2014-02-10 01:10:30 +00:00
|
|
|
/*************************************************************************/
|
|
|
|
/* settings_config_dialog.cpp */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* http://www.godotengine.org */
|
|
|
|
/*************************************************************************/
|
2017-01-01 21:01:57 +00:00
|
|
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
2014-02-10 01:10:30 +00:00
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
|
|
|
#include "settings_config_dialog.h"
|
|
|
|
#include "editor_file_system.h"
|
2016-06-05 00:31:29 +00:00
|
|
|
#include "editor_node.h"
|
2017-03-18 23:36:26 +00:00
|
|
|
#include "editor_settings.h"
|
|
|
|
#include "globals.h"
|
2016-06-05 00:31:29 +00:00
|
|
|
#include "os/keyboard.h"
|
2017-03-18 23:36:26 +00:00
|
|
|
#include "scene/gui/margin_container.h"
|
2016-06-05 00:31:29 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
void EditorSettingsDialog::ok_pressed() {
|
|
|
|
|
|
|
|
if (!EditorSettings::get_singleton())
|
|
|
|
return;
|
|
|
|
|
|
|
|
_settings_save();
|
|
|
|
timer->stop();
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorSettingsDialog::_settings_changed() {
|
|
|
|
|
|
|
|
timer->start();
|
2016-07-18 21:46:16 +00:00
|
|
|
}
|
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
void EditorSettingsDialog::_settings_property_edited(const String &p_name) {
|
2016-07-18 21:46:16 +00:00
|
|
|
|
|
|
|
String full_name = property_editor->get_full_item_path(p_name);
|
|
|
|
|
|
|
|
// Small usability workaround to update the text color settings when the
|
|
|
|
// color theme is changed
|
|
|
|
if (full_name == "text_editor/color_theme") {
|
|
|
|
property_editor->get_property_editor()->update_tree();
|
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void EditorSettingsDialog::_settings_save() {
|
|
|
|
|
|
|
|
EditorSettings::get_singleton()->notify_changes();
|
|
|
|
EditorSettings::get_singleton()->save();
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorSettingsDialog::cancel_pressed() {
|
|
|
|
|
|
|
|
if (!EditorSettings::get_singleton())
|
|
|
|
return;
|
|
|
|
|
|
|
|
EditorSettings::get_singleton()->notify_changes();
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorSettingsDialog::popup_edit_settings() {
|
|
|
|
|
|
|
|
if (!EditorSettings::get_singleton())
|
|
|
|
return;
|
|
|
|
|
2016-04-12 14:45:31 +00:00
|
|
|
EditorSettings::get_singleton()->list_text_editor_themes(); // make sure we have an up to date list of themes
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
property_editor->edit(EditorSettings::get_singleton());
|
2015-12-16 02:39:36 +00:00
|
|
|
property_editor->get_property_editor()->update_tree();
|
2015-11-21 16:42:15 +00:00
|
|
|
|
2016-01-23 19:05:27 +00:00
|
|
|
search_box->select_all();
|
|
|
|
search_box->grab_focus();
|
|
|
|
|
2016-06-05 00:31:29 +00:00
|
|
|
_update_shortcuts();
|
2014-02-10 01:10:30 +00:00
|
|
|
popup_centered_ratio(0.7);
|
|
|
|
}
|
|
|
|
|
2016-01-23 19:05:27 +00:00
|
|
|
void EditorSettingsDialog::_clear_search_box() {
|
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
if (search_box->get_text() == "")
|
2016-01-23 19:05:27 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
search_box->clear();
|
|
|
|
property_editor->get_property_editor()->update_tree();
|
|
|
|
}
|
|
|
|
|
2016-07-03 13:07:16 +00:00
|
|
|
void EditorSettingsDialog::_clear_shortcut_search_box() {
|
2017-03-18 23:36:26 +00:00
|
|
|
if (shortcut_search_box->get_text() == "")
|
2016-07-03 13:07:16 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
shortcut_search_box->clear();
|
|
|
|
}
|
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
void EditorSettingsDialog::_filter_shortcuts(const String &p_filter) {
|
2016-07-03 13:07:16 +00:00
|
|
|
shortcut_filter = p_filter;
|
|
|
|
_update_shortcuts();
|
|
|
|
}
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
void EditorSettingsDialog::_notification(int p_what) {
|
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
if (p_what == NOTIFICATION_ENTER_TREE) {
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
clear_button->set_icon(get_icon("Close", "EditorIcons"));
|
|
|
|
shortcut_clear_button->set_icon(get_icon("Close", "EditorIcons"));
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-05 00:31:29 +00:00
|
|
|
void EditorSettingsDialog::_update_shortcuts() {
|
|
|
|
|
|
|
|
shortcuts->clear();
|
|
|
|
|
|
|
|
List<String> slist;
|
|
|
|
EditorSettings::get_singleton()->get_shortcut_list(&slist);
|
|
|
|
TreeItem *root = shortcuts->create_item();
|
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
Map<String, TreeItem *> sections;
|
2016-06-05 00:31:29 +00:00
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
for (List<String>::Element *E = slist.front(); E; E = E->next()) {
|
2016-06-05 00:31:29 +00:00
|
|
|
|
|
|
|
Ref<ShortCut> sc = EditorSettings::get_singleton()->get_shortcut(E->get());
|
|
|
|
if (!sc->has_meta("original"))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
InputEvent original = sc->get_meta("original");
|
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
String section_name = E->get().get_slice("/", 0);
|
2016-06-05 00:31:29 +00:00
|
|
|
|
|
|
|
TreeItem *section;
|
|
|
|
|
|
|
|
if (sections.has(section_name)) {
|
2017-03-18 23:36:26 +00:00
|
|
|
section = sections[section_name];
|
2016-06-05 00:31:29 +00:00
|
|
|
} else {
|
|
|
|
section = shortcuts->create_item(root);
|
2017-03-18 23:36:26 +00:00
|
|
|
section->set_text(0, section_name.capitalize());
|
2016-06-05 00:31:29 +00:00
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
sections[section_name] = section;
|
|
|
|
section->set_custom_bg_color(0, get_color("prop_subsection", "Editor"));
|
|
|
|
section->set_custom_bg_color(1, get_color("prop_subsection", "Editor"));
|
2016-06-05 00:31:29 +00:00
|
|
|
}
|
|
|
|
|
2016-07-03 13:07:16 +00:00
|
|
|
if (shortcut_filter.is_subsequence_ofi(sc->get_name())) {
|
|
|
|
TreeItem *item = shortcuts->create_item(section);
|
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
item->set_text(0, sc->get_name());
|
|
|
|
item->set_text(1, sc->get_as_text());
|
|
|
|
if (!sc->is_shortcut(original) && !(sc->get_shortcut().type == InputEvent::NONE && original.type == InputEvent::NONE)) {
|
|
|
|
item->add_button(1, get_icon("Reload", "EditorIcons"), 2);
|
2016-07-03 13:07:16 +00:00
|
|
|
}
|
2017-03-18 23:36:26 +00:00
|
|
|
item->add_button(1, get_icon("Edit", "EditorIcons"), 0);
|
|
|
|
item->add_button(1, get_icon("Close", "EditorIcons"), 1);
|
|
|
|
item->set_tooltip(0, E->get());
|
|
|
|
item->set_metadata(0, E->get());
|
2016-06-05 00:31:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-03 13:07:16 +00:00
|
|
|
// remove sections with no shortcuts
|
2017-03-18 23:36:26 +00:00
|
|
|
for (Map<String, TreeItem *>::Element *E = sections.front(); E; E = E->next()) {
|
2016-07-03 13:07:16 +00:00
|
|
|
TreeItem *section = E->get();
|
|
|
|
if (section->get_children() == NULL) {
|
|
|
|
root->remove_child(section);
|
|
|
|
}
|
|
|
|
}
|
2016-06-05 00:31:29 +00:00
|
|
|
}
|
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
void EditorSettingsDialog::_shortcut_button_pressed(Object *p_item, int p_column, int p_idx) {
|
2016-06-05 00:31:29 +00:00
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
TreeItem *ti = p_item->cast_to<TreeItem>();
|
2016-06-05 00:31:29 +00:00
|
|
|
ERR_FAIL_COND(!ti);
|
|
|
|
|
|
|
|
String item = ti->get_metadata(0);
|
|
|
|
Ref<ShortCut> sc = EditorSettings::get_singleton()->get_shortcut(item);
|
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
if (p_idx == 0) {
|
2016-06-05 00:31:29 +00:00
|
|
|
press_a_key_label->set_text(TTR("Press a Key.."));
|
2017-03-18 23:36:26 +00:00
|
|
|
last_wait_for_key = InputEvent();
|
|
|
|
press_a_key->popup_centered(Size2(250, 80) * EDSCALE);
|
2016-06-05 00:31:29 +00:00
|
|
|
press_a_key->grab_focus();
|
|
|
|
press_a_key->get_ok()->set_focus_mode(FOCUS_NONE);
|
|
|
|
press_a_key->get_cancel()->set_focus_mode(FOCUS_NONE);
|
2017-03-18 23:36:26 +00:00
|
|
|
shortcut_configured = item;
|
2016-06-05 00:31:29 +00:00
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
} else if (p_idx == 1) { //erase
|
2016-06-05 00:31:29 +00:00
|
|
|
if (!sc.is_valid())
|
|
|
|
return; //pointless, there is nothing
|
|
|
|
|
|
|
|
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
|
|
|
|
ur->create_action("Erase Shortcut");
|
2017-03-18 23:36:26 +00:00
|
|
|
ur->add_do_method(sc.ptr(), "set_shortcut", InputEvent());
|
|
|
|
ur->add_undo_method(sc.ptr(), "set_shortcut", sc->get_shortcut());
|
|
|
|
ur->add_do_method(this, "_update_shortcuts");
|
|
|
|
ur->add_undo_method(this, "_update_shortcuts");
|
|
|
|
ur->add_do_method(this, "_settings_changed");
|
|
|
|
ur->add_undo_method(this, "_settings_changed");
|
2016-06-05 00:31:29 +00:00
|
|
|
ur->commit_action();
|
2017-03-18 23:36:26 +00:00
|
|
|
} else if (p_idx == 2) { //revert to original
|
2016-06-05 00:31:29 +00:00
|
|
|
if (!sc.is_valid())
|
|
|
|
return; //pointless, there is nothing
|
|
|
|
|
|
|
|
InputEvent original = sc->get_meta("original");
|
|
|
|
|
|
|
|
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
|
|
|
|
ur->create_action("Restore Shortcut");
|
2017-03-18 23:36:26 +00:00
|
|
|
ur->add_do_method(sc.ptr(), "set_shortcut", original);
|
|
|
|
ur->add_undo_method(sc.ptr(), "set_shortcut", sc->get_shortcut());
|
|
|
|
ur->add_do_method(this, "_update_shortcuts");
|
|
|
|
ur->add_undo_method(this, "_update_shortcuts");
|
|
|
|
ur->add_do_method(this, "_settings_changed");
|
|
|
|
ur->add_undo_method(this, "_settings_changed");
|
2016-06-05 00:31:29 +00:00
|
|
|
ur->commit_action();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
void EditorSettingsDialog::_wait_for_key(const InputEvent &p_event) {
|
2016-06-05 00:31:29 +00:00
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
if (p_event.type == InputEvent::KEY && p_event.key.pressed && p_event.key.scancode != 0) {
|
2016-06-05 00:31:29 +00:00
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
last_wait_for_key = p_event;
|
|
|
|
String str = keycode_get_string(p_event.key.scancode).capitalize();
|
2016-06-05 00:31:29 +00:00
|
|
|
if (p_event.key.mod.meta)
|
2017-03-18 23:36:26 +00:00
|
|
|
str = TTR("Meta+") + str;
|
2016-06-05 00:31:29 +00:00
|
|
|
if (p_event.key.mod.shift)
|
2017-03-18 23:36:26 +00:00
|
|
|
str = TTR("Shift+") + str;
|
2016-06-05 00:31:29 +00:00
|
|
|
if (p_event.key.mod.alt)
|
2017-03-18 23:36:26 +00:00
|
|
|
str = TTR("Alt+") + str;
|
2016-06-05 00:31:29 +00:00
|
|
|
if (p_event.key.mod.control)
|
2017-03-18 23:36:26 +00:00
|
|
|
str = TTR("Control+") + str;
|
2016-06-05 00:31:29 +00:00
|
|
|
|
|
|
|
press_a_key_label->set_text(str);
|
|
|
|
press_a_key->accept_event();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorSettingsDialog::_press_a_key_confirm() {
|
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
if (last_wait_for_key.type != InputEvent::KEY)
|
2016-06-05 00:31:29 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
InputEvent ie;
|
2017-03-18 23:36:26 +00:00
|
|
|
ie.type = InputEvent::KEY;
|
|
|
|
ie.key.scancode = last_wait_for_key.key.scancode;
|
|
|
|
ie.key.mod = last_wait_for_key.key.mod;
|
2016-06-05 00:31:29 +00:00
|
|
|
|
|
|
|
Ref<ShortCut> sc = EditorSettings::get_singleton()->get_shortcut(shortcut_configured);
|
|
|
|
|
|
|
|
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
|
2017-03-18 23:36:26 +00:00
|
|
|
ur->create_action("Change Shortcut '" + shortcut_configured + "'");
|
|
|
|
ur->add_do_method(sc.ptr(), "set_shortcut", ie);
|
|
|
|
ur->add_undo_method(sc.ptr(), "set_shortcut", sc->get_shortcut());
|
|
|
|
ur->add_do_method(this, "_update_shortcuts");
|
|
|
|
ur->add_undo_method(this, "_update_shortcuts");
|
|
|
|
ur->add_do_method(this, "_settings_changed");
|
|
|
|
ur->add_undo_method(this, "_settings_changed");
|
2016-06-05 00:31:29 +00:00
|
|
|
ur->commit_action();
|
|
|
|
}
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
void EditorSettingsDialog::_bind_methods() {
|
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
ObjectTypeDB::bind_method(_MD("_settings_save"), &EditorSettingsDialog::_settings_save);
|
|
|
|
ObjectTypeDB::bind_method(_MD("_settings_changed"), &EditorSettingsDialog::_settings_changed);
|
|
|
|
ObjectTypeDB::bind_method(_MD("_settings_property_edited"), &EditorSettingsDialog::_settings_property_edited);
|
|
|
|
ObjectTypeDB::bind_method(_MD("_clear_search_box"), &EditorSettingsDialog::_clear_search_box);
|
|
|
|
ObjectTypeDB::bind_method(_MD("_clear_shortcut_search_box"), &EditorSettingsDialog::_clear_shortcut_search_box);
|
|
|
|
ObjectTypeDB::bind_method(_MD("_shortcut_button_pressed"), &EditorSettingsDialog::_shortcut_button_pressed);
|
|
|
|
ObjectTypeDB::bind_method(_MD("_filter_shortcuts"), &EditorSettingsDialog::_filter_shortcuts);
|
|
|
|
ObjectTypeDB::bind_method(_MD("_update_shortcuts"), &EditorSettingsDialog::_update_shortcuts);
|
|
|
|
ObjectTypeDB::bind_method(_MD("_press_a_key_confirm"), &EditorSettingsDialog::_press_a_key_confirm);
|
|
|
|
ObjectTypeDB::bind_method(_MD("_wait_for_key"), &EditorSettingsDialog::_wait_for_key);
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
EditorSettingsDialog::EditorSettingsDialog() {
|
|
|
|
|
2016-05-04 01:25:37 +00:00
|
|
|
set_title(TTR("Editor Settings"));
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
tabs = memnew(TabContainer);
|
2014-02-10 01:10:30 +00:00
|
|
|
add_child(tabs);
|
|
|
|
set_child_rect(tabs);
|
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
VBoxContainer *vbc = memnew(VBoxContainer);
|
2016-01-23 19:05:27 +00:00
|
|
|
tabs->add_child(vbc);
|
2016-05-04 01:25:37 +00:00
|
|
|
vbc->set_name(TTR("General"));
|
2016-01-23 19:05:27 +00:00
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
HBoxContainer *hbc = memnew(HBoxContainer);
|
2016-01-23 19:05:27 +00:00
|
|
|
hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
|
|
|
vbc->add_child(hbc);
|
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
Label *l = memnew(Label);
|
|
|
|
l->set_text(TTR("Search:") + " ");
|
2016-01-23 19:05:27 +00:00
|
|
|
hbc->add_child(l);
|
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
search_box = memnew(LineEdit);
|
2016-01-23 19:05:27 +00:00
|
|
|
search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
|
|
|
hbc->add_child(search_box);
|
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
clear_button = memnew(ToolButton);
|
2016-01-23 19:05:27 +00:00
|
|
|
hbc->add_child(clear_button);
|
2017-03-18 23:36:26 +00:00
|
|
|
clear_button->connect("pressed", this, "_clear_search_box");
|
2016-01-23 19:05:27 +00:00
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
property_editor = memnew(SectionedPropertyEditor);
|
2015-12-16 02:39:36 +00:00
|
|
|
//property_editor->hide_top_label();
|
2016-01-23 19:05:27 +00:00
|
|
|
property_editor->get_property_editor()->set_use_filter(true);
|
|
|
|
property_editor->get_property_editor()->register_text_enter(search_box);
|
2015-11-21 16:42:15 +00:00
|
|
|
property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
2016-01-23 19:05:27 +00:00
|
|
|
vbc->add_child(property_editor);
|
2016-07-18 21:46:16 +00:00
|
|
|
property_editor->get_property_editor()->connect("property_edited", this, "_settings_property_edited");
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
vbc = memnew(VBoxContainer);
|
2014-02-10 01:10:30 +00:00
|
|
|
tabs->add_child(vbc);
|
2016-06-05 00:31:29 +00:00
|
|
|
vbc->set_name(TTR("Shortcuts"));
|
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
hbc = memnew(HBoxContainer);
|
2016-07-03 13:07:16 +00:00
|
|
|
hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
|
|
|
vbc->add_child(hbc);
|
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
l = memnew(Label);
|
|
|
|
l->set_text(TTR("Search:") + " ");
|
2016-07-03 13:07:16 +00:00
|
|
|
hbc->add_child(l);
|
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
shortcut_search_box = memnew(LineEdit);
|
2016-07-03 13:07:16 +00:00
|
|
|
shortcut_search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
|
|
|
hbc->add_child(shortcut_search_box);
|
|
|
|
shortcut_search_box->connect("text_changed", this, "_filter_shortcuts");
|
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
shortcut_clear_button = memnew(ToolButton);
|
2016-07-03 13:07:16 +00:00
|
|
|
hbc->add_child(shortcut_clear_button);
|
2017-03-18 23:36:26 +00:00
|
|
|
shortcut_clear_button->connect("pressed", this, "_clear_shortcut_search_box");
|
2016-07-03 13:07:16 +00:00
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
shortcuts = memnew(Tree);
|
|
|
|
vbc->add_margin_child("Shortcut List:", shortcuts, true);
|
2016-06-05 00:31:29 +00:00
|
|
|
shortcuts->set_columns(2);
|
|
|
|
shortcuts->set_hide_root(true);
|
|
|
|
//shortcuts->set_hide_folding(true);
|
|
|
|
shortcuts->set_column_titles_visible(true);
|
2017-03-18 23:36:26 +00:00
|
|
|
shortcuts->set_column_title(0, "Name");
|
|
|
|
shortcuts->set_column_title(1, "Binding");
|
|
|
|
shortcuts->connect("button_pressed", this, "_shortcut_button_pressed");
|
2016-06-05 00:31:29 +00:00
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
press_a_key = memnew(ConfirmationDialog);
|
2016-06-05 00:31:29 +00:00
|
|
|
press_a_key->set_focus_mode(FOCUS_ALL);
|
|
|
|
add_child(press_a_key);
|
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
l = memnew(Label);
|
2016-06-05 00:31:29 +00:00
|
|
|
l->set_text(TTR("Press a Key.."));
|
|
|
|
l->set_area_as_parent_rect();
|
|
|
|
l->set_align(Label::ALIGN_CENTER);
|
2017-03-18 23:36:26 +00:00
|
|
|
l->set_margin(MARGIN_TOP, 20);
|
|
|
|
l->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_BEGIN, 30);
|
|
|
|
press_a_key_label = l;
|
2016-06-05 00:31:29 +00:00
|
|
|
press_a_key->add_child(l);
|
2017-03-18 23:36:26 +00:00
|
|
|
press_a_key->connect("input_event", this, "_wait_for_key");
|
|
|
|
press_a_key->connect("confirmed", this, "_press_a_key_confirm");
|
2016-02-05 23:05:34 +00:00
|
|
|
//Button *load = memnew( Button );
|
2016-06-05 00:31:29 +00:00
|
|
|
|
2016-05-18 22:08:12 +00:00
|
|
|
//load->set_text("Load..");
|
2016-02-05 23:05:34 +00:00
|
|
|
//hbc->add_child(load);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2016-05-18 22:08:12 +00:00
|
|
|
//get_ok()->set_text("Apply");
|
2014-02-10 01:10:30 +00:00
|
|
|
set_hide_on_ok(true);
|
2016-05-18 22:08:12 +00:00
|
|
|
//get_cancel()->set_text("Close");
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
timer = memnew(Timer);
|
2014-02-10 01:10:30 +00:00
|
|
|
timer->set_wait_time(1.5);
|
2017-03-18 23:36:26 +00:00
|
|
|
timer->connect("timeout", this, "_settings_save");
|
2014-02-10 01:10:30 +00:00
|
|
|
timer->set_one_shot(true);
|
|
|
|
add_child(timer);
|
2017-03-18 23:36:26 +00:00
|
|
|
EditorSettings::get_singleton()->connect("settings_changed", this, "_settings_changed");
|
2016-05-04 01:25:37 +00:00
|
|
|
get_ok()->set_text(TTR("Close"));
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-18 23:36:26 +00:00
|
|
|
updating = false;
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|