Reinstate code removed in rev 1917 that creates the text tags for the log window

This was causing an assertion each time a log message is sent as the text tags
are uninitialized.


git-svn-id: svn://localhost/ardour2/trunk@2018 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Tim Mayberry
2007-06-17 00:53:04 +00:00
parent 56a27e8734
commit ccd732beea

View File

@@ -19,7 +19,6 @@
*/
#include <cmath>
#include <cassert>
#include <fcntl.h>
#include <signal.h>
#include <unistd.h>
@@ -130,6 +129,77 @@ UI::load_rcfile (string path)
}
RC rc (path.c_str());
/* have to pack widgets into a toplevel window so that styles will stick */
Window temp_window (WINDOW_TOPLEVEL);
HBox box;
Label a_widget1;
Label a_widget2;
Label a_widget3;
Label a_widget4;
RefPtr<Gtk::Style> style;
RefPtr<TextBuffer> buffer (errors->text().get_buffer());
box.pack_start (a_widget1);
box.pack_start (a_widget2);
box.pack_start (a_widget3);
box.pack_start (a_widget4);
error_ptag = buffer->create_tag();
error_mtag = buffer->create_tag();
fatal_ptag = buffer->create_tag();
fatal_mtag = buffer->create_tag();
warning_ptag = buffer->create_tag();
warning_mtag = buffer->create_tag();
info_ptag = buffer->create_tag();
info_mtag = buffer->create_tag();
a_widget1.set_name ("FatalMessage");
a_widget1.ensure_style ();
style = a_widget1.get_style();
fatal_ptag->property_font_desc().set_value(style->get_font());
fatal_ptag->property_foreground_gdk().set_value(style->get_fg(STATE_ACTIVE));
fatal_ptag->property_background_gdk().set_value(style->get_bg(STATE_ACTIVE));
fatal_mtag->property_font_desc().set_value(style->get_font());
fatal_mtag->property_foreground_gdk().set_value(style->get_fg(STATE_NORMAL));
fatal_mtag->property_background_gdk().set_value(style->get_bg(STATE_NORMAL));
a_widget2.set_name ("ErrorMessage");
a_widget2.ensure_style ();
style = a_widget2.get_style();
error_ptag->property_font_desc().set_value(style->get_font());
error_ptag->property_foreground_gdk().set_value(style->get_fg(STATE_ACTIVE));
error_ptag->property_background_gdk().set_value(style->get_bg(STATE_ACTIVE));
error_mtag->property_font_desc().set_value(style->get_font());
error_mtag->property_foreground_gdk().set_value(style->get_fg(STATE_NORMAL));
error_mtag->property_background_gdk().set_value(style->get_bg(STATE_NORMAL));
a_widget3.set_name ("WarningMessage");
a_widget3.ensure_style ();
style = a_widget3.get_style();
warning_ptag->property_font_desc().set_value(style->get_font());
warning_ptag->property_foreground_gdk().set_value(style->get_fg(STATE_ACTIVE));
warning_ptag->property_background_gdk().set_value(style->get_bg(STATE_ACTIVE));
warning_mtag->property_font_desc().set_value(style->get_font());
warning_mtag->property_foreground_gdk().set_value(style->get_fg(STATE_NORMAL));
warning_mtag->property_background_gdk().set_value(style->get_bg(STATE_NORMAL));
a_widget4.set_name ("InfoMessage");
a_widget4.ensure_style ();
style = a_widget4.get_style();
info_ptag->property_font_desc().set_value(style->get_font());
info_ptag->property_foreground_gdk().set_value(style->get_fg(STATE_ACTIVE));
info_ptag->property_background_gdk().set_value(style->get_bg(STATE_ACTIVE));
info_mtag->property_font_desc().set_value(style->get_font());
info_mtag->property_foreground_gdk().set_value(style->get_fg(STATE_NORMAL));
info_mtag->property_background_gdk().set_value(style->get_bg(STATE_NORMAL));
RC::reset_styles(Gtk::Settings::get_default());
return 0;
}
@@ -430,9 +500,6 @@ UI::toggle_errors ()
void
UI::display_message (const char *prefix, gint prefix_len, RefPtr<TextBuffer::Tag> ptag, RefPtr<TextBuffer::Tag> mtag, const char *msg)
{
assert(ptag);
assert(mtag);
RefPtr<TextBuffer> buffer (errors->text().get_buffer());
buffer->insert_with_tag(buffer->end(), prefix, ptag);