More fixes for new menu engine. Timer events now have additional execution options
This commit is contained in:
parent
2d67b42fa6
commit
3f217b6262
|
@ -276,7 +276,7 @@ Begin
|
||||||
|
|
||||||
Form.AddNone ('C', ' Command ', 15, 11, 9, Topic + 'Menu command function');
|
Form.AddNone ('C', ' Command ', 15, 11, 9, Topic + 'Menu command function');
|
||||||
Form.AddStr ('A', ' Access ' , 16, 12, 26, 12, 8, 30, 30, @Menu.Item[Num]^.CmdData[CmdNum]^.Access, Topic + 'Access level to run this command');
|
Form.AddStr ('A', ' Access ' , 16, 12, 26, 12, 8, 30, 30, @Menu.Item[Num]^.CmdData[CmdNum]^.Access, Topic + 'Access level to run this command');
|
||||||
Form.AddStr ('D', ' Data ' , 18, 13, 26, 13, 6, 40, 80, @Menu.Item[Num]^.CmdData[CmdNum]^.Data, Topic + 'Menu command optional data');
|
Form.AddStr ('D', ' Data ' , 18, 13, 26, 13, 6, 40, 160, @Menu.Item[Num]^.CmdData[CmdNum]^.Data, Topic + 'Menu command optional data');
|
||||||
Form.AddTog ('G', ' Execute ', 15, 14, 26, 14, 9, 6, 0, 10, '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?');
|
Form.AddTog ('G', ' Execute ', 15, 14, 26, 14, 9, 6, 0, 10, '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?');
|
||||||
|
|
||||||
Repeat
|
Repeat
|
||||||
|
@ -346,6 +346,7 @@ Begin
|
||||||
|
|
||||||
VerticalLine (18, 6, 14);
|
VerticalLine (18, 6, 14);
|
||||||
VerticalLine (60, 10, 14);
|
VerticalLine (60, 10, 14);
|
||||||
|
VerticalLine (41, 14, 14);
|
||||||
VerticalLine (73, 10, 14);
|
VerticalLine (73, 10, 14);
|
||||||
|
|
||||||
WriteXY (4, 15, 112, 'Command ' + strRep(#196, 18) + ' Access ' + strRep(#196, 5) + ' Data ' + strRep(#196, 29));
|
WriteXY (4, 15, 112, 'Command ' + strRep(#196, 18) + ' Access ' + strRep(#196, 5) + ' Data ' + strRep(#196, 29));
|
||||||
|
@ -365,7 +366,9 @@ Begin
|
||||||
Form.AddByte ('X', 'X' , 14, 12, 20, 12, 1, 2, 0, 80, @Menu.Item[Num]^.X, Topic + 'X coordinate of lightbar');
|
Form.AddByte ('X', 'X' , 14, 12, 20, 12, 1, 2, 0, 80, @Menu.Item[Num]^.X, Topic + 'X coordinate of lightbar');
|
||||||
Form.AddByte ('Y', 'Y' , 16, 12, 23, 12, 1, 2, 0, 50, @Menu.Item[Num]^.Y, Topic + 'Y coordinate of lightbar');
|
Form.AddByte ('Y', 'Y' , 16, 12, 23, 12, 1, 2, 0, 50, @Menu.Item[Num]^.Y, Topic + 'Y coordinate of lightbar');
|
||||||
Form.AddWord ('M', ' Timer ' , 11, 13, 20, 13, 7, 5, 0, 65535, @Menu.Item[Num]^.Timer, Topic + 'Timer interval (seconds)');
|
Form.AddWord ('M', ' Timer ' , 11, 13, 20, 13, 7, 5, 0, 65535, @Menu.Item[Num]^.Timer, Topic + 'Timer interval (seconds)');
|
||||||
Form.AddBol ('W', ' Redraw ' , 10, 14, 20, 14, 8, 3, @Menu.Item[Num]^.ReDraw, Topic + 'Redraw menu after running this command?');
|
Form.AddTog ('X', ' Exec Type' , 7, 14, 20, 14, 11, 9, 0, 2, 'Interval OnlyOnce PerRedraw', @Menu.Item[Num]^.TimerType, Topic + 'TIMER event execution type');
|
||||||
|
|
||||||
|
Form.AddBol ('W', ' Redraw ' , 33, 14, 43, 14, 8, 3, @Menu.Item[Num]^.ReDraw, Topic + 'Redraw menu after running this command?');
|
||||||
|
|
||||||
Form.AddByte ('U', ' Up ' , 56, 10, 62, 10, 4, 3, 0, 255, @Menu.Item[Num]^.JumpUp, Topic + '(Grid) Item # to jump to when UP is pressed');
|
Form.AddByte ('U', ' Up ' , 56, 10, 62, 10, 4, 3, 0, 255, @Menu.Item[Num]^.JumpUp, Topic + '(Grid) Item # to jump to when UP is pressed');
|
||||||
Form.AddByte ('D', ' Down ' , 54, 11, 62, 11, 6, 3, 0, 255, @Menu.Item[Num]^.JumpDown, Topic + '(Grid) Item # to jump to when DOWN is pressed');
|
Form.AddByte ('D', ' Down ' , 54, 11, 62, 11, 6, 3, 0, 255, @Menu.Item[Num]^.JumpDown, Topic + '(Grid) Item # to jump to when DOWN is pressed');
|
||||||
|
@ -379,12 +382,12 @@ Begin
|
||||||
Form.AddByte ('G', ' PageDn ' , 65, 13, 75, 13, 8, 3, 0, 255, @Menu.Item[Num]^.JumpPgDn, Topic + '(Grid) Item # to jump to when PGDN is pressed');
|
Form.AddByte ('G', ' PageDn ' , 65, 13, 75, 13, 8, 3, 0, 255, @Menu.Item[Num]^.JumpPgDn, Topic + '(Grid) Item # to jump to when PGDN is pressed');
|
||||||
Form.AddByte ('N', ' End ' , 68, 14, 75, 14, 5, 3, 0, 255, @Menu.Item[Num]^.JumpEnd, Topic + '(Grid) Item # to jump to when END is pressed');
|
Form.AddByte ('N', ' End ' , 68, 14, 75, 14, 5, 3, 0, 255, @Menu.Item[Num]^.JumpEnd, Topic + '(Grid) Item # to jump to when END is pressed');
|
||||||
|
|
||||||
WriteXY (25, 21, 113, Status1);
|
WriteXY (26, 21, 120, Status1);
|
||||||
|
|
||||||
Repeat
|
Repeat
|
||||||
Case Form.Execute of
|
Case Form.Execute of
|
||||||
#09 : Begin
|
#09 : Begin
|
||||||
WriteXY (25, 21, 113, Status2);
|
WriteXY (26, 21, 120, Status2);
|
||||||
|
|
||||||
Repeat
|
Repeat
|
||||||
MakeList;
|
MakeList;
|
||||||
|
@ -394,8 +397,8 @@ Begin
|
||||||
List.Open (2, 15, 79, 21);
|
List.Open (2, 15, 79, 21);
|
||||||
|
|
||||||
Case List.ExitCode of
|
Case List.ExitCode of
|
||||||
'/' : Case GetCommandOption(10, 'A-Add|D-Delete|') of
|
'/' : Case GetCommandOption(10, 'I-Insert|D-Delete|') of
|
||||||
'A' : Begin
|
'I' : Begin
|
||||||
Menu.InsertCommand(Num, List.Picked);
|
Menu.InsertCommand(Num, List.Picked);
|
||||||
Changed := True;
|
Changed := True;
|
||||||
End;
|
End;
|
||||||
|
@ -414,7 +417,7 @@ Begin
|
||||||
End;
|
End;
|
||||||
Until False;
|
Until False;
|
||||||
|
|
||||||
WriteXY (25, 21, 113, Status1);
|
WriteXY (26, 21, 120, Status1);
|
||||||
|
|
||||||
If List.ExitCode = #27 Then Break;
|
If List.ExitCode = #27 Then Break;
|
||||||
End;
|
End;
|
||||||
|
@ -521,8 +524,8 @@ Begin
|
||||||
List.Open (9, 7, 72, 19);
|
List.Open (9, 7, 72, 19);
|
||||||
|
|
||||||
Case List.ExitCode of
|
Case List.ExitCode of
|
||||||
'/' : Case GetCommandOption(10, 'F-Flags|A-Add|D-Delete|C-Copy|P-Paste|V-View|') of
|
'/' : Case GetCommandOption(10, 'F-Flags|I-Insert|D-Delete|C-Copy|P-Paste|V-View|') of
|
||||||
'A' : Begin
|
'I' : Begin
|
||||||
Menu.InsertItem(List.Picked);
|
Menu.InsertItem(List.Picked);
|
||||||
Changed := True;
|
Changed := True;
|
||||||
End;
|
End;
|
||||||
|
|
|
@ -1271,14 +1271,14 @@ Begin
|
||||||
Repeat
|
Repeat
|
||||||
If LastSecond <> TimerSeconds Then Begin
|
If LastSecond <> TimerSeconds Then Begin
|
||||||
|
|
||||||
|
LastSecond := TimerSeconds;
|
||||||
|
|
||||||
If Assigned(GetKeyCallBack) Then
|
If Assigned(GetKeyCallBack) Then
|
||||||
If GetKeyCallBack(False) Then Begin
|
If GetKeyCallBack(False) Then Begin
|
||||||
Result := #02;
|
Result := #02;
|
||||||
Exit;
|
Exit;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
LastSecond := TimerSeconds;
|
|
||||||
|
|
||||||
If InMacro Then
|
If InMacro Then
|
||||||
If InMacroPos <= Length(InMacroStr) Then Begin
|
If InMacroPos <= Length(InMacroStr) Then Begin
|
||||||
Result := InMacroStr[InMacroPos];
|
Result := InMacroStr[InMacroPos];
|
||||||
|
|
|
@ -21,7 +21,6 @@ Type
|
||||||
UseHotKeys : Boolean;
|
UseHotKeys : Boolean;
|
||||||
ReDraw : Boolean;
|
ReDraw : Boolean;
|
||||||
SetAction : Boolean;
|
SetAction : Boolean;
|
||||||
UseLongKey : Boolean;
|
|
||||||
UseTimer : Boolean;
|
UseTimer : Boolean;
|
||||||
TimerCount : LongInt;
|
TimerCount : LongInt;
|
||||||
TimerReload : Boolean;
|
TimerReload : Boolean;
|
||||||
|
@ -38,6 +37,7 @@ Type
|
||||||
Function ExecuteByHotkey (Key: String; Interval: LongInt) : Byte;
|
Function ExecuteByHotkey (Key: String; Interval: LongInt) : Byte;
|
||||||
Function ExecuteCommand (Cmd, CmdData: String) : Boolean;
|
Function ExecuteCommand (Cmd, CmdData: String) : Boolean;
|
||||||
Function SpecialKey (Str: String) : Boolean;
|
Function SpecialKey (Str: String) : Boolean;
|
||||||
|
Function MenuGetKey : Char;
|
||||||
Function ShowMenu : Boolean;
|
Function ShowMenu : Boolean;
|
||||||
Procedure GenerateMenu;
|
Procedure GenerateMenu;
|
||||||
Procedure DoStandardMenu;
|
Procedure DoStandardMenu;
|
||||||
|
@ -48,7 +48,9 @@ Implementation
|
||||||
|
|
||||||
Uses
|
Uses
|
||||||
m_Strings,
|
m_Strings,
|
||||||
|
m_DateTime,
|
||||||
BBS_Core,
|
BBS_Core,
|
||||||
|
BBS_IO,
|
||||||
BBS_NodeInfo,
|
BBS_NodeInfo,
|
||||||
BBS_General,
|
BBS_General,
|
||||||
BBS_Doors,
|
BBS_Doors,
|
||||||
|
@ -379,17 +381,30 @@ Begin
|
||||||
Key := strUpper(Key);
|
Key := strUpper(Key);
|
||||||
|
|
||||||
For Count := 1 to Data.NumItems Do Begin
|
For Count := 1 to Data.NumItems Do Begin
|
||||||
|
|
||||||
If Data.Item[Count] = Nil Then Begin
|
If Data.Item[Count] = Nil Then Begin
|
||||||
Result := 2;
|
Result := 2;
|
||||||
Exit;
|
Break;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
If Data.Item[Count]^.HotKey = Key Then
|
If Data.Item[Count]^.HotKey = Key Then Begin
|
||||||
If (Key <> 'TIMER') or ((Key = 'TIMER') And (Interval MOD Data.Item[Count]^.Timer = 0)) Then Begin
|
If Key <> 'TIMER' Then
|
||||||
Result := ExecuteCommandList(Count, -1);
|
Result := ExecuteCommandList(Count, -1)
|
||||||
|
Else
|
||||||
|
If (Interval MOD Data.Item[Count]^.Timer <> 0) Then
|
||||||
|
Continue
|
||||||
|
Else Begin
|
||||||
|
|
||||||
If Result = 2 Then Exit;
|
Case Data.Item[Count]^.TimerType of
|
||||||
|
0 : Result := ExecuteCommandList(Count, -1);
|
||||||
|
1,
|
||||||
|
2 : If Data.Item[Count]^.TimerShow Then Begin
|
||||||
|
Result := ExecuteCommandList(Count, -1);
|
||||||
|
Data.Item[Count]^.TimerShow := False;
|
||||||
|
End;
|
||||||
|
End;
|
||||||
|
End;
|
||||||
|
|
||||||
|
If Result = 2 Then Break;
|
||||||
End;
|
End;
|
||||||
End;
|
End;
|
||||||
End;
|
End;
|
||||||
|
@ -420,6 +435,12 @@ Var
|
||||||
Listed : Word;
|
Listed : Word;
|
||||||
Count : LongInt;
|
Count : LongInt;
|
||||||
Begin
|
Begin
|
||||||
|
If UseTimer Then Begin
|
||||||
|
For Count := 1 to Data.NumItems Do
|
||||||
|
If Data.Item[Count]^.TimerType = 2 Then
|
||||||
|
Data.Item[Count]^.TimerShow := True;
|
||||||
|
End;
|
||||||
|
|
||||||
If ShowMenu Then Begin
|
If ShowMenu Then Begin
|
||||||
Case Data.Info.DispCols of
|
Case Data.Info.DispCols of
|
||||||
1 : Format := 79;
|
1 : Format := 79;
|
||||||
|
@ -531,7 +552,7 @@ Begin
|
||||||
Temp := '';
|
Temp := '';
|
||||||
|
|
||||||
While Not TBBSCore(Owner).ShutDown Do Begin
|
While Not TBBSCore(Owner).ShutDown Do Begin
|
||||||
Ch := Session.io.GetKey;
|
Ch := MenuGetKey;
|
||||||
|
|
||||||
If TBBSCore(Owner).ShutDown Then Exit;
|
If TBBSCore(Owner).ShutDown Then Exit;
|
||||||
|
|
||||||
|
@ -602,6 +623,42 @@ Begin
|
||||||
End;
|
End;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
Function TMenuEngine.MenuGetKey : Char;
|
||||||
|
Var
|
||||||
|
Current : LongInt;
|
||||||
|
LastSec : LongInt;
|
||||||
|
Begin
|
||||||
|
LastSec := TimerSeconds;
|
||||||
|
|
||||||
|
While Not TBBSCore(Owner).ShutDown Do Begin
|
||||||
|
Result := TBBSCore(Owner).io.InKey(1000);
|
||||||
|
|
||||||
|
If TBBSCore(Owner).ShutDown Then Exit;
|
||||||
|
|
||||||
|
If UseTimer And (TimerSeconds <> LastSec) Then Begin
|
||||||
|
LastSec := TimerSeconds;
|
||||||
|
|
||||||
|
Inc (TimerCount);
|
||||||
|
|
||||||
|
Case ExecuteByHotkey('TIMER', TimerCount) of
|
||||||
|
1 : If ReDraw Then Begin
|
||||||
|
Result := #02;
|
||||||
|
Exit;
|
||||||
|
End;
|
||||||
|
2 : Begin
|
||||||
|
TimerReload := True;
|
||||||
|
Result := #02;
|
||||||
|
Exit;
|
||||||
|
End;
|
||||||
|
End;
|
||||||
|
|
||||||
|
If TimerCount = 1000000000 Then TimerCount := 0;
|
||||||
|
End;
|
||||||
|
|
||||||
|
If Result <> #255 Then Break;
|
||||||
|
End;
|
||||||
|
End;
|
||||||
|
|
||||||
Procedure TMenuEngine.DoLightBarMenu;
|
Procedure TMenuEngine.DoLightBarMenu;
|
||||||
Var
|
Var
|
||||||
TempStr : String;
|
TempStr : String;
|
||||||
|
@ -703,9 +760,14 @@ Begin
|
||||||
Set_Node_Action(TBBSCore(Owner).GetPrompt(346));
|
Set_Node_Action(TBBSCore(Owner).GetPrompt(346));
|
||||||
|
|
||||||
If ReDraw Then Begin
|
If ReDraw Then Begin
|
||||||
|
If UseTimer Then Begin
|
||||||
|
For Count := 1 to Data.NumItems Do
|
||||||
|
If Data.Item[Count]^.TimerType = 2 Then
|
||||||
|
Data.Item[Count]^.TimerShow := True;
|
||||||
|
End;
|
||||||
|
|
||||||
ShowMenu;
|
ShowMenu;
|
||||||
|
|
||||||
// If Data.Info.Header <> '' Then
|
|
||||||
TBBSCore(Owner).io.OutFullLn(Data.Info.Header);
|
TBBSCore(Owner).io.OutFullLn(Data.Info.Header);
|
||||||
|
|
||||||
If Data.Info.Footer <> '' Then
|
If Data.Info.Footer <> '' Then
|
||||||
|
@ -734,7 +796,7 @@ Begin
|
||||||
TempStr := '';
|
TempStr := '';
|
||||||
|
|
||||||
While Not TBBSCore(Owner).ShutDown Do Begin
|
While Not TBBSCore(Owner).ShutDown Do Begin
|
||||||
Ch := Session.io.GetKey;
|
Ch := MenuGetKey;
|
||||||
|
|
||||||
If UseTimer And (Ch = #02) Then Begin
|
If UseTimer And (Ch = #02) Then Begin
|
||||||
If TimerReload Then Exit;
|
If TimerReload Then Exit;
|
||||||
|
@ -927,23 +989,6 @@ Begin
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Procedure TMenuEngine.ExecuteMenu (Load, Forced, View, Action: Boolean);
|
Procedure TMenuEngine.ExecuteMenu (Load, Forced, View, Action: Boolean);
|
||||||
|
|
||||||
Function TimerController (Forced: Boolean) : Boolean;
|
|
||||||
Begin
|
|
||||||
Inc (TimerCount);
|
|
||||||
|
|
||||||
Case ExecuteByHotkey('TIMER', TimerCount) of
|
|
||||||
0 : Result := False;
|
|
||||||
1 : Result := True;
|
|
||||||
2 : Begin
|
|
||||||
TimerReload := True;
|
|
||||||
Result := True;
|
|
||||||
End;
|
|
||||||
End;
|
|
||||||
|
|
||||||
If TimerCount = 1000000000 Then TimerCount := 0;
|
|
||||||
End;
|
|
||||||
|
|
||||||
Var
|
Var
|
||||||
Count : LongInt;
|
Count : LongInt;
|
||||||
Begin
|
Begin
|
||||||
|
@ -983,12 +1028,9 @@ Begin
|
||||||
Else
|
Else
|
||||||
UseHotKeys := Not Boolean(Data.Info.InputType - 1);
|
UseHotKeys := Not Boolean(Data.Info.InputType - 1);
|
||||||
|
|
||||||
// Run FIRSTCMD commands and setup valid extended keys
|
|
||||||
|
|
||||||
ExtKeys := '';
|
ExtKeys := '';
|
||||||
UseTimer := False;
|
UseTimer := False;
|
||||||
ReDraw := True;
|
ReDraw := True;
|
||||||
UseLongKey := False;
|
|
||||||
TimerCount := 0;
|
TimerCount := 0;
|
||||||
TimerReload := False;
|
TimerReload := False;
|
||||||
|
|
||||||
|
@ -1010,13 +1052,9 @@ Begin
|
||||||
If Data.Item[Count]^.HotKey = 'PAGEDOWN' Then ExtKeys := ExtKeys + #81 Else
|
If Data.Item[Count]^.HotKey = 'PAGEDOWN' Then ExtKeys := ExtKeys + #81 Else
|
||||||
If Data.Item[Count]^.HotKey = 'HOME' Then ExtKeys := ExtKeys + #71 Else
|
If Data.Item[Count]^.HotKey = 'HOME' Then ExtKeys := ExtKeys + #71 Else
|
||||||
If Data.Item[Count]^.HotKey = 'END' Then ExtKeys := ExtKeys + #79 Else
|
If Data.Item[Count]^.HotKey = 'END' Then ExtKeys := ExtKeys + #79 Else
|
||||||
If Data.Item[Count]^.HotKey = 'TIMER' Then UseTimer := True Else
|
If Data.Item[Count]^.HotKey = 'TIMER' Then UseTimer := True;
|
||||||
If Byte(Data.Item[Count]^.HotKey[0]) > 1 Then UseLongKey := True;
|
|
||||||
End;
|
End;
|
||||||
|
|
||||||
If UseTimer Then
|
|
||||||
Session.io.GetKeyCallBack := TimerController;
|
|
||||||
|
|
||||||
Case Data.Info.MenuType of
|
Case Data.Info.MenuType of
|
||||||
0 : DoStandardMenu;
|
0 : DoStandardMenu;
|
||||||
1,
|
1,
|
||||||
|
@ -1025,8 +1063,6 @@ Begin
|
||||||
Else
|
Else
|
||||||
DoStandardMenu;
|
DoStandardMenu;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Session.io.GetKeyCallback := NIL;
|
|
||||||
End;
|
End;
|
||||||
|
|
||||||
End.
|
End.
|
||||||
|
|
|
@ -47,7 +47,7 @@ Const
|
||||||
mysMaxVoteQuestion = 20; // Max number of voting questions
|
mysMaxVoteQuestion = 20; // Max number of voting questions
|
||||||
mysMaxMenuNameLen = 20; // menu name size
|
mysMaxMenuNameLen = 20; // menu name size
|
||||||
mysMaxMenuItems = 75; // Maximum menu items per menu
|
mysMaxMenuItems = 75; // Maximum menu items per menu
|
||||||
mysMaxMenuCmds = 20; // Max menu commands per item
|
mysMaxMenuCmds = 25; // Max menu commands per item
|
||||||
mysMaxMenuInput = 12;
|
mysMaxMenuInput = 12;
|
||||||
mysMaxMenuStack = 8;
|
mysMaxMenuStack = 8;
|
||||||
mysMaxThemeText = 493; // Total prompts in theme file
|
mysMaxThemeText = 493; // Total prompts in theme file
|
||||||
|
@ -525,7 +525,7 @@ Type
|
||||||
RecMenuCmd = Packed Record
|
RecMenuCmd = Packed Record
|
||||||
MenuCmd : String[2];
|
MenuCmd : String[2];
|
||||||
Access : String[mysMaxAcsSize];
|
Access : String[mysMaxAcsSize];
|
||||||
Data : String[80];
|
Data : String[160];
|
||||||
JumpID : Byte;
|
JumpID : Byte;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
@ -553,6 +553,8 @@ Type
|
||||||
X : Byte;
|
X : Byte;
|
||||||
Y : Byte;
|
Y : Byte;
|
||||||
Timer : Word;
|
Timer : Word;
|
||||||
|
TimerType : Byte;
|
||||||
|
TimerShow : Boolean;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
RecMenuInfo = Packed Record
|
RecMenuInfo = Packed Record
|
||||||
|
|
Loading…
Reference in New Issue