summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/code_editor.cpp28
-rw-r--r--tools/editor/code_editor.h5
-rw-r--r--tools/editor/editor_node.cpp6
-rw-r--r--tools/editor/editor_themes.cpp13
-rw-r--r--tools/editor/editor_themes.h4
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp1
-rw-r--r--tools/editor/project_manager.cpp4
7 files changed, 39 insertions, 22 deletions
diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp
index 2779275ea8..9bf7d05ae8 100644
--- a/tools/editor/code_editor.cpp
+++ b/tools/editor/code_editor.cpp
@@ -356,7 +356,7 @@ void FindReplaceBar::_show_search() {
show();
search_text->grab_focus();
- if (text_edit->is_selection_active()) {
+ if (text_edit->is_selection_active() && !selection_only->is_pressed()) {
search_text->set_text(text_edit->get_selection_text());
}
@@ -376,12 +376,16 @@ void FindReplaceBar::popup_search() {
void FindReplaceBar::popup_replace() {
+
if (!replace_hbc->is_visible() || !replace_options_hbc->is_visible()) {
replace_text->clear();
replace_hbc->show();
replace_options_hbc->show();
+
}
+ selection_only->set_pressed( (text_edit->is_selection_active() && text_edit->get_selection_from_line() < text_edit->get_selection_to_line()) );
+
_show_search();
}
@@ -409,6 +413,14 @@ void FindReplaceBar::_search_text_entered(const String& p_text) {
search_next();
}
+void FindReplaceBar::_replace_text_entered(const String& p_text) {
+
+ if (selection_only->is_pressed() && text_edit->is_selection_active()) {
+ _replace_all();
+ _hide_bar();
+ }
+}
+
String FindReplaceBar::get_search_text() const {
return search_text->get_text();
@@ -452,6 +464,7 @@ void FindReplaceBar::_bind_methods() {
ObjectTypeDB::bind_method("_editor_text_changed",&FindReplaceBar::_editor_text_changed);
ObjectTypeDB::bind_method("_search_text_changed",&FindReplaceBar::_search_text_changed);
ObjectTypeDB::bind_method("_search_text_entered",&FindReplaceBar::_search_text_entered);
+ ObjectTypeDB::bind_method("_replace_text_entered",&FindReplaceBar::_replace_text_entered);
ObjectTypeDB::bind_method("_search_current",&FindReplaceBar::search_current);
ObjectTypeDB::bind_method("_search_next",&FindReplaceBar::search_next);
ObjectTypeDB::bind_method("_search_prev",&FindReplaceBar::search_prev);
@@ -497,18 +510,19 @@ FindReplaceBar::FindReplaceBar() {
replace_text = memnew(LineEdit);
replace_hbc->add_child(replace_text);
replace_text->set_custom_minimum_size(Size2(200, 0));
- replace_text->connect("text_entered",this,"_search_text_entered");
+ replace_text->connect("text_entered",this,"_replace_text_entered");
+
- replace = memnew(ToolButton);
+ replace = memnew(Button);
replace_hbc->add_child(replace);
replace->set_text(TTR("Replace"));
- replace->set_focus_mode(FOCUS_NONE);
+ //replace->set_focus_mode(FOCUS_NONE);
replace->connect("pressed",this,"_replace_pressed");
- replace_all = memnew(ToolButton);
+ replace_all = memnew(Button);
replace_hbc->add_child(replace_all);
replace_all->set_text(TTR("Replace All"));
- replace_all->set_focus_mode(FOCUS_NONE);
+ //replace_all->set_focus_mode(FOCUS_NONE);
replace_all->connect("pressed",this,"_replace_all_pressed");
Control *spacer_split = memnew( Control );
@@ -581,8 +595,10 @@ void FindReplaceDialog::popup_search() {
void FindReplaceDialog::popup_replace() {
+
set_title(TTR("Replace"));
bool do_selection=(text_edit->is_selection_active() && text_edit->get_selection_from_line() < text_edit->get_selection_to_line());
+
set_replace_selection_only(do_selection);
if (!do_selection && text_edit->is_selection_active()) {
diff --git a/tools/editor/code_editor.h b/tools/editor/code_editor.h
index 2affa31482..6f59dda1ee 100644
--- a/tools/editor/code_editor.h
+++ b/tools/editor/code_editor.h
@@ -73,8 +73,8 @@ class FindReplaceBar : public HBoxContainer {
TextureButton *hide_button;
LineEdit *replace_text;
- ToolButton *replace;
- ToolButton *replace_all;
+ Button *replace;
+ Button *replace_all;
CheckBox *selection_only;
VBoxContainer *text_vbc;
@@ -98,6 +98,7 @@ class FindReplaceBar : public HBoxContainer {
void _search_options_changed(bool p_pressed);
void _search_text_changed(const String& p_text);
void _search_text_entered(const String& p_text);
+ void _replace_text_entered(const String& p_text);
protected:
void _notification(int p_what);
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 86b814c610..e88a155d95 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -5419,9 +5419,9 @@ EditorNode::EditorNode() {
theme_base->add_child(gui_base);
gui_base->set_area_as_parent_rect();
- theme_base->set_theme( create_default_theme() );
- theme = create_editor_theme();
- gui_base->set_theme(theme);
+ Ref<Theme> theme = create_editor_theme();
+ theme_base->set_theme( theme );
+ gui_base->set_theme(create_custom_theme());
resource_preview = memnew( EditorResourcePreview );
add_child(resource_preview);
diff --git a/tools/editor/editor_themes.cpp b/tools/editor/editor_themes.cpp
index 7130044490..80ba4c46e0 100644
--- a/tools/editor/editor_themes.cpp
+++ b/tools/editor/editor_themes.cpp
@@ -33,7 +33,7 @@
#include "editor_settings.h"
#include "core/io/resource_loader.h"
-Ref<Theme> create_default_theme()
+Ref<Theme> create_editor_theme()
{
Ref<Theme> theme = Ref<Theme>( memnew( Theme ) );
@@ -57,23 +57,22 @@ Ref<Theme> create_default_theme()
return theme;
}
-Ref<Theme> create_editor_theme()
+Ref<Theme> create_custom_theme()
{
- Ref<Theme> theme = NULL;
+ Ref<Theme> theme;
String custom_theme = EditorSettings::get_singleton()->get("global/custom_theme");
if (custom_theme!="") {
theme = ResourceLoader::load(custom_theme);
}
- if (theme.is_null() || !theme.is_valid()) {
- theme = create_default_theme();
- }
-
String global_font = EditorSettings::get_singleton()->get("global/custom_font");
if (global_font!="") {
Ref<Font> fnt = ResourceLoader::load(global_font);
if (fnt.is_valid()) {
+ if (!theme.is_valid()) {
+ theme.instance();
+ }
theme->set_default_theme_font(fnt);
}
}
diff --git a/tools/editor/editor_themes.h b/tools/editor/editor_themes.h
index dbff8b3079..db49801600 100644
--- a/tools/editor/editor_themes.h
+++ b/tools/editor/editor_themes.h
@@ -31,8 +31,8 @@
#include "scene/resources/theme.h"
-Ref<Theme> create_default_theme();
-
Ref<Theme> create_editor_theme();
+Ref<Theme> create_custom_theme();
+
#endif
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index 7f41949613..f2655fbb9f 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -1513,6 +1513,7 @@ void ScriptEditor::edit(const Ref<Script>& p_script, bool p_grab_focus) {
}
ERR_FAIL_COND(!se);
tab_container->add_child(se);
+
se->set_edited_script(p_script);
se->set_tooltip_request_func("_get_debug_tooltip",this);
if (se->get_edit_menu()) {
diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp
index 0c734436cd..b884e0d111 100644
--- a/tools/editor/project_manager.cpp
+++ b/tools/editor/project_manager.cpp
@@ -1196,7 +1196,7 @@ ProjectManager::ProjectManager() {
FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("file_dialog/show_hidden_files"));
set_area_as_parent_rect();
- set_theme(create_default_theme());
+ set_theme(create_editor_theme());
gui_base = memnew( Control );
add_child(gui_base);
@@ -1389,7 +1389,7 @@ ProjectManager::ProjectManager() {
SceneTree::get_singleton()->connect("files_dropped", this, "_files_dropped");
- gui_base->set_theme(create_editor_theme());
+ gui_base->set_theme(create_custom_theme());
}