editor: Implement a Show Tool Information toggle option
This allows permanently hiding the obnoxious help text tooltip that constantly dances between the top and bottom of the screen depending on what you're doing in the editor. Icons provided by babaissarkar.
This commit is contained in:
parent
e6dd32b8e8
commit
e6a4bbf2f3
14 changed files with 74 additions and 2 deletions
|
@ -79,7 +79,7 @@
|
|||
id=menu-editor-map
|
||||
title= _ "Map"
|
||||
image=button_menu/menu_button_copper_H20
|
||||
items=editor-map-resize,editor-map-generate,editor-map-apply-mask,editor-map-create-mask-to,menu-editor-transitions,editor-refresh,editor-refresh-image-cache,togglegrid,editor-draw-coordinates,editor-draw-terrain-codes,editor-draw-num-of-bitmaps
|
||||
items=editor-map-resize,editor-map-generate,editor-map-apply-mask,editor-map-create-mask-to,editor-help-text-shown,menu-editor-transitions,editor-refresh,editor-refresh-image-cache,togglegrid,editor-draw-coordinates,editor-draw-terrain-codes,editor-draw-num-of-bitmaps
|
||||
rect="+0,=,+100,+20"
|
||||
xanchor=fixed
|
||||
yanchor=fixed
|
||||
|
@ -445,6 +445,22 @@
|
|||
xanchor=fixed
|
||||
yanchor=fixed
|
||||
[/panel]
|
||||
[action]
|
||||
id=toggle_help_text_editor
|
||||
items=editor-help-text-shown
|
||||
type=checkbox
|
||||
image=button_square/button_square_30
|
||||
tooltip_name_prepend=yes
|
||||
rect="=-31,=,+30,+30"
|
||||
xanchor=right
|
||||
yanchor=fixed
|
||||
[/action]
|
||||
[panel]
|
||||
id=top_separator4
|
||||
rect="=-11,=,+10,+27"
|
||||
xanchor=fixed
|
||||
yanchor=fixed
|
||||
[/panel]
|
||||
[menu]
|
||||
id=switch_time
|
||||
items=editor-switch-time, menu-editor-schedule, editor-custom-tods
|
||||
|
|
BIN
images/icons/action/editor-help-text-shown_25-active.png
Normal file
BIN
images/icons/action/editor-help-text-shown_25-active.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 832 B |
BIN
images/icons/action/editor-help-text-shown_25-pressed.png
Normal file
BIN
images/icons/action/editor-help-text-shown_25-pressed.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 830 B |
BIN
images/icons/action/editor-help-text-shown_25.png
Normal file
BIN
images/icons/action/editor-help-text-shown_25.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 814 B |
BIN
images/icons/action/editor-help-text-shown_30-active.png
Normal file
BIN
images/icons/action/editor-help-text-shown_30-active.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1,017 B |
BIN
images/icons/action/editor-help-text-shown_30-pressed.png
Normal file
BIN
images/icons/action/editor-help-text-shown_30-pressed.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 976 B |
BIN
images/icons/action/editor-help-text-shown_30.png
Normal file
BIN
images/icons/action/editor-help-text-shown_30.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 954 B |
|
@ -109,6 +109,7 @@ void editor_controller::init_gui()
|
|||
gui().set_debug_flag(display::DEBUG_COORDINATES, preferences::editor::draw_hex_coordinates());
|
||||
gui().set_debug_flag(display::DEBUG_TERRAIN_CODES, preferences::editor::draw_terrain_codes());
|
||||
gui().set_debug_flag(display::DEBUG_NUM_BITMAPS, preferences::editor::draw_num_of_bitmaps());
|
||||
gui().set_help_string_enabled(preferences::editor::help_text_shown());
|
||||
// halo_manager_.reset(new halo::manager(*gui_));
|
||||
// resources::halo = halo_manager_.get();
|
||||
// ^ These lines no longer necessary, the gui owns its halo manager.
|
||||
|
@ -499,6 +500,7 @@ bool editor_controller::can_execute_command(const hotkey::ui_command& cmd) const
|
|||
case HOTKEY_EDITOR_PARTIAL_UPDATE_TRANSITIONS:
|
||||
case HOTKEY_EDITOR_NO_UPDATE_TRANSITIONS:
|
||||
case HOTKEY_EDITOR_REFRESH_IMAGE_CACHE:
|
||||
case HOTKEY_EDITOR_HELP_TEXT_SHOWN:
|
||||
case HOTKEY_MINIMAP_CODING_TERRAIN:
|
||||
case HOTKEY_MINIMAP_CODING_UNIT:
|
||||
case HOTKEY_MINIMAP_DRAW_UNITS:
|
||||
|
@ -585,7 +587,8 @@ hotkey::ACTION_STATE editor_controller::get_action_state(const hotkey::ui_comman
|
|||
return gui_->debug_flag_set(display::DEBUG_TERRAIN_CODES) ? ACTION_ON : ACTION_OFF;
|
||||
case HOTKEY_EDITOR_DRAW_NUM_OF_BITMAPS:
|
||||
return gui_->debug_flag_set(display::DEBUG_NUM_BITMAPS) ? ACTION_ON : ACTION_OFF;
|
||||
|
||||
case HOTKEY_EDITOR_HELP_TEXT_SHOWN:
|
||||
return gui_->help_string_enabled() ? ACTION_ON : ACTION_OFF;
|
||||
case HOTKEY_MINIMAP_DRAW_VILLAGES:
|
||||
return (preferences::minimap_draw_villages()) ? ACTION_ON : ACTION_OFF;
|
||||
case HOTKEY_MINIMAP_CODING_UNIT:
|
||||
|
@ -1094,6 +1097,10 @@ bool editor_controller::do_execute_command(const hotkey::ui_command& cmd, bool p
|
|||
preferences::editor::set_draw_num_of_bitmaps(gui().debug_flag_set(display::DEBUG_NUM_BITMAPS));
|
||||
gui().invalidate_all();
|
||||
return true;
|
||||
case HOTKEY_EDITOR_HELP_TEXT_SHOWN:
|
||||
gui().set_help_string_enabled(!gui().help_string_enabled());
|
||||
preferences::editor::set_help_text_shown(gui().help_string_enabled());
|
||||
return true;
|
||||
case HOTKEY_EDITOR_REMOVE_LOCATION: {
|
||||
location_palette* lp = dynamic_cast<location_palette*>(&toolkit_->get_palette_manager()->active_palette());
|
||||
if (lp) {
|
||||
|
|
|
@ -159,6 +159,17 @@ display::overlay_map& editor_display::get_overlays()
|
|||
return controller_.get_current_map_context().get_overlays();
|
||||
}
|
||||
|
||||
void editor_display::set_help_string_enabled(bool value)
|
||||
{
|
||||
help_string_enabled_ = value;
|
||||
|
||||
if (!value) {
|
||||
clear_help_string();
|
||||
} else if (!help_string_.empty()) {
|
||||
set_help_string(help_string_);
|
||||
}
|
||||
}
|
||||
|
||||
void editor_display::clear_help_string()
|
||||
{
|
||||
font::remove_floating_label(help_handle_);
|
||||
|
@ -167,8 +178,16 @@ void editor_display::clear_help_string()
|
|||
|
||||
void editor_display::set_help_string(const std::string& str)
|
||||
{
|
||||
// Always update the internal string so we can toggle its visibility back
|
||||
// at any time without having to ask the current editor_palette.
|
||||
help_string_ = str;
|
||||
|
||||
clear_help_string();
|
||||
|
||||
if (!help_string_enabled_ || help_string_.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const color_t color{0, 0, 0, 0xbb};
|
||||
|
||||
int size = font::SIZE_LARGE;
|
||||
|
|
|
@ -71,6 +71,15 @@ public:
|
|||
/** Removes the help string. */
|
||||
void clear_help_string();
|
||||
|
||||
/** Returns whether the help text is currently shown. */
|
||||
bool help_string_enabled() const
|
||||
{
|
||||
return help_string_enabled_;
|
||||
}
|
||||
|
||||
/** Sets whether the help text should be shown. */
|
||||
void set_help_string_enabled(bool value);
|
||||
|
||||
protected:
|
||||
void draw_hex(const map_location& loc) override;
|
||||
|
||||
|
@ -95,6 +104,12 @@ private:
|
|||
* northern hexes in the map area, false if it's over the southern hexes instead.
|
||||
*/
|
||||
bool help_string_at_top_ = false;
|
||||
|
||||
/** Whether the help text is currently shown. */
|
||||
bool help_string_enabled_ = true;
|
||||
|
||||
/** Current help string, cached for easy visibility toggling. */
|
||||
std::string help_string_;
|
||||
};
|
||||
|
||||
} //end namespace editor
|
||||
|
|
|
@ -212,6 +212,8 @@ constexpr std::array<hotkey_command_temp, HOTKEY_NULL - 1> master_hotkey_list {{
|
|||
{ HOTKEY_EDITOR_UNIT_TOGGLE_LOYAL, "editor-unit-toggle-loyal", N_("Loyal"), false, scope_editor, HKCAT_TOOLS, "" },
|
||||
{ HOTKEY_EDITOR_UNIT_FACING, "menu-unit-facing", "", true, scope_editor, HKCAT_PLACEHOLDER, "" },
|
||||
|
||||
{ HOTKEY_EDITOR_HELP_TEXT_SHOWN, "editor-help-text-shown", N_("Show Tool Information"), false, scope_editor, HKCAT_TOOLS, "" },
|
||||
|
||||
{ HOTKEY_MINIMAP_CODING_UNIT, "minimap-unit-coding", N_("Toggle Minimap Unit Coding"), false, scope_game | scope_editor, HKCAT_MAP, "" },
|
||||
{ HOTKEY_MINIMAP_CODING_TERRAIN, "minimap-terrain-coding", N_("Toggle Minimap Terrain Coding"), false, scope_game | scope_editor, HKCAT_MAP, "" },
|
||||
|
||||
|
|
|
@ -133,6 +133,8 @@ enum HOTKEY_COMMAND {
|
|||
HOTKEY_EDITOR_LOCAL_TIME,
|
||||
HOTKEY_EDITOR_UNIT_FACING,
|
||||
|
||||
HOTKEY_EDITOR_HELP_TEXT_SHOWN,
|
||||
|
||||
// Unit
|
||||
HOTKEY_EDITOR_UNIT_TOGGLE_CANRECRUIT, HOTKEY_EDITOR_UNIT_TOGGLE_RENAMEABLE,
|
||||
HOTKEY_EDITOR_UNIT_CHANGE_ID, HOTKEY_EDITOR_UNIT_TOGGLE_LOYAL,
|
||||
|
|
|
@ -58,6 +58,14 @@ namespace editor {
|
|||
preferences::set("editor_draw_num_of_bitmaps", value);
|
||||
}
|
||||
|
||||
bool help_text_shown() {
|
||||
return preferences::get("editor_help_text_shown", true);
|
||||
}
|
||||
|
||||
void set_help_text_shown(bool value) {
|
||||
preferences::set("editor_help_text_shown", value);
|
||||
}
|
||||
|
||||
namespace {
|
||||
std::size_t editor_mru_limit()
|
||||
{
|
||||
|
|
|
@ -45,6 +45,9 @@ namespace editor {
|
|||
bool draw_num_of_bitmaps();
|
||||
void set_draw_num_of_bitmaps(bool value);
|
||||
|
||||
bool help_text_shown();
|
||||
void set_help_text_shown(bool value);
|
||||
|
||||
/** Retrieves the list of recently opened files. */
|
||||
std::vector<std::string> recent_files();
|
||||
/** Adds an entry to the recent files list. */
|
||||
|
|
Loading…
Add table
Reference in a new issue