(svn r20221) -Codechange: Move unscrolled row calculation into a function.

This commit is contained in:
alberth
2010-07-26 13:02:28 +00:00
parent 80cc566553
commit 3a1451644a
4 changed files with 20 additions and 4 deletions

View File

@@ -401,7 +401,7 @@ struct MusicTrackSelectionWindow : public Window {
{
switch (widget) {
case MTSW_LIST_LEFT: { // add to playlist
int y = (pt.y - this->GetWidget<NWidgetBase>(widget)->pos_y) / FONT_HEIGHT_SMALL;
int y = this->GetRowFromWidget(pt.y, widget, 0, FONT_HEIGHT_SMALL);
if (msf.playlist < 4) return;
if (!IsInsideMM(y, 0, BaseMusic::GetUsedSet()->num_available)) return;
@@ -425,7 +425,7 @@ struct MusicTrackSelectionWindow : public Window {
} break;
case MTSW_LIST_RIGHT: { // remove from playlist
int y = (pt.y - this->GetWidget<NWidgetBase>(widget)->pos_y) / FONT_HEIGHT_SMALL;
int y = this->GetRowFromWidget(pt.y, widget, 0, FONT_HEIGHT_SMALL);
if (msf.playlist < 4) return;
if (!IsInsideMM(y, 0, NUM_SONGS_PLAYLIST)) return;