diff --git a/CMakeLists.txt b/CMakeLists.txt index 242a1ea2..3fbd6ed5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,8 +34,13 @@ if(BIICODE) # we'll use the default config file so we can iliminate the following macro definitions if(MSVC) # More MSVC specific compilation flags - add_definitions(-D_SCL_SECURE_NO_WARNINGS) - add_definitions(-D_CRT_SECURE_NO_DEPRECATE) + add_definitions(-D_SCL_SECURE_NO_WARNINGS) + add_definitions(-D_CRT_SECURE_NO_DEPRECATE) + if(MSVC14) + add_definitions(-DSTD_CODECVT_NOT_SUPPORTED) + else() + add_definitions(-DNOT_IMPLEMENTED_KEYWORD_noexcept) + endif() endif() add_biicode_targets() diff --git a/include/nana/detail/linux_X11/platform_spec.hpp b/include/nana/detail/linux_X11/platform_spec.hpp index ae4a1830..461517f9 100644 --- a/include/nana/detail/linux_X11/platform_spec.hpp +++ b/include/nana/detail/linux_X11/platform_spec.hpp @@ -106,6 +106,8 @@ namespace detail ~drawable_impl_type(); void fgcolor(const ::nana::color&); //deprecated + unsigned get_color() const; + unsigned get_text_color() const; void set_color(const ::nana::color&); void set_text_color(const ::nana::color&); diff --git a/include/nana/detail/win32/platform_spec.hpp b/include/nana/detail/win32/platform_spec.hpp index e8db5fff..3afea077 100644 --- a/include/nana/detail/win32/platform_spec.hpp +++ b/include/nana/detail/win32/platform_spec.hpp @@ -146,6 +146,7 @@ namespace detail void fgcolor(const ::nana::color&); //deprecated unsigned get_color() const; + unsigned get_text_color() const; void set_color(const ::nana::color&); void set_text_color(const ::nana::color&); diff --git a/include/nana/paint/graphics.hpp b/include/nana/paint/graphics.hpp index ad2c8a6c..a194aa7e 100644 --- a/include/nana/paint/graphics.hpp +++ b/include/nana/paint/graphics.hpp @@ -136,8 +136,11 @@ namespace nana /// @param file_utf8 A UTF-8 string to a filename void save_as_file(const char* file_utf8) const throw(); - void set_color(const ::nana::color&); - void set_text_color(const ::nana::color&); + void set_color(const ::nana::color&); //deprecated, graphics::palette() instead + void set_text_color(const ::nana::color&); //deprecated, graphics::palette() instead + + ::nana::color palette(bool for_text) const; + graphics& palette(bool for_text, const ::nana::color&); unsigned bidi_string(const nana::point&, const char_t *, std::size_t len); unsigned bidi_string(const point& pos, const char*, std::size_t len); diff --git a/source/detail/linux_X11/platform_spec.cpp b/source/detail/linux_X11/platform_spec.cpp index 0765b46c..8d4ff735 100644 --- a/source/detail/linux_X11/platform_spec.cpp +++ b/source/detail/linux_X11/platform_spec.cpp @@ -302,6 +302,16 @@ namespace detail #endif } + unsigned drawable_impl_type::get_color() const + { + return color_; + } + + unsigned drawable_impl_type::get_text_color() const + { + return text_color_; + } + void drawable_impl_type::set_color(const ::nana::color& clr) { color_ = (clr.px_color().value & 0xFFFFFF); diff --git a/source/detail/win32/platform_spec.cpp b/source/detail/win32/platform_spec.cpp index dcc22037..767b843f 100644 --- a/source/detail/win32/platform_spec.cpp +++ b/source/detail/win32/platform_spec.cpp @@ -63,6 +63,11 @@ namespace detail return color_; } + unsigned drawable_impl_type::get_text_color() const + { + return text_color_; + } + void drawable_impl_type::set_color(const ::nana::color& clr) { color_ = (clr.px_color().value & 0xFFFFFF); diff --git a/source/paint/graphics.cpp b/source/paint/graphics.cpp index 562d6fac..c6b71f21 100644 --- a/source/paint/graphics.cpp +++ b/source/paint/graphics.cpp @@ -874,6 +874,27 @@ namespace paint handle_->set_text_color(col); } + ::nana::color graphics::palette(bool for_text) const + { + if (handle_) + return static_cast(for_text ? handle_->get_text_color() : handle_->get_color()); + + return{}; + } + + graphics& graphics::palette(bool for_text, const ::nana::color& clr) + { + if (handle_) + { + if (for_text) + handle_->set_text_color(clr); + else + handle_->set_color(clr); + } + + return *this; + } + unsigned graphics::bidi_string(const nana::point& pos, const char_t * str, std::size_t len) { auto moved_pos = pos; diff --git a/source/paint/text_renderer.cpp b/source/paint/text_renderer.cpp index 9fbcf8f6..eaa87349 100644 --- a/source/paint/text_renderer.cpp +++ b/source/paint/text_renderer.cpp @@ -118,11 +118,12 @@ namespace nana { graphics & graph; int x, endpos; - ::nana::color fgcolor; + //::nana::color fgcolor; //deprecated unsigned omitted_pixels; nana::unicode_bidi bidi; std::vector reordered; + /* //deprecated draw_string_omitted(graphics& graph, int x, int endpos, const ::nana::color& fgcolor, bool omitted) : graph(graph), x(x), endpos(endpos), fgcolor(fgcolor) { @@ -132,6 +133,7 @@ namespace nana else this->endpos = x; } + */ draw_string_omitted(graphics& graph, int x, int endpos, bool omitted) : graph(graph), x(x), endpos(endpos) @@ -169,7 +171,8 @@ namespace nana nana::paint::graphics dum_graph({ r.width, r.height }); dum_graph.bitblt(r, graph, pos); - dum_graph.set_text_color(fgcolor); + //dum_graph.set_text_color(fgcolor); //deprecated + dum_graph.set_text_color(graph.palette(true)); dum_graph.string({}, i.begin, len); r.x = pos.x;