Merge branch 'hotfix-1.6.2' into develop-1.7

This commit is contained in:
Jinhao 2018-12-29 07:18:03 +08:00
commit 88294ed9fb
10 changed files with 71 additions and 22 deletions

View File

@ -46,6 +46,8 @@ before_install:
- cd ..
- git clone --depth=1 --branch=cmake-dev 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.12/cmake-3.12.0-rc3-Linux-x86_64.sh || true
- chmod -R +x /tmp/tools

View File

@ -42,6 +42,13 @@ namespace nana{
using field_reference = place::field_reference;
constexpr static const std::size_t npos = static_cast<std::size_t>(-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);

View File

@ -163,7 +163,8 @@ namespace nana
bld_fgcolor = fgcolor.blend(highlighted, 0.6);
break;
case element_state::disabled:
bld_bgcolor = bld_fgcolor = static_cast<color_rgb>(0xb2b7bc);
bld_bgcolor = static_cast<color_rgb>(0xE0E0E0);
bld_fgcolor = static_cast<color_rgb>(0x999A9E);
break;
default:
//Leave things as they are

View File

@ -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&)

View File

@ -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)
@ -295,17 +322,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<unsigned>(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<unsigned>(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
);
}
}
});
}

View File

@ -130,7 +130,7 @@ namespace nana
if (!_m_foreach_visual_line(graph, rs))
break;
rs.pos.y += static_cast<int>(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<int>(graph.height()) - 1;
for (auto & vsline : rs.vslines)

View File

@ -2002,7 +2002,7 @@ namespace nana {
auto fgcolor = scheme_->foreground.get_color();
if (!API::window_enabled(window_))
fgcolor.blend(bgcolor, 0.5);
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);

View File

@ -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())
{

View File

@ -1,7 +1,7 @@
#include <nana/push_ignore_diagnostic>
#include <nana/paint/detail/image_process_provider.hpp>
#include <nana/paint/detail/image_processor.hpp>
#include "image_processor.hpp"
namespace nana
{

View File

@ -15,8 +15,8 @@
#ifndef NANA_PAINT_DETAIL_IMAGE_PROCESSOR_HPP
#define NANA_PAINT_DETAIL_IMAGE_PROCESSOR_HPP
#include "../image_process_interface.hpp"
#include <nana/paint/pixel_buffer.hpp>
#include <nana/paint/image_process_interface.hpp>
#include <nana/paint/detail/native_paint_interface.hpp>
#include <algorithm>
@ -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<unsigned char[]> 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);