Merge branch 'develop' into prepare-utf8

This commit is contained in:
Jinhao
2016-01-03 14:18:03 +08:00
13 changed files with 522 additions and 108 deletions

View File

@@ -7,7 +7,39 @@
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* @file: nana/config.hpp
* @file nana/config.hpp
*
* @brief Provide switches to adapt to the target OS, use of external libraries or workarounds compiler errors or lack of std C++ support.
*
* To control target OS/compiler:
* - NANA_WINDOWS
* - NANA_MINGW
* - NANA_POSIX
* - NANA_LINUX
* - NANA_MACOS
* - NANA_X11
* - NANA_UNICODE
*
* External libraries:
* - NANA_LIBPNG, USE_LIBPNG_FROM_OS
* - NANA_LIBJPEG, USE_LIBJPEG_FROM_OS
*
* (see: Feature-testing recommendations for C++
* in http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0096r0.html
* for example: __cpp_lib_experimental_filesystem = 201406 in <experimental/filesystem)
*
* Workaround to known compiler errors, unnecessary warnings or lack of C++11/14/17 support:
* - _SCL_SECURE_NO_WARNNGS, _CRT_SECURE_NO_DEPRECATE (VC)
* - STD_CODECVT_NOT_SUPPORTED (VC RC, <codecvt> is a known issue on libstdc++, it works on libc++)
* - STD_THREAD_NOT_SUPPORTED (GCC < 4.8.1)
* - STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED (MinGW with GCC < 4.8.1)
* - USE_github_com_meganz_mingw_std_threads (MinGW with GCC < 4.8.1)
* - STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED (MinGW with GCC < 4.8.1)
* - STD_TO_STRING_NOT_SUPPORTED (MinGW with GCC < 4.8)
* - VERBOSE_PREPROCESSOR, STOP_VERBOSE_PREPROCESSOR
* - STD_make_unique_NOT_SUPPORTED (MinGW with GCC < 4.8.1)
* or __cpp_lib_make_unique
* http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0096r0.html#detail.cpp14.n3656
*/
#ifndef NANA_CONFIG_HPP
@@ -67,18 +99,31 @@
// 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
#if defined(__clang__)
#elif defined(__clang__) //Clang
#include <iosfwd> //Introduces some implement-specific flags of ISO C++ Library
#if defined(__GLIBCPP__) || defined(__GLIBCXX__)
//<codecvt> is a known issue on libstdc++, it works on libc++
#define STD_CODECVT_NOT_SUPPORTED
#endif
#elif defined(__GNUC__) //GCC
#include <iosfwd> //Introduces some implement-specific flags of ISO C++ Library
#if defined(__GLIBCPP__) || defined(__GLIBCXX__)
//<codecvt> is a known issue on libstdc++, it works on libc++
#define STD_CODECVT_NOT_SUPPORTED
//It's a known issue of libstdc++ on MinGW
//introduce to_string/to_wstring workarounds for disabled capacity of stdlib
#ifdef _GLIBCXX_HAVE_BROKEN_VSWPRINTF
#if (__GNUC__ < 5)
# define STD_TO_STRING_NOT_SUPPORTED
#endif
#define STD_TO_WSTRING_NOT_SUPPORTED
#endif
#endif
#if (__GNUC__ == 4)
@@ -89,16 +134,29 @@
//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
#if !defined( USE_github_com_meganz_mingw_std_threads )
//#define USE_github_com_meganz_mingw_std_threads
#endif
#if !defined(STD_make_unique_NOT_SUPPORTED)
#define STD_make_unique_NOT_SUPPORTED
#endif //STD_make_unique_NOT_SUPPORTED
#endif
#if defined(NANA_MINGW)
//It's a known issue under MinGW
//It's a knonwn issue under MinGW
#define STD_NUMERIC_CONVERSIONS_NOT_SUPPORTED
#endif
#if ((__GNUC_MINOR__ < 8) || defined(NANA_MINGW))
#define STD_TO_STRING_NOT_SUPPORTED
#if (__GNUC_MINOR__ < 8)
//introduce to_string/to_wstring workaround for lack of stdlib definitions
#ifndef STD_TO_STRING_NOT_SUPPORTED
# define STD_TO_STRING_NOT_SUPPORTED
#endif
#ifndef STD_TO_WSTRING_NOT_SUPPORTED
# define STD_TO_WSTRING_NOT_SUPPORTED
#endif
#endif
#endif
#endif
@@ -151,5 +209,13 @@
#endif
#endif
#if !defined(VERBOSE_PREPROCESSOR)
//#define VERBOSE_PREPROCESSOR
#endif
#endif //NANA_CONFIG_HPP
#if !defined(STOP_VERBOSE_PREPROCESSOR)
#define STOP_VERBOSE_PREPROCESSOR
#endif
#endif // NANA_CONFIG_HPP

View File

@@ -3,8 +3,8 @@
* 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
* 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/deploy.hpp
@@ -15,9 +15,12 @@
#ifndef NANA_DEPLOY_HPP
#define NANA_DEPLOY_HPP
#include <stdexcept>
#include <nana/config.hpp>
#if defined(VERBOSE_PREPROCESSOR)
#include <nana/verbose_preprocessor.hpp>
#endif
#include <stdexcept>
#include <nana/charset.hpp>
//Implement workarounds for GCC/MinGW which version is below 4.8.2
@@ -71,7 +74,12 @@ namespace std
std::string to_string(long long);
std::string to_string(unsigned long long);
std::string to_string(float);
}
#endif
#ifdef STD_TO_WSTRING_NOT_SUPPORTED
namespace std
{
std::wstring to_wstring(long double);
std::wstring to_wstring(double);
std::wstring to_wstring(unsigned);
@@ -146,4 +154,44 @@ namespace nana
#define NANA_RGB(a) (((DWORD)(a) & 0xFF)<<16) | ((DWORD)(a) & 0xFF00) | (((DWORD)(a) & 0xFF0000) >> 16 )
#if defined(STD_make_unique_NOT_SUPPORTED)
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3656.htm
#include <cstddef>
#include <memory>
#include <type_traits>
#include <utility>
namespace std {
template<class T> struct _Unique_if {
typedef unique_ptr<T> _Single_object;
};
template<class T> struct _Unique_if<T[]> {
typedef unique_ptr<T[]> _Unknown_bound;
};
template<class T, size_t N> struct _Unique_if<T[N]> {
typedef void _Known_bound;
};
template<class T, class... Args>
typename _Unique_if<T>::_Single_object
make_unique(Args&&... args) {
return unique_ptr<T>(new T(std::forward<Args>(args)...));
}
template<class T>
typename _Unique_if<T>::_Unknown_bound
make_unique(size_t n) {
typedef typename remove_extent<T>::type U;
return unique_ptr<T>(new U[n]());
}
template<class T, class... Args>
typename _Unique_if<T>::_Known_bound
make_unique(Args&&...) = delete;
}
#endif //STD_make_unique_NOT_SUPPORTED
#endif //NANA_MACROS_HPP

View File

@@ -72,10 +72,12 @@ namespace detail
static void capture_window(native_window_type, bool);
static nana::point cursor_position();
static native_window_type get_owner_window(native_window_type);
static native_window_type parent_window(native_window_type);
static native_window_type parent_window(native_window_type child, native_window_type new_parent, bool returns_previous);
//For Caret
static void caret_create(native_window_type, const ::nana::size&);
static void caret_create(native_window_type, const ::nana::size&);
static void caret_destroy(native_window_type);
static void caret_pos(native_window_type, const ::nana::point&);
static void caret_pos(native_window_type, const ::nana::point&);
static void caret_visible(native_window_type, bool);
static void set_focus(native_window_type);

View File

@@ -0,0 +1,56 @@
/**
* Nana Verbose preprocessor
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2016 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/verbose_preprocessor.hpp
*
* @brief show the values of configuration constants during compilation to facilitate build debugging.
*
* Set VERBOSE_PREPROCESSOR to 1 to show the messages or to 0 for a normal build.
* Normally set to 0. Set to 1 only in case you want to debug the build system because it is extremely repetitive and slow.
*
* @authors Ariel Vina-Rodriguez (qPCR4vir)
*
*/
// Created by ariel.rodriguez on 08.12.2015.
//
#ifndef NANA_VERBOSE_PREPROCESSOR_H
#define NANA_VERBOSE_PREPROCESSOR_H
#if defined(VERBOSE_PREPROCESSOR)
#define STRING2(x) #x
#define STRING(x) STRING2(x)
#pragma message ( "\nVerbose preprocessor =" STRING(VERBOSE_PREPROCESSOR)" , \n STOP_VERBOSE_PREPROCESSOR=" STRING(STOP_VERBOSE_PREPROCESSOR) )
#pragma message ( "\nWindows: \n _WIN32=" STRING(_WIN32) ", \n __WIN32__ =" STRING(__WIN32__) " , \n WIN32=" STRING(WIN32)" , \n NANA_WINDOWS=" STRING(NANA_WINDOWS) )
#pragma message ( "\nUNICODE: \n NANA_UNICODE=" STRING(NANA_UNICODE) ", \n _UNICODE =" STRING(_UNICODE) " , \n UNICODE=" STRING(UNICODE) )
#pragma message ( "\nMinGW: \n __MINGW32__=" STRING(__MINGW32__) ", \n __MINGW64__=" STRING(__MINGW64__) " , \n MINGW=" STRING(MINGW) )
#pragma message ( "\nGNU: \n __GNUC__=" STRING(__GNUC__) ", \n __GNUC_MINOR__=" STRING(__GNUC_MINOR__) " , \n __GNUC_PATCHLEVEL__=" STRING(__GNUC_PATCHLEVEL__) )
#pragma message ( "\nSTD: \nSTD_CODECVT_NOT_SUPPORTED=" STRING(STD_CODECVT_NOT_SUPPORTED) " , \nSTD_THREAD_NOT_SUPPORTED=" STRING(STD_THREAD_NOT_SUPPORTED) )
#pragma message ( "\nSTD: \nUSE_github_com_meganz_mingw_std_threads=" STRING(USE_github_com_meganz_mingw_std_threads) " , \nSTD_THREAD_NOT_SUPPORTED=" STRING(STD_THREAD_NOT_SUPPORTED) )
#pragma message ( "\nClang compiler: \n__clang__=" STRING(__clang__) ", \n__GLIBCPP__=" STRING(__GLIBCPP__) " , \n__GLIBCXX__=" STRING(__GLIBCXX__) )
#pragma message ( "\nMSC: \n_MSC_VER=" STRING(_MSC_VER) ", \n_MSC_FULL_VER=" STRING(_MSC_FULL_VER ) )
#if defined(STOP_VERBOSE_PREPROCESSOR)
#error ("\nCompilation stopped to avoid annoying messages")
#endif
#endif // VERBOSE_PREPROCESSOR
#endif //NANA_VERBOSE_PREPROCESSOR_H