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 @@ + 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/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) diff --git a/source/gui/widgets/spinbox.cpp b/source/gui/widgets/spinbox.cpp index 2fad022f..41b592f3 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) { @@ -599,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&) 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; }