diff --git a/FL/Fl_Tree.H b/FL/Fl_Tree.H
index 9bfb88910..46a104db5 100644
--- a/FL/Fl_Tree.H
+++ b/FL/Fl_Tree.H
@@ -51,7 +51,6 @@
/// |--- Fl_Tree_Select (enum) // Selection modes
/// |--- Fl_Tree_Sort (enum) // Sort behavior
/// \endcode
-///
/// Similar to Fl_Browser, Fl_Tree is a browser of Fl_Tree_Item's arranged
/// in a parented hierarchy, or 'tree'. Subtrees can be expanded or closed.
/// Items can be added, deleted, inserted, sorted and re-ordered.
diff --git a/src/Fl_Tree.cxx b/src/Fl_Tree.cxx
index a92539cf0..4c4f19e2a 100644
--- a/src/Fl_Tree.cxx
+++ b/src/Fl_Tree.cxx
@@ -626,9 +626,9 @@ void Fl_Tree::calc_dimensions() {
}
}
-/// Recalculuates the tree's sizes and scrollbar visibility,
+/// Recalculates the tree's sizes and scrollbar visibility,
/// normally managed automatically.
-///
+///
/// On return:
///
/// - _tree_w will be the overall pixel width of the entire viewable tree
@@ -648,7 +648,7 @@ void Fl_Tree::calc_dimensions() {
/// open/closed, label contents or font sizes changed, margins changed, etc.
///
/// This calculation involves walking the *entire* tree from top to bottom,
-/// a potentially a slow calculation if the tree has many items (potentially
+/// potentially a slow calculation if the tree has many items (potentially
/// hundreds of thousands), and should therefore be called sparingly.
///
/// For this reason, recalc_tree() is used as a way to /schedule/
@@ -808,10 +808,10 @@ void Fl_Tree::root(Fl_Tree_Item *newitem) {
/// To specify items or submenus that contain slashes ('/' or '\')
/// use an escape character to protect them, e.g.
/// \code
-/// tree->add("/Holidays/Photos/12\\/25\\2010"); // Adds item "12/25/2010"
+/// tree->add("/Holidays/Photos/12\\/25\\/2010"); // Adds item "12/25/2010"
/// tree->add("/Pathnames/c:\\\\Program Files\\\\MyApp"); // Adds item "c:\Program Files\MyApp"
/// \endcode
-/// \param[in] path The path to the item, e.g. "Flintsone/Fred".
+/// \param[in] path The path to the item, e.g. "Flintstone/Fred".
/// \param[in] item The new item to be added.
/// If NULL, a new item is created with
/// a name that is the last element in \p 'path'.
@@ -898,6 +898,7 @@ Fl_Tree_Item* Fl_Tree::insert(Fl_Tree_Item *item, const char *name, int pos) {
int Fl_Tree::remove(Fl_Tree_Item *item) {
// Item being removed is focus item? zero focus
if ( item == _item_focus ) _item_focus = 0;
+ if ( item == _lastselect ) _lastselect = 0;
if ( item == _root ) {
clear();
} else {
@@ -916,6 +917,7 @@ void Fl_Tree::clear() {
_root->clear_children();
delete _root; _root = 0;
_item_focus = 0;
+ _lastselect = 0;
}
/// Clear all the children for \p 'item'.
@@ -937,7 +939,7 @@ void Fl_Tree::clear_children(Fl_Tree_Item *item) {
/// use an escape character to protect them, e.g.
///
/// \code
-/// tree->add("/Holidays/Photos/12\\/25\\2010"); // Adds item "12/25/2010"
+/// tree->add("/Holidays/Photos/12\\/25\\/2010"); // Adds item "12/25/2010"
/// tree->add("/Pathnames/c:\\\\Program Files\\\\MyApp"); // Adds item "c:\Program Files\MyApp"
/// \endcode
///
@@ -972,7 +974,7 @@ Fl_Tree_Item *Fl_Tree::find_item(const char *path) {
/// Return \p 'pathname' of size \p 'pathnamelen' for the specified \p 'item'.
///
/// If \p 'item' is NULL, root() is used.
-/// The tree's root will be included in the pathname of showroot() is on.
+/// The tree's root will be included in the pathname if showroot() is on.
/// Menu items or submenus that contain slashes ('/' or '\') in their names
/// will be escaped with a backslash. This is symmetrical with the add()
/// function which uses the same escape pattern to set names.
@@ -1068,8 +1070,8 @@ Fl_Tree_Item* Fl_Tree::item_clicked() {
/// Returns next open(), visible item above (\p dir==FL_Up)
/// or below (\p dir==FL_Down) the specified \p 'item', or 0 if no more items.
///
-/// If \p 'item' is 0, returns first() if \p 'dir' is FL_Up,
-/// or last() if \p dir is FL_Down.
+/// If \p 'item' is 0, returns last() if \p 'dir' is FL_Up,
+/// or first() if \p dir is FL_Down.
///
/// \code
/// // Walk down the tree (forwards)
@@ -1258,8 +1260,8 @@ Fl_Tree_Item *Fl_Tree::last_selected_item() {
///
/// visible=true visible=false /// ------------------- ------------- -/// dir=Fl_Up: last_visible_item() last() -/// dir=Fl_Down: first_visible_item() first() +/// dir=FL_Up: last_visible_item() last() +/// dir=FL_Down: first_visible_item() first() ////// /// \par Example use: @@ -1404,7 +1406,7 @@ int Fl_Tree::get_selected_items(Fl_Tree_Item_Array &ret_items) { /// \param[in] item -- the item to be opened. Must not be NULL. /// \param[in] docallback -- A flag that determines if the callback() is invoked or not: /// - 0 - callback() is not invoked -/// - 1 - callback() is invoked if item changed, (default) +/// - 1 - callback() is invoked if item changed (default), /// callback_reason() will be FL_TREE_REASON_OPENED /// \returns /// - 1 -- item was opened @@ -1430,7 +1432,7 @@ int Fl_Tree::open(Fl_Tree_Item *item, int docallback) { /// Handles calling redraw() if anything changed. /// /// Items or submenus that themselves contain slashes ('/' or '\') -/// should be escaped, e.g. open("Holidays/12\\/25\//2010"). +/// should be escaped, e.g. open("Holidays/12\\/25\\/2010"). /// /// The callback can use callback_item() and callback_reason() respectively to determine /// the item changed and the reason the callback was called. @@ -1513,7 +1515,7 @@ int Fl_Tree::close(Fl_Tree_Item *item, int docallback) { /// Handles calling redraw() if anything changed. /// /// Items or submenus that themselves contain slashes ('/' or '\') -/// should be escaped, e.g. close("Holidays/12\\/25\//2010"). +/// should be escaped, e.g. close("Holidays/12\\/25\\/2010"). /// /// The callback can use callback_item() and callback_reason() respectively to determine /// the item changed and the reason the callback was called. @@ -1552,7 +1554,7 @@ int Fl_Tree::is_open(Fl_Tree_Item *item) const { /// See if item specified by \p 'path' is open. /// /// Items or submenus that themselves contain slashes ('/' or '\') -/// should be escaped, e.g. is_open("Holidays/12\\/25\//2010"). +/// should be escaped, e.g. is_open("Holidays/12\\/25\\/2010"). /// /// Items that are 'open' are themselves not necessarily visible; /// one of the item's parents might be closed. @@ -1574,8 +1576,8 @@ int Fl_Tree::is_open(const char *path) const { /// /// \param[in] item -- the item to be tested. Must not be NULL. /// \returns -/// - 1 : item is open -/// - 0 : item is closed +/// - 1 : item is closed +/// - 0 : item is open /// int Fl_Tree::is_close(Fl_Tree_Item *item) const { return(item->is_close()); @@ -1584,7 +1586,7 @@ int Fl_Tree::is_close(Fl_Tree_Item *item) const { /// See if item specified by \p 'path' is closed. /// /// Items or submenus that themselves contain slashes ('/' or '\') -/// should be escaped, e.g. is_close("Holidays/12\\/25\//2010"). +/// should be escaped, e.g. is_close("Holidays/12\\/25\\/2010"). /// /// \param[in] path -- the tree item's pathname (e.g. "Flintstones/Fred") /// \returns @@ -1598,7 +1600,7 @@ int Fl_Tree::is_close(const char *path) const { return(item->is_close()?1:0); } -/// Select the specified \p 'item'. Use 'deselect()' to de-select it. +/// Select the specified \p 'item'. Use 'deselect()' to deselect it. /// /// Invokes the callback depending on the value of optional parameter \p docallback.