summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorPaulb23 <p_batty@hotmail.co.uk>2021-07-10 11:41:38 +0100
committerPaulb23 <p_batty@hotmail.co.uk>2021-08-12 11:43:35 +0100
commitae4dcb89182c44c923f8aac29855bebc701a237f (patch)
tree96d761996affa115d911b5e65af0d89c6d7395aa /editor/plugins
parent0a32a6907b4c6801e0b9d22057863c01fd25a3cd (diff)
Cleanup and bind remaing methods in TextEdit
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/script_text_editor.cpp17
-rw-r--r--editor/plugins/shader_editor_plugin.cpp6
-rw-r--r--editor/plugins/text_editor.cpp6
3 files changed, 18 insertions, 11 deletions
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 6d2b22c46c..8cd746304c 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -241,7 +241,7 @@ void ScriptTextEditor::_warning_clicked(Variant p_line) {
goto_line_centered(p_line.operator int64_t());
} else if (p_line.get_type() == Variant::DICTIONARY) {
Dictionary meta = p_line.operator Dictionary();
- code_editor->get_text_editor()->insert_at("# warning-ignore:" + meta["code"].operator String(), meta["line"].operator int64_t() - 1);
+ code_editor->get_text_editor()->insert_line_at(meta["line"].operator int64_t() - 1, "# warning-ignore:" + meta["code"].operator String());
_validate_script();
}
}
@@ -884,7 +884,7 @@ void ScriptTextEditor::update_toggle_scripts_button() {
void ScriptTextEditor::_update_connected_methods() {
CodeEdit *text_edit = code_editor->get_text_editor();
- text_edit->set_gutter_width(connection_gutter, text_edit->get_row_height());
+ text_edit->set_gutter_width(connection_gutter, text_edit->get_line_height());
for (int i = 0; i < text_edit->get_line_count(); i++) {
if (text_edit->get_line_gutter_metadata(i, connection_gutter) == "") {
continue;
@@ -1325,7 +1325,7 @@ void ScriptTextEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_THEME_CHANGED:
case NOTIFICATION_ENTER_TREE: {
- code_editor->get_text_editor()->set_gutter_width(connection_gutter, code_editor->get_text_editor()->get_row_height());
+ code_editor->get_text_editor()->set_gutter_width(connection_gutter, code_editor->get_text_editor()->get_line_height());
} break;
default:
break;
@@ -1422,8 +1422,10 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
Dictionary d = p_data;
CodeEdit *te = code_editor->get_text_editor();
- int row, col;
- te->_get_mouse_pos(p_point, row, col);
+
+ Point2i pos = te->get_line_column_at_pos(p_point);
+ int row = pos.y;
+ int col = pos.x;
if (d.has("type") && String(d["type"]) == "resource") {
Ref<Resource> res = d["resource"];
@@ -1512,8 +1514,9 @@ void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
}
if (create_menu) {
- int col, row;
- tx->_get_mouse_pos(local_pos, row, col);
+ Point2i pos = tx->get_line_column_at_pos(local_pos);
+ int row = pos.y;
+ int col = pos.x;
tx->set_move_caret_on_right_click_enabled(EditorSettings::get_singleton()->get("text_editor/cursor/right_click_moves_caret"));
if (tx->is_move_caret_on_right_click_enabled()) {
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 00890227cb..29436e32b2 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -550,9 +550,11 @@ void ShaderEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
if (mb.is_valid()) {
if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed()) {
- int col, row;
CodeEdit *tx = shader_editor->get_text_editor();
- tx->_get_mouse_pos(mb->get_global_position() - tx->get_global_position(), row, col);
+
+ Point2i pos = tx->get_line_column_at_pos(mb->get_global_position() - tx->get_global_position());
+ int row = pos.y;
+ int col = pos.x;
tx->set_move_caret_on_right_click_enabled(EditorSettings::get_singleton()->get("text_editor/cursor/right_click_moves_caret"));
if (tx->is_move_caret_on_right_click_enabled()) {
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp
index f38bb6e996..cfccf90499 100644
--- a/editor/plugins/text_editor.cpp
+++ b/editor/plugins/text_editor.cpp
@@ -427,9 +427,11 @@ void TextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
if (mb.is_valid()) {
if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
- int col, row;
CodeEdit *tx = code_editor->get_text_editor();
- tx->_get_mouse_pos(mb->get_global_position() - tx->get_global_position(), row, col);
+
+ Point2i pos = tx->get_line_column_at_pos(mb->get_global_position() - tx->get_global_position());
+ int row = pos.y;
+ int col = pos.x;
tx->set_move_caret_on_right_click_enabled(EditorSettings::get_singleton()->get("text_editor/cursor/right_click_moves_caret"));
bool can_fold = tx->can_fold_line(row);