summaryrefslogtreecommitdiff
path: root/src/toolbar_gui.cpp
diff options
context:
space:
mode:
authorplanetmaker <planetmaker@openttd.org>2011-07-20 16:19:48 +0000
committerplanetmaker <planetmaker@openttd.org>2011-07-20 16:19:48 +0000
commit3045c3fd2a84290abfc8c1510cd0a24aa7ce38b0 (patch)
treefaed26decb8171d7e54e213f3e3c3f36ffe653b2 /src/toolbar_gui.cpp
parenta70c37e4c9b80872b9fca1fb5707743854198ecf (diff)
downloadopenttd-3045c3fd2a84290abfc8c1510cd0a24aa7ce38b0.tar.xz
(svn r22675) -Change: Add a menu entry for the sprite bounding box debuging feature in the help menu and enable bounding boxes only in conjunction with the newgrf developer tools
Diffstat (limited to 'src/toolbar_gui.cpp')
-rw-r--r--src/toolbar_gui.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp
index e879114d2..dc1658108 100644
--- a/src/toolbar_gui.cpp
+++ b/src/toolbar_gui.cpp
@@ -828,7 +828,7 @@ static CallBackFunction PlaceLandBlockInfo()
static CallBackFunction ToolbarHelpClick(Window *w)
{
- PopupMainToolbMenu(w, TBN_HELP, STR_ABOUT_MENU_LAND_BLOCK_INFO, _settings_client.gui.newgrf_developer_tools ? 9 : 8);
+ PopupMainToolbMenu(w, TBN_HELP, STR_ABOUT_MENU_LAND_BLOCK_INFO, _settings_client.gui.newgrf_developer_tools ? 10 : 8);
return CBF_NONE;
}
@@ -847,6 +847,28 @@ static void MenuClickWorldScreenshot()
MakeScreenshot(SC_WORLD, NULL);
}
+/**
+ * Toggle drawing of sprites' bounding boxes
+ * @note has only an effect when newgrf_developer_tools are active
+ *
+ * Function is found here and not in viewport.cpp in order to avoid
+ * importing the settings structs to there
+ */
+void ToggleBoundingBoxes()
+{
+ extern bool _draw_bounding_boxes;
+ /* Always allow to toggle them off */
+ if (_settings_client.gui.newgrf_developer_tools || _draw_bounding_boxes) {
+ _draw_bounding_boxes = !_draw_bounding_boxes;
+ MarkWholeScreenDirty();
+ }
+}
+
+/**
+ * Choose the proper callback function for the main toolbar's help menu
+ * @param index The menu index which was selected
+ * @return CBF_NONE
+ */
static CallBackFunction MenuClickHelp(int index)
{
switch (index) {
@@ -858,6 +880,7 @@ static CallBackFunction MenuClickHelp(int index)
case 6: MenuClickWorldScreenshot(); break;
case 7: ShowAboutWindow(); break;
case 8: ShowSpriteAlignerWindow(); break;
+ case 9: ToggleBoundingBoxes(); break;
}
return CBF_NONE;
}