13
0

tweak design of time axis view item name text handling

This commit is contained in:
Paul Davis 2014-01-02 14:29:07 -05:00
parent 6085d8c15c
commit 10c8b48235
3 changed files with 14 additions and 6 deletions

View File

@ -80,10 +80,14 @@ TimeAxisViewItem::set_constant_heights ()
int height = 0;
layout->set_font_description (NAME_FONT);
Gtkmm2ext::get_ink_pixel_size (layout, width, height);
get_pixel_size (layout, width, height);
layout = foo.create_pango_layout (X_("H")); /* just the ascender */
std::cerr << " height: " << height << " baseline = " << layout->get_baseline() / PANGO_SCALE << std::endl;
NAME_HEIGHT = height;
NAME_Y_OFFSET = height * 1.5; // XXX this offset is magic
NAME_Y_OFFSET = height + 2;
NAME_HIGHLIGHT_SIZE = height + 2;
NAME_HIGHLIGHT_THRESH = NAME_HIGHLIGHT_SIZE * 3;
}
@ -565,7 +569,7 @@ TimeAxisViewItem::set_height (double height)
manage_name_highlight ();
if (visibility & ShowNameText) {
name_text->set_y_position (height + 1 - NAME_Y_OFFSET);
name_text->set_y_position (height - NAME_Y_OFFSET);
}
if (frame) {

View File

@ -56,6 +56,10 @@ namespace Gtkmm2ext {
LIBGTKMM2EXT_API void get_ink_pixel_size (Glib::RefPtr<Pango::Layout>,
int& width, int& height);
LIBGTKMM2EXT_API void get_pixel_size (Glib::RefPtr<Pango::Layout>,
int& width, int& height);
LIBGTKMM2EXT_API void set_size_request_to_display_given_text (Gtk::Widget &w,
const gchar *text,
gint hpadding,

View File

@ -57,9 +57,9 @@ Gtkmm2ext::get_ink_pixel_size (Glib::RefPtr<Pango::Layout> layout,
}
void
get_pixel_size (Glib::RefPtr<Pango::Layout> layout,
int& width,
int& height)
Gtkmm2ext::get_pixel_size (Glib::RefPtr<Pango::Layout> layout,
int& width,
int& height)
{
layout->get_pixel_size (width, height);
}