mirror of
https://github.com/clangen/musikcube.git
synced 2024-11-19 11:10:52 +00:00
Fixed a bug in ListWindow() where setting the selected index would not
result in a repaint.
This commit is contained in:
parent
3123701db2
commit
3476c7b2ed
@ -127,12 +127,13 @@ void TrackListView::ScrollToPlaying() {
|
||||
DBID id = this->playing->Id();
|
||||
for (size_t i = 0; i < this->metadata->Count(); i++) {
|
||||
if (this->metadata->GetId(i) == id) {
|
||||
this->SetSelectedIndex(i);
|
||||
|
||||
auto pos = this->GetScrollPosition();
|
||||
size_t first = pos.firstVisibleEntryIndex;
|
||||
size_t last = first + pos.visibleEntryCount;
|
||||
if (i < first || i > last) {
|
||||
/* only scroll if the playing track is not visible. */
|
||||
this->SetSelectedIndex(i);
|
||||
this->ScrollTo(i);
|
||||
}
|
||||
break;
|
||||
|
@ -176,6 +176,12 @@ void ListWindow::SetSelectedIndex(size_t index) {
|
||||
if (this->selectedIndex != index) {
|
||||
size_t prev = this->selectedIndex;
|
||||
this->selectedIndex = index;
|
||||
|
||||
this->GetScrollAdapter().DrawPage(
|
||||
this, index, &this->GetScrollPosition());
|
||||
|
||||
this->Repaint();
|
||||
|
||||
this->OnSelectionChanged(index, prev); /* internal */
|
||||
this->SelectionChanged(this, index, prev); /* external */
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user