mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
CtrlLib: ArrayCtrl multiselect fix
git-svn-id: svn://ultimatepp.org/upp/trunk@13363 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
52a3c6c032
commit
7dea068f34
2 changed files with 23 additions and 20 deletions
|
|
@ -1432,11 +1432,14 @@ bool ArrayCtrl::SetCursor0(int i, bool dosel) {
|
|||
if(dosel && multiselect) {
|
||||
ClearSelection(false);
|
||||
anchor = cursor;
|
||||
Select(cursor, true, false);
|
||||
SelectOne(cursor, true, false);
|
||||
sel = true;
|
||||
}
|
||||
if(sel)
|
||||
if(sel) {
|
||||
selectiondirty = true;
|
||||
WhenSelection();
|
||||
WhenSel();
|
||||
}
|
||||
SyncInfo();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1496,7 +1499,7 @@ int ArrayCtrl::GetSelectCount() const
|
|||
return selectcount;
|
||||
}
|
||||
|
||||
void ArrayCtrl::Select(int i, bool sel, bool raise)
|
||||
void ArrayCtrl::SelectOne(int i, bool sel, bool raise)
|
||||
{
|
||||
array.At(i).select = sel;
|
||||
selectiondirty = true;
|
||||
|
|
@ -1508,6 +1511,18 @@ void ArrayCtrl::Select(int i, bool sel, bool raise)
|
|||
SyncInfo();
|
||||
}
|
||||
|
||||
void ArrayCtrl::Select(int i, int count, bool sel)
|
||||
{
|
||||
while(count--) {
|
||||
array.At(i).select = sel;
|
||||
RefreshRow(i++);
|
||||
}
|
||||
selectiondirty = true;
|
||||
WhenSelection();
|
||||
WhenSel();
|
||||
SyncInfo();
|
||||
}
|
||||
|
||||
void ArrayCtrl::EnableLine(int i, bool en)
|
||||
{
|
||||
array.At(i).enabled = en;
|
||||
|
|
@ -1538,18 +1553,6 @@ bool ArrayCtrl::IsLineVisible(int i) const
|
|||
return b;
|
||||
}
|
||||
|
||||
void ArrayCtrl::Select(int i, int count, bool sel)
|
||||
{
|
||||
while(count--) {
|
||||
array.At(i).select = sel;
|
||||
RefreshRow(i++);
|
||||
}
|
||||
selectiondirty = true;
|
||||
WhenSelection();
|
||||
WhenSel();
|
||||
SyncInfo();
|
||||
}
|
||||
|
||||
void ArrayCtrl::ClearSelection(bool raise)
|
||||
{
|
||||
if(IsSelection()) {
|
||||
|
|
@ -1661,7 +1664,7 @@ void ArrayCtrl::ClickSel(dword flags)
|
|||
{
|
||||
if(cursor >= 0 && multiselect) {
|
||||
if(flags & K_CTRL) {
|
||||
Select(cursor, !IsSelected(cursor), false);
|
||||
SelectOne(cursor, !IsSelected(cursor));
|
||||
anchor = cursor;
|
||||
}
|
||||
else {
|
||||
|
|
@ -1670,7 +1673,7 @@ void ArrayCtrl::ClickSel(dword flags)
|
|||
Select(min(anchor, cursor), abs(anchor - cursor) + 1, true);
|
||||
else {
|
||||
anchor = cursor;
|
||||
Select(cursor, true, false);
|
||||
SelectOne(cursor, true);
|
||||
}
|
||||
}
|
||||
Action();
|
||||
|
|
@ -1803,7 +1806,7 @@ void ArrayCtrl::RightDown(Point p, dword flags) {
|
|||
if(cursor >= 0 && multiselect) {
|
||||
if(!IsSelected(cursor)) {
|
||||
ClearSelection();
|
||||
Select(anchor = cursor);
|
||||
SelectOne(anchor = cursor);
|
||||
}
|
||||
Action();
|
||||
}
|
||||
|
|
@ -1858,7 +1861,7 @@ void ArrayCtrl::KeyMultiSelect(int aanchor, dword key)
|
|||
else
|
||||
if(cursor >= 0) {
|
||||
anchor = cursor;
|
||||
Select(anchor);
|
||||
SelectOne(anchor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue