Merge branch 'hotfix-1.6.1' into develop

This commit is contained in:
Jinhao
2018-08-19 15:24:05 +08:00
42 changed files with 1148 additions and 230 deletions

View File

@@ -23,6 +23,8 @@
#include <windows.h>
#endif
#include <atomic>
namespace nana{ namespace audio
{
namespace detail
@@ -52,8 +54,8 @@ namespace nana{ namespace audio
private:
void _m_prepare_routine();
private:
volatile bool running_;
volatile bool wait_for_buffer_;
std::atomic<bool> running_;
std::atomic<bool> wait_for_buffer_;
std::thread thr_;
mutable std::mutex token_buffer_, token_prepared_;
mutable std::condition_variable cond_buffer_, cond_prepared_;

View File

@@ -220,12 +220,14 @@
#endif
#undef _nana_std_has_string_view
#undef _nana_std_has_returnable_emplace_back
#if ((defined(_MSC_VER) && (_MSC_VER >= 1912) && defined(_MSVC_LANG) && _MSVC_LANG >= 201703)) || \
((__cplusplus >= 201703L) && \
(defined(__clang__) && (__clang_major__ * 100 + __clang_minor__ >= 400) || \
(!defined(__clang__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 701))) \
)
# define _nana_std_has_string_view
# define _nana_std_has_returnable_emplace_back
#endif

View File

@@ -51,6 +51,13 @@ namespace nana
top_left, top_right, bottom_left, bottom_right
};
enum class window_relationship
{
owner, ///< Owner window.
parent, ///< Parent window.
either_po ///< One between owner and parent.
};
enum class bground_mode
{
none,

View File

@@ -172,7 +172,7 @@ namespace nana
}
else if constexpr(std::is_invocable_v<Function>)
{
return _m_emplace(new docker{ this, [fn](arg_reference){
return _m_emplace(new docker{ this, [fn](arg_reference) mutable{
fn();
}, false }, false);
}
@@ -200,7 +200,7 @@ namespace nana
}
else if constexpr(std::is_invocable_v<Function>)
{
return _m_emplace(new docker{ this, [fn](arg_reference) {
return _m_emplace(new docker{ this, [fn](arg_reference) mutable{
fn();
}, true }, in_front);
}

View File

@@ -1,7 +1,7 @@
/*
* Platform Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -36,6 +36,14 @@ namespace detail
unsigned extra_height; //extra border size, it is useful in Windows, ignore in X11 always 0
};
struct frame_extents
{
int left;
int right;
int top;
int bottom;
};
using native_string_type = ::nana::detail::native_string_type;
//Execute a function in a thread which is associated with the specified native window.
@@ -70,14 +78,15 @@ namespace detail
static void bring_top(native_window_type, bool activated);
static void set_window_z_order(native_window_type, native_window_type wd_after, z_order_action action_if_no_wd_after);
static frame_extents window_frame_extents(native_window_type);
static bool window_size(native_window_type, const size&);
static void get_window_rect(native_window_type, rectangle&);
static void window_caption(native_window_type, const native_string_type&);
static native_string_type window_caption(native_window_type);
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 get_window(native_window_type wd, window_relationship);
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&);

View File

@@ -1,7 +1,7 @@
/*
* A Message Box Class
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -255,7 +255,11 @@ namespace nana
bool show_modal(Args&& ... args)
{
std::vector<abstract_content*> contents;
#ifdef __cpp_fold_expressions
(contents.emplace_back(&args), ...);
#else
_m_fetch_args(contents, std::forward<Args>(args)...);
#endif
if (contents.empty())
return false;

View File

@@ -1,6 +1,6 @@
/*
* A Widget Iterator Template
* Copyright(C) 2017 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2017-2018 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -23,6 +23,7 @@ namespace nana {
template<typename Category, typename T>
class widget_iterator
{
public:
using iterator_category = Category;
using value_type = T;
using difference_type = std::ptrdiff_t;

View File

@@ -1033,6 +1033,7 @@ namespace nana
template<typename T>
void append_model(const T& t)
{
nana::internal_scope_guard lock;
_m_try_append_model(const_virtual_pointer{ &t });
_m_update();
}

View File

@@ -1,7 +1,7 @@
/*
* Text Token Stream
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -22,6 +22,7 @@
#include <stdexcept>
#include <nana/push_ignore_diagnostic>
#include <nana/unicode_bidi.hpp>
namespace nana{ namespace widgets{ namespace skeletons
{
@@ -95,10 +96,19 @@ namespace nana{ namespace widgets{ namespace skeletons
return std::stoi(idstr_, nullptr, 0);
}
private:
static bool _m_unicode_word_breakable(wchar_t ch)
/*
static bool _m_unicode_word_breakable(wchar_t ch) //deprecated
{
return ((0x4E00 <= ch) && (ch <= 0x9FFF));
}
*/
static bool _m_unicode_word_breakable(const wchar_t* ch) noexcept
{
if (*ch)
return unicode_wordbreak(*ch, ch[1]);
return true;
}
//Read the data token
token _m_token()
@@ -112,14 +122,14 @@ namespace nana{ namespace widgets{ namespace skeletons
idstr_.clear();
idstr_.append(1, ch);
if(_m_unicode_word_breakable(ch))
if (_m_unicode_word_breakable(iptr_))
{
++iptr_;
return token::data;
}
ch = *++iptr_;
while((iptr_ != endptr_) && (ch > 0xFF) && (false == _m_unicode_word_breakable(ch)))
while((iptr_ != endptr_) && (ch > 0xFF) && (false == _m_unicode_word_breakable(iptr_)))
{
idstr_.append(1, ch);

View File

@@ -170,7 +170,8 @@ namespace nana
}
/// Base class of all the classes defined as a widget window. Defaultly a widget_tag
template<typename Category, typename DrawerTrigger, typename Events = ::nana::general_events, typename Scheme = ::nana::widget_geometrics>
template<typename Category, typename DrawerTrigger, typename Events = ::nana::general_events, typename Scheme = ::nana::widget_geometrics,
typename = typename std::enable_if<std::is_base_of<::nana::drawer_trigger, DrawerTrigger>::value>::type> //type DrawerTrigger must be derived from nana::drawer_trigger
class widget_object: public detail::widget_base
{
protected:
@@ -182,7 +183,9 @@ namespace nana
widget_object()
: events_{ std::make_shared<Events>() },
scheme_{ API::dev::make_scheme<Scheme>() }
{}
{
static_assert(std::is_base_of<::nana::drawer_trigger, DrawerTrigger>::value, "The type DrawerTrigger must be derived from nana::drawer_trigger");
}
~widget_object()
{
@@ -291,7 +294,7 @@ namespace nana
};//end class widget_object
/// Base class of all the classes defined as a non-graphics-buffer widget window. The second template parameter DrawerTrigger is always ignored.\see nana::panel
template<typename DrawerTrigger, typename Events, typename Scheme>
template<typename DrawerTrigger, typename Events, typename Scheme> //type DrawerTrigger must be derived from nana::drawer_trigger
class widget_object<category::lite_widget_tag, DrawerTrigger, Events, Scheme>: public detail::widget_base
{
protected:
@@ -302,7 +305,9 @@ namespace nana
widget_object()
: events_{ std::make_shared<Events>() }, scheme_{ API::dev::make_scheme<scheme_type>() }
{}
{
static_assert(std::is_base_of<::nana::drawer_trigger, DrawerTrigger>::value, "The type DrawerTrigger must be derived from nana::drawer_trigger");
}
~widget_object()
{
@@ -355,7 +360,7 @@ namespace nana
/// Base class of all the classes defined as a root window. \see nana::form
template<typename DrawerTrigger, typename Events, typename Scheme>
template<typename DrawerTrigger, typename Events, typename Scheme> //type DrawerTrigger must be derived from nana::drawer_trigger
class widget_object<category::root_tag, DrawerTrigger, Events, Scheme>: public detail::widget_base
{
protected:
@@ -367,10 +372,12 @@ namespace nana
widget_object()
: widget_object(nullptr, false, API::make_center(300, 150), appearance(), this)
{
static_assert(std::is_base_of<::nana::drawer_trigger, DrawerTrigger>::value, "The type DrawerTrigger must be derived from nana::drawer_trigger");
}
widget_object(window owner, bool nested, const rectangle& r = {}, const appearance& apr = {})
{
static_assert(std::is_base_of<::nana::drawer_trigger, DrawerTrigger>::value, "The type DrawerTrigger must be derived from nana::drawer_trigger");
handle_ = API::dev::create_window(owner, nested, r, apr, this);
_m_bind_and_attach();
}

View File

@@ -1,7 +1,7 @@
/*
* An Implementation of i18n
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at

View File

@@ -193,7 +193,7 @@ namespace nana{ namespace pat{
cwrapper_.reset();
}
operator operator_bool_t() const volatile noexcept
operator operator_bool_t() const noexcept
{
return (fast_ptr_ ? &inner_bool::true_stand : nullptr);
}

View File

@@ -1,5 +1,5 @@
#if (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 6)
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
# pragma GCC diagnostic pop
#endif

View File

@@ -1,4 +1,4 @@
#if (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 6)
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Weffc++"
#endif

View File

@@ -1,6 +1,6 @@
/*
* Timepiece Implementation
* Copyright(C) 2003-2013 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -13,6 +13,8 @@
#ifndef NANA_SYSTEM_TIMEPIECE_HPP
#define NANA_SYSTEM_TIMEPIECE_HPP
#include "../c++defines.hpp"
namespace nana
{
namespace system
@@ -21,11 +23,11 @@ namespace system
{
public:
timepiece();
timepiece(const volatile timepiece&);
timepiece(const timepiece&);
~timepiece();
timepiece & operator=(const volatile timepiece &);
void start() volatile; ///< Set the begin time.
double calc() const volatile; ///< Get the intervals from the begin time.
timepiece & operator=(const timepiece &);
void start() noexcept; ///< Set the begin time.
double calc() const noexcept; ///< Get the intervals from the begin time.
private:
struct impl_t;
impl_t * impl_;

View File

@@ -71,6 +71,8 @@ namespace nana
std::vector<unicode_bidi::entity> unicode_reorder(const wchar_t* text, std::size_t length);
bool unicode_wordbreak(wchar_t left, wchar_t right);
}
#include <nana/pop_ignore_diagnostic>