Merge pull request #8861

This commit is contained in:
Iris Morelle 2024-08-06 21:14:47 -04:00
commit 8a54d10fe8
No known key found for this signature in database
GPG key ID: BB9666228F278524
17 changed files with 84 additions and 2 deletions

View file

@ -0,0 +1,2 @@
### Editor
* Added Show Tool Information toggle option in the menus and toolbar to allow hiding the informational tooltip on the edge of the screen that shows the current editor tool's usage and palette information

View file

@ -17564,6 +17564,12 @@ Date,File,License,Author - Real Name(other name);Real Name(other name);etc,Notes
2013/04/29,images/icons/action/editor-draw-terrain-codes_30-active.png,GNU GPL v2+,Emilien Rotival(LordBob),,,324bc3aa8af556d137d7a3051240026a
2013/04/29,images/icons/action/editor-draw-terrain-codes_30-pressed.png,GNU GPL v2+,Emilien Rotival(LordBob),,,6c0e878e65cde4086681d2349ee8c942
2013/04/29,images/icons/action/editor-draw-terrain-codes_30.png,GNU GPL v2+,Emilien Rotival(LordBob),,,2ee66dbc7482f411c163920ec89fa1bc
2024/05/07,images/icons/action/editor-help-text-shown_25-active.png,GNU GPL v2+,Subhraman Sarkar(babaissarkar),,,f993763bb3688c1335574aada7241d55
2024/05/07,images/icons/action/editor-help-text-shown_25-pressed.png,GNU GPL v2+,Subhraman Sarkar(babaissarkar),,,fbdff4755b938f20ce0e432760049a3f
2024/05/07,images/icons/action/editor-help-text-shown_25.png,GNU GPL v2+,Subhraman Sarkar(babaissarkar),,,eac26eabc031c44a7907c07479623aa9
2024/05/07,images/icons/action/editor-help-text-shown_30-active.png,GNU GPL v2+,Subhraman Sarkar(babaissarkar),,,ecf77f14b657e34f7a6a231aa06d40d0
2024/05/07,images/icons/action/editor-help-text-shown_30-pressed.png,GNU GPL v2+,Subhraman Sarkar(babaissarkar),,,8b00a2cc52e8b2d12bd4b52ee44792c0
2024/05/07,images/icons/action/editor-help-text-shown_30.png,GNU GPL v2+,Subhraman Sarkar(babaissarkar),,,59eb378d046b4b01165c083d0574e02e
2013/04/29,images/icons/action/editor-map-flip_25-active.png,GNU GPL v2+,Emilien Rotival(LordBob),,,e47f95f26109060428575ce27b422623
2013/04/29,images/icons/action/editor-map-flip_25-pressed.png,GNU GPL v2+,Emilien Rotival(LordBob),,,17a549a9c3bad71f593bf0f4be297f30
2013/04/29,images/icons/action/editor-map-flip_25.png,GNU GPL v2+,Emilien Rotival(LordBob),,,6ddd79b611141def85b91826933f4ab8

Can't render this file because it is too large.

View file

@ -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
@ -455,6 +455,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

Binary file not shown.

After

Width:  |  Height:  |  Size: 832 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 830 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 814 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,017 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 976 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 954 B

View file

@ -107,6 +107,7 @@ void editor_controller::init_gui()
gui().set_debug_flag(display::DEBUG_COORDINATES, prefs::get().editor_draw_hex_coordinates());
gui().set_debug_flag(display::DEBUG_TERRAIN_CODES, prefs::get().editor_draw_terrain_codes());
gui().set_debug_flag(display::DEBUG_NUM_BITMAPS, prefs::get().editor_draw_num_of_bitmaps());
gui().set_help_string_enabled(prefs::get().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.
@ -514,6 +515,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:
@ -600,7 +602,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 (prefs::get().minimap_draw_villages()) ? ACTION_ON : ACTION_OFF;
case HOTKEY_MINIMAP_CODING_UNIT:
@ -1132,6 +1135,10 @@ bool editor_controller::do_execute_command(const hotkey::ui_command& cmd, bool p
prefs::get().set_editor_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());
prefs::get().set_editor_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) {

View file

@ -157,6 +157,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_);
@ -165,8 +176,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;

View file

@ -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

View file

@ -215,6 +215,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, "" },

View file

@ -132,6 +132,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,

View file

@ -1569,6 +1569,14 @@ void prefs::set_editor_draw_num_of_bitmaps(bool value) {
preferences_[prefs_list::editor_draw_num_of_bitmaps] = value;
}
bool prefs::editor_help_text_shown() {
return preferences_[prefs_list::editor_help_text_shown].to_bool(true);
}
void prefs::set_editor_help_text_shown(bool value) {
preferences_[prefs_list::editor_help_text_shown] = value;
}
std::size_t prefs::editor_mru_limit()
{
return std::max(std::size_t(1), preferences_[prefs_list::editor_max_recent_files].to_size_t(10));

View file

@ -499,6 +499,9 @@ class prefs
bool editor_draw_num_of_bitmaps();
void set_editor_draw_num_of_bitmaps(bool value);
bool editor_help_text_shown();
void set_editor_help_text_shown(bool value);
std::size_t editor_mru_limit();
std::vector<std::string> do_read_editor_mru();
void do_commit_editor_mru(const std::vector<std::string>& mru);

View file

@ -89,6 +89,8 @@ struct preferences_list_defines
static constexpr const char* const editor_draw_terrain_codes = "editor_draw_terrain_codes";
/** list of recently accessed files in the editor */
static constexpr const char* const editor_recent_files = "editor_recent_files";
/** whether to display the active tool information help text at the bottom/top of the editor */
static constexpr const char* const editor_help_text_shown = "editor_help_text_shown";
/** whether to automatically start in planning mode in-game */
static constexpr const char* const enable_planning_mode_on_start = "enable_planning_mode_on_start";
/** list of terrain seen so far */