diff --git a/doc/classes/BaseButton.xml b/doc/classes/BaseButton.xml index 3812b45b139..bf4d9383ace 100644 --- a/doc/classes/BaseButton.xml +++ b/doc/classes/BaseButton.xml @@ -65,8 +65,8 @@ If [code]true[/code], the button's state is pressed. Means the button is pressed down or toggled (if [member toggle_mode] is active). - - [ShortCut] associated to the button. + + [Shortcut] associated to the button. If [code]true[/code], the button will add information about its shortcut in the tooltip. diff --git a/doc/classes/PopupMenu.xml b/doc/classes/PopupMenu.xml index 2af0f500a0e..b1ec9a222a4 100644 --- a/doc/classes/PopupMenu.xml +++ b/doc/classes/PopupMenu.xml @@ -29,14 +29,14 @@ - + - Adds a new checkable item and assigns the specified [ShortCut] to it. Sets the label of the checkbox to the [ShortCut]'s name. + Adds a new checkable item and assigns the specified [Shortcut] to it. Sets the label of the checkbox to the [Shortcut]'s name. An [code]id[/code] can optionally be provided. If no [code]id[/code] is provided, one will be created from the index. [b]Note:[/b] Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See [method set_item_checked] for more info on how to control it. @@ -63,14 +63,14 @@ - + - Adds a new checkable item and assigns the specified [ShortCut] and icon [code]texture[/code] to it. Sets the label of the checkbox to the [ShortCut]'s name. + Adds a new checkable item and assigns the specified [Shortcut] and icon [code]texture[/code] to it. Sets the label of the checkbox to the [Shortcut]'s name. An [code]id[/code] can optionally be provided. If no [code]id[/code] is provided, one will be created from the index. [b]Note:[/b] Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See [method set_item_checked] for more info on how to control it. @@ -111,7 +111,7 @@ - + @@ -126,14 +126,14 @@ - + - Adds a new item and assigns the specified [ShortCut] and icon [code]texture[/code] to it. Sets the label of the checkbox to the [ShortCut]'s name. + Adds a new item and assigns the specified [Shortcut] and icon [code]texture[/code] to it. Sets the label of the checkbox to the [Shortcut]'s name. An [code]id[/code] can optionally be provided. If no [code]id[/code] is provided, one will be created from the index. @@ -188,14 +188,14 @@ - + - Adds a new radio check button and assigns a [ShortCut] to it. Sets the label of the checkbox to the [ShortCut]'s name. + Adds a new radio check button and assigns a [Shortcut] to it. Sets the label of the checkbox to the [Shortcut]'s name. An [code]id[/code] can optionally be provided. If no [code]id[/code] is provided, one will be created from the index. [b]Note:[/b] Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See [method set_item_checked] for more info on how to control it. @@ -212,14 +212,14 @@ - + - Adds a [ShortCut]. + Adds a [Shortcut]. An [code]id[/code] can optionally be provided. If no [code]id[/code] is provided, one will be created from the index. @@ -303,12 +303,12 @@ - + - Returns the [ShortCut] associated with the specified [code]idx[/code] item. + Returns the [Shortcut] associated with the specified [code]idx[/code] item. @@ -521,12 +521,12 @@ - + - Sets a [ShortCut] for the specified item [code]idx[/code]. + Sets a [Shortcut] for the specified item [code]idx[/code]. @@ -537,7 +537,7 @@ - Disables the [ShortCut] of the specified index [code]idx[/code]. + Disables the [Shortcut] of the specified index [code]idx[/code]. diff --git a/doc/classes/ShortCut.xml b/doc/classes/Shortcut.xml similarity index 95% rename from doc/classes/ShortCut.xml rename to doc/classes/Shortcut.xml index 9a2a7619690..55bbb083c98 100644 --- a/doc/classes/ShortCut.xml +++ b/doc/classes/Shortcut.xml @@ -1,5 +1,5 @@ - + A shortcut for binding input. diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 6c830b8074f..4835b4beab2 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2819,9 +2819,9 @@ void EditorNode::_discard_changes(const String &p_str) { } void EditorNode::_update_file_menu_opened() { - Ref close_scene_sc = ED_GET_SHORTCUT("editor/close_scene"); + Ref close_scene_sc = ED_GET_SHORTCUT("editor/close_scene"); close_scene_sc->set_name(TTR("Close Scene")); - Ref reopen_closed_scene_sc = ED_GET_SHORTCUT("editor/reopen_closed_scene"); + Ref reopen_closed_scene_sc = ED_GET_SHORTCUT("editor/reopen_closed_scene"); reopen_closed_scene_sc->set_name(TTR("Reopen Closed Scene")); PopupMenu *pop = file_menu->get_popup(); pop->set_item_disabled(pop->get_item_index(FILE_OPEN_PREV), previous_scenes.empty()); @@ -4714,10 +4714,10 @@ void EditorNode::_scene_tab_input(const Ref &p_input) { scene_tabs_context_menu->add_item(TTR("Play This Scene"), RUN_PLAY_SCENE); scene_tabs_context_menu->add_separator(); - Ref close_tab_sc = ED_GET_SHORTCUT("editor/close_scene"); + Ref close_tab_sc = ED_GET_SHORTCUT("editor/close_scene"); close_tab_sc->set_name(TTR("Close Tab")); scene_tabs_context_menu->add_shortcut(close_tab_sc, FILE_CLOSE); - Ref undo_close_tab_sc = ED_GET_SHORTCUT("editor/reopen_closed_scene"); + Ref undo_close_tab_sc = ED_GET_SHORTCUT("editor/reopen_closed_scene"); undo_close_tab_sc->set_name(TTR("Undo Close Tab")); scene_tabs_context_menu->add_shortcut(undo_close_tab_sc, FILE_OPEN_PREV); if (previous_scenes.empty()) { diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 0aefef7018b..8be157ffb5d 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -77,7 +77,7 @@ bool EditorSettings::_set_only(const StringName &p_name, const Variant &p_value) String name = arr[i]; Ref shortcut = arr[i + 1]; - Ref sc; + Ref sc; sc.instance(); sc->set_shortcut(shortcut); add_shortcut(name, sc); @@ -120,8 +120,8 @@ bool EditorSettings::_get(const StringName &p_name, Variant &r_ret) const { if (p_name.operator String() == "shortcuts") { Array arr; - for (const Map>::Element *E = shortcuts.front(); E; E = E->next()) { - Ref sc = E->get(); + for (const Map>::Element *E = shortcuts.front(); E; E = E->next()) { + Ref sc = E->get(); if (optimize_save) { if (!sc->has_meta("original")) { @@ -1481,50 +1481,50 @@ String EditorSettings::get_editor_layouts_config() const { // Shortcuts -void EditorSettings::add_shortcut(const String &p_name, Ref &p_shortcut) { +void EditorSettings::add_shortcut(const String &p_name, Ref &p_shortcut) { shortcuts[p_name] = p_shortcut; } bool EditorSettings::is_shortcut(const String &p_name, const Ref &p_event) const { - const Map>::Element *E = shortcuts.find(p_name); + const Map>::Element *E = shortcuts.find(p_name); ERR_FAIL_COND_V_MSG(!E, false, "Unknown Shortcut: " + p_name + "."); return E->get()->is_shortcut(p_event); } -Ref EditorSettings::get_shortcut(const String &p_name) const { - const Map>::Element *E = shortcuts.find(p_name); +Ref EditorSettings::get_shortcut(const String &p_name) const { + const Map>::Element *E = shortcuts.find(p_name); if (!E) { - return Ref(); + return Ref(); } return E->get(); } void EditorSettings::get_shortcut_list(List *r_shortcuts) { - for (const Map>::Element *E = shortcuts.front(); E; E = E->next()) { + for (const Map>::Element *E = shortcuts.front(); E; E = E->next()) { r_shortcuts->push_back(E->key()); } } -Ref ED_GET_SHORTCUT(const String &p_path) { +Ref ED_GET_SHORTCUT(const String &p_path) { if (!EditorSettings::get_singleton()) { return nullptr; } - Ref sc = EditorSettings::get_singleton()->get_shortcut(p_path); + Ref sc = EditorSettings::get_singleton()->get_shortcut(p_path); ERR_FAIL_COND_V_MSG(!sc.is_valid(), sc, "Used ED_GET_SHORTCUT with invalid shortcut: " + p_path + "."); return sc; } -struct ShortCutMapping { +struct ShortcutMapping { const char *path; uint32_t keycode; }; -Ref ED_SHORTCUT(const String &p_path, const String &p_name, uint32_t p_keycode) { +Ref ED_SHORTCUT(const String &p_path, const String &p_name, uint32_t p_keycode) { #ifdef OSX_ENABLED // Use Cmd+Backspace as a general replacement for Delete shortcuts on macOS if (p_keycode == KEY_DELETE) { @@ -1545,7 +1545,7 @@ Ref ED_SHORTCUT(const String &p_path, const String &p_name, uint32_t p } if (!EditorSettings::get_singleton()) { - Ref sc; + Ref sc; sc.instance(); sc->set_name(p_name); sc->set_shortcut(ie); @@ -1553,7 +1553,7 @@ Ref ED_SHORTCUT(const String &p_path, const String &p_name, uint32_t p return sc; } - Ref sc = EditorSettings::get_singleton()->get_shortcut(p_path); + Ref sc = EditorSettings::get_singleton()->get_shortcut(p_path); if (sc.is_valid()) { sc->set_name(p_name); //keep name (the ones that come from disk have no name) sc->set_meta("original", ie); //to compare against changes diff --git a/editor/editor_settings.h b/editor/editor_settings.h index 13aebb7ea6d..4896fb58db2 100644 --- a/editor/editor_settings.h +++ b/editor/editor_settings.h @@ -85,7 +85,7 @@ private: int last_order; Ref clipboard; - Map> shortcuts; + Map> shortcuts; String resource_path; String settings_dir; @@ -182,9 +182,9 @@ public: Vector get_script_templates(const String &p_extension, const String &p_custom_path = String()); String get_editor_layouts_config() const; - void add_shortcut(const String &p_name, Ref &p_shortcut); + void add_shortcut(const String &p_name, Ref &p_shortcut); bool is_shortcut(const String &p_name, const Ref &p_event) const; - Ref get_shortcut(const String &p_name) const; + Ref get_shortcut(const String &p_name) const; void get_shortcut_list(List *r_shortcuts); void notify_changes(); @@ -203,7 +203,7 @@ Variant _EDITOR_DEF(const String &p_setting, const Variant &p_default, bool p_re Variant _EDITOR_GET(const String &p_setting); #define ED_IS_SHORTCUT(p_name, p_ev) (EditorSettings::get_singleton()->is_shortcut(p_name, p_ev)) -Ref ED_SHORTCUT(const String &p_path, const String &p_name, uint32_t p_keycode = 0); -Ref ED_GET_SHORTCUT(const String &p_path); +Ref ED_SHORTCUT(const String &p_path, const String &p_name, uint32_t p_keycode = 0); +Ref ED_GET_SHORTCUT(const String &p_path); #endif // EDITOR_SETTINGS_H diff --git a/editor/icons/ShortCut.svg b/editor/icons/Shortcut.svg similarity index 100% rename from editor/icons/ShortCut.svg rename to editor/icons/Shortcut.svg diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index ea58fb1e36a..859e80befef 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -400,11 +400,11 @@ private: Ref select_handle; Ref anchor_handle; - Ref drag_pivot_shortcut; - Ref set_pivot_shortcut; - Ref multiply_grid_step_shortcut; - Ref divide_grid_step_shortcut; - Ref pan_view_shortcut; + Ref drag_pivot_shortcut; + Ref set_pivot_shortcut; + Ref multiply_grid_step_shortcut; + Ref divide_grid_step_shortcut; + Ref pan_view_shortcut; bool _is_node_locked(const Node *p_node); bool _is_node_movable(const Node *p_node, bool p_popup_warning = false); diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 952487c13cb..d28bbadf397 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -2246,7 +2246,7 @@ Point2i Node3DEditorViewport::_get_warped_mouse_motion(const Ref shortcut = ED_GET_SHORTCUT(p_path); + Ref shortcut = ED_GET_SHORTCUT(p_path); if (shortcut.is_null()) { return false; } diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp index 35610ef71b1..5da682a1481 100644 --- a/editor/settings_config_dialog.cpp +++ b/editor/settings_config_dialog.cpp @@ -202,7 +202,7 @@ void EditorSettingsDialog::_update_shortcuts() { Map sections; for (List::Element *E = slist.front(); E; E = E->next()) { - Ref sc = EditorSettings::get_singleton()->get_shortcut(E->get()); + Ref sc = EditorSettings::get_singleton()->get_shortcut(E->get()); if (!sc->has_meta("original")) { continue; } @@ -268,7 +268,7 @@ void EditorSettingsDialog::_shortcut_button_pressed(Object *p_item, int p_column ERR_FAIL_COND(!ti); String item = ti->get_metadata(0); - Ref sc = EditorSettings::get_singleton()->get_shortcut(item); + Ref sc = EditorSettings::get_singleton()->get_shortcut(item); if (p_idx == 0) { press_a_key_label->set_text(TTR("Press a Key...")); @@ -335,7 +335,7 @@ void EditorSettingsDialog::_press_a_key_confirm() { ie->set_alt(last_wait_for_key->get_alt()); ie->set_metakey(last_wait_for_key->get_metakey()); - Ref sc = EditorSettings::get_singleton()->get_shortcut(shortcut_configured); + Ref sc = EditorSettings::get_singleton()->get_shortcut(shortcut_configured); undo_redo->create_action(TTR("Change Shortcut") + " '" + shortcut_configured + "'"); undo_redo->add_do_method(sc.ptr(), "set_shortcut", ie); diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index aaae03df68a..211082d610e 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -326,12 +326,12 @@ bool BaseButton::is_keep_pressed_outside() const { return keep_pressed_outside; } -void BaseButton::set_shortcut(const Ref &p_shortcut) { +void BaseButton::set_shortcut(const Ref &p_shortcut) { shortcut = p_shortcut; set_process_unhandled_input(shortcut.is_valid()); } -Ref BaseButton::get_shortcut() const { +Ref BaseButton::get_shortcut() const { return shortcut; } @@ -414,7 +414,7 @@ void BaseButton::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "button_mask", PROPERTY_HINT_FLAGS, "Mouse Left, Mouse Right, Mouse Middle"), "set_button_mask", "get_button_mask"); ADD_PROPERTY(PropertyInfo(Variant::INT, "enabled_focus_mode", PROPERTY_HINT_ENUM, "None,Click,All"), "set_enabled_focus_mode", "get_enabled_focus_mode"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "keep_pressed_outside"), "set_keep_pressed_outside", "is_keep_pressed_outside"); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shortcut", PROPERTY_HINT_RESOURCE_TYPE, "ShortCut"), "set_shortcut", "get_shortcut"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shortcut", PROPERTY_HINT_RESOURCE_TYPE, "Shortcut"), "set_shortcut", "get_shortcut"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "group", PROPERTY_HINT_RESOURCE_TYPE, "ButtonGroup"), "set_button_group", "get_button_group"); BIND_ENUM_CONSTANT(DRAW_NORMAL); diff --git a/scene/gui/base_button.h b/scene/gui/base_button.h index 12272446d5f..8e71931f8b3 100644 --- a/scene/gui/base_button.h +++ b/scene/gui/base_button.h @@ -50,7 +50,7 @@ private: bool shortcut_in_tooltip; bool keep_pressed_outside; FocusMode enabled_focus_mode; - Ref shortcut; + Ref shortcut; ActionMode action_mode; struct Status { @@ -118,8 +118,8 @@ public: void set_enabled_focus_mode(FocusMode p_mode); FocusMode get_enabled_focus_mode() const; - void set_shortcut(const Ref &p_shortcut); - Ref get_shortcut() const; + void set_shortcut(const Ref &p_shortcut); + Ref get_shortcut() const; virtual String get_tooltip(const Point2 &p_pos) const override; diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 2fdcf11ca81..bc70809ad5c 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -717,7 +717,7 @@ void PopupMenu::add_multistate_item(const String &p_label, int p_max_states, int } #define ITEM_SETUP_WITH_SHORTCUT(p_shortcut, p_id, p_global) \ - ERR_FAIL_COND_MSG(p_shortcut.is_null(), "Cannot add item with invalid ShortCut."); \ + ERR_FAIL_COND_MSG(p_shortcut.is_null(), "Cannot add item with invalid Shortcut."); \ _ref_shortcut(p_shortcut); \ item.text = p_shortcut->get_name(); \ item.xl_text = tr(item.text); \ @@ -725,7 +725,7 @@ void PopupMenu::add_multistate_item(const String &p_label, int p_max_states, int item.shortcut = p_shortcut; \ item.shortcut_is_global = p_global; -void PopupMenu::add_shortcut(const Ref &p_shortcut, int p_id, bool p_global) { +void PopupMenu::add_shortcut(const Ref &p_shortcut, int p_id, bool p_global) { Item item; ITEM_SETUP_WITH_SHORTCUT(p_shortcut, p_id, p_global); items.push_back(item); @@ -733,7 +733,7 @@ void PopupMenu::add_shortcut(const Ref &p_shortcut, int p_id, bool p_g child_controls_changed(); } -void PopupMenu::add_icon_shortcut(const Ref &p_icon, const Ref &p_shortcut, int p_id, bool p_global) { +void PopupMenu::add_icon_shortcut(const Ref &p_icon, const Ref &p_shortcut, int p_id, bool p_global) { Item item; ITEM_SETUP_WITH_SHORTCUT(p_shortcut, p_id, p_global); item.icon = p_icon; @@ -742,7 +742,7 @@ void PopupMenu::add_icon_shortcut(const Ref &p_icon, const Ref &p_shortcut, int p_id, bool p_global) { +void PopupMenu::add_check_shortcut(const Ref &p_shortcut, int p_id, bool p_global) { Item item; ITEM_SETUP_WITH_SHORTCUT(p_shortcut, p_id, p_global); item.checkable_type = Item::CHECKABLE_TYPE_CHECK_BOX; @@ -751,7 +751,7 @@ void PopupMenu::add_check_shortcut(const Ref &p_shortcut, int p_id, bo child_controls_changed(); } -void PopupMenu::add_icon_check_shortcut(const Ref &p_icon, const Ref &p_shortcut, int p_id, bool p_global) { +void PopupMenu::add_icon_check_shortcut(const Ref &p_icon, const Ref &p_shortcut, int p_id, bool p_global) { Item item; ITEM_SETUP_WITH_SHORTCUT(p_shortcut, p_id, p_global); item.icon = p_icon; @@ -761,7 +761,7 @@ void PopupMenu::add_icon_check_shortcut(const Ref &p_icon, const Ref< child_controls_changed(); } -void PopupMenu::add_radio_check_shortcut(const Ref &p_shortcut, int p_id, bool p_global) { +void PopupMenu::add_radio_check_shortcut(const Ref &p_shortcut, int p_id, bool p_global) { Item item; ITEM_SETUP_WITH_SHORTCUT(p_shortcut, p_id, p_global); item.checkable_type = Item::CHECKABLE_TYPE_RADIO_BUTTON; @@ -770,7 +770,7 @@ void PopupMenu::add_radio_check_shortcut(const Ref &p_shortcut, int p_ child_controls_changed(); } -void PopupMenu::add_icon_radio_check_shortcut(const Ref &p_icon, const Ref &p_shortcut, int p_id, bool p_global) { +void PopupMenu::add_icon_radio_check_shortcut(const Ref &p_icon, const Ref &p_shortcut, int p_id, bool p_global) { Item item; ITEM_SETUP_WITH_SHORTCUT(p_shortcut, p_id, p_global); item.icon = p_icon; @@ -931,8 +931,8 @@ String PopupMenu::get_item_tooltip(int p_idx) const { return items[p_idx].tooltip; } -Ref PopupMenu::get_item_shortcut(int p_idx) const { - ERR_FAIL_INDEX_V(p_idx, items.size(), Ref()); +Ref PopupMenu::get_item_shortcut(int p_idx) const { + ERR_FAIL_INDEX_V(p_idx, items.size(), Ref()); return items[p_idx].shortcut; } @@ -970,7 +970,7 @@ void PopupMenu::set_item_tooltip(int p_idx, const String &p_tooltip) { control->update(); } -void PopupMenu::set_item_shortcut(int p_idx, const Ref &p_shortcut, bool p_global) { +void PopupMenu::set_item_shortcut(int p_idx, const Ref &p_shortcut, bool p_global) { ERR_FAIL_INDEX(p_idx, items.size()); if (items[p_idx].shortcut.is_valid()) { _unref_shortcut(items[p_idx].shortcut); @@ -1209,7 +1209,7 @@ Array PopupMenu::_get_items() const { return items; } -void PopupMenu::_ref_shortcut(Ref p_sc) { +void PopupMenu::_ref_shortcut(Ref p_sc) { if (!shortcut_refcount.has(p_sc)) { shortcut_refcount[p_sc] = 1; p_sc->connect("changed", callable_mp((CanvasItem *)this, &CanvasItem::update)); @@ -1218,7 +1218,7 @@ void PopupMenu::_ref_shortcut(Ref p_sc) { } } -void PopupMenu::_unref_shortcut(Ref p_sc) { +void PopupMenu::_unref_shortcut(Ref p_sc) { ERR_FAIL_COND(!shortcut_refcount.has(p_sc)); shortcut_refcount[p_sc]--; if (shortcut_refcount[p_sc] == 0) { diff --git a/scene/gui/popup_menu.h b/scene/gui/popup_menu.h index 45a33367471..9535fd07d78 100644 --- a/scene/gui/popup_menu.h +++ b/scene/gui/popup_menu.h @@ -61,7 +61,7 @@ class PopupMenu : public Popup { int _ofs_cache; int _height_cache; int h_ofs; - Ref shortcut; + Ref shortcut; bool shortcut_is_global; bool shortcut_is_disabled; @@ -114,10 +114,10 @@ class PopupMenu : public Popup { Array _get_items() const; void _set_items(const Array &p_items); - Map, int> shortcut_refcount; + Map, int> shortcut_refcount; - void _ref_shortcut(Ref p_sc); - void _unref_shortcut(Ref p_sc); + void _ref_shortcut(Ref p_sc); + void _unref_shortcut(Ref p_sc); bool allow_search; uint64_t search_time_msec; @@ -145,12 +145,12 @@ public: void add_multistate_item(const String &p_label, int p_max_states, int p_default_state = 0, int p_id = -1, uint32_t p_accel = 0); - void add_shortcut(const Ref &p_shortcut, int p_id = -1, bool p_global = false); - void add_icon_shortcut(const Ref &p_icon, const Ref &p_shortcut, int p_id = -1, bool p_global = false); - void add_check_shortcut(const Ref &p_shortcut, int p_id = -1, bool p_global = false); - void add_icon_check_shortcut(const Ref &p_icon, const Ref &p_shortcut, int p_id = -1, bool p_global = false); - void add_radio_check_shortcut(const Ref &p_shortcut, int p_id = -1, bool p_global = false); - void add_icon_radio_check_shortcut(const Ref &p_icon, const Ref &p_shortcut, int p_id = -1, bool p_global = false); + void add_shortcut(const Ref &p_shortcut, int p_id = -1, bool p_global = false); + void add_icon_shortcut(const Ref &p_icon, const Ref &p_shortcut, int p_id = -1, bool p_global = false); + void add_check_shortcut(const Ref &p_shortcut, int p_id = -1, bool p_global = false); + void add_icon_check_shortcut(const Ref &p_icon, const Ref &p_shortcut, int p_id = -1, bool p_global = false); + void add_radio_check_shortcut(const Ref &p_shortcut, int p_id = -1, bool p_global = false); + void add_icon_radio_check_shortcut(const Ref &p_icon, const Ref &p_shortcut, int p_id = -1, bool p_global = false); void add_submenu_item(const String &p_label, const String &p_submenu, int p_id = -1); @@ -166,7 +166,7 @@ public: void set_item_as_checkable(int p_idx, bool p_checkable); void set_item_as_radio_checkable(int p_idx, bool p_radio_checkable); void set_item_tooltip(int p_idx, const String &p_tooltip); - void set_item_shortcut(int p_idx, const Ref &p_shortcut, bool p_global = false); + void set_item_shortcut(int p_idx, const Ref &p_shortcut, bool p_global = false); void set_item_h_offset(int p_idx, int p_offset); void set_item_multistate(int p_idx, int p_state); void toggle_item_multistate(int p_idx); @@ -189,7 +189,7 @@ public: bool is_item_radio_checkable(int p_idx) const; bool is_item_shortcut_disabled(int p_idx) const; String get_item_tooltip(int p_idx) const; - Ref get_item_shortcut(int p_idx) const; + Ref get_item_shortcut(int p_idx) const; int get_item_state(int p_idx) const; int get_current_index() const; diff --git a/scene/gui/shortcut.cpp b/scene/gui/shortcut.cpp index 9f5b9c40c2d..f8c7bc44a73 100644 --- a/scene/gui/shortcut.cpp +++ b/scene/gui/shortcut.cpp @@ -32,20 +32,20 @@ #include "core/os/keyboard.h" -void ShortCut::set_shortcut(const Ref &p_shortcut) { +void Shortcut::set_shortcut(const Ref &p_shortcut) { shortcut = p_shortcut; emit_changed(); } -Ref ShortCut::get_shortcut() const { +Ref Shortcut::get_shortcut() const { return shortcut; } -bool ShortCut::is_shortcut(const Ref &p_event) const { +bool Shortcut::is_shortcut(const Ref &p_event) const { return shortcut.is_valid() && shortcut->shortcut_match(p_event); } -String ShortCut::get_as_text() const { +String Shortcut::get_as_text() const { if (shortcut.is_valid()) { return shortcut->as_text(); } else { @@ -53,21 +53,21 @@ String ShortCut::get_as_text() const { } } -bool ShortCut::is_valid() const { +bool Shortcut::is_valid() const { return shortcut.is_valid(); } -void ShortCut::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_shortcut", "event"), &ShortCut::set_shortcut); - ClassDB::bind_method(D_METHOD("get_shortcut"), &ShortCut::get_shortcut); +void Shortcut::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_shortcut", "event"), &Shortcut::set_shortcut); + ClassDB::bind_method(D_METHOD("get_shortcut"), &Shortcut::get_shortcut); - ClassDB::bind_method(D_METHOD("is_valid"), &ShortCut::is_valid); + ClassDB::bind_method(D_METHOD("is_valid"), &Shortcut::is_valid); - ClassDB::bind_method(D_METHOD("is_shortcut", "event"), &ShortCut::is_shortcut); - ClassDB::bind_method(D_METHOD("get_as_text"), &ShortCut::get_as_text); + ClassDB::bind_method(D_METHOD("is_shortcut", "event"), &Shortcut::is_shortcut); + ClassDB::bind_method(D_METHOD("get_as_text"), &Shortcut::get_as_text); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shortcut", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), "set_shortcut", "get_shortcut"); } -ShortCut::ShortCut() { +Shortcut::Shortcut() { } diff --git a/scene/gui/shortcut.h b/scene/gui/shortcut.h index 063d4e43dc8..0d7809e5cf5 100644 --- a/scene/gui/shortcut.h +++ b/scene/gui/shortcut.h @@ -34,8 +34,8 @@ #include "core/input/input_event.h" #include "core/resource.h" -class ShortCut : public Resource { - GDCLASS(ShortCut, Resource); +class Shortcut : public Resource { + GDCLASS(Shortcut, Resource); Ref shortcut; @@ -50,7 +50,7 @@ public: String get_as_text() const; - ShortCut(); + Shortcut(); }; #endif // SHORTCUT_H diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index af900a22dbb..39749bcf6f4 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -295,7 +295,7 @@ void register_scene_types() { OS::get_singleton()->yield(); //may take time to init - ClassDB::register_class(); + ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class