Author: matt
Date: 2012-05-16 13:23:20 -0700 (Wed, 16 May 2012)
New Revision: 9505
Log:
Fixed some more Fluid3 interactive resizing
Modified:
branches/branch-3.0/fluid/Fl_Group_Type.cxx
branches/branch-3.0/fluid/Fl_Type.cxx
branches/branch-3.0/fluid/Fl_Type.h
branches/branch-3.0/fluid/Fl_Window_Type.cxx
Modified: branches/branch-3.0/fluid/Fl_Group_Type.cxx
===================================================================
--- branches/branch-3.0/fluid/Fl_Group_Type.cxx 2012-05-16 19:44:05 UTC (rev
9504)
+++ branches/branch-3.0/fluid/Fl_Group_Type.cxx 2012-05-16 20:23:20 UTC (rev
9505)
@@ -50,6 +50,7 @@
}
void fix_group_size(Fl_Type *tt) {
+#if 0
if (!tt || !tt->is_group()) return;
Fl_Group_Type* t = (Fl_Group_Type*)tt;
int X = t->o->x();
@@ -59,12 +60,48 @@
for (Fl_Type *nn = t->next; nn && nn->level > t->level; nn = nn->next) {
if (!nn->is_widget() || nn->is_menu_item()) continue;
Fl_Widget_Type* n = (Fl_Widget_Type*)nn;
- int x = n->o->x(); if (x < X) X = x;
- int y = n->o->y(); if (y < Y) Y = y;
+ int x = n->o->x(); if (x < X) X = x;
+ int y = n->o->y(); if (y < Y) Y = y;
int r = x+n->o->w();if (r > R) R = r;
int b = y+n->o->h();if (b > B) B = b;
}
t->o->resize(X,Y,R-X,B-Y);
+#else
+ if (!tt || !tt->is_group()) return;
+ Fl_Group_Type* t = (Fl_Group_Type*)tt;
+ fltk3::Group* g = (fltk3::Group*)t->o;
+ int X = g->x(), X0=X;
+ int Y = g->y(), Y0=Y;
+ int R = g->r();
+ int B = g->b();
+
+ for (Fl_Type *nn = t->first_child(); nn; nn = nn->next_brother()) {
+ if (nn->is_widget()) {
+ fltk3::Widget* o = ((Fl_Widget_Type*)nn)->o;
+ int x = o->x(); if (x+X0 < X)
+ X = x+X0;
+ int y = o->y(); if (y+Y0 < Y) Y = y+Y0;
+ int r = o->r(); if (r+X0 > R)
+ R = r+X0;
+ int b = o->b(); if (b+Y0 > B) B = b+Y0;
+ }
+ }
+
+ int dx = X - X0, dy = Y-Y0;
+ g->resize(X,Y,R-X,B-Y);
+ if (dx || dy) {
+ for (Fl_Type *nn = t->first_child(); nn; nn = nn->next_brother()) {
+ if (nn->is_widget()) {
+ fltk3::Widget* o = ((Fl_Widget_Type*)nn)->o;
+ o->x(o->x()-dx);
+ o->y(o->y()-dy);
+ }
+ }
+ }
+
+ g->init_sizes();
+ fix_group_size(t->parent );
+#endif
}
extern int force_parent;
Modified: branches/branch-3.0/fluid/Fl_Type.cxx
===================================================================
--- branches/branch-3.0/fluid/Fl_Type.cxx 2012-05-16 19:44:05 UTC (rev
9504)
+++ branches/branch-3.0/fluid/Fl_Type.cxx 2012-05-16 20:23:20 UTC (rev
9505)
@@ -546,6 +546,26 @@
}
}
+
+Fl_Type *Fl_Type::first_child() {
+ if (next && next->level==this->level+1) {
+ return next;
+ } else {
+ return 0L;
+ }
+}
+
+
+Fl_Type *Fl_Type::next_brother() {
+ Fl_Type *n = next;
+ for (;;) {
+ if (!n || n->level>=this->level) return 0L;
+ if (n->level==this->level) return n;
+ n = n->next;
+ }
+}
+
+
// turn a click at x,y on this into the actual picked object:
Fl_Type* Fl_Type::click_test(int,int) {return 0;}
void Fl_Type::add_child(Fl_Type*, Fl_Type*) {}
Modified: branches/branch-3.0/fluid/Fl_Type.h
===================================================================
--- branches/branch-3.0/fluid/Fl_Type.h 2012-05-16 19:44:05 UTC (rev 9504)
+++ branches/branch-3.0/fluid/Fl_Type.h 2012-05-16 20:23:20 UTC (rev 9505)
@@ -129,6 +129,8 @@
int level; // number of parents over this
static Fl_Type *first, *last; // linked list of all objects
Fl_Type *next, *prev; // linked list of all objects
+ Fl_Type *first_child();
+ Fl_Type *next_brother();
Fl_Type *factory;
const char *callback_name();
Modified: branches/branch-3.0/fluid/Fl_Window_Type.cxx
===================================================================
--- branches/branch-3.0/fluid/Fl_Window_Type.cxx 2012-05-16 19:44:05 UTC
(rev 9504)
+++ branches/branch-3.0/fluid/Fl_Window_Type.cxx 2012-05-16 20:23:20 UTC
(rev 9505)
@@ -1187,7 +1187,7 @@
// don't move any children, whether selected or not:
Fl_Type* p;
for (p = myo->next; p && p->level>myo->level; p = p->next) {
- if (pDragMode & (LEFT|TOP|RIGHT|BOTTOM)) {
+ if (pDragMode & (LEFT|TOP)) {
if (p->is_widget() && !p->is_menu_item()) {
Fl_Widget_Type* myo2 = (Fl_Widget_Type*)p;
myo2->o->position(myo2->o->x()+dx, myo2->o->y()+dy);
@@ -1199,10 +1199,8 @@
i = i->next;
}
}
- /*
for (i=next; i && i->level>level; i=i->next)
fix_group_size(i);
- */
o->redraw();
pRecalculateSelectionBox = 1;
((Overlay_Window *)(this->o))->redraw_overlay();
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit