From 0eb7456128fd82a7fc4eb533bf494fe898a70a2c Mon Sep 17 00:00:00 2001 From: Jinhao Date: Mon, 23 Nov 2015 22:25:32 +0800 Subject: [PATCH 01/28] fix a compile error with API::enum_widgets(#90) --- include/nana/gui/programming_interface.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/nana/gui/programming_interface.hpp b/include/nana/gui/programming_interface.hpp index 520bc05c..6227f6bb 100644 --- a/include/nana/gui/programming_interface.hpp +++ b/include/nana/gui/programming_interface.hpp @@ -113,7 +113,7 @@ namespace API private: bool _m_enum_fn(::nana::widget* wd) override { - return _m_enum_call(wd, nullptr); + return _m_enum_call(wd); } template::value>::type* = nullptr> From c5afe06ecd4dc977d8a7e8f90afbdf3c80c13d2c Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Tue, 24 Nov 2015 08:45:47 +0100 Subject: [PATCH 02/28] Create readme.md --- build/bakefile/readme.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 build/bakefile/readme.md diff --git a/build/bakefile/readme.md b/build/bakefile/readme.md new file mode 100644 index 00000000..88764041 --- /dev/null +++ b/build/bakefile/readme.md @@ -0,0 +1,4 @@ +## Instructions: +1. +2. + From 8178f685459408cace49c78637c304b075ede8db Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Tue, 24 Nov 2015 08:54:50 +0100 Subject: [PATCH 03/28] Rename readme.txt to readme.md --- build/makefile/{readme.txt => readme.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename build/makefile/{readme.txt => readme.md} (100%) diff --git a/build/makefile/readme.txt b/build/makefile/readme.md similarity index 100% rename from build/makefile/readme.txt rename to build/makefile/readme.md From da073d23296bc961debce45b048d9edfaaeaee12 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Tue, 24 Nov 2015 08:55:32 +0100 Subject: [PATCH 04/28] Update readme.md --- build/makefile/readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/makefile/readme.md b/build/makefile/readme.md index fc8df43f..522ffc71 100644 --- a/build/makefile/readme.md +++ b/build/makefile/readme.md @@ -4,6 +4,7 @@ X11, pthread, Xpm, rt, dl, freetype2, Xft, fontconfig, ALSA Writing a makefile for creating applications with Nana C++ Library ------------------- +''' GCC = g++ NANAPATH = [The folder of Nana C++ Library] BIN = [The bin file what you want to create.] @@ -28,4 +29,5 @@ $(NANALIB): clean: rm -f $(LINKOBJ) +''' ------------------- From 8ff252dbf3c9ed4967633e9f71b1ff7565c5ad31 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Tue, 24 Nov 2015 08:57:00 +0100 Subject: [PATCH 05/28] Update readme.md --- build/makefile/readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/makefile/readme.md b/build/makefile/readme.md index 522ffc71..1b8d9b1b 100644 --- a/build/makefile/readme.md +++ b/build/makefile/readme.md @@ -4,7 +4,7 @@ X11, pthread, Xpm, rt, dl, freetype2, Xft, fontconfig, ALSA Writing a makefile for creating applications with Nana C++ Library ------------------- -''' +``` GCC = g++ NANAPATH = [The folder of Nana C++ Library] BIN = [The bin file what you want to create.] @@ -29,5 +29,5 @@ $(NANALIB): clean: rm -f $(LINKOBJ) -''' +``` ------------------- From f9af384f6956fb951d7afec6d2f7536a3673f5ad Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Tue, 24 Nov 2015 12:18:22 +0100 Subject: [PATCH 06/28] delete automatic files to avoid confusions. --- build/vc2013-bkl/vc2013/nana.sln | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 build/vc2013-bkl/vc2013/nana.sln diff --git a/build/vc2013-bkl/vc2013/nana.sln b/build/vc2013-bkl/vc2013/nana.sln deleted file mode 100644 index 8f49cc71..00000000 --- a/build/vc2013-bkl/vc2013/nana.sln +++ /dev/null @@ -1,22 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.21005.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nana", "nana.vcxproj", "{78487472-4F43-5A69-93CC-4FDC4D124241}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {78487472-4F43-5A69-93CC-4FDC4D124241}.Debug|Win32.ActiveCfg = Debug|Win32 - {78487472-4F43-5A69-93CC-4FDC4D124241}.Debug|Win32.Build.0 = Debug|Win32 - {78487472-4F43-5A69-93CC-4FDC4D124241}.Release|Win32.ActiveCfg = Release|Win32 - {78487472-4F43-5A69-93CC-4FDC4D124241}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal From 3323da8baa0c03b3b53c1291eb29a1b1d0b66f86 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Tue, 24 Nov 2015 12:18:54 +0100 Subject: [PATCH 07/28] Delete nana.vcxproj --- build/vc2013-bkl/vc2013/nana.vcxproj | 163 --------------------------- 1 file changed, 163 deletions(-) delete mode 100644 build/vc2013-bkl/vc2013/nana.vcxproj diff --git a/build/vc2013-bkl/vc2013/nana.vcxproj b/build/vc2013-bkl/vc2013/nana.vcxproj deleted file mode 100644 index c3b2d3ac..00000000 --- a/build/vc2013-bkl/vc2013/nana.vcxproj +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - Debug - Win32 - - - Release - Win32 - - - - {78487472-4F43-5A69-93CC-4FDC4D124241} - Win32Proj - nana - nana - - - - StaticLibrary - true - Unicode - v120 - - - StaticLibrary - false - Unicode - v120 - - - - - - - - - - - - - - - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - false - ..\..\include - MultiThreadedDebugDLL - - - Windows - true - - - - - Level3 - MaxSpeed - true - true - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - false - ..\..\include - MultiThreadedDLL - - - Windows - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 6e9b3a7494c8b0adc187269b0b3d24d82b542dac Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Tue, 24 Nov 2015 12:19:15 +0100 Subject: [PATCH 08/28] Delete nana.vcxproj.filters --- build/vc2013-bkl/vc2013/nana.vcxproj.filters | 261 ------------------- 1 file changed, 261 deletions(-) delete mode 100644 build/vc2013-bkl/vc2013/nana.vcxproj.filters diff --git a/build/vc2013-bkl/vc2013/nana.vcxproj.filters b/build/vc2013-bkl/vc2013/nana.vcxproj.filters deleted file mode 100644 index 2858b8fa..00000000 --- a/build/vc2013-bkl/vc2013/nana.vcxproj.filters +++ /dev/null @@ -1,261 +0,0 @@ - - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - From e1a80fccd33e2756658f3962ba253f87e331d9aa Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Tue, 24 Nov 2015 12:20:12 +0100 Subject: [PATCH 09/28] Delete makefile --- build/makefile-bkl/makefile | 305 ------------------------------------ 1 file changed, 305 deletions(-) delete mode 100644 build/makefile-bkl/makefile diff --git a/build/makefile-bkl/makefile b/build/makefile-bkl/makefile deleted file mode 100644 index 03225611..00000000 --- a/build/makefile-bkl/makefile +++ /dev/null @@ -1,305 +0,0 @@ -# This file was automatically generated by bakefile. -# -# Any manual changes will be lost if it is regenerated, -# modify the source .bkl file instead if possible. - -# You may define standard make variables such as CFLAGS or -# CXXFLAGS to affect the build. For example, you could use: -# -# make CXXFLAGS=-g -# -# to build with debug information. The full list of variables -# that can be used by this makefile is: -# AR, CC, CFLAGS, CPPFLAGS, CXX, CXXFLAGS, LD, LDFLAGS, MAKE, RANLIB. - -# You may also specify config=Debug|Release -# or their corresponding lower case variants on make command line to select -# the corresponding default flags values. -ifeq ($(config),debug) -override config := Debug -endif -ifeq ($(config),release) -override config := Release -endif -ifeq ($(config),Debug) -override CPPFLAGS += -DDEBUG -override CFLAGS += -g -O0 -override CXXFLAGS += -g -O0 -override LDFLAGS += -g -else ifeq ($(config),Release) -override CPPFLAGS += -DNDEBUG -override CFLAGS += -O2 -override CXXFLAGS += -O2 -else ifneq (,$(config)) -$(warning Unknown configuration "$(config)") -endif - -# Use "make RANLIB=''" for platforms without ranlib. -RANLIB ?= ranlib - -CC := cc -CXX := c++ - -# The directory for the build files, may be overridden on make command line. -builddir = . - -ifneq ($(builddir),.) -_builddir := $(if $(findstring $(abspath $(builddir)),$(builddir)),,../../../)$(builddir)/../build/makefile/ -_builddir_error := $(shell mkdir -p $(_builddir) 2>&1) -$(if $(_builddir_error),$(error Failed to create build directory: $(_builddir_error))) -endif -all: $(_builddir)libnana.a - -$(_builddir)libnana.a: $(_builddir)nana_any.o $(_builddir)nana_basic_types.o $(_builddir)nana_charset.o $(_builddir)nana_datetime.o $(_builddir)nana_deploy.o $(_builddir)nana_exceptions.o $(_builddir)nana_internationalization.o $(_builddir)nana_traits.o $(_builddir)nana_unicode_bidi.o $(_builddir)nana_file_iterator.o $(_builddir)nana_fs_utility.o $(_builddir)nana_player.o $(_builddir)nana_audio_device.o $(_builddir)nana_audio_stream.o $(_builddir)nana_buffer_preparation.o $(_builddir)nana_animation.o $(_builddir)nana_basis.o $(_builddir)nana_dragger.o $(_builddir)nana_drawing.o $(_builddir)nana_effects.o $(_builddir)nana_element.o $(_builddir)nana_filebox.o $(_builddir)nana_layout_utility.o $(_builddir)nana_msgbox.o $(_builddir)nana_notifier.o $(_builddir)nana_place.o $(_builddir)nana_programming_interface.o $(_builddir)nana_screen.o $(_builddir)nana_state_cursor.o $(_builddir)nana_timer.o $(_builddir)nana_tooltip.o $(_builddir)nana_wvl.o $(_builddir)nana_basic_window.o $(_builddir)nana_bedrock_pi.o $(_builddir)nana_color_schemes.o $(_builddir)nana_drawer.o $(_builddir)nana_element_store.o $(_builddir)nana_events_operation.o $(_builddir)nana_native_window_interface.o $(_builddir)nana_window_layout.o $(_builddir)nana_window_manager.o $(_builddir)nana_button.o $(_builddir)nana_categorize.o $(_builddir)nana_checkbox.o $(_builddir)nana_combox.o $(_builddir)nana_date_chooser.o $(_builddir)nana_float_listbox.o $(_builddir)nana_form.o $(_builddir)nana_frame.o $(_builddir)nana_label.o $(_builddir)nana_listbox.o $(_builddir)nana_menubar.o $(_builddir)nana_menu.o $(_builddir)nana_panel.o $(_builddir)nana_picture.o $(_builddir)nana_progress.o $(_builddir)nana_scroll.o $(_builddir)nana_slider.o $(_builddir)nana_spinbox.o $(_builddir)nana_tabbar.o $(_builddir)nana_textbox.o $(_builddir)nana_toolbar.o $(_builddir)nana_treebox.o $(_builddir)nana_widget.o $(_builddir)nana_text_editor.o $(_builddir)nana_gadget.o $(_builddir)nana_graphics.o $(_builddir)nana_image.o $(_builddir)nana_image_process_selector.o $(_builddir)nana_pixel_buffer.o $(_builddir)nana_text_renderer.o $(_builddir)nana_image_process_provider.o $(_builddir)nana_native_paint_interface.o $(_builddir)nana_dataexch.o $(_builddir)nana_platform.o $(_builddir)nana_shared_wrapper.o $(_builddir)nana_timepiece.o $(_builddir)nana_pool.o $(_builddir)nana_platform_spec_selector.o $(_builddir)nana_bedrock_selector.o - $(AR) rcu $@ $(_builddir)nana_any.o $(_builddir)nana_basic_types.o $(_builddir)nana_charset.o $(_builddir)nana_datetime.o $(_builddir)nana_deploy.o $(_builddir)nana_exceptions.o $(_builddir)nana_internationalization.o $(_builddir)nana_traits.o $(_builddir)nana_unicode_bidi.o $(_builddir)nana_file_iterator.o $(_builddir)nana_fs_utility.o $(_builddir)nana_player.o $(_builddir)nana_audio_device.o $(_builddir)nana_audio_stream.o $(_builddir)nana_buffer_preparation.o $(_builddir)nana_animation.o $(_builddir)nana_basis.o $(_builddir)nana_dragger.o $(_builddir)nana_drawing.o $(_builddir)nana_effects.o $(_builddir)nana_element.o $(_builddir)nana_filebox.o $(_builddir)nana_layout_utility.o $(_builddir)nana_msgbox.o $(_builddir)nana_notifier.o $(_builddir)nana_place.o $(_builddir)nana_programming_interface.o $(_builddir)nana_screen.o $(_builddir)nana_state_cursor.o $(_builddir)nana_timer.o $(_builddir)nana_tooltip.o $(_builddir)nana_wvl.o $(_builddir)nana_basic_window.o $(_builddir)nana_bedrock_pi.o $(_builddir)nana_color_schemes.o $(_builddir)nana_drawer.o $(_builddir)nana_element_store.o $(_builddir)nana_events_operation.o $(_builddir)nana_native_window_interface.o $(_builddir)nana_window_layout.o $(_builddir)nana_window_manager.o $(_builddir)nana_button.o $(_builddir)nana_categorize.o $(_builddir)nana_checkbox.o $(_builddir)nana_combox.o $(_builddir)nana_date_chooser.o $(_builddir)nana_float_listbox.o $(_builddir)nana_form.o $(_builddir)nana_frame.o $(_builddir)nana_label.o $(_builddir)nana_listbox.o $(_builddir)nana_menubar.o $(_builddir)nana_menu.o $(_builddir)nana_panel.o $(_builddir)nana_picture.o $(_builddir)nana_progress.o $(_builddir)nana_scroll.o $(_builddir)nana_slider.o $(_builddir)nana_spinbox.o $(_builddir)nana_tabbar.o $(_builddir)nana_textbox.o $(_builddir)nana_toolbar.o $(_builddir)nana_treebox.o $(_builddir)nana_widget.o $(_builddir)nana_text_editor.o $(_builddir)nana_gadget.o $(_builddir)nana_graphics.o $(_builddir)nana_image.o $(_builddir)nana_image_process_selector.o $(_builddir)nana_pixel_buffer.o $(_builddir)nana_text_renderer.o $(_builddir)nana_image_process_provider.o $(_builddir)nana_native_paint_interface.o $(_builddir)nana_dataexch.o $(_builddir)nana_platform.o $(_builddir)nana_shared_wrapper.o $(_builddir)nana_timepiece.o $(_builddir)nana_pool.o $(_builddir)nana_platform_spec_selector.o $(_builddir)nana_bedrock_selector.o - $(RANLIB) $@ - -$(_builddir)nana_any.o: ../../source/any.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/any.cpp - -$(_builddir)nana_basic_types.o: ../../source/basic_types.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/basic_types.cpp - -$(_builddir)nana_charset.o: ../../source/charset.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/charset.cpp - -$(_builddir)nana_datetime.o: ../../source/datetime.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/datetime.cpp - -$(_builddir)nana_deploy.o: ../../source/deploy.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/deploy.cpp - -$(_builddir)nana_exceptions.o: ../../source/exceptions.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/exceptions.cpp - -$(_builddir)nana_internationalization.o: ../../source/internationalization.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/internationalization.cpp - -$(_builddir)nana_traits.o: ../../source/traits.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/traits.cpp - -$(_builddir)nana_unicode_bidi.o: ../../source/unicode_bidi.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/unicode_bidi.cpp - -$(_builddir)nana_file_iterator.o: ../../source/filesystem/file_iterator.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/filesystem/file_iterator.cpp - -$(_builddir)nana_fs_utility.o: ../../source/filesystem/fs_utility.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/filesystem/fs_utility.cpp - -$(_builddir)nana_player.o: ../../source/audio/player.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/audio/player.cpp - -$(_builddir)nana_audio_device.o: ../../source/audio/detail/audio_device.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/audio/detail/audio_device.cpp - -$(_builddir)nana_audio_stream.o: ../../source/audio/detail/audio_stream.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/audio/detail/audio_stream.cpp - -$(_builddir)nana_buffer_preparation.o: ../../source/audio/detail/buffer_preparation.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/audio/detail/buffer_preparation.cpp - -$(_builddir)nana_animation.o: ../../source/gui/animation.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/animation.cpp - -$(_builddir)nana_basis.o: ../../source/gui/basis.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/basis.cpp - -$(_builddir)nana_dragger.o: ../../source/gui/dragger.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/dragger.cpp - -$(_builddir)nana_drawing.o: ../../source/gui/drawing.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/drawing.cpp - -$(_builddir)nana_effects.o: ../../source/gui/effects.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/effects.cpp - -$(_builddir)nana_element.o: ../../source/gui/element.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/element.cpp - -$(_builddir)nana_filebox.o: ../../source/gui/filebox.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/filebox.cpp - -$(_builddir)nana_layout_utility.o: ../../source/gui/layout_utility.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/layout_utility.cpp - -$(_builddir)nana_msgbox.o: ../../source/gui/msgbox.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/msgbox.cpp - -$(_builddir)nana_notifier.o: ../../source/gui/notifier.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/notifier.cpp - -$(_builddir)nana_place.o: ../../source/gui/place.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/place.cpp - -$(_builddir)nana_programming_interface.o: ../../source/gui/programming_interface.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/programming_interface.cpp - -$(_builddir)nana_screen.o: ../../source/gui/screen.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/screen.cpp - -$(_builddir)nana_state_cursor.o: ../../source/gui/state_cursor.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/state_cursor.cpp - -$(_builddir)nana_timer.o: ../../source/gui/timer.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/timer.cpp - -$(_builddir)nana_tooltip.o: ../../source/gui/tooltip.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/tooltip.cpp - -$(_builddir)nana_wvl.o: ../../source/gui/wvl.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/wvl.cpp - -$(_builddir)nana_basic_window.o: ../../source/gui/detail/basic_window.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/detail/basic_window.cpp - -$(_builddir)nana_bedrock_pi.o: ../../source/gui/detail/bedrock_pi.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/detail/bedrock_pi.cpp - -$(_builddir)nana_color_schemes.o: ../../source/gui/detail/color_schemes.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/detail/color_schemes.cpp - -$(_builddir)nana_drawer.o: ../../source/gui/detail/drawer.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/detail/drawer.cpp - -$(_builddir)nana_element_store.o: ../../source/gui/detail/element_store.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/detail/element_store.cpp - -$(_builddir)nana_events_operation.o: ../../source/gui/detail/events_operation.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/detail/events_operation.cpp - -$(_builddir)nana_native_window_interface.o: ../../source/gui/detail/native_window_interface.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/detail/native_window_interface.cpp - -$(_builddir)nana_window_layout.o: ../../source/gui/detail/window_layout.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/detail/window_layout.cpp - -$(_builddir)nana_window_manager.o: ../../source/gui/detail/window_manager.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/detail/window_manager.cpp - -$(_builddir)nana_button.o: ../../source/gui/widgets/button.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/widgets/button.cpp - -$(_builddir)nana_categorize.o: ../../source/gui/widgets/categorize.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/widgets/categorize.cpp - -$(_builddir)nana_checkbox.o: ../../source/gui/widgets/checkbox.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/widgets/checkbox.cpp - -$(_builddir)nana_combox.o: ../../source/gui/widgets/combox.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/widgets/combox.cpp - -$(_builddir)nana_date_chooser.o: ../../source/gui/widgets/date_chooser.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/widgets/date_chooser.cpp - -$(_builddir)nana_float_listbox.o: ../../source/gui/widgets/float_listbox.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/widgets/float_listbox.cpp - -$(_builddir)nana_form.o: ../../source/gui/widgets/form.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/widgets/form.cpp - -$(_builddir)nana_frame.o: ../../source/gui/widgets/frame.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/widgets/frame.cpp - -$(_builddir)nana_label.o: ../../source/gui/widgets/label.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/widgets/label.cpp - -$(_builddir)nana_listbox.o: ../../source/gui/widgets/listbox.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/widgets/listbox.cpp - -$(_builddir)nana_menubar.o: ../../source/gui/widgets/menubar.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/widgets/menubar.cpp - -$(_builddir)nana_menu.o: ../../source/gui/widgets/menu.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/widgets/menu.cpp - -$(_builddir)nana_panel.o: ../../source/gui/widgets/panel.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/widgets/panel.cpp - -$(_builddir)nana_picture.o: ../../source/gui/widgets/picture.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/widgets/picture.cpp - -$(_builddir)nana_progress.o: ../../source/gui/widgets/progress.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/widgets/progress.cpp - -$(_builddir)nana_scroll.o: ../../source/gui/widgets/scroll.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/widgets/scroll.cpp - -$(_builddir)nana_slider.o: ../../source/gui/widgets/slider.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/widgets/slider.cpp - -$(_builddir)nana_spinbox.o: ../../source/gui/widgets/spinbox.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/widgets/spinbox.cpp - -$(_builddir)nana_tabbar.o: ../../source/gui/widgets/tabbar.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/widgets/tabbar.cpp - -$(_builddir)nana_textbox.o: ../../source/gui/widgets/textbox.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/widgets/textbox.cpp - -$(_builddir)nana_toolbar.o: ../../source/gui/widgets/toolbar.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/widgets/toolbar.cpp - -$(_builddir)nana_treebox.o: ../../source/gui/widgets/treebox.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/widgets/treebox.cpp - -$(_builddir)nana_widget.o: ../../source/gui/widgets/widget.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/widgets/widget.cpp - -$(_builddir)nana_text_editor.o: ../../source/gui/widgets/skeletons/text_editor.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/widgets/skeletons/text_editor.cpp - -$(_builddir)nana_gadget.o: ../../source/paint/gadget.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/paint/gadget.cpp - -$(_builddir)nana_graphics.o: ../../source/paint/graphics.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/paint/graphics.cpp - -$(_builddir)nana_image.o: ../../source/paint/image.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/paint/image.cpp - -$(_builddir)nana_image_process_selector.o: ../../source/paint/image_process_selector.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/paint/image_process_selector.cpp - -$(_builddir)nana_pixel_buffer.o: ../../source/paint/pixel_buffer.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/paint/pixel_buffer.cpp - -$(_builddir)nana_text_renderer.o: ../../source/paint/text_renderer.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/paint/text_renderer.cpp - -$(_builddir)nana_image_process_provider.o: ../../source/paint/detail/image_process_provider.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/paint/detail/image_process_provider.cpp - -$(_builddir)nana_native_paint_interface.o: ../../source/paint/detail/native_paint_interface.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/paint/detail/native_paint_interface.cpp - -$(_builddir)nana_dataexch.o: ../../source/system/dataexch.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/system/dataexch.cpp - -$(_builddir)nana_platform.o: ../../source/system/platform.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/system/platform.cpp - -$(_builddir)nana_shared_wrapper.o: ../../source/system/shared_wrapper.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/system/shared_wrapper.cpp - -$(_builddir)nana_timepiece.o: ../../source/system/timepiece.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/system/timepiece.cpp - -$(_builddir)nana_pool.o: ../../source/threads/pool.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/threads/pool.cpp - -$(_builddir)nana_platform_spec_selector.o: ../../source/detail/platform_spec_selector.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/detail/platform_spec_selector.cpp - -$(_builddir)nana_bedrock_selector.o: ../../source/gui/detail/bedrock_selector.cpp - $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) -MD -MP -fPIC -DPIC -pthread -I../../include -std=c++0x `pkg-config --cflags freetype2` ../../source/gui/detail/bedrock_selector.cpp - -clean: - rm -f $(_builddir)*.o - rm -f $(_builddir)*.d - rm -f $(_builddir)libnana.a - -.PHONY: all clean - -# Dependencies tracking: --include *.d From 68611797f8dfbaf9f0050588c40fab6c0a662fe1 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Tue, 24 Nov 2015 12:47:18 +0100 Subject: [PATCH 10/28] Update .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 80730e12..5c5fac64 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ Thumbs.db bii/build/* bii/cmake/* bii/deps/* +build/vc2013-bkl/* +build/makefile-bkl/* *.obj *.exe *.pdb From a55b94299cade7a8cc5e3cbe4f267ebb5059580d Mon Sep 17 00:00:00 2001 From: Jinhao Date: Wed, 25 Nov 2015 00:45:39 +0800 Subject: [PATCH 11/28] change arg_click for holding mouse information(#89) --- include/nana/gui/detail/general_events.hpp | 13 ++++---- source/gui/detail/linux_X11/bedrock.cpp | 39 ++++++++++------------ source/gui/detail/win32/bedrock.cpp | 36 +++++++++----------- source/gui/widgets/button.cpp | 2 +- 4 files changed, 40 insertions(+), 50 deletions(-) diff --git a/include/nana/gui/detail/general_events.hpp b/include/nana/gui/detail/general_events.hpp index cdb6ac3a..a6f17bc6 100644 --- a/include/nana/gui/detail/general_events.hpp +++ b/include/nana/gui/detail/general_events.hpp @@ -427,11 +427,12 @@ namespace nana ::nana::point pos; ///< cursor position in the event window ::nana::mouse button; ///< indicates a button which triggers the event - bool left_button; ///< mouse left button is pressed? - bool mid_button; ///< mouse middle button is pressed? - bool right_button; ///< mouse right button is pressed? - bool shift; ///< keyboard Shift is pressed? - bool ctrl; ///< keyboard Ctrl is pressed? + bool left_button; ///< mouse left button is pressed? + bool mid_button; ///< mouse middle button is pressed? + bool right_button; ///< mouse right button is pressed? + bool alt; ///< keyboard alt is pressed? + bool shift; ///< keyboard Shift is pressed? + bool ctrl; ///< keyboard Ctrl is pressed? /// Checks if left button is operated, bool is_left_button() const @@ -521,7 +522,7 @@ namespace nana struct arg_click : public event_arg { ::nana::window window_handle; ///< A handle to the event window - bool by_mouse; ///< Determines whether the event is emitted by clicking mouse button + const arg_mouse* mouse_args; ///< If it is not null, it refers to the mouse arguments for click event emitted by mouse, nullptr otherwise. }; /// provides some fundamental events that every widget owns. diff --git a/source/gui/detail/linux_X11/bedrock.cpp b/source/gui/detail/linux_X11/bedrock.cpp index 2bcf5715..991cf8ef 100644 --- a/source/gui/detail/linux_X11/bedrock.cpp +++ b/source/gui/detail/linux_X11/bedrock.cpp @@ -467,8 +467,9 @@ namespace detail arg.left_button = ((Button1Mask & mask_state) != 0) || (::nana::mouse::left_button == arg.button) ; arg.right_button = ((Button2Mask & mask_state) != 0) || (::nana::mouse::right_button == arg.button); arg.mid_button = ((Button3Mask & mask_state) != 0) || (::nana::mouse::middle_button == arg.button); - arg.shift = (ShiftMask & mask_state); - arg.ctrl = (ControlMask & mask_state); + arg.alt = ((Mod1Mask & mask_state) != 0); + arg.shift = £¨(ShiftMask & mask_state) != 0); + arg.ctrl = £¨(ControlMask & mask_state) != 0); } @@ -815,21 +816,24 @@ namespace detail { auto retain = msgwnd->together.events_ptr; - arg_mouse arg; + ::nana::arg_mouse arg; assign_arg(arg, msgwnd, message, xevent); + ::nana::arg_click click_arg; + + //the window_handle of click_arg is used as a flag to determinate whether to emit click event. + click_arg.window_handle = nullptr; + click_arg.mouse_args = &arg; + const bool hit = msgwnd->dimension.is_hit(arg.pos); - bool fire_click = false; if(msgwnd == pressed_wd) { if((arg.button == ::nana::mouse::left_button) && hit) { msgwnd->flags.action = mouse_action::over; - arg_click arg; - arg.window_handle = reinterpret_cast(msgwnd); - arg.by_mouse = true; + + click_arg.window_handle = reinterpret_cast(msgwnd); emit_drawer(&drawer::click, msgwnd, arg, &context); - fire_click = true; } } @@ -845,13 +849,8 @@ namespace detail arg.evt_code = event_code::mouse_up; emit_drawer(&drawer::mouse_up, msgwnd, arg, &context); - if(fire_click) - { - arg_click arg; - arg.window_handle = reinterpret_cast(msgwnd); - arg.by_mouse = true; - evt_ptr->click.emit(arg); - } + if(click_arg.window_handle) + evt_ptr->click.emit(click_arg); if (brock.wd_manager().available(msgwnd)) { @@ -859,13 +858,9 @@ namespace detail evt_ptr->mouse_up.emit(arg); } } - else if(fire_click) - { - arg_click arg; - arg.window_handle = reinterpret_cast(msgwnd); - arg.by_mouse = true; - msgwnd->together.events_ptr->click.emit(arg); - } + else if(click_arg.window_handle) + msgwnd->together.events_ptr->click.emit(click_arg); + brock.wd_manager().do_lazy_refresh(msgwnd, false); } pressed_wd = nullptr; diff --git a/source/gui/detail/win32/bedrock.cpp b/source/gui/detail/win32/bedrock.cpp index 2a68f95a..7cdd1b5f 100644 --- a/source/gui/detail/win32/bedrock.cpp +++ b/source/gui/detail/win32/bedrock.cpp @@ -536,6 +536,7 @@ namespace detail { arg.pos.x = pmdec.mouse.x - wd->pos_root.x; arg.pos.y = pmdec.mouse.y - wd->pos_root.y; + arg.alt = (::GetKeyState(VK_MENU) < 0); arg.shift = pmdec.mouse.button.shift; arg.ctrl = pmdec.mouse.button.ctrl; arg.left_button = pmdec.mouse.button.left; @@ -1001,20 +1002,22 @@ namespace detail { auto retain = msgwnd->together.events_ptr; - nana::arg_mouse arg; + ::nana::arg_mouse arg; assign_arg(arg, msgwnd, message, pmdec); - bool fire_click = false; + ::nana::arg_click click_arg; + + //the window_handle of click_arg is used as a flag to determinate whether to emit click event + click_arg.window_handle = nullptr; + click_arg.mouse_args = &arg; + if (msgwnd->dimension.is_hit(arg.pos)) { msgwnd->flags.action = mouse_action::over; if (::nana::mouse::left_button == arg.button) { - arg_click arg; - arg.window_handle = reinterpret_cast(msgwnd); - arg.by_mouse = true; - emit_drawer(&drawer::click, msgwnd, arg, &context); - fire_click = true; + click_arg.window_handle = reinterpret_cast(msgwnd); + emit_drawer(&drawer::click, msgwnd, click_arg, &context); } } @@ -1024,13 +1027,8 @@ namespace detail arg.evt_code = event_code::mouse_up; emit_drawer(&drawer::mouse_up, msgwnd, arg, &context); - if (fire_click) - { - arg_click arg; - arg.window_handle = reinterpret_cast(msgwnd); - arg.by_mouse = true; - retain->click.emit(arg); - } + if (click_arg.window_handle) + retain->click.emit(click_arg); if (brock.wd_manager().available(msgwnd)) { @@ -1038,13 +1036,9 @@ namespace detail retain->mouse_up.emit(arg); } } - else if (fire_click) - { - arg_click arg; - arg.window_handle = reinterpret_cast(msgwnd); - arg.by_mouse = true; - retain->click.emit(arg); - } + else if (click_arg.window_handle) + retain->click.emit(click_arg); + brock.wd_manager().do_lazy_refresh(msgwnd, false); } pressed_wd = nullptr; diff --git a/source/gui/widgets/button.cpp b/source/gui/widgets/button.cpp index e68d9a3b..65972433 100644 --- a/source/gui/widgets/button.cpp +++ b/source/gui/widgets/button.cpp @@ -373,7 +373,7 @@ namespace nana{ namespace drawerbase { arg_click arg; arg.window_handle = wdg_->handle(); - arg.by_mouse = false; + arg.mouse_args = nullptr; API::emit_event(event_code::click, arg.window_handle, arg); } From faa33817e2160c7d0eef808980d87f9a600cd8b6 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Fri, 4 Dec 2015 00:20:29 +0800 Subject: [PATCH 12/28] add insert/append/erase methods to template class tabbar --- include/nana/gui/widgets/tabbar.hpp | 76 +++++++++++++++++++++++------ source/gui/widgets/tabbar.cpp | 41 +++++++++++----- 2 files changed, 88 insertions(+), 29 deletions(-) diff --git a/include/nana/gui/widgets/tabbar.hpp b/include/nana/gui/widgets/tabbar.hpp index 2ed73ab4..2b7193cf 100644 --- a/include/nana/gui/widgets/tabbar.hpp +++ b/include/nana/gui/widgets/tabbar.hpp @@ -40,7 +40,9 @@ namespace nana : arg_tabbar({wdg, v}) {} - bool remove = true; + bool remove = true; ///< determines whether to remove the item + bool close_attach_window = true; ///< determines whether to close the attached window. It is ignored if remove is false + }; namespace drawerbase @@ -51,11 +53,11 @@ namespace nana struct tabbar_events : public general_events { - typedef T value_type; + using value_type = T; basic_event> added; basic_event> activated; - basic_event> removed; + basic_event> removed; }; class event_agent_interface @@ -64,7 +66,7 @@ namespace nana virtual ~event_agent_interface() = default; virtual void added(std::size_t) = 0; virtual void activated(std::size_t) = 0; - virtual bool removed(std::size_t) = 0; + virtual bool removed(std::size_t, bool & close_attached) = 0; }; class item_renderer @@ -98,7 +100,7 @@ namespace nana : public event_agent_interface { public: - typedef ::nana::arg_tabbar arg_tabbar; + using arg_tabbar = ::nana::arg_tabbar; event_agent(::nana::tabbar& tb, DrawerTrigger & dtr) : tabbar_(tb), drawer_trigger_(dtr) @@ -119,14 +121,16 @@ namespace nana tabbar_.events().activated.emit(arg_tabbar({ tabbar_, tabbar_[pos]})); } - bool removed(std::size_t pos) override + bool removed(std::size_t pos, bool & close_attach) override { if (pos != npos) { ::nana::arg_tabbar_removed arg(tabbar_, tabbar_[pos]); tabbar_.events().removed.emit(arg); + close_attach = arg.close_attach_window; return arg.remove; } + close_attach = true; return true; } private: @@ -140,8 +144,6 @@ namespace nana : public drawer_trigger { public: - //enum toolbox_button_t{ButtonAdd, ButtonScroll, ButtonList, ButtonClose}; //deprecated - enum class kits { add, @@ -159,10 +161,11 @@ namespace nana const pat::cloneable & ext_renderer() const; void ext_renderer(const pat::cloneable&); void set_event_agent(event_agent_interface*); - void push_back(const nana::string&, const nana::any&); + void insert(std::size_t, nana::string&&, nana::any&&); std::size_t length() const; bool close_fly(bool); - void relate(size_t, window); + void attach(std::size_t, window); + void erase(std::size_t); void tab_color(std::size_t, bool is_bgcolor, const ::nana::color&); void tab_image(size_t, const nana::paint::image&); void text(std::size_t, const nana::string&); @@ -198,7 +201,7 @@ namespace nana struct button_close{}; ///< The type identifies the close button of the tabbar's toolbox. //This template class is deprecated, it will be removed in 1.3 - /// A template class identifies the buttons of the tabbar's toolbox. Refer to notes for more details. + /// A template class identifies the buttons of the tabbar's toolbox. Refer to notes for more details. template struct button_container { @@ -270,7 +273,7 @@ namespace nana void close_fly(bool fly) /// Draw or not a close button in each tab. { - if(this->get_drawer_trigger().close_fly(fly)) + if (this->get_drawer_trigger().close_fly(fly)) API::refresh_window(this->handle()); } @@ -289,16 +292,57 @@ namespace nana return this->get_drawer_trigger().length(); } - void push_back(const nana::string& text) /// Append a new item. + void append(const std::string& text, window attach_wd, value_type value = {}) { - auto & t = this->get_drawer_trigger(); - t.push_back(text, value_type()); + this->append(static_cast(nana::charset(text, nana::unicode::utf8)), attach_wd); + } + + void append(const std::wstring& text, window attach_wd, value_type value = {}) + { + this->get_drawer_trigger().insert(::nana::npos, std::wstring(text), std::move(value)); + if (attach_wd) + { + auto pos = this->get_drawer_trigger().length(); + relate(pos, attach_wd); + } + API::update_window(*this); } + void push_back(nana::string text) /// Append a new item. + { + this->get_drawer_trigger().insert(::nana::npos, std::move(text), value_type()); + API::update_window(*this); + } + + void insert(std::size_t pos, const std::string& text, const value_type& value = {}) + { + this->insert(pos, static_cast(nana::charset(text, nana::unicode::utf8)), value); + } + + void insert(std::size_t pos, const std::wstring& text, const value_type& value = {}) + { + if (pos > length()) + throw std::out_of_range("tabbar::insert invalid position"); + + this->get_drawer_trigger().insert(pos, std::wstring(text), value_type(value)); + API::update_window(*this); + } + + //deprecated from 1.2.1, removed from 1.3 void relate(std::size_t pos, window wd) /// Binds a window to an item specified by pos, if the item is selected, shows the window, otherwise, hides it. { - this->get_drawer_trigger().relate(pos, wd); + this->get_drawer_trigger().attach(pos, wd); + } + + void attach(std::size_t pos, window wd) + { + this->get_drawer_trigger().attach(pos, wd); + } + + void erase(std::size_t pos) + { + this->get_drawer_trigger().erase(pos); } void tab_bgcolor(std::size_t i, const ::nana::color& clr) diff --git a/source/gui/widgets/tabbar.cpp b/source/gui/widgets/tabbar.cpp index c0acd9f3..d2a8cb2a 100644 --- a/source/gui/widgets/tabbar.cpp +++ b/source/gui/widgets/tabbar.cpp @@ -30,6 +30,12 @@ namespace nana ::nana::color bgcolor; ::nana::color fgcolor; + + item_t() = default; + + item_t(nana::string&& text, any && value) + : text(std::move(text)), value(std::move(value)) + {} }; class def_renderer @@ -414,13 +420,13 @@ namespace nana evt_agent_ = evt; } - void push_back(const nana::string& text, const nana::any & value) + void insert(std::size_t pos, nana::string&& text, nana::any&& value) { - item_t m; - m.text = text; - m.value = value; - list_.push_back(m); - activate(static_cast(list_.size() - 1)); + if (pos >= list_.size()) + pos = list_.size(); + + list_.emplace(iterator_at(pos), std::move(text), std::move(value)); + this->activate(pos); render(); } @@ -433,9 +439,13 @@ namespace nana { if(pos < list_.size()) { - if ((nullptr == evt_agent_) || evt_agent_->removed(pos)) + bool close_attach = true; + if ((nullptr == evt_agent_) || evt_agent_->removed(pos, close_attach)) { - API::show_window(iterator_at(pos)->relative, false); + if (close_attach) + API::close_window(iterator_at(pos)->relative); + else + API::show_window(iterator_at(pos)->relative, false); list_.erase(iterator_at(pos)); _m_adjust(); @@ -593,7 +603,7 @@ namespace nana return basis_.active; } - void relate(std::size_t pos, window wd) + void attach(std::size_t pos, window wd) { if(pos < list_.size()) { @@ -1152,9 +1162,9 @@ namespace nana layouter_->event_agent(evt); } - void trigger::push_back(const nana::string& text, const nana::any& value) + void trigger::insert(std::size_t pos, nana::string&& text, nana::any&& value) { - layouter_->push_back(text, value); + layouter_->insert(pos, std::move(text), std::move(value)); } std::size_t trigger::length() const @@ -1167,9 +1177,14 @@ namespace nana return layouter_->toolbox_object().close_fly(fly); } - void trigger::relate(std::size_t i, window wd) + void trigger::attach(std::size_t pos, window wd) { - layouter_->relate(i, wd); + layouter_->attach(pos, wd); + } + + void trigger::erase(std::size_t pos) + { + layouter_->erase(pos); } void trigger::tab_color(std::size_t i, bool is_bgcolor, const ::nana::color& clr) From 3a04e10d697a5ce98f6f7a90ea97a560ea468f67 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Tue, 1 Dec 2015 10:30:12 +0100 Subject: [PATCH 13/28] ignore .ideas --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 5c5fac64..53eee01b 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,4 @@ CMakeCache.txt CMakeFiles/ cmake_install.cmake *.DS_Store +.idea/ From 4b57b76ffbcb446a090644713119c2baf9eb67eb Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Wed, 2 Dec 2015 08:39:10 +0100 Subject: [PATCH 14/28] simplify automatic project generation --- CMakeLists.txt | 99 ++++--------------- .../nana/detail/linux_X11/platform_spec.hpp | 6 ++ include/nana/detail/win32/platform_spec.hpp | 6 ++ source/detail/linux_X11/platform_spec.cpp | 7 ++ source/detail/win32/platform_spec.cpp | 6 ++ 5 files changed, 43 insertions(+), 81 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a6453263..b943f95a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,48 +4,17 @@ # Robert Hauck - Enable support for PNG/Freetype # Qiangqiang Wu - Add biicode support + +# set compile flags +if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall") +endif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + + if(BIICODE) # prepare BII_LIB_SRC set(LIB_SRC ${BII_LIB_SRC}) - foreach(cpp ${BII_LIB_SRC}) - if(${cpp} MATCHES "/detail/(win32|linux_X11)/.+$") - list(APPEND trash_files ${cpp}) - endif() - endforeach() - - list(REMOVE_ITEM BII_LIB_SRC ${trash_files}) - - if(WIN32) - file(GLOB_RECURSE platform_files "*/detail/win32/*") - list(APPEND BII_LIB_SRC ${platform_files}) - elseif(APPLE) - file(GLOB_RECURSE platform_files "*/detail/macos_X11/*") - list(APPEND BII_LIB_SRC ${platform_files}) - elseif(UNIX) - file(GLOB_RECURSE platform_files "*/detail/linux_X11/*") - list(APPEND BII_LIB_SRC ${platform_files}) - else() - message(FATAL_ERROR "Only Windows and Unix are supported for the moment (Mac OS is experimental)") - endif() - - # set compile flags - if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall") - endif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") - - # 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) - if(MSVC14) - add_definitions(-DSTD_CODECVT_NOT_SUPPORTED) - else() - add_definitions(-DNOT_IMPLEMENTED_KEYWORD_noexcept) - endif() - endif() - add_biicode_targets() return() @@ -54,40 +23,16 @@ endif() project(nana) cmake_minimum_required(VERSION 2.8) -#Select platform automatically -if(WIN32) - add_definitions(-DNANA_WINDOWS) - add_definitions(-DPLATFORM_SPEC_HPP=) - if(MSVC14) - add_definitions(-DSTD_CODECVT_NOT_SUPPORTED) - else() - add_definitions(-DNOT_IMPLEMENTED_KEYWORD_noexcept) - endif() - - #Test if it is MINGW - if(MINGW) - add_definitions(-DNANA_MINGW) - add_definitions(-DSTD_CODECVT_NOT_SUPPORTED) - if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8.1") - option(NANA_THREAD_NOT_SUPPORTED "Use this flag if MinGW version is older than 4.8.1" ON) - endif() - endif() - if(NANA_THREAD_NOT_SUPPORTED) - add_definitions(-DSTD_THREAD_NOT_SUPPORTED) - endif() - endif() -endif() if(APPLE) add_definitions(-DNANA_MACOS) add_definitions(-DNANA_X11) - add_definitions(-DPLATFORM_SPEC_HPP=) + #add_definitions(-DPLATFORM_SPEC_HPP=) add_definitions(-DSTD_CODECVT_NOT_SUPPORTED) include_directories(/opt/X11/include/) elseif(UNIX) add_definitions(-DNANA_LINUX) add_definitions(-DNANA_X11) - add_definitions(-DPLATFORM_SPEC_HPP=) + #add_definitions(-DPLATFORM_SPEC_HPP=) add_definitions(-DSTD_CODECVT_NOT_SUPPORTED) endif() @@ -96,25 +41,26 @@ endif() if(WIN32) if(MSVC) option(WIN32_USE_MP "Set to ON to build nana with the /MP option (Visual Studio 2005 and above)." ON) + # ?? if(WIN32_USE_MP) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") endif() # 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) endif(MSVC) endif(WIN32) #Unicode option(NANA_UNICODE "Use Unicode Character Set" ON) -if(NANA_UNICODE) - add_definitions(-DNANA_UNICODE) - if(WIN32) - add_definitions(-DUNICODE -D_UNICODE) - endif() -endif() +#if(NANA_UNICODE) +# add_definitions(-DNANA_UNICODE) +# if(WIN32) +# add_definitions(-DUNICODE -D_UNICODE) +# endif() +#endif() #Find PNG if(UNIX) @@ -139,15 +85,6 @@ if(NANA_ENABLE_PNG) endif() endif() -#Copy our new config.hpp (with removed defines) -execute_process(COMMAND ${CMAKE_COMMAND} - -E copy_if_different - ${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/include/nana/) - -if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall") -endif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") set(NANA_SOURCE_DIR ${CMAKE_SOURCE_DIR}/source) set(NANA_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include) diff --git a/include/nana/detail/linux_X11/platform_spec.hpp b/include/nana/detail/linux_X11/platform_spec.hpp index 461517f9..0a013ed6 100644 --- a/include/nana/detail/linux_X11/platform_spec.hpp +++ b/include/nana/detail/linux_X11/platform_spec.hpp @@ -13,6 +13,8 @@ * This file should not be included by any header files. */ +#if defined(NANA_LINUX) || defined(NANA_MACOS) + #ifndef NANA_DETAIL_PLATFORM_SPEC_HPP #define NANA_DETAIL_PLATFORM_SPEC_HPP @@ -323,5 +325,9 @@ namespace detail }//end namespace nana +// .h ward +#endif + +//#if defined(NANA_LINUX) || defined(NANA_MACOS) #endif diff --git a/include/nana/detail/win32/platform_spec.hpp b/include/nana/detail/win32/platform_spec.hpp index b0b90fad..b129406b 100644 --- a/include/nana/detail/win32/platform_spec.hpp +++ b/include/nana/detail/win32/platform_spec.hpp @@ -12,6 +12,7 @@ * This file provides basis class and data structrue that required by nana * This file should not be included by any header files. */ +#if defined(NANA_WINDOWS) #ifndef NANA_DETAIL_PLATFORM_SPEC_HPP #define NANA_DETAIL_PLATFORM_SPEC_HPP @@ -198,4 +199,9 @@ namespace detail }//end namespace detail }//end namespace nana + +// .h ward +#endif + +//#if defined(NANA_WINDOWS) #endif diff --git a/source/detail/linux_X11/platform_spec.cpp b/source/detail/linux_X11/platform_spec.cpp index d2244430..1f17cda4 100644 --- a/source/detail/linux_X11/platform_spec.cpp +++ b/source/detail/linux_X11/platform_spec.cpp @@ -13,6 +13,9 @@ * * http://standards.freedesktop.org/clipboards-spec/clipboards-0.1.txt */ + +#if defined(NANA_LINUX) || defined(NANA_MACOS) + #include #include #include @@ -1411,3 +1414,7 @@ namespace detail } }//end namespace detail }//end namespace nana + + +//#if defined(NANA_LINUX) || defined(NANA_MACOS) +#endif diff --git a/source/detail/win32/platform_spec.cpp b/source/detail/win32/platform_spec.cpp index ffc6dc28..7b048aba 100644 --- a/source/detail/win32/platform_spec.cpp +++ b/source/detail/win32/platform_spec.cpp @@ -11,6 +11,9 @@ * * This file provides basis class and data structrue that required by nana */ + +#if defined(NANA_WINDOWS) + #include #include #include @@ -289,3 +292,6 @@ namespace detail } }//end namespace detail }//end namespace nana + +//#if defined(NANA_WINDOWS) +#endif \ No newline at end of file From 003b0b4041f6376ce8e4d62cd21d2dfd31fc48c8 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Wed, 2 Dec 2015 13:15:08 +0100 Subject: [PATCH 15/28] simplify automatic project generation - return config + USE_github_com_meganz_mingw_std_threads --- include/nana/config.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/nana/config.hpp b/include/nana/config.hpp index 188f7562..47ab7eac 100644 --- a/include/nana/config.hpp +++ b/include/nana/config.hpp @@ -41,9 +41,15 @@ #if defined(__MINGW32__) || defined(__MINGW64__) #define NANA_MINGW #define STD_CODECVT_NOT_SUPPORTED - #if (__GNUC__ == 4) && ((__GNUC_MINOR__ < 8) || (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ < 1)) + // https://github.com/meganz/mingw-std-threads + //#define STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED + //#define _GLIBCXX_HAS_GTHREADS + //#define _GTHREAD_USE_MUTEX_TIMEDLOCK 1 + //#define STD_THREAD_NOT_SUPPORTED + #if ((__GNUC__ == 4) && ((__GNUC_MINOR__ < 8) || (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ < 2))) //Use this flag if MinGW version is older than 4.8.1 #define STD_THREAD_NOT_SUPPORTED + #define USE_github_com_meganz_mingw_std_threads #endif #endif #elif (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)) && !defined(_CRAYC) @@ -63,6 +69,7 @@ #endif //Here defines some flags that tell Nana what features will be supported. +//#ifndef NANA_UNICODE #define NANA_UNICODE #if defined(NANA_UNICODE) && defined(NANA_WINDOWS) From 74be76e49a890e2c3f98b5a88472bcfaf637b293 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Wed, 2 Dec 2015 13:38:22 +0100 Subject: [PATCH 16/28] MinGW workaround with USE_github_com_meganz_mingw_std_threads --- include/nana/std_condition_variable.hpp | 6 +++++- include/nana/std_mutex.hpp | 17 ++++++++++++++++- include/nana/std_thread.hpp | 8 ++++++-- source/internationalization.cpp | 18 +++++++++++++----- source/threads/pool.cpp | 3 ++- 5 files changed, 42 insertions(+), 10 deletions(-) diff --git a/include/nana/std_condition_variable.hpp b/include/nana/std_condition_variable.hpp index 72399b59..0c9813fc 100644 --- a/include/nana/std_condition_variable.hpp +++ b/include/nana/std_condition_variable.hpp @@ -3,10 +3,14 @@ #include #if defined(STD_THREAD_NOT_SUPPORTED) +#if defined(USE_github_com_meganz_mingw_std_threads) + #include +#else #include namespace std { typedef boost::condition_variable condition_variable; } -#endif +#endif // (USE_github_com_meganz_mingw_std_threads) +#endif // (STD_THREAD_NOT_SUPPORTED) #endif // NANA_STD_CONDITION_VARIABLE_HPP diff --git a/include/nana/std_mutex.hpp b/include/nana/std_mutex.hpp index 9fdebfc6..5eb6528a 100644 --- a/include/nana/std_mutex.hpp +++ b/include/nana/std_mutex.hpp @@ -3,6 +3,20 @@ #include #if defined(STD_THREAD_NOT_SUPPORTED) + +#if defined(USE_github_com_meganz_mingw_std_threads) +#include +#include +#include +#include +#include +#include +#include +// http://lxr.free-electrons.com/source/include/uapi/asm-generic/errno.h#L53 +#define EPROTO 71 /* Protocol error */ +#include +#include +#else #include #include #include @@ -18,5 +32,6 @@ namespace std typedef boost::mutex mutex; typedef boost::recursive_mutex recursive_mutex; } -#endif +#endif // (USE_github_com_meganz_mingw_std_threads) +#endif // (STD_THREAD_NOT_SUPPORTED) #endif // NANA_STD_MUTEX_HPP diff --git a/include/nana/std_thread.hpp b/include/nana/std_thread.hpp index 572193ac..321b3728 100644 --- a/include/nana/std_thread.hpp +++ b/include/nana/std_thread.hpp @@ -3,11 +3,15 @@ #include #if defined(STD_THREAD_NOT_SUPPORTED) + +#if defined(USE_github_com_meganz_mingw_std_threads) +#include +#else #include namespace std { typedef boost::thread thread; } -#endif - +#endif // (USE_github_com_meganz_mingw_std_threads) +#endif // (STD_THREAD_NOT_SUPPORTED) #endif // NANA_STD_THREAD_HPP diff --git a/source/internationalization.cpp b/source/internationalization.cpp index 56bc327e..c2e47e5d 100644 --- a/source/internationalization.cpp +++ b/source/internationalization.cpp @@ -14,9 +14,16 @@ #include #include #include -#include -#include +#include // Warning:(17, 1) [unused] Unused import statement +#include // Warning:(17, 1) [unused] Unused import statement + +#if defined(STD_THREAD_NOT_SUPPORTED) +#include +#else #include +#endif + + #include namespace nana @@ -68,7 +75,7 @@ namespace nana bool escape = false; for (auto i = read_ptr_ + 1; i != end_ptr_; ++i) { - if (escape) + if (escape) // Warning:(78, 12) Condition is always false { escape = false; continue; @@ -261,8 +268,9 @@ namespace nana { auto result = mgr.table.emplace(wd, std::move(eval)); result.first->second.destroy = nana::API::events(wd).destroy([wd]{ - auto & mgr = get_eval_manager(); - std::lock_guard lock(mgr.mutex); + auto & mgr = get_eval_manager(); // Warning:(271, 13) Local 'mgr' hides previous declaration + std::lock_guard lock(mgr.mutex); // Local 'lock' hides previous + mgr.table.erase(wd); }); } diff --git a/source/threads/pool.cpp b/source/threads/pool.cpp index aa9bd461..d15180d5 100644 --- a/source/threads/pool.cpp +++ b/source/threads/pool.cpp @@ -17,8 +17,9 @@ #include #if defined(STD_THREAD_NOT_SUPPORTED) - #include #include + #include + #else #include #include From 221e9f662414b659a2599fcbef029f70bb161040 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Wed, 2 Dec 2015 13:40:47 +0100 Subject: [PATCH 17/28] FIX MinGW workaround bring some macro small ? --- include/nana/gui/detail/window_manager.hpp | 2 +- source/gui/detail/window_manager.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/nana/gui/detail/window_manager.hpp b/include/nana/gui/detail/window_manager.hpp index c8229df6..b04c32dc 100644 --- a/include/nana/gui/detail/window_manager.hpp +++ b/include/nana/gui/detail/window_manager.hpp @@ -106,7 +106,7 @@ namespace detail //@brief: Delete window handle, the handle type must be a root and a frame. void destroy_handle(core_window_t*); - void default_icon(const paint::image& small_icon, const paint::image& big_icon); + void default_icon(const paint::image& _small_icon, const paint::image& big_icon); void icon(core_window_t*, const paint::image& small_icon, const paint::image& big_icon); //show diff --git a/source/gui/detail/window_manager.cpp b/source/gui/detail/window_manager.cpp index eb56ff89..909cf193 100644 --- a/source/gui/detail/window_manager.cpp +++ b/source/gui/detail/window_manager.cpp @@ -463,10 +463,10 @@ namespace detail } } - void window_manager::default_icon(const nana::paint::image& small, const nana::paint::image& big) + void window_manager::default_icon(const nana::paint::image& _small, const nana::paint::image& big) { impl_->default_icon_big = big; - impl_->default_icon_small = small; + impl_->default_icon_small = _small; } void window_manager::icon(core_window_t* wd, const paint::image& small_icon, const paint::image& big_icon) From f7f8db5337a043557b7572f89dbde691074b6b22 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Wed, 2 Dec 2015 13:42:04 +0100 Subject: [PATCH 18/28] FIX: MinGW no expose functions in std:: --- source/deploy.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/deploy.cpp b/source/deploy.cpp index d61b0dd5..817721ec 100644 --- a/source/deploy.cpp +++ b/source/deploy.cpp @@ -61,6 +61,13 @@ namespace std *pos = (std::size_t)(end - sptr); return ((int)result); } + using ::strtof; + using ::strtold; + using ::wcstold; + using ::strtoll; + using ::wcstoll; + using ::strtoull; + using ::wcstoull; float stof(const std::string& str, std::size_t * pos) { From f9f70cf08b6ba48122a3b6edf1edc1fd8e5639b4 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Wed, 2 Dec 2015 13:43:19 +0100 Subject: [PATCH 19/28] Simplify CMake file --- CMakeLists.txt | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b943f95a..dc1e5a90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,19 +23,6 @@ endif() project(nana) cmake_minimum_required(VERSION 2.8) -if(APPLE) - add_definitions(-DNANA_MACOS) - add_definitions(-DNANA_X11) - #add_definitions(-DPLATFORM_SPEC_HPP=) - add_definitions(-DSTD_CODECVT_NOT_SUPPORTED) - include_directories(/opt/X11/include/) -elseif(UNIX) - add_definitions(-DNANA_LINUX) - add_definitions(-DNANA_X11) - #add_definitions(-DPLATFORM_SPEC_HPP=) - add_definitions(-DSTD_CODECVT_NOT_SUPPORTED) -endif() - #Global MSVC definitions if(WIN32) From 3ad8f5a64167700afc9db403345740bdcaa64b5e Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Thu, 3 Dec 2015 16:54:13 +0100 Subject: [PATCH 20/28] Simplify CMake file and config.h --- CMakeLists.txt | 53 ++++-- build/cmake/config.hpp | 18 -- .../nana/audio/detail/buffer_preparation.hpp | 2 +- include/nana/charset.hpp | 15 ++ include/nana/config.hpp | 177 +++++++++++------- include/nana/deploy.hpp | 4 +- include/nana/gui/detail/events_operation.hpp | 2 +- include/nana/gui/detail/handle_manager.hpp | 2 +- source/gui/animation.cpp | 4 +- source/gui/detail/native_window_interface.cpp | 2 +- source/gui/notifier.cpp | 2 +- source/gui/place.cpp | 4 +- source/gui/timer.cpp | 2 +- 13 files changed, 171 insertions(+), 116 deletions(-) delete mode 100644 build/cmake/config.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index dc1e5a90..80465950 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,13 +4,13 @@ # Robert Hauck - Enable support for PNG/Freetype # Qiangqiang Wu - Add biicode support - # set compile flags if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall") endif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") +# move this to the end ?? if(BIICODE) # prepare BII_LIB_SRC set(LIB_SRC ${BII_LIB_SRC}) @@ -33,23 +33,25 @@ if(WIN32) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") endif() - # More MSVC specific compilation flags - #add_definitions(-D_SCL_SECURE_NO_WARNINGS) - #add_definitions(-D_CRT_SECURE_NO_DEPRECATE) endif(MSVC) endif(WIN32) #Unicode option(NANA_UNICODE "Use Unicode Character Set" ON) -#if(NANA_UNICODE) -# add_definitions(-DNANA_UNICODE) -# if(WIN32) -# add_definitions(-DUNICODE -D_UNICODE) -# endif() -#endif() +if(NANA_UNICODE) + add_definitions(-DNANA_UNICODE) +endif() + +if(APPLE) + add_definitions(-DAPPLE) + include_directories(/opt/X11/include/) +elseif(UNIX) + add_definitions(-Dlinux) +endif() + + -#Find PNG if(UNIX) find_package(Freetype) if (FREETYPE_FOUND) @@ -57,21 +59,36 @@ if(UNIX) endif() endif() -option(NANA_ENABLE_PNG "Enable the use of PNG" ON) + +#Find PNG +option(NANA_ENABLE_PNG "Enable the use of PNG" OFF) +option(USE_LIBPNG_FROM_OS "Use libpng from operating system." OFF) if(NANA_ENABLE_PNG) add_definitions(-DNANA_ENABLE_PNG) - - option(NANA_LIBPNG "Use the included libpng" ON) - if(NANA_LIBPNG) - add_definitions(-DNANA_LIBPNG) - else() + if(USE_LIBPNG_FROM_OS) find_package(PNG) if (PNG_FOUND) include_directories( ${PNG_INCLUDE_DIRS}) + add_definitions(-DUSE_LIBPNG_FROM_OS) endif() endif() endif() +#Find JPEG +option(NANA_ENABLE_JPEG "Enable the use of JPEG" OFF) +option(USE_LIBJPEG_FROM_OS "Use libjpeg from operating system." OFF) +if(NANA_ENABLE_JPEG) + add_definitions(-DNANA_ENABLE_JPEG) + if(USE_LIBJPEG_FROM_OS) + find_package(JPEG) + if (JPEG_FOUND) + include_directories( ${JPEG_INCLUDE_DIRS}) + add_definitions(-DUSE_LIBJPEG_FROM_OS) + endif() + endif() +endif() + + set(NANA_SOURCE_DIR ${CMAKE_SOURCE_DIR}/source) set(NANA_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include) diff --git a/build/cmake/config.hpp b/build/cmake/config.hpp deleted file mode 100644 index 08527a55..00000000 --- a/build/cmake/config.hpp +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Nana Configuration - * Nana C++ Library(http://www.nanapro.org) - * Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) - * - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - * - * @file: nana/config.hpp - */ - -#ifndef NANA_CONFIG_HPP -#define NANA_CONFIG_HPP - -//All defines have been moved to the CMakelists.txt in the root directory. - -#endif //NANA_CONFIG_HPP diff --git a/include/nana/audio/detail/buffer_preparation.hpp b/include/nana/audio/detail/buffer_preparation.hpp index fdffc91c..c3e03d71 100644 --- a/include/nana/audio/detail/buffer_preparation.hpp +++ b/include/nana/audio/detail/buffer_preparation.hpp @@ -3,7 +3,7 @@ #include #include -#if defined(NANA_MINGW) && defined(STD_THREAD_NOT_SUPPORTED) +#if defined(STD_THREAD_NOT_SUPPORTED) #include #include #include diff --git a/include/nana/charset.hpp b/include/nana/charset.hpp index 9e109b65..6c36159b 100644 --- a/include/nana/charset.hpp +++ b/include/nana/charset.hpp @@ -1,3 +1,17 @@ +/** + * The charset Implementation + * Nana C++ Library(http://www.nanapro.org) + * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com) + * + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + * @file: nana/charset.hpp + * + * + */ + #ifndef NANA_CHARSET_HPP #define NANA_CHARSET_HPP #include @@ -13,6 +27,7 @@ namespace nana { class charset_encoding_interface; } + /// An intelligent charset class for character code conversion. class charset { diff --git a/include/nana/config.hpp b/include/nana/config.hpp index 47ab7eac..a1e068a4 100644 --- a/include/nana/config.hpp +++ b/include/nana/config.hpp @@ -1,7 +1,7 @@ -/* +/** * Nana Configuration * Nana C++ Library(http://www.nanapro.org) - * Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) + * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com) * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at @@ -13,63 +13,124 @@ #ifndef NANA_CONFIG_HPP #define NANA_CONFIG_HPP -#if defined(_MSC_VER) - #define _SCL_SECURE_NO_WARNINGS - #define _CRT_SECURE_NO_DEPRECATE - #pragma warning(disable : 4996) +// Select platform ...... - #if (_MSC_VER < 1900) - // is this a good idea? - #define NOT_IMPLEMENTED_KEYWORD_noexcept - #endif // _MSC_VER < 1900 - #if (_MSC_VER == 1900) - // google: break any code that tries to use codecvt or codecvt. - // google: It appears the C++ libs haven't been compiled with native char16_t/char32_t support. - // google: Those definitions are for codecvt::id, codecvt::id and codecvt::id respectively. - // However, the codecvt::id and codecvt::id definitions aren't there, and indeed, if you look at locale0.cpp in the CRT source code you'll see they're not defined at all. - // google: That's a known issue, tracked by an active bug (DevDiv#1060849). We were able to update the STL's headers in response to char16_t/char32_t, but we still need to update the separately compiled sources. - #define STD_CODECVT_NOT_SUPPORTED - #endif // _MSC_VER == 1900 -#endif // _MSVC + // Windows: + #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) -//Select platform automatically -#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) -//Windows: - #define NANA_WINDOWS 1 + #define NANA_WINDOWS 1 - //Test if it is MINGW - #if defined(__MINGW32__) || defined(__MINGW64__) - #define NANA_MINGW - #define STD_CODECVT_NOT_SUPPORTED - // https://github.com/meganz/mingw-std-threads - //#define STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED - //#define _GLIBCXX_HAS_GTHREADS - //#define _GTHREAD_USE_MUTEX_TIMEDLOCK 1 - //#define STD_THREAD_NOT_SUPPORTED - #if ((__GNUC__ == 4) && ((__GNUC_MINOR__ < 8) || (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ < 2))) + // compilers in Windows... + + // MSVC++ versions + #if defined(_MSC_VER) + #define _SCL_SECURE_NO_WARNNGS + #define _CRT_SECURE_NO_DEPRECATE + #pragma warning(disable : 4996) + + #if (_MSC_VER == 1900) + // google: break any code that tries to use codecvt or codecvt. + // google: It appears the C++ libs haven't been compiled with native char16_t/char32_t support. + // google: Those definitions are for codecvt::id, codecvt::id and codecvt::id respectively. + // However, the codecvt::id and codecvt::id definitions aren't there, and indeed, if you look at locale0.cpp in the CRT source code you'll see they're not defined at all. + // google: That's a known issue, tracked by an active bug (DevDiv#1060849). We were able to update the STL's headers in response to char16_t/char32_t, but we still need to update the separately compiled sources. + #define STD_CODECVT_NOT_SUPPORTED + #endif // _MSC_VER == 1900 + #endif // _MSVC + + // MINGW ... + #if defined(__MINGW32__) || defined(__MINGW64__) + #define NANA_MINGW //Use this flag if MinGW version is older than 4.8.1 - #define STD_THREAD_NOT_SUPPORTED - #define USE_github_com_meganz_mingw_std_threads + #if ((__GNUC__ == 4) && ((__GNUC_MINOR__ < 8) || (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ < 2))) + + // ?? + #define UNDEFINED_to_string + + // https://github.com/meganz/mingw-std-threads + #define STD_THREAD_NOT_SUPPORTED + #define USE_github_com_meganz_mingw_std_threads + + #endif + + #endif // MINGW + + // end Windows + + + // MacOS: who define APPLE ?? + //#define APPLE + #elif defined(APPLE) + #define NANA_MACOS 1 + #define NANA_X11 1 + // how to add this: include_directories(/opt/X11/include/) + // MacOS + + // Linux: + #elif (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)) && !defined(_CRAYC) + + #define NANA_LINUX 1 + #define NANA_X11 1 + + // end Linux + + + #else + # static_assert(false, "Only Windows and Unix are supported now (Mac OS is experimental)"); + #endif // Select platform + + #if defined(NANA_LINUX) || defined(NANA_MACOS) + #undef NANA_WINDOWS + #endif +// End Select platform ...... + +// compilers ... + + // GCC ... + #if defined(__GNU__) + #if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) && (__GNUC_PATCHLEVEL__ <= 1) + + //GCC 4.7.0 does not implement the and codecvt_utfx classes ?? + #define STD_CODECVT_NOT_SUPPORTED + + //Some functions which are specified in 21.5 Numeric conversions in Strings library have not yet implemented + + //Implement workarounds for GCC/MinGW which version is below 4.8.2 + #define STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED #endif - #endif -#elif (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)) && !defined(_CRAYC) -//Linux: - #define NANA_LINUX 1 - #define NANA_X11 1 - #define STD_CODECVT_NOT_SUPPORTED -#else -# static_assert(false, "Only Windows and Unix are supported now (Mac OS is experimental)"); -#endif + #endif // GCC +// End compilers ... -#if defined(NANA_MINGW) || defined(NANA_LINUX) - #if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) && (__GNUC_PATCHLEVEL__ <= 1) - //Some functions which are specified in 21.5 Numeric conversions in Strings library have not yet implemented - #define STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED + +// Here defines some flags that tell Nana what features will be supported. + +/////////////////// +//Support for PNG +// Define the NANA_ENABLE_PNG to enable the support of PNG. +// +//#define NANA_ENABLE_PNG //! +//#define USE_LIBPNG_FROM_OS // Un-Comment it to use libpng from operating system. +#if defined(NANA_ENABLE_PNG) + #if not defined(USE_LIBPNG_FROM_OS) + #define NANA_LIBPNG #endif #endif -//Here defines some flags that tell Nana what features will be supported. +/////////////////// +//Support for JPEG +// Define the NANA_ENABLE_JPEG to enable the support of JPEG. +// +//#define NANA_ENABLE_JPEG //! +//#define USE_LIBJPEG_FROM_OS // Un-Comment it to use libjpeg from operating system. +#if defined(NANA_ENABLE_JPEG) +#if not defined(USE_LIBJPEG_FROM_OS) + #define NANA_LIBJPEG + #endif +#endif + + //#ifndef NANA_UNICODE +// always define NANA_UNICODE ?? it will be deprecated ?. #define NANA_UNICODE #if defined(NANA_UNICODE) && defined(NANA_WINDOWS) @@ -82,23 +143,5 @@ #endif #endif -/////////////////// -//Support for PNG -// Define the NANA_ENABLE_PNG to enable the support of PNG. -// -//#define NANA_ENABLE_PNG //! -#if defined(NANA_ENABLE_PNG) - #define NANA_LIBPNG //Comment it to use libpng from operating system. -#endif - -/////////////////// -//Support for JPEG -// Define the NANA_ENABLE_JPEG to enable the support of JPEG. -// -//#define NANA_ENABLE_JPEG //! -#if defined(NANA_ENABLE_JPEG) - #define NANA_LIBJPEG //Comment this whole line to use libjpeg from operating system. -#endif - #endif //NANA_CONFIG_HPP diff --git a/include/nana/deploy.hpp b/include/nana/deploy.hpp index b3ac88d0..e1f15d7d 100644 --- a/include/nana/deploy.hpp +++ b/include/nana/deploy.hpp @@ -19,9 +19,7 @@ #include #include -#if defined(NANA_LINUX) || defined(NANA_MACOS) -#undef NANA_WINDOWS -#endif + //Implement workarounds for GCC/MinGW which version is below 4.8.2 #if defined(STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED) diff --git a/include/nana/gui/detail/events_operation.hpp b/include/nana/gui/detail/events_operation.hpp index 08a98b48..78f5c432 100644 --- a/include/nana/gui/detail/events_operation.hpp +++ b/include/nana/gui/detail/events_operation.hpp @@ -5,7 +5,7 @@ #include #include -#if defined(NANA_MINGW) && defined(STD_THREAD_NOT_SUPPORTED) +#if defined(STD_THREAD_NOT_SUPPORTED) #include #else #include diff --git a/include/nana/gui/detail/handle_manager.hpp b/include/nana/gui/detail/handle_manager.hpp index 91ac70f1..7e8f670d 100644 --- a/include/nana/gui/detail/handle_manager.hpp +++ b/include/nana/gui/detail/handle_manager.hpp @@ -17,7 +17,7 @@ #include #include -#if defined(NANA_MINGW) && defined(STD_THREAD_NOT_SUPPORTED) +#if defined(STD_THREAD_NOT_SUPPORTED) #include #else #include diff --git a/source/gui/animation.cpp b/source/gui/animation.cpp index 4b1c8e59..a82702e6 100644 --- a/source/gui/animation.cpp +++ b/source/gui/animation.cpp @@ -21,7 +21,7 @@ #include #include -#if defined(NANA_MINGW) && defined(STD_THREAD_NOT_SUPPORTED) +#if defined(STD_THREAD_NOT_SUPPORTED) #include #include #include @@ -29,7 +29,7 @@ #include #include #include -#endif //NANA_MINGW +#endif // STD_THREAD_NOT_SUPPORTED namespace nana { diff --git a/source/gui/detail/native_window_interface.cpp b/source/gui/detail/native_window_interface.cpp index fa3c2558..202a76d3 100644 --- a/source/gui/detail/native_window_interface.cpp +++ b/source/gui/detail/native_window_interface.cpp @@ -14,7 +14,7 @@ #include #include #if defined(NANA_WINDOWS) - #if defined(NANA_MINGW) && defined(STD_THREAD_NOT_SUPPORTED) + #if defined(STD_THREAD_NOT_SUPPORTED) #include #else #include diff --git a/source/gui/notifier.cpp b/source/gui/notifier.cpp index b9577bdb..242b0334 100644 --- a/source/gui/notifier.cpp +++ b/source/gui/notifier.cpp @@ -20,7 +20,7 @@ #include #include -#if defined(NANA_MINGW) && defined(STD_THREAD_NOT_SUPPORTED) +#if defined(STD_THREAD_NOT_SUPPORTED) #include #else #include diff --git a/source/gui/place.cpp b/source/gui/place.cpp index c31daf36..da742af5 100644 --- a/source/gui/place.cpp +++ b/source/gui/place.cpp @@ -95,13 +95,13 @@ namespace nana std::string pos_str() const { -#ifdef NANA_MINGW +#ifdef UNDEFINED_to_string std::stringstream ss; ss< #include -#if defined(NANA_MINGW) && defined(STD_THREAD_NOT_SUPPORTED) +#if defined(STD_THREAD_NOT_SUPPORTED) #include #else #include From 48b622acc7a722fa0b8abf20a634521cb02af493 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Thu, 3 Dec 2015 19:33:19 +0100 Subject: [PATCH 21/28] why some variables are not set by CLion / CMake ? __GNUC__ etc. I got libnana.a, but not the test.exe, why? --- CMakeLists.txt | 26 ++++++++++++++++---------- include/nana/config.hpp | 22 +++++++++++++++------- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 80465950..5b65dadc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,8 +38,8 @@ endif(WIN32) #Unicode -option(NANA_UNICODE "Use Unicode Character Set" ON) -if(NANA_UNICODE) +option(USE_UNICODE "Use Unicode Character Set") +if(USE_UNICODE) add_definitions(-DNANA_UNICODE) endif() @@ -59,13 +59,19 @@ if(UNIX) endif() endif() +if(WIN32) + add_definitions(-DWIN32) + if(MINGW) + add_definitions(-DMINGW) + endif() +endif() #Find PNG -option(NANA_ENABLE_PNG "Enable the use of PNG" OFF) -option(USE_LIBPNG_FROM_OS "Use libpng from operating system." OFF) -if(NANA_ENABLE_PNG) +option(ENABLE_PNG "Enable the use of PNG") +option(LIBPNG_FROM_OS "Use libpng from operating system.") +if(ENABLE_PNG) add_definitions(-DNANA_ENABLE_PNG) - if(USE_LIBPNG_FROM_OS) + if(LIBPNG_FROM_OS) find_package(PNG) if (PNG_FOUND) include_directories( ${PNG_INCLUDE_DIRS}) @@ -75,11 +81,11 @@ if(NANA_ENABLE_PNG) endif() #Find JPEG -option(NANA_ENABLE_JPEG "Enable the use of JPEG" OFF) -option(USE_LIBJPEG_FROM_OS "Use libjpeg from operating system." OFF) -if(NANA_ENABLE_JPEG) +option(ENABLE_JPEG "Enable the use of JPEG") +option(LIBJPEG_FROM_OS "Use libjpeg from operating system.") +if(ENABLE_JPEG) add_definitions(-DNANA_ENABLE_JPEG) - if(USE_LIBJPEG_FROM_OS) + if(LIBJPEG_FROM_OS) find_package(JPEG) if (JPEG_FOUND) include_directories( ${JPEG_INCLUDE_DIRS}) diff --git a/include/nana/config.hpp b/include/nana/config.hpp index a1e068a4..1d7390b8 100644 --- a/include/nana/config.hpp +++ b/include/nana/config.hpp @@ -39,11 +39,12 @@ #endif // _MSVC // MINGW ... - #if defined(__MINGW32__) || defined(__MINGW64__) + #if defined(__MINGW32__) || defined(__MINGW64__) || defined(MINGW) #define NANA_MINGW + //#define STD_THREAD_NOT_SUPPORTED // don't works? why? where __GNUC__, etc. are set? by CLion ?? //Use this flag if MinGW version is older than 4.8.1 #if ((__GNUC__ == 4) && ((__GNUC_MINOR__ < 8) || (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ < 2))) - + // don't works? why? where __GNUC__, etc. are set? by CLion ?? // ?? #define UNDEFINED_to_string @@ -69,8 +70,8 @@ // Linux: #elif (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)) && !defined(_CRAYC) - #define NANA_LINUX 1 - #define NANA_X11 1 + //#define NANA_LINUX 1 + //#define NANA_X11 1 // end Linux @@ -86,9 +87,14 @@ // compilers ... +// temp +//#define STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED // don't works? +//#define STD_CODECVT_NOT_SUPPORTED + // GCC ... #if defined(__GNU__) #if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) && (__GNUC_PATCHLEVEL__ <= 1) + // don't works? //GCC 4.7.0 does not implement the and codecvt_utfx classes ?? #define STD_CODECVT_NOT_SUPPORTED @@ -123,15 +129,17 @@ //#define NANA_ENABLE_JPEG //! //#define USE_LIBJPEG_FROM_OS // Un-Comment it to use libjpeg from operating system. #if defined(NANA_ENABLE_JPEG) -#if not defined(USE_LIBJPEG_FROM_OS) + #if not defined(USE_LIBJPEG_FROM_OS) #define NANA_LIBJPEG #endif #endif -//#ifndef NANA_UNICODE + // always define NANA_UNICODE ?? it will be deprecated ?. -#define NANA_UNICODE +#ifndef NANA_UNICODE + #define NANA_UNICODE +#endif #if defined(NANA_UNICODE) && defined(NANA_WINDOWS) #ifndef _UNICODE From b8b174b1f2df269a07c2db1ed7a8b07a107e0040 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Fri, 4 Dec 2015 10:03:52 +0100 Subject: [PATCH 22/28] FIX: un-comment Linux --- include/nana/config.hpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/include/nana/config.hpp b/include/nana/config.hpp index 1d7390b8..806a0fd1 100644 --- a/include/nana/config.hpp +++ b/include/nana/config.hpp @@ -65,14 +65,12 @@ #define NANA_MACOS 1 #define NANA_X11 1 // how to add this: include_directories(/opt/X11/include/) - // MacOS + // end MacOS - // Linux: + // Linux: (not sure about __GNU__ ??) #elif (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)) && !defined(_CRAYC) - - //#define NANA_LINUX 1 - //#define NANA_X11 1 - + #define NANA_LINUX 1 + #define NANA_X11 1 // end Linux From a5df90f8a9ae0425eb287eab9aa00808d9f03c62 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Fri, 4 Dec 2015 23:13:22 +0800 Subject: [PATCH 23/28] remove platform preprocess check in platform_spec.cpp --- source/detail/linux_X11/platform_spec.cpp | 6 ------ source/detail/win32/platform_spec.cpp | 5 ----- source/internationalization.cpp | 12 ++++++------ 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/source/detail/linux_X11/platform_spec.cpp b/source/detail/linux_X11/platform_spec.cpp index 1f17cda4..43fde207 100644 --- a/source/detail/linux_X11/platform_spec.cpp +++ b/source/detail/linux_X11/platform_spec.cpp @@ -14,8 +14,6 @@ * http://standards.freedesktop.org/clipboards-spec/clipboards-0.1.txt */ -#if defined(NANA_LINUX) || defined(NANA_MACOS) - #include #include #include @@ -1414,7 +1412,3 @@ namespace detail } }//end namespace detail }//end namespace nana - - -//#if defined(NANA_LINUX) || defined(NANA_MACOS) -#endif diff --git a/source/detail/win32/platform_spec.cpp b/source/detail/win32/platform_spec.cpp index 7b048aba..f7ac9917 100644 --- a/source/detail/win32/platform_spec.cpp +++ b/source/detail/win32/platform_spec.cpp @@ -12,8 +12,6 @@ * This file provides basis class and data structrue that required by nana */ -#if defined(NANA_WINDOWS) - #include #include #include @@ -292,6 +290,3 @@ namespace detail } }//end namespace detail }//end namespace nana - -//#if defined(NANA_WINDOWS) -#endif \ No newline at end of file diff --git a/source/internationalization.cpp b/source/internationalization.cpp index c2e47e5d..2e7367fc 100644 --- a/source/internationalization.cpp +++ b/source/internationalization.cpp @@ -14,8 +14,6 @@ #include #include #include -#include // Warning:(17, 1) [unused] Unused import statement -#include // Warning:(17, 1) [unused] Unused import statement #if defined(STD_THREAD_NOT_SUPPORTED) #include @@ -75,7 +73,7 @@ namespace nana bool escape = false; for (auto i = read_ptr_ + 1; i != end_ptr_; ++i) { - if (escape) // Warning:(78, 12) Condition is always false + if (escape) { escape = false; continue; @@ -88,6 +86,8 @@ namespace nana reach_right_quota = true; break; } + else if ('\\' == *i) + escape = true; } _m_eat_ws(); if (read_ptr_ == end_ptr_ || '"' != *read_ptr_) @@ -268,10 +268,10 @@ namespace nana { auto result = mgr.table.emplace(wd, std::move(eval)); result.first->second.destroy = nana::API::events(wd).destroy([wd]{ - auto & mgr = get_eval_manager(); // Warning:(271, 13) Local 'mgr' hides previous declaration - std::lock_guard lock(mgr.mutex); // Local 'lock' hides previous + auto & eval_mgr = get_eval_manager(); + std::lock_guard lockgd(eval_mgr.mutex); - mgr.table.erase(wd); + eval_mgr.table.erase(wd); }); } else From 21a5e2fc2e6c10374a40c42b64efe13fd1c4e271 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Fri, 4 Dec 2015 23:21:33 +0800 Subject: [PATCH 24/28] fix i18n escape char '\\' issue --- source/internationalization.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/internationalization.cpp b/source/internationalization.cpp index 2e7367fc..a83698a9 100644 --- a/source/internationalization.cpp +++ b/source/internationalization.cpp @@ -76,17 +76,19 @@ namespace nana if (escape) { escape = false; + str_ += *i; continue; } if ('"' == *i) { - str_.append(read_ptr_ + 1, i - read_ptr_ - 1); read_ptr_ = i + 1; reach_right_quota = true; break; } - else if ('\\' == *i) + else if ('\\' != *i) + str_ += *i; + else escape = true; } _m_eat_ws(); From 3863a0dc604742ab623dad418a0fed95094845eb Mon Sep 17 00:00:00 2001 From: Jinhao Date: Sat, 5 Dec 2015 14:03:46 +0800 Subject: [PATCH 25/28] improve the detection for GCC --- include/nana/config.hpp | 83 ++++++++++++------------- include/nana/deploy.hpp | 17 ++++- source/deploy.cpp | 68 ++++++++++++++++++++ source/gui/detail/linux_X11/bedrock.cpp | 6 +- source/gui/place.cpp | 7 +-- 5 files changed, 128 insertions(+), 53 deletions(-) diff --git a/include/nana/config.hpp b/include/nana/config.hpp index 806a0fd1..8f519e9b 100644 --- a/include/nana/config.hpp +++ b/include/nana/config.hpp @@ -20,40 +20,9 @@ #define NANA_WINDOWS 1 - // compilers in Windows... - - // MSVC++ versions - #if defined(_MSC_VER) - #define _SCL_SECURE_NO_WARNNGS - #define _CRT_SECURE_NO_DEPRECATE - #pragma warning(disable : 4996) - - #if (_MSC_VER == 1900) - // google: break any code that tries to use codecvt or codecvt. - // google: It appears the C++ libs haven't been compiled with native char16_t/char32_t support. - // google: Those definitions are for codecvt::id, codecvt::id and codecvt::id respectively. - // However, the codecvt::id and codecvt::id definitions aren't there, and indeed, if you look at locale0.cpp in the CRT source code you'll see they're not defined at all. - // google: That's a known issue, tracked by an active bug (DevDiv#1060849). We were able to update the STL's headers in response to char16_t/char32_t, but we still need to update the separately compiled sources. - #define STD_CODECVT_NOT_SUPPORTED - #endif // _MSC_VER == 1900 - #endif // _MSVC - // MINGW ... #if defined(__MINGW32__) || defined(__MINGW64__) || defined(MINGW) #define NANA_MINGW - //#define STD_THREAD_NOT_SUPPORTED // don't works? why? where __GNUC__, etc. are set? by CLion ?? - //Use this flag if MinGW version is older than 4.8.1 - #if ((__GNUC__ == 4) && ((__GNUC_MINOR__ < 8) || (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ < 2))) - // don't works? why? where __GNUC__, etc. are set? by CLion ?? - // ?? - #define UNDEFINED_to_string - - // https://github.com/meganz/mingw-std-threads - #define STD_THREAD_NOT_SUPPORTED - #define USE_github_com_meganz_mingw_std_threads - - #endif - #endif // MINGW // end Windows @@ -85,24 +54,52 @@ // compilers ... -// temp -//#define STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED // don't works? -//#define STD_CODECVT_NOT_SUPPORTED +// MSVC++ versions +#if defined(_MSC_VER) + #define _SCL_SECURE_NO_WARNNGS + #define _CRT_SECURE_NO_DEPRECATE + #pragma warning(disable : 4996) - // GCC ... - #if defined(__GNU__) - #if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) && (__GNUC_PATCHLEVEL__ <= 1) - // don't works? + #if (_MSC_VER == 1900) + // google: break any code that tries to use codecvt or codecvt. + // google: It appears the C++ libs haven't been compiled with native char16_t/char32_t support. + // google: Those definitions are for codecvt::id, codecvt::id and codecvt::id respectively. + // However, the codecvt::id and codecvt::id definitions aren't there, and indeed, if you look at locale0.cpp in the CRT source code you'll see they're not defined at all. + // google: That's a known issue, tracked by an active bug (DevDiv#1060849). We were able to update the STL's headers in response to char16_t/char32_t, but we still need to update the separately compiled sources. + #define STD_CODECVT_NOT_SUPPORTED + #endif // _MSC_VER == 1900 +#endif // _MSVC - //GCC 4.7.0 does not implement the and codecvt_utfx classes ?? - #define STD_CODECVT_NOT_SUPPORTED +//GCC +#if defined(__GNUC__) + #if defined(__GLIBCPP__) || defined(__GLIBCXX__) + // is a known issue on libstdc++, it works on libc++ + #define STD_CODECVT_NOT_SUPPORTED + #endif - //Some functions which are specified in 21.5 Numeric conversions in Strings library have not yet implemented + #if (__GNUC__ == 4) + #if ((__GNUC_MINOR__ < 8) || (__GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ < 1)) + #define STD_THREAD_NOT_SUPPORTED - //Implement workarounds for GCC/MinGW which version is below 4.8.2 + //boost.thread is preferred + //but if USE_github_com_meganz_mingw_std_threads is enabled, + //boost.thread will be replaced with meganz's mingw-std-threads. + // https://github.com/meganz/mingw-std-threads + //#define USE_github_com_meganz_mingw_std_threads + #endif + + #if defined(NANA_MINGW) + //It's a known issue under MinGW #define STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED #endif - #endif // GCC + + #if ((__GNUC_MINOR__ < 8) || defined(NANA_MINGW)) + #define STD_TO_STRING_NOT_SUPPORTED + #endif + #endif +#endif + + // End compilers ... diff --git a/include/nana/deploy.hpp b/include/nana/deploy.hpp index e1f15d7d..30d87935 100644 --- a/include/nana/deploy.hpp +++ b/include/nana/deploy.hpp @@ -56,8 +56,23 @@ namespace std //Workaround for no implemenation of std::stoull in MinGW. unsigned long long stoull(const std::string&, std::size_t* pos = nullptr, int base = 10); unsigned long long stoull(const std::wstring&, std::size_t* pos = nullptr, int base = 10); +} +#endif //STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED - //Workaround for no implemenation of std::to_wstring in MinGW. +#ifdef STD_TO_STRING_NOT_SUPPORTED +namespace std +{ + //Workaround for no implemenation of std::to_string/std::to_wstring in MinGW. + std::string to_string(long double); + std::string to_string(double); + std::string to_string(unsigned); + std::string to_string(int); + std::string to_string(long); + std::string to_string(unsigned long); + std::string to_string(long long); + std::string to_string(unsigned long long); + std::string to_string(float); + std::wstring to_wstring(long double); std::wstring to_wstring(double); std::wstring to_wstring(unsigned); diff --git a/source/deploy.cpp b/source/deploy.cpp index 817721ec..ce92982a 100644 --- a/source/deploy.cpp +++ b/source/deploy.cpp @@ -294,6 +294,74 @@ namespace std *pos = (std::size_t)(end - ptr); return result; } +}//end namespace std +#endif //STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED + +#ifdef STD_TO_STRING_NOT_SUPPORTED +namespace std +{ + std::string to_string(double v) + { + std::stringstream ss; + ss << v; + return ss.str(); + } + + std::string to_string(long double v) + { + std::stringstream ss; + ss << v; + return ss.str(); + } + + std::string to_string(unsigned v) + { + std::stringstream ss; + ss << v; + return ss.str(); + } + + std::string to_string(int v) + { + std::stringstream ss; + ss << v; + return ss.str(); + } + + std::string to_string(long v) + { + std::stringstream ss; + ss << v; + return ss.str(); + } + + std::string to_string(unsigned long v) + { + std::stringstream ss; + ss << v; + return ss.str(); + } + + std::string to_string(long long v) + { + std::stringstream ss; + ss << v; + return ss.str(); + } + + std::string to_string(unsigned long long v) + { + std::stringstream ss; + ss << v; + return ss.str(); + } + + std::string to_string(float v) + { + std::stringstream ss; + ss << v; + return ss.str(); + } std::wstring to_wstring(double v) { diff --git a/source/gui/detail/linux_X11/bedrock.cpp b/source/gui/detail/linux_X11/bedrock.cpp index 991cf8ef..5a69ab34 100644 --- a/source/gui/detail/linux_X11/bedrock.cpp +++ b/source/gui/detail/linux_X11/bedrock.cpp @@ -468,8 +468,8 @@ namespace detail arg.right_button = ((Button2Mask & mask_state) != 0) || (::nana::mouse::right_button == arg.button); arg.mid_button = ((Button3Mask & mask_state) != 0) || (::nana::mouse::middle_button == arg.button); arg.alt = ((Mod1Mask & mask_state) != 0); - arg.shift = £¨(ShiftMask & mask_state) != 0); - arg.ctrl = £¨(ControlMask & mask_state) != 0); + arg.shift = ((ShiftMask & mask_state) != 0); + arg.ctrl = ((ControlMask & mask_state) != 0); } @@ -833,7 +833,7 @@ namespace detail msgwnd->flags.action = mouse_action::over; click_arg.window_handle = reinterpret_cast(msgwnd); - emit_drawer(&drawer::click, msgwnd, arg, &context); + emit_drawer(&drawer::click, msgwnd, click_arg, &context); } } diff --git a/source/gui/place.cpp b/source/gui/place.cpp index da742af5..88ea8dd7 100644 --- a/source/gui/place.cpp +++ b/source/gui/place.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -95,13 +96,7 @@ namespace nana std::string pos_str() const { -#ifdef UNDEFINED_to_string - std::stringstream ss; - ss< Date: Sat, 5 Dec 2015 15:52:31 +0800 Subject: [PATCH 26/28] remove platform_spec_selector.cpp and bedrock_selector.cpp --- build/codeblocks/nana.cbp | 6 +++-- build/vc2013/nana.vcxproj | 4 ++-- build/vc2013/nana.vcxproj.filters | 18 +++++---------- build/vc2015/nana.sln | 18 +++++++-------- build/vc2015/nana.vcxproj | 4 ++-- build/vc2015/nana.vcxproj.filters | 18 +++++---------- include/nana/config.hpp | 15 ++++++------ include/nana/filesystem/file_iterator.hpp | 2 +- ...tform_spec.cpp => platform_spec_posix.cpp} | 4 +++- source/detail/platform_spec_selector.cpp | 22 ------------------ ...orm_spec.cpp => platform_spec_windows.cpp} | 5 ++++ .../{linux_X11 => x11}/msg_dispatcher.hpp | 0 .../bedrock.cpp => bedrock_posix.cpp} | 2 ++ source/gui/detail/bedrock_selector.cpp | 23 ------------------- .../bedrock.cpp => bedrock_windows.cpp} | 2 ++ 15 files changed, 49 insertions(+), 94 deletions(-) rename source/detail/{linux_X11/platform_spec.cpp => platform_spec_posix.cpp} (99%) delete mode 100644 source/detail/platform_spec_selector.cpp rename source/detail/{win32/platform_spec.cpp => platform_spec_windows.cpp} (99%) rename source/detail/{linux_X11 => x11}/msg_dispatcher.hpp (100%) rename source/gui/detail/{linux_X11/bedrock.cpp => bedrock_posix.cpp} (99%) delete mode 100644 source/gui/detail/bedrock_selector.cpp rename source/gui/detail/{win32/bedrock.cpp => bedrock_windows.cpp} (99%) diff --git a/build/codeblocks/nana.cbp b/build/codeblocks/nana.cbp index 03e6b72f..49f61ad7 100644 --- a/build/codeblocks/nana.cbp +++ b/build/codeblocks/nana.cbp @@ -49,14 +49,16 @@ - + + - + + diff --git a/build/vc2013/nana.vcxproj b/build/vc2013/nana.vcxproj index 41477943..01db0e79 100644 --- a/build/vc2013/nana.vcxproj +++ b/build/vc2013/nana.vcxproj @@ -187,7 +187,7 @@ - + @@ -195,12 +195,12 @@ + - diff --git a/build/vc2013/nana.vcxproj.filters b/build/vc2013/nana.vcxproj.filters index 418bbf46..d2c700e8 100644 --- a/build/vc2013/nana.vcxproj.filters +++ b/build/vc2013/nana.vcxproj.filters @@ -25,9 +25,6 @@ {e2569be2-9e68-477d-8b59-e248595de6c7} - - {52ed7f8e-fa48-495e-af1f-4df013205a35} - {87d14798-9015-4162-b9ab-72c741cff063} @@ -37,9 +34,6 @@ {85c9c1bb-d87b-4481-bf3c-7425f680a12d} - - {8058b530-86ec-4d72-890d-345aa30db056} - {87b124cb-408d-460b-a81b-8a788bbae0d9} @@ -114,9 +108,6 @@ Source Files\nana\audio - - Source Files\nana\detail\win32 - Source Files\nana\filesystem @@ -126,9 +117,6 @@ Source Files\nana\filesystem - - Source Files\nana\gui\detail\win32 - Source Files\nana\gui\detail @@ -339,6 +327,12 @@ Source Files\nana\gui\widgets + + Source Files\nana\detail + + + Source Files\nana\gui\detail + diff --git a/build/vc2015/nana.sln b/build/vc2015/nana.sln index 6de06997..6aec89c0 100644 --- a/build/vc2015/nana.sln +++ b/build/vc2015/nana.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.23107.0 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nana", "nana.vcxproj", "{98091380-2EC4-44B4-82A2-F0A6393BA908}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nana", "nana.vcxproj", "{25B21068-491B-4A9F-B99F-6C27BF31BAAD}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -13,14 +13,14 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {98091380-2EC4-44B4-82A2-F0A6393BA908}.Debug|x64.ActiveCfg = Debug|x64 - {98091380-2EC4-44B4-82A2-F0A6393BA908}.Debug|x64.Build.0 = Debug|x64 - {98091380-2EC4-44B4-82A2-F0A6393BA908}.Debug|x86.ActiveCfg = Debug|Win32 - {98091380-2EC4-44B4-82A2-F0A6393BA908}.Debug|x86.Build.0 = Debug|Win32 - {98091380-2EC4-44B4-82A2-F0A6393BA908}.Release|x64.ActiveCfg = Release|x64 - {98091380-2EC4-44B4-82A2-F0A6393BA908}.Release|x64.Build.0 = Release|x64 - {98091380-2EC4-44B4-82A2-F0A6393BA908}.Release|x86.ActiveCfg = Release|Win32 - {98091380-2EC4-44B4-82A2-F0A6393BA908}.Release|x86.Build.0 = Release|Win32 + {25B21068-491B-4A9F-B99F-6C27BF31BAAD}.Debug|x64.ActiveCfg = Debug|x64 + {25B21068-491B-4A9F-B99F-6C27BF31BAAD}.Debug|x64.Build.0 = Debug|x64 + {25B21068-491B-4A9F-B99F-6C27BF31BAAD}.Debug|x86.ActiveCfg = Debug|Win32 + {25B21068-491B-4A9F-B99F-6C27BF31BAAD}.Debug|x86.Build.0 = Debug|Win32 + {25B21068-491B-4A9F-B99F-6C27BF31BAAD}.Release|x64.ActiveCfg = Release|x64 + {25B21068-491B-4A9F-B99F-6C27BF31BAAD}.Release|x64.Build.0 = Release|x64 + {25B21068-491B-4A9F-B99F-6C27BF31BAAD}.Release|x86.ActiveCfg = Release|Win32 + {25B21068-491B-4A9F-B99F-6C27BF31BAAD}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/build/vc2015/nana.vcxproj b/build/vc2015/nana.vcxproj index 0f5dd3d3..89ceaaa3 100644 --- a/build/vc2015/nana.vcxproj +++ b/build/vc2015/nana.vcxproj @@ -181,7 +181,7 @@ - + @@ -189,12 +189,12 @@ + - diff --git a/build/vc2015/nana.vcxproj.filters b/build/vc2015/nana.vcxproj.filters index fab8ae53..8130c2bc 100644 --- a/build/vc2015/nana.vcxproj.filters +++ b/build/vc2015/nana.vcxproj.filters @@ -37,18 +37,12 @@ {b3023f5e-2759-409d-b6e8-5ef2fe6601ae} - - {2ce139f3-ef8e-48b7-a82a-68003eac75da} - {b9f9a5a8-fd1a-4b99-b530-d8a4c45e62ec} {4b04c197-4a1e-41f9-bfa3-d82c18bcad51} - - {cd6e7f3f-fe5b-44c6-ae8d-15554f926055} - {60f588f2-bdb9-4b1d-9e23-40a73f327283} @@ -93,9 +87,6 @@ Source Files\audio - - Source Files\detail\win32 - Source Files\filesystem @@ -132,9 +123,6 @@ Source Files\gui\detail - - Source Files\gui\detail\win32 - Source Files\gui\widgets\skeletons @@ -294,5 +282,11 @@ Source Files\paint + + Source Files\detail + + + Source Files\gui\detail + \ No newline at end of file diff --git a/include/nana/config.hpp b/include/nana/config.hpp index 8f519e9b..d9ac719b 100644 --- a/include/nana/config.hpp +++ b/include/nana/config.hpp @@ -18,7 +18,7 @@ // Windows: #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) - #define NANA_WINDOWS 1 + #define NANA_WINDOWS // MINGW ... #if defined(__MINGW32__) || defined(__MINGW64__) || defined(MINGW) @@ -31,24 +31,23 @@ // MacOS: who define APPLE ?? //#define APPLE #elif defined(APPLE) - #define NANA_MACOS 1 - #define NANA_X11 1 + #define NANA_MACOS + #define NANA_X11 // how to add this: include_directories(/opt/X11/include/) // end MacOS // Linux: (not sure about __GNU__ ??) #elif (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)) && !defined(_CRAYC) - #define NANA_LINUX 1 - #define NANA_X11 1 + #define NANA_LINUX + #define NANA_X11 // end Linux - - #else # static_assert(false, "Only Windows and Unix are supported now (Mac OS is experimental)"); #endif // Select platform #if defined(NANA_LINUX) || defined(NANA_MACOS) - #undef NANA_WINDOWS + #define NANA_POSIX + #undef NANA_WINDOWS #endif // End Select platform ...... diff --git a/include/nana/filesystem/file_iterator.hpp b/include/nana/filesystem/file_iterator.hpp index b884638f..94f37001 100644 --- a/include/nana/filesystem/file_iterator.hpp +++ b/include/nana/filesystem/file_iterator.hpp @@ -38,7 +38,7 @@ namespace filesystem fileinfo(); #ifdef NANA_WINDOWS fileinfo(const WIN32_FIND_DATA& wfd); -#elif NANA_LINUX or NANA_MACOS +#elif defined(NANA_POSIX) fileinfo(const nana::string& filename, const struct stat &); #endif nana::string name; diff --git a/source/detail/linux_X11/platform_spec.cpp b/source/detail/platform_spec_posix.cpp similarity index 99% rename from source/detail/linux_X11/platform_spec.cpp rename to source/detail/platform_spec_posix.cpp index 43fde207..33d81a75 100644 --- a/source/detail/linux_X11/platform_spec.cpp +++ b/source/detail/platform_spec_posix.cpp @@ -15,6 +15,7 @@ */ #include +#if defined(NANA_POSIX) && defined(NANA_X11) #include #include #include @@ -28,7 +29,7 @@ #include #include -#include "msg_dispatcher.hpp" +#include "x11/msg_dispatcher.hpp" namespace nana { @@ -1412,3 +1413,4 @@ namespace detail } }//end namespace detail }//end namespace nana +#endif //NANA_POSIX && NANA_X11 diff --git a/source/detail/platform_spec_selector.cpp b/source/detail/platform_spec_selector.cpp deleted file mode 100644 index b09fbfe4..00000000 --- a/source/detail/platform_spec_selector.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Platform Specification Selector - * Nana C++ Library(http://www.nanapro.org) - * Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) - * - * Distributed under the Nana Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at - * http://nanapro.org/LICENSE_1_0.txt) - * - * @file: nana/detail/platform_spec_selector.cpp - * - * This file is used to support the Nana project of some cross-platform IDE, - * - */ - -#include - -#if defined(NANA_WINDOWS) - #include "win32/platform_spec.cpp" -#elif defined(NANA_LINUX) || defined(NANA_MACOS) - #include "linux_X11/platform_spec.cpp" -#endif \ No newline at end of file diff --git a/source/detail/win32/platform_spec.cpp b/source/detail/platform_spec_windows.cpp similarity index 99% rename from source/detail/win32/platform_spec.cpp rename to source/detail/platform_spec_windows.cpp index f7ac9917..0323dfc1 100644 --- a/source/detail/win32/platform_spec.cpp +++ b/source/detail/platform_spec_windows.cpp @@ -13,6 +13,9 @@ */ #include + +#if defined(NANA_WINDOWS) + #include #include @@ -290,3 +293,5 @@ namespace detail } }//end namespace detail }//end namespace nana + +#endif //NANA_WINDOWS diff --git a/source/detail/linux_X11/msg_dispatcher.hpp b/source/detail/x11/msg_dispatcher.hpp similarity index 100% rename from source/detail/linux_X11/msg_dispatcher.hpp rename to source/detail/x11/msg_dispatcher.hpp diff --git a/source/gui/detail/linux_X11/bedrock.cpp b/source/gui/detail/bedrock_posix.cpp similarity index 99% rename from source/gui/detail/linux_X11/bedrock.cpp rename to source/gui/detail/bedrock_posix.cpp index 5a69ab34..ad8a8508 100644 --- a/source/gui/detail/linux_X11/bedrock.cpp +++ b/source/gui/detail/bedrock_posix.cpp @@ -11,6 +11,7 @@ */ #include +#if defined(NANA_POSIX) && defined(NANA_X11) #include #include #include @@ -1399,3 +1400,4 @@ namespace detail } }//end namespace detail }//end namespace nana +#endif //NANA_POSIX && NANA_X11 \ No newline at end of file diff --git a/source/gui/detail/bedrock_selector.cpp b/source/gui/detail/bedrock_selector.cpp deleted file mode 100644 index 986d3538..00000000 --- a/source/gui/detail/bedrock_selector.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Bedrock Selector - * Nana C++ Library(http://www.nanapro.org) - * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com) - * - * Distributed under the Nana Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at - * http://nanapro.sourceforge.net/LICENSE_1_0.txt) - * - * @file: nana/gui/detail/bedrock_selector.cpp - * - * This file is used to support the Nana project of some cross-platform IDE, - * - */ - -#include - -#if defined(NANA_WINDOWS) - #include "win32/bedrock.cpp" -#elif defined(NANA_LINUX) || defined(NANA_MACOS) - #include "linux_X11/bedrock.cpp" -#endif - diff --git a/source/gui/detail/win32/bedrock.cpp b/source/gui/detail/bedrock_windows.cpp similarity index 99% rename from source/gui/detail/win32/bedrock.cpp rename to source/gui/detail/bedrock_windows.cpp index 7cdd1b5f..eb48b9e9 100644 --- a/source/gui/detail/win32/bedrock.cpp +++ b/source/gui/detail/bedrock_windows.cpp @@ -12,6 +12,7 @@ */ #include +#if defined(NANA_WINDOWS) #include #include #include @@ -1894,3 +1895,4 @@ namespace detail } }//end namespace detail }//end namespace nana +#endif //NANA_WINDOWS From 8a243ad0d75978345edfd8b77b971e89e242d133 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Mon, 7 Dec 2015 02:52:30 +0800 Subject: [PATCH 27/28] add detection of clang --- include/nana/config.hpp | 10 ++++-- include/nana/gui/widgets/tabbar.hpp | 51 +++++++++++--------------- source/gui/widgets/tabbar.cpp | 56 ++++++++++++++--------------- 3 files changed, 56 insertions(+), 61 deletions(-) diff --git a/include/nana/config.hpp b/include/nana/config.hpp index d9ac719b..acef5d8c 100644 --- a/include/nana/config.hpp +++ b/include/nana/config.hpp @@ -69,8 +69,13 @@ #endif // _MSC_VER == 1900 #endif // _MSVC -//GCC -#if defined(__GNUC__) +#if defined(__clang__) + #if defined(__GLIBCPP__) || defined(__GLIBCXX__) + // is a known issue on libstdc++, it works on libc++ + #define STD_CODECVT_NOT_SUPPORTED + #endif + +#elif defined(__GNUC__) //GCC #if defined(__GLIBCPP__) || defined(__GLIBCXX__) // is a known issue on libstdc++, it works on libc++ #define STD_CODECVT_NOT_SUPPORTED @@ -99,6 +104,7 @@ #endif + // End compilers ... diff --git a/include/nana/gui/widgets/tabbar.hpp b/include/nana/gui/widgets/tabbar.hpp index 2b7193cf..f0bcb3b2 100644 --- a/include/nana/gui/widgets/tabbar.hpp +++ b/include/nana/gui/widgets/tabbar.hpp @@ -228,18 +228,6 @@ namespace nana this->create(wd, rectangle(), visible); } - tabbar(window wd, const nana::char_t* text, bool visible) - : tabbar(wd, ::nana::string(text), visible) - { - } - - tabbar(window wd, const nana::string& text, bool visible) - : tabbar() - { - this->create(wd, rectangle(), visible); - this->caption(text); - } - tabbar(window wd, const rectangle& r = rectangle(), bool visible = true) : tabbar() { @@ -256,7 +244,7 @@ namespace nana return static_cast(this->get_drawer_trigger().at_no_bound_check(pos)); } - void activate(std::size_t pos) /// Activates a tab specified by i. + void activated(std::size_t pos) /// Activates a tab specified by pos. { this->get_drawer_trigger().activate(pos); } @@ -266,9 +254,9 @@ namespace nana return this->get_drawer_trigger().activated(); } - value_type & at(std::size_t i) const /// Returns i'th element + value_type & at(std::size_t pos) const /// Returns pos'th element { - return static_cast(this->get_drawer_trigger().at(i)); + return static_cast(this->get_drawer_trigger().at(pos)); } void close_fly(bool fly) /// Draw or not a close button in each tab. @@ -277,12 +265,12 @@ namespace nana API::refresh_window(this->handle()); } - pat::cloneable& ext_renderer() const + pat::cloneable& renderer() const { return this->get_drawer_trigger().ext_renderer(); } - void ext_renderer(const pat::cloneable& ir) + void renderer(const pat::cloneable& ir) { this->get_drawer_trigger().ext_renderer(ir); } @@ -292,14 +280,14 @@ namespace nana return this->get_drawer_trigger().length(); } - void append(const std::string& text, window attach_wd, value_type value = {}) + tabbar& append(std::string text, window attach_wd, value_type value = {}) { - this->append(static_cast(nana::charset(text, nana::unicode::utf8)), attach_wd); + return this->append(static_cast(nana::charset(text, nana::unicode::utf8)), attach_wd); } - void append(const std::wstring& text, window attach_wd, value_type value = {}) + tabbar& append(std::wstring text, window attach_wd, value_type value = {}) { - this->get_drawer_trigger().insert(::nana::npos, std::wstring(text), std::move(value)); + this->get_drawer_trigger().insert(::nana::npos, std::move(text), std::move(value)); if (attach_wd) { auto pos = this->get_drawer_trigger().length(); @@ -307,6 +295,7 @@ namespace nana } API::update_window(*this); + return *this; } void push_back(nana::string text) /// Append a new item. @@ -315,17 +304,17 @@ namespace nana API::update_window(*this); } - void insert(std::size_t pos, const std::string& text, const value_type& value = {}) + void insert(std::size_t pos, std::string text, value_type value = {}) { - this->insert(pos, static_cast(nana::charset(text, nana::unicode::utf8)), value); + return this->insert(pos, static_cast(nana::charset(text, nana::unicode::utf8)), std::move(value)); } - void insert(std::size_t pos, const std::wstring& text, const value_type& value = {}) + void insert(std::size_t pos, std::wstring text, value_type value = {}) { if (pos > length()) throw std::out_of_range("tabbar::insert invalid position"); - this->get_drawer_trigger().insert(pos, std::wstring(text), value_type(value)); + this->get_drawer_trigger().insert(pos, std::move(text), std::move(value)); API::update_window(*this); } @@ -345,19 +334,19 @@ namespace nana this->get_drawer_trigger().erase(pos); } - void tab_bgcolor(std::size_t i, const ::nana::color& clr) + void tab_bgcolor(std::size_t pos, const ::nana::color& clr) { - this->get_drawer_trigger().tab_color(i, true, clr); + this->get_drawer_trigger().tab_color(pos, true, clr); } - void tab_fgcolor(std::size_t i, const ::nana::color& clr) + void tab_fgcolor(std::size_t pos, const ::nana::color& clr) { - this->get_drawer_trigger().tab_color(i, false, clr); + this->get_drawer_trigger().tab_color(pos, false, clr); } - void tab_image(std::size_t i, const nana::paint::image& img) + void tab_image(std::size_t pos, const nana::paint::image& img) { - this->get_drawer_trigger().tab_image(i, img); + this->get_drawer_trigger().tab_image(pos, img); } /// Sets buttons of the tabbar's toolbox, refer to notes for more details. template diff --git a/source/gui/widgets/tabbar.cpp b/source/gui/widgets/tabbar.cpp index d2a8cb2a..19d18391 100644 --- a/source/gui/widgets/tabbar.cpp +++ b/source/gui/widgets/tabbar.cpp @@ -605,60 +605,60 @@ namespace nana void attach(std::size_t pos, window wd) { - if(pos < list_.size()) - { - iterator_at(pos)->relative = wd; - API::show_window(wd, basis_.active == pos); - } + if (pos >= list_.size()) + throw std::out_of_range("tabbar: invalid position"); + + API::show_window(wd, basis_.active == pos); } bool tab_color(std::size_t pos, bool is_bgcolor, const ::nana::color& clr) { - if(pos < list_.size()) + if (pos >= list_.size()) + throw std::out_of_range("tabbar: invalid position"); + + auto & m = *iterator_at(pos); + auto & m_clr = (is_bgcolor ? m.bgcolor : m.fgcolor); + if (m_clr != clr) { - auto & m = *iterator_at(pos); - auto & m_clr = (is_bgcolor ? m.bgcolor : m.fgcolor); - if (m_clr != clr) - { - m_clr = clr; - return true; - } + m_clr = clr; + return true; } return false; } - bool tab_image(std::size_t pos, const nana::paint::image& img) + void tab_image(std::size_t pos, const nana::paint::image& img) { - if(pos > list_.size()) return false; + if (pos >= list_.size()) + throw std::out_of_range("tabbar: invalid position"); auto & m = *iterator_at(pos); if(img) m.img = img; else m.img.close(); - return true; } bool text(std::size_t pos, const nana::string& str) { - if(pos < list_.size()) + if (pos >= list_.size()) + throw std::out_of_range("tabbar: invalid position"); + + auto & m = *iterator_at(pos); + if(m.text != str) { - auto & m = *iterator_at(pos); - if(m.text != str) - { - m.text = str; - return true; - } + m.text = str; + return true; } + return false; } nana::string text(std::size_t pos) const { - if(pos < list_.size()) - return iterator_at(pos)->text; + if (pos >= list_.size()) + throw std::out_of_range("tabbar: invalid position"); - return nana::string(); + return iterator_at(pos)->text; } bool toolbox_answer(const arg_mouse& arg) @@ -1195,8 +1195,8 @@ namespace nana void trigger::tab_image(std::size_t i, const nana::paint::image& img) { - if(layouter_->tab_image(i, img)) - API::refresh_window(layouter_->widget_handle()); + layouter_->tab_image(i, img); + API::refresh_window(layouter_->widget_handle()); } void trigger::text(std::size_t i, const nana::string& str) From e189d6559ea3c6b97fde85ec373c5a9bf6508ac6 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Tue, 8 Dec 2015 00:42:07 +0800 Subject: [PATCH 28/28] remove warning for preprocessor --- include/nana/config.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/nana/config.hpp b/include/nana/config.hpp index acef5d8c..e97c70f6 100644 --- a/include/nana/config.hpp +++ b/include/nana/config.hpp @@ -117,7 +117,7 @@ //#define NANA_ENABLE_PNG //! //#define USE_LIBPNG_FROM_OS // Un-Comment it to use libpng from operating system. #if defined(NANA_ENABLE_PNG) - #if not defined(USE_LIBPNG_FROM_OS) + #if !defined(USE_LIBPNG_FROM_OS) #define NANA_LIBPNG #endif #endif @@ -129,7 +129,7 @@ //#define NANA_ENABLE_JPEG //! //#define USE_LIBJPEG_FROM_OS // Un-Comment it to use libjpeg from operating system. #if defined(NANA_ENABLE_JPEG) - #if not defined(USE_LIBJPEG_FROM_OS) + #if !defined(USE_LIBJPEG_FROM_OS) #define NANA_LIBJPEG #endif #endif