summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-05-16 19:06:40 +0000
committeralberth <alberth@openttd.org>2010-05-16 19:06:40 +0000
commite49cb2d3200c24241e6253fd324040f7a55531ed (patch)
treeaa411f8d471990e70f917d195b8935bd006c56db /src
parent34ab8519b50fd014871322d90c35d6a5f6d47092 (diff)
downloadopenttd-e49cb2d3200c24241e6253fd324040f7a55531ed.tar.xz
(svn r19840) -Add: Add 'rescan' functionality to the NewGRF window.
Diffstat (limited to 'src')
-rw-r--r--src/newgrf_gui.cpp30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index 9d561da48..23d3a5034 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -514,6 +514,7 @@ enum ShowNewGRFStateWidgets {
SNGRFS_SET_PARAMETERS,
SNGRFS_TOGGLE_PALETTE,
SNGRFS_APPLY_CHANGES,
+ SNGRFS_RESCAN_FILES,
SNGRFS_CONTENT_DOWNLOAD,
};
@@ -953,6 +954,14 @@ struct NewGRFWindow : public QueryStringBaseWindow {
#endif
}
break;
+
+ case SNGRFS_RESCAN_FILES:
+ ScanNewGRFFiles();
+ this->avail_sel = NULL;
+ this->avail_pos = -1;
+ this->avails.ForceRebuild();
+ this->InvalidateData(1);
+ break;
}
}
@@ -1234,7 +1243,7 @@ static const NWidgetPart _nested_newgrf_widgets[] = {
EndContainer(),
NWidget(WWT_PANEL, COLOUR_MAUVE),
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),
+ NWidget(NWID_VERTICAL), SetPadding(WD_RESIZEBOX_WIDTH, 0, 0, 0),
/* Left side, presets. */
NWidget(NWID_HORIZONTAL),
NWidget(WWT_TEXT, COLOUR_MAUVE), SetDataTip(STR_NEWGRF_SETTINGS_SELECT_PRESET, STR_NULL),
@@ -1298,6 +1307,13 @@ static const NWidgetPart _nested_newgrf_widgets[] = {
EndContainer(),
NWidget(WWT_SCROLL2BAR, COLOUR_MAUVE, SNGRFS_SCROLL2BAR),
EndContainer(),
+ /* Left side, available grfs, buttons. */
+ NWidget(NWID_VERTICAL), SetPadding(2, 2, 2, 2),
+ NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, SNGRFS_RESCAN_FILES), SetFill(1, 0), SetResize(1, 0),
+ SetDataTip(STR_NEWGRF_ADD_RESCAN_FILES, STR_NEWGRF_ADD_RESCAN_FILES_TOOLTIP),
+ NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, SNGRFS_CONTENT_DOWNLOAD), SetFill(1, 0), SetResize(1, 0),
+ SetDataTip(STR_INTRO_ONLINE_CONTENT, STR_INTRO_TOOLTIP_ONLINE_CONTENT),
+ EndContainer(),
EndContainer(),
EndContainer(),
@@ -1318,15 +1334,13 @@ static const NWidgetPart _nested_newgrf_widgets[] = {
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(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_RESIZEBOX, COLOUR_MAUVE),
+ /* Resize button. */
+ NWidget(NWID_HORIZONTAL),
+ NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0),
+ NWidget(WWT_RESIZEBOX, COLOUR_MAUVE),
+ EndContainer(),
EndContainer(),
};