diff options
author | alberth <alberth@openttd.org> | 2010-05-16 18:41:59 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2010-05-16 18:41:59 +0000 |
commit | 22b868f4d5b1ef19ba79552e156eff8a2da8f55c (patch) | |
tree | dc64e2d4d0176a8c02c4aaf34f1261f989fee3d2 /src | |
parent | cf6e1165b5ebe6c3ba93fc5884187861a6298c8a (diff) | |
download | openttd-22b868f4d5b1ef19ba79552e156eff8a2da8f55c.tar.xz |
(svn r19833) -Change: Modify NewGRF window towards having combined lists, add captions.
Diffstat (limited to 'src')
-rw-r--r-- | src/lang/english.txt | 3 | ||||
-rw-r--r-- | src/newgrf_gui.cpp | 102 |
2 files changed, 81 insertions, 24 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt index 8941292c2..6041a3ab3 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -2321,6 +2321,9 @@ STR_GENERATION_PREPARING_GAME :{BLACK}Preparin # NewGRF settings STR_NEWGRF_SETTINGS_CAPTION :{WHITE}NewGRF Settings +STR_NEWGRF_SETTINGS_INFO_TITLE :{WHITE}Detailed NewGRF information +STR_NEWGRF_SETTINGS_ACTIVE_LIST :{WHITE}Active NewGRF files +STR_NEWGRF_SETTINGS_SELECT_PRESET :{ORANGE}Select preset: STR_NEWGRF_SETTINGS_PRESET_LIST_TOOLTIP :{BLACK}Load the selected preset STR_NEWGRF_SETTINGS_PRESET_SAVE :{BLACK}Save preset STR_NEWGRF_SETTINGS_PRESET_SAVE_TOOLTIP :{BLACK}Save the current list as a preset diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 4c5596add..f5f2809d0 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -506,6 +506,7 @@ enum ShowNewGRFStateWidgets { SNGRFS_MOVE_DOWN, SNGRFS_FILE_LIST, SNGRFS_SCROLLBAR, + SNGRFS_NEWGRF_INFO_TITLE, SNGRFS_NEWGRF_INFO, SNGRFS_SET_PARAMETERS, SNGRFS_TOGGLE_PALETTE, @@ -564,6 +565,13 @@ struct NewGRFWindow : public Window { size->height = max(size->height, 7 * resize->height); break; + case SNGRFS_NEWGRF_INFO_TITLE: { + Dimension dim = GetStringBoundingBox(STR_NEWGRF_SETTINGS_INFO_TITLE); + size->height = max(size->height, dim.height + WD_FRAMETEXT_TOP + WD_FRAMETEXT_BOTTOM); + size->width = max(size->width, dim.width + WD_FRAMETEXT_LEFT + WD_FRAMETEXT_RIGHT); + break; + } + case SNGRFS_NEWGRF_INFO: size->height = max(size->height, WD_FRAMERECT_TOP + 10 * FONT_HEIGHT_NORMAL + WD_FRAMERECT_BOTTOM + padding.height + 2); break; @@ -667,6 +675,12 @@ struct NewGRFWindow : public Window { } } break; + case SNGRFS_NEWGRF_INFO_TITLE: + /* Create the nice grayish rectangle at the details top. */ + GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, 157); + DrawString(r.left, r.right, (r.top + r.bottom - FONT_HEIGHT_NORMAL) / 2, STR_NEWGRF_SETTINGS_INFO_TITLE, TC_FROMSTRING, SA_CENTER); + break; + case SNGRFS_NEWGRF_INFO: if (this->active_sel != NULL) { ShowNewGRFInfo(this->active_sel, r.left + WD_FRAMERECT_LEFT, r.top + WD_FRAMERECT_TOP, r.right - WD_FRAMERECT_RIGHT, r.bottom - WD_FRAMERECT_BOTTOM, this->show_params); @@ -996,34 +1010,74 @@ static const NWidgetPart _nested_newgrf_widgets[] = { NWidget(WWT_CAPTION, COLOUR_MAUVE), SetDataTip(STR_NEWGRF_SETTINGS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), EndContainer(), NWidget(WWT_PANEL, COLOUR_MAUVE), - NWidget(NWID_HORIZONTAL), SetPadding(2, 10, 2, 10), - NWidget(WWT_DROPDOWN, COLOUR_YELLOW, SNGRFS_PRESET_LIST), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_JUST_STRING, STR_NEWGRF_SETTINGS_PRESET_LIST_TOOLTIP), - NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, SNGRFS_PRESET_SAVE), SetFill(1, 0), SetDataTip(STR_NEWGRF_SETTINGS_PRESET_SAVE, STR_NEWGRF_SETTINGS_PRESET_SAVE_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, SNGRFS_PRESET_DELETE), SetFill(1, 0), SetDataTip(STR_NEWGRF_SETTINGS_PRESET_DELETE, STR_NEWGRF_SETTINGS_PRESET_DELETE_TOOLTIP), + NWidget(NWID_HORIZONTAL), SetPIP(WD_RESIZEBOX_WIDTH, WD_RESIZEBOX_WIDTH, WD_RESIZEBOX_WIDTH), + NWidget(NWID_VERTICAL), SetPadding(WD_RESIZEBOX_WIDTH, 0, WD_RESIZEBOX_WIDTH, 0), + /* Left side, presets. */ + NWidget(NWID_HORIZONTAL), + NWidget(WWT_TEXT, COLOUR_MAUVE), SetDataTip(STR_NEWGRF_SETTINGS_SELECT_PRESET, STR_NULL), + SetPadding(0, WD_FRAMETEXT_RIGHT, 0, 0), + NWidget(WWT_DROPDOWN, COLOUR_YELLOW, SNGRFS_PRESET_LIST), SetFill(1, 0), SetResize(1, 0), + SetDataTip(STR_JUST_STRING, STR_NEWGRF_SETTINGS_PRESET_LIST_TOOLTIP), + EndContainer(), + NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), + NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, SNGRFS_PRESET_SAVE), SetFill(1, 0), SetResize(1, 0), + SetDataTip(STR_NEWGRF_SETTINGS_PRESET_SAVE, STR_NEWGRF_SETTINGS_PRESET_SAVE_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, SNGRFS_PRESET_DELETE), SetFill(1, 0), SetResize(1, 0), + SetDataTip(STR_NEWGRF_SETTINGS_PRESET_DELETE, STR_NEWGRF_SETTINGS_PRESET_DELETE_TOOLTIP), + EndContainer(), + + NWidget(NWID_SPACER), SetMinimalSize(0, WD_RESIZEBOX_WIDTH), SetResize(1, 0), + NWidget(WWT_PANEL, COLOUR_MAUVE), + NWidget(WWT_LABEL, COLOUR_MAUVE), SetDataTip(STR_NEWGRF_SETTINGS_ACTIVE_LIST, STR_NULL), + SetFill(1, 0), SetResize(1, 0), SetPadding(3, WD_FRAMETEXT_RIGHT, 0, WD_FRAMETEXT_LEFT), + /* Left side, active grfs. */ + NWidget(NWID_HORIZONTAL), SetPadding(0, 2, 0, 2), + NWidget(WWT_MATRIX, COLOUR_MAUVE, SNGRFS_FILE_LIST), SetFill(1, 0), SetResize(1, 0), + SetDataTip(0x501, STR_NEWGRF_SETTINGS_FILE_TOOLTIP), + NWidget(WWT_SCROLLBAR, COLOUR_MAUVE, SNGRFS_SCROLLBAR), + EndContainer(), + NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPadding(2, 2, 2, 2), SetPIP(0, WD_RESIZEBOX_WIDTH, 0), + NWidget(NWID_VERTICAL), + NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, SNGRFS_ADD), SetFill(1, 0), SetResize(1, 0), + SetDataTip(STR_NEWGRF_SETTINGS_ADD, STR_NEWGRF_SETTINGS_ADD_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, SNGRFS_REMOVE), SetFill(1, 0), SetResize(1, 0), + SetDataTip(STR_NEWGRF_SETTINGS_REMOVE, STR_NEWGRF_SETTINGS_REMOVE_TOOLTIP), + EndContainer(), + NWidget(NWID_VERTICAL), + NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, SNGRFS_MOVE_UP), SetFill(1, 0), SetResize(1, 0), + SetDataTip(STR_NEWGRF_SETTINGS_MOVEUP, STR_NEWGRF_SETTINGS_MOVEUP_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, SNGRFS_MOVE_DOWN), SetFill(1, 0), SetResize(1, 0), + SetDataTip(STR_NEWGRF_SETTINGS_MOVEDOWN, STR_NEWGRF_SETTINGS_MOVEDOWN_TOOLTIP), + EndContainer(), + EndContainer(), + EndContainer(), + EndContainer(), + + NWidget(NWID_VERTICAL), + /* Right side, info panel. */ + NWidget(WWT_PANEL, COLOUR_MAUVE), SetPadding(WD_RESIZEBOX_WIDTH, 0, 2, 0), + NWidget(WWT_EMPTY, COLOUR_MAUVE, SNGRFS_NEWGRF_INFO_TITLE), SetFill(1, 0), SetResize(1, 0), + NWidget(WWT_EMPTY, COLOUR_MAUVE, SNGRFS_NEWGRF_INFO), SetFill(1, 1), SetResize(1, 1), SetMinimalSize(150, 100), + EndContainer(), + /* Right side, buttons. */ + NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(0, WD_RESIZEBOX_WIDTH, 0), + NWidget(NWID_VERTICAL), + NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, SNGRFS_SET_PARAMETERS), SetFill(1, 0), SetResize(1, 0), + SetDataTip(STR_NEWGRF_SETTINGS_SET_PARAMETERS, STR_NULL), + NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, SNGRFS_TOGGLE_PALETTE), SetFill(1, 0), SetResize(1, 0), + SetDataTip(STR_NEWGRF_SETTINGS_TOGGLE_PALETTE, STR_NEWGRF_SETTINGS_TOGGLE_PALETTE_TOOLTIP), + EndContainer(), + NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, SNGRFS_APPLY_CHANGES), SetFill(1, 0), SetResize(1, 0), + SetDataTip(STR_NEWGRF_SETTINGS_APPLY_CHANGES, STR_NULL), + EndContainer(), + + NWidget(NWID_SPACER), SetMinimalSize(0, WD_RESIZEBOX_WIDTH), SetResize(1, 0), EndContainer(), EndContainer(), EndContainer(), - NWidget(WWT_PANEL, COLOUR_MAUVE), - NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPadding(2, 10, 2, 10), - NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, SNGRFS_ADD), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_NEWGRF_SETTINGS_ADD, STR_NEWGRF_SETTINGS_ADD_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, SNGRFS_REMOVE), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_NEWGRF_SETTINGS_REMOVE, STR_NEWGRF_SETTINGS_REMOVE_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, SNGRFS_MOVE_UP), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_NEWGRF_SETTINGS_MOVEUP, STR_NEWGRF_SETTINGS_MOVEUP_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, SNGRFS_MOVE_DOWN), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_NEWGRF_SETTINGS_MOVEDOWN, STR_NEWGRF_SETTINGS_MOVEDOWN_TOOLTIP), - EndContainer(), - EndContainer(), - NWidget(NWID_HORIZONTAL), - NWidget(WWT_MATRIX, COLOUR_MAUVE, SNGRFS_FILE_LIST), SetFill(1, 0), SetDataTip(0x501, STR_NEWGRF_SETTINGS_FILE_TOOLTIP), SetResize(1, 0), - NWidget(WWT_SCROLLBAR, COLOUR_MAUVE, SNGRFS_SCROLLBAR), - EndContainer(), - NWidget(WWT_PANEL, COLOUR_MAUVE, SNGRFS_NEWGRF_INFO), SetFill(1, 0), SetResize(1, 0), EndContainer(), - NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, SNGRFS_SET_PARAMETERS), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_NEWGRF_SETTINGS_SET_PARAMETERS, STR_NULL), - NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, SNGRFS_TOGGLE_PALETTE), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_NEWGRF_SETTINGS_TOGGLE_PALETTE, STR_NEWGRF_SETTINGS_TOGGLE_PALETTE_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, SNGRFS_APPLY_CHANGES), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_NEWGRF_SETTINGS_APPLY_CHANGES, STR_NULL), - EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, SNGRFS_CONTENT_DOWNLOAD), SetFill(1, 0), SetResize(1, 0), SetDataTip(STR_INTRO_ONLINE_CONTENT, STR_INTRO_TOOLTIP_ONLINE_CONTENT), + NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, SNGRFS_CONTENT_DOWNLOAD), SetFill(1, 0), SetResize(1, 0), + SetDataTip(STR_INTRO_ONLINE_CONTENT, STR_INTRO_TOOLTIP_ONLINE_CONTENT), NWidget(WWT_RESIZEBOX, COLOUR_MAUVE), EndContainer(), }; |