Merge branch 'hotfix-1.5.1' into develop

This commit is contained in:
Jinhao 2017-06-08 21:40:32 +08:00
commit 3cefaa3506
11 changed files with 43 additions and 58 deletions

View File

@ -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) # ??

View File

@ -23,7 +23,7 @@
<ProjectGuid>{42D0520F-EFA5-4831-84FE-2B9085301C5D}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>nana</RootNamespace>
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@ -82,6 +82,18 @@
<IntDir>..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>../bin/</OutDir>
<IntDir>..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)</TargetName>
<IncludePath>..\..\include;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>../bin/</OutDir>
<IntDir>..\..\..\temp\$(ProjectName)\$(PlatformToolset)_$(Configuration)_$(PlatformShortName)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformToolset)_$(Configuration)_$(PlatformShortName)</TargetName>
<IncludePath>..\..\include;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>

View File

@ -893,7 +893,7 @@ namespace nana
}
template<typename T>
T* value_ptr() const
T const * value_ptr() const
{
return any_cast<T>(_m_value());
}

View File

@ -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<value_type&>(this->get_drawer_trigger().at(pos));
return any_cast<value_type&>(this->get_drawer_trigger().at(pos));
}
void close_fly(bool fly) /// Draw or not a close button in each tab.

View File

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

View File

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

View File

@ -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_;

View File

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

View File

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

View File

@ -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());
}
}

View File

@ -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<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);
if (endpos > 0)
{
@ -1220,7 +1221,8 @@ namespace paint
if (new_color != last_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();
}
}
}
@ -1235,7 +1237,8 @@ namespace paint
if (new_color != last_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();
}
}
}