fix issue that graphics::gradual_rectangle modifies fgcolor unexpectedly
This commit is contained in:
parent
42f89854fd
commit
d384a6a8e7
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Platform Specification Implementation
|
* Platform Specification Implementation
|
||||||
* Nana C++ Library(http://www.nanapro.org)
|
* Nana C++ Library(http://www.nanapro.org)
|
||||||
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
|
* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com)
|
||||||
*
|
*
|
||||||
* Distributed under the Boost Software License, Version 1.0.
|
* Distributed under the Boost Software License, Version 1.0.
|
||||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -144,7 +144,6 @@ namespace detail
|
|||||||
drawable_impl_type();
|
drawable_impl_type();
|
||||||
~drawable_impl_type();
|
~drawable_impl_type();
|
||||||
|
|
||||||
void fgcolor(const ::nana::color&); //deprecated
|
|
||||||
unsigned get_color() const;
|
unsigned get_color() const;
|
||||||
unsigned get_text_color() const;
|
unsigned get_text_color() const;
|
||||||
void set_color(const ::nana::color&);
|
void set_color(const ::nana::color&);
|
||||||
|
|||||||
@ -423,35 +423,6 @@ namespace detail
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawable_impl_type::fgcolor(const ::nana::color& clr)
|
|
||||||
{
|
|
||||||
auto rgb = clr.px_color().value;
|
|
||||||
|
|
||||||
if (rgb != current_color_)
|
|
||||||
{
|
|
||||||
auto & spec = nana::detail::platform_spec::instance();
|
|
||||||
platform_scope_guard psg;
|
|
||||||
|
|
||||||
current_color_ = rgb;
|
|
||||||
switch(spec.screen_depth())
|
|
||||||
{
|
|
||||||
case 16:
|
|
||||||
rgb = ((((rgb >> 16) & 0xFF) * 31 / 255) << 11) |
|
|
||||||
((((rgb >> 8) & 0xFF) * 63 / 255) << 5) |
|
|
||||||
(rgb & 0xFF) * 31 / 255;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
::XSetForeground(spec.open_display(), context, rgb);
|
|
||||||
::XSetBackground(spec.open_display(), context, rgb);
|
|
||||||
#if defined(NANA_USE_XFT)
|
|
||||||
xft_fgcolor.color.red = ((0xFF0000 & rgb) >> 16) * 0x101;
|
|
||||||
xft_fgcolor.color.green = ((0xFF00 & rgb) >> 8) * 0x101;
|
|
||||||
xft_fgcolor.color.blue = (0xFF & rgb) * 0x101;
|
|
||||||
xft_fgcolor.color.alpha = 0xFFFF;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
platform_scope_guard::platform_scope_guard()
|
platform_scope_guard::platform_scope_guard()
|
||||||
{
|
{
|
||||||
platform_spec::instance().lock_xlib();
|
platform_spec::instance().lock_xlib();
|
||||||
|
|||||||
@ -221,11 +221,6 @@ namespace detail
|
|||||||
::DeleteObject(round_region.handle);
|
::DeleteObject(round_region.handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawable_impl_type::fgcolor(const ::nana::color& clr)
|
|
||||||
{
|
|
||||||
set_text_color(clr);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned drawable_impl_type::get_color() const
|
unsigned drawable_impl_type::get_color() const
|
||||||
{
|
{
|
||||||
return color_;
|
return color_;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Platform Specification Implementation
|
* Platform Specification Implementation
|
||||||
* Nana C++ Library(http://www.nanapro.org)
|
* Nana C++ Library(http://www.nanapro.org)
|
||||||
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
|
* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com)
|
||||||
*
|
*
|
||||||
* Distributed under the Boost Software License, Version 1.0.
|
* Distributed under the Boost Software License, Version 1.0.
|
||||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@ -101,7 +101,6 @@ namespace detail
|
|||||||
drawable_impl_type();
|
drawable_impl_type();
|
||||||
~drawable_impl_type();
|
~drawable_impl_type();
|
||||||
|
|
||||||
void fgcolor(const ::nana::color&); //deprecated
|
|
||||||
unsigned get_color() const;
|
unsigned get_color() const;
|
||||||
unsigned get_text_color() const;
|
unsigned get_text_color() const;
|
||||||
void set_color(const ::nana::color&);
|
void set_color(const ::nana::color&);
|
||||||
|
|||||||
@ -2248,7 +2248,6 @@ namespace nana
|
|||||||
if (seq.empty())
|
if (seq.empty())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
//return (header.position(seq[0], nullptr) - this->content_view->origin().x + r.x); //deprecated
|
|
||||||
return header.range(seq.front()).first + r.x - this->content_view->origin().x;
|
return header.range(seq.front()).first + r.x - this->content_view->origin().x;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3226,14 +3225,10 @@ namespace nana
|
|||||||
auto i = essence_->header.column_from_point(x);
|
auto i = essence_->header.column_from_point(x);
|
||||||
|
|
||||||
if (i == npos)
|
if (i == npos)
|
||||||
//i = essence_->header.boundary(essence_->header.position(grab, nullptr) >= x); //deprecated
|
|
||||||
i = essence_->header.boundary(essence_->header.range(grab).first >= x);
|
i = essence_->header.boundary(essence_->header.range(grab).first >= x);
|
||||||
|
|
||||||
if(grab != i)
|
if(grab != i)
|
||||||
{
|
{
|
||||||
//unsigned item_pixels = 0;
|
|
||||||
//auto item_x = essence_->header.position(i, &item_pixels); //deprecated
|
|
||||||
|
|
||||||
auto item_rg = essence_->header.range(i);
|
auto item_rg = essence_->header.range(i);
|
||||||
|
|
||||||
//Get the item pos
|
//Get the item pos
|
||||||
@ -3319,7 +3314,6 @@ namespace nana
|
|||||||
|
|
||||||
_m_draw_header_item(fl_graph, margin, rectangle{ fl_graph.size()}, colors::white, col, item_state::floated);
|
_m_draw_header_item(fl_graph, margin, rectangle{ fl_graph.size()}, colors::white, col, item_state::floated);
|
||||||
|
|
||||||
//auto xpos = essence_->header.position(col.index, nullptr) + pos.x - grabs_.start_pos; //deprecated
|
|
||||||
auto xpos = essence_->header.range(col.index).first + pos.x - grabs_.start_pos;
|
auto xpos = essence_->header.range(col.index).first + pos.x - grabs_.start_pos;
|
||||||
essence_->graph->blend(rectangle{ point{ xpos - essence_->content_view->origin().x + rect.x, rect.y } , fl_graph.size() }, fl_graph, {}, 0.5);
|
essence_->graph->blend(rectangle{ point{ xpos - essence_->content_view->origin().x + rect.x, rect.y } , fl_graph.size() }, fl_graph, {}, 0.5);
|
||||||
}
|
}
|
||||||
@ -3405,7 +3399,6 @@ namespace nana
|
|||||||
|
|
||||||
auto & ptr_where = essence_->pointer_where;
|
auto & ptr_where = essence_->pointer_where;
|
||||||
|
|
||||||
//int item_top = rect.y - (origin.y % item_height_px); //deprecated
|
|
||||||
auto first_disp = essence_->first_display();
|
auto first_disp = essence_->first_display();
|
||||||
|
|
||||||
point item_coord{
|
point item_coord{
|
||||||
@ -3444,8 +3437,6 @@ namespace nana
|
|||||||
ind->detach();
|
ind->detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
//const int x = essence_->item_xpos(rect); //deprecated
|
|
||||||
|
|
||||||
//Here we draw the root categ (0) or a first item if the first drawing is not a categ.(item!=npos))
|
//Here we draw the root categ (0) or a first item if the first drawing is not a categ.(item!=npos))
|
||||||
if (idx.cat == 0 || !idx.is_category())
|
if (idx.cat == 0 || !idx.is_category())
|
||||||
{
|
{
|
||||||
@ -3579,7 +3570,6 @@ namespace nana
|
|||||||
|
|
||||||
//Draw selecting inner rectangle
|
//Draw selecting inner rectangle
|
||||||
if (item.flags.selected && (categ.expand == false))
|
if (item.flags.selected && (categ.expand == false))
|
||||||
//_m_draw_item_border(r.x, y, (std::min)(r.width, width - essence_->content_view->origin().x)); //deprecated
|
|
||||||
_m_draw_item_border(y);
|
_m_draw_item_border(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3816,7 +3806,6 @@ namespace nana
|
|||||||
|
|
||||||
//Draw selecting inner rectangle
|
//Draw selecting inner rectangle
|
||||||
if (item.flags.selected)
|
if (item.flags.selected)
|
||||||
//_m_draw_item_border(content_r.x, coord.y, show_w); //deprecated
|
|
||||||
_m_draw_item_border(coord.y);
|
_m_draw_item_border(coord.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1208,7 +1208,8 @@ namespace paint
|
|||||||
unsigned last_color = (int(r) << 16) | (int(g) << 8) | int(b);
|
unsigned last_color = (int(r) << 16) | (int(g) << 8) | int(b);
|
||||||
|
|
||||||
Display * disp = nana::detail::platform_spec::instance().open_display();
|
Display * disp = nana::detail::platform_spec::instance().open_display();
|
||||||
impl_->handle->fgcolor(static_cast<color_rgb>(last_color));
|
impl_->handle->set_color(static_cast<color_rgb>(last_color));
|
||||||
|
impl_->handle->update_color();
|
||||||
const int endpos = deltapx + (vertical ? rct.y : rct.x);
|
const int endpos = deltapx + (vertical ? rct.y : rct.x);
|
||||||
if (endpos > 0)
|
if (endpos > 0)
|
||||||
{
|
{
|
||||||
@ -1223,7 +1224,8 @@ namespace paint
|
|||||||
if (new_color != last_color)
|
if (new_color != last_color)
|
||||||
{
|
{
|
||||||
last_color = new_color;
|
last_color = new_color;
|
||||||
impl_->handle->fgcolor(static_cast<color_rgb>(last_color));
|
impl_->handle->set_color(static_cast<color_rgb>(last_color));
|
||||||
|
impl_->handle->update_color();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1238,7 +1240,8 @@ namespace paint
|
|||||||
if (new_color != last_color)
|
if (new_color != last_color)
|
||||||
{
|
{
|
||||||
last_color = new_color;
|
last_color = new_color;
|
||||||
impl_->handle->fgcolor(static_cast<color_rgb>(last_color));
|
impl_->handle->set_color(static_cast<color_rgb>(last_color));
|
||||||
|
impl_->handle->update_color();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user