diff -r 864726d3157f src/settings_gui.cpp --- a/src/settings_gui.cpp Sun Nov 16 10:51:35 2008 +0100 +++ b/src/settings_gui.cpp Sun Nov 16 11:14:27 2008 +0100 @@ -615,6 +615,8 @@ byte num; ///< Number of entries on the page (statically filled). void Init(); + + void Draw(GameSettings *patches_ptr, int base_x, int base_y, uint first_row, uint max_row) const; }; /* == PatchEntry methods == */ @@ -716,6 +718,21 @@ entries[fld].Init(); } +/** + * Draw a selected part of the settings page + * @param patches_ptr Pointer to current values of all settings + * @param base_x Left-most position in window/panel to start drawing of each setting row + * @param base_y Upper-most position in window/panel to start drawing of row number \a first_row + * @param first_row Number of first row to draw + * @param max_row Row-number to stop drawing (the row-number of the row below the last row to draw) + */ +void PatchPage::Draw(GameSettings *patches_ptr, int base_x, int base_y, uint first_row, uint max_row) const +{ + for (uint i = first_row; i < num && i < max_row; i++) { + entries[i].Draw(patches_ptr, base_x, base_y); + base_y += SETTING_HEIGHT; + } +} static PatchEntry _patches_ui[] = { PatchEntry("gui.vehicle_speed"), @@ -917,15 +934,9 @@ { const PatchPage *page = &_patches_page[this->page]; - /* Set up selected category */ + /* Draw selected page */ this->DrawWidgets(); - - int x = SETTINGTREE_LEFT_OFFSET; - int y = SETTINGTREE_TOP_OFFSET; - for (uint i = vscroll.pos; i != page->num && i < vscroll.pos + vscroll.cap; i++) { - page->entries[i].Draw(patches_ptr, x, y); - y += SETTING_HEIGHT; - } + page->Draw(patches_ptr, SETTINGTREE_LEFT_OFFSET, SETTINGTREE_TOP_OFFSET, vscroll.pos, vscroll.pos + vscroll.cap); } virtual void OnClick(Point pt, int widget)