mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-22 03:46:50 +01:00
Ported from godot: Expose the TextEdit control of the script editor
Refactor ScriptEditor and ScriptTextEditor with added method to retrieve the script editor's TextEdit control.
Update
doc/classes/ScriptEditor.xml
script_editor_plugin.cpp
script_editor_plugin.h
script_text_editor.cpp
script_text_editor.h
- jeronimo-schreyer
a248c318de
This commit is contained in:
parent
4281657cf1
commit
5f4bc29d13
@ -25,6 +25,12 @@
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_base_editor" qualifiers="const">
|
||||
<return type="Control" />
|
||||
<description>
|
||||
Returns the underlying [Control] used for editing scripts. For text scripts, this is a [TextEdit].
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_current_script">
|
||||
<return type="Script" />
|
||||
<description>
|
||||
|
@ -285,6 +285,10 @@ EditorScriptEditorBase *EditorScriptEditor::_get_current_editor() const {
|
||||
return Object::cast_to<EditorScriptEditorBase>(tab_container->get_child(selected));
|
||||
}
|
||||
|
||||
Control *EditorScriptEditor::_get_base_editor() const {
|
||||
return Object::cast_to<EditorScriptTextEditor>(_get_current_editor())->get_code_editor_text_edit();
|
||||
}
|
||||
|
||||
void EditorScriptEditor::_update_history_arrows() {
|
||||
script_back->set_disabled(history_pos <= 0);
|
||||
script_forward->set_disabled(history_pos >= history.size() - 1);
|
||||
@ -3184,6 +3188,7 @@ void EditorScriptEditor::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_open_scripts"), &EditorScriptEditor::_get_open_scripts);
|
||||
ClassDB::bind_method(D_METHOD("open_script_create_dialog", "base_name", "base_path"), &EditorScriptEditor::open_script_create_dialog);
|
||||
ClassDB::bind_method(D_METHOD("reload_scripts"), &EditorScriptEditor::reload_scripts);
|
||||
ClassDB::bind_method(D_METHOD("get_base_editor"), &EditorScriptEditor::_get_base_editor);
|
||||
|
||||
ADD_SIGNAL(MethodInfo("editor_script_changed", PropertyInfo(Variant::OBJECT, "script", PROPERTY_HINT_RESOURCE_TYPE, "Script")));
|
||||
ADD_SIGNAL(MethodInfo("script_close", PropertyInfo(Variant::OBJECT, "script", PROPERTY_HINT_RESOURCE_TYPE, "Script")));
|
||||
|
@ -294,6 +294,7 @@ class EditorScriptEditor : public PanelContainer {
|
||||
void _script_created(Ref<Script> p_script);
|
||||
|
||||
EditorScriptEditorBase *_get_current_editor() const;
|
||||
Control *_get_base_editor() const;
|
||||
|
||||
void _save_layout();
|
||||
void _editor_settings_changed();
|
||||
|
@ -1283,6 +1283,10 @@ Control *EditorScriptTextEditor::get_edit_menu() {
|
||||
return edit_hb;
|
||||
}
|
||||
|
||||
Control *EditorScriptTextEditor::get_code_editor_text_edit() {
|
||||
return code_editor->get_text_edit();
|
||||
}
|
||||
|
||||
void EditorScriptTextEditor::clear_edit_menu() {
|
||||
memdelete(edit_hb);
|
||||
}
|
||||
|
@ -241,6 +241,7 @@ public:
|
||||
virtual void set_debugger_active(bool p_active);
|
||||
|
||||
Control *get_edit_menu();
|
||||
Control *get_code_editor_text_edit();
|
||||
virtual void clear_edit_menu();
|
||||
static void register_editor();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user