Merge pull request #6575 from Geequlim/more_themes

More custom theme support for editor
This commit is contained in:
Rémi Verschelde 2016-10-03 11:50:18 +02:00 committed by GitHub
commit de648e552b
5 changed files with 19 additions and 13 deletions

View file

@ -161,7 +161,7 @@ void EditorLog::_undo_redo_cbk(void *p_self,const String& p_name) {
void EditorLog::_bind_methods() { void EditorLog::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_clear_request"),&EditorLog::_clear_request ); 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 ); //ObjectTypeDB::bind_method(_MD("_dragged"),&EditorLog::_dragged );
ADD_SIGNAL( MethodInfo("clear_request")); ADD_SIGNAL( MethodInfo("clear_request"));
} }
@ -193,11 +193,10 @@ EditorLog::EditorLog() {
ec->set_custom_minimum_size(Size2(0,180)); ec->set_custom_minimum_size(Size2(0,180));
ec->set_v_size_flags(SIZE_EXPAND_FILL); ec->set_v_size_flags(SIZE_EXPAND_FILL);
pc = memnew( PanelContainer );
PanelContainer *pc = memnew( PanelContainer );
pc->add_style_override("panel",get_stylebox("normal","TextEdit"));
ec->add_child(pc); ec->add_child(pc);
pc->set_area_as_parent_rect(); pc->set_area_as_parent_rect();
pc->connect("enter_tree", this, "_override_logger_styles");
log = memnew( RichTextLabel ); log = memnew( RichTextLabel );
log->set_scroll_follow(true); 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() { EditorLog::~EditorLog() {

View file

@ -50,6 +50,7 @@ class EditorLog : public VBoxContainer {
HBoxContainer *title_hb; HBoxContainer *title_hb;
// PaneDrag *pd; // PaneDrag *pd;
Control *ec; 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); 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(); static void _bind_methods();
void _notification(int p_what); void _notification(int p_what);
void _override_logger_styles();
public: public:
void add_message(const String& p_msg, bool p_error=false); void add_message(const String& p_msg, bool p_error=false);

View file

@ -668,7 +668,7 @@ ThemeEditor::ThemeEditor() {
theme_menu = memnew( MenuButton ); 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 Item"),POPUP_ADD);
theme_menu->get_popup()->add_item(TTR("Add Class Items"),POPUP_CLASS_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); theme_menu->get_popup()->add_item(TTR("Remove Item"),POPUP_REMOVE);

View file

@ -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")); 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"))) { 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; List<PropertyInfo> properties;
EditorSettings::get_singleton()->get_property_list(&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> projects;
List<ProjectItem> favorite_projects; List<ProjectItem> favorite_projects;
@ -864,6 +864,7 @@ void ProjectManager::_load_recent_projects() {
hb->set_meta("favorite",is_favorite); hb->set_meta("favorite",is_favorite);
hb->connect("draw",this,"_panel_draw",varray(hb)); hb->connect("draw",this,"_panel_draw",varray(hb));
hb->connect("input_event",this,"_panel_input",varray(hb)); hb->connect("input_event",this,"_panel_input",varray(hb));
hb->add_constant_override("separation",10*EDSCALE);
VBoxContainer *favorite_box = memnew( VBoxContainer ); VBoxContainer *favorite_box = memnew( VBoxContainer );
TextureButton *favorite = memnew( TextureButton ); TextureButton *favorite = memnew( TextureButton );
@ -885,7 +886,7 @@ void ProjectManager::_load_recent_projects() {
ec->set_custom_minimum_size(Size2(0,1)); ec->set_custom_minimum_size(Size2(0,1));
vb->add_child(ec); vb->add_child(ec);
Label *title = memnew( Label(project_name) ); 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); title->add_color_override("font_color",font_color);
vb->add_child(title); vb->add_child(title);
Label *fpath = memnew( Label(path) ); Label *fpath = memnew( Label(path) );
@ -1205,6 +1206,7 @@ ProjectManager::ProjectManager() {
gui_base = memnew( Control ); gui_base = memnew( Control );
add_child(gui_base); add_child(gui_base);
gui_base->set_area_as_parent_rect(); gui_base->set_area_as_parent_rect();
gui_base->set_theme(create_custom_theme());
Panel *panel = memnew( Panel ); Panel *panel = memnew( Panel );
gui_base->add_child(panel); gui_base->add_child(panel);
@ -1227,7 +1229,7 @@ ProjectManager::ProjectManager() {
CenterContainer *ccl = memnew( CenterContainer ); CenterContainer *ccl = memnew( CenterContainer );
Label *l = memnew( Label ); Label *l = memnew( Label );
l->set_text(_MKSTR(VERSION_NAME)+String(" - ")+TTR("Project Manager")); 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); ccl->add_child(l);
top_hb->add_child(ccl); top_hb->add_child(ccl);
top_hb->add_spacer(); top_hb->add_spacer();
@ -1263,7 +1265,7 @@ ProjectManager::ProjectManager() {
search_tree_vb->add_child(search_box); search_tree_vb->add_child(search_box);
PanelContainer *pc = memnew( PanelContainer); 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); search_tree_vb->add_child(pc);
pc->set_v_size_flags(SIZE_EXPAND_FILL); pc->set_v_size_flags(SIZE_EXPAND_FILL);
@ -1392,8 +1394,6 @@ ProjectManager::ProjectManager() {
last_clicked = ""; last_clicked = "";
SceneTree::get_singleton()->connect("files_dropped", this, "_files_dropped"); SceneTree::get_singleton()->connect("files_dropped", this, "_files_dropped");
gui_base->set_theme(create_custom_theme());
} }