mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-11 13:21:10 +01:00
Ported: Add an option to drag'n'drop selected text in TextEdit - ConteZero
a13b3028a2
This commit is contained in:
parent
38d7f8dac8
commit
648b9fce40
@ -495,6 +495,9 @@
|
||||
<member name="deselect_on_focus_loss_enabled" type="bool" setter="set_deselect_on_focus_loss_enabled" getter="is_deselect_on_focus_loss_enabled" default="true">
|
||||
If [code]true[/code], the selected text will be deselected when focus is lost.
|
||||
</member>
|
||||
<member name="drag_and_drop_selection_enabled" type="bool" setter="set_drag_and_drop_selection_enabled" getter="is_drag_and_drop_selection_enabled" default="true">
|
||||
If [code]true[/code], allow drag and drop of selected text.
|
||||
</member>
|
||||
<member name="draw_spaces" type="bool" setter="set_draw_spaces" getter="is_drawing_spaces" default="false">
|
||||
If [code]true[/code], the "space" character will have a visible representation.
|
||||
</member>
|
||||
|
@ -948,6 +948,7 @@ void CodeTextEditor::update_editor_settings() {
|
||||
text_editor->set_v_scroll_speed(EditorSettings::get_singleton()->get("text_editor/navigation/v_scroll_speed"));
|
||||
text_editor->set_draw_minimap(EditorSettings::get_singleton()->get("text_editor/navigation/show_minimap"));
|
||||
text_editor->set_minimap_width((int)EditorSettings::get_singleton()->get("text_editor/navigation/minimap_width") * EDSCALE);
|
||||
text_editor->set_drag_and_drop_selection_enabled(EditorSettings::get_singleton()->get("text_editor/navigation/drag_and_drop_selection"));
|
||||
text_editor->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/appearance/show_line_numbers"));
|
||||
text_editor->set_line_numbers_zero_padded(EditorSettings::get_singleton()->get("text_editor/appearance/line_numbers_zero_padded"));
|
||||
text_editor->set_bookmark_gutter_enabled(EditorSettings::get_singleton()->get("text_editor/appearance/show_bookmark_gutter"));
|
||||
|
@ -453,6 +453,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
||||
_initial_set("text_editor/navigation/minimap_width", 80);
|
||||
hints["text_editor/navigation/minimap_width"] = PropertyInfo(Variant::INT, "text_editor/navigation/minimap_width", PROPERTY_HINT_RANGE, "50,250,1");
|
||||
_initial_set("text_editor/navigation/mouse_extra_buttons_navigate_history", true);
|
||||
_initial_set("text_editor/navigation/drag_and_drop_selection", true);
|
||||
|
||||
// Appearance
|
||||
_initial_set("text_editor/appearance/show_line_numbers", true);
|
||||
|
@ -2580,7 +2580,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
||||
update();
|
||||
}
|
||||
|
||||
} else if (is_mouse_over_selection()) {
|
||||
} else if (drag_and_drop_selection_enabled && is_mouse_over_selection()) {
|
||||
selection.selecting_mode = Selection::MODE_NONE;
|
||||
selection.drag_attempt = true;
|
||||
} else {
|
||||
@ -7339,6 +7339,14 @@ bool TextEdit::is_deselect_on_focus_loss_enabled() const {
|
||||
return deselect_on_focus_loss_enabled;
|
||||
}
|
||||
|
||||
void TextEdit::set_drag_and_drop_selection_enabled(const bool p_enabled) {
|
||||
drag_and_drop_selection_enabled = p_enabled;
|
||||
}
|
||||
|
||||
bool TextEdit::is_drag_and_drop_selection_enabled() const {
|
||||
return drag_and_drop_selection_enabled;
|
||||
}
|
||||
|
||||
bool TextEdit::is_shortcut_keys_enabled() const {
|
||||
return shortcut_keys_enabled;
|
||||
}
|
||||
@ -7449,6 +7457,8 @@ void TextEdit::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("is_selecting_enabled"), &TextEdit::is_selecting_enabled);
|
||||
ClassDB::bind_method(D_METHOD("set_deselect_on_focus_loss_enabled", "enable"), &TextEdit::set_deselect_on_focus_loss_enabled);
|
||||
ClassDB::bind_method(D_METHOD("is_deselect_on_focus_loss_enabled"), &TextEdit::is_deselect_on_focus_loss_enabled);
|
||||
ClassDB::bind_method(D_METHOD("set_drag_and_drop_selection_enabled", "enable"), &TextEdit::set_drag_and_drop_selection_enabled);
|
||||
ClassDB::bind_method(D_METHOD("is_drag_and_drop_selection_enabled"), &TextEdit::is_drag_and_drop_selection_enabled);
|
||||
ClassDB::bind_method(D_METHOD("is_line_set_as_safe", "line"), &TextEdit::is_line_set_as_safe);
|
||||
ClassDB::bind_method(D_METHOD("set_line_as_safe", "line", "safe"), &TextEdit::set_line_as_safe);
|
||||
ClassDB::bind_method(D_METHOD("is_line_set_as_bookmark", "line"), &TextEdit::is_line_set_as_bookmark);
|
||||
@ -7562,6 +7572,7 @@ void TextEdit::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "virtual_keyboard_enabled"), "set_virtual_keyboard_enabled", "is_virtual_keyboard_enabled");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "selecting_enabled"), "set_selecting_enabled", "is_selecting_enabled");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "deselect_on_focus_loss_enabled"), "set_deselect_on_focus_loss_enabled", "is_deselect_on_focus_loss_enabled");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "drag_and_drop_selection_enabled"), "set_drag_and_drop_selection_enabled", "is_drag_and_drop_selection_enabled");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smooth_scrolling"), "set_smooth_scroll_enable", "is_smooth_scroll_enabled");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "v_scroll_speed"), "set_v_scroll_speed", "get_v_scroll_speed");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "hiding_enabled"), "set_hiding_enabled", "is_hiding_enabled");
|
||||
@ -7731,6 +7742,7 @@ TextEdit::TextEdit() {
|
||||
|
||||
selecting_enabled = true;
|
||||
deselect_on_focus_loss_enabled = true;
|
||||
drag_and_drop_selection_enabled = true;
|
||||
popup_show = false;
|
||||
context_menu_enabled = true;
|
||||
shortcut_keys_enabled = true;
|
||||
|
@ -438,6 +438,7 @@ private:
|
||||
|
||||
bool selecting_enabled;
|
||||
bool deselect_on_focus_loss_enabled;
|
||||
bool drag_and_drop_selection_enabled;
|
||||
bool popup_show;
|
||||
|
||||
bool context_menu_enabled;
|
||||
@ -760,6 +761,7 @@ public:
|
||||
bool is_drawing_tabs() const;
|
||||
void set_draw_spaces(bool p_draw);
|
||||
bool is_drawing_spaces() const;
|
||||
|
||||
void set_override_selected_font_color(bool p_override_selected_font_color);
|
||||
bool is_overriding_selected_font_color() const;
|
||||
|
||||
@ -859,6 +861,9 @@ public:
|
||||
void set_deselect_on_focus_loss_enabled(const bool p_enabled);
|
||||
bool is_deselect_on_focus_loss_enabled() const;
|
||||
|
||||
void set_drag_and_drop_selection_enabled(const bool p_enabled);
|
||||
bool is_drag_and_drop_selection_enabled() const;
|
||||
|
||||
void set_shortcut_keys_enabled(bool p_enabled);
|
||||
bool is_shortcut_keys_enabled() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user