mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-28 22:03:40 -06:00
Fixed MultiList scrolling bug
git-svn-id: svn://ultimatepp.org/upp/trunk@323 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
850b64038b
commit
b87ea83029
1 changed files with 32 additions and 19 deletions
|
|
@ -499,13 +499,28 @@ void MultiList::SetSb()
|
|||
int rcnt = GetCount()/ncl;
|
||||
rcnt += (GetCount() % ncl) ? 1 : 0;
|
||||
sb.SetTotal(rcnt*cy);
|
||||
sb.SetPage((GetSize().cy-cy/2)/cy*cy + cy/4);
|
||||
sb.SetLine(cy/4);
|
||||
sb.SetPage((GetSize().cy/cy)*cy);
|
||||
sb.SetLine(cy);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MultiList::ScrollInto(int pos)
|
||||
{
|
||||
switch (mode) {
|
||||
case MODE_ROWS:
|
||||
sb.ScrollInto((pos / ncl) * cy, max(0, sb.GetLine() - (GetSize().cy - sb.GetPage())));
|
||||
return;
|
||||
case MODE_COLUMNS:
|
||||
sb.ScrollInto(pos / max(1, GetColumnItems()));
|
||||
return;
|
||||
case MODE_LIST:
|
||||
sb.ScrollInto(pos);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void MultiList::Layout()
|
||||
{
|
||||
if (mode == MODE_ROWS)
|
||||
|
|
@ -597,21 +612,6 @@ void MultiList::SetSbPos(int y)
|
|||
sb = minmax(y, 0, GetCount() - GetPageItems());
|
||||
}
|
||||
|
||||
void MultiList::ScrollInto(int pos)
|
||||
{
|
||||
switch (mode) {
|
||||
case MODE_ROWS:
|
||||
sb.ScrollInto(pos / ncl * cy + sb.GetLine());
|
||||
return;
|
||||
case MODE_COLUMNS:
|
||||
sb.ScrollInto(pos / max(1, GetColumnItems()));
|
||||
return;
|
||||
case MODE_LIST:
|
||||
sb.ScrollInto(pos);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void MultiList::KillCursor()
|
||||
{
|
||||
if(cursor < 0) return;
|
||||
|
|
@ -1010,8 +1010,21 @@ void MultiList::InsertDrop(int ii, PasteClip& d)
|
|||
|
||||
void MultiList::Serialize(Stream& s) {
|
||||
int version = 0;
|
||||
s / version;
|
||||
s / ncl;
|
||||
int cnt;
|
||||
s.Magic();
|
||||
s / version / ncl / cnt;
|
||||
if (s.IsLoading())
|
||||
item.SetCount(cnt);
|
||||
for (int i = 0; i < item.GetCount(); i++) {
|
||||
Item &q = item[i];
|
||||
s % q.key % q.value % q.canselect;
|
||||
if (s.IsLoading()) {
|
||||
q.display = NULL;
|
||||
q.sel = false;
|
||||
}
|
||||
}
|
||||
s.Magic();
|
||||
|
||||
Refresh();
|
||||
SyncInfo();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue