Merge branch 'hotfix-1.2' into prepare-utf8

This commit is contained in:
Jinhao
2015-12-04 23:44:11 +08:00
28 changed files with 351 additions and 236 deletions

View File

@@ -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)
{

View File

@@ -13,6 +13,7 @@
*
* http://standards.freedesktop.org/clipboards-spec/clipboards-0.1.txt
*/
#include <nana/detail/platform_spec_selector.hpp>
#include <X11/Xlocale.h>
#include <locale>

View File

@@ -11,6 +11,7 @@
*
* This file provides basis class and data structrue that required by nana
*/
#include <nana/detail/platform_spec_selector.hpp>
#include <shellapi.h>
#include <stdexcept>

View File

@@ -21,7 +21,7 @@
#include <map>
#include <algorithm>
#if defined(NANA_MINGW) && defined(STD_THREAD_NOT_SUPPORTED)
#if defined(STD_THREAD_NOT_SUPPORTED)
#include <nana/std_thread.hpp>
#include <nana/std_mutex.hpp>
#include <nana/std_condition_variable.hpp>
@@ -29,7 +29,7 @@
#include <mutex>
#include <condition_variable>
#include <thread>
#endif //NANA_MINGW
#endif // STD_THREAD_NOT_SUPPORTED
namespace nana
{

View File

@@ -14,7 +14,7 @@
#include <nana/gui/detail/native_window_interface.hpp>
#include <nana/gui/screen.hpp>
#if defined(NANA_WINDOWS)
#if defined(NANA_MINGW) && defined(STD_THREAD_NOT_SUPPORTED)
#if defined(STD_THREAD_NOT_SUPPORTED)
#include <nana/std_mutex.hpp>
#else
#include <mutex>

View File

@@ -463,10 +463,10 @@ namespace detail
}
}
void window_manager::default_icon(const nana::paint::image& small_icon, const nana::paint::image& big_icon)
void window_manager::default_icon(const nana::paint::image& _small, const nana::paint::image& big)
{
impl_->default_icon_big = big_icon;
impl_->default_icon_small = small_icon;
impl_->default_icon_big = big;
impl_->default_icon_small = _small;
}
void window_manager::icon(core_window_t* wd, const paint::image& small_icon, const paint::image& big_icon)

View File

@@ -20,7 +20,7 @@
#include <unordered_map>
#include <unordered_set>
#if defined(NANA_MINGW) && defined(STD_THREAD_NOT_SUPPORTED)
#if defined(STD_THREAD_NOT_SUPPORTED)
#include <nana/std_mutex.hpp>
#else
#include <mutex>

View File

@@ -95,13 +95,13 @@ namespace nana
std::string pos_str() const
{
#ifdef NANA_MINGW
#ifdef UNDEFINED_to_string
std::stringstream ss;
ss<<pos();
return ss.str();
#else
return std::to_string(pos());
#endif // NANA_MINGW
#endif // UNDEFINED_to_string
}
token read()

View File

@@ -19,7 +19,7 @@
#include <map>
#include <memory>
#if defined(NANA_MINGW) && defined(STD_THREAD_NOT_SUPPORTED)
#if defined(STD_THREAD_NOT_SUPPORTED)
#include <nana/std_mutex.hpp>
#else
#include <mutex>

View File

@@ -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<size_t>(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)

View File

@@ -14,9 +14,14 @@
#include <nana/gui/widgets/widget.hpp>
#include <unordered_map>
#include <fstream>
#include <sstream>
#include <memory>
#if defined(STD_THREAD_NOT_SUPPORTED)
#include <nana/std_mutex.hpp>
#else
#include <mutex>
#endif
#include <map>
namespace nana
@@ -71,16 +76,20 @@ 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)
str_ += *i;
else
escape = true;
}
_m_eat_ws();
if (read_ptr_ == end_ptr_ || '"' != *read_ptr_)
@@ -261,9 +270,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();
std::lock_guard<std::recursive_mutex> lock(mgr.mutex);
mgr.table.erase(wd);
auto & eval_mgr = get_eval_manager();
std::lock_guard<std::recursive_mutex> lockgd(eval_mgr.mutex);
eval_mgr.table.erase(wd);
});
}
else

View File

@@ -17,8 +17,9 @@
#include <vector>
#if defined(STD_THREAD_NOT_SUPPORTED)
#include <nana/std_condition_variable.hpp>
#include <nana/std_mutex.hpp>
#include <nana/std_condition_variable.hpp>
#else
#include <condition_variable>
#include <mutex>