From ab789837a008d9890bc479b1e1dc5e2822d386fe Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Wed, 7 Nov 2018 19:37:05 +0100 Subject: [PATCH 1/6] cmake-3.12 in travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 42f63050..9d7e849e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,7 +44,7 @@ before_install: - git clone --depth=1 --branch=develop https://github.com/qPCR4vir/nana-demo.git ../nana-demo - export PATH="$HOME/bin:$PATH" #- mkdir ~/bin #it seemd that a bin already exists from 20170901 - - wget --no-check-certificate --no-clobber -O /tmp/tools/cmake https://cmake.org/files/v3.4/cmake-3.4.0-rc3-Linux-x86_64.sh || true + - wget --no-check-certificate --no-clobber -O /tmp/tools/cmake https://cmake.org/files/v3.12/cmake-3.12.0-rc3-Linux-x86_64.sh || true - chmod -R +x /tmp/tools install: From e7bc1405eced585120b9facb6b024d0daf4a80ba Mon Sep 17 00:00:00 2001 From: James Bremner Date: Sun, 9 Dec 2018 16:01:32 -0500 Subject: [PATCH 2/6] Prevent slider adorn moving when slider disabled Fix suggested be Error Flynn in http://nanapro.org/en-us/forum/index.php?u=/topic/1059/ggslider-appearance-when-disabled#post-2498 --- source/gui/widgets/slider.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/gui/widgets/slider.cpp b/source/gui/widgets/slider.cpp index 20109237..67a67631 100644 --- a/source/gui/widgets/slider.cpp +++ b/source/gui/widgets/slider.cpp @@ -758,6 +758,10 @@ namespace nana void trigger::mouse_move(graph_reference graph, const arg_mouse& arg) { + // check if slider is disabled + if(!API::get_widget(arg.window_handle)->enabled()) + return; // do nothing + bool updated = false; if (model_ptr_->if_trace_slider()) { From 93df609520ff395d6a4d465f6b2e4d799bb9885b Mon Sep 17 00:00:00 2001 From: Jinhao Date: Fri, 14 Dec 2018 07:14:04 +0800 Subject: [PATCH 3/6] fix bug that label renders an additional endline(#365) --- source/gui/widgets/label.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/source/gui/widgets/label.cpp b/source/gui/widgets/label.cpp index 74bedf81..3095ec56 100644 --- a/source/gui/widgets/label.cpp +++ b/source/gui/widgets/label.cpp @@ -130,7 +130,7 @@ namespace nana if (!_m_foreach_visual_line(graph, rs)) break; - rs.pos.y += static_cast(rs.vslines.back().extent_height_px); + //Now the y-position of rs has been modified to next line. } if (transient_.current_font != pre_font) @@ -531,10 +531,6 @@ namespace nana bool _m_foreach_visual_line(graph_reference graph, render_status& rs) { - std::wstring text; - - content_element_iterator block_start; - auto const bottom = static_cast(graph.height()) - 1; for (auto & vsline : rs.vslines) From 36095c91908f7ea6d8b37504e13b431f7480a70f Mon Sep 17 00:00:00 2001 From: besh81 Date: Fri, 14 Dec 2018 12:38:06 +0100 Subject: [PATCH 4/6] fix disabled checkbox square disabled checkbox square now looks like disabled textbox In addition found an unused instruction in text_editor.cpp: could be replaced or removed (or left as it is :) ) --- source/gui/element.cpp | 3 ++- source/gui/widgets/checkbox.cpp | 6 +++++- source/gui/widgets/skeletons/text_editor.cpp | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/source/gui/element.cpp b/source/gui/element.cpp index a67a7341..ea3b94a2 100644 --- a/source/gui/element.cpp +++ b/source/gui/element.cpp @@ -163,7 +163,8 @@ namespace nana bld_fgcolor = fgcolor.blend(highlighted, 0.6); break; case element_state::disabled: - bld_bgcolor = bld_fgcolor = static_cast(0xb2b7bc); + bld_bgcolor = static_cast(0xE0E0E0); + bld_fgcolor = static_cast(0x999A9E); break; default: //Leave things as they are diff --git a/source/gui/widgets/checkbox.cpp b/source/gui/widgets/checkbox.cpp index c458a4ac..a43cd908 100644 --- a/source/gui/widgets/checkbox.cpp +++ b/source/gui/widgets/checkbox.cpp @@ -85,9 +85,13 @@ namespace nana{ namespace drawerbase graph.text_metrics(txt_px, descent, ileading); txt_px += (descent + 2); + auto e_state = API::element_state(*wdg); + if(!wdg->enabled()) + e_state = element_state::disabled; + impl_->crook.draw(graph, impl_->scheme_ptr->square_bgcolor.get(wdg->bgcolor()), impl_->scheme_ptr->square_border_color.get(wdg->fgcolor()), - rectangle(0, txt_px > 16 ? (txt_px - 16) / 2 : 0, 16, 16), API::element_state(*wdg)); + rectangle(0, txt_px > 16 ? (txt_px - 16) / 2 : 0, 16, 16), e_state); } void drawer::mouse_down(graph_reference graph, const arg_mouse&) diff --git a/source/gui/widgets/skeletons/text_editor.cpp b/source/gui/widgets/skeletons/text_editor.cpp index 304ed929..72d26a2e 100644 --- a/source/gui/widgets/skeletons/text_editor.cpp +++ b/source/gui/widgets/skeletons/text_editor.cpp @@ -2002,7 +2002,7 @@ namespace nana { auto fgcolor = scheme_->foreground.get_color(); if (!API::window_enabled(window_)) - fgcolor.blend(bgcolor, 0.5); + fgcolor.blend(bgcolor, 0.5); // do nothing !!! should be replace with fgcolor = fgcolor.blend(bgcolor, 0.5); <\code> or removed if (API::widget_borderless(window_)) graph_.rectangle(false, bgcolor); From bed829fa26a666044eb6d66d333dea91e3e57ca3 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Sat, 29 Dec 2018 06:38:46 +0800 Subject: [PATCH 5/6] fix bug that line alorithm wrongly draws a line when fade_rate is zero --- source/gui/widgets/skeletons/text_editor.cpp | 2 +- source/paint/detail/image_process_provider.cpp | 2 +- .../nana => source}/paint/detail/image_processor.hpp | 12 ++++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) rename {include/nana => source}/paint/detail/image_processor.hpp (98%) diff --git a/source/gui/widgets/skeletons/text_editor.cpp b/source/gui/widgets/skeletons/text_editor.cpp index 72d26a2e..6a5251b4 100644 --- a/source/gui/widgets/skeletons/text_editor.cpp +++ b/source/gui/widgets/skeletons/text_editor.cpp @@ -2002,7 +2002,7 @@ namespace nana { auto fgcolor = scheme_->foreground.get_color(); if (!API::window_enabled(window_)) - fgcolor.blend(bgcolor, 0.5); // do nothing !!! should be replace with fgcolor = fgcolor.blend(bgcolor, 0.5); <\code> or removed + fgcolor = fgcolor.blend(bgcolor, 0.5); //Thank to besh81 for getting the fgcolor to be changed if (API::widget_borderless(window_)) graph_.rectangle(false, bgcolor); diff --git a/source/paint/detail/image_process_provider.cpp b/source/paint/detail/image_process_provider.cpp index 414d68dc..89324e04 100644 --- a/source/paint/detail/image_process_provider.cpp +++ b/source/paint/detail/image_process_provider.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include "image_processor.hpp" namespace nana { diff --git a/include/nana/paint/detail/image_processor.hpp b/source/paint/detail/image_processor.hpp similarity index 98% rename from include/nana/paint/detail/image_processor.hpp rename to source/paint/detail/image_processor.hpp index 1a412a2e..5e7e3548 100644 --- a/include/nana/paint/detail/image_processor.hpp +++ b/source/paint/detail/image_processor.hpp @@ -1,7 +1,7 @@ /* * Image Processor Algorithm Implementation * Nana C++ Library(http://www.nanapro.org) - * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com) + * Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com) * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at @@ -15,8 +15,8 @@ #ifndef NANA_PAINT_DETAIL_IMAGE_PROCESSOR_HPP #define NANA_PAINT_DETAIL_IMAGE_PROCESSOR_HPP -#include "../image_process_interface.hpp" #include +#include #include #include @@ -421,15 +421,19 @@ namespace detail { virtual void process(paint::pixel_buffer & pixbuf, const nana::point& pos_beg, const nana::point& pos_end, const ::nana::color& clr, double fade_rate) const { + //Return if it is completely transparent + if (fade_rate <= 0) + return; + auto rgb_color = clr.px_color().value; const std::size_t bytes_pl = pixbuf.bytes_per_line(); unsigned char * fade_table = nullptr; std::unique_ptr autoptr; nana::pixel_argb_t rgb_imd = {}; - if(fade_rate != 0.0) + if(fade_rate < 1) { - autoptr = detail::alloc_fade_table(1 - fade_rate); + autoptr = detail::alloc_fade_table(1.0 - fade_rate); fade_table = autoptr.get(); rgb_imd.value = rgb_color; rgb_imd = detail::fade_color_intermedia(rgb_imd, fade_table); From 345d65f6c9abe38c43daf90aad4ac63f81cd05a9 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Sat, 29 Dec 2018 07:08:49 +0800 Subject: [PATCH 6/6] add caption background mode for group --- include/nana/gui/widgets/group.hpp | 10 ++++++- source/gui/widgets/group.cpp | 48 ++++++++++++++++++++++++------ 2 files changed, 48 insertions(+), 10 deletions(-) diff --git a/include/nana/gui/widgets/group.hpp b/include/nana/gui/widgets/group.hpp index ba48928b..e0fdfc3b 100644 --- a/include/nana/gui/widgets/group.hpp +++ b/include/nana/gui/widgets/group.hpp @@ -42,6 +42,13 @@ namespace nana{ using field_reference = place::field_reference; constexpr static const std::size_t npos = static_cast(-1); + enum class background_mode + { + none, + transparent, + blending + }; + /// The default construction group(); @@ -66,7 +73,8 @@ namespace nana{ checkbox& add_option(::std::string); /// Modifies the alignment of the title - void caption_align(align position); + group& caption_align(align position); + group& caption_background_mode(background_mode mode); /// Enables/disables the radio mode which is single selection group& radio_mode(bool); diff --git a/source/gui/widgets/group.cpp b/source/gui/widgets/group.cpp index 6d697a62..d85d81a9 100644 --- a/source/gui/widgets/group.cpp +++ b/source/gui/widgets/group.cpp @@ -36,6 +36,7 @@ namespace nana{ { label caption; align caption_align{ align::left }; + background_mode caption_mode{ background_mode::blending }; place place_content; unsigned gap{2}; std::string usr_div_str; @@ -154,7 +155,7 @@ namespace nana{ return *impl_->options.back(); } - void group::caption_align(align position) + group& group::caption_align(align position) { if (position != impl_->caption_align) { @@ -163,6 +164,32 @@ namespace nana{ impl_->place_content.collocate(); API::refresh_window(*this); } + return *this; + } + + group& group::caption_background_mode(background_mode mode) + { + if (mode != impl_->caption_mode) + { + impl_->caption_mode = mode; + switch (mode) + { + case background_mode::none: + impl_->caption.bgcolor(this->bgcolor()); + impl_->caption.transparent(false); + break; + case background_mode::blending: + impl_->caption.transparent(true); + impl_->caption.bgcolor(API::bgcolor(this->parent()).blend(colors::black, 0.025)); + break; + case background_mode::transparent: + impl_->caption.transparent(true); + impl_->caption.bgcolor(API::bgcolor(this->parent()).blend(colors::black, 0.025)); + break; + } + API::refresh_window(*this); + } + return *this; } group& group::radio_mode(bool enable) @@ -289,17 +316,20 @@ namespace nana{ ), 3, 3, this->scheme().border, true, this->bgcolor()); - auto opt_r = API::window_rectangle(impl_->caption); - if (opt_r) + if (background_mode::blending == impl_->caption_mode) { - rectangle grad_r{ opt_r->position(), nana::size{ opt_r->width + 4, static_cast(top_round_line - opt_r->y) } }; + auto opt_r = API::window_rectangle(impl_->caption); + if (opt_r) + { + rectangle grad_r{ opt_r->position(), nana::size{ opt_r->width + 4, static_cast(top_round_line - opt_r->y) } }; - grad_r.y += top_round_line*2 / 3; - grad_r.x -= 2; + grad_r.y += top_round_line * 2 / 3; + grad_r.x -= 2; - graph.gradual_rectangle(grad_r, - API::bgcolor(this->parent()), this->bgcolor(), true - ); + graph.gradual_rectangle(grad_r, + API::bgcolor(this->parent()), this->bgcolor(), true + ); + } } }); }