diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ca11efe..e46796a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -141,10 +141,10 @@ endif(UNIX) if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") # Clang || GNU if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++14 -Wall") # Clang + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++14 -Wall -g") # Clang else ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall") # GNU + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -g") # GNU endif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") diff --git a/build/makefile/makefile b/build/makefile/makefile index db31cf6e..9f0fb052 100644 --- a/build/makefile/makefile +++ b/build/makefile/makefile @@ -1,43 +1,53 @@ #Nana C++ Library # -#Makefile created by Jinhao(cnjinhao@hotmail.com) +#Makefile created by sarrow104(sarrow104@gmail.com) GCC = g++ INCROOT = ../../include SRCROOT = ../../source EXTRLIB = ../../extrlib NANA_INC= $(INCROOT)/nana +OUTROOT = out +#CXXFLAGS= -g -std=c++11 -Wall +CXXFLAGS= -g -fexceptions -std=c++11 -Wall -Wextra -Wunused-variable -Wfatal-errors INCS = -I$(INCROOT) -I/usr/include/freetype2 -I$(EXTRLIB) BIN = libnana.a -SRC_NANA = $(wildcard $(SRCROOT)/*.cpp) -SRC_DETAIL = $(wildcard $(SRCROOT)/detail/*.cpp) -SRC_FILESYSTEM = $(wildcard $(SRCROOT)/filesystem/*.cpp) -SRC_AUDIO = $(wildcard $(SRCROOT)/audio/*.cpp) -SRC_AUDIO_DETAIL = $(wildcard $(SRCROOT)/audio/detail/*.cpp) -SRC_GUI = $(wildcard $(SRCROOT)/gui/*.cpp) -SRC_GUI_DETAIL = $(wildcard $(SRCROOT)/gui/detail/*.cpp) -SRC_GUI_WIDGETS = $(wildcard $(SRCROOT)/gui/widgets/*.cpp) -SRC_GUI_WIDGETS_SKELETONS = $(wildcard $(SRCROOT)/gui/widgets/skeletons/*.cpp) -SRC_PAINT = $(wildcard $(SRCROOT)/paint/*.cpp) -SRC_PAINT_DETAIL = $(wildcard $(SRCROOT)/paint/detail/*.cpp) -SRC_SYSTEM = $(wildcard $(SRCROOT)/system/*.cpp) -SRC_THREADS= $(wildcard $(SRCROOT)/threads/*.cpp) +TARGET = ../bin/$(BIN) -SOURCES = $(SRC_NANA) $(SRC_DETAIL) $(SRC_FILESYSTEM) $(SRC_AUDIO) $(SRC_AUDIO_DETAIL) $(SRC_GUI) $(SRC_GUI_DETAIL) $(SRC_GUI_WIDGETS) $(SRC_GUI_WIDGETS_SKELETONS) $(SRC_PAINT) $(SRC_PAINT_DETAIL) $(SRC_SYSTEM) $(SRC_THREADS) +.PHONY: all clean install print -LINKOBJ = $(SOURCES:.cpp=.o) +all: $(TARGET) -$(BIN): $(LINKOBJ) - ar r ../bin/$(BIN) $(LINKOBJ) - ranlib ../bin/$(BIN) +define walk +$(wildcard $(1)) $(foreach e, $(wildcard $(1)/*), $(call walk, $(e))) +endef -.cpp.o: - $(GCC) -g -c $< -o $@ $(INCS) -std=c++11 -Wall +SRCFILES := $(filter %.cpp,$(patsubst ./%,%,$(filter-out .,$(call walk, $(SRCROOT))))) + +LINKOBJ = $(patsubst $(SRCROOT)/%.cpp,$(OUTROOT)/objs/%.o,$(SRCFILES)) + +print: + @echo $(LINKOBJ) + +$(TARGET): $(LINKOBJ) + mkdir -p $(dir $@) + ar rus $@ $? + ranlib $@ + +$(OUTROOT)/objs/%.o: $(SRCROOT)/%.cpp + @mkdir -p $(dir $@) + $(GCC) -o $@ -c $< $(INCS) $(CXXFLAGS) clean: rm -f $(LINKOBJ) - rm -f ../bin/$(BIN) + rm -f $(TARGET) +install: + @mkdir -p $(INSTALL_PREFIX)/include + @mkdir -p $(INSTALL_PREFIX)/bin + @mkdir -p $(INSTALL_PREFIX)/lib + cp -rfl $(INCROOT)/* $(INSTALL_PREFIX)/include + cp -rfl $(TARGET) $(INSTALL_PREFIX)/lib/ diff --git a/include/nana/config.hpp b/include/nana/config.hpp index 0969af25..47ab4e4a 100644 --- a/include/nana/config.hpp +++ b/include/nana/config.hpp @@ -25,7 +25,11 @@ #include "c++defines.hpp" -//The basic configurations are ignored when NANA_IGNORE_CONF is defined. +//This marco is defined since 1.4 and until 1.5 for deprecating frame widget. +//This marco and class frame will be removed in version 1.5 +#define WIDGET_FRAME_DEPRECATED + +//The following basic configurations are ignored when NANA_IGNORE_CONF is defined. //The NANA_IGNORE_CONF may be specified by CMake generated makefile. #ifndef NANA_IGNORE_CONF @@ -93,10 +97,6 @@ #endif #endif -//This marco is defined since 1.4 and until 1.5 for deprecating frame widget. -//This marco and class frame will be removed in version 1.5 -#define WIDGET_FRAME_DEPRECATED - /////////////////// // Support for NANA_AUTOMATIC_GUI_TESTING // Will cause the program to self-test the GUI. A default automatic GUI test diff --git a/include/nana/gui/detail/basic_window.hpp b/include/nana/gui/detail/basic_window.hpp index 01ccb589..038acdbb 100644 --- a/include/nana/gui/detail/basic_window.hpp +++ b/include/nana/gui/detail/basic_window.hpp @@ -64,6 +64,7 @@ namespace detail rectangle effect_range_; };//end class caret + /// Define some constant about tab category, these flags can be combine with operator | struct tab_type { @@ -75,7 +76,6 @@ namespace detail }; }; - class caret; /// a window data structure descriptor struct basic_window @@ -212,7 +212,9 @@ namespace detail struct attr_root_tag { +#ifndef WIDGET_FRAME_DEPRECATED container frames; ///< initialization is null, it will be created while creating a frame widget. Refer to WindowManager::create_frame +#endif container tabstop; std::vector effects_edge_nimbus; basic_window* focus{nullptr}; diff --git a/include/nana/gui/detail/window_manager.hpp b/include/nana/gui/detail/window_manager.hpp index d2a83d3e..e7cbf5ca 100644 --- a/include/nana/gui/detail/window_manager.hpp +++ b/include/nana/gui/detail/window_manager.hpp @@ -10,8 +10,8 @@ * @file: nana/gui/detail/window_manager.hpp * * - * destroy method destroys a window handle and the handles of its children, but it doesn't delete the handle which type is a root window or a frame - * destroy_handle method just destroys the handle which type is a root window or a frame + * destroy method destroys a window handle and the handles of its children, but it doesn't delete the handle which type is a root window + * destroy_handle method just destroys the handle which type is a root window * */ diff --git a/source/deploy.cpp b/source/deploy.cpp index 7f098148..7f715ef9 100644 --- a/source/deploy.cpp +++ b/source/deploy.cpp @@ -449,7 +449,7 @@ namespace std //template< > std::string put_time/**/(const std::tm* tmb, const char* fmt) { - unsigned sz = 200; + std::size_t sz = 200; std::string str(sz, '\0'); sz = std::strftime(&str[0], str.size() - 1, fmt, tmb); str.resize(sz); diff --git a/source/gui/detail/basic_window.cpp b/source/gui/detail/basic_window.cpp index a7cbd2e6..faf0b553 100644 --- a/source/gui/detail/basic_window.cpp +++ b/source/gui/detail/basic_window.cpp @@ -211,19 +211,24 @@ namespace nana basic_window::other_tag::other_tag(category::flags categ) : category(categ), active_window(nullptr), upd_state(update_state::none) { +#ifndef WIDGET_FRAME_DEPRECATED switch(categ) { case category::flags::root: attribute.root = new attr_root_tag; break; -#ifndef WIDGET_FRAME_DEPRECATED case category::flags::frame: attribute.frame = new attr_frame_tag; break; -#endif default: attribute.root = nullptr; } +#else + if (category::flags::root == categ) + attribute.root = new attr_root_tag; + else + attribute.root = nullptr; +#endif } basic_window::other_tag::~other_tag() diff --git a/source/gui/detail/window_manager.cpp b/source/gui/detail/window_manager.cpp index 0af79eb8..f685c83b 100644 --- a/source/gui/detail/window_manager.cpp +++ b/source/gui/detail/window_manager.cpp @@ -23,6 +23,8 @@ #include #include +#include //debug travis + namespace nana { @@ -92,7 +94,9 @@ namespace detail { void operator()(basic_window* wd) const { + std::cout << "delete basic_window " << wd <<" category="<(wd->other.category)<< std::endl; delete wd; + std::cout << " delete successfully" << std::endl; } }; diff --git a/source/gui/widgets/listbox.cpp b/source/gui/widgets/listbox.cpp index 9c710901..8cf10cbc 100644 --- a/source/gui/widgets/listbox.cpp +++ b/source/gui/widgets/listbox.cpp @@ -2078,7 +2078,7 @@ namespace nana unsigned x_offset() const { - return (h.empty() ? 0 : h.value()); + return static_cast(h.empty() ? 0 : h.value()); } index_pair offset_y_abs, offset_y_dpl; //cat stands for category, item stands for item. "item == npos" means that is a category. diff --git a/source/gui/widgets/skeletons/text_editor.cpp b/source/gui/widgets/skeletons/text_editor.cpp index 341fa22d..3062b445 100644 --- a/source/gui/widgets/skeletons/text_editor.cpp +++ b/source/gui/widgets/skeletons/text_editor.cpp @@ -3451,7 +3451,7 @@ namespace nana{ namespace widgets unsigned text_editor::_m_char_by_pixels(const unicode_bidi::entity& ent, unsigned pos) { - unsigned len = ent.end - ent.begin; + auto len = static_cast(ent.end - ent.begin); std::unique_ptr pxbuf(new unsigned[len]); if (graph_.glyph_pixels(ent.begin, len, pxbuf.get())) diff --git a/source/paint/text_renderer.cpp b/source/paint/text_renderer.cpp index 1716b34c..825639c6 100644 --- a/source/paint/text_renderer.cpp +++ b/source/paint/text_renderer.cpp @@ -627,7 +627,7 @@ namespace nana std::unique_ptr pixels(new unsigned[text.size()]); graph_.glyph_pixels(text.c_str(), text.size(), pixels.get()); - unsigned substr_len = 0; + std::size_t substr_len = 0; unsigned substr_px = 0; if (align::right == text_align_ex_)