2012-07-23 20:01:52 -07:00
Unit bbs_cfg_MenuEdit;
2012-02-13 16:50:48 -08:00
{$I M_OPS.PAS}
Interface
2012-07-23 20:01:52 -07:00
Procedure Configuration_MenuEditor;
Implementation
2012-02-13 16:50:48 -08:00
Uses
DOS,
2012-07-23 20:01:52 -07:00
m_Types,
m_Output,
2012-02-13 16:50:48 -08:00
m_Strings,
2012-07-23 20:01:52 -07:00
m_QuickSort,
2012-02-13 16:50:48 -08:00
m_FileIO,
2012-07-23 20:01:52 -07:00
bbs_Ansi_MenuBox,
bbs_Ansi_MenuForm,
BBS_Core,
BBS_Common,
BBS_MenuData,
bbs_cfg_Theme,
bbs_cfg_Common;
2012-02-13 16:50:48 -08:00
2012-07-23 20:01:52 -07:00
Type
CmdRec = Record
Name : String [ 2 ] ;
Desc : String [ 3 0 ] ;
End ;
2012-02-13 16:50:48 -08:00
2012-07-23 20:01:52 -07:00
Const
2013-02-26 04:45:01 -08:00
Num_Cmds = 1 0 0 ;
2012-07-23 20:01:52 -07:00
MenuCmds : Array [ 1 .. Num_Cmds] of CmdRec = (
// AUTOSIG MENU COMMANDS
( Name : 'AE' ; Desc: 'Autosig editor' ) ,
( Name : 'AT' ; Desc: 'Toggle autosig on/off' ) ,
( Name : 'AV' ; Desc: 'View autosig' ) ,
// BBS LIST MENU COMMANDS
( Name : 'BA' ; Desc: 'BBS list add' ) ,
( Name : 'BL' ; Desc: 'BBS list view extended' ) ,
( Name : 'BS' ; Desc: 'BBS list view' ) ,
// DOOR EXECUTION MENU COMMANDS
( Name : 'D-' ; Desc: 'Exec door (no dropfile)' ) ,
( Name : 'D3' ; Desc: 'Exec door (door32.sys)' ) ,
( Name : 'DC' ; Desc: 'Exec door (CHAIN.TXT)' ) ,
( Name : 'DD' ; Desc: 'Exec door (DORINFO1.DEF)' ) ,
( Name : 'DG' ; Desc: 'Exec door (DOOR.SYS)' ) ,
// FILE BASE MENU COMMANDS
( Name : 'FA' ; Desc: 'File area change' ) ,
( Name : 'FD' ; Desc: 'Download file' ) ,
( Name : 'FF' ; Desc: 'Download filelist' ) ,
( Name : 'FG' ; Desc: 'File group change' ) ,
( Name : 'FL' ; Desc: 'List files' ) ,
( Name : 'FN' ; Desc: 'New file scan' ) ,
( Name : 'FP' ; Desc: 'Set new filescan date' ) ,
( Name : 'FS' ; Desc: 'Search for files' ) ,
( Name : 'FU' ; Desc: 'Upload files' ) ,
( Name : 'FV' ; Desc: 'View archive' ) ,
( Name : 'FZ' ; Desc: 'Toggle newscan bases' ) ,
2012-08-15 19:18:55 -07:00
( Name : 'F1' ; Desc: '(SYS) Mass upload' ) ,
( Name : 'F2' ; Desc: '(SYS) Directory editor' ) ,
2012-07-23 20:01:52 -07:00
( Name : 'F3' ; Desc: 'Send file by location' ) ,
// GENERAL MENU COMMANDS
( Name : 'G1' ; Desc: 'Show BBS history' ) ,
( Name : 'GA' ; Desc: 'ANSI art gallery' ) ,
( Name : 'GD' ; Desc: 'Display a file' ) ,
( Name : 'GE' ; Desc: 'Edit user settings' ) ,
( Name : 'GH' ; Desc: 'Hangup' ) ,
( Name : 'GI' ; Desc: 'Hangup immediately' ) ,
( Name : 'GL' ; Desc: 'Show last callers' ) ,
( Name : 'GO' ; Desc: 'Go to new menu' ) ,
( Name : 'GN' ; Desc: 'Show one-liners' ) ,
( Name : 'GP' ; Desc: 'Page Sysop for chat' ) ,
( Name : 'GR' ; Desc: 'Return from gosub menu' ) ,
( Name : 'GS' ; Desc: 'Gosub to new menu' ) ,
2012-07-23 21:55:32 -07:00
( Name : 'GT' ; Desc: 'Display line of text' ) ,
2012-07-23 20:01:52 -07:00
( Name : 'GU' ; Desc: 'Display user list' ) ,
2013-02-16 18:23:51 -08:00
( Name : 'GV' ; Desc: 'ANSI File viewer' ) ,
2012-07-23 20:01:52 -07:00
( Name : 'GX' ; Desc: 'Execute MPL program' ) ,
( Name : 'G?' ; Desc: 'Open ANSI help browser' ) ,
// MESSAGE BASE MENU COMMANDS
( Name : 'MA' ; Desc: 'Message area change' ) ,
( Name : 'MC' ; Desc: 'Check e-mail' ) ,
( Name : 'MD' ; Desc: 'Set msg newscan date' ) ,
( Name : 'MG' ; Desc: 'Message group change' ) ,
( Name : 'MM' ; Desc: 'Send mass e-mail' ) ,
( Name : 'MN' ; Desc: 'Message new scan' ) ,
( Name : 'MP' ; Desc: 'Post a message' ) ,
( Name : 'MQ' ; Desc: 'Message quick scan' ) ,
( Name : 'MR' ; Desc: 'Read messages' ) ,
( Name : 'MS' ; Desc: 'Global message search' ) ,
( Name : 'MV' ; Desc: 'View sent e-mail' ) ,
( Name : 'MW' ; Desc: 'Send new e-mail' ) ,
( Name : 'MX' ; Desc: 'Post text file to base' ) ,
( Name : 'MZ' ; Desc: 'Toggle new scan bases' ) ,
// NODE MENU COMMANDS
( Name : 'NA' ; Desc: 'Set node action' ) ,
( Name : 'NC' ; Desc: 'Enter teleconference chat' ) ,
( Name : 'NP' ; Desc: 'Page user for private chat' ) ,
( Name : 'NS' ; Desc: 'Send node message' ) ,
( Name : 'NW' ; DEsc: 'Show whos online' ) ,
// OFFLINE MAIL MENU COMMANDS
( Name : 'OS' ; Desc: 'Set QWK scanned bases' ) ,
( Name : 'OD' ; Desc: 'Download QWK packet' ) ,
2012-08-15 19:18:55 -07:00
( Name : 'OE' ; Desc: 'Download QWKE packet' ) ,
2012-07-23 20:01:52 -07:00
( Name : 'OU' ; Desc: 'Upload REP packet' ) ,
// DOWNLOAD QUEUE MENU COMMANDS
( Name : 'QA' ; Desc: 'Add file to batch queue' ) ,
( Name : 'QC' ; Desc: 'Clear batch queue' ) ,
( Name : 'QD' ; Desc: 'Delete from batch queue' ) ,
( Name : 'QL' ; Desc: 'List batch queue' ) ,
// TIME BANK MENU COMMANDS
( Name : 'TD' ; Desc: 'Deposit to time bank' ) ,
( Name : 'TW' ; Desc: 'Withdraw from time bank' ) ,
// VOTING BOOTH MENU COMMANDS
( Name : 'VA' ; Desc: 'Create voting poll' ) ,
( Name : 'VN' ; Desc: 'Vote on new polls' ) ,
( Name : 'VR' ; Desc: 'See poll results' ) ,
( Name : 'VV' ; Desc: 'Vote on a poll' ) ,
// MATRIX LOGIN MENU COMMANDS
( Name : 'XA' ; Desc: 'Matrix apply for access' ) ,
( Name : 'XC' ; Desc: 'Matrix check for access' ) ,
( Name : 'XL' ; Desc: 'Matrix login' ) ,
( Name : 'XP' ; Desc: 'Matrix page sysop' ) ,
// OTHER MENU COMMANDS
( Name : '-D' ; Desc: 'Set access flags (set 2)' ) ,
( Name : '-F' ; Desc: 'Set access flags (set 1)' ) ,
2013-02-26 04:45:01 -08:00
( Name : '-G' ; Desc: 'Show generated menu' ) ,
2012-07-30 15:17:32 -07:00
( Name : '-I' ; Desc: 'Set menu timer' ) ,
2012-07-23 20:01:52 -07:00
( Name : '-K' ; Desc: 'Add keys to input buffer' ) ,
( Name : '-N' ; Desc: 'Ask Yes/No (default No)' ) ,
( Name : '-P' ; Desc: 'Prompt for a password' ) ,
( Name : '-S' ; Desc: 'Add text to Sysop log' ) ,
( Name : '-Y' ; Desc: 'Ask Yes/No (default Yes)' ) ,
// SYSOP/EDITORS MENU COMMANDS
2012-08-15 19:18:55 -07:00
( Name : '*#' ; Desc: '(SYS) Menu editor' ) ,
( Name : '*A' ; Desc: '(SYS) Archive editor' ) ,
( Name : '*E' ; Desc: '(SYS) Event editor' ) ,
( Name : '*F' ; Desc: '(SYS) File base editor' ) ,
( Name : '*G' ; Desc: '(SYS) Message group editor' ) ,
( Name : '*L' ; Desc: '(SYS) Security level editor' ) ,
( Name : '*B' ; Desc: '(SYS) Message base editor' ) ,
( Name : '*P' ; Desc: '(SYS) Protocol editor' ) ,
( Name : '*R' ; Desc: '(SYS) File group editor' ) ,
( Name : '*S' ; Desc: '(SYS) System configuration' ) ,
( Name : '*U' ; Desc: '(SYS) User editor' ) ,
( Name : '*V' ; Desc: '(SYS) Voting booth editor' )
2012-07-23 20:01:52 -07:00
) ; {123456789012345678901234567890}
Var
Menu : TMenuData;
MenuName : String ;
Changed : Boolean ;
Procedure ViewMenu;
Var
OldData : TMenuData;
TmpImage : TConsoleImageRec;
Begin
Screen. GetScreenImage ( 1 , 1 , 7 9 , 2 4 , TmpImage) ;
Session. io. OutFull( '|07|16|CL' ) ;
Session. io. BufFlush;
OldData : = Session. Menu. Data;
Session. Menu. Data : = Menu;
Session. Menu. ExecuteMenu( False , False , True , False ) ;
Session. Menu. Data : = OldData;
Session. io. RemoteRestore( TmpImage) ;
End ;
Function GetCommandDesc ( Str: String ) : String ;
Var
Count : Byte ;
Begin
Result : = 'Unknown Command' ;
2012-07-23 21:55:32 -07:00
2012-07-23 20:01:52 -07:00
For Count : = 1 to Num_Cmds Do
If Str = MenuCmds[ Count] . Name Then Begin
Result : = MenuCmds[ Count] . Desc;
Break;
End ;
End ;
Function GetCommand ( Str: String ) : String ;
Var
List : TAnsiMenuList;
Count : Byte ;
Begin
List : = TAnsiMenuList. Create;
For Count : = 1 to Num_Cmds Do Begin
List. Add ( MenuCmds[ Count] . Name + ' ' + MenuCmds[ Count] . Desc, 0 ) ;
If Str = MenuCmds[ Count] . Name Then
List. Picked : = Count;
End ;
List. Open ( 2 1 , 4 , 5 9 , 1 9 ) ;
List. Close;
If List. ExitCode = #13 Then Begin
Changed : = Str = MenuCmds[ List. Picked] . Name ;
Str : = MenuCmds[ List. Picked] . Name ;
End ;
List. Free;
2012-02-13 16:50:48 -08:00
2012-07-23 20:01:52 -07:00
Result : = Str;
End ;
Procedure GetExtendedKey ( Var Key: String ) ;
2012-02-13 16:50:48 -08:00
Var
2012-07-23 20:01:52 -07:00
List : TAnsiMenuList;
Begin
List : = TAnsiMenuList. Create;
List. Add ( 'FIRSTCMD' , 0 ) ;
2012-07-23 21:55:32 -07:00
List. Add ( 'EVERY' , 0 ) ;
List. Add ( 'AFTER' , 0 ) ;
2012-07-23 20:01:52 -07:00
List. Add ( 'LINEFEED' , 0 ) ;
2012-07-23 21:55:32 -07:00
List. Add ( 'TIMER' , 0 ) ;
List. Add ( 'UP' , 0 ) ;
List. Add ( 'DOWN' , 0 ) ;
List. Add ( 'LEFT' , 0 ) ;
List. Add ( 'RIGHT' , 0 ) ;
List. Add ( 'ENTER' , 0 ) ;
List. Add ( 'TAB' , 0 ) ;
List. Add ( 'ESCAPE' , 0 ) ;
List. Add ( 'HOME' , 0 ) ;
List. Add ( 'END' , 0 ) ;
List. Add ( 'PAGEUP' , 0 ) ;
2012-07-23 20:01:52 -07:00
List. Add ( 'PAGEDOWN' , 0 ) ;
List. Open ( 3 5 , 4 , 4 6 , 2 1 ) ;
List. Close;
2012-02-13 16:50:48 -08:00
2012-07-23 20:01:52 -07:00
If List. ExitCode < > #27 Then Begin
Changed : = List. List[ List. Picked] ^ . Name < > Key;
Key : = List. List[ List. Picked] ^ . Name ;
End ;
2012-02-13 16:50:48 -08:00
2012-07-23 20:01:52 -07:00
List. Free;
End ;
Procedure EditCommand ( Num, CmdNum: Word ) ;
Var
Box : TAnsiMenuBox;
Form : TAnsiMenuForm;
Topic : String ;
CmdStr : String ;
2012-02-13 16:50:48 -08:00
Begin
2012-07-23 20:01:52 -07:00
Topic : = '|03(|09Menu Cmd Editor|03) |01-|09> |15' ;
Box : = TAnsiMenuBox. Create;
Form : = TAnsiMenuForm. Create;
Box. Header : = ' Menu (' + MenuName + '): Command #' + strI2S( Num) + ' ' ;
Box. Open ( 1 3 , 9 , 6 8 , 1 6 ) ;
VerticalLine ( 2 4 , 1 1 , 1 4 ) ;
2012-11-18 09:04:59 -08:00
Form. AddNone ( 'C' , ' Command ' , 1 5 , 1 1 , 2 6 , 1 1 , 9 , Topic + 'Menu command function' ) ;
2012-08-08 10:51:11 -07:00
Form. AddStr ( 'D' , ' Data ' , 1 8 , 1 2 , 2 6 , 1 2 , 6 , 4 0 , 1 6 0 , @ Menu. Item[ Num] ^ . CmdData[ CmdNum] ^ . Data, Topic + 'Menu command optional data' ) ;
Form. AddStr ( 'A' , ' Access ' , 1 6 , 1 3 , 2 6 , 1 3 , 8 , 3 0 , 3 0 , @ Menu. Item[ Num] ^ . CmdData[ CmdNum] ^ . Access, Topic + 'Access level to run this command' ) ;
2012-07-23 21:55:32 -07:00
Form. AddTog ( 'G' , ' Execute ' , 1 5 , 1 4 , 2 6 , 1 4 , 9 , 6 , 0 , 1 0 , 'Selected Up Down Left Right Tab Escape PgUp PgDn Home End' , @ Menu. Item[ Num] ^ . CmdData[ CmdNum] ^ . JumpID, Topic + '(Grid) Execute command on what Grid event?' ) ;
2012-07-23 20:01:52 -07:00
Repeat
CmdStr : = '(' + Menu. Item[ Num] ^ . CmdData[ CmdNum] ^ . MenuCmd + ') ' + GetCommandDesc( Menu. Item[ Num] ^ . CmdData[ CmdNum] ^ . MenuCmd) ;
2012-07-23 21:55:32 -07:00
2012-07-23 20:01:52 -07:00
WriteXY ( 2 6 , 1 1 , 1 1 3 , strPadR( CmdStr, 4 0 , ' ' ) ) ;
Case Form. Execute of
#27 : Break;
'C' : Begin
Menu. Item[ Num] ^ . CmdData[ CmdNum] ^ . MenuCmd : = GetCommand( Menu. Item[ Num] ^ . CmdData[ CmdNum] ^ . MenuCmd) ;
Changed : = True ;
End ;
End ;
Changed : = Changed or Form. Changed;
Until False ;
Changed : = Changed or Form. Changed;
Box. Close;
Box. Free;
Form. Free;
2012-02-13 16:50:48 -08:00
End ;
2012-07-23 20:01:52 -07:00
Procedure EditItem ( Num: Word ) ;
Const
2012-07-23 21:55:32 -07:00
Status1 = ' (TAB) to edit menu commands ' ;
Status2 = ' (TAB) Switch (/) Commands ' ;
2012-07-24 14:54:01 -07:00
Grid = '(Grid) Item # to jump to on keypress ' ;
2012-02-13 16:50:48 -08:00
Var
2012-09-22 14:38:56 -07:00
Box : TAnsiMenuBox;
List : TAnsiMenuList;
Form : TAnsiMenuForm;
Topic : String ;
CopyCmd : RecMenuCmd;
HasCopy : Boolean = False ;
2012-07-23 20:01:52 -07:00
Procedure MakeList;
Var
Count : Word ;
Begin
List. Clear;
For Count : = 1 to Menu. Item[ Num] ^ . Commands Do
With Menu. Item[ Num] ^ . CmdData[ Count] ^ Do Begin
List. Add( strPadR( '(' + MenuCmd + ') ' + GetCommandDesc( MenuCmd) , 2 6 , ' ' ) + ' ' +
strPadR( Access, 1 2 , ' ' ) + ' ' + Data, 0 ) ;
End ;
List. Add ( '' , 0 ) ;
End ;
2012-02-13 16:50:48 -08:00
Begin
2012-07-23 20:01:52 -07:00
Box : = TAnsiMenuBox. Create;
List : = TAnsiMenuList. Create;
Form : = TAnsiMenuForm. Create;
Form. LoExitChars : = #09 #12 #27 ;
List. LoChars : = #09 #13 #27 #47 ;
List. LoAttr : = 1 1 3 ;
List. NoInput : = True ;
List. NoWindow : = True ;
2012-08-04 16:18:48 -07:00
List. SearchY : = 2 1 ;
2012-07-23 21:55:32 -07:00
Box. Shadow : = False ;
2012-07-23 20:01:52 -07:00
Box. Header : = ' Command #' + strI2S( Num) + ' (' + MenuName + ') ' ;
Topic : = '|03(|09Menu Editor|03) |01-|09> |15' ;
2012-07-23 21:55:32 -07:00
Box. Open ( 2 , 5 , 7 9 , 2 1 ) ;
2012-07-23 20:01:52 -07:00
2012-07-23 21:55:32 -07:00
VerticalLine ( 1 8 , 6 , 1 4 ) ;
VerticalLine ( 6 0 , 1 0 , 1 4 ) ;
2012-07-24 13:29:51 -07:00
VerticalLine ( 4 1 , 1 4 , 1 4 ) ;
2012-07-23 21:55:32 -07:00
VerticalLine ( 7 3 , 1 0 , 1 4 ) ;
2012-07-23 20:01:52 -07:00
2012-07-23 21:55:32 -07:00
WriteXY ( 4 , 1 5 , 1 1 2 , 'Command ' + strRep( #196 , 1 8 ) + ' Access ' + strRep( #196 , 5 ) + ' Data ' + strRep( #196 , 2 9 ) ) ;
2012-07-23 20:01:52 -07:00
MakeList;
2012-07-23 21:55:32 -07:00
List. Open ( 2 , 1 5 , 7 9 , 2 1 ) ;
2012-07-23 20:01:52 -07:00
List. Picked : = 0 ;
List. Update;
2012-07-24 14:54:01 -07:00
Form. AddPipe ( 'D' , ' Display Text' , 4 , 6 , 2 0 , 6 , 1 4 , 5 8 , 1 6 0 , @ Menu. Item[ Num] ^ . Text , Topic + 'Text displayed on generated menus' ) ;
Form. AddPipe ( 'O' , ' LightBar Low' , 4 , 7 , 2 0 , 7 , 1 4 , 5 8 , 1 6 0 , @ Menu. Item[ Num] ^ . TextLo, Topic + 'Normal text in lightbar menu' ) ;
Form. AddPipe ( 'I' , ' LightBar High' , 3 , 8 , 2 0 , 8 , 1 5 , 5 8 , 1 6 0 , @ Menu. Item[ Num] ^ . TextHi, Topic + 'Highlighted text in lightbar menu' ) ;
Form. AddCaps ( 'H' , ' Hot Key' , 9 , 9 , 2 0 , 9 , 9 , 1 2 , mysMaxMenuInput, @ Menu. Item[ Num] ^ . HotKey, Topic + 'Key to run this command (CTRL-L/Extended Key List)' ) ;
Form. AddStr ( 'A' , ' Access' , 1 0 , 1 0 , 2 0 , 1 0 , 8 , 3 0 , 3 0 , @ Menu. Item[ Num] ^ . Access, Topic + 'ACS level required to access this command' ) ;
Form. AddTog ( 'S' , ' Display Type' , 4 , 1 1 , 2 0 , 1 1 , 1 4 , 6 , 0 , 2 , 'Access Always Never' , @ Menu. Item[ Num] ^ . ShowType, Topic + 'How should this command be displayed?' ) ;
2012-07-23 21:55:32 -07:00
Form. AddByte ( 'X' , 'X' , 1 4 , 1 2 , 2 0 , 1 2 , 1 , 2 , 0 , 8 0 , @ Menu. Item[ Num] ^ . X, Topic + 'X coordinate of lightbar' ) ;
Form. AddByte ( 'Y' , 'Y' , 1 6 , 1 2 , 2 3 , 1 2 , 1 , 2 , 0 , 5 0 , @ Menu. Item[ Num] ^ . Y, Topic + 'Y coordinate of lightbar' ) ;
2012-07-24 14:54:01 -07:00
Form. AddWord ( 'M' , ' Timer' , 1 1 , 1 3 , 2 0 , 1 3 , 7 , 5 , 0 , 6 5 5 3 5 , @ Menu. Item[ Num] ^ . Timer, Topic + 'Timer interval (seconds)' ) ;
Form. AddTog ( 'X' , ' Timer Type' , 6 , 1 4 , 2 0 , 1 4 , 1 2 , 9 , 0 , 2 , 'Interval OnlyOnce PerRedraw' , @ Menu. Item[ Num] ^ . TimerType, Topic + 'TIMER event execution type' ) ;
2012-07-24 13:29:51 -07:00
2012-07-24 14:54:01 -07:00
Form. AddBol ( 'W' , ' Redraw' , 3 3 , 1 4 , 4 3 , 1 4 , 8 , 3 , @ Menu. Item[ Num] ^ . ReDraw, Topic + 'Redraw menu after running this command?' ) ;
2012-07-23 21:55:32 -07:00
2012-07-24 14:54:01 -07:00
Form. AddByte ( 'U' , ' Up' , 5 6 , 1 0 , 6 2 , 1 0 , 4 , 3 , 0 , 2 5 5 , @ Menu. Item[ Num] ^ . JumpUp, Topic + Grid + 'UP' ) ;
2012-08-04 16:18:48 -07:00
Form. AddByte ( #01 , ' Down' , 5 4 , 1 1 , 6 2 , 1 1 , 6 , 3 , 0 , 2 5 5 , @ Menu. Item[ Num] ^ . JumpDown, Topic + Grid + 'DOWN' ) ;
2012-07-24 14:54:01 -07:00
Form. AddByte ( 'L' , ' Left' , 5 4 , 1 2 , 6 2 , 1 2 , 6 , 3 , 0 , 2 5 5 , @ Menu. Item[ Num] ^ . JumpLeft, Topic + Grid + 'LEFT' ) ;
Form. AddByte ( 'R' , ' Right' , 5 3 , 1 3 , 6 2 , 1 3 , 7 , 3 , 0 , 2 5 5 , @ Menu. Item[ Num] ^ . JumpRight, Topic + Grid + 'RIGHT' ) ;
Form. AddByte ( 'E' , ' Home' , 5 4 , 1 4 , 6 2 , 1 4 , 6 , 3 , 0 , 2 5 5 , @ Menu. Item[ Num] ^ . JumpHome, Topic + Grid + 'HOME' ) ;
2012-07-23 21:55:32 -07:00
2012-07-24 14:54:01 -07:00
Form. AddByte ( 'C' , ' Escape' , 6 5 , 1 0 , 7 5 , 1 0 , 8 , 3 , 0 , 2 5 5 , @ Menu. Item[ Num] ^ . JumpEscape, Topic + Grid + 'ESCAPE' ) ;
Form. AddByte ( 'T' , ' Tab' , 6 8 , 1 1 , 7 5 , 1 1 , 5 , 3 , 0 , 2 5 5 , @ Menu. Item[ Num] ^ . JumpTab, Topic + Grid + 'TAB' ) ;
Form. AddByte ( 'P' , ' PageUp' , 6 5 , 1 2 , 7 5 , 1 2 , 8 , 3 , 0 , 2 5 5 , @ Menu. Item[ Num] ^ . JumpPgUp, Topic + Grid + 'PGUP' ) ;
Form. AddByte ( 'G' , ' PageDn' , 6 5 , 1 3 , 7 5 , 1 3 , 8 , 3 , 0 , 2 5 5 , @ Menu. Item[ Num] ^ . JumpPgDn, Topic + Grid + 'PGDN' ) ;
Form. AddByte ( 'N' , ' End' , 6 8 , 1 4 , 7 5 , 1 4 , 5 , 3 , 0 , 2 5 5 , @ Menu. Item[ Num] ^ . JumpEnd, Topic + Grid + 'END' ) ;
2012-07-23 21:55:32 -07:00
2012-07-24 13:29:51 -07:00
WriteXY ( 2 6 , 2 1 , 1 2 0 , Status1) ;
2012-07-23 20:01:52 -07:00
Repeat
Case Form. Execute of
#09 : Begin
2012-07-24 13:29:51 -07:00
WriteXY ( 2 6 , 2 1 , 1 2 0 , Status2) ;
2012-07-23 21:55:32 -07:00
2012-07-23 20:01:52 -07:00
Repeat
MakeList;
List. NoInput : = False ;
2012-07-23 21:55:32 -07:00
List. Open ( 2 , 1 5 , 7 9 , 2 1 ) ;
2012-07-23 20:01:52 -07:00
Case List. ExitCode of
2012-09-22 14:38:56 -07:00
'/' : Case GetCommandOption( 1 0 , 'I-Insert|D-Delete|C-Copy|P-Paste|' ) of
'C' : If List. Picked < > List. ListMax Then Begin
CopyCmd : = Menu. Item[ Num] ^ . CmdData[ List. Picked] ^ ;
HasCopy : = True ;
End ;
'P' : If HasCopy Then Begin
Menu. InsertCommand( Num, List. Picked) ;
Menu. Item[ Num] ^ . CmdData[ List. Picked] ^ : = CopyCmd;
Changed : = True ;
End ;
2012-07-24 13:29:51 -07:00
'I' : Begin
2012-07-23 20:01:52 -07:00
Menu. InsertCommand( Num, List. Picked) ;
Changed : = True ;
End ;
'D' : If List. Picked < > List. ListMax Then Begin
Menu. DeleteCommand( Num, List. Picked) ;
Changed : = True ;
End ;
End ;
#09 : Begin
List. Picked : = 0 ;
List. Update;
Break;
End ;
#13 : If List. Picked < > List. ListMax Then EditCommand( Num, List. Picked) ;
#27 : Break;
End ;
Until False ;
2012-07-24 13:29:51 -07:00
WriteXY ( 2 6 , 2 1 , 1 2 0 , Status1) ;
2012-07-23 20:01:52 -07:00
If List. ExitCode = #27 Then Break;
End ;
#12 : GetExtendedKey( Menu. Item[ Num] ^ . HotKey) ;
#27 : Break;
End ;
Changed : = Changed or Form. Changed;
Until False ;
Changed : = Changed or Form. Changed;
Box. Close;
Form. Free;
List. Free;
Box. Free;
End ;
Procedure EditFlags;
Var
Box : TAnsiMenuBox;
Form : TAnsiMenuForm;
Topic : String ;
Begin
Box : = TAnsiMenuBox. Create;
Form : = TAnsiMenuForm. Create;
Box. Header : = ' Menu Flags (' + MenuName + ') ' ;
Topic : = '|03(|09Menu Flags|03) |01-|09> |15' ; ;
2012-08-15 19:18:55 -07:00
Box. Open ( 6 , 5 , 7 5 , 2 1 ) ;
2012-07-23 20:01:52 -07:00
2012-08-15 19:18:55 -07:00
VerticalLine ( 2 2 , 7 , 2 0 ) ;
2012-07-23 20:01:52 -07:00
2012-07-24 14:54:01 -07:00
Form. AddStr ( 'D' , ' Description' , 9 , 7 , 2 4 , 7 , 1 3 , 3 0 , 3 0 , @ Menu. Info. Description, Topic + 'Description of menu' ) ;
Form. AddStr ( 'A' , ' Access' , 1 4 , 8 , 2 4 , 8 , 8 , 3 0 , 3 0 , @ Menu. Info. Access, Topic + 'Security requirements to access this menu' ) ;
2012-08-15 19:18:55 -07:00
Form. AddStr ( 'B' , ' Fallback' , 1 2 , 9 , 2 4 , 9 , 1 0 , 2 0 , 2 0 , @ Menu. Info. Fallback, Topic + 'Menu loaded if user has no access (Blank/Last)' ) ;
2013-02-26 04:45:01 -08:00
Form. AddTog ( 'T' , ' Menu Type' , 1 1 , 1 0 , 2 4 , 1 0 , 1 1 , 1 5 , 0 , 3 , 'Standard Lightbar Lightbar/Grid Lightbar/Prompt' , @ Menu. Info. MenuType, Topic + 'Type of menu' ) ;
2012-08-15 19:18:55 -07:00
Form. AddTog ( 'I' , ' Input Type' , 1 0 , 1 1 , 2 4 , 1 1 , 1 2 , 1 2 , 0 , 2 , 'User_Defined HotKey LongKey' , @ Menu. Info. InputType, Topic + 'Input type for this menu' ) ;
Form. AddTog ( 'C' , ' Input Chars' , 9 , 1 2 , 2 4 , 1 2 , 1 3 , 9 , 0 , 2 , 'Uppercase Lowercase Hidden' , @ Menu. Info. CharType, Topic + 'Input format display' ) ;
Form. AddBol ( 'G' , ' Use Global' , 1 0 , 1 3 , 2 4 , 1 3 , 1 2 , 3 , @ Menu. Info. Global, Topic + 'Include global menu options in this menu?' ) ;
Form. AddStr ( 'N' , ' Node Status' , 9 , 1 4 , 2 4 , 1 4 , 1 3 , 3 0 , 3 0 , @ Menu. Info. NodeStatus, Topic + 'Node/User status set when this menu is loaded' ) ;
Form. AddStr ( 'F' , ' Display File' , 8 , 1 5 , 2 4 , 1 5 , 1 4 , 2 0 , 2 0 , @ Menu. Info. DispFile, Topic + 'Display file shown instead of generated menu' ) ;
2013-02-26 04:45:01 -08:00
Form. AddTog ( 'L' , ' Display Cols' , 8 , 1 6 , 2 4 , 1 6 , 1 4 , 1 , 0 , 4 , '0 1 2 3 4' , @ Menu. Info. DispCols, Topic + 'Number of columns in generated menu' ) ;
2012-08-15 19:18:55 -07:00
Form. AddPipe ( 'H' , ' Menu Header' , 9 , 1 7 , 2 4 , 1 7 , 1 3 , 5 0 , 1 6 0 , @ Menu. Info. Header, Topic + 'Menu header displayed in generated menu' ) ;
Form. AddPipe ( 'P' , ' Menu Prompt' , 9 , 1 8 , 2 4 , 1 8 , 1 3 , 5 0 , 1 6 0 , @ Menu. Info. Footer, Topic + 'Menu prompt displayed in generated menu' ) ;
Form. AddByte ( 'X' , ' X' , 1 9 , 1 9 , 2 4 , 1 9 , 3 , 2 , 0 , 8 0 , @ Menu. Info. DoneX, Topic + 'Locate to X coordinate after lightbar menu' ) ;
Form. AddByte ( 'Y' , ' Y' , 1 9 , 2 0 , 2 4 , 2 0 , 3 , 2 , 0 , 5 0 , @ Menu. Info. DoneY, Topic + 'Locate to Y coordinate after lightbar menu' ) ;
2012-07-23 20:01:52 -07:00
Form. Execute;
Changed : = Changed Or Form. Changed;
Box. Close;
Box. Free;
Form. Free;
End ;
2013-02-27 01:42:36 -08:00
Procedure EditMenu ( Var Theme: RecTheme) ;
2012-07-23 20:01:52 -07:00
Var
Box : TAnsiMenuBox;
List : TAnsiMenuList;
Count : Word ;
CopyItem : Word ;
Str : String ;
Begin
Menu : = TMenuData. Create;
2013-02-27 01:42:36 -08:00
Menu. Load ( False , Theme. MenuPath + MenuName + '.mnu' ) ;
2012-07-23 20:01:52 -07:00
Box : = TAnsiMenuBox. Create;
List : = TAnsiMenuList. Create;
List. NoWindow : = True ;
List. LoChars : = #13 #27 #47 ;
2012-08-04 16:18:48 -07:00
List. SearchY : = 2 1 ;
2012-07-23 20:01:52 -07:00
Box. Header : = ' Command list (' + MenuName + ') ' ;
Box. Open ( 9 , 5 , 7 2 , 2 1 ) ;
2012-08-05 22:53:35 -07:00
WriteXY ( 1 1 , 6 , 1 1 2 , 'HotKey Text C# Ex' ) ;
2012-07-23 20:01:52 -07:00
WriteXY ( 1 1 , 7 , 1 1 2 , strRep( '<27> ' , 6 0 ) ) ;
WriteXY ( 1 1 , 1 9 , 1 1 2 , strRep( '<27> ' , 6 0 ) ) ;
WriteXY ( 2 9 , 2 0 , 1 1 2 , cfgCommandList) ;
CopyItem : = 0 ;
Repeat
List. Clear;
For Count : = 1 to Menu. NumItems Do Begin
Str : = strStripMCI( Menu. Item[ Count] ^ . Text ) ;
If ( Str = '' ) And ( Menu. Item[ Count] ^ . TextLo < > '' ) Then
Str : = strStripMCI( Menu. Item[ Count] ^ . TextLo) ;
2012-08-05 22:53:35 -07:00
List. Add ( strPadR( Menu. Item[ Count] ^ . HotKey, 1 0 , ' ' ) + ' ' +
strPadR( Str, 4 3 , ' ' ) + ' ' +
strPadL( strI2S( Count) , 2 , ' ' ) + ' ' +
2012-07-23 20:01:52 -07:00
strPadL( strI2S( Menu. Item[ Count] ^ . Commands) , 2 , ' ' ) , 0 ) ;
End ;
List. Add ( '' , 0 ) ;
List. Open ( 9 , 7 , 7 2 , 1 9 ) ;
Case List. ExitCode of
2012-07-24 13:29:51 -07:00
'/' : Case GetCommandOption( 1 0 , 'F-Flags|I-Insert|D-Delete|C-Copy|P-Paste|V-View|' ) of
'I' : Begin
2012-09-02 18:48:29 -07:00
Menu. InsertItem( List. Picked, True ) ;
2012-07-23 20:01:52 -07:00
Changed : = True ;
End ;
'C' : If List. Picked < > List. ListMax Then
CopyItem : = List. Picked;
'D' : If List. Picked < > List. ListMax Then Begin
Menu. DeleteItem( List. Picked) ;
Changed : = True ;
End ;
'F' : EditFlags;
'P' : If ( CopyItem > 0 ) And ( CopyItem < List. ListMax) And ( Menu. Item[ CopyItem] < > NIL ) Then Begin
Menu. CopyItem( CopyItem, List. Picked) ;
Changed : = True ;
End ;
'V' : ViewMenu;
End ;
#13 : If List. Picked < > List. ListMax Then
EditItem ( List. Picked) ;
#27 : Break;
End ;
Until False ;
Box. Close;
List. Free;
Box. Free;
If Changed Then
If ShowMsgBox( 1 , 'Save changes to ' + MenuName + '?' ) Then
2013-02-27 01:42:36 -08:00
If Not Menu. Save( Theme. MenuPath + MenuName + '.mnu' ) Then
2012-07-23 20:01:52 -07:00
ShowMsgBox( 0 , 'Unable to save menu' ) ;
Menu. Free;
End ;
2013-02-27 01:42:36 -08:00
Function GetMenuName ( Var Theme: RecTheme; OldName: String ) : String ;
2012-07-23 20:01:52 -07:00
Var
Box : TAnsiMenuBox;
List : TAnsiMenuList;
MF : Text ;
Procedure MakeList;
Var
Dir : SearchRec;
Sort : TQuickSort;
Count : Word ;
Desc : String ;
Begin
Sort : = TQuickSort. Create;
2013-02-27 01:42:36 -08:00
FindFirst ( Theme. MenuPath + '*.mnu' , Archive, Dir) ;
2012-07-23 20:01:52 -07:00
While DosError = 0 Do Begin
Sort. Add( JustFileName( Dir. Name ) , 0 ) ;
FindNext ( Dir) ;
End ;
FindClose( Dir) ;
Sort. Sort( 1 , Sort. Total, qAscending) ;
List. Clear;
For Count : = 1 to Sort. Total Do Begin
2013-02-27 01:42:36 -08:00
Assign ( MF, Theme. MenuPath + Sort. Data[ Count] ^ . Name + '.mnu' ) ;
2012-07-23 20:01:52 -07:00
{$I-} Reset ( MF) ; {$I+}
If IoResult = 0 Then Begin
ReadLn ( MF, Desc) ;
Close ( MF) ;
End Else
Desc : = '' ;
List. Add( strPadR( Sort. Data[ Count] ^ . Name , 2 2 , ' ' ) + Desc, 0 ) ;
If Sort. Data[ Count] ^ . Name = OldName Then
List. Picked : = List. ListMax;
End ;
Sort. Free;
End ;
Procedure CopyMenu ( Orig: String ) ;
Var
Str : String ;
Begin
Str : = InBox( 'Copy menu' , 'New menu name: ' , '' , 2 0 , 2 0 ) ;
If Str = '' Then Exit;
2013-02-27 01:42:36 -08:00
Str : = Theme. MenuPath + Str + '.mnu' ;
2012-07-23 20:01:52 -07:00
If FileExist( Str) Then
If ShowMsgBox( 1 , JustFile( Str) + ' already exists. Overwrite?' ) Then
FileErase( Str) ;
2013-02-27 01:42:36 -08:00
FileCopy( Theme. MenuPath + Orig + '.mnu' , Str) ;
2012-07-23 20:01:52 -07:00
End ;
Procedure InsertMenu;
Var
Str : String ;
OK : Boolean ;
Begin
Str : = InBox( 'Insert Menu' , 'New menu name: ' , '' , 2 0 , 2 0 ) ;
If Str = '' Then Exit;
2013-02-27 01:42:36 -08:00
OK : = Not FileExist( Theme. MenuPath + Str + '.mnu' ) ;
2012-07-23 20:01:52 -07:00
If Not OK Then
OK : = ShowMsgBox( 1 , Str + ' already exists. Overwrite?' ) ;
If OK Then Begin
Menu : = TMenuData. Create;
2013-02-27 01:42:36 -08:00
Menu. CreateNewMenu( Theme. MenuPath + Str + '.mnu' ) ;
2012-07-23 20:01:52 -07:00
Menu. Free;
End ;
End ;
Begin
Result : = '' ;
Box : = TAnsiMenuBox. Create;
List : = TAnsiMenuList. Create;
List. NoWindow : = True ;
List. LoChars : = #13 #27 #47 ;
2012-08-04 16:18:48 -07:00
List. SearchY : = 2 1 ;
2013-02-27 01:42:36 -08:00
Box. Header : = ' Menu Editor (' + Theme. Desc + ') ' ;
2012-07-23 20:01:52 -07:00
Box. Open ( 1 2 , 5 , 6 8 , 2 1 ) ;
WriteXY ( 1 4 , 6 , 1 1 2 , 'Menu Name Description' ) ;
WriteXY ( 1 4 , 7 , 1 1 2 , strRep( '<27> ' , 5 3 ) ) ;
WriteXY ( 1 4 , 1 9 , 1 1 2 , strRep( '<27> ' , 5 3 ) ) ;
WriteXY ( 2 9 , 2 0 , 1 1 2 , cfgCommandList) ;
Repeat
Changed : = False ;
MakeList;
List. Open ( 1 2 , 7 , 6 8 , 1 9 ) ;
Case List. ExitCode of
'/' : Case GetCommandOption( 1 0 , 'I-Insert|D-Delete|C-Copy|' ) of
'C' : If List. ListMax > 0 Then
CopyMenu( strWordGet( 1 , List. List[ List. Picked] ^ . Name , ' ' ) ) ;
'I' : InsertMenu;
'D' : If List. ListMax > 0 Then
If ShowMsgBox( 1 , 'Delete menu: ' + strWordGet( 1 , List. List[ List. Picked] ^ . Name , ' ' ) ) Then
2013-02-27 01:42:36 -08:00
FileErase ( Theme. MenuPath + strWordGet( 1 , List. List[ List. Picked] ^ . Name , ' ' ) + '.mnu' ) ;
2012-07-23 20:01:52 -07:00
End ;
#13 : Begin
If List. ListMax < > 0 Then
Result : = strWordGet( 1 , List. List[ List. Picked] ^ . Name , ' ' ) ;
Break;
End ;
#27 : Break;
End ;
Until False ;
Box. Close;
List. Free;
Box. Free;
End ;
Procedure Configuration_MenuEditor;
Var
Saved : String ;
2013-02-27 01:42:36 -08:00
Theme : RecTheme;
Found : Boolean ;
2012-07-23 20:01:52 -07:00
Begin
Saved : = '' ;
MenuName : = Configuration_ThemeEditor( True ) ;
If MenuName = '' Then Exit;
2013-02-27 01:42:36 -08:00
Reset ( Session. ThemeFile) ;
While Not Eof( Session. ThemeFile) Do Begin
Read ( Session. ThemeFile, Theme) ;
If strUpper( Theme. FileName) = strUpper( MenuName) Then Begin
Found : = True ;
Break;
End ;
End ;
Close ( Session. ThemeFile) ;
If Not Found Then Exit;
2012-07-23 20:01:52 -07:00
Repeat
2013-02-27 01:42:36 -08:00
MenuName : = GetMenuName( Theme, Saved) ;
2012-07-23 20:01:52 -07:00
Saved : = MenuName;
If MenuName = '' Then Exit;
2013-02-27 01:42:36 -08:00
EditMenu( Theme) ;
2012-07-23 20:01:52 -07:00
Until False ;
2012-02-13 16:50:48 -08:00
End ;
End .