/usr/share/doc/libtexttools-doc/usermanual.html is in libtexttools-doc 2.1.0-10.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | <html>
<head>
<title>TextTools User Manual</title>
</head>
<body bgcolor="#FFF0F0">
<h2>TextTools 2.0</h2>
Copyright (c) 1999-2003 PegaSoft Canada.<br>
Designed and Programmed by Ken O. Burtch<br>
Home Page: http://www.pegasoft.ca/tt.html<br>
<p>The Texttools packages are a GPL, ncurses-based library for the Linux
console. Texttools contain more than 600 procedures and functions to
create windows, draw scroll bars, handle the mouse and keyboard events,
play sounds, and much more. The Texttools package also provides a
thick binding to Linux kernel calls. You can create a wide
variety of application programs using Texttools alone.
<p>TextTools is written in Ada 95 and C. You'll need to download the
Gnat compiler to use TextTools.
<h3>RECENT CHANGES</h3>
<p>The change logs are now online at the PegaSoft Linux Cafe
http://www.pegasoft.ca/docs/discus/index.html.
<p>Partial C++ support added.
<p>If you're looking to contribute to the Texttools project, here are
some outstanding jobs that need to be done:
<ol>
<li>A GUI Window Editor should be written. Texttools is designed to
load windows saved as a file.</li>
<li>The Window Manager should be rewritten to use tagged record features
when working with controls. The enumerated control type should be
discarded so users can create their own controls using child packages.</li>
<li>Regions and clipping need to be implemented to allow writing to
windows other than the top window.</li>
<li>Support for AU sounds should be added.</li>
<li>Support for modification keys (control, alt, etc) on mouse clicks
should be added.</li>
<li>Resizing by SIGWINCH isn't finished, primarily because of the
tasking problems in the ALT version of Gnat.</li>
<li>Multiline text pasting sometimes crashes on small files (or is
it because of pasting at the end of the text?) in EditList's.</li>
</ol>
<h3>INSTALLATION</h3>
<ol>
<li>Install the GNAT compiler (or in GCC 3.1 or newer, make sure
Ada is enabled).</li>
<li>Edit C_code/curses.c If you are using NCURSES3, uncomment the NCURSES3
define. If using NCURSES4, comment out the NCURSES5 define.</li>
<li>Type "make" in the topmost Texttools directory.</li>
<li>Test the examples by running them. (Note: Red Hat's console is not
fully VT-102 compatible. Use xterm instead.)</li>
</ol>
<p>The cpp directory contains C++ examples.
<p>The examples directory contains Ada examples.
<h3>USING TEXTTOOLS IN YOUR OWN PROJECTS</h3>
<ol>
<li>If TextTools are installed in a different
directory than your project, you will need to use the
gnatmake -I switch.</li>
<li>When linking, you'll need to include the "-lm" and
"-lcurses" switches. TextTools uses the C math library
and ncurses 3.x, 4.x or 5.x.</li>
</ol>
<h3>INTRODUCTION</h3>
<p>Although there are over 600 procedures and functions in TextTools,
to open window is fairly uncomplicated. Detailed explanations of
all TextTools procedures and functions are located in texttools.txt.
<p>Everything in TextTools is drawn in a window. Everything in a
window is a control (sometimes called a "widget"). To display
a window, you must create a window, fill in the window with
controls to display, and run the window manager's DoDialog
command.
<p>The following program opens a simple window.
<hr>
<pre>
with common, os, userio, controls, windows;
use common, os, userio, controls, windows;
procedure demo is
-- Define Window Controls
OKButton : aliased ASimpleButton;
MessageLine : aliased AStaticLine;
-- The Dialog Record
DT : ADialogTaskRecord;
begin
-- Start TextTools
StartupCommon( "demo", "demo" );
StartupOS;
StartupUserIO;
StartupControls;
StartupWindows;
-- Create a new window. The window will not appear until the
-- DoDialog procedure is used.
OpenWindow( To255( "Demo Window" ), -- title at top of window
0, 0, 78, 23, -- the coordinates of the window
Style => normal, -- type of window, usually "normal"
HasInfoBar => true ); -- true if control information is
-- displayed at the bottom of the
-- window
-- Setup the controls in the window
-- OK Button located near bottom of window
Init( OKButton,
36, 20, 44, 20, -- coordinates in window
'o' ); -- hot key for OK button
SetText( OKButton, "OK" ); -- button will have "OK"
SetInfo( OKButton, To255( "Select me to quit" ) );
AddControl( SimpleButton, OKButton'unchecked_access, IsGlobal => false );
-- Message at top of window in bright red
Init( MessageLine,
1, 1, 78, 1 );
SetText( MessageLine, "Welcome to TextTools" );
SetStyle( MessageLine, Bold );
SetColour( MessageLine, Red );
AddControl( SimpleButton, MessageLine'unchecked_access, IsGlobal => false );
-- Display the window and handle any input events. When dialog
-- is finished, return control which completed the dialog.
loop
DoDialog( DT );
exit when DT.Control = 1; -- first control is the OK button
end loop;
-- close the window
CloseWindow;
-- Shutdown TextTools
ShutdownWindows;
ShutdownControls;
ShutdownUserIO;
ShutdownOS;
ShutdownCommon;
end demo;
</pre>
<hr>
<h3>PACKAGE OVERVIEW</h3>
<p>TextTools is broken into 5 main packages, based on what they do.
<ul>
<li><b>Common</b> - this package contains all the basic data types used by
TextTools, plus subprograms that work with those types.
In particular, two important types are defined:
<ul>
<li>Str255 - most TextTools subprograms use this bounded,
255 character string type instead of the standard Ada
fixed strings. The function To255 converts an Ada
string to a Str255. ToString converts in the other
direction.</li>
<li>Str255List - some list controls display a block of
text. These controls use the Str255List.List type, a
linked list of Str255 strings. The subprograms
for this type are defined the generic package gen_list.</li>
<li>Most TextTools calls do not return errors. There are
some exceptions, such in the OS package. Error numbers
are returned in the LastError variable. LastError is
0 if there is no error.</li>
</ul>
</li><li>
<b>OS</b> - this package contains subprograms for working with the Linux
operating system: that is, for reading the current
time, deleting files, and the like.
<p>Texttools pathnames are defined in this package. A
path is a Str255 string. The OS package can define
path prefixes, beginning with a "$". For example,
"$HOME" is predefined as the user's home directory.
To delete a file called "temp.txt" from the user's
home directory, you can use the OS erase command:
<pre>Erase( To255( "$HOME/temp.txt" ) );</pre>
<p>$SYS is another predefined prefix. This refers to
a directory in the user's home directory named with
the "short name" you specify in the StartupCommon
procedure. Sounds, keyboard macros and the
session_log file are located here.
</li><li>
<b>UserIO</b> - this package contains all the input/output routines
for TextTools: it handles mouse clicks, draws text,
and so forth. Normally, only people writing controls
will need access to this package. However, the pen
colours, beep sounds and text styles, are also defined
here.
</li><li>
<b>Controls</b> - this package contains all the window controls and
related subprograms. Currently defined controls are:
<p>Thermometer<br>
ScrollBar<br>
StaticLine<br>
EditLine (and family)<br>
CheckBox<br>
RadioButton<br>
WindowButton<br>
Rectangle<br>
Line<br>
HorizontalSep<br>
VerticalSep<br>
StaticList<br>
CheckList<br>
RadioList<br>
EditList<br>
SourceCodeList (used by PegaSoft's TIA)<br>
</li><li>
<b>Windows</b> - this is the window manager. It creates and draws windows,
and DoDialog procedure lets a user interact with the window.
It also handles the "Accessories" window that appears when
ESC is pressed.
</li>
</ul>
Each package is started with a "Startup" procedure, and shutdown with
a "Shutdown" procedure. The only procedure to take parameters is
StartupCommon: you need to specify a program name and a short name to
use for temporary files.
<h3>WINDOW OVERVIEW</h3>
The Window Manager draws all the windows on the screen. For simple
programs, you will need to use only four Window Manager procedures.
<p>OpenWindow - this procedure creates a new window. Each window has
a title, coordinates on the screen, a "style", and an optional
info bar.
<p>AddControl - adds a control to the current window. If IsGlobal is
false, the coordinates you specified in the control's Init
call will be treated as relative to the top-left corner of the
window, as opposed to the top left corner of the screen.
<p>CloseWindow - closes the last window you created
<p>DoDialog - this procedure displays the window and handles all
interaction between the user and the window. It has one
parameter, ADialogTaskRecord, which lets you set up callbacks
(if necessary) and returns the number of the control which
terminated the dialog.
<h4>Other Useful Window Manager Subprograms</h4>
<p>Windows can be saved using the SaveWindow command, and loaded again
using LoadWindow. When a window is loaded with LoadWindow, you
don't need to open the window or set up the controls--the Window
Manager does this automatically for you.
<p><b>ShellOut</b> will close the windows, run a shell command, and reopen
the windows.
<p><b>RefreshDesktop</b> will redraw all the windows on the screen.
<p><b>SetWindowTimeout</b> will set a default control to be selected if there
is no response after a certain amount of time.
<h4>Alerts</h4>
<p>Alerts are small windows that show a short message.
<p>NoteAlert - displays a message with an "OK" button. The status sound
is played, if installed.
<p>CautionAlert - displays a message with an "OK" button. The text is drawn
to emphasize the message. The warning sound is played, if installed.
<p>StopAlert - displays a message with an "OK" button. The text is drawn
to emphasize the message. The warning sound is played, if installed.
<p>YesAlert - display a message with "yes" (default) and "no" buttons.
Plays an optional sound.
<p>NoAlert - display a message with "yes" and "no" (default) buttons.
Plays an optional sound.
<p>CancelAlert - display a message with cancel button and a customized
button (default). Plays an optional sound.
<p>YesCancelAlert - display a message with "yes", "no", and "cancel"
buttons and returns the number of the button selected. Plays an
optional sound.
<p>Example:
<pre>NoteAlert( "The database has been updated" );</pre>
<h4>Other Predefined Windows</h4>
<p>SelectOpenFile - displays a dialog for opening files. It has
one parameter, ASelectOpenFileRec. You have to fill in certain
details before displaying this window.
<p>SelectSaveFile - displays a dialog for saving files. It has
one parameter, ASelectSaveFileRec. You have to fill in certain
details before displaying this window.
<p>ShowListInfo - displays a Str255List list in a window
<p>EditListInfo - displays a Str255List list in a window and let's
the user edit the list.
<p>Example:
<pre>
sof : ASelectOpenFileRec;
...
sof.prompt := To255( "Select a file to open" );
sof.direct := false; -- can't select directories
SelectOpenFile( sof );
if sof.replied then
FilePath := sof.path & "/" & sof.fname;
else
-- user cancelled
end if;
</pre>
<h3>CONTROL OVERVIEW</h3>
<p>Every control must be initialized with the Init procedure. Init
positions the control in the window and assigns a "hot key", a
short cut key for moving to the control.
<p>You can turn a control off (make it unselectable) using SetStatus.
Setting the control's status to Standby will make it selectable.
Some controls are automatically turned off, such as the static
line control.
<p>The following controls can be used in a TextTools window:
<p>Thermometer - This is a thermometer bar graph. It shows the percentage between
the maximum value and the current value, and is filled based on the
percentage.
<p>ScrollBar - This is a scroll bar. A thumb is drawn at the relative location
of the thumb value to the maximum value of the bar. The bar will
be horizontal or vertical depending on the shape specified in the
Init procedure.
<p>StaticLine - This is an unchanging line of text.
<p>EditLine (and family) - This is an editable line of text.
<ul>
<li>AdvanceMode - if set, the cursor will move to the next control
when the edit field is full. This is useful in business
applications where fixed-length product numbers are typed in.</li>
<li>BlindMode - if set, hides the characters typed. This is
useful for typing in passwords.</li>
</ul>
<p>SimpleButton - This is a button that, when selected, terminates the dialog.
<ul>
<li>Instant - if set, the button acts like a menu item. Pressing
the hot key will immediately select the button and terminate
the dialog. Otherwise, pressing the hot key only moves the
cursor to the button.</li>
</ul>
<p>CheckBox - A check box is an option which may be turned on or off.
<p>RadioButton - A radio button is one of a set of options which may be turned
on or off. Every radio button has a family number defined in
the Init procedure. When a radio button is turned on, all
other buttons in the family are turned off.
<p>WindowButton - Loads a window from disk and displays it. The window must
have been saved with the Window Manager's SaveWindow procedure.
<p>Rectangle - A box which can be drawn around controls.
<p>Line - A line--what else would it be--drawn between two corners of the
enclosing rectangle defined by the Init procedure.
<p>HorizontalSep - A horizontal line, often used to separate controls into groups.
<p>VerticalSep - A vertical line, often used to separate controls into groups.
<p>StaticList - A scrollable box of unchanging text.
<p>CheckList - A scrollable box of check boxes.
<p>RadioList - A scrollable box of radio buttons.
<p>EditList - A scrollable box of editable text.
<p>SourceCodeList (used by PegaSoft's TIA) - A scrollable box containing source code.
<h3>OS Package</h3>
<p>This package contains various calls for working with the operating
system. All calls support path prefixes as described above. Here
are some of the subprograms:
<p>UNIX - run a UNIX shell command. The function variations return
the result of the command.
<p>RunIt - runs a UNIX program.
<p>ValidateFilename - check for a syntactically correct filename.
<p>NotEmpty - true if a file is not empty
<p>IsDirectory - true if file is a directory
<p>IsFile - true if file is a "regular" file
<p>MakeTempFileName - creates a random file name for a temporary file
<p>Erase - deletes a file
<p>LoadList - load a Str255List list from a file
<p>SaveList - save a Str255List list to a file
<p>MyID - return the PID for your program
<p>SessionLog - write to the session log. If a $SYS directory exists,
SessionLog creates a file called "session_log" in that directory.
All SessionLog calls write to this file.
<h3>UserIO Overview</h3>
<p>The UserIO package handles all the input and output for TextTools.
Unless you are writing a game or new controls, you'll probably
won't need to use UserIO at all. However, there are a few useful
subprograms to be aware of:
<p>Beep - play a .wav file. Requires Warren Gay's wavplay program.
These files must be saved in the $SYS directory, with the name
of the beep sound in upper case.
<p>Keypress - get a keypress
<p>DrawErr - draw an error message. DrawErr draws the text on the left-side
screen in white. Use only for emergencies.
<p>GetDisplayInfo - retrieve information about the current screen, such
as whether it supports colour, and it's dimensions. Use this
information to resize your windows for different screens.
<p>Example:
<Pre>Beep( Startup ); -- play startup sound</pre>
<h4>Keyboard Macros</h4>
<p>UserIO will load a set of keyboard macros at startup. These must
be saved in the $SYS directory, in a file called macro_file. The
first letter of each line is the key for the macro, and the rest
of the line is the expanded macro. For example, if a line in
macro_file contained
<pre>pPegaSoft</pre>
<p>then typing control-A followed by "p" would put the word "PegaSoft"
in the input queue as if the person had typed "PegaSoft".
<h4>Appearance and Keys</h4>
<p>Most of the objects on the screen should be easily understood, the
majority designed after their GUI counterparts. Here is a list:
<ul>
<li><tt>< > Text</tt> - A button. Press Return to activate. Type the hilighted
letter to go immediately to this button.</li>
<li><tt>| > Text</tt> - An menu button. Enter Return to activate. Type the
hilighted letter to immediately activate.</li>
<li><tt>( ) Text</tt> - A radio button. Press Return to select this item and
deselect the previous item in the group.</li>
<li><tt>[ ] Text</tt> - A check box. Press Return to switch on or off.</li>
<li><tt>-----#-------</tt> - A scroll bar.</li>
<li><tt>-----50%-----</tt> - A thermometer graph.</li>
</ul>
<p>Buttons with hyphens in them are not selectable.
<h4>Basic Keyboard Shortcuts:</h4>
<h5>Movement Keys</h5>
<ul>
<li>
Up/Down Arrow - move up or down to the next menu item
<ul>
<li>in lists - move up or down one line in the list</li>
<li>in scroll bars - adjust up or down by 10%</li>
</ul>
</li><li>
Left/Right Arrows - move left or right to the next menu item
<ul>
<li>in lists - move up or down one line in the list</li>
<li>in scroll bars - adjust up or down by 1</li>
</ul>
</li><li>
Page Up (or Control-P) - move up one page in a list
<ul>
<li>in scroll bars - same as up and down arrows</li>
</ul>
</li><li>
Page Down (or Control-N) - move down one page in a list
<ul>
<li>in scroll bars - same as up and down arrows</li>
</ul>
</li><li>
Home Key (or Control-Y) - move to the top of a list
<ul>
<li>in scroll bars - go to the top</li>
</ul>
</li><li>
End Key (or Control-E) - move to the bottom of a list
<ul>
<li>in scroll bars - go to the bottom</li>
</ul>
</li><li>
Tab Key - move to the next item in the window
</li><li>
Control-T - move to the previous item in the window
</li><li>
Return Key (or Spacebar) - activate a button
</li>
</ul>
When inside of a list box, the movement keys move you around the list.
If you are on the Linux console, pressing alt and the hilighted letter
will always jump to the appropriate object, even if you're inside a
list box or the notepad.
<h5>Editing Keys</h5>
<ul>
<li>
Control-6 - mark text
* only works in edit lists
</li><li>
Control-X - clear text
* in lists, clear the current line (or lines, if control-6 used)
</li><li>
Control-B - copy text
* in lists, copy the current line (or lines, if control-6 used)
</li><li>
Control-V - paste text
* in notepad, paste the last line copied
</ul>
<h5>Misc. Keys</h5>
<ul>
<li>ESC Key (or F1) - bring up the accessories menu</li>
<li>Control-L - redraw the screen</li>
<li>Control-A (or F2) - execute a keyboard macro</li>
</ul>
<p>For more detailed information, consult the TextTools reference manual.
<p>End of Document
</body>
</html>
|