Getopt-EvaP
view release on metacpan or search on metacpan
sub display_usage {
my($version) = @ARG;
# Open a Toplevel widget and insert some fanciful help text.
if (Exists($USAGE)) {
$USAGE->deiconify;
return;
}
$USAGE = $genPerlTk_mw->Toplevel;
$USAGE->title('Usage');
$USAGE->iconname('Usage');
$uhf = $USAGE->Frame;
$uht = $uhf->Text(qw(-relief raised -bd 1 -setgrid true -height 36
-wrap word),
);
$uhs = $uhf->Scrollbar(qw(-relief flat), -command => [$uht => 'yview']);
$uht->configure(-yscrollcommand => [$uhs => 'set']);
$uht->pack(qw(-side left -expand yes -fill both));
$uhs->pack(qw(-side right -fill y));
$uhm = $USAGE->Frame(qw/-borderwidth 2 -relief raised/);
$uhm->pack(qw(-side top -fill x -expand yes));
$uhmf = $uhm->Menubutton(qw(-text File -underline 0 -relief raised));
$uhmf->pack(qw(-side left));
$uhmf->command(
-label => 'Close',
-command => [$USAGE => 'withdraw'],
-underline => 0,
);
$uhf->pack(qw(-side left -expand yes -fill both));
$uhl = $USAGE->Frame(-borderwidth => 5);
$uhl->pack(qw( -side right -fill y));
$uhl_label = $uhl->Label(-text => 'Table of Contents');
$uhl_label->pack(qw(-side top -fill x));
$uhll = $uhl->Listbox(
qw(-relief sunken -setgrid 1),
-selectbackground => $genPerlTk_highlight,
);
$uhll->pack(qw(-side left -fill y));
$uhll->bind('<Double-1>' => [sub {
my($l, $uht) = @ARG;
my $mark = $l->get('active');
$mark =~ s/ /_/g;
$uht->yview("mark_usage_help_${mark}");
}, $uht]);
$uhl->AddScrollbars($uhll);
$uhl->configure(-scrollbars => 'e');
$uhll->insert('end', 'Introduction');
$uhll->insert('end', 'Quick Start');
$uhll->insert('end', 'Unix Command Syntax');
$uhll->insert('end', ' The Problem');
$uhll->insert('end', ' A Solution');
$uhll->insert('end', 'Parameter Types');
$uhll->insert('end', ' String');
$uhll->insert('end', ' Integer');
$uhll->insert('end', ' Real');
$uhll->insert('end', ' File');
$uhll->insert('end', ' Key');
$uhll->insert('end', ' Boolean');
$uhll->insert('end', ' Switch');
$uhll->insert('end', ' Name');
$uhll->insert('end', ' Application');
$uhll->insert('end', 'Lists');
$uhll->insert('end', 'The `Do It\' Button');
$uhll->insert('end', 'Windows');
$uhll->insert('end', ' Main Window');
$uhll->insert('end', ' Main File Menu');
$uhll->insert('end', ' Main Edit Menu');
$uhll->insert('end', ' Main Help Menu');
$uhll->insert('end', ' Output Window');
$uhll->insert('end', ' Output File Menu');
$uhll->insert('end', ' Help Window');
$uhll->insert('end', ' Help File Menu');
$uhll->insert('end', 'Revision History');
$uhll->insert('end', 'Credits');
$uht->tag('configure', qw(bold -font -Adobe-Courier-Bold-O-Normal-*-120-*));
$uht->tag('configure', qw(big -font -Adobe-Courier-Bold-R-Normal-*-140-*));
$uht->tag('configure', qw(verybig -font -Adobe-Helvetica-Bold-R-Normal-*-240-*));
if ($USAGE->depth > 1) {
$uht->tag('configure', qw(color2 -foreground blue));
} else {
$uht->tag('configure', qw(color2 -background black -foreground white));
}
$uht->tag('configure', qw(bgstipple -background black -borderwidth 0
-bgstipple gray25));
$uht->tag('configure', qw(fgstipple -fgstipple gray50));
$uht->tag('configure', qw(underline -underline on));
####### New section #######
$uht->insert('end', '
Introduction
', 'big');
my $start;
$start = $uht->index('end') - 4;
$uht->mark('set', 'mark_usage_help_Introduction', "$start.0");
$uht->insert('end', 'You are interacting with an X11 Perl/Tk Graphical User Interface for a typical Unix program. Although unimportant to you, this program uses as its command line interface the function ');
$uht->insert('end', "Evaluate Parameters", 'color2');
$uht->insert('end', ', which makes the creation of this GUI possible. By filling out a form and pushing buttons you can easily run this Unix program, avoiding most if not all of the pitfalls that Unix throws at you!
This program is brought to you courtesy of ');
$uht->insert('end', 'generate_PerlTk_program', 'color2');
$uht->insert('end', ', ');
$uht->insert('end', 'Perl', 'color2');
$uht->insert('end', ', ',);
$uht->insert('end', 'Tk', 'color2');
$uht->insert('end', ' and '),
$uht->insert('end', 'Evaluate Parameters', 'color2');
$uht->insert('end', '.');
####### New section #######
$uht->insert('end', '
Quick Start
', 'big');
$start = $uht->index('end') - 4;
$uht->mark('set', 'mark_usage_help_Quick_Start', "$start.0");
$uht->insert('end', 'In 25 words or less: fill in the blanks, push the required buttons and click on `Do It\'. That\'s really all there is to it.
Some parameters ');
$uht->insert('end', 'require', 'bold');
$uht->insert('end', ' a value: for parameters with an Entry box the value `$REQUIRED\' is displayed; for parameters with Radio or Check buttons none of the buttons are highlighted, so you must click on at least one.
Scroll through the window containing the command\'s help text to see what information the programmer has provided for you.
If the parameter is a list you may enter multiple space-separated items.
At the bottom of the main window is a box that displays the Unix command. As parameter values are entered you can watch the command update in realtime.
$start = $uht->index('end') - 4;
$uht->mark('set', 'mark_usage_help_Lists', "$start.0");
$uht->insert('end', 'Except for ');
$uht->insert('end', 'switches', 'bold');
$uht->insert('end', ', all parameter types can be lists, which simply means that multiple values can be supplied to the program. You can tell if a parameter can take a list by inspecting the type-code field in the main window - the letter `l\' i...
For most types you can simply enter your values separated by spaces, but don\'t forget to quote ');
$uht->insert('end', 'strings', 'bold');
$uht->insert('end', '. A list of ');
$uht->insert('end', 'keys', 'bold');
$uht->insert('end', ' is specified by pushing one or more Checkbuttons.');
####### New section #######
$uht->insert('end', '
The `Do It\' Button
', 'big');
$start = $uht->index('end') - 4;
$uht->mark('set', 'mark_usage_help_The_`Do_It\'_Button', "$start.0");
$uht->insert('end', 'After you are through customizing parameter values, click on ');
$uht->insert('end', 'Do It', 'bold');
$uht->insert('end', ' to start command execution. The button changes to ');
$uht->insert('end', 'Working ...', 'bold');
$uht->insert('end', ' and an Output window opens.
The button now changes to ');
$uht->insert('end', 'Cancel', 'bold');
$uht->insert('end', ' and begins blinking.');
$uht->insert('end', ' This means that you can abort the command at any time.');
####### New section #######
$uht->insert('end', '
Windows
', 'big');
$start = $uht->index('end') - 4;
$uht->mark('set', 'mark_usage_help_Windows', "$start.0");
$uht->insert('end', 'This section describes this application\'s Toplevel windows. The Main window is already open, you are using the Help window now, and there is an Output window which may or may not be open at this time.');
####### New section #######
$uht->insert('end', '
Main Window
', 'big');
$start = $uht->index('end') - 4;
$uht->mark('set', 'mark_usage_help___Main_Window', "$start.0");
$uht->insert('end', 'The Main window is the one you use most often. It contains the main controls for this X11 application which allow you to enter or change command parameter values, view help information, execute the Unix command and exit this...
$uht->insert('end', 'Do It', 'bold');
$uht->insert('end', ' button. The menus are described below.');
####### New section #######
$uht->insert('end', '
Main File Menu
', 'big');
$start = $uht->index('end') - 4;
$uht->mark('set', 'mark_usage_help_____Main_File_Menu', "$start.0");
$uht->insert('end', 'The Main window ');
$uht->insert('end', 'File', 'bold');
$uht->insert('end', ' menu contains these selections:
');
$uht->insert('end', ' Open ...
', 'bold');
$uht->tag('configure', qw(lmargin -lmargin1 90 -lmargin2 90));
$uht->tag('configure', qw(rmargin -rmargin 90));
$uht->insert('end', 'If the Unix program expects a trailing File Name you see this selection to browse your directory tree for the desired file. After a selection is made the file name is appended to the generated Unix command. If you are using...
', [qw(lmargin rmargin)]);
$uht->insert('end', ' Quit
', 'bold');
$uht->insert('end', 'Make this selection to quit the X11 application.
', [qw(lmargin rmargin)]);
####### New section #######
$uht->insert('end', '
Main Edit Menu
', 'big');
$start = $uht->index('end') - 4;
$uht->mark('set', 'mark_usage_help_____Main_Edit_Menu', "$start.0");
$uht->insert('end', 'The Main window ');
$uht->insert('end', 'Edit', 'bold');
$uht->insert('end', ' menu contains this selection:
');
$uht->insert('end', 'Undo All
', 'bold');
$uht->insert('end', 'Make this selection to reset all parameter values to their default values.', [qw(lmargin rmargin)]);
####### New section #######
$uht->insert('end', '
Main Help Menu
', 'big');
$start = $uht->index('end') - 4;
$uht->mark('set', 'mark_usage_help_____Main_Help_Menu', "$start.0");
$uht->insert('end', 'The Main window ');
$uht->insert('end', 'Help', 'bold');
$uht->insert('end', ' menu contains these selections:
');
$uht->insert('end', ' About
', 'bold');
$uht->insert('end', 'This selection tells you a little bit about the Unix program, and gives me some credit! (-:
', [qw(lmargin rmargin)]);
$uht->insert('end', '
Usage
', 'bold');
$uht->insert('end', 'This selction opens the Help window which you are currently using.
', [qw(lmargin rmargin)]);
####### New section #######
$uht->insert('end', '
Output Window
', 'big');
$start = $uht->index('end') - 4;
$uht->mark('set', 'mark_usage_help___Output_Window', "$start.0");
$uht->insert('end', 'The Output window holds standard output and standard error resulting from the execution of the Unix command. After clicking on the ');
$uht->insert('end', 'Do It', 'bold');
$uht->insert('end', ' button this window appears.
');
####### New section #######
$uht->insert('end', '
Output File Menu
', 'big');
$start = $uht->index('end') - 4;
$uht->mark('set', 'mark_usage_help_____Output_File_Menu', "$start.0");
$uht->insert('end', 'The Output window ');
$uht->insert('end', 'File', 'bold');
$uht->insert('end', ' menu contains these selections:
');
$uht->insert('end', '
Save As ...
', 'bold');
$uht->insert('end', 'Use this selection to save the contents of the Output window to a file.
', [qw(lmargin rmargin)]);
$uht->insert('end', '
Pipe To ...
', 'bold');
$uht->insert('end', 'Use this selection to write the contents of the Output window to a command pipeline. You might print or mail the window contents using this feature.
', [qw(lmargin rmargin)]);
$uht->insert('end', '
Close
', 'bold');
$uht->insert('end', 'Make this selection to close the Output window.
', [qw(lmargin rmargin)]);
####### New section #######
$uht->insert('end', '
Help Window
', 'big');
$start = $uht->index('end') - 4;
$uht->mark('set', 'mark_usage_help___Help_Window', "$start.0");
$uht->insert('end', 'The Help window is in use at this very momment. Hopefully all the information that you need to run this X11 application and execute the Unix command can be found here. If not, or you have further suggestions or comments, pl...
');
$uht->insert('end', '
Stephen.O.Lidie@Lehigh.EDU
', 'color2');
####### New section #######
$uht->insert('end', '
Help File Menu
', 'big');
$start = $uht->index('end') - 4;
$uht->mark('set', 'mark_usage_help_____Help_File_Menu', "$start.0");
$uht->insert('end', 'The Help window ');
$uht->insert('end', 'File', 'bold');
$uht->insert('end', ' menu contains this selection:
');
$uht->insert('end', '
Close
', 'bold');
$uht->insert('end', 'Make this selection to close the Help window.
', [qw(lmargin rmargin)]);
####### New section #######
$uht->insert('end', '
Revision History
', 'big');
$start = $uht->index('end') - 4;
$uht->mark('set', 'mark_usage_help_Revision_History', "$start.0");
$uht->insert('end', "This is version $version of ");
$uht->insert('end', 'generate_PerlTk_program', 'color2');
$uht->insert('end', ", that corresponds to version $version of ");
$uht->insert('end', 'Evaluate Parameters', 'color2');
$uht->insert('end', ' for ');
$uht->insert('end', 'C', 'color2');
$uht->insert('end', ', ');
$uht->insert('end', 'Perl', 'color2');
$uht->insert('end', ' and ');
$uht->insert('end', 'Tcl', 'color2');
$uht->insert('end', '.');
$uht->insert('end', '
95/10/26, version 2.3
. Original release.
98/07/26, version 2.3.3.
. Update for Perl 5.005 and Tk 800.008.
99/04/03, version 2.3.5.
. Update for Perl 5.005_03 and Tk 800.013.
');
####### New section #######
$uht->insert('end', '
Credits
', 'big');
$start = $uht->index('end') - 4;
$uht->mark('set', 'mark_usage_help_Credits', "$start.0");
$uht->tag('configure', qw(lmargin2 -lmargin1 20 -lmargin2 20));
$uht->tag('configure', qw(rmargin2 -rmargin 20));
$uht->insert('end', 'John K. Ousterhout, Scriptics.
');
$uht->insert('end', 'For writing ', [qw(lmargin2 rmargin2)]);
$uht->insert('end', 'Tcl/Tk', [qw(lmargin2 rmargin2 color2)]);
( run in 1.113 second using v1.01-cache-2.11-cpan-39bf76dae61 )