| 1 | // |
|---|
| 2 | // TxWin, Textmode Windowing Library |
|---|
| 3 | // |
|---|
| 4 | // Original code Copyright (c) 1995-2005 Fsys Software and Jan van Wijk |
|---|
| 5 | // |
|---|
| 6 | // ========================================================================== |
|---|
| 7 | // |
|---|
| 8 | // This file contains Original Code and/or Modifications of Original Code as |
|---|
| 9 | // defined in and that are subject to the GNU Lesser General Public License. |
|---|
| 10 | // You may not use this file except in compliance with the License. |
|---|
| 11 | // BY USING THIS FILE YOU AGREE TO ALL TERMS AND CONDITIONS OF THE LICENSE. |
|---|
| 12 | // A copy of the License is provided with the Original Code and Modifications, |
|---|
| 13 | // and is also available at http://www.dfsee.com/txwin/lgpl.htm |
|---|
| 14 | // |
|---|
| 15 | // This library is free software; you can redistribute it and/or modify |
|---|
| 16 | // it under the terms of the GNU Lesser General Public License as published |
|---|
| 17 | // by the Free Software Foundation; either version 2.1 of the License, |
|---|
| 18 | // or (at your option) any later version. |
|---|
| 19 | // |
|---|
| 20 | // This library is distributed in the hope that it will be useful, |
|---|
| 21 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 22 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|---|
| 23 | // See the GNU Lesser General Public License for more details. |
|---|
| 24 | // |
|---|
| 25 | // You should have received a copy of the GNU Lesser General Public License |
|---|
| 26 | // along with this library; (lgpl.htm) if not, write to the Free Software |
|---|
| 27 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 28 | // |
|---|
| 29 | // Questions on TxWin licensing can be directed to: txwin@fsys.nl |
|---|
| 30 | // |
|---|
| 31 | // ========================================================================== |
|---|
| 32 | // |
|---|
| 33 | // TXT navigation and general function interface |
|---|
| 34 | // |
|---|
| 35 | // Author: J. van Wijk |
|---|
| 36 | // |
|---|
| 37 | // JvW 08-07-2003 Initial version, derived from DFS.H |
|---|
| 38 | // |
|---|
| 39 | #ifndef TXT_H |
|---|
| 40 | #define TXT_H |
|---|
| 41 | |
|---|
| 42 | #define TXT_CMD_FAILED ((USHORT) 901) // Generic cmd failure code |
|---|
| 43 | #define TXT_ALLOC_ERROR ((USHORT) 906) // memory allocation error |
|---|
| 44 | #define TXT_PENDING ((USHORT) 907) // function pending |
|---|
| 45 | #define TXT_QUIT ((USHORT) 909) // quit TXT interactive |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | typedef struct txtinf // information anchor block |
|---|
| 49 | { |
|---|
| 50 | BOOL batch; // batch-mode active |
|---|
| 51 | BOOL dialogs; // dialogs will be used |
|---|
| 52 | ULONG verbosity; // output verbosity |
|---|
| 53 | int eStrategy; // error strategy |
|---|
| 54 | ULONG retc; // overall return-code |
|---|
| 55 | USHORT sbWidth; // visible scroll-buffer width |
|---|
| 56 | USHORT sbLength; // visible scroll-buffer length |
|---|
| 57 | BOOL autoquit; // auto quit after fdisk/setb |
|---|
| 58 | BOOL regconfirm; // registration conf required |
|---|
| 59 | BOOL nowindow; // running in classic mode |
|---|
| 60 | TXCELL *sbbuf; // actual scroll buffer |
|---|
| 61 | ULONG sbsize; // actual scrollbuf size |
|---|
| 62 | ULONG sblwidth; // actual sb linelength |
|---|
| 63 | TXWHANDLE sbwindow; // scroll-buffer window |
|---|
| 64 | TXWHANDLE menuOwner; // menu handling window |
|---|
| 65 | BOOL automenu; // automatic menu activation |
|---|
| 66 | BOOL autodrop; // automatic pulldown drop |
|---|
| 67 | ULONG menuopen; // default drop-down menu |
|---|
| 68 | ULONG worklevel; // when 0, activate menu |
|---|
| 69 | TXSELIST *slSchemes; // selection list, Color schemes |
|---|
| 70 | #if defined (DOS32) |
|---|
| 71 | BOOL win9x; // Windows-9x DosBox detected |
|---|
| 72 | #endif |
|---|
| 73 | } TXTINF; // end of struct "txtinf" |
|---|
| 74 | |
|---|
| 75 | extern TXTINF *txta; // TXT anchor block |
|---|
| 76 | |
|---|
| 77 | extern char *switchhelp[]; |
|---|
| 78 | extern char *cmdhelptxt[]; |
|---|
| 79 | |
|---|
| 80 | #define TXT_PROFILE "profile.txt" |
|---|
| 81 | |
|---|
| 82 | // scroll to end (output), cancel-abort and execute a new command |
|---|
| 83 | #define txtExecEnd(c) txwSendMsg( hwnd, TXWM_CHAR, 0, TXc_END), \ |
|---|
| 84 | TxCancelAbort(), \ |
|---|
| 85 | txtMultiCommand((c), TRUE, TRUE, FALSE) |
|---|
| 86 | |
|---|
| 87 | // cancel-abort and execute a new command |
|---|
| 88 | #define txtExecCmd(c) TxCancelAbort(), \ |
|---|
| 89 | txtMultiCommand((c), TRUE, TRUE, FALSE) |
|---|
| 90 | |
|---|
| 91 | |
|---|
| 92 | // cancel-abort and execute a new command, NO echo or prompting |
|---|
| 93 | #define txtExecSilent(c) TxCancelAbort(), \ |
|---|
| 94 | txtMultiCommand((c), FALSE, FALSE, TRUE) |
|---|
| 95 | |
|---|
| 96 | //- WARNING: Never execute two txtExec... from the menu, that will |
|---|
| 97 | //- cause the menu to restart after the 1st, causing hangs |
|---|
| 98 | //- Use a real "multiple command" in one go instead. |
|---|
| 99 | |
|---|
| 100 | #define txtBEGINWORK() {txta->worklevel++;} |
|---|
| 101 | #define txtENDWORK() { \ |
|---|
| 102 | if (txta->worklevel) \ |
|---|
| 103 | { \ |
|---|
| 104 | if ((--(txta->worklevel) == 0) && \ |
|---|
| 105 | (txta->menuOwner != 0) ) \ |
|---|
| 106 | { \ |
|---|
| 107 | txwPostMsg( txta->menuOwner, \ |
|---|
| 108 | TXWM_COMMAND, TXTM_DEFAULT, 0); \ |
|---|
| 109 | } \ |
|---|
| 110 | } \ |
|---|
| 111 | } |
|---|
| 112 | |
|---|
| 113 | |
|---|
| 114 | // Print TXTst logo+status, do startup checks, run startup commands + profile |
|---|
| 115 | ULONG txtStartupLogo // RET Checks and firstcmd RC |
|---|
| 116 | ( |
|---|
| 117 | char *firstcmd // IN initial command |
|---|
| 118 | ); |
|---|
| 119 | |
|---|
| 120 | |
|---|
| 121 | // Execute multiple txt-commands separated by # characters |
|---|
| 122 | ULONG txtMultiCommand |
|---|
| 123 | ( |
|---|
| 124 | char *cmdstring, // IN multiple command |
|---|
| 125 | BOOL echo, // IN Echo before execute |
|---|
| 126 | BOOL prompt, // IN prompt after execute |
|---|
| 127 | BOOL quiet // IN screen-off during cmd |
|---|
| 128 | ); |
|---|
| 129 | |
|---|
| 130 | #endif |
|---|