diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-05-04 13:12:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-04 13:12:17 +0200 |
commit | 4e7ca279fca892c1ceef875ef728be748ab1179b (patch) | |
tree | 61e833c205c18714d9ed0873f8dc8ca86e0d8680 | |
parent | 56316b27ab97acb3ce1a318ba3466c31489a1322 (diff) | |
parent | 0de9a7d8030a35415e918e9580f5926db4856ea2 (diff) |
Merge pull request #47855 from aaronfranke/doubleclick
Rename `doubleclick` to `double_click`
-rw-r--r-- | core/input/input_event.cpp | 22 | ||||
-rw-r--r-- | core/input/input_event.h | 6 | ||||
-rw-r--r-- | doc/classes/InputEventMouseButton.xml | 2 | ||||
-rw-r--r-- | editor/editor_node.cpp | 2 | ||||
-rw-r--r-- | editor/editor_properties.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/project_manager.cpp | 2 | ||||
-rw-r--r-- | modules/visual_script/visual_script_editor.cpp | 2 | ||||
-rw-r--r-- | platform/android/display_server_android.cpp | 2 | ||||
-rw-r--r-- | platform/iphone/display_server_iphone.h | 2 | ||||
-rw-r--r-- | platform/iphone/display_server_iphone.mm | 2 | ||||
-rw-r--r-- | platform/javascript/display_server_javascript.cpp | 4 | ||||
-rw-r--r-- | platform/linuxbsd/display_server_x11.cpp | 4 | ||||
-rw-r--r-- | platform/osx/display_server_osx.mm | 2 | ||||
-rw-r--r-- | platform/windows/display_server_windows.cpp | 8 | ||||
-rw-r--r-- | scene/gui/gradient_edit.cpp | 2 | ||||
-rw-r--r-- | scene/gui/item_list.cpp | 4 | ||||
-rw-r--r-- | scene/gui/line_edit.cpp | 16 | ||||
-rw-r--r-- | scene/gui/line_edit.h | 2 | ||||
-rw-r--r-- | scene/gui/rich_text_label.cpp | 8 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 6 | ||||
-rw-r--r-- | scene/gui/tree.cpp | 10 | ||||
-rw-r--r-- | scene/gui/tree.h | 2 |
23 files changed, 57 insertions, 57 deletions
diff --git a/core/input/input_event.cpp b/core/input/input_event.cpp index 99cc51b95e..46629d742e 100644 --- a/core/input/input_event.cpp +++ b/core/input/input_event.cpp @@ -545,12 +545,12 @@ bool InputEventMouseButton::is_pressed() const { return pressed; } -void InputEventMouseButton::set_doubleclick(bool p_doubleclick) { - doubleclick = p_doubleclick; +void InputEventMouseButton::set_double_click(bool p_double_click) { + double_click = p_double_click; } -bool InputEventMouseButton::is_doubleclick() const { - return doubleclick; +bool InputEventMouseButton::is_double_click() const { + return double_click; } Ref<InputEvent> InputEventMouseButton::xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs) const { @@ -569,7 +569,7 @@ Ref<InputEvent> InputEventMouseButton::xformed_by(const Transform2D &p_xform, co mb->set_button_mask(get_button_mask()); mb->set_pressed(pressed); - mb->set_doubleclick(doubleclick); + mb->set_double_click(double_click); mb->set_factor(factor); mb->set_button_index(button_index); @@ -636,7 +636,7 @@ String InputEventMouseButton::as_text() const { } // Double Click - if (doubleclick) { + if (double_click) { full_string += " (" + RTR("Double Click") + ")"; } @@ -645,7 +645,7 @@ String InputEventMouseButton::as_text() const { String InputEventMouseButton::to_string() { String p = is_pressed() ? "true" : "false"; - String d = doubleclick ? "true" : "false"; + String d = double_click ? "true" : "false"; int idx = get_button_index(); String button_string = itos(idx); @@ -671,7 +671,7 @@ String InputEventMouseButton::to_string() { // Work around the fact vformat can only take 5 substitutions but 6 need to be passed. String index_and_mods = vformat("button_index=%s mods=%s", button_index, mods); - return vformat("InputEventMouseButton: %s pressed=%s position=(%s) button_mask=%s doubleclick=%s", index_and_mods, p, String(get_position()), itos(get_button_mask()), d); + return vformat("InputEventMouseButton: %s pressed=%s position=(%s) button_mask=%s double_click=%s", index_and_mods, p, String(get_position()), itos(get_button_mask()), d); } void InputEventMouseButton::_bind_methods() { @@ -684,13 +684,13 @@ void InputEventMouseButton::_bind_methods() { ClassDB::bind_method(D_METHOD("set_pressed", "pressed"), &InputEventMouseButton::set_pressed); // ClassDB::bind_method(D_METHOD("is_pressed"), &InputEventMouseButton::is_pressed); - ClassDB::bind_method(D_METHOD("set_doubleclick", "doubleclick"), &InputEventMouseButton::set_doubleclick); - ClassDB::bind_method(D_METHOD("is_doubleclick"), &InputEventMouseButton::is_doubleclick); + ClassDB::bind_method(D_METHOD("set_double_click", "double_click"), &InputEventMouseButton::set_double_click); + ClassDB::bind_method(D_METHOD("is_double_click"), &InputEventMouseButton::is_double_click); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "factor"), "set_factor", "get_factor"); ADD_PROPERTY(PropertyInfo(Variant::INT, "button_index"), "set_button_index", "get_button_index"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "pressed"), "set_pressed", "is_pressed"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "doubleclick"), "set_doubleclick", "is_doubleclick"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "double_click"), "set_double_click", "is_double_click"); } /////////////////////////////////// diff --git a/core/input/input_event.h b/core/input/input_event.h index 94aa68db33..5a33ee7b9c 100644 --- a/core/input/input_event.h +++ b/core/input/input_event.h @@ -294,7 +294,7 @@ class InputEventMouseButton : public InputEventMouse { float factor = 1; int button_index = 0; bool pressed = false; //otherwise released - bool doubleclick = false; //last even less than doubleclick time + bool double_click = false; //last even less than double click time protected: static void _bind_methods(); @@ -309,8 +309,8 @@ public: void set_pressed(bool p_pressed); virtual bool is_pressed() const override; - void set_doubleclick(bool p_doubleclick); - bool is_doubleclick() const; + void set_double_click(bool p_double_click); + bool is_double_click() const; virtual Ref<InputEvent> xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs = Vector2()) const override; virtual bool action_match(const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength, float *p_raw_strength, float p_deadzone) const override; diff --git a/doc/classes/InputEventMouseButton.xml b/doc/classes/InputEventMouseButton.xml index d7e92f8bca..be71b42567 100644 --- a/doc/classes/InputEventMouseButton.xml +++ b/doc/classes/InputEventMouseButton.xml @@ -15,7 +15,7 @@ <member name="button_index" type="int" setter="set_button_index" getter="get_button_index" default="0"> The mouse button identifier, one of the [enum MouseButton] button or button wheel constants. </member> - <member name="doubleclick" type="bool" setter="set_doubleclick" getter="is_doubleclick" default="false"> + <member name="double_click" type="bool" setter="set_double_click" getter="is_double_click" default="false"> If [code]true[/code], the mouse button's state is a double-click. </member> <member name="factor" type="float" setter="set_factor" getter="get_factor" default="1.0"> diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index b5bb35a6e7..0f0b2da6ab 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -4864,7 +4864,7 @@ void EditorNode::_scene_tab_input(const Ref<InputEvent> &p_input) { _scene_tab_closed(scene_tabs->get_hovered_tab()); } } else { - if ((mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_doubleclick()) || (mb->get_button_index() == MOUSE_BUTTON_MIDDLE && mb->is_pressed())) { + if ((mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_double_click()) || (mb->get_button_index() == MOUSE_BUTTON_MIDDLE && mb->is_pressed())) { _menu_option_confirm(FILE_NEW_SCENE, true); } } diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 652deb1804..47c0e31da6 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -929,7 +929,7 @@ EditorPropertyFloat::EditorPropertyFloat() { void EditorPropertyEasing::_drag_easing(const Ref<InputEvent> &p_ev) { const Ref<InputEventMouseButton> mb = p_ev; if (mb.is_valid()) { - if (mb->is_doubleclick() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { + if (mb->is_double_click() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { _setup_spin(); } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 6ac47595dc..261621e10a 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -1654,7 +1654,7 @@ bool CanvasItemEditor::_gui_input_open_scene_on_double_click(const Ref<InputEven Ref<InputEventMouseButton> b = p_event; // Open a sub-scene on double-click - if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed() && b->is_doubleclick() && tool == TOOL_SELECT) { + if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed() && b->is_double_click() && tool == TOOL_SELECT) { List<CanvasItem *> selection = _get_edited_canvas_items(); if (selection.size() == 1) { CanvasItem *canvas_item = selection[0]; diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 780dbb644e..2b75144ac7 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -1762,7 +1762,7 @@ void ProjectList::_panel_input(const Ref<InputEvent> &p_ev, Node *p_hb) { emit_signal(SIGNAL_SELECTION_CHANGED); - if (!mb->get_control() && mb->is_doubleclick()) { + if (!mb->get_control() && mb->is_double_click()) { emit_signal(SIGNAL_PROJECT_ASK_OPEN); } } diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 02ec9ccd06..527eb0abc9 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -1875,7 +1875,7 @@ void VisualScriptEditor::_members_gui_input(const Ref<InputEvent> &p_event) { } Ref<InputEventMouseButton> btn = p_event; - if (btn.is_valid() && btn->is_doubleclick()) { + if (btn.is_valid() && btn->is_double_click()) { TreeItem *ti = members->get_selected(); if (ti && ti->get_parent() == members->get_root()->get_children()) { // to check if it's a function _center_on_node(script->get_function_node_id(ti->get_metadata(0))); diff --git a/platform/android/display_server_android.cpp b/platform/android/display_server_android.cpp index dd001baba9..51cea39a43 100644 --- a/platform/android/display_server_android.cpp +++ b/platform/android/display_server_android.cpp @@ -778,7 +778,7 @@ void DisplayServerAndroid::process_double_tap(int event_android_button_mask, Poi ev->set_pressed(event_button_mask != 0); ev->set_button_index(_button_index_from_mask(event_button_mask)); ev->set_button_mask(event_button_mask); - ev->set_doubleclick(true); + ev->set_double_click(true); Input::get_singleton()->accumulate_input_event(ev); } diff --git a/platform/iphone/display_server_iphone.h b/platform/iphone/display_server_iphone.h index 31a44723a5..7bf1557873 100644 --- a/platform/iphone/display_server_iphone.h +++ b/platform/iphone/display_server_iphone.h @@ -99,7 +99,7 @@ public: // MARK: Touches - void touch_press(int p_idx, int p_x, int p_y, bool p_pressed, bool p_doubleclick); + void touch_press(int p_idx, int p_x, int p_y, bool p_pressed, bool p_double_click); void touch_drag(int p_idx, int p_prev_x, int p_prev_y, int p_x, int p_y); void touches_cancelled(int p_idx); diff --git a/platform/iphone/display_server_iphone.mm b/platform/iphone/display_server_iphone.mm index b590ce065c..a852bea207 100644 --- a/platform/iphone/display_server_iphone.mm +++ b/platform/iphone/display_server_iphone.mm @@ -222,7 +222,7 @@ void DisplayServerIPhone::_window_callback(const Callable &p_callable, const Var // MARK: Touches -void DisplayServerIPhone::touch_press(int p_idx, int p_x, int p_y, bool p_pressed, bool p_doubleclick) { +void DisplayServerIPhone::touch_press(int p_idx, int p_x, int p_y, bool p_pressed, bool p_double_click) { if (!GLOBAL_DEF("debug/disable_touch", false)) { Ref<InputEventScreenTouch> ev; ev.instance(); diff --git a/platform/javascript/display_server_javascript.cpp b/platform/javascript/display_server_javascript.cpp index 0031650360..234e42376d 100644 --- a/platform/javascript/display_server_javascript.cpp +++ b/platform/javascript/display_server_javascript.cpp @@ -215,14 +215,14 @@ EM_BOOL DisplayServerJavaScript::mouse_button_callback(int p_event_type, const E display->last_click_ms = 0; display->last_click_pos = Point2(-100, -100); display->last_click_button_index = -1; - ev->set_doubleclick(true); + ev->set_double_click(true); } } else { display->last_click_button_index = ev->get_button_index(); } - if (!ev->is_doubleclick()) { + if (!ev->is_double_click()) { display->last_click_ms += diff; display->last_click_pos = ev->get_position(); } diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp index 8dc1b41702..12f030bd58 100644 --- a/platform/linuxbsd/display_server_x11.cpp +++ b/platform/linuxbsd/display_server_x11.cpp @@ -3162,14 +3162,14 @@ void DisplayServerX11::process_events() { last_click_ms = 0; last_click_pos = Point2i(-100, -100); last_click_button_index = -1; - mb->set_doubleclick(true); + mb->set_double_click(true); } } else if (mb->get_button_index() < 4 || mb->get_button_index() > 7) { last_click_button_index = mb->get_button_index(); } - if (!mb->is_doubleclick()) { + if (!mb->is_double_click()) { last_click_ms += diff; last_click_pos = Point2i(event.xbutton.x, event.xbutton.y); } diff --git a/platform/osx/display_server_osx.mm b/platform/osx/display_server_osx.mm index 61bb26c2a8..473ae95036 100644 --- a/platform/osx/display_server_osx.mm +++ b/platform/osx/display_server_osx.mm @@ -830,7 +830,7 @@ static void _mouseDownEvent(DisplayServer::WindowID window_id, NSEvent *event, i mb->set_global_position(pos); mb->set_button_mask(DS_OSX->last_button_state); if (index == MOUSE_BUTTON_LEFT && pressed) { - mb->set_doubleclick([event clickCount] == 2); + mb->set_double_click([event clickCount] == 2); } Input::get_singleton()->accumulate_input_event(mb); diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index 8789e6dfb4..4b859da340 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -2412,17 +2412,17 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA case WM_LBUTTONDBLCLK: { mb->set_pressed(true); mb->set_button_index(1); - mb->set_doubleclick(true); + mb->set_double_click(true); } break; case WM_RBUTTONDBLCLK: { mb->set_pressed(true); mb->set_button_index(2); - mb->set_doubleclick(true); + mb->set_double_click(true); } break; case WM_MBUTTONDBLCLK: { mb->set_pressed(true); mb->set_button_index(3); - mb->set_doubleclick(true); + mb->set_double_click(true); } break; case WM_MOUSEWHEEL: { mb->set_pressed(true); @@ -2470,7 +2470,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA mb->set_button_index(MOUSE_BUTTON_XBUTTON1); else mb->set_button_index(MOUSE_BUTTON_XBUTTON2); - mb->set_doubleclick(true); + mb->set_double_click(true); } break; default: { return 0; diff --git a/scene/gui/gradient_edit.cpp b/scene/gui/gradient_edit.cpp index e72709e847..ebefb2938f 100644 --- a/scene/gui/gradient_edit.cpp +++ b/scene/gui/gradient_edit.cpp @@ -107,7 +107,7 @@ void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) { Ref<InputEventMouseButton> mb = p_event; //Show color picker on double click. - if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_doubleclick() && mb->is_pressed()) { + if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_double_click() && mb->is_pressed()) { grabbed = _get_point_from_pos(mb->get_position().x); _show_color_picker(); accept_event(); diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 86d070f9b1..4fddb4b661 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -600,7 +600,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) { emit_signal("item_rmb_selected", i, get_local_mouse_position()); } } else { - if (!mb->is_doubleclick() && !mb->get_command() && select_mode == SELECT_MULTI && items[i].selectable && !items[i].disabled && items[i].selected && mb->get_button_index() == MOUSE_BUTTON_LEFT) { + if (!mb->is_double_click() && !mb->get_command() && select_mode == SELECT_MULTI && items[i].selectable && !items[i].disabled && items[i].selected && mb->get_button_index() == MOUSE_BUTTON_LEFT) { defer_select_single = i; return; } @@ -622,7 +622,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) { if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) { emit_signal("item_rmb_selected", i, get_local_mouse_position()); - } else if (/*select_mode==SELECT_SINGLE &&*/ mb->is_doubleclick()) { + } else if (/*select_mode==SELECT_SINGLE &&*/ mb->is_double_click()) { emit_signal("item_activated", i); } } diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 1aff5d5390..eb836b3bf7 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -260,15 +260,15 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) { } else { if (selecting_enabled) { - if (!b->is_doubleclick() && (OS::get_singleton()->get_ticks_msec() - selection.last_dblclk) < 600) { + if (!b->is_double_click() && (OS::get_singleton()->get_ticks_msec() - selection.last_dblclk) < 600) { // Triple-click select all. selection.enabled = true; selection.begin = 0; selection.end = text.length(); - selection.doubleclick = true; + selection.double_click = true; selection.last_dblclk = 0; caret_column = selection.begin; - } else if (b->is_doubleclick()) { + } else if (b->is_double_click()) { // Double-click select word. Vector<Vector2i> words = TS->shaped_text_get_word_breaks(text_rid); for (int i = 0; i < words.size(); i++) { @@ -276,7 +276,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) { selection.enabled = true; selection.begin = words[i].x; selection.end = words[i].y; - selection.doubleclick = true; + selection.double_click = true; selection.last_dblclk = OS::get_singleton()->get_ticks_msec(); caret_column = selection.end; break; @@ -308,11 +308,11 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) { } } - if ((!selection.creating) && (!selection.doubleclick)) { + if ((!selection.creating) && (!selection.double_click)) { deselect(); } selection.creating = false; - selection.doubleclick = false; + selection.double_click = false; show_virtual_keyboard(); } @@ -1532,7 +1532,7 @@ void LineEdit::deselect() { selection.start_column = 0; selection.enabled = false; selection.creating = false; - selection.doubleclick = false; + selection.double_click = false; update(); } @@ -1659,7 +1659,7 @@ void LineEdit::select(int p_from, int p_to) { selection.begin = p_from; selection.end = p_to; selection.creating = false; - selection.doubleclick = false; + selection.double_click = false; update(); } diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h index f4f0ff0629..12fec2f98b 100644 --- a/scene/gui/line_edit.h +++ b/scene/gui/line_edit.h @@ -134,7 +134,7 @@ private: int start_column = 0; bool enabled = false; bool creating = false; - bool doubleclick = false; + bool double_click = false; bool drag_attempt = false; uint64_t last_dblclk = 0; } selection; diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 843e7ef6e2..9efc1af23b 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -1482,7 +1482,7 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) { } if (b->get_button_index() == MOUSE_BUTTON_LEFT) { - if (b->is_pressed() && !b->is_doubleclick()) { + if (b->is_pressed() && !b->is_double_click()) { scroll_updated = false; ItemFrame *c_frame = nullptr; int c_line = 0; @@ -1514,8 +1514,8 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) { } } } - } else if (b->is_pressed() && b->is_doubleclick() && selection.enabled) { - //doubleclick: select word + } else if (b->is_pressed() && b->is_double_click() && selection.enabled) { + //double_click: select word ItemFrame *c_frame = nullptr; int c_line = 0; @@ -1549,7 +1549,7 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) { } else if (!b->is_pressed()) { selection.click_item = nullptr; - if (!b->is_doubleclick() && !scroll_updated) { + if (!b->is_double_click() && !scroll_updated) { Item *c_item = nullptr; bool outside = true; diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 0713df9955..ded912591f 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2903,7 +2903,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { completion_current = completion_options[completion_index]; update(); - if (mb->is_doubleclick()) { + if (mb->is_double_click()) { _confirm_completion(); } } @@ -3026,12 +3026,12 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { selection.selecting_column = col; } - if (!mb->is_doubleclick() && (OS::get_singleton()->get_ticks_msec() - last_dblclk) < 600 && cursor.line == prev_line) { + if (!mb->is_double_click() && (OS::get_singleton()->get_ticks_msec() - last_dblclk) < 600 && cursor.line == prev_line) { // Triple-click select line. selection.selecting_mode = SelectionMode::SELECTION_MODE_LINE; _update_selection_mode_line(); last_dblclk = 0; - } else if (mb->is_doubleclick() && text[cursor.line].length()) { + } else if (mb->is_double_click() && text[cursor.line].length()) { // Double-click select word. selection.selecting_mode = SelectionMode::SELECTION_MODE_WORD; _update_selection_mode_word(); diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 5fbf1bdb29..6404f6fc0d 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1866,7 +1866,7 @@ void Tree::_range_click_timeout() { } } -int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool p_doubleclick, TreeItem *p_item, int p_button, const Ref<InputEventWithModifiers> &p_mod) { +int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool p_double_click, TreeItem *p_item, int p_button, const Ref<InputEventWithModifiers> &p_mod) { int item_h = compute_item_height(p_item) + cache.vseparation; bool skip = (p_item == root && hide_root); @@ -1963,7 +1963,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool if (p_button == MOUSE_BUTTON_LEFT || (p_button == MOUSE_BUTTON_RIGHT && allow_rmb_select)) { /* process selection */ - if (p_doubleclick && (!c.editable || c.mode == TreeItem::CELL_MODE_CUSTOM || c.mode == TreeItem::CELL_MODE_ICON /*|| c.mode==TreeItem::CELL_MODE_CHECK*/)) { //it's confusing for check + if (p_double_click && (!c.editable || c.mode == TreeItem::CELL_MODE_CUSTOM || c.mode == TreeItem::CELL_MODE_ICON /*|| c.mode==TreeItem::CELL_MODE_CHECK*/)) { //it's confusing for check propagate_mouse_activated = true; @@ -2167,7 +2167,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool TreeItem *c = p_item->children; while (c) { - int child_h = propagate_mouse_event(new_pos, x_ofs, y_ofs, p_doubleclick, c, p_button, p_mod); + int child_h = propagate_mouse_event(new_pos, x_ofs, y_ofs, p_double_click, c, p_button, p_mod); if (child_h < 0) { return -1; // break, stop propagating, no need to anymore @@ -2846,7 +2846,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) { propagate_mouse_activated = false; blocked++; - propagate_mouse_event(pos + cache.offset, 0, 0, b->is_doubleclick(), root, b->get_button_index(), b); + propagate_mouse_event(pos + cache.offset, 0, 0, b->is_double_click(), root, b->get_button_index(), b); blocked--; if (pressing_for_editor) { @@ -4262,7 +4262,7 @@ void Tree::_bind_methods() { ADD_SIGNAL(MethodInfo("item_custom_button_pressed")); ADD_SIGNAL(MethodInfo("item_double_clicked")); ADD_SIGNAL(MethodInfo("item_collapsed", PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "TreeItem"))); - //ADD_SIGNAL( MethodInfo("item_doubleclicked" ) ); + //ADD_SIGNAL( MethodInfo("item_double_clicked" ) ); ADD_SIGNAL(MethodInfo("button_pressed", PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "TreeItem"), PropertyInfo(Variant::INT, "column"), PropertyInfo(Variant::INT, "id"))); ADD_SIGNAL(MethodInfo("custom_popup_edited", PropertyInfo(Variant::BOOL, "arrow_clicked"))); ADD_SIGNAL(MethodInfo("item_activated")); diff --git a/scene/gui/tree.h b/scene/gui/tree.h index d1407e24d4..a40817b752 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -390,7 +390,7 @@ private: void draw_item_rect(TreeItem::Cell &p_cell, const Rect2i &p_rect, const Color &p_color, const Color &p_icon_color, int p_ol_size, const Color &p_ol_color); int draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 &p_draw_size, TreeItem *p_item); void select_single_item(TreeItem *p_selected, TreeItem *p_current, int p_col, TreeItem *p_prev = nullptr, bool *r_in_range = nullptr, bool p_force_deselect = false); - int propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool p_doubleclick, TreeItem *p_item, int p_button, const Ref<InputEventWithModifiers> &p_mod); + int propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool p_double_click, TreeItem *p_item, int p_button, const Ref<InputEventWithModifiers> &p_mod); void _text_editor_enter(String p_text); void _text_editor_modal_close(); void value_editor_changed(double p_value); |