diff --git a/CMakeLists.txt b/CMakeLists.txt index 054137f0..7f89337e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,7 +101,7 @@ endif(WIN32) if(APPLE) add_definitions(-DAPPLE) include_directories(/opt/X11/include/) - set(NANA_LINKS "${NANA_LINKS} -L/opt/X11/lib/ -liconv") + list(APPEND NANA_LINKS -L/opt/X11/lib/ -liconv) set(ENABLE_AUDIO OFF) elseif(UNIX) add_definitions(-Dlinux) @@ -109,11 +109,11 @@ elseif(UNIX) endif(APPLE) if(UNIX) - set(NANA_LINKS "${NANA_LINKS} -lX11") + list(APPEND NANA_LINKS -lX11) find_package(Freetype) if (FREETYPE_FOUND) include_directories( ${FREETYPE_INCLUDE_DIRS}) - set(NANA_LINKS "${NANA_LINKS} -lXft") + list(APPEND NANA_LINKS -lXft) endif(FREETYPE_FOUND) endif(UNIX) @@ -141,13 +141,13 @@ endif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") # enable static linkage # GNU || CLang not MinGW if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") # AND NOT MINGW # set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -pthread") - set(NANA_LINKS "${NANA_LINKS} -static-libgcc -static-libstdc++ -pthread") + list(APPEND NANA_LINKS -static-libgcc -static-libstdc++ -pthread) # message("Setting NANA_LINKS to -static-libgcc -static-libstdc++ -pthread or ${NANA_LINKS}") if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.3) # IS_GNUCXX < 5.3 else(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.3) # set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lstdc++fs") # IS_GNUCXX 5.3 or more - set(NANA_LINKS "${NANA_LINKS} -lstdc++fs") + list(APPEND NANA_LINKS -lstdc++fs) endif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.3) endif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") # AND NOT MINGW @@ -155,7 +155,7 @@ endif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") # if (APPLE AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") # APPLE Clang # set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libstdc++") - set(NANA_LINKS "${NANA_LINKS} -stdlib=libstdc++") + list(APPEND NANA_LINKS -stdlib=libstdc++) endif () @@ -164,11 +164,11 @@ endif () # Find PNG if(NANA_CMAKE_ENABLE_PNG) add_definitions(-DNANA_ENABLE_PNG) - set(NANA_LINKS "${NANA_LINKS} -lpng") if(NANA_CMAKE_LIBPNG_FROM_OS) find_package(PNG) if (PNG_FOUND) include_directories( ${PNG_INCLUDE_DIRS}) + list(APPEND NANA_LINKS ${PNG_LIBRARIES}) add_definitions(-DUSE_LIBPNG_FROM_OS) endif(PNG_FOUND) endif(NANA_CMAKE_LIBPNG_FROM_OS) @@ -177,11 +177,11 @@ endif(NANA_CMAKE_ENABLE_PNG) # Find JPEG if(NANA_CMAKE_ENABLE_JPEG) add_definitions(-DNANA_ENABLE_JPEG) - set(NANA_LINKS "${NANA_LINKS} -ljpeg") if(NANA_CMAKE_LIBJPEG_FROM_OS) find_package(JPEG) if (JPEG_FOUND) - include_directories( ${JPEG_INCLUDE_DIRS}) + include_directories( ${JPEG_INCLUDE_DIR}) + list(APPEND NANA_LINKS ${JPEG_LIBRARY}) add_definitions(-DUSE_LIBJPEG_FROM_OS) endif(JPEG_FOUND) endif(NANA_CMAKE_LIBJPEG_FROM_OS) @@ -194,7 +194,7 @@ if(NANA_CMAKE_ENABLE_AUDIO) find_package(ASOUND) if (ASOUND_FOUND) include_directories( ${ASOUND_INCLUDE_DIRS}) - set(NANA_LINKS "${NANA_LINKS} -lasound") + list(APPEND NANA_LINKS -lasound) else(ASOUND_FOUND) message(FATAL_ERROR "libasound is not found") endif(ASOUND_FOUND) @@ -218,7 +218,7 @@ elseif (NANA_CMAKE_FIND_BOOST_FILESYSTEM OR NANA_CMAKE_BOOST_FILESYSTEM_FORCE) if (Boost_FOUND) add_definitions(-DNANA_BOOST_FILESYSTEM_AVAILABLE) include_directories(SYSTEM "${Boost_INCLUDE_DIR}") - set(NANA_LINKS "${NANA_LINKS} ${Boost_LIBRARIES}") ###### FIRST !!!!!!!!!!!!!!!!! add is not first + list(APPEND NANA_LINKS ${Boost_LIBRARIES}) ###### FIRST !!!!!!!!!!!!!!!!! add is not first endif (Boost_FOUND) set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_STATIC_RUNTIME ON) # ?? diff --git a/build/vc2017/nana.vcxproj b/build/vc2017/nana.vcxproj index 6ee38270..b1e450b8 100644 --- a/build/vc2017/nana.vcxproj +++ b/build/vc2017/nana.vcxproj @@ -23,7 +23,7 @@ {42D0520F-EFA5-4831-84FE-2B9085301C5D} Win32Proj nana - 10.0.14393.0 + 10.0.15063.0 @@ -82,6 +82,18 @@ ..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\ $(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName) + + ../bin/ + ..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\ + $(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName) + ..\..\include;$(IncludePath) + + + ../bin/ + ..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\ + $(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName) + ..\..\include;$(IncludePath) + diff --git a/include/nana/gui/widgets/listbox.hpp b/include/nana/gui/widgets/listbox.hpp index f3cc09df..552b2e36 100644 --- a/include/nana/gui/widgets/listbox.hpp +++ b/include/nana/gui/widgets/listbox.hpp @@ -893,7 +893,7 @@ namespace nana } template - T* value_ptr() const + T const * value_ptr() const { return any_cast(_m_value()); } diff --git a/include/nana/gui/widgets/tabbar.hpp b/include/nana/gui/widgets/tabbar.hpp index f22e6e5c..0e2e2e9c 100644 --- a/include/nana/gui/widgets/tabbar.hpp +++ b/include/nana/gui/widgets/tabbar.hpp @@ -237,9 +237,9 @@ namespace nana return this->get_drawer_trigger().activated(); } - value_type & at(std::size_t pos) const /// Returns pos'th element + value_type const & at(std::size_t pos) const /// Returns pos'th element { - return static_cast(this->get_drawer_trigger().at(pos)); + return any_cast(this->get_drawer_trigger().at(pos)); } void close_fly(bool fly) /// Draw or not a close button in each tab. diff --git a/source/detail/mswin/platform_spec.hpp b/source/detail/mswin/platform_spec.hpp index 6de8c4e2..ed4b0d9a 100644 --- a/source/detail/mswin/platform_spec.hpp +++ b/source/detail/mswin/platform_spec.hpp @@ -1,7 +1,7 @@ /* * Platform Specification Implementation * 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. * (See accompanying file LICENSE_1_0.txt or copy at @@ -144,7 +144,6 @@ namespace detail drawable_impl_type(); ~drawable_impl_type(); - void fgcolor(const ::nana::color&); //deprecated unsigned get_color() const; unsigned get_text_color() const; void set_color(const ::nana::color&); diff --git a/source/detail/platform_spec_posix.cpp b/source/detail/platform_spec_posix.cpp index 89ea7b8c..0b7e9538 100644 --- a/source/detail/platform_spec_posix.cpp +++ b/source/detail/platform_spec_posix.cpp @@ -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_spec::instance().lock_xlib(); diff --git a/source/detail/platform_spec_windows.cpp b/source/detail/platform_spec_windows.cpp index 3e4e044b..eb58c603 100644 --- a/source/detail/platform_spec_windows.cpp +++ b/source/detail/platform_spec_windows.cpp @@ -221,11 +221,6 @@ namespace detail ::DeleteObject(round_region.handle); } - void drawable_impl_type::fgcolor(const ::nana::color& clr) - { - set_text_color(clr); - } - unsigned drawable_impl_type::get_color() const { return color_; diff --git a/source/detail/posix/platform_spec.hpp b/source/detail/posix/platform_spec.hpp index f1f32448..2ada1eac 100644 --- a/source/detail/posix/platform_spec.hpp +++ b/source/detail/posix/platform_spec.hpp @@ -1,7 +1,7 @@ /* * Platform Specification Implementation * 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. * (See accompanying file LICENSE_1_0.txt or copy at @@ -101,7 +101,6 @@ namespace detail drawable_impl_type(); ~drawable_impl_type(); - void fgcolor(const ::nana::color&); //deprecated unsigned get_color() const; unsigned get_text_color() const; void set_color(const ::nana::color&); diff --git a/source/gui/widgets/spinbox.cpp b/source/gui/widgets/spinbox.cpp index 87cec724..2cb89870 100644 --- a/source/gui/widgets/spinbox.cpp +++ b/source/gui/widgets/spinbox.cpp @@ -441,7 +441,10 @@ namespace nana text = to_wstring(modifier_.prefix + range_->value() + modifier_.suffix); if (editor_->text() != text) + { editor_->text(text, false); + editor_->try_refresh(); + } _m_draw_spins(spin_stated_); } @@ -736,7 +739,8 @@ namespace nana if (editor) { editor->text(to_wstring(text), false); - API::refresh_window(*this); + if (editor->try_refresh()) + API::update_window(*this); } } }//end namespace nana diff --git a/source/gui/widgets/textbox.cpp b/source/gui/widgets/textbox.cpp index 909cde92..5ae9454b 100644 --- a/source/gui/widgets/textbox.cpp +++ b/source/gui/widgets/textbox.cpp @@ -738,7 +738,9 @@ namespace drawerbase { if (editor) { editor->text(to_wstring(str), false); - API::update_window(this->handle()); + + if (editor->try_refresh()) + API::update_window(this->handle()); } } diff --git a/source/paint/graphics.cpp b/source/paint/graphics.cpp index 075f8be1..21aa4948 100644 --- a/source/paint/graphics.cpp +++ b/source/paint/graphics.cpp @@ -1205,7 +1205,8 @@ namespace paint unsigned last_color = (int(r) << 16) | (int(g) << 8) | int(b); Display * disp = nana::detail::platform_spec::instance().open_display(); - impl_->handle->fgcolor(static_cast(last_color)); + impl_->handle->set_color(static_cast(last_color)); + impl_->handle->update_color(); const int endpos = deltapx + (vertical ? rct.y : rct.x); if (endpos > 0) { @@ -1220,7 +1221,8 @@ namespace paint if (new_color != last_color) { last_color = new_color; - impl_->handle->fgcolor(static_cast(last_color)); + impl_->handle->set_color(static_cast(last_color)); + impl_->handle->update_color(); } } } @@ -1235,7 +1237,8 @@ namespace paint if (new_color != last_color) { last_color = new_color; - impl_->handle->fgcolor(static_cast(last_color)); + impl_->handle->set_color(static_cast(last_color)); + impl_->handle->update_color(); } } }