Changeset - r17869:b0e51d26f3f0
[Not reviewed]
master
0 4 0
planetmaker - 13 years ago 2011-07-20 16:19:48
planetmaker@openttd.org
(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
4 files changed with 27 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -448,6 +448,7 @@ STR_ABOUT_MENU_ZOOMIN_SCREENSHOT        
 
STR_ABOUT_MENU_GIANT_SCREENSHOT                                 :Whole map screenshot
 
STR_ABOUT_MENU_ABOUT_OPENTTD                                    :About 'OpenTTD'
 
STR_ABOUT_MENU_SPRITE_ALIGNER                                   :Sprite aligner
 
STR_ABOUT_MENU_TOGGLE_BOUNDING_BOXES                            :Toggle bounding boxes
 
############ range ends here
 

	
 
############ range for days starts (also used for the place in the highscore window)
src/main_gui.cpp
Show inline comments
 
@@ -301,9 +301,7 @@ struct MainWindow : Window
 
				return ES_HANDLED;
 

	
 
			case GHK_BOUNDING_BOXES:
 
				extern bool _draw_bounding_boxes;
 
				_draw_bounding_boxes = !_draw_bounding_boxes;
 
				MarkWholeScreenDirty();
 
				ToggleBoundingBoxes();
 
				return ES_HANDLED;
 
		}
 

	
src/toolbar_gui.cpp
Show inline comments
 
@@ -828,7 +828,7 @@ static CallBackFunction PlaceLandBlockIn
 

	
 
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(in
 
		case 6: MenuClickWorldScreenshot();    break;
 
		case 7: ShowAboutWindow();             break;
 
		case 8: ShowSpriteAlignerWindow();     break;
 
		case 9: ToggleBoundingBoxes();         break;
 
	}
 
	return CBF_NONE;
 
}
src/toolbar_gui.h
Show inline comments
 
@@ -13,6 +13,7 @@
 
#define TOOLBAR_GUI_H
 

	
 
void AllocateToolbar();
 
void ToggleBoundingBoxes();
 

	
 
extern int16 *_preferred_toolbar_size;
 

	
0 comments (0 inline, 0 general)