Merge branch 'loaden-develop' into develop

This commit is contained in:
Jinhao 2018-04-09 07:43:03 +08:00
commit 355b6b2520
2 changed files with 12 additions and 19 deletions

View File

@ -1,4 +1,4 @@
# CMake configuration for Nana
# CMake configuration for Nana
# Author: Andrew Kornilov(https://github.com/ierofant)
# Contributors:
# Jinhao
@ -59,14 +59,8 @@ option(NANA_CMAKE_BOOST_FILESYSTEM_FORCE "Force use of Boost filesystem if avail
########### Compatibility with CMake 3.1
if(POLICY CMP0054)
# http://www.cmake.org/cmake/help/v3.1/policy/CMP0054.html
cmake_policy(SET CMP0054 OLD)
cmake_policy(SET CMP0054 NEW)
endif()
if(POLICY CMP0004) # ignore leading space
# http://www.cmake.org/cmake/help/v3.0/policy/CMP0004.html
cmake_policy(SET CMP0004 OLD)
endif()
set(CMAKE_DEBUG_POSTFIX "_d")
########### OS
@ -113,7 +107,6 @@ if(WIN32)
endif()
endif()
if(APPLE)
add_definitions(-DAPPLE)
include_directories(/opt/X11/include/)
@ -146,20 +139,21 @@ endif()
#
#
# see at end of: https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dynamic_or_shared.html
#
if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-std=gnu++14 -Wall -g")
set(CMAKE_CXX_FLAGS "-std=gnu++14 -Wall")
else()
set(CMAKE_CXX_FLAGS "-std=c++14 -Wall -g")
set(CMAKE_CXX_FLAGS "-std=c++14 -Wall")
endif()
endif()
# enable static linkage # GNU || CLang not MinGW
if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
if(NANA_CMAKE_SHARED_LIB)
list(APPEND NANA_LINKS -lgcc -lstdc++ -pthread)
else()
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -pthread")
set(CMAKE_EXE_LINKER_FLAGS "-static -pthread")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s")
endif()
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.3)
@ -167,7 +161,6 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
endif()
endif()
if(APPLE AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
list(APPEND NANA_LINKS -stdlib=libstdc++)
endif()
@ -287,6 +280,8 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
add_definitions(-fmax-errors=3)
endif()
set(CMAKE_DEBUG_POSTFIX "_d")
if(NANA_CMAKE_SHARED_LIB)
add_library(${PROJECT_NAME} SHARED ${SOURCES})
else()
@ -315,8 +310,6 @@ if(NANA_CLION) # the Clion IDE don't reconize the install target
COMMENT "Installing ${PROJECT_NAME}")
endif()
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14)
if(NANA_CMAKE_SHARED_LIB)
if(WIN32)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

View File

@ -4552,7 +4552,7 @@ namespace nana
//Check if it scrolls in current screen window
//condition: top of target item is not less than top edge of content view and
//the bottom of target item is not greater than bottom edge of content view.
if ((screen_top + static_cast<int>(item_px) <= logic_top) && (logic_top + static_cast<int>(item_px) + static_cast<int>(item_px) <= screen_bottom))
if ((screen_top + static_cast<int>(item_px) <= logic_top) && (logic_top + static_cast<int>(item_px) + static_cast<int>(item_px) <= static_cast<int>(screen_bottom)))
{
int offset = (static_cast<int>(upward ? screen_top : screen_bottom - item_px) - logic_top) / static_cast<int>(item_px);
target_idx = list.advance(init_idx, offset);
@ -4578,8 +4578,8 @@ namespace nana
target_idx = list.last();
origin.y = list.distance(list.first(), target_idx) * item_px + item_px;
if (origin.y >= (screen_bottom - screen_top))
origin.y -= (screen_bottom - screen_top);
if (origin.y >= static_cast<int>(screen_bottom - screen_top))
origin.y -= static_cast<int>(screen_bottom - screen_top);
else
origin.y = 0;
}