summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeequlim <geequlim@gmail.com>2016-09-20 20:41:57 +0800
committerGeequlim <geequlim@gmail.com>2016-09-20 20:41:57 +0800
commitfd236a4b6cb4619844c7fd0bafa6a4dc089d8019 (patch)
treec33051888deb8f785eb83ee64e944a386ee61919
parent2f776af2e600639c8d214e19555f3452a558692f (diff)
More custom theme support for editor
-rw-r--r--tools/editor/editor_log.cpp12
-rw-r--r--tools/editor/editor_log.h2
-rw-r--r--tools/editor/editor_node.cpp2
-rw-r--r--tools/editor/plugins/theme_editor_plugin.cpp2
-rw-r--r--tools/editor/project_manager.cpp14
5 files changed, 19 insertions, 13 deletions
diff --git a/tools/editor/editor_log.cpp b/tools/editor/editor_log.cpp
index 20613467d3..02af9712a8 100644
--- a/tools/editor/editor_log.cpp
+++ b/tools/editor/editor_log.cpp
@@ -161,7 +161,7 @@ void EditorLog::_undo_redo_cbk(void *p_self,const String& p_name) {
void EditorLog::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_clear_request"),&EditorLog::_clear_request );
-
+ ObjectTypeDB::bind_method("_override_logger_styles",&EditorLog::_override_logger_styles );
//ObjectTypeDB::bind_method(_MD("_dragged"),&EditorLog::_dragged );
ADD_SIGNAL( MethodInfo("clear_request"));
}
@@ -193,11 +193,10 @@ EditorLog::EditorLog() {
ec->set_custom_minimum_size(Size2(0,180));
ec->set_v_size_flags(SIZE_EXPAND_FILL);
-
- PanelContainer *pc = memnew( PanelContainer );
- pc->add_style_override("panel",get_stylebox("normal","TextEdit"));
+ pc = memnew( PanelContainer );
ec->add_child(pc);
pc->set_area_as_parent_rect();
+ pc->connect("enter_tree", this, "_override_logger_styles");
log = memnew( RichTextLabel );
log->set_scroll_follow(true);
@@ -224,6 +223,11 @@ void EditorLog::deinit() {
}
+void EditorLog::_override_logger_styles() {
+
+ pc->add_style_override("panel",get_stylebox("normal","TextEdit"));
+
+}
EditorLog::~EditorLog() {
diff --git a/tools/editor/editor_log.h b/tools/editor/editor_log.h
index 699be710d8..bbf35b63cb 100644
--- a/tools/editor/editor_log.h
+++ b/tools/editor/editor_log.h
@@ -50,6 +50,7 @@ class EditorLog : public VBoxContainer {
HBoxContainer *title_hb;
// PaneDrag *pd;
Control *ec;
+ PanelContainer *pc;
static void _error_handler(void *p_self, const char*p_func, const char*p_file,int p_line, const char*p_error,const char*p_errorexp,ErrorHandlerType p_type);
@@ -64,6 +65,7 @@ protected:
static void _bind_methods();
void _notification(int p_what);
+ void _override_logger_styles();
public:
void add_message(const String& p_msg, bool p_error=false);
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 1ee0b93114..2ba0d8ef2d 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -2678,7 +2678,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
} break;
case RUN_PLAY_NATIVE: {
-
+
bool autosave = EDITOR_DEF("run/auto_save_before_running",true);
if (autosave) {
_menu_option_confirm(FILE_SAVE_ALL_SCENES, false);
diff --git a/tools/editor/plugins/theme_editor_plugin.cpp b/tools/editor/plugins/theme_editor_plugin.cpp
index 5db331ba45..84568aa8c0 100644
--- a/tools/editor/plugins/theme_editor_plugin.cpp
+++ b/tools/editor/plugins/theme_editor_plugin.cpp
@@ -668,7 +668,7 @@ ThemeEditor::ThemeEditor() {
theme_menu = memnew( MenuButton );
- theme_menu->set_text("Theme");
+ theme_menu->set_text(TTR("Theme"));
theme_menu->get_popup()->add_item(TTR("Add Item"),POPUP_ADD);
theme_menu->get_popup()->add_item(TTR("Add Class Items"),POPUP_CLASS_ADD);
theme_menu->get_popup()->add_item(TTR("Remove Item"),POPUP_REMOVE);
diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp
index b2eae2f6d1..18a4e845a0 100644
--- a/tools/editor/project_manager.cpp
+++ b/tools/editor/project_manager.cpp
@@ -506,7 +506,7 @@ void ProjectManager::_panel_draw(Node *p_hb) {
hb->draw_line(Point2(0,hb->get_size().y+1),Point2(hb->get_size().x-10,hb->get_size().y+1),get_color("guide_color","Tree"));
if (selected_list.has(hb->get_meta("name"))) {
- hb->draw_style_box(get_stylebox("selected","Tree"),Rect2(Point2(),hb->get_size()-Size2(10,0)));
+ hb->draw_style_box( gui_base->get_stylebox("selected","Tree"),Rect2(Point2(),hb->get_size()-Size2(10,0)));
}
}
@@ -753,7 +753,7 @@ void ProjectManager::_load_recent_projects() {
List<PropertyInfo> properties;
EditorSettings::get_singleton()->get_property_list(&properties);
- Color font_color = get_color("font_color","Tree");
+ Color font_color = gui_base->get_color("font_color","Tree");
List<ProjectItem> projects;
List<ProjectItem> favorite_projects;
@@ -864,6 +864,7 @@ void ProjectManager::_load_recent_projects() {
hb->set_meta("favorite",is_favorite);
hb->connect("draw",this,"_panel_draw",varray(hb));
hb->connect("input_event",this,"_panel_input",varray(hb));
+ hb->add_constant_override("separation",10*EDSCALE);
VBoxContainer *favorite_box = memnew( VBoxContainer );
TextureButton *favorite = memnew( TextureButton );
@@ -885,7 +886,7 @@ void ProjectManager::_load_recent_projects() {
ec->set_custom_minimum_size(Size2(0,1));
vb->add_child(ec);
Label *title = memnew( Label(project_name) );
- title->add_font_override("font",get_font("large","Fonts"));
+ title->add_font_override("font", gui_base->get_font("large","Fonts"));
title->add_color_override("font_color",font_color);
vb->add_child(title);
Label *fpath = memnew( Label(path) );
@@ -1205,6 +1206,7 @@ ProjectManager::ProjectManager() {
gui_base = memnew( Control );
add_child(gui_base);
gui_base->set_area_as_parent_rect();
+ gui_base->set_theme(create_custom_theme());
Panel *panel = memnew( Panel );
gui_base->add_child(panel);
@@ -1227,7 +1229,7 @@ ProjectManager::ProjectManager() {
CenterContainer *ccl = memnew( CenterContainer );
Label *l = memnew( Label );
l->set_text(_MKSTR(VERSION_NAME)+String(" - ")+TTR("Project Manager"));
- l->add_font_override("font",get_font("doc","EditorFonts"));
+ l->add_font_override("font", gui_base->get_font("doc","EditorFonts"));
ccl->add_child(l);
top_hb->add_child(ccl);
top_hb->add_spacer();
@@ -1263,7 +1265,7 @@ ProjectManager::ProjectManager() {
search_tree_vb->add_child(search_box);
PanelContainer *pc = memnew( PanelContainer);
- pc->add_style_override("panel",get_stylebox("bg","Tree"));
+ pc->add_style_override("panel", gui_base->get_stylebox("bg","Tree"));
search_tree_vb->add_child(pc);
pc->set_v_size_flags(SIZE_EXPAND_FILL);
@@ -1392,8 +1394,6 @@ ProjectManager::ProjectManager() {
last_clicked = "";
SceneTree::get_singleton()->connect("files_dropped", this, "_files_dropped");
-
- gui_base->set_theme(create_custom_theme());
}