diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2007-04-03 02:05:34 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2007-04-03 02:05:34 +0000 |
commit | 4b35fc4c68fbd4845f7f8f3d2307e97412d7a4d8 (patch) | |
tree | 04aab666f44cb9787220fa76d79a3fba379655fd /gtk2_ardour/utils.cc | |
parent | edfc81352e66a412c6bc180c15f788512eccbe42 (diff) |
audun's tempo redraw fix; sort-of cache time axis view item name widths and avoid pango-width-computation when unnecessary
git-svn-id: svn://localhost/ardour2/trunk@1657 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/utils.cc')
-rw-r--r-- | gtk2_ardour/utils.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index fbebf0d51a..9c1ef22a88 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -44,6 +44,20 @@ using namespace sigc; using namespace Glib; using namespace PBD; +int +pixel_width (const ustring& str, Pango::FontDescription& font) +{ + Label foo; + Glib::RefPtr<Pango::Layout> layout = foo.create_pango_layout (""); + + layout->set_font_description (font); + layout->set_text (str); + + int width, height; + Gtkmm2ext::get_ink_pixel_size (layout, width, height); + return width; +} + ustring fit_to_pixels (const ustring& str, int pixel_width, Pango::FontDescription& font, int& actual_width, bool with_ellipses) { |