summaryrefslogtreecommitdiffstats
path: root/perl-install/interactive
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-02-06 20:35:54 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-02-06 20:35:54 +0000
commit018ed46bb0136e7c881a94ce14a74e029c1f8618 (patch)
tree64e487625db329bbffb9d1b7a3eafb1e419e482f /perl-install/interactive
parenta11a69740790a3c8b647a78299ee0fd581958175 (diff)
downloaddrakx-018ed46bb0136e7c881a94ce14a74e029c1f8618.tar
drakx-018ed46bb0136e7c881a94ce14a74e029c1f8618.tar.gz
drakx-018ed46bb0136e7c881a94ce14a74e029c1f8618.tar.bz2
drakx-018ed46bb0136e7c881a94ce14a74e029c1f8618.tar.xz
drakx-018ed46bb0136e7c881a94ce14a74e029c1f8618.zip
fix sizing in the scrolled window in 80x25
Diffstat (limited to 'perl-install/interactive')
-rw-r--r--perl-install/interactive/newt.pm19
1 files changed, 12 insertions, 7 deletions
diff --git a/perl-install/interactive/newt.pm b/perl-install/interactive/newt.pm
index 161971b83..7b227b61b 100644
--- a/perl-install/interactive/newt.pm
+++ b/perl-install/interactive/newt.pm
@@ -31,12 +31,14 @@ sub end() { Newt::Finished() }
sub exit() { end(); exit($_[1]) }
END { end() }
+sub messages { warp_text(join("\n", @_), $width - 9) }
+
sub myTextbox {
my ($allow_scroll, $free_height, @messages) = @_;
- my $width = $width - 9;
- my @l = warp_text(join("\n", @messages), $width);
+ my @l = messages(@messages);
my $h = min($free_height - 13, int @l);
+
my $want_scroll;
if ($h < @l) {
if ($allow_scroll) {
@@ -46,6 +48,7 @@ sub myTextbox {
@l = @l[0 .. $h-1];
}
}
+
my $mess = Newt::Component::Textbox(1, 0, my $w = max(map { length } @l) + 1, $h, $want_scroll);
$mess->TextboxSetText(join("\n", @l));
$mess, $w + 1, $h;
@@ -228,21 +231,23 @@ sub ask_fromW_real {
} @widgets;
my $listg = do {
- my $height = 18;
+ my $wanted_header_height = min(8, listlength(messages(@{$common->{messages}})));
+ my $height_avail = $height - $wanted_header_height - 13;
#- use a scrolled window if there is a lot of checkboxes (aka
#- ask_many_from_list) or a lot of widgets in general (aka
#- options of a native PostScript printer in printerdrake)
#- !! works badly together with list's (lists are one widget, so a
#- big list window will not switch to scrollbar mode) :-(
- if (@$l > 3 && $total_size > $height) {
+ if (@$l > 3 && $total_size > $height_avail) {
$grid->GridPlace(1, 1); #- Uh?? otherwise the size allocated is bad
$has_scroll = 1;
+ $total_size = $height_avail;
- my $scroll = Newt::Component::VerticalScrollbar($height, 9, 10); # 9=NEWT_COLORSET_CHECKBOX, 10=NEWT_COLORSET_ACTCHECKBOX
+ my $scroll = Newt::Component::VerticalScrollbar($height_avail, 9, 10); # 9=NEWT_COLORSET_CHECKBOX, 10=NEWT_COLORSET_ACTCHECKBOX
my $subf = $scroll->Form('', 0);
- $subf->FormSetHeight($height);
+ $subf->FormSetHeight($height_avail);
$subf->FormAddGrid($grid, 0);
- Newt::Grid::HCloseStacked3($subf, separator(1, $height-1), $scroll);
+ Newt::Grid::HCloseStacked3($subf, separator(1, $height_avail-1), $scroll);
} else {
$grid;
}