diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-06-03 15:57:31 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-06-03 15:57:31 +0000 |
commit | ce78296f96071f4617b52327b0face0b65553e88 (patch) | |
tree | f1acc12d595204086e25f6d7e1f183dae6e86ef9 /gtk2_ardour/time_axis_view_item.cc | |
parent | eb37119975961abde36e069326873606e58dd022 (diff) |
move computation of TimeAxisViewItem fixed heights into a static member function and call early in process life, because we need the values in MidiStreamview - fixes a bug with notes not aligning with note lines in a new session
git-svn-id: svn://localhost/ardour2/branches/3.0@7220 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/time_axis_view_item.cc')
-rw-r--r-- | gtk2_ardour/time_axis_view_item.cc | 48 |
1 files changed, 22 insertions, 26 deletions
diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc index 416a1741dc..e4f7a860e7 100644 --- a/gtk2_ardour/time_axis_view_item.cc +++ b/gtk2_ardour/time_axis_view_item.cc @@ -49,7 +49,6 @@ using namespace PBD; using namespace ARDOUR; Pango::FontDescription* TimeAxisViewItem::NAME_FONT = 0; -bool TimeAxisViewItem::have_name_font = false; const double TimeAxisViewItem::NAME_X_OFFSET = 15.0; const double TimeAxisViewItem::GRAB_HANDLE_LENGTH = 6; @@ -58,6 +57,28 @@ double TimeAxisViewItem::NAME_Y_OFFSET; double TimeAxisViewItem::NAME_HIGHLIGHT_SIZE; double TimeAxisViewItem::NAME_HIGHLIGHT_THRESH; +void +TimeAxisViewItem::set_constant_heights () +{ + NAME_FONT = get_font_for_style (X_("TimeAxisViewItemName")); + + Gtk::Window win; + Gtk::Label foo; + win.add (foo); + + Glib::RefPtr<Pango::Layout> layout = foo.create_pango_layout (X_("Hg")); /* ascender + descender */ + int width = 0; + int height = 0; + + layout->set_font_description (*NAME_FONT); + Gtkmm2ext::get_ink_pixel_size (layout, width, height); + + NAME_HEIGHT = height; + NAME_Y_OFFSET = height + 3; + NAME_HIGHLIGHT_SIZE = height + 2; + NAME_HIGHLIGHT_THRESH = NAME_HIGHLIGHT_SIZE * 3; +} + /** * Construct a new TimeAxisViewItem. * @@ -76,31 +97,6 @@ TimeAxisViewItem::TimeAxisViewItem(const string & it_name, ArdourCanvas::Group& , _height (1.0) , _recregion (recording) { - if (!have_name_font) { - - /* first constructed item sets up font info */ - - NAME_FONT = get_font_for_style (N_("TimeAxisViewItemName")); - - Gtk::Window win; - Gtk::Label foo; - win.add (foo); - - Glib::RefPtr<Pango::Layout> layout = foo.create_pango_layout (X_("Hg")); /* ascender + descender */ - int width = 0; - int height = 0; - - layout->set_font_description (*NAME_FONT); - Gtkmm2ext::get_ink_pixel_size (layout, width, height); - - NAME_HEIGHT = height; - NAME_Y_OFFSET = height + 3; - NAME_HIGHLIGHT_SIZE = height + 2; - NAME_HIGHLIGHT_THRESH = NAME_HIGHLIGHT_SIZE * 3; - - have_name_font = true; - } - group = new ArdourCanvas::Group (parent); init (it_name, spu, base_color, start, duration, vis, true, true); |