FIX: select range of items with shift and mouse when list is ordered

This commit is contained in:
qPCR4vir 2015-03-22 02:57:50 +01:00
parent 835b3ce145
commit bde6015d73

View File

@ -1181,6 +1181,21 @@ namespace nana
if (to.is_item()) if (to.is_item())
item_proxy(ess_, to).select(sel); item_proxy(ess_, to).select(sel);
} }
void select_display_range(index_pair fr_abs, index_pair to_dpl, bool sel)
{
index_pair fr_dpl (fr_abs.cat, this->display_order(fr_abs.cat, fr_abs.item));
if (fr_dpl > to_dpl)
std::swap(fr_dpl, to_dpl);
for (; fr_dpl != to_dpl; forward(fr_dpl, 1, fr_dpl))
{
if (fr_dpl.is_item())
item_proxy(ess_, index_pair(fr_dpl.cat, absolute( fr_dpl ) )).select(sel);
}
if (to_dpl.is_item())
item_proxy(ess_, index_pair(to_dpl.cat, absolute( to_dpl ) )).select(sel);
}
bool select_for_all(bool sel) bool select_for_all(bool sel)
{ {
@ -2609,7 +2624,7 @@ namespace nana
graph->set_color(bgcolor); graph->set_color(bgcolor);
graph->rectangle(rectangle{ r.x, y, show_w, essence_->item_size }, true); graph->rectangle(rectangle{ r.x, y, show_w, essence_->item_size }, true);
int item_xpos = x; int item_xpos = x;
unsigned extreme_text = x; unsigned extreme_text = x;
bool first = true; bool first = true;
@ -2926,7 +2941,7 @@ namespace nana
if (!lister.single_selection()) if (!lister.single_selection())
{ {
if (arg.shift) if (arg.shift)
lister.select_range(lister.last_selected, item_pos, sel); lister.select_display_range(lister.last_selected, item_pos, sel);
else if (arg.ctrl) else if (arg.ctrl)
sel = !item_proxy(essence_, item_pos).selected(); sel = !item_proxy(essence_, item_pos).selected();
else else