summaryrefslogtreecommitdiffstats
path: root/perl-install/help.pm
Commit message (Expand)AuthorAgeFilesLines
* updated help filePablo Saratxaga2002-03-111-254/+258
* updated help filePablo Saratxaga2002-02-211-14/+21
* updated help filePablo Saratxaga2002-02-181-47/+45
* new version for 8.2Stefan Siegel2002-02-171-109/+134
* updated help.pm filePablo Saratxaga2002-02-091-12/+23
* updated pot file with help messages from manualPablo Saratxaga2002-01-291-5/+24
* updated help filePablo Saratxaga2001-11-141-23/+23
* updated help filePablo Saratxaga2001-09-211-2/+2
* updated help filePablo Saratxaga2001-09-191-17/+57
* updated help filePablo Saratxaga2001-09-171-0/+34
* updated help.pm filePablo Saratxaga2001-09-161-28/+0
* Added a dialog in English for users selecting a printing system since no otherMichael Glenn Moore2001-09-151-0/+28
* new version with [ and ]Pablo Saratxaga2001-09-121-5/+5
* small fixPablo Saratxaga2001-09-111-471/+502
* new helpPascal Rigaux2001-09-071-310/+523
* fixed (was utf8)Pascal Rigaux2001-08-301-1/+1
* auto-generates help.pm from xml doc done by doc teamPascal Rigaux2001-08-241-972/+396
* last of sync with PPC beta modsStew Benedict2001-07-271-1/+11
* move to MDK::Common, bool->to_boolPascal Rigaux2001-07-241-1/+1
* fix missing ``"''Pascal Rigaux2001-07-201-1/+1
* updated root password help.Francois Pons2001-07-091-6/+6
* s/Linux-Mandrake/Mandrake Linux/Pablo Saratxaga2001-06-221-19/+19
* Updated po files and help messages (patch from Pixel)Pablo Saratxaga2001-03-311-27/+14
* * perl-install/help.pm - typo in yaboot helpStew Benedict2001-03-071-1/+1
* corrected some typos, Updated Japanese filePablo Saratxaga2001-03-061-2/+2
* fixed English typosPablo Saratxaga2001-03-051-2/+2
* *** empty log message ***Stew Benedict2001-03-031-1/+103
* Fixed English typoPablo Saratxaga2000-10-041-1/+1
* fixed English TypoPablo Saratxaga2000-10-031-1/+1
* fixed English typoPablo Saratxaga2000-10-031-1/+1
* fixed some English stringsPablo Saratxaga2000-10-021-2/+3
* fixed small error in English stringPablo Saratxaga2000-10-021-1/+1
* corrected an English typoPablo Saratxaga2000-09-291-1/+1
* fixed english typoPablo Saratxaga2000-09-291-1/+1
* fixed English TypoPablo Saratxaga2000-09-291-1/+1
* corrected English typosPablo Saratxaga2000-09-291-2/+2
* no_commentPascal Rigaux2000-09-281-2/+2
* More human readable helpDavid Baudens2000-09-271-25/+89
* *** empty log message ***Pascal Rigaux2000-09-261-51/+81
* *** empty log message ***Francois Pons2000-09-261-1/+1
* *** empty log message ***Francois Pons2000-09-261-0/+12
* *** empty log message ***Francois Pons2000-09-261-3/+3
* *** empty log message ***Francois Pons2000-09-261-0/+27
* no_commentPascal Rigaux2000-09-261-22/+45
* set help.damien2000-09-261-1/+4
* no_commentPascal Rigaux2000-09-261-205/+356
* fixed English stringPablo Saratxaga2000-09-251-1/+1
* changed some English stringsPablo Saratxaga2000-09-171-2/+2
* no_commentPascal Rigaux2000-09-141-1/+1
* *** empty log message ***Francois Pons2000-09-121-4/+3
an> @_; if (grep { $_->{type} ne 'button' } @$l or @$l < 5) { &ask_fromW_real; } else { my $r; do { my @choices = map { my $s = simplify_string(may_apply($_->{format}, ${$_->{val}})); $s = "$_->{label}: $s" if $_->{label}; { label => $s, clicked_may_quit => $_->{clicked_may_quit} } } @$l; #- replace many buttons with a list my $new_l = [ { val => \$r, type => 'list', list => \@choices, format => sub { $_[0]{label} }, sort => 0 } ]; ask_fromW_real($o, $common, $new_l, $l2) or return; } until $r->{clicked_may_quit}->(); 1; } } sub ask_fromW_real { my ($o, $common, $l, $l2) = @_; my $ignore; #-to handle recursivity my $old_focus = -2; #-the widgets my (@widgets, $total_size); my $set_all = sub { $ignore = 1; $_->{set}->(${$_->{e}{val}}) foreach @widgets; # $_->{w}->set_sensitive(!$_->{e}{disabled}()) foreach @widgets; $ignore = 0; }; my $get_all = sub { ${$_->{e}{val}} = $_->{get}->() foreach @widgets; }; my $create_widget = sub { my ($e, $ind) = @_; $e->{type} = 'list' if $e->{type} =~ /(icon|tree)list/; #- combo doesn't exist, fallback to a sensible default $e->{type} = $e->{not_edit} ? 'list' : 'entry' if $e->{type} eq 'combo'; my $changed = sub { return if $ignore; return $old_focus++ if $old_focus == -2; #- handle special first case $get_all->(); #- TODO: this is very rough :( $common->{callbacks}{$old_focus == $ind ? 'changed' : 'focus_out'}->($ind); $set_all->(); $old_focus = $ind; }; my ($w, $real_w, $set, $get, $expand, $size); if ($e->{type} eq 'bool') { $w = Newt::Component::Checkbox(-1, -1, $e->{text} || '', checkval(${$e->{val}}), " *"); $set = sub { $w->CheckboxSetValue(checkval($_[0])) }; $get = sub { $w->CheckboxGetValue == ord '*' }; } elsif ($e->{type} eq 'button') { $w = Newt::Component::Button(-1, -1, simplify_string(may_apply($e->{format}, ${$e->{val}}))); } elsif ($e->{type} =~ /list/) { my ($h, $wi) = (@$l == 1 && $height > 30 ? 10 : 5, 20); my $scroll = @{$e->{list}} > $h ? 1 << 2 : 0; $size = min(int @{$e->{list}}, $h); $w = Newt::Component::Listbox(-1, -1, $h, $scroll); #- NEWT_FLAG_SCROLL foreach (@{$e->{list}}) { my $t = simplify_string(may_apply($e->{format}, $_)); $w->ListboxAddEntry($t, $_); $wi = max($wi, length $t); } $w->ListboxSetWidth(min($wi + 3, $width - 7)); # 3 added for the scrollbar (?) $get = sub { $w->ListboxGetCurrent }; $set = sub { my ($val) = @_; each_index { $w->ListboxSetCurrent($::i) if $val eq $_; } @{$e->{list}}; }; } else { $w = Newt::Component::Entry(-1, -1, '', 20, ($e->{hidden} && 1 << 11) | (1 << 2)); $get = sub { $w->EntryGetValue }; $set = sub { $w->EntrySet($_[0], 1) }; } $total_size += $size || 1; #- !! callbacks must be kept otherwise perl will free them !! #- (better handling of addCallback needed) { e => $e, w => $w, real_w => $real_w || $w, expand => $expand, callback => $changed, get => $get || sub { ${$e->{val}} }, set => $set || sub {} }; }; @widgets = map_index { $create_widget->($_, $::i) } @$l; $_->{w}->addCallback($_->{callback}) foreach @widgets; $set_all->(); my $grid = Newt::Grid::CreateGrid(3, max(1, int @$l)); each_index { $grid->GridSetField(0, $::i, 1, ${Newt::Component::Label(-1, -1, $_->{e}{label})}, 0, 0, 1, 0, 1, 0); $grid->GridSetField(1, $::i, 1, ${$_->{real_w}}, 0, 0, 0, 0, 1, 0); } @widgets; my $listg = do { my $height = 18; #- 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) { $grid->GridPlace(1, 1); #- Uh?? otherwise the size allocated is bad my $scroll = Newt::Component::VerticalScrollbar(-1, -1, $height, 9, 10); # 9=NEWT_COLORSET_CHECKBOX, 10=NEWT_COLORSET_ACTCHECKBOX my $subf = $scroll->Form('', 0); $subf->FormSetHeight($height); $subf->FormAddGrid($grid, 0); Newt::Grid::HCloseStacked3($subf, separator(1, $height-1), $scroll); } else { $grid; } }; my ($b1, $b2) = map { simplify_string($_) } (exists $common->{ok} ? ($common->{ok}, $common->{cancel}) : ($::isWizard ? N("Next") : N("Ok"), $common->{cancel} || ($::isWizard ? N("<- Previous") : N("Cancel")))); #- b1 is always displayed, so giving it some label :-( $b1 ||= $::isWizard ? N("Next") : N("Ok"); my @b2 = if_($b2, $b2); my ($buttons, $ok, $cancel) = Newt::Grid::ButtonBar($::isWizard ? (@b2, $b1) : ($b1, @b2)); ($ok, $cancel) = ($cancel, $ok) if $::isWizard; my $form = Newt::Component::Form(\undef, '', 0); my $window = Newt::Grid::GridBasicWindow(first(myTextbox(@widgets == 0, @{$common->{messages}})), $listg, $buttons); $window->GridWrappedWindow($common->{title} || ''); $form->FormAddGrid($window, 1); my $check = sub { my ($f) = @_; $get_all->(); my ($error, $focus) = $f->(); if ($error) { $set_all->(); } !$error; }; my ($destroyed, $canceled); do { my $r = do { local $::setstep = 1; $form->RunForm; }; $canceled = $cancel && $$r == $$cancel; if (my ($button) = grep { $$r == ${$_->{w}} } @widgets) { $get_all->(); my $v = do { local $::setstep = 1; $button->{e}{clicked_may_quit}(); }; $form->FormDestroy; Newt::PopWindow(); return $v || &ask_fromW; } } until $check->($common->{callbacks}{$canceled ? 'canceled' : 'complete'}); $form->FormDestroy; Newt::PopWindow(); !$canceled; } sub waitbox { my ($title, $messages) = @_; my ($t, $w, $h) = myTextbox(1, @$messages); my $f = Newt::Component::Form(\undef, '', 0); Newt::CenteredWindow($w, $h, $title); $f->FormAddComponent($t); $f->DrawForm; Newt::Refresh(); $f->FormDestroy; push @wait_messages, $f; $f; } sub wait_messageW { my ($o, $title, $messages) = @_; { form => waitbox($title, $messages), title => $title }; } sub wait_message_nextW { my ($o, $messages, $w) = @_; $o->wait_message_endW($w); $o->wait_messageW($w->{title}, $messages); } sub wait_message_endW { my ($o, $w) = @_; my $wait = pop @wait_messages; # log::l("interactive_newt does not handle none stacked wait-messages") if $w->{form} != $wait; Newt::PopWindow(); } sub simplify_string { my ($s) = @_; $s =~ s/\n/ /g; $s = substr($s, 0, 40); #- truncate if too long $s; } 1;