You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-15 13:51:40 +00:00
Do ctrl-click on any code identifier to go to definiton or help page.
This commit is contained in:
@@ -43,6 +43,17 @@
|
||||
/*** SCRIPT EDITOR ****/
|
||||
|
||||
|
||||
|
||||
void ScriptEditorBase::_bind_methods() {
|
||||
|
||||
ADD_SIGNAL(MethodInfo("name_changed"));
|
||||
ADD_SIGNAL(MethodInfo("request_help_search",PropertyInfo(Variant::STRING,"topic")));
|
||||
ADD_SIGNAL(MethodInfo("request_open_script_at_line",PropertyInfo(Variant::OBJECT,"script"),PropertyInfo(Variant::INT,"line")));
|
||||
ADD_SIGNAL(MethodInfo("request_save_history"));
|
||||
ADD_SIGNAL(MethodInfo("go_to_help",PropertyInfo(Variant::STRING,"what")));
|
||||
|
||||
}
|
||||
|
||||
static bool _can_open_in_editor(Script* p_script) {
|
||||
|
||||
String path = p_script->get_path();
|
||||
@@ -346,6 +357,34 @@ void ScriptEditor::_update_history_arrows() {
|
||||
script_forward->set_disabled( history_pos>=history.size()-1 );
|
||||
}
|
||||
|
||||
void ScriptEditor::_save_history() {
|
||||
|
||||
|
||||
if (history_pos>=0 && history_pos<history.size() && history[history_pos].control==tab_container->get_current_tab_control()) {
|
||||
|
||||
Node *n = tab_container->get_current_tab_control();
|
||||
|
||||
if (n->cast_to<ScriptEditorBase>()) {
|
||||
|
||||
history[history_pos].state=n->cast_to<ScriptEditorBase>()->get_edit_state();
|
||||
}
|
||||
if (n->cast_to<EditorHelp>()) {
|
||||
|
||||
history[history_pos].state=n->cast_to<EditorHelp>()->get_scroll();
|
||||
}
|
||||
}
|
||||
|
||||
history.resize(history_pos+1);
|
||||
ScriptHistory sh;
|
||||
sh.control=tab_container->get_current_tab_control();
|
||||
sh.state=Variant();
|
||||
|
||||
history.push_back(sh);
|
||||
history_pos++;
|
||||
|
||||
_update_history_arrows();
|
||||
}
|
||||
|
||||
|
||||
void ScriptEditor::_go_to_tab(int p_idx) {
|
||||
|
||||
@@ -1535,6 +1574,11 @@ void ScriptEditor::edit(const Ref<Script>& p_script, bool p_grab_focus) {
|
||||
_save_layout();
|
||||
se->connect("name_changed",this,"_update_script_names");
|
||||
se->connect("request_help_search",this,"_help_search");
|
||||
se->connect("request_open_script_at_line",this,"_goto_script_line");
|
||||
se->connect("go_to_help",this,"_help_class_goto");
|
||||
se->connect("request_save_history",this,"_save_history");
|
||||
|
||||
|
||||
|
||||
|
||||
//test for modification, maybe the script was not edited but was loaded
|
||||
@@ -1840,7 +1884,6 @@ void ScriptEditor::_help_class_open(const String& p_class) {
|
||||
|
||||
void ScriptEditor::_help_class_goto(const String& p_desc) {
|
||||
|
||||
|
||||
String cname=p_desc.get_slice(":",1);
|
||||
|
||||
for(int i=0;i<tab_container->get_child_count();i++) {
|
||||
@@ -2021,6 +2064,8 @@ void ScriptEditor::_bind_methods() {
|
||||
ObjectTypeDB::bind_method("_goto_script_line",&ScriptEditor::_goto_script_line);
|
||||
ObjectTypeDB::bind_method("_goto_script_line2",&ScriptEditor::_goto_script_line2);
|
||||
ObjectTypeDB::bind_method("_help_search",&ScriptEditor::_help_search);
|
||||
ObjectTypeDB::bind_method("_save_history",&ScriptEditor::_save_history);
|
||||
|
||||
|
||||
|
||||
ObjectTypeDB::bind_method("_breaked",&ScriptEditor::_breaked);
|
||||
|
||||
Reference in New Issue
Block a user