Commit Graph

70 Commits

Author SHA1 Message Date
Greg Ercolano
0291b48a73 Fix slowness due to not clipping (#1014) 2024-07-21 10:20:13 -07:00
Greg Ercolano
3e9c77b62a Fix Fl_Tree related -Wall warnings 2024-07-17 10:29:49 -07:00
Greg Ercolano
f950b93e9c Added is_visible_r() for consistency w/is_visible() 2024-07-17 10:20:39 -07:00
Greg Ercolano
6ed7b56c79 Fix warning (#1008) 2024-07-09 11:00:52 -07:00
Greg Ercolano
6776f89872 Fix horiz connection lines (#1008) 2024-07-08 12:13:44 -07:00
Cyprinus Carpio
a69c5c5c92
Fl_Tree +/- buttons are no longer drawn using bitmaps, different default line color (#995)
Fl_Tree changed to support system color themes (PR #995)

merging CyprinusCarpio's mods carried over from from issue #972.

* Fl_Tree: use named (colormap) colors to support system color themes (see issue #972). changed connectorcolor() default from gray ramp color to FL_INACTIVE_COLOR (Fl_Color(8)), and similar named colormap colors for icon drawing.

* Fl_Tree ⊞ / ⊟ icons (and on macs, ▶ / ▼icons) are now drawn w/fl_draw() functions instead of with xpm bitmaps for colormap control

---------
Co-authored-by: Greg Ercolano <erco@seriss.com>
2024-06-30 09:08:00 -07:00
Matthias Melcher
281ec24c8f Box types can now defined and draw their own focus frame, STR 2145, #659 2024-04-26 12:42:11 +02:00
Albrecht Schlosser
0bd156e219 Fix buffer overflow in Fl_Tree_Item::show_self() 2023-01-12 00:06:05 +01:00
Greg Ercolano
6d3071b859 Small doc improvements for Fl_Tree_Item. 2022-03-09 06:12:42 -08:00
Albrecht Schlosser
92e9181a0a Rename FL/fl_string.h to FL/fl_string_functions.h
This is part 1 of the final fix for a previous name clash on case
insensitive file systems (fl_string.h vs. Fl_String.H).
2022-01-16 19:47:16 +01:00
Greg Ercolano
36af6a5729 Solves Fl_Tree focus box artifacts on linux - fixes issue #299.
Nabbed the current code from Fl_Widget::draw_focus() which solves.
2021-11-27 10:20:47 -08:00
Greg Ercolano
2141c63628 Implement + deploy fl_strdup() 2020-08-01 14:19:40 -07:00
Albrecht Schlosser
f09e17c3c5 Remove $Id$ tags, update URL's, and more
- remove obsolete svn '$Id$' tags from all source files
- update .fl files and generated files accordingly
- replace 'http://www.fltk.org' URL's with 'https://...'
- replace bug report URL 'str.php' with 'bugs.php'
- remove trailing whitespace
- fix other whitespace errors flagged by Git
- add and/or fix missing or wrong standard headers
- convert tabs to spaces in all source files

The only relevant code changes are in the fluid/ folder where
some .fl files and other source files were used to generate
the '$Id' headers and footers.
2020-07-06 20:28:20 +02:00
Greg Ercolano
62e39e5559 Added new method Fl_Tree_Item::event_on_item() 2019-08-27 16:53:57 -07:00
Greg Ercolano
3340b33bf1 Added NULL checks in Fl_Tree_Item::move() 2019-08-27 16:46:36 -07:00
Greg Ercolano
4870cde0a6 More fixes for STR #3527; handle usericons, etc 2019-08-25 01:13:35 -07:00
Matthias Melcher
452a410a3e STR #2714: remove new shadow lint for MacOS 2019-02-02 17:47:55 +01:00
Albrecht Schlosser
2c5ba94458 Fix Fl_Tree::insert() with pos out ouf range (#18)
The given position to insert a new item was not checked  against the
valid range so the program  could crash if a position less than zero
or greater than children() was given. The position is now clamped to
the valid range, i.e. the item is either prepended or appended.

Fixes issue #18.
2019-01-25 17:40:51 +01:00
Greg Ercolano
c7080e826e General description: mention how to move items around
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12824 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-04-10 18:37:18 +00:00
Greg Ercolano
e92fa6914b Bringing over fix [r11840] from 1.3 current to the porting branch.
Solves STR#3294; added methods to let user set the userdeicon,
and removed the performance degrading automatic deicon creation.



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11841 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-07-21 00:51:14 +00:00
Manolo Gouy
7a580fd421 Remove FL_ABI_VERSION clauses from the Fl_Tree class source code
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11602 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-13 19:18:56 +00:00
Greg Ercolano
91e747bbda Carrying over r11173 fix to the new 1.3 porting branch.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11362 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-03-14 17:20:59 +00:00
Matthias Melcher
5d1df0e789 Details on PORTME items. Move fl_parse_color() to screen drivers.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11163 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-02-13 12:57:00 +00:00
Matthias Melcher
50ee3bcd66 Mark places that need to be refactored with // PORTME:
Searching for __APPLE, WIN32 or X11 did give me many false results. I instead marked most ifdef's that I would like to get rid of with the text // PORTME:, so they can be easily found by a global search.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11155 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-02-11 12:02:36 +00:00
Greg Ercolano
aa9b326b56 Fixes STR 3234
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10773 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-06-23 16:36:47 +00:00
Greg Ercolano
81654d15eb Fl_Tree: improved draw() behavior when deactivated;
icons draw deactivated now. 

test/tree: Added 'deactivate tree' button to test
deactivating entire widget.



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10723 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-04-28 19:39:53 +00:00
Greg Ercolano
f722272921 Small doc fixes as recommended by Albrecht,
who is currently proofreading the Fl_Tree docs/code.



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10700 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-04-13 17:00:26 +00:00
Greg Ercolano
1f7eb7bc4e Fix return value test, as pointed out by Albrecht.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10699 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-04-13 16:55:27 +00:00
Greg Ercolano
a7dc3ea9e2 Fix problem with *horiz* dot pattern alignment,
optimized draw loop, fixed indent.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10497 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-12-19 05:55:08 +00:00
Greg Ercolano
67341668f8 Optimize drawing loop, fix indent.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10496 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-12-19 05:48:50 +00:00
Greg Ercolano
ce1ab7e1ce Fixes to how new move() operations handle the concept
of 'above' and 'below' when referring to items instead
of index positions.

Small offsets needed due to how the arrays are scrolled
after a move operation.



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10272 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-09-05 02:59:00 +00:00
Greg Ercolano
107fc50e48 Solves STR #3127.
Added to assist cand for his patch to solve RFE STR #2828 option (I).

o Add move() methods to Fl_Tree_Item.
o Add deparent()/reparent() methods
o Supporting methods added to Fl_Tree_Item_Array, and enhancement
  to update_prev_next() to allow -1 option to create an orphan item

Added to Fl_Tree_Item:

    * Fl_Tree_Item* deparent(int pos)
    * int reparent(Fl_Tree_Item *newchild, int pos)

    * int move(int to, int from)
    * int move(Fl_Tree_Item *item, int op, int pos)
    * int move_above(Fl_Tree_Item *item)
    * int move_below(Fl_Tree_Item *item)
    * int move_into(Fl_Tree_Item *item, int pos)

Added to Fl_Tree_Item_Array:

    * int move(int to, int from)
    * int deparent(int pos)
    * int reparent(Fl_Tree_Item *item, Fl_Tree_Item* newparent, int pos)



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10271 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-09-04 18:56:52 +00:00
Greg Ercolano
1ba5c254f5 More Fl_Tree doc improvements.
Only docs changed here, no code changed..
one method's definition moved to match similar method organization.

Some redundant docs (for const vs. non-const) changed
by referring the non-const method to the const one, to reduce size.



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10081 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-01-24 19:03:15 +00:00
Greg Ercolano
abdc834705 o Added draw_item_content() to Fl_Tree_Item,
a volatile method that can be overridden by
  subclasses to take drawing control of tree item's content.

  This replaces the old "item_draw_callback()" technique
  added a few months ago as an ABI feature; turned out the
  new technique is a better way to go.

o The examples/tree-custom-draw-items.cxx demo adjusted
  accordingly.

o Added missing docs for some methods that had none,
  including label_[xywh]().

o Added related methods needed to implement this, including:
  	Fl_Tree_Item_Array::replace()
  	Fl_Tree_Item::replace()
	Fl_Tree::root(item)
        Fl_Tree::add() variations
	Fl_Tree_Item::drawbgcolor()/drawfgcolor()


o Carefully worked the FLTK_ABI_VERSION macros so as to be
  ABI compatible with 1.3.0.

o Verified 1.3.0 ABI compatibility with ABI Compliance Checker 1.99.8.5:
  http://ispras.linuxbase.org/index.php/ABI_compliance_checker




git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10071 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-01-20 21:23:24 +00:00
Greg Ercolano
b849a1d2d9 ABI fixes.
These are problems "ABI Compliance Checker" found with the recent
Fl_Tree mods.



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10062 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-01-16 00:58:58 +00:00
Greg Ercolano
6beedf4c28 Fix small memleak in Fl_Tree::show_self() [used only for debugging anyway]
and convert from malloc/free -> new/delete



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10055 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-01-14 01:08:40 +00:00
Greg Ercolano
a4550ade99 * Fixes STR#3024 issue with Fl_Tree::find_item()
* Removes redundant const vs. non-const code
  using technique from Scott Meyers' book "Effective C++", 3rd Ed.



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10038 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2013-12-28 22:26:22 +00:00
Greg Ercolano
d36882e67e Adds horizontal scrollbar to Fl_Tree as an ABI 1.3.3 feature.
***************************************************************
NOTE: You MUST uncomment the FLTK_ABI_VERSION in Enumerations.H
      to use these changes.
***************************************************************

Also: separated tree size calculation from draw() code,
so that one can cause the tree to recalculate immediately
after making modifications to the tree by calling Fl_Tree::calc_tree().

Numerous improvements to docs for the tree as well, enough
to create a rather large diff.

Large internal changes were needed to do this properly.
The following was added to the CHANGES file:

	- Fl_Tree: various related changes:
	    o Added horizontal scrollbar
	    o Separated draw() and tree size calculation
	    o Added new public methods:
	        > resize()           -- uses optimized dim calc, avoids tree recalc
		> next_item()        -- added parameters: direction, visibility
		> extend_selection() -- added parameters, improved algorithm
		> calc_dimensions()  -- calc tix/y/w/h, tox/y/w/h and scrollbars
		> calc_tree()        -- calc tree_w/tree_h
		> recalc_tree()      -- schedules calc_tree()
		> first_visible_item(), last_visible_item(), next_visible_item()
		> first_selected_item(), last_selected_item(), next_selected_item()
	    o Added protected variables:
	        > _tix/y/w/h      -- tree widget 'inner' dimension
		> _tox/y/w/h      -- tree widget 'outer' dimension
		> _tree_w,_tree_h -- entire tree hierarchy width/height
	    o Deprecated:
	        > item_clicked() -- use callback_item() instead
		> first_visible() -- use first_visible_item() instead
		> last_visible() -- use last_visible_item() instead

	- Fl_Tree_Item: various related changes:
	    o Added Fl_Tree ptr: needed for auto-recalc when item modified directly
	    o Added new methods tree(), recalc_tree()
	    o Added new ctor that accepts Fl_Tree*
	    o draw() parameters changed to include tree size calculations
	    o Deprecated:
	       > ctor using Fl_Tree_Prefs parameter (Fl_Tree* version better,
	         and must be used for 1.3.3 ABI features to work correctly)
	       > next_displayed() -- use next_visible() instead
	       > prev_displayed() -- use prev_visible() instead

	- test/tree: added tests for newly added features




git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10034 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2013-12-15 18:59:02 +00:00
Greg Ercolano
88cea3c82d o Added Fl_Tree::item_draw_callback(), letting one define a custom draw function for Fl_Tree_Item's.
o Added examples/tree-custom-draw-items.cxx to demonstrate its use.
o Fixed small doc error for recent Fl_Tree::get_selected_items()



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10018 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2013-11-10 04:33:44 +00:00
Greg Ercolano
33ab9cfed1 Fl_Tree:
o Added new method Fl_Tree::get_selected_items()
	o Modified Fl_Tree_Item_Array to usable in a general way (i.e. beyond Fl_Tree's internal use)



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10016 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2013-11-06 20:44:47 +00:00
Greg Ercolano
67ed1a8da9 STR# #2973: applied patch str_2973_r9958_sun-fix-errors-5.patch verbatim.
src/Fl_Tree_Item.cxx -- solve: "Fl_Tree_Item.cxx",    line 614: Error: Initializing int& requires an lvalue.
    FL/Fl_Preferences.H  -- solve: "FL/Fl_Preferences.H", line 196: Error: Fl_Preferences::RootNode is not accessible from 0
    FL/Fl_Tree_Item.H    -- solve: "Fl_Tree_Item.cxx",    line 614: Error: Initializing int& requires an lvalue.
    test/unittests.cxx   -- solve: "unittests.cxx",        line 95: Error: The type "UnitTest*[]" is incomplete.
            


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9978 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2013-09-16 20:25:14 +00:00
Matthias Melcher
78039ecb55 Replaced 10302 with 10301 for FLTK_ABI_VERSION
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9706 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2012-11-06 20:46:14 +00:00
Greg Ercolano
df5c8cc76f Fixed some keynav problems:
No focus, hitting down would skip first item
    Enter key to toggle was falling through to other widgets
    Removing an item that has focus clears item focus (to prevent wild ptr)

Added new methods:
	Fl_Tree::get_item_focus()
	Fl_Tree::first_visible()
	Fl_Tree::last_visible()
	Fl_Tree::is_vscroll_visible()

Simplified + fixed Fl_Tree_Item::next_displayed()

Fixed Fl_Tree_Item::visible_r(), was skipping item if it was a closed branch.

tree demo: fixed button ordering for "Test Suggestions" button



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9555 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2012-05-29 13:34:39 +00:00
Greg Ercolano
31f320e2c6 o Added new 0xffffffff 'transparent' color behavior for the item's bg color;
with this as the default color, Fl_Tree::color() can control the tree's background.
  Tests added to the test/tree application.

o test/tree.fl modified:
    o Added a 'Test Suggestions' button to document various tests
    o Added tests for new 'transparent' color behavior
    o Added test for STR#2832 to check if items can be drawn to the /right/ of child widgets

o Added new methods to Fl_Tree_Prefs:
    item_labelfont()     -- obsoletes labelfont()
    item_labelsize()     -- obsoletes labelsize()
    item_labelfgcolor()  -- obsoletes labelfgcolor()
    item_labelbgcolor()  -- obsoletes labelbgcolor()

o Added 'Fonts and Colors' section to Fl_Tree docs

o Fl_Tree_Item ABI feature added: using bitflags instead of chars
  to keep the class small, as it gets instanced a lot. (fast + LIGHT)



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9478 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2012-05-09 21:26:32 +00:00
Greg Ercolano
93fd842a5b Fixes small redraw problem with Fl_Tree child widgets on linux, perhaps others.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9431 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2012-05-02 18:37:00 +00:00
Greg Ercolano
b395ce78de Grr, looks like Fl_Group::update_child()
doesn't include drawing the label, so include drawing that explicitly.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9414 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2012-04-30 21:42:31 +00:00
Greg Ercolano
f8d269725d Fixes focus issues:
o Nav keys were being used even if widget didn't have focus
	o When Fl_Input was used as immediate child, wasn't redrawing properly
	  when typing into input fields. (noticed problem with test program in STR# 2832)



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9413 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2012-04-30 21:22:57 +00:00
Greg Ercolano
165cd2b63b Fixes STR#2832; support labels on tree child widget()s.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9411 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2012-04-30 17:14:15 +00:00
Greg Ercolano
474feee1db o Added FL_TREE_ITEM_HEIGHT_FROM_WIDGET option to item_draw_mode()
to allow widgets to control the size of items in the tree
  (instead of vice versa).

o Added item_draw_mode(int) to allow for easier bitflag maintenance,
  since enums don't seem to be typesafe yet.

o Tree demo modified to demonstrate this feature.
  An important feature for adding large widgets to tree items.
  Will probably add an example, 'tree-of-tables' to demo this usage.

o Small doc fixes.

o Had to rename FL_TREE_ITEM_DRAW_WIDGET_ONLY to FL_TREE_ITEM_DRAW_DEFAULT.
  Its meaning for the bit fields changed when new bit fields were added.
  (The prev name just didn't make sense in the new context. Since it was
  just a few svn commits old and an unreleased ABI feature, it shouldn't
  affect anyone not in R&D)



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9404 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2012-04-27 02:03:48 +00:00
Greg Ercolano
d07ef80207 Various Fl_Tree enhancements:
o Added keyboard navigation table
    o Added Shift-Click to extend selection, Ctrl-Space to toggle selection, Enter key toggle
    o Added protected extend_selection(from_item,to_item)
    o Cleanup of Fl_Tree::handle()
    o Limit ^A to multi-select mode only
    o Disable focus box in SELECT_NONE mode
    o test/tree: changed default mode to 'multiselect' (most often needs testing)



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9385 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2012-04-23 16:31:51 +00:00