From 69e559f657a34239dd039284cddf650b71b5b2d0 Mon Sep 17 00:00:00 2001 From: ErrorFlynn Date: Sun, 11 Aug 2019 20:27:16 -0400 Subject: [PATCH 1/5] fixed a bug in trigger::dbl_click() impl_->set_expanded() was called unconditionally, even if the node had no children. This caused the node icon to change to the "expanded" icon if the node had an icon scheme, even when the node didn't have children. --- source/gui/widgets/treebox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/gui/widgets/treebox.cpp b/source/gui/widgets/treebox.cpp index eb859353..c70c4330 100644 --- a/source/gui/widgets/treebox.cpp +++ b/source/gui/widgets/treebox.cpp @@ -1952,7 +1952,7 @@ namespace nana impl_->attr.tree_cont.for_each(shape.first, nl); auto const node = nl.node(); - if (!node) + if (!node || !node->child) return; switch (nl.what()) From b7a08744287270a1b0fb88152a4a6b7234b4d289 Mon Sep 17 00:00:00 2001 From: ErrorFlynn Date: Tue, 20 Aug 2019 05:32:36 -0400 Subject: [PATCH 2/5] fixed bug: listbox::sort_col doesn't update view Calling listbox::sort_col to change the sort column doesn't update the viewport to reflect the change, forcing the user to call API::refresh_window or otherwise perform stupid tricks to force the listbox to refresh. --- source/gui/widgets/listbox.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/gui/widgets/listbox.cpp b/source/gui/widgets/listbox.cpp index 2a984cf5..a62a80f8 100644 --- a/source/gui/widgets/listbox.cpp +++ b/source/gui/widgets/listbox.cpp @@ -5949,6 +5949,7 @@ namespace nana { internal_scope_guard lock; _m_ess().lister.sort_column(col, &reverse); + _m_ess().update(); } auto listbox::sort_col() const -> size_type From e626f816b38c95cf61af189e4514ef102841549e Mon Sep 17 00:00:00 2001 From: ErrorFlynn Date: Mon, 16 Sep 2019 06:07:04 -0400 Subject: [PATCH 3/5] nana::any bug fix - argument not forwarded A constructor and an overload of the assignment operator each have a forwarding reference as a parameter, but they don't actually forward the argument. --- include/nana/any.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/nana/any.hpp b/include/nana/any.hpp index ed711146..9a90ca2f 100644 --- a/include/nana/any.hpp +++ b/include/nana/any.hpp @@ -74,7 +74,7 @@ namespace nana any(Value && value, typename std::enable_if::value>::type * = nullptr, typename std::enable_if::value>::type* = nullptr) - : content_(new holder::type>(static_cast(value))) + : content_(new holder::type>(std::forward(value))) { } @@ -87,7 +87,7 @@ namespace nana template any& operator=(Value&& other) { - any(other).swap(*this); + any(std::forward(other)).swap(*this); return *this; } From 59d3a684855d08bd78f50ab3137aa2c8478b6f13 Mon Sep 17 00:00:00 2001 From: ErrorFlynn Date: Fri, 20 Sep 2019 23:38:09 -0400 Subject: [PATCH 4/5] item_proxy bug fix: postfix increment operator The behavior of the postfix increment operator is not consistent with the increment operator concept (currently just returns the next sibling node). --- source/gui/widgets/treebox.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/gui/widgets/treebox.cpp b/source/gui/widgets/treebox.cpp index c70c4330..233099c6 100644 --- a/source/gui/widgets/treebox.cpp +++ b/source/gui/widgets/treebox.cpp @@ -1274,7 +1274,10 @@ namespace nana item_proxy item_proxy::operator++(int) { - return sibling(); + item_proxy ip(*this); + if(trigger_ && node_) + node_ = node_->next; + return ip; } item_proxy& item_proxy::operator*() From 6c547276ecd32ca58bb8d6f94c5f687dbd96e259 Mon Sep 17 00:00:00 2001 From: ErrorFlynn Date: Sat, 5 Oct 2019 11:19:42 -0400 Subject: [PATCH 5/5] bug fix: nana::drawerbase::listbox::essence::where This method incorrectly calculates the position of checkboxes in the listbox content area. It uses the formula `new_where.second * item_h + header_visible_px()` to calculate the number of pixels between the top of the viewport and a checkbox. The problem is that when the first visible item is only partially visible, `new_where.second * item_h` produces an excess of pixels equal to the vertical segment of the first visible item that is not in the viewport. This excess value produces a downward displacement of the calculated checkbox position, so it must be accounted for in the aforementioned formula. This problem occurs because at some point, the library switched from scrolling in item-sized increments to smooth scrolling (in older versions, it used to be that it was impossible for an item to be only partially visible). Relevant thread: http://nanapro.org/en-us/forum/index.php?u=/topic/1227/ggnana-listbox-with-a-check-box-for-each-list-item#post-3359 --- source/gui/widgets/listbox.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/gui/widgets/listbox.cpp b/source/gui/widgets/listbox.cpp index a62a80f8..1fa6a29e 100644 --- a/source/gui/widgets/listbox.cpp +++ b/source/gui/widgets/listbox.cpp @@ -2387,7 +2387,9 @@ namespace nana nana::rectangle r; if (rect_lister(r)) { - auto top = new_where.second * item_h + header_visible_px(); + //potential displacement due to partially visible first visible item + auto disp = origin.y - first_display().item * item_h; + auto top = new_where.second * item_h + header_visible_px() - disp; if (checkarea(item_xpos(r), static_cast(top)).is_hit(pos)) new_where.first = parts::checker; }