Re: [fltk.bugs] [MOD] STR #2795: Fl_Tree: needs to be optimized to handle very large contents (>10000)
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR Pending] Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.4-feature (r9232) @Domingo: OK, r9355 should take care of not drawing items outside the Fl_Tree viewport when the items are FLTK widgets. I've included a new example as well, to both demonstrate how to make items that are FLTK widgets, and exercise the widget with a very large tree: example/tree-as-container.cxx This example creates 50,000 items, each item containing 5 Fl_Input widgets contained in an Fl_Group. So 50k x (5+1) = 300k widgets. I purposefully chose a large enough number that I could /see/ slight slowness on my dev box (1.8GHz dual intel running centos 5.6) so that any inefficiencies would be obvious. I didn't have time test on windows, but runs well on linux + mac. Or at least, as well as FLTK can handle 300k widgets. Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.4-feature (r9232) ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2795: Fl_Tree: needs to be optimized to handle very large contents (>10000)
Today I received another email from Jason Bryan telling me where on the sourceforge he hosted the latest FLU code: http://sourceforge.net/projects/flufltk/?source=directory And there the license file clearly say that FLU uses the same license as FLTK and can be static linked with close sourced applications without forcing then to make their code public. ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2795: Fl_Tree: needs to be optimized to handle very large contents (>10000)
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR Pending] Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.4-feature (r9232) Also, when looking for selected nodes and checking if node is already selected it seems, that we traverse all nodes instead of , as an example, inspecting a selected node list. Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.4-feature (r9232) ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2795: Fl_Tree: needs to be optimized to handle very large contents (>10000)
Hello ! I'm looking to update the FLU - FLTK Utility Widgets to work with FLTK 1.3 (the latest) and also to use it if I the license can be extended to allow static linking as exception to the LGPL (I mean to have the same license exeption the FLTK has). If what I'm asking is possible do you have any objection to some of the FLU widgets be added to the official FLTK and be maintained there ? I can also with your permition and the license exception mentioned open a project on code.google.com to publish the actualized FLU. Thanks for your attention and great work ! -Reply from Jason Bryan the FLU author- Hi Domingo Go for it. I can't promise the code is neat and tidy and bug-free (I started it more than a decade ago when I was much younger ;) but if it is helpful to you I'm happy to hear it. I created the widgets at a time when fltk and GUI design was much worse than it is today, so some things may not be worth the trouble. But I certainly have no time to spend on it so be my guest. Last year in a cleaning/reorganization of my source I uploaded it to sourceforge for posterity so check there too. I'm sure that code is newer than the archive at osc although the internal version may not reflect it. Good luck! ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2795: Fl_Tree: needs to be optimized to handle very large contents (>10000)
Also there is one static variable inside Fl_Tree::handle that is a bug waiting to wakeup if someone try to make some kind of master detail with two or more Fl_Trees: static Fl_Tree_Item *lastselect = 0; ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2795: Fl_Tree: needs to be optimized to handle very large contents (>10000)
Do you mean something like Flu_Tree_Browser for FLU widgets ? ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2795: Fl_Tree: needs to be optimized to handle very large contents (>10000)
Where is it's repository for 1.4-feature (r9232) ? And yes I tested it and it's drawing everything all the time. even when we only scroll it by only one line. > > Link: http://www.fltk.org/str.php?L2795 > Version: 1.3-current > Fix Version: 1.4-feature (r9232) ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2795: Fl_Tree: needs to be optimized to handle very large contents (>10000)
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR Pending] Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.4-feature (r9232) @Domingo: Yes, optimization in this case was wrt the tree being used to contain its native 'items', and not as a container for Fl_Widgets. So the native items are optimized: they aren't drawn if they're outside the viewing window. But I think you're right if the tree is a container for Fl_Widgets, currently all of those widgets are being drawn regardless. This is because it's letting Fl_Group handle drawing them (when Fl_Tree::draw() calls draw_children()). It should probably have its own children() loop that checks the xywh of each child, and only draw it if it's inside the scrolled position (probably similar to what Fl_Scroll does). Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.4-feature (r9232) ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2795: Fl_Tree: needs to be optimized to handle very large contents (>10000)
On 12.04.2012, at 15:34, Domingo Alvarez Duarte wrote: > Also would be a nice feature to allow inheritance of Fl_Tree and > Fl_Tree_Item, actually Fl_Tree do not allow insertion of custom > Fl_Tree_Items, also support for virtual widgets instead of one widget per > node. For FLTK3, Fl_tree should be a specialized group and Fl_Tree_Item should be any possible widget, including a Group. If done correctly, this will keep Fl_Tree in line with the hierarchical design of FLTK. Greg, what do you think? - Matthias ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2795: Fl_Tree: needs to be optimized to handle very large contents (>10000)
Also would be a nice feature to allow inheritance of Fl_Tree and Fl_Tree_Item, actually Fl_Tree do not allow insertion of custom Fl_Tree_Items, also support for virtual widgets instead of one widget per node. ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2795: Fl_Tree: needs to be optimized to handle very large contents (>10000)
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR Pending] Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.4-feature (r9232) Fl_Tree is drawing all it's nodes even when they are not visible, with this discussion about optimizing Fl_Tree this topic was not touched ? Is it possible to only draw (or call the draw on a childreen) that is not visible (by visible I mean it's outside the visible viewport) ? Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.4-feature (r9232) ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2795: Fl_Tree: needs to be optimized to handle very large contents (>10000)
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR Pending] Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.4-feature (r9232) OK, I've checked in a few more mods to fix the selection slowness issue on very large trees as mentioned by Dave. See r9231 and r9232. (Or just upgrade to r9232) Since this fix breaks FLTK's ABI, it's ifdef'ed out by default in the 1.3.x series, and won't be enabled by default until 1.4.0. So to make use of this fix during the 1.3.x series of releases, you'll need to: 1) Add: #define FLTK_ABI_FEATURE 10302 ..to FL/Enumerations.H and rebuild FLTK 2) Rebuild your app /statically/ with FLTK. Do NOT build your app against FLTK dll's if using this feature! Bumping this STR to "1.4-feature" and leaving it open, so that when 1.4.0 comes out, this fix will be included in default builds. Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.4-feature (r9232) ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2795: Fl_Tree: needs to be optimized to handle very large contents (>10000)
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR Pending] Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.3-current (r9217) Albrecht: see my reply in fltk.bugs, along with an RFC that might make ABI breaking code a possible option for users + devs. Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.3-current (r9217) ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2795: Fl_Tree: needs to be optimized to handle very large contents (>10000)
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR Pending] Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.3-current (r9217) I tested fltree.patch in Windows with the tree-100k.cxx sample code and my application. It worked fine. Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.3-current (r9217) ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2795: Fl_Tree: needs to be optimized to handle very large contents (>10000)
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR Pending] Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.3-current (r9217) Looks like fltree.patch would break the ABI, so we can probably not apply this in fltk 1.3.x. The patch adds new members to class Fl_Tree_Item: + Fl_Tree_Item *_prev_sibling; // previous sibling (same level) + Fl_Tree_Item *_next_sibling; // next sibling (same level) Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.3-current (r9217) ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2795: Fl_Tree: needs to be optimized to handle very large contents (>10000)
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR Pending] Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.3-current (r9217) Attached a patch (fltree.patch) to address slowness when selecting items in the 100k test program. Thanks to David Fleury for his patch that gave a good starting point. I'm posting this here for people to try, as its late and I don't want to commit it to SVN until I've done more testing tomorrow. Please follow up here if you have comments regarding this patch. Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.3-current (r9217) ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2795: Fl_Tree: needs to be optimized to handle very large contents (>10000)
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR Pending] Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.3-current (r9217) Attached file "fltree.patch"... Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.3-current (r9217)Index: src/Fl_Tree_Item_Array.cxx === --- src/Fl_Tree_Item_Array.cxx (revision 9216) +++ src/Fl_Tree_Item_Array.cxx (working copy) @@ -53,6 +53,9 @@ for ( int t=0; t_total; t++ ) { _items[t] = new Fl_Tree_Item(o->_items[t]); } + for ( int t=0; t_total; t++ ) { +_items[t]->update_prev_next(t); + } } /// Clear the entire array. @@ -108,6 +111,7 @@ } _items[pos] = new_item; _total++; + _items[pos]->update_prev_next(pos); // adjust item's prev/next and its neighbors } /// Add an item* to the end of the array. @@ -125,13 +129,20 @@ /// The item will be delete'd (if non-NULL), so its destructor will be called. /// void Fl_Tree_Item_Array::remove(int index) { - if ( _items[index] ) { // delete if non-zero + if ( _items[index] ) { // delete if non-zero delete _items[index]; } _items[index] = 0; - for ( _total--; index<_total; index++ ) { -_items[index] = _items[index+1]; + _total--; + for ( int i=index; i<_total; i++ ) { // reshuffle array +_items[i] = _items[i+1]; } + if ( index < _total ) { // removed item not last? +_items[index]->update_prev_next(index);// update next item's prev/next and neighbors + } else if ( ((index-1) >= 0) && // removed item IS last? +((index-1) < _total)) { +_items[index-1]->update_prev_next(index-1);// update prev item's prev/next and neighbors + } } /// Remove the item from the array. @@ -148,6 +159,16 @@ return(-1); } +/// Swap the two items at index positions \p ax and \p bx. +void Fl_Tree_Item_Array::swap(int ax, int bx) { + Fl_Tree_Item *asave = _items[ax]; + _items[ax] = _items[bx]; + _items[bx] = asave; + // Adjust prev/next ptrs + _items[ax]->update_prev_next(ax); + _items[bx]->update_prev_next(bx); +} + // // End of "$Id$". // Index: src/Fl_Tree_Item.cxx === --- src/Fl_Tree_Item.cxx(revision 9217) +++ src/Fl_Tree_Item.cxx(working copy) @@ -61,6 +61,8 @@ _usericon = 0; _userdata = 0; _parent = 0; + _prev_sibling = 0; + _next_sibling = 0; } // DTOR @@ -101,6 +103,8 @@ _usericon = o->usericon(); _userdata = o->user_data(); _parent = o->_parent; + _prev_sibling = 0; // do not copy ptrs! use update_prev_next() + _next_sibling = 0; // do not copy ptrs! use update_prev_next() } /// Print the tree as 'ascii art' to stdout. @@ -108,8 +112,9 @@ /// void Fl_Tree_Item::show_self(const char *indent) const { if ( label() ) { -printf("%s-%s (%d children, this=%p, parent=%p depth=%d)\n", - indent,label(),children(),(void*)this, (void*)_parent, depth()); +printf("%s-%s (%d children, this=%p, parent=%p, prev=%p, next=%p, depth=%d)\n", + indent,label(),children(),(void*)this, (void*)_parent, + _prev_sibling, _next_sibling, depth()); } if ( children() ) { char *i2 = (char*)malloc(strlen(indent) + 2); @@ -794,9 +799,8 @@ return(c->child(0)); } while ( ( p = c->parent() ) != NULL ) { // loop upwards through parents -int t = p->find_child(c); // find our position in parent's children[] array -if ( ++t < p->children() ) // not last child? - return(p->child(t)); // return next child +if ( c->_next_sibling )// not last child? + return(c->_next_sibling);// return next child c = p; // child becomes parent to move up generation }// loop: moves up to next parent return(0); // hit root? done @@ -832,14 +836,28 @@ /// \returns item's next sibling, or 0 if none. /// Fl_Tree_Item *Fl_Tree_Item::next_sibling() { - if ( !parent() ) return(0); // No parent (root)? We have no siblings - int index = parent()->find_child(this); // find our position in parent's child() array - if ( index == -1 ) return(0);// parent doesn't know us? weird - if ( (index+1) < parent()->children() ) // is there a next child? -return(parent()->child(index+1)); // return next child if there's one below us - return(0); // no siblings below us + return(_next_sibling); } +/// Update our _prev_sibling and _next_sibling pointers to point to
Re: [fltk.bugs] [MOD] STR #2795: Fl_Tree: needs to be optimized to handle very large contents (>10000)
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR Pending] Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.3-current (r9217) Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.3-current (r9217) ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2795: Fl_Tree: needs to be optimized to handle very large contents (>10000)
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR Pending] Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.3-current (r9217) Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.3-current (r9217) ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2795: Fl_Tree: needs to be optimized to handle very large contents (>10000)
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR Pending] Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.3-current (r9216) Christophe reported a clipping problem with vertical connectors between far away items in the tree, which should now be solved by r9217. Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.3-current (r9216) ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2795: Fl_Tree: needs to be optimized to handle very large contents (>10000)
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR Active] Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.3-current (r9216) Should be fixed in r9216. Leaving this open to see how it goes. I tested with the attached code (tree-100k.cxx) that creates 100k items which is entirely unusable in r9215 and lower, but should be quite normal in r9216 and up. There is still a practical limit on the number of items that can be in the tree; draw() will still /consider/ (ie. do calculations on) items that are not hidden (ie. open() and visible()), but at least it won't try to /draw/ items unless they're inside the window. Link: http://www.fltk.org/str.php?L2795 Version: 1.3-current Fix Version: 1.3-current (r9216)#include #include #include int main( int argc, char **argv) { Fl_Double_Window *w = new Fl_Double_Window(900,300); Fl_Tree *b = new Fl_Tree(10,10,w->w()-20,w->h()-20); char s[80]; for ( int t=0; t<10; t++ ) { sprintf(s, "Entry #%06d", t); b->add(s); if ( t % 50 == 0 ) printf("Working on %d\n", t); } w->resizable(b); w->end(); w->show(); return(Fl::run()); } ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs