diff --git a/.travis.yml b/.travis.yml index 4bd87dfd..3c7d5312 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,6 @@ matrix: - alsa-oss - libx11-dev - libxft-dev - - libboost-filesystem-dev sources: - ubuntu-toolchain-r-test - env: CXX=g++-4.9 CC=gcc-4.9 @@ -35,6 +34,7 @@ matrix: - alsa-oss - libx11-dev - libxft-dev + - libboost-filesystem-dev sources: - ubuntu-toolchain-r-test @@ -56,7 +56,7 @@ matrix: - llvm-toolchain-precise before_install: - - git clone --depth=1 --branch=dev_nana_fs https://github.com/qPCR4vir/nana-demo.git nana-demo + - git clone --depth=1 --branch=dev_nana_fs https://github.com/qPCR4vir/nana-demo.git ../nana-demo - export PATH="$HOME/bin:$PATH" - mkdir ~/bin - wget --no-check-certificate --no-clobber -O /tmp/tools/cmake https://cmake.org/files/v3.4/cmake-3.4.0-rc3-Linux-x86_64.sh || true @@ -66,37 +66,39 @@ install: - /tmp/tools/cmake --prefix="$HOME" --exclude-subdir before_script : - # travis dont have a fisical monitor. We need to instal an emulator: https://docs.travis-ci.com/user/gui-and-headless-browsers/ + # travis don't have a physical monitor. We need to install an emulator: https://docs.travis-ci.com/user/gui-and-headless-browsers/ - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" - sleep 3 # give xvfb some time to start - # we have: qPCR4vir/nana/nana-demo and now we are in: qPCR4vir/nana/ our executable tests will assces: ../Examples/*.bmp etc.(need to be in parallel with nana-demo/Examples) - #- cd nana-demo - - mkdir bin + # we have: qPCR4vir/nana/../nana-demo and now we are in: qPCR4vir/nana/ our executable tests will access: ../nana-demo/Examples/*.bmp etc.(need to be in parallel with nana-demo/Examples) + #- cd ../nana-demo + - mkdir ../nana_lib + - mkdir ../nana_demo_bin + - cd ../nana_lib + - mkdir bin - cd bin - - - - - - - - - - - - - - - - script: - - cmake -G"Unix Makefiles" .. -DNANA_CMAKE_ENABLE_JPEG=ON -DNANA_CMAKE_ENABLE_PNG=OFF -DNANA_CMAKE_BUILD_DEMOS=ON -DNANA_CMAKE_ENABLE_AUDIO=OFF -DNANA_CMAKE_FIND_BOOST_FILESYSTEM=ON -DNANA_CMAKE_BOOST_FILESYSTEM_FORCE=OFF -DNANA_CMAKE_INCLUDE_EXPERIMENTAL_DEMOS=OFF -DNANA_CMAKE_AUTOMATIC_GUI_TESTING=ON + # Installing: the static "nana lib" will be in DESTDIR/CMAKE_INSTALL_PREFIX/lib/ + # and the includes files "nana" in DESTDIR/CMAKE_INSTALL_PREFIX/include/ + # we are in "... nana/../nana_lib/bin/" we need "../../nana" to get the CMakeList.txt of nana. + # Thus, make install will put the nana.lib in "... nana/../nana_lib/lib/" + # and the includes in "... nana/../nana_lib/include/" + - cmake -G"Unix Makefiles" ../../nana -DCMAKE_INSTALL_PREFIX=.. -DNANA_CMAKE_ENABLE_JPEG=ON -DNANA_CMAKE_ENABLE_PNG=OFF -DNANA_CMAKE_BUILD_DEMOS=ON -DNANA_CMAKE_ENABLE_AUDIO=OFF -DNANA_CMAKE_FIND_BOOST_FILESYSTEM=ON -DNANA_CMAKE_BOOST_FILESYSTEM_FORCE=OFF -DNANA_CMAKE_AUTOMATIC_GUI_TESTING=ON - make + - make install + - ls - cd .. - - mv -v bin/ nana-demo/ - - cd nana-demo/bin + - ls + - cd .. + - ls + - cd nana_demo_bin + - cmake -G"Unix Makefiles" ../nana-demo -DCMAKE_INSTALL_PREFIX=.. -DNANA_CMAKE_ENABLE_JPEG=ON -DNANA_CMAKE_ENABLE_PNG=OFF -DNANA_CMAKE_BUILD_DEMOS=ON -DNANA_CMAKE_ENABLE_AUDIO=OFF -DNANA_CMAKE_FIND_BOOST_FILESYSTEM=ON -DNANA_CMAKE_BOOST_FILESYSTEM_FORCE=OFF -DNANA_CMAKE_INCLUDE_EXPERIMENTAL_DEMOS=OFF -DNANA_CMAKE_AUTOMATIC_GUI_TESTING=ON + - make + - make install + # todo: separate resources from sources (a directory for images) + - ls + - cd ../bin - ls - ./a_group_impl - ./animate-bmp diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ebc78bc..782d06cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,10 +35,8 @@ option(NANA_CMAKE_LIBJPEG_FROM_OS "Use libjpeg from operating system." ON) option(NANA_CMAKE_ENABLE_AUDIO "Enable class audio::play for PCM playback." OFF) option(NANA_CMAKE_VERBOSE_PREPROCESSOR "Show annoying debug messages during compilation." ON) option(NANA_CMAKE_STOP_VERBOSE_PREPROCESSOR "Stop compilation after showing the annoying debug messages." ON) -option(NANA_CMAKE_BUILD_DEMOS "Build all the demos form the nana_demo repository." ON) -option(NANA_CMAKE_INCLUDE_EXPERIMENTAL_DEMOS "" ON) option(NANA_CMAKE_AUTOMATIC_GUI_TESTING "Activate automatic GUI testing?" OFF) -option(NANA_CMAKE_BUILD_FreeMe "Build FreeMe (currently broken)?" OFF) + # The ISO C++ File System Technical Specification (ISO-TS, or STD) is optional. @@ -84,7 +82,6 @@ add_definitions(-DNANA_IGNORE_CONF) if(WIN32) add_definitions(-DWIN32) - # set(BUILD_FreeMe ON) #"Build FreeMe only on Windows." #Global MSVC definitions. You may prefer the hand-tuned sln and projects from the nana repository. if(MSVC) option(WIN32_USE_MP "Set to ON to build nana with the /MP option (Visual Studio 2005 and above)." ON) @@ -106,8 +103,6 @@ if(APPLE) add_definitions(-DAPPLE) include_directories(/opt/X11/include/) set(NANA_LINKS "${NANA_LINKS} -L/opt/X11/lib/ -liconv") - #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -liconv") - #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/opt/X11/lib/ -liconv") set(ENABLE_AUDIO OFF) elseif(UNIX) add_definitions(-Dlinux) @@ -116,13 +111,9 @@ endif(APPLE) if(UNIX) set(NANA_LINKS "${NANA_LINKS} -lX11") - #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lX11") - #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lX11") find_package(Freetype) if (FREETYPE_FOUND) include_directories( ${FREETYPE_INCLUDE_DIRS}) - #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lXft") - #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lXft") set(NANA_LINKS "${NANA_LINKS} -lXft") endif(FREETYPE_FOUND) endif(UNIX) @@ -152,7 +143,6 @@ endif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") # enable static linkage if (CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND NOT MINGW) # GNU || CLang not MinGW - #set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -pthread") if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.3) @@ -169,9 +159,6 @@ if (APPLE AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") # A set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libstdc++") endif () -# set (CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}") - - ############# Optional libraries @@ -179,10 +166,7 @@ endif () #Find PNG if(NANA_CMAKE_ENABLE_PNG) add_definitions(-DNANA_ENABLE_PNG) - #set(NANA_PNG_LIB "png") set(NANA_LINKS "${NANA_LINKS} -lpng") - #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lpng") - #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lpng") if(NANA_CMAKE_LIBPNG_FROM_OS) find_package(PNG) if (PNG_FOUND) @@ -195,10 +179,7 @@ endif(NANA_CMAKE_ENABLE_PNG) #Find JPEG if(NANA_CMAKE_ENABLE_JPEG) add_definitions(-DNANA_ENABLE_JPEG) - #set(NANA_JPEG_LIB "jpeg") set(NANA_LINKS "${NANA_LINKS} -ljpeg") - # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ljpeg") - #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ljpeg") if(NANA_CMAKE_LIBJPEG_FROM_OS) find_package(JPEG) if (JPEG_FOUND) @@ -215,8 +196,6 @@ if(NANA_CMAKE_ENABLE_AUDIO) if (ASOUND_FOUND) include_directories( ${ASOUND_INCLUDE_DIRS}) set(NANA_LINKS "${NANA_LINKS} -lasound") - # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lasound") - #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lasound") else(ASOUND_FOUND) message(FATAL_ERROR "libasound is not found") endif(ASOUND_FOUND) @@ -243,9 +222,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(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${Boost_LIBRARIES}") set(NANA_LINKS "${NANA_LINKS} ${Boost_LIBRARIES}") ###### FIRST !!!!!!!!!!!!!!!!! add is not first - #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Boost_LIBRARIES}") endif (Boost_FOUND) set(Boost_USE_STATIC_LIBS ON) @@ -255,11 +232,15 @@ elseif (NANA_CMAKE_FIND_BOOST_FILESYSTEM OR NANA_CMAKE_BOOST_FILESYSTEM_FORCE) endif (NANA_CMAKE_NANA_FILESYSTEM_FORCE) - if(NANA_CMAKE_VERBOSE_PREPROCESSOR) add_definitions(-DVERBOSE_PREPROCESSOR) endif(NANA_CMAKE_VERBOSE_PREPROCESSOR) +if(NANA_CMAKE_AUTOMATIC_GUI_TESTING) + add_definitions(-DNANA_AUTOMATIC_GUI_TESTING) + enable_testing () +endif(NANA_CMAKE_AUTOMATIC_GUI_TESTING) + set(NANA_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/source) set(NANA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include) @@ -298,81 +279,22 @@ target_link_libraries(${PROJECT_NAME} ${NANA_LINKS}) # Headers: use INCLUDE_DIRECTORIES # Libraries: use FIND_LIBRARY and link with the result of it (try to avoid LINK_DIRECTORIES) - + + # Installing: the static "nana lib" will be in DESTDIR/CMAKE_INSTALL_PREFIX/lib/ +# and the includes files "include/nana/" in DESTDIR/CMAKE_INSTALL_PREFIX/include/nana/ install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) # Install include directories too. if(NANA_CMAKE_INSTALL_INCLUDES) - install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/nana - DESTINATION include) + install(DIRECTORY ${NANA_INCLUDE_DIR} + DESTINATION .) endif(NANA_CMAKE_INSTALL_INCLUDES) set_property( TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14 ) - -# TODO: move this nana-demo section to the nana demo repository, and here only include that cmake file - -if (NANA_CMAKE_BUILD_DEMOS) - - if(NANA_CMAKE_AUTOMATIC_GUI_TESTING) - add_definitions(-DNANA_AUTOMATIC_GUI_TESTING) - enable_testing () - endif(NANA_CMAKE_AUTOMATIC_GUI_TESTING) - - - set (demos_dir ../nana-demo/) - set (demos calculator file_explorer helloworld_demo notepad widget_show widget_show2 ) - # Pending: - - set (examples_dir ../nana-demo/Examples/) - set (examples a_group_impl animate-bmp audio_player audio_player_simple - background-effects categ clicked windows-subclassing - dock drag-button draw example.button - example_combox example_listbox example_menu lambda_event.Cpp11 - filebox-txt folder_tree folder_tree_nana folder_tree_std - framework_design_1 framework_design_2 framework_design_3 label_listener - group HelloWord helloword_quit listbox_inline_widget - inputbox listbox_Resolver loader_1 loader_2 - main mbox menu_debug menu_popuper modal_form - MontiHall place_login png textbox_line_number - stretch_image threading thread-pool various_events - window-dragger screen decore - ) - # Pending: - - if (NANA_CMAKE_BUILD_FreeMe) - add_definitions(-DBUILD_FreeMe) - endif (NANA_CMAKE_BUILD_FreeMe) - if (NANA_CMAKE_INCLUDE_EXPERIMENTAL_DEMOS) - list(APPEND demos ) # ?? FreeMe - endif (NANA_CMAKE_INCLUDE_EXPERIMENTAL_DEMOS) - # Pending: FreeMe (added but really completely compiled if defined BUILD_FreeMe ) - - function(set_nana_test dir files) - foreach ( test ${${files}}) - add_executable(${test} "${${dir}}${test}.cpp") - set_property( TARGET ${test} PROPERTY CXX_STANDARD 14 ) - target_link_libraries(${test} ${PROJECT_NAME}) - #if(NANA_CMAKE_AUTOMATIC_GUI_TESTING) - #add_custom_command( TARGET ${test} POST_BUILD COMMAND ${test} ) - #add_custom_target(do_always_${test} ALL COMMAND ${test}) - #add_test(${test} COMMAND ${test}) - #endif(NANA_CMAKE_AUTOMATIC_GUI_TESTING) - install(TARGETS ${test} RUNTIME DESTINATION "../nana-demo/") - message("... to build: ${${dir}}${test}.cpp" ) - endforeach( test ${${files}}) - endfunction(set_nana_test) - - set_nana_test(demos_dir demos) - set_nana_test(examples_dir examples) - -endif (NANA_CMAKE_BUILD_DEMOS) - - - message ( "CMAKE_CXX_COMPILER_ID = " ${CMAKE_CXX_COMPILER_ID}) message ( "COMPILER_IS_CLANG = " ${COMPILER_IS_CLANG}) message ( "CMAKE_COMPILER_IS_GNUCXX= " ${CMAKE_COMPILER_IS_GNUCXX}) @@ -382,6 +304,9 @@ message ( "CMAKE_STATIC_LINKER_FLAGS= " ${CMAKE_STATIC_LINKER_FLAGS}) message ( "NANA_LINKS = " ${NANA_LINKS}) message ( "DESTDIR = " ${DESTDIR}) message ( "CMAKE_INSTALL_PREFIX = " ${CMAKE_INSTALL_PREFIX}) +message ( "NANA_INCLUDE_DIR = " ${NANA_INCLUDE_DIR}) +message ( "CMAKE_CURRENT_SOURCE_DIR= " ${CMAKE_CURRENT_SOURCE_DIR}) + message ( "NANA_CMAKE_ENABLE_AUDIO = " ${NANA_CMAKE_ENABLE_AUDIO}) message ( "NANA_CMAKE_FIND_BOOST_FILESYSTEM = " ${NANA_CMAKE_FIND_BOOST_FILESYSTEM}) message ( "NANA_CMAKE_BOOST_FILESYSTEM_FORCE = " ${NANA_CMAKE_BOOST_FILESYSTEM_FORCE}) diff --git a/README.md b/README.md index cd9a692d..a8b4aec5 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Nana C++ Library -[Linux (gcc 5.2.1 and 4.9.2)![TravisCI build status](https://travis-ci.org/cnjinhao/nana.svg)](https://travis-ci.org/cnjinhao/nana) including [(nana-demos)](https://github.com/qPCR4vir/nana-demo) +[Linux (gcc 5.4.0 and 4.9.2)![TravisCI build status](https://travis-ci.org/cnjinhao/nana.svg)](https://travis-ci.org/cnjinhao/nana) including [(nana-demos)](https://github.com/qPCR4vir/nana-demo) -[Windows (Microsoft (R) Build Engine version 14.0.24720.0) ![AppVeyor uild status](https://ci.appveyor.com/api/projects/status/5j79p9fi887usv7h?svg=true)](https://ci.appveyor.com/project/qPCR4vir/nana) +[Windows (Microsoft (R) Build Engine version 14.0.24720.0) ![AppVeyor build status](https://ci.appveyor.com/api/projects/status/5j79p9fi887usv7h?svg=true)](https://ci.appveyor.com/project/qPCR4vir/nana) [![Licence](https://img.shields.io/badge/license-BSL-blue.svg?style=flat)](LICENSE_1_0.txt) -Nana is a C++ library designed to allow developers to easily create cross-platform GUI applications with modern C++11 style, currently it can work on Linux(X11) and Windows. The nana repository contains the entire source of library, you can browse the source code and submit your pull request for contributing. +Nana is a C++ library designed to allow developers to easily create cross-platform GUI applications with modern C++11 style. Currently it can work on Linux(X11) and Windows. The [nana repository](https://github.com/cnjinhao/nana) contains the entire source of the library. You can browse the source code and submit your pull request for contributing. ## License @@ -24,7 +24,7 @@ The best way to get help with Nana library is by visiting http://nanapro.org/hel ## Sending a Pull Request ? -This project is encourage you to contribute it through sending a pull request! There is a simple rule, please **don't** directly commit your contributions to the **master** branch. According to your commits, please choose the **hotfixes** branch or the **develop** branch. Thank you! +This project encourage you to contribute through sending a pull request! There is a simple rule: please **don't** directly commit your contributions to the **master** branch. According to your commits, please choose the **hotfixes** branch or the **develop** branch. Thank you! ## Introduction to the Repository diff --git a/build/vc2015/nana.vcxproj b/build/vc2015/nana.vcxproj index ce428ef7..e9c0aa02 100644 --- a/build/vc2015/nana.vcxproj +++ b/build/vc2015/nana.vcxproj @@ -249,9 +249,6 @@ - - - diff --git a/build/vc2015/nana.vcxproj.filters b/build/vc2015/nana.vcxproj.filters index aaac3c60..4fcfbb6b 100644 --- a/build/vc2015/nana.vcxproj.filters +++ b/build/vc2015/nana.vcxproj.filters @@ -283,9 +283,4 @@ Source Files\gui\detail - - - Header Files\filesystem - - \ No newline at end of file diff --git a/source/gui/basis.cpp b/source/gui/basis.cpp index 3fe44813..fc8c92eb 100644 --- a/source/gui/basis.cpp +++ b/source/gui/basis.cpp @@ -39,6 +39,9 @@ mouse_wheel::mouse_wheel() : lines(3), characters(3) { #if defined(NANA_WINDOWS) + // https://msdn.microsoft.com/en-us/library/ms997498.aspx + #define SPI_SETWHEELSCROLLCHARS 0x006D + #define SPI_GETWHEELSCROLLCHARS 0x006C ::SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &lines, 0); ::SystemParametersInfo(SPI_GETWHEELSCROLLCHARS, 0, &characters, 0); #endif