From d34211f0039c88fc737067c8adebfb2a3b910ac6 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 17 Dec 2003 14:59:49 +0000 Subject: compute offsets only once, not once per state anymore since we always reuse the same layout --- control-center | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/control-center b/control-center index eae73495..e1f6512c 100755 --- a/control-center +++ b/control-center @@ -616,7 +616,7 @@ foreach (@tree) { my @icon_pixbufs = ($icon_pixbuf, render_shiner($icon_pixbuf, 1.89), $icon_pixbuf); my @fonts = map { Gtk2::Pango::FontDescription->from_string($_) } '', 'Bold', 'Bold'; - my ($lines, $widths, $heights, @dbl_area_left); + my ($lines, $widths, $heights, $offset, @dbl_area_left); push @curr_state, 0; push @old_state, -1; @@ -629,6 +629,7 @@ foreach (@tree) { unless ($lines) { $darea_left->modify_font($fonts[1]); ($lines, $widths, $heights) = (get_text_coord($text, $darea_left, $d_width-$left_txt_offset-$right_text_offset, $d_height, 0, 0, 0, 0))[2..4]; + $offset = -($d_height - string_height($darea_left, $lines->[0]) * (listlength(@$lines) + 0.2)) / 2; # text lines are offsetted } # Redraw double buffer on first expose in that particular state (selected <=> not selected): render background, then icon, then text unless ($dbl_area_left[$curr_state]) { @@ -641,7 +642,6 @@ foreach (@tree) { $darea_left->modify_font($fonts[$curr_state]); - my $offset = -($d_height - string_height($darea_left, $lines->[0]) * (listlength(@$lines) + 0.2)) / 2; # text lines are offsetted mapn { $dbl_area_left[$curr_state]->draw_layout($darea_left->style->black_gc, $_[1]+$left_txt_offset, $_[2]-$offset, $darea_left->create_pango_layout($_[0])); } $lines, $widths, $heights; -- cgit v1.2.1