mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-15 19:16:40 +01:00
dynamically resize text in the big clock, first version
git-svn-id: svn://localhost/ardour2/branches/3.0@6494 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
81fd8dd960
commit
11edfd035e
6 changed files with 192 additions and 15 deletions
|
|
@ -45,6 +45,14 @@ Gtkmm2ext::get_ink_pixel_size (Glib::RefPtr<Pango::Layout> layout,
|
|||
height = (ink_rect.get_height() + PANGO_SCALE / 2) / PANGO_SCALE;
|
||||
}
|
||||
|
||||
void
|
||||
get_pixel_size (Glib::RefPtr<Pango::Layout> layout,
|
||||
int& width,
|
||||
int& height)
|
||||
{
|
||||
layout->get_pixel_size (width, height);
|
||||
}
|
||||
|
||||
void
|
||||
Gtkmm2ext::set_size_request_to_display_given_text (Gtk::Widget &w, const gchar *text,
|
||||
gint hpadding, gint vpadding)
|
||||
|
|
@ -53,7 +61,7 @@ Gtkmm2ext::set_size_request_to_display_given_text (Gtk::Widget &w, const gchar *
|
|||
int width, height;
|
||||
w.ensure_style ();
|
||||
|
||||
get_ink_pixel_size (w.create_pango_layout (text), width, height);
|
||||
get_pixel_size (w.create_pango_layout (text), width, height);
|
||||
w.set_size_request(width + hpadding, height + vpadding);
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +77,7 @@ Gtkmm2ext::set_size_request_to_display_given_text (Gtk::Widget &w,
|
|||
w.ensure_style ();
|
||||
|
||||
for (vector<string>::const_iterator i = strings.begin(); i != strings.end(); ++i) {
|
||||
get_ink_pixel_size (w.create_pango_layout (*i), width, height);
|
||||
get_pixel_size (w.create_pango_layout (*i), width, height);
|
||||
width_max = max(width_max,width);
|
||||
height_max = max(height_max, height);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue