summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fluid/Fl_Group_Type.cxx48
-rw-r--r--fluid/Fl_Window_Type.h13
-rw-r--r--fluid/Shortcut_Button.cxx5
3 files changed, 40 insertions, 26 deletions
diff --git a/fluid/Fl_Group_Type.cxx b/fluid/Fl_Group_Type.cxx
index d83d7fa2d..44b83e82b 100644
--- a/fluid/Fl_Group_Type.cxx
+++ b/fluid/Fl_Group_Type.cxx
@@ -315,30 +315,32 @@ void Fl_Flex_Type::remove_child(Fl_Type* a) {
// We need to relayout existing children.
void Fl_Flex_Type::change_subtype_to(int n) {
Fl_Flex* f = (Fl_Flex*)o;
- int nc = f->children();
- if (f->type()==n || nc==0) return;
+ if (f->type()==n) return;
- int dw = Fl::box_dw(f->box());
- int dh = Fl::box_dh(f->box());
- int lm, tm, rm, bm;
- f->margins(&lm, &tm, &rm, &bm);
- int gap = f->gap();
- int fw = f->w()-dw-lm-rm-(nc*gap);
- if (fw<=nc) fw = nc; // avoid division by zero
- int fh = f->h()-dh-tm-bm-(nc*gap);
- if (fh<=nc) fh = nc; // avoid division by zero
-
- if (f->type()==Fl_Flex::HORIZONTAL && n==Fl_Flex::VERTICAL) {
- float scl = (float)fh/(float)fw;
- for (int i=0; i<nc; i++) {
- Fl_Widget* c = f->child(i);
- c->size(f->w(), (int)(c->w()*scl));
- }
- } else if (f->type()==Fl_Flex::VERTICAL && n==Fl_Flex::HORIZONTAL) {
- float scl = (float)fw/(float)fh;
- for (int i=0; i<nc; i++) {
- Fl_Widget* c = f->child(i);
- c->size((int)(c->h()*scl), f->h());
+ int nc = f->children();
+ if (nc > 0) {
+ int dw = Fl::box_dw(f->box());
+ int dh = Fl::box_dh(f->box());
+ int lm, tm, rm, bm;
+ f->margins(&lm, &tm, &rm, &bm);
+ int gap = f->gap();
+ int fw = f->w()-dw-lm-rm-(nc*gap);
+ if (fw<=nc) fw = nc; // avoid division by zero
+ int fh = f->h()-dh-tm-bm-(nc*gap);
+ if (fh<=nc) fh = nc; // avoid division by zero
+
+ if (f->type()==Fl_Flex::HORIZONTAL && n==Fl_Flex::VERTICAL) {
+ float scl = (float)fh/(float)fw;
+ for (int i=0; i<nc; i++) {
+ Fl_Widget* c = f->child(i);
+ c->size(f->w(), (int)(c->w()*scl));
+ }
+ } else if (f->type()==Fl_Flex::VERTICAL && n==Fl_Flex::HORIZONTAL) {
+ float scl = (float)fw/(float)fh;
+ for (int i=0; i<nc; i++) {
+ Fl_Widget* c = f->child(i);
+ c->size((int)(c->h()*scl), f->h());
+ }
}
}
f->type(n);
diff --git a/fluid/Fl_Window_Type.h b/fluid/Fl_Window_Type.h
index 41cf73f4b..05a2777ca 100644
--- a/fluid/Fl_Window_Type.h
+++ b/fluid/Fl_Window_Type.h
@@ -67,7 +67,18 @@ protected:
public:
- Fl_Window_Type() { drag = dx = dy = 0; sr_min_w = sr_min_h = sr_max_w = sr_max_h = 0; }
+ Fl_Window_Type() :
+ mx(0), my(0),
+ x1(0), y1(0),
+ bx(0), by(0), br(0), bt(0),
+ sx(0), sy(0), sr(0), st(0),
+ dx(0), dy(0),
+ drag(0),
+ numselected(0),
+ recalc(0),
+ modal(0), non_modal(0),
+ sr_min_w(0), sr_min_h(0), sr_max_w(0), sr_max_h(0)
+ { }
uchar modal, non_modal;
Fl_Type *make(Strategy strategy);
diff --git a/fluid/Shortcut_Button.cxx b/fluid/Shortcut_Button.cxx
index 517eee624..9c64b760a 100644
--- a/fluid/Shortcut_Button.cxx
+++ b/fluid/Shortcut_Button.cxx
@@ -283,14 +283,15 @@ int Fluid_Coord_Input::eval(uchar *&s, int prio) const {
} else {
return v; // syntax error
}
- c = *s++;
+ c = *s;
+ if (c) s++;
}
return v;
}
/**
Evaluate a formula into an integer.
- The interpreter understand unary plus and minus, basic integer math
+ The interpreter understands unary plus and minus, basic integer math
(+, -, *, /), brackets, and can handle a user defined list of variables
by name. There is no error checking. We assume that the formula is
entered correctly.