On 04/12/12 17:26, Domingo Alvarez Duarte wrote:
> I was thinking of only have the minimun on an Fl_Tree_item and derived  
> ones to each specific task.
>
> Lets say:
> 
> class Fl_Tree_Item {
>    char                    _open;             // item is open?
>    char                    _visible;          // item is visible?
>    char                    _active;           // item activated?
>    char                    _selected;         // item selected?
>    Fl_Tree_Item_Array      _children;         // array of child items
>    Fl_Tree_Item           *_parent;           // parent item (=0 if root)
> #if FLTK_ABI_VERSION >= 10302
>    Fl_Tree_Item           *_prev_sibling;     // previous sibling (same level)
>    Fl_Tree_Item           *_next_sibling;     // next sibling (same level)
> #endif /*FLTK_ABI_VERSION*/
> }

        Ah, OK, cool, I can see using that as the base class,
        and then deriving some classes from it to cover Fl_Widget*,
        icons, text, label colors, etc.

        I see.

        I don't think you can remove xywh[4] though; that's needed
        for the item to know where it is in the tree without having
        to re-calculate it dynamically (which is nontrivial, since an
        item's position is based on the sizes of all the items above it,
        and whether they're on or off)

        By my count you're saving about 61 bytes per item in a 32bit app:

                1 char (_label)
                4 ints (for font/size/fg/bg color)
                4 ints (for label_xywh[4]
                4 ints (for collapse_xywh[4]
                3 pointers (for widget, usericon, and userdata)

        ..which doesn't sound like much, but I suppose with 80,000 items,
        that'd save about 4MB if none of that was needed.

        I'll look into it to see if this can be done.

        Thing is, it might break the existing API, not sure.
        Might have to delay that until 3.x.

_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to