Merge remote-tracking branch 'cnjinhao/hotfix-1.3' into hotfix-1.3

This commit is contained in:
qPCR4vir 2016-03-23 17:24:14 +01:00
commit 4b2657246d
7 changed files with 31 additions and 16 deletions

View File

@ -109,6 +109,7 @@ if(WIN32)
if(MINGW) if(MINGW)
if(NANA_CMAKE_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ) if(NANA_CMAKE_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ)
add_definitions(-DSTD_THREAD_NOT_SUPPORTED)
add_definitions(-DNANA_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ) add_definitions(-DNANA_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ)
endif(NANA_CMAKE_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ) endif(NANA_CMAKE_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ)
endif(MINGW) endif(MINGW)

View File

@ -8,12 +8,12 @@
#include <windows.h> #include <windows.h>
#include <mutex> #include <mutex>
#include <condition_variable> #include <condition_variable>
#include <thread> //#include <thread>
#include <pthread.h> //#include <pthread.h>
#include <errno.h> #include <errno.h>
#include <cstdio> #include <cstdio>
// http://lxr.free-electrons.com/source/include/uapi/asm-generic/errno.h#L53 // http://lxr.free-electrons.com/source/include/uapi/asm-generic/errno.h#L53
#define EPROTO 71 /* Protocol error */ //#define EPROTO 71 /* Protocol error */
#include <mingw.thread.h> #include <mingw.thread.h>
#include <mingw.mutex.h> #include <mingw.mutex.h>
#else #else

View File

@ -5,6 +5,7 @@
#if defined(STD_THREAD_NOT_SUPPORTED) #if defined(STD_THREAD_NOT_SUPPORTED)
#if defined(NANA_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ) #if defined(NANA_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ)
#include <mingw.thread.h> #include <mingw.thread.h>
#else #else
#include <boost/thread.hpp> #include <boost/thread.hpp>
@ -13,5 +14,11 @@ namespace std
typedef boost::thread thread; typedef boost::thread thread;
} }
#endif // (NANA_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ) #endif // (NANA_ENABLE_MINGW_STD_THREADS_WITH_MEGANZ)
#else
#include <thread>
#endif // (STD_THREAD_NOT_SUPPORTED) #endif // (STD_THREAD_NOT_SUPPORTED)
#endif // NANA_STD_THREAD_HPP #endif // NANA_STD_THREAD_HPP

View File

@ -57,7 +57,7 @@ namespace nana
} }
date::date() date::date()
: value_(to_dateval(*std::localtime(nullptr))) : value_(to_dateval(localtime()))
{ {
} }

View File

@ -3436,6 +3436,9 @@ namespace nana
if (lister.forward(essence_->scroll.offset_y_dpl, ptr_where.second, item_pos)) if (lister.forward(essence_->scroll.offset_y_dpl, ptr_where.second, item_pos))
{ {
auto * item_ptr = (item_pos.is_item() ? &lister.at(item_pos) : nullptr); auto * item_ptr = (item_pos.is_item() ? &lister.at(item_pos) : nullptr);
const index_pair abs_item_pos{ item_pos.cat, lister.absolute(item_pos) };
if(ptr_where.first == parts::lister) if(ptr_where.first == parts::lister)
{ {
bool sel = true; bool sel = true;
@ -3444,28 +3447,32 @@ namespace nana
if (arg.shift) if (arg.shift)
lister.select_display_range(lister.last_selected_abs , item_pos, sel); lister.select_display_range(lister.last_selected_abs , item_pos, sel);
else if (arg.ctrl) else if (arg.ctrl)
sel = !item_proxy(essence_, index_pair (item_pos.cat, lister.absolute(item_pos))).selected(); sel = !item_proxy(essence_, abs_item_pos).selected();
else else
lister.select_for_all(false); //cancel all selections lister.select_for_all(false); //cancel all selections
} }
else else
sel = !item_proxy(essence_, index_pair (item_pos.cat, lister.absolute(item_pos))).selected(); {
//Clicking on a category is ignored when single selection is enabled.
//Fixed by Greentwip(issue #121)
if (item_ptr)
sel = !item_proxy(essence_, abs_item_pos).selected();
}
if(item_ptr) if(item_ptr)
{ {
item_ptr->flags.selected = sel; item_ptr->flags.selected = sel;
index_pair last_selected(item_pos.cat, lister.absolute(item_pos));
arg_listbox arg{item_proxy{essence_, last_selected}, sel}; arg_listbox arg{ item_proxy{ essence_, abs_item_pos }, sel };
lister.wd_ptr()->events().selected.emit(arg); lister.wd_ptr()->events().selected.emit(arg);
if (item_ptr->flags.selected) if (item_ptr->flags.selected)
{ {
lister.cancel_others_if_single_enabled(true, last_selected); lister.cancel_others_if_single_enabled(true, abs_item_pos);
essence_->lister.last_selected_abs = last_selected; essence_->lister.last_selected_abs = abs_item_pos;
} }
else if (essence_->lister.last_selected_abs == last_selected) else if (essence_->lister.last_selected_abs == abs_item_pos)
essence_->lister.last_selected_abs.set_both(npos); essence_->lister.last_selected_abs.set_both(npos);
} }
else if(!lister.single_selection()) else if(!lister.single_selection())
@ -3476,13 +3483,11 @@ namespace nana
if(item_ptr) if(item_ptr)
{ {
item_ptr->flags.checked = ! item_ptr->flags.checked; item_ptr->flags.checked = ! item_ptr->flags.checked;
arg_listbox arg{ item_proxy{ essence_, abs_item_pos }, item_ptr->flags.checked };
index_pair abs_pos{ item_pos.cat, lister.absolute(item_pos) };
arg_listbox arg{ item_proxy{ essence_, abs_pos }, item_ptr->flags.checked };
lister.wd_ptr()->events().checked.emit(arg); lister.wd_ptr()->events().checked.emit(arg);
if (item_ptr->flags.checked) if (item_ptr->flags.checked)
lister.cancel_others_if_single_enabled(false, abs_pos); lister.cancel_others_if_single_enabled(false, abs_item_pos);
} }
else if (! lister.single_check()) else if (! lister.single_check())
lister.categ_checked_reverse(item_pos.cat); lister.categ_checked_reverse(item_pos.cat);

View File

@ -13,8 +13,9 @@
#include <nana/gui/wvl.hpp> #include <nana/gui/wvl.hpp>
#include <nana/gui/detail/bedrock.hpp> #include <nana/gui/detail/bedrock.hpp>
#include <thread> #include <nana/std_thread.hpp>
#include <iostream> #include <iostream>
#include <chrono>
//#define NANA_AUTOMATIC_GUI_TESTING //#define NANA_AUTOMATIC_GUI_TESTING
namespace nana namespace nana

View File

@ -15,6 +15,7 @@
#include <nana/paint/graphics.hpp> #include <nana/paint/graphics.hpp>
#include <vector> #include <vector>
#include <cassert> #include <cassert>
#include <cstring>
#if defined(NANA_WINDOWS) #if defined(NANA_WINDOWS)
#include <windows.h> #include <windows.h>