mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-23 12:26:59 +01:00
Now the TextEditor won't open a file multiple times, instead it will just switch to the proper tab.
This commit is contained in:
parent
1d101bfea1
commit
98e649489f
@ -11,8 +11,7 @@ def configure(env):
|
|||||||
|
|
||||||
|
|
||||||
def get_doc_classes():
|
def get_doc_classes():
|
||||||
return [
|
return []
|
||||||
]
|
|
||||||
|
|
||||||
def get_doc_path():
|
def get_doc_path():
|
||||||
return "doc_classes"
|
return "doc_classes"
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
|
|
||||||
#include "text_file_editor.h"
|
#include "text_file_editor.h"
|
||||||
|
|
||||||
#include "core/variant/array.h"
|
|
||||||
#include "core/config/engine.h"
|
#include "core/config/engine.h"
|
||||||
#include "core/math/math_defs.h"
|
#include "core/math/math_defs.h"
|
||||||
#include "core/os/dir_access.h"
|
#include "core/os/dir_access.h"
|
||||||
#include "core/os/file_access.h"
|
#include "core/os/file_access.h"
|
||||||
#include "core/os/keyboard.h"
|
#include "core/os/keyboard.h"
|
||||||
#include "core/os/os.h"
|
#include "core/os/os.h"
|
||||||
|
#include "core/variant/array.h"
|
||||||
#include "text_editor_preview.h"
|
#include "text_editor_preview.h"
|
||||||
#include "text_editor_settings.h"
|
#include "text_editor_settings.h"
|
||||||
#include "text_editor_vanilla_editor.h"
|
#include "text_editor_vanilla_editor.h"
|
||||||
@ -226,6 +226,21 @@ void TextFileEditor::_on_fileitem_pressed(const int index) {
|
|||||||
|
|
||||||
void TextFileEditor::open_file(const String &path, const String &font) {
|
void TextFileEditor::open_file(const String &path, const String &font) {
|
||||||
if (current_file_path != path) {
|
if (current_file_path != path) {
|
||||||
|
for (int i = 0; i < _open_file_list->get_item_count(); ++i) {
|
||||||
|
Array selected_item_metadata = _open_file_list->get_item_metadata(i);
|
||||||
|
|
||||||
|
Control *c = selected_item_metadata[0];
|
||||||
|
TextEditorVanillaEditor *e = Object::cast_to<TextEditorVanillaEditor>(c);
|
||||||
|
|
||||||
|
if (e) {
|
||||||
|
if (e->get_current_path() == path) {
|
||||||
|
_open_file_list->select(i);
|
||||||
|
_on_fileitem_pressed(i);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
current_file_path = path;
|
current_file_path = path;
|
||||||
TextEditorVanillaEditor *vanilla_editor = open_in_vanillaeditor(path);
|
TextEditorVanillaEditor *vanilla_editor = open_in_vanillaeditor(path);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user