From 803acb13f0a85ea9b5048c429ae21d02d64b2f5a Mon Sep 17 00:00:00 2001 From: Jinhao Date: Tue, 12 Sep 2017 08:15:22 +0800 Subject: [PATCH 1/5] fix move-ctor and move-assignement operator of graphics(#253) --- source/paint/graphics.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/paint/graphics.cpp b/source/paint/graphics.cpp index b7dd3426..c617b3ee 100644 --- a/source/paint/graphics.cpp +++ b/source/paint/graphics.cpp @@ -240,12 +240,16 @@ namespace paint graphics::graphics(graphics&& other) : impl_(std::move(other.impl_)) { + other.impl_.reset(new implementation); } graphics& graphics::operator=(graphics&& other) { if (this != &other) + { impl_ = std::move(other.impl_); + other.impl_.reset(new implementation); + } return *this; } From c45f621eeab9e7f739ef0afddb38f05dd45e2f1e Mon Sep 17 00:00:00 2001 From: Jinhao Date: Wed, 13 Sep 2017 04:58:05 +0800 Subject: [PATCH 2/5] fix crash where text_editor enables the linewrap(#254) --- source/gui/widgets/skeletons/text_editor.cpp | 21 ++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/source/gui/widgets/skeletons/text_editor.cpp b/source/gui/widgets/skeletons/text_editor.cpp index f39638b2..5688b2be 100644 --- a/source/gui/widgets/skeletons/text_editor.cpp +++ b/source/gui/widgets/skeletons/text_editor.cpp @@ -556,6 +556,7 @@ namespace nana{ namespace widgets virtual void merge_lines(std::size_t first, std::size_t second) = 0; //Calculates how many lines the specified line of text takes with a specified pixels of width. virtual void add_lines(std::size_t pos, std::size_t lines) = 0; + virtual void prepare() = 0; virtual void pre_calc_line(std::size_t line, unsigned pixels) = 0; virtual void pre_calc_lines(unsigned pixels) = 0; virtual std::size_t take_lines() const = 0; @@ -668,6 +669,12 @@ namespace nana{ namespace widgets } } + void prepare() override + { + auto const line_count = editor_.textbase().lines(); + this->sections_.resize(line_count); + } + void pre_calc_line(std::size_t pos, unsigned) override { auto const & text = editor_.textbase().getline(pos); @@ -781,6 +788,12 @@ namespace nana{ namespace widgets } } + void prepare() override + { + auto const lines = editor_.textbase().lines(); + linemtr_.resize(lines); + } + void pre_calc_line(std::size_t line, unsigned pixels) override { const string_type& lnstr = editor_.textbase().getline(line); @@ -1234,7 +1247,7 @@ namespace nana{ namespace widgets void text_editor::typeface_changed() { - impl_->capacities.behavior->pre_calc_lines(width_pixels()); + _m_reset_content_size(true); } void text_editor::indent(bool enb, std::function generator) @@ -2886,10 +2899,14 @@ namespace nana{ namespace widgets auto text_lines = textbase().lines(); if (text_lines <= max_lines) { + impl_->capacities.behavior->prepare(); + + auto const width_px = _m_width_px(true); + std::size_t lines = 0; for (std::size_t i = 0; i < text_lines; ++i) { - impl_->capacities.behavior->pre_calc_line(i, csize.width); + impl_->capacities.behavior->pre_calc_line(i, width_px); lines += impl_->capacities.behavior->take_lines(i); if (lines > max_lines) From 6e9296166f395bbd0c4b49d055116551a9342a14 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Thu, 14 Sep 2017 02:21:03 +0800 Subject: [PATCH 3/5] fix bug that platform_spec_posix.cpp is missing in code::blocks project --- build/codeblocks/nana.cbp | 1 + 1 file changed, 1 insertion(+) diff --git a/build/codeblocks/nana.cbp b/build/codeblocks/nana.cbp index c598a95d..18c78755 100644 --- a/build/codeblocks/nana.cbp +++ b/build/codeblocks/nana.cbp @@ -50,6 +50,7 @@ + From dbc9bc55ff5bd055f2f01c80d119e35a7a981f41 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Mon, 18 Sep 2017 23:36:40 +0800 Subject: [PATCH 4/5] fix bug that fast clicking a spinbox doesn't change the value(#257) --- include/nana/gui/widgets/spinbox.hpp | 1 + source/gui/widgets/spinbox.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/nana/gui/widgets/spinbox.hpp b/include/nana/gui/widgets/spinbox.hpp index 2ecabc78..15cbc694 100644 --- a/include/nana/gui/widgets/spinbox.hpp +++ b/include/nana/gui/widgets/spinbox.hpp @@ -61,6 +61,7 @@ namespace nana void focus(graph_reference, const arg_focus&) override; void mouse_wheel(graph_reference, const arg_wheel&) override; + void dbl_click(graph_reference, const arg_mouse&) override; void mouse_down(graph_reference, const arg_mouse&) override; void mouse_move(graph_reference, const arg_mouse&) override; void mouse_up(graph_reference, const arg_mouse& arg) override; diff --git a/source/gui/widgets/spinbox.cpp b/source/gui/widgets/spinbox.cpp index 2fad022f..89423eab 100644 --- a/source/gui/widgets/spinbox.cpp +++ b/source/gui/widgets/spinbox.cpp @@ -560,6 +560,12 @@ namespace nana impl_->editor()->reset_caret(); API::dev::lazy_refresh(); } + + void drawer::dbl_click(graph_reference, const arg_mouse& arg) + { + if (impl_->mouse_button(arg, true)) + API::dev::lazy_refresh(); + } void drawer::mouse_down(graph_reference, const arg_mouse& arg) { From c1654f75eca2ea61fa18f86fc8c49d58ee5eb539 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Mon, 18 Sep 2017 23:46:02 +0800 Subject: [PATCH 5/5] fix issue that typing text for spinbox doesn't draw spin buttons border --- source/gui/widgets/spinbox.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/gui/widgets/spinbox.cpp b/source/gui/widgets/spinbox.cpp index 89423eab..41b592f3 100644 --- a/source/gui/widgets/spinbox.cpp +++ b/source/gui/widgets/spinbox.cpp @@ -605,7 +605,10 @@ namespace nana { impl_->editor()->respond_char(arg); if (impl_->editor()->try_refresh()) + { + impl_->draw_spins(); API::dev::lazy_refresh(); + } } void drawer::resized(graph_reference, const arg_resized&)