Merge remote-tracking branch 'cnjinhao/hotfix-1.3' into hotfix-1.3
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
|
||||
#include <nana/push_ignore_diagnostic>
|
||||
#include <nana/audio/player.hpp>
|
||||
|
||||
|
||||
#ifdef NANA_ENABLE_AUDIO
|
||||
|
||||
#include <nana/audio/detail/audio_stream.hpp>
|
||||
@@ -67,4 +70,4 @@ namespace nana{ namespace audio
|
||||
}//end namespace audio
|
||||
}//end namespace nana
|
||||
|
||||
#endif //NANA_ENABLE_AUDIO
|
||||
#endif //NANA_ENABLE_AUDIO
|
||||
|
||||
@@ -344,11 +344,11 @@ namespace nana
|
||||
{
|
||||
public:
|
||||
charset_string(const std::string& s)
|
||||
: data_(s), is_unicode_(false)
|
||||
: data_(s)
|
||||
{}
|
||||
|
||||
charset_string(std::string&& s)
|
||||
: data_(std::move(s)), is_unicode_(false)
|
||||
: data_(std::move(s))
|
||||
{}
|
||||
|
||||
charset_string(const std::string& s, unicode encoding)
|
||||
@@ -501,9 +501,9 @@ namespace nana
|
||||
}
|
||||
private:
|
||||
std::string data_;
|
||||
std::wstring wdata_for_move_;
|
||||
bool is_unicode_;
|
||||
unicode utf_x_;
|
||||
std::wstring wdata_for_move_{};
|
||||
bool is_unicode_{ false };
|
||||
unicode utf_x_{ unicode::utf8 };
|
||||
};
|
||||
|
||||
class charset_wstring
|
||||
@@ -950,11 +950,11 @@ namespace nana
|
||||
{
|
||||
public:
|
||||
charset_string(const std::string& s)
|
||||
: data_(s), is_unicode_(false)
|
||||
: data_(s)
|
||||
{}
|
||||
|
||||
charset_string(std::string&& s)
|
||||
: data_(std::move(s)), is_unicode_(false)
|
||||
: data_(std::move(s))
|
||||
{}
|
||||
|
||||
charset_string(const std::string& s, unicode encoding)
|
||||
@@ -1122,9 +1122,9 @@ namespace nana
|
||||
}
|
||||
private:
|
||||
std::string data_;
|
||||
std::wstring wdata_for_move_;
|
||||
bool is_unicode_;
|
||||
unicode utf_x_;
|
||||
std::wstring wdata_for_move_{};
|
||||
bool is_unicode_{ false };
|
||||
unicode utf_x_{ unicode::utf8 };
|
||||
};
|
||||
|
||||
|
||||
@@ -1195,7 +1195,7 @@ namespace nana
|
||||
}
|
||||
private:
|
||||
std::wstring data_;
|
||||
std::string data_for_move_;
|
||||
std::string data_for_move_{};
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -17,62 +17,65 @@
|
||||
#include <cassert>
|
||||
|
||||
namespace {
|
||||
void localtime(struct tm& tm)
|
||||
std::tm localtime()
|
||||
{
|
||||
#if defined(NANA_WINDOWS) && !defined(NANA_MINGW)
|
||||
time_t t;
|
||||
::time(&t);
|
||||
std::tm tm;
|
||||
if(localtime_s(&tm, &t) != 0)
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
|
||||
return tm;
|
||||
#else
|
||||
time_t t = std::time(nullptr);
|
||||
struct tm * tm_addr = std::localtime(&t);
|
||||
assert(tm_addr);
|
||||
tm = *tm_addr;
|
||||
|
||||
return *tm_addr;
|
||||
#endif
|
||||
}
|
||||
|
||||
::nana::date::value to_dateval(const std::tm& t)
|
||||
{
|
||||
return {static_cast<unsigned>(t.tm_year + 1900), static_cast<unsigned>(t.tm_mon + 1), static_cast<unsigned>(t.tm_mday)};
|
||||
}
|
||||
|
||||
::nana::time::value to_timeval(const std::tm& t)
|
||||
{
|
||||
return {static_cast<unsigned>(t.tm_hour), static_cast<unsigned>(t.tm_min), static_cast<unsigned>(t.tm_sec)};
|
||||
}
|
||||
|
||||
} // namespace anonymous
|
||||
|
||||
namespace nana
|
||||
{
|
||||
//class date
|
||||
//class date
|
||||
void date::set(const std::tm& t)
|
||||
{
|
||||
value_.year = t.tm_year + 1900;
|
||||
value_.month = t.tm_mon + 1;
|
||||
value_.day = t.tm_mday;
|
||||
value_ = to_dateval(t);
|
||||
}
|
||||
|
||||
date::date()
|
||||
: value_(to_dateval(*std::localtime(nullptr)))
|
||||
{
|
||||
struct tm t;
|
||||
localtime(t);
|
||||
set(t);
|
||||
}
|
||||
|
||||
date::date(const std::tm& t)
|
||||
: value_(to_dateval(t))
|
||||
{
|
||||
set(t);
|
||||
}
|
||||
|
||||
date::date(int year, int month, int day)
|
||||
: value_({static_cast<unsigned>(year), static_cast<unsigned>(month), static_cast<unsigned>(day)})
|
||||
{
|
||||
if(1601 <= year && year < 30827 && 0 < month && month < 13 && day > 0)
|
||||
{
|
||||
if(day <= static_cast<int>(date::month_days(year, month)))
|
||||
{
|
||||
value_.year = year;
|
||||
value_.month = month;
|
||||
value_.day = day;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
struct tm t;
|
||||
localtime(t);
|
||||
set(t);
|
||||
set(localtime());
|
||||
}
|
||||
|
||||
date date::operator - (int off) const
|
||||
@@ -258,40 +261,27 @@ namespace nana
|
||||
//class time
|
||||
void time::set(const std::tm& t)
|
||||
{
|
||||
value_.hour = t.tm_hour;
|
||||
value_.minute = t.tm_min;
|
||||
value_.second = t.tm_sec;
|
||||
value_ = to_timeval(t);
|
||||
}
|
||||
|
||||
time::time()
|
||||
: value_{}
|
||||
: value_(to_timeval(localtime()))
|
||||
{
|
||||
struct tm t;
|
||||
localtime(t);
|
||||
set(t);
|
||||
}
|
||||
|
||||
time::time(const std::tm& t)
|
||||
: value_(to_timeval(t))
|
||||
{
|
||||
value_.hour = t.tm_hour;
|
||||
value_.minute = t.tm_min;
|
||||
value_.second = t.tm_sec;
|
||||
}
|
||||
|
||||
time::time(unsigned hour, unsigned minute, unsigned second)
|
||||
: value_({hour, minute, second})
|
||||
{
|
||||
if(hour < 24 && minute < 60 && second < 62)
|
||||
{
|
||||
value_.hour = hour;
|
||||
value_.minute = minute;
|
||||
value_.second = second;
|
||||
return;
|
||||
}
|
||||
struct tm t;
|
||||
localtime(t);
|
||||
set(t);
|
||||
}
|
||||
|
||||
set(localtime());
|
||||
}
|
||||
const time::value& time::read() const
|
||||
{
|
||||
return value_;
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
#include <nana/detail/platform_spec_selector.hpp>
|
||||
#if defined(NANA_POSIX) && defined(NANA_X11)
|
||||
|
||||
#include <nana/push_ignore_diagnostic>
|
||||
|
||||
#include <X11/Xlocale.h>
|
||||
#include <locale>
|
||||
#include <map>
|
||||
@@ -1414,4 +1417,6 @@ namespace detail
|
||||
}
|
||||
}//end namespace detail
|
||||
}//end namespace nana
|
||||
|
||||
#include <nana/pop_ignore_diagnostic>
|
||||
#endif //NANA_POSIX && NANA_X11
|
||||
|
||||
@@ -207,10 +207,10 @@ namespace nana
|
||||
{
|
||||
switch(categ)
|
||||
{
|
||||
case category::root_tag::value:
|
||||
case category::flags::root:
|
||||
attribute.root = new attr_root_tag;
|
||||
break;
|
||||
case category::frame_tag::value:
|
||||
case category::flags::frame:
|
||||
attribute.frame = new attr_frame_tag;
|
||||
break;
|
||||
default:
|
||||
@@ -222,10 +222,10 @@ namespace nana
|
||||
{
|
||||
switch(category)
|
||||
{
|
||||
case category::root_tag::value:
|
||||
case category::flags::root:
|
||||
delete attribute.root;
|
||||
break;
|
||||
case category::frame_tag::value:
|
||||
case category::flags::frame:
|
||||
delete attribute.frame;
|
||||
break;
|
||||
default: break;
|
||||
@@ -236,7 +236,7 @@ namespace nana
|
||||
//basic_window
|
||||
//@brief: constructor for the root window
|
||||
basic_window::basic_window(basic_window* owner, std::unique_ptr<widget_notifier_interface>&& wdg_notifier, category::root_tag**)
|
||||
: widget_notifier(std::move(wdg_notifier)), other(category::root_tag::value)
|
||||
: widget_notifier(std::move(wdg_notifier)), other(category::flags::root)
|
||||
{
|
||||
drawer.bind(this);
|
||||
_m_init_pos_and_size(nullptr, rectangle());
|
||||
@@ -256,7 +256,7 @@ namespace nana
|
||||
//@brief: bind a native window and baisc_window
|
||||
void basic_window::bind_native_window(native_window_type wd, unsigned width, unsigned height, unsigned extra_width, unsigned extra_height, nana::paint::graphics& graphics)
|
||||
{
|
||||
if(category::root_tag::value == this->other.category)
|
||||
if(category::flags::root == this->other.category)
|
||||
{
|
||||
this->root = wd;
|
||||
dimension.width = width;
|
||||
@@ -270,7 +270,7 @@ namespace nana
|
||||
|
||||
void basic_window::frame_window(native_window_type wd)
|
||||
{
|
||||
if(category::frame_tag::value == this->other.category)
|
||||
if(category::flags::frame == this->other.category)
|
||||
other.attribute.frame->container = wd;
|
||||
}
|
||||
|
||||
@@ -357,12 +357,12 @@ namespace nana
|
||||
|
||||
void basic_window::_m_initialize(basic_window* agrparent)
|
||||
{
|
||||
if(other.category == category::root_tag::value)
|
||||
if(category::flags::root == other.category)
|
||||
{
|
||||
if(agrparent && (nana::system::this_thread_id() != agrparent->thread_id))
|
||||
agrparent = nullptr;
|
||||
|
||||
while(agrparent && (agrparent->other.category != category::root_tag::value))
|
||||
while(agrparent && (category::flags::root != agrparent->other.category))
|
||||
agrparent = agrparent->parent;
|
||||
|
||||
owner = agrparent;
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace nana
|
||||
//get the root graphics
|
||||
auto& graph = *(wd->root_graph);
|
||||
|
||||
if (wd->other.category != category::lite_widget_tag::value)
|
||||
if (category::flags::lite_widget != wd->other.category)
|
||||
graph.bitblt(vr, wd->drawer.graphics, nana::point(vr.x - wd->pos_root.x, vr.y - wd->pos_root.y));
|
||||
|
||||
_m_paste_children(wd, is_child_refreshed, have_refreshed, vr, graph, nana::point());
|
||||
@@ -66,7 +66,7 @@ namespace nana
|
||||
nana::point p_src;
|
||||
for (auto & el : blocks)
|
||||
{
|
||||
if (el.window->other.category == category::frame_tag::value)
|
||||
if (category::flags::frame == el.window->other.category)
|
||||
{
|
||||
native_window_type container = el.window->other.attribute.frame->container;
|
||||
native_interface::refresh_window(container);
|
||||
@@ -158,7 +158,7 @@ namespace nana
|
||||
|
||||
bool window_layout::enable_effects_bground(core_window_t * wd, bool enabled)
|
||||
{
|
||||
if (wd->other.category != category::widget_tag::value)
|
||||
if (category::flags::widget != wd->other.category)
|
||||
return false;
|
||||
|
||||
if (false == enabled)
|
||||
@@ -199,11 +199,11 @@ namespace nana
|
||||
nana::point rpos{ wd->pos_root };
|
||||
auto & glass_buffer = wd->other.glass_buffer;
|
||||
|
||||
if (wd->parent->other.category == category::lite_widget_tag::value)
|
||||
if (category::flags::lite_widget == wd->parent->other.category)
|
||||
{
|
||||
std::vector<core_window_t*> layers;
|
||||
core_window_t * beg = wd->parent;
|
||||
while (beg && (beg->other.category == category::lite_widget_tag::value))
|
||||
while (beg && (category::flags::lite_widget == beg->other.category))
|
||||
{
|
||||
layers.push_back(beg);
|
||||
beg = beg->parent;
|
||||
@@ -229,7 +229,7 @@ namespace nana
|
||||
nana::rectangle ovlp;
|
||||
if (child->visible && overlap(r, rectangle(child->pos_owner, child->dimension), ovlp))
|
||||
{
|
||||
if (child->other.category != category::lite_widget_tag::value)
|
||||
if (category::flags::lite_widget != child->other.category)
|
||||
glass_buffer.bitblt(nana::rectangle(ovlp.x - pre->pos_owner.x, ovlp.y - pre->pos_owner.y, ovlp.width, ovlp.height), child->drawer.graphics, nana::point(ovlp.x - child->pos_owner.x, ovlp.y - child->pos_owner.y));
|
||||
ovlp.x += pre->pos_root.x;
|
||||
ovlp.y += pre->pos_root.y;
|
||||
@@ -250,7 +250,7 @@ namespace nana
|
||||
nana::rectangle ovlp;
|
||||
if (child->visible && overlap(r_of_wd, rectangle{ child->pos_owner, child->dimension }, ovlp))
|
||||
{
|
||||
if (child->other.category != category::lite_widget_tag::value)
|
||||
if (category::flags::lite_widget != child->other.category)
|
||||
glass_buffer.bitblt(nana::rectangle{ ovlp.x - wd->pos_owner.x, ovlp.y - wd->pos_owner.y, ovlp.width, ovlp.height }, child->drawer.graphics, nana::point(ovlp.x - child->pos_owner.x, ovlp.y - child->pos_owner.y));
|
||||
|
||||
ovlp.x += wd->pos_root.x;
|
||||
@@ -285,7 +285,7 @@ namespace nana
|
||||
if (overlap(nana::rectangle{ child->pos_root, child->dimension }, parent_rect, rect))
|
||||
{
|
||||
bool have_child_refreshed = false;
|
||||
if (child->other.category != category::lite_widget_tag::value)
|
||||
if (category::flags::lite_widget != child->other.category)
|
||||
{
|
||||
if (is_child_refreshed && (false == child->flags.refreshing))
|
||||
{
|
||||
|
||||
@@ -312,7 +312,7 @@ namespace detail
|
||||
wd->bind_native_window(result.native_handle, result.width, result.height, result.extra_width, result.extra_height, value->root_graph);
|
||||
impl_->wd_register.insert(wd, wd->thread_id);
|
||||
|
||||
if (owner && owner->other.category == category::frame_tag::value)
|
||||
if (owner && (category::flags::frame == owner->other.category))
|
||||
insert_frame(owner, wd);
|
||||
|
||||
bedrock::inc_window(wd->thread_id);
|
||||
@@ -344,7 +344,7 @@ namespace detail
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<decltype(mutex_)> lock(mutex_);
|
||||
if(frame->other.category == category::frame_tag::value)
|
||||
if(category::flags::frame == frame->other.category)
|
||||
frame->other.attribute.frame->attach.push_back(wd);
|
||||
return true;
|
||||
}
|
||||
@@ -357,9 +357,9 @@ namespace detail
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<decltype(mutex_)> lock(mutex_);
|
||||
if(frame->other.category == category::frame_tag::value)
|
||||
if(category::flags::frame == frame->other.category)
|
||||
{
|
||||
if (impl_->wd_register.available(wd) && wd->other.category == category::root_tag::value && wd->root != frame->root)
|
||||
if (impl_->wd_register.available(wd) && (category::flags::root == wd->other.category) && wd->root != frame->root)
|
||||
{
|
||||
frame->other.attribute.frame->attach.push_back(wd->root);
|
||||
return true;
|
||||
@@ -399,7 +399,7 @@ namespace detail
|
||||
if (wd->flags.destroying)
|
||||
return;
|
||||
|
||||
if(wd->other.category == category::root_tag::value)
|
||||
if(category::flags::root == wd->other.category)
|
||||
{
|
||||
auto &brock = bedrock::instance();
|
||||
arg_unload arg;
|
||||
@@ -464,7 +464,7 @@ namespace detail
|
||||
std::lock_guard<decltype(mutex_)> lock(mutex_);
|
||||
if (impl_->wd_register.available(wd) == false) return;
|
||||
|
||||
if((wd->other.category == category::root_tag::value) || (wd->other.category != category::frame_tag::value))
|
||||
if((category::flags::root == wd->other.category) || (category::flags::frame != wd->other.category))
|
||||
{
|
||||
impl_->misc_register.erase(wd->root);
|
||||
impl_->wd_register.remove(wd);
|
||||
@@ -484,7 +484,7 @@ namespace detail
|
||||
std::lock_guard<decltype(mutex_)> lock(mutex_);
|
||||
if (impl_->wd_register.available(wd))
|
||||
{
|
||||
if(wd->other.category == category::root_tag::value)
|
||||
if(category::flags::root == wd->other.category)
|
||||
native_interface::window_icon(wd->root, small_icon, big_icon);
|
||||
}
|
||||
}
|
||||
@@ -504,9 +504,9 @@ namespace detail
|
||||
native_window_type nv = nullptr;
|
||||
switch(wd->other.category)
|
||||
{
|
||||
case category::root_tag::value:
|
||||
case category::flags::root:
|
||||
nv = wd->root; break;
|
||||
case category::frame_tag::value:
|
||||
case category::flags::frame:
|
||||
nv = wd->other.attribute.frame->container; break;
|
||||
default: //category::widget_tag, category::lite_widget_tag
|
||||
break;
|
||||
@@ -703,7 +703,7 @@ namespace detail
|
||||
|
||||
wd->dimension = sz;
|
||||
|
||||
if(category::lite_widget_tag::value != wd->other.category)
|
||||
if(category::flags::lite_widget != wd->other.category)
|
||||
{
|
||||
bool graph_state = wd->drawer.graphics.empty();
|
||||
wd->drawer.graphics.make(sz);
|
||||
@@ -714,13 +714,13 @@ namespace detail
|
||||
if(graph_state != wd->drawer.graphics.empty())
|
||||
wd->drawer.typeface_changed();
|
||||
|
||||
if(category::root_tag::value == wd->other.category)
|
||||
if(category::flags::root == wd->other.category)
|
||||
{
|
||||
wd->root_graph->make(sz);
|
||||
if(false == passive)
|
||||
native_interface::window_size(wd->root, sz + nana::size(wd->extra_width, wd->extra_height));
|
||||
}
|
||||
else if(category::frame_tag::value == wd->other.category)
|
||||
else if(category::flags::frame == wd->other.category)
|
||||
{
|
||||
native_interface::window_size(wd->other.attribute.frame->container, sz);
|
||||
for(auto natwd : wd->other.attribute.frame->attach)
|
||||
@@ -850,6 +850,9 @@ namespace detail
|
||||
{
|
||||
window_layer::paint(wd, false, refresh_tree);
|
||||
this->map(wd, force_copy_to_screen);
|
||||
|
||||
wd->drawer.graphics.save_as_file("d:\\button.bmp");
|
||||
wd->root_graph->save_as_file("d:\\button_root.bmp");
|
||||
}
|
||||
else if (effects::edge_nimbus::none != wd->effect.edge_nimbus)
|
||||
{
|
||||
@@ -1379,7 +1382,7 @@ namespace detail
|
||||
root_attr->menubar = nullptr;
|
||||
}
|
||||
|
||||
if (wd->other.category == category::root_tag::value)
|
||||
if (wd->other.category == category::flags::root)
|
||||
{
|
||||
root_runtime(wd->root)->shortkeys.clear();
|
||||
wd->other.attribute.root->focus = nullptr;
|
||||
@@ -1459,7 +1462,7 @@ namespace detail
|
||||
}
|
||||
}
|
||||
|
||||
if (wd->other.category == category::frame_tag::value)
|
||||
if (category::flags::frame == wd->other.category)
|
||||
{
|
||||
//remove the frame handle from the WM frames manager.
|
||||
utl::erase(root_attr->frames, wd);
|
||||
@@ -1565,7 +1568,7 @@ namespace detail
|
||||
wd->drawer.detached();
|
||||
wd->widget_notifier->destroy();
|
||||
|
||||
if(wd->other.category == category::frame_tag::value)
|
||||
if(category::flags::frame == wd->other.category)
|
||||
{
|
||||
//The frame widget does not have an owner, and close their element windows without activating owner.
|
||||
//close the frame container window, it's a native window.
|
||||
@@ -1616,7 +1619,7 @@ namespace detail
|
||||
for(auto i = wd->children.rbegin(); i != wd->children.rend(); ++i)
|
||||
{
|
||||
core_window_t* child = *i;
|
||||
if((child->other.category != category::root_tag::value) && _m_effective(child, pos))
|
||||
if((child->other.category != category::flags::root) && _m_effective(child, pos))
|
||||
{
|
||||
child = _m_find(child, pos);
|
||||
if(child)
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <cmath>
|
||||
#include <map>
|
||||
#include <deque>
|
||||
#include <nana/push_ignore_diagnostic>
|
||||
#include <nana/deploy.hpp>
|
||||
#include <nana/gui/place.hpp>
|
||||
#include <nana/gui/programming_interface.hpp>
|
||||
@@ -2851,3 +2852,5 @@ namespace nana
|
||||
}
|
||||
//end class place
|
||||
}//end namespace nana
|
||||
|
||||
#include <nana/pop_ignore_diagnostic>
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
* @file: nana/internationalization.cpp
|
||||
*/
|
||||
|
||||
#include <nana/push_ignore_diagnostic>
|
||||
|
||||
#include <nana/internationalization.hpp>
|
||||
#include <nana/gui/widgets/widget.hpp>
|
||||
#include <unordered_map>
|
||||
@@ -513,3 +515,5 @@ namespace nana
|
||||
}
|
||||
//end class i18n_eval
|
||||
}
|
||||
|
||||
#include <nana/pop_ignore_diagnostic>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <nana/push_ignore_diagnostic>
|
||||
#include <nana/paint/detail/image_process_provider.hpp>
|
||||
|
||||
#include <nana/paint/detail/image_processor.hpp>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* @contributors:
|
||||
* nabijaczleweli(pr#106)
|
||||
*/
|
||||
|
||||
#include <nana/push_ignore_diagnostic>
|
||||
#include <nana/detail/platform_spec_selector.hpp>
|
||||
#include <nana/paint/image.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <nana/push_ignore_diagnostic>
|
||||
#include <nana/paint/image_process_selector.hpp>
|
||||
|
||||
namespace nana
|
||||
|
||||
Reference in New Issue
Block a user