From 723e9abb3bf09a1764fd4b5f56aeb7af6319b314 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 21 Jan 2002 23:08:33 +0000 Subject: hopefully better dialog box sizing --- perl-install/my_gtk.pm | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'perl-install/my_gtk.pm') diff --git a/perl-install/my_gtk.pm b/perl-install/my_gtk.pm index 54f029e89..ad5c61f24 100644 --- a/perl-install/my_gtk.pm +++ b/perl-install/my_gtk.pm @@ -677,20 +677,21 @@ sub create_okcancel { sub create_box_with_title($@) { my $o = shift; - $o->{box_size} = sum(map { round(length($_) / 60 + 1/2) } map { split "\n" } @_); + my $nbline = sum(map { round(length($_) / 60 + 1/2) } map { split "\n" } @_); $o->{box} = new Gtk::VBox(0,0); - if (@_ <= 2 && $o->{box_size} > 4) { + $o->{box_size} = n_line_size($nbline, 'text', $o->{box}); + if (@_ <= 2 && $nbline > 4) { $o->{icon} && !$::isWizard and - eval { gtkpack__($o->{box}, gtkset_border_width(gtkpack_(new Gtk::HBox(0,0), 1, gtkpng($o->{icon})),5)); }; - my $wanted = n_line_size($o->{box_size}, 'text', $o->{box}); - my $height = min(250, $wanted); - my $has_scroll = $height < $wanted; + eval { gtkpack__($o->{box}, gtkset_border_width(gtkpack_(new Gtk::HBox(0,0), 1, gtkpng($o->{icon})),5)) }; + my $wanted = $o->{box_size}; + $o->{box_size} = min(200, $o->{box_size}); + my $has_scroll = $o->{box_size} < $wanted; my $wtext = new Gtk::Text; $wtext->can_focus($has_scroll); chomp(my $text = join("\n", @_)); my $scroll = createScrolledWindow(gtktext_insert($wtext, $text)); - $scroll->set_usize(400, $height); + $scroll->set_usize(400, $o->{box_size}); gtkpack__($o->{box}, $scroll); } else { my $a = !$::no_separator; -- cgit v1.2.1