Add: Debug tool to draw widget outlines. (#11401)
This is considered a developer tool and is controlled from the help menu (or default hotkey Ctrl-O). This draws a white dashed outline around widgets. NWidgetSpacer and (unused) WWT_EMPTY widgets are also filled with check pattern to highlight them, as they usually indicate a design issue.
This commit is contained in:
@@ -1100,7 +1100,7 @@ static CallBackFunction PlaceLandBlockInfo()
|
||||
|
||||
static CallBackFunction ToolbarHelpClick(Window *w)
|
||||
{
|
||||
PopupMainToolbMenu(w, _game_mode == GM_EDITOR ? (int)WID_TE_HELP : (int)WID_TN_HELP, STR_ABOUT_MENU_LAND_BLOCK_INFO, _settings_client.gui.newgrf_developer_tools ? 11 : 8);
|
||||
PopupMainToolbMenu(w, _game_mode == GM_EDITOR ? (int)WID_TE_HELP : (int)WID_TN_HELP, STR_ABOUT_MENU_LAND_BLOCK_INFO, _settings_client.gui.newgrf_developer_tools ? 12 : 8);
|
||||
return CBF_NONE;
|
||||
}
|
||||
|
||||
@@ -1138,6 +1138,20 @@ void ToggleDirtyBlocks()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle drawing of widget outlihes.
|
||||
* @note has only an effect when newgrf_developer_tools are active.
|
||||
*/
|
||||
void ToggleWidgetOutlines()
|
||||
{
|
||||
extern bool _draw_widget_outlines;
|
||||
/* Always allow to toggle them off */
|
||||
if (_settings_client.gui.newgrf_developer_tools || _draw_widget_outlines) {
|
||||
_draw_widget_outlines = !_draw_widget_outlines;
|
||||
MarkWholeScreenDirty();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the starting year for a scenario.
|
||||
* @param year New starting year.
|
||||
@@ -1169,6 +1183,7 @@ static CallBackFunction MenuClickHelp(int index)
|
||||
case 8: ShowSpriteAlignerWindow(); break;
|
||||
case 9: ToggleBoundingBoxes(); break;
|
||||
case 10: ToggleDirtyBlocks(); break;
|
||||
case 11: ToggleWidgetOutlines(); break;
|
||||
}
|
||||
return CBF_NONE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user