13
0

Fix colours of log window messages.

If anyone has a better way of making this actually work than the absurd kludge in gtk_ui.cc, feel free.


git-svn-id: svn://localhost/ardour2/branches/3.0@5864 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2009-10-22 19:53:22 +00:00
parent b3a80523d3
commit 02f2755e60
3 changed files with 81 additions and 70 deletions

View File

@ -566,42 +566,42 @@ style "menu_bar_base" = "default_base"
*/ */
style "fatal_message" = "medium_text" style "fatal_message" = "medium_text"
{ {
fg[ACTIVE] = { 1.0, 0, 1.0 } fg[ACTIVE] = { 1.0, 0.20, 0.20 }
fg[NORMAL] = { 0.80, 0.80, 0.80 } fg[NORMAL] = { 1.0, 0.20, 0.20 }
bg[ACTIVE] = { 0,0,0 } bg[ACTIVE] = "#1a1e24"
bg[NORMAL] = { 0,0,0 } bg[NORMAL] = "#1a1e24"
base[ACTIVE] = { 0,0,0 } base[NORMAL] = "#1a1e24"
base[NORMAL] = { 0,0,0 } base[NORMAL] = "#1a1e24"
} }
style "error_message" = "medium_text" style "error_message" = "medium_text"
{ {
fg[ACTIVE] = { 1.0, 0, 0 } fg[ACTIVE] = { 1.0, 0.20, 0.20 }
fg[NORMAL] = { 0.80, 0.80, 0.80 } fg[NORMAL] = { 1.0, 0.20, 0.20 }
bg[ACTIVE] = { 0,0,0 } bg[ACTIVE] = "#1a1e24"
bg[NORMAL] = { 0,0,0 } bg[NORMAL] = "#1a1e24"
base[ACTIVE] = { 0,0,0 } base[NORMAL] = "#1a1e24"
base[NORMAL] = { 0,0,0 } base[NORMAL] = "#1a1e24"
} }
style "info_message" = "medium_text" style "info_message" = "medium_text"
{ {
fg[ACTIVE] = { 1.0, 0, 0 } fg[ACTIVE] = { 0.20, 0.80, 0.20 }
fg[NORMAL] = { 0.80, 0.80, 0.80 } fg[NORMAL] = { 0.20, 0.80, 0.20 }
bg[ACTIVE] = { 0,0,0 } bg[ACTIVE] = "#1a1e24"
bg[NORMAL] = { 0,0,0 } bg[NORMAL] = "#1a1e24"
base[ACTIVE] = { 0,0,0 } base[NORMAL] = "#1a1e24"
base[NORMAL] = { 0,0,0 } base[NORMAL] = "#1a1e24"
} }
style "warning_message" = "medium_text" style "warning_message" = "medium_text"
{ {
fg[ACTIVE] = { 0.30,0.30, 1.0 } fg[ACTIVE] = { 0.80, 0.80, 0.20 }
fg[NORMAL] = { 0.80, 0.80, 0.80 } fg[NORMAL] = { 0.80, 0.80, 0.20 }
bg[ACTIVE] = { 0, 0, 0 } bg[ACTIVE] = "#1a1e24"
bg[NORMAL] = { 0, 0, 0 } bg[NORMAL] = "#1a1e24"
base[ACTIVE] = { 0, 0, 0 } base[NORMAL] = "#1a1e24"
base[NORMAL] = { 0, 0, 0 } base[NORMAL] = "#1a1e24"
} }
style "medium_entry" = "medium_text" style "medium_entry" = "medium_text"

View File

@ -252,7 +252,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
/* lets get this party started */ /* lets get this party started */
try { try {
if (ARDOUR::init (ARDOUR_COMMAND_LINE::use_vst, ARDOUR_COMMAND_LINE::try_hw_optimization)) { if (ARDOUR::init (ARDOUR_COMMAND_LINE::use_vst, ARDOUR_COMMAND_LINE::try_hw_optimization)) {
throw failed_constructor (); throw failed_constructor ();
} }

View File

@ -119,6 +119,15 @@ UI::caller_is_ui_thread ()
int int
UI::load_rcfile (string path, bool themechange) UI::load_rcfile (string path, bool themechange)
{ {
/* Yes, pointers to Glib::RefPtr. If these are not kept around,
* a segfault somewhere deep in the wonderfully robust glib will result.
* This does not occur if wiget.get_style is used instead of rc.get_style below,
* except that doesn't actually work... */
static Glib::RefPtr<Style>* fatal_style = 0;
static Glib::RefPtr<Style>* error_style = 0;
static Glib::RefPtr<Style>* warning_style = 0;
static Glib::RefPtr<Style>* info_style = 0;
if (path.length() == 0) { if (path.length() == 0) {
return -1; return -1;
} }
@ -132,7 +141,7 @@ UI::load_rcfile (string path, bool themechange)
} }
RC rc (path.c_str()); RC rc (path.c_str());
// RC::reset_styles (Gtk::Settings::get_default()); //RC::reset_styles (Gtk::Settings::get_default());
gtk_rc_reset_styles (gtk_settings_get_default()); gtk_rc_reset_styles (gtk_settings_get_default());
theme_changed.emit(); theme_changed.emit();
@ -143,18 +152,20 @@ UI::load_rcfile (string path, bool themechange)
/* have to pack widgets into a toplevel window so that styles will stick */ /* have to pack widgets into a toplevel window so that styles will stick */
Window temp_window (WINDOW_TOPLEVEL); Window temp_window (WINDOW_TOPLEVEL);
temp_window.ensure_style ();
HBox box; HBox box;
Label a_widget1; Label fatal_widget;
Label a_widget2; Label error_widget;
Label a_widget3; Label warning_widget;
Label a_widget4; Label info_widget;
RefPtr<Gtk::Style> style; RefPtr<Gtk::Style> style;
RefPtr<TextBuffer> buffer (errors->text().get_buffer()); RefPtr<TextBuffer> buffer (errors->text().get_buffer());
box.pack_start (a_widget1); box.pack_start (fatal_widget);
box.pack_start (a_widget2); box.pack_start (error_widget);
box.pack_start (a_widget3); box.pack_start (warning_widget);
box.pack_start (a_widget4); box.pack_start (info_widget);
error_ptag = buffer->create_tag(); error_ptag = buffer->create_tag();
error_mtag = buffer->create_tag(); error_mtag = buffer->create_tag();
@ -165,49 +176,49 @@ UI::load_rcfile (string path, bool themechange)
info_ptag = buffer->create_tag(); info_ptag = buffer->create_tag();
info_mtag = buffer->create_tag(); info_mtag = buffer->create_tag();
a_widget1.set_name ("FatalMessage"); fatal_widget.set_name ("FatalMessage");
a_widget1.ensure_style (); delete fatal_style;
style = a_widget1.get_style(); fatal_style = new Glib::RefPtr<Style>(rc.get_style(fatal_widget));
fatal_ptag->property_font_desc().set_value(style->get_font()); fatal_ptag->property_font_desc().set_value((*fatal_style)->get_font());
fatal_ptag->property_foreground_gdk().set_value(style->get_fg(STATE_ACTIVE)); fatal_ptag->property_foreground_gdk().set_value((*fatal_style)->get_fg(STATE_ACTIVE));
fatal_ptag->property_background_gdk().set_value(style->get_bg(STATE_ACTIVE)); fatal_ptag->property_background_gdk().set_value((*fatal_style)->get_bg(STATE_ACTIVE));
fatal_mtag->property_font_desc().set_value(style->get_font()); fatal_mtag->property_font_desc().set_value((*fatal_style)->get_font());
fatal_mtag->property_foreground_gdk().set_value(style->get_fg(STATE_NORMAL)); fatal_mtag->property_foreground_gdk().set_value((*fatal_style)->get_fg(STATE_NORMAL));
fatal_mtag->property_background_gdk().set_value(style->get_bg(STATE_NORMAL)); fatal_mtag->property_background_gdk().set_value((*fatal_style)->get_bg(STATE_NORMAL));
a_widget2.set_name ("ErrorMessage"); error_widget.set_name ("ErrorMessage");
a_widget2.ensure_style (); delete error_style;
style = a_widget2.get_style(); error_style = new Glib::RefPtr<Style>(rc.get_style(error_widget));
error_ptag->property_font_desc().set_value(style->get_font()); error_ptag->property_font_desc().set_value((*error_style)->get_font());
error_ptag->property_foreground_gdk().set_value(style->get_fg(STATE_ACTIVE)); error_ptag->property_foreground_gdk().set_value((*error_style)->get_fg(STATE_ACTIVE));
error_ptag->property_background_gdk().set_value(style->get_bg(STATE_ACTIVE)); error_ptag->property_background_gdk().set_value((*error_style)->get_bg(STATE_ACTIVE));
error_mtag->property_font_desc().set_value(style->get_font()); error_mtag->property_font_desc().set_value((*error_style)->get_font());
error_mtag->property_foreground_gdk().set_value(style->get_fg(STATE_NORMAL)); error_mtag->property_foreground_gdk().set_value((*error_style)->get_fg(STATE_NORMAL));
error_mtag->property_background_gdk().set_value(style->get_bg(STATE_NORMAL)); error_mtag->property_background_gdk().set_value((*error_style)->get_bg(STATE_NORMAL));
a_widget3.set_name ("WarningMessage"); warning_widget.set_name ("WarningMessage");
a_widget3.ensure_style (); delete warning_style;
style = a_widget3.get_style(); warning_style = new Glib::RefPtr<Style>(rc.get_style(warning_widget));
warning_ptag->property_font_desc().set_value(style->get_font()); warning_ptag->property_font_desc().set_value((*warning_style)->get_font());
warning_ptag->property_foreground_gdk().set_value(style->get_fg(STATE_ACTIVE)); warning_ptag->property_foreground_gdk().set_value((*warning_style)->get_fg(STATE_ACTIVE));
warning_ptag->property_background_gdk().set_value(style->get_bg(STATE_ACTIVE)); warning_ptag->property_background_gdk().set_value((*warning_style)->get_bg(STATE_ACTIVE));
warning_mtag->property_font_desc().set_value(style->get_font()); warning_mtag->property_font_desc().set_value((*warning_style)->get_font());
warning_mtag->property_foreground_gdk().set_value(style->get_fg(STATE_NORMAL)); warning_mtag->property_foreground_gdk().set_value((*warning_style)->get_fg(STATE_NORMAL));
warning_mtag->property_background_gdk().set_value(style->get_bg(STATE_NORMAL)); warning_mtag->property_background_gdk().set_value((*warning_style)->get_bg(STATE_NORMAL));
a_widget4.set_name ("InfoMessage"); info_widget.set_name ("InfoMessage");
a_widget4.ensure_style (); delete info_style;
style = a_widget4.get_style(); info_style = new Glib::RefPtr<Style>(rc.get_style(info_widget));
info_ptag->property_font_desc().set_value(style->get_font()); info_ptag->property_font_desc().set_value((*info_style)->get_font());
info_ptag->property_foreground_gdk().set_value(style->get_fg(STATE_ACTIVE)); info_ptag->property_foreground_gdk().set_value((*info_style)->get_fg(STATE_ACTIVE));
info_ptag->property_background_gdk().set_value(style->get_bg(STATE_ACTIVE)); info_ptag->property_background_gdk().set_value((*info_style)->get_bg(STATE_ACTIVE));
info_mtag->property_font_desc().set_value(style->get_font()); info_mtag->property_font_desc().set_value((*info_style)->get_font());
info_mtag->property_foreground_gdk().set_value(style->get_fg(STATE_NORMAL)); info_mtag->property_foreground_gdk().set_value((*info_style)->get_fg(STATE_NORMAL));
info_mtag->property_background_gdk().set_value(style->get_bg(STATE_NORMAL)); info_mtag->property_background_gdk().set_value((*info_style)->get_bg(STATE_NORMAL));
return 0; return 0;
} }