Added TIMER menu command types

This commit is contained in:
mysticbbs 2012-07-24 00:55:23 -04:00
parent 3725817427
commit a737132e15
3 changed files with 65 additions and 19 deletions

View File

@ -4326,6 +4326,10 @@
there may be issues - particularly in lightbar grid menus I would guess there may be issues - particularly in lightbar grid menus I would guess
since they can be quite complex. since they can be quite complex.
For those of you alpha testing, if you do find a menu that does not
convert correctly, please send the .mnu file to me so that I can see if
I can improve the conversion process before 1.10 official release.
+ Each menu option on a menu now as its own "execution list" of menu + Each menu option on a menu now as its own "execution list" of menu
commands. This basically replaces the old "kludge" stacking of commands commands. This basically replaces the old "kludge" stacking of commands
to execute back to back with a single hotkey. It is a much more clean to execute back to back with a single hotkey. It is a much more clean
@ -4378,6 +4382,8 @@
Page Down Page Down
Escape Escape
Tab Tab
Home
End
+ In a lightbar grid menu, each menu command now has the ability to execute + In a lightbar grid menu, each menu command now has the ability to execute
on a grid-specific event. The following are available options: on a grid-specific event. The following are available options:
@ -4391,14 +4397,21 @@
Escape Escape
PgUp PgUp
PgDn PgDn
Home
End
+ All displayed menu items now have an option for display type. If it set + All displayed menu items now have an option for display type. If it set
to Access it will only be displayed if the user has access. If it is set to Access it will only be displayed if the user has access. If it is set
to Always, it will always been displayed, and if it is set to Never, it to Always, it will always been displayed. If its set to Never, it will
will never be displayed. never be displayed.
+ Lightbar and Lightbar/Grid menus now display menu header and prompts if + Lightbar and Lightbar/Grid menus now display menu header and prompts if
they are not set to a blank value. They were ignored in the past, but they are not set to a blank value. They were ignored in the past, but
this provides some better flexibility. If you have lightbar menus you this provides some better flexibility. If you have lightbar menus you
may need to validate that the header/footers in your menu flags are blank may need to validate that the header/footers in your menu flags are blank
if you do not want this feature. if you do not want this feature.
+ New auto-exec hotkey for menu commands: TIMER. An item with the hotkey
of TIMER will automatically execute every X amount of seconds, which is
defined per menu command. This combined with all of the other new
features makes for an amazingly powerful new menu system!

View File

@ -54,6 +54,7 @@ Type
LastMCIValue : String; LastMCIValue : String;
InputPos : Byte; InputPos : Byte;
GetKeyCallBack : TGetKeyCallBack; GetKeyCallBack : TGetKeyCallBack;
LastSecond : LongInt;
{$IFDEF WINDOWS} {$IFDEF WINDOWS}
OutBuffer : Array[0..TBBSIOBufferSize] of Char; OutBuffer : Array[0..TBBSIOBufferSize] of Char;
@ -1260,7 +1261,6 @@ End;
Function TBBSIO.GetKey : Char; Function TBBSIO.GetKey : Char;
Var Var
TimeCount : LongInt; TimeCount : LongInt;
LastSec : LongInt = 0;
Begin Begin
Result := #255; Result := #255;
@ -1269,7 +1269,7 @@ Begin
BufFlush; BufFlush;
Repeat Repeat
If LastSec <> TimerSeconds Then Begin If LastSecond <> TimerSeconds Then Begin
If Assigned(GetKeyCallBack) Then If Assigned(GetKeyCallBack) Then
If GetKeyCallBack(False) Then Begin If GetKeyCallBack(False) Then Begin
@ -1277,7 +1277,7 @@ Begin
Exit; Exit;
End; End;
LastSec := TimerSeconds; LastSecond := TimerSeconds;
If InMacro Then If InMacro Then
If InMacroPos <= Length(InMacroStr) Then Begin If InMacroPos <= Length(InMacroStr) Then Begin

View File

@ -24,6 +24,7 @@ Type
SetAction : Boolean; SetAction : Boolean;
UseLongKey : Boolean; UseLongKey : Boolean;
UseTimer : Boolean; UseTimer : Boolean;
TimerCount : LongInt;
ViewOnly : Boolean; ViewOnly : Boolean;
Constructor Create (O: Pointer); Constructor Create (O: Pointer);
@ -34,7 +35,7 @@ Type
Function LoadMenu (Forced: Boolean) : Boolean; Function LoadMenu (Forced: Boolean) : Boolean;
Procedure ExecuteMenu (Load, Forced, View, Action: Boolean); Procedure ExecuteMenu (Load, Forced, View, Action: Boolean);
Function ExecuteCommandList (Num, JumpID: LongInt) : Byte; Function ExecuteCommandList (Num, JumpID: LongInt) : Byte;
Function ExecuteByHotkey (Key: String) : Boolean; Function ExecuteByHotkey (Key: String; Interval: LongInt) : Boolean;
Function ExecuteCommand (Cmd, CmdData: String) : Boolean; Function ExecuteCommand (Cmd, CmdData: String) : Boolean;
Function ShowMenu : Boolean; Function ShowMenu : Boolean;
Procedure GenerateMenu; Procedure GenerateMenu;
@ -359,6 +360,7 @@ Begin
If TBBSCore(Owner).User.Access(Data.Item[Num]^.CmdData[Count]^.Access) Then Begin If TBBSCore(Owner).User.Access(Data.Item[Num]^.CmdData[Count]^.Access) Then Begin
Result := 1; Result := 1;
If ExecuteCommand(Data.Item[Num]^.CmdData[Count]^.MenuCmd, Data.Item[Num]^.CmdData[Count]^.Data) Then Begin If ExecuteCommand(Data.Item[Num]^.CmdData[Count]^.MenuCmd, Data.Item[Num]^.CmdData[Count]^.Data) Then Begin
Result := 2; Result := 2;
Exit; Exit;
@ -367,7 +369,7 @@ Begin
End; End;
End; End;
Function TMenuEngine.ExecuteByHotkey (Key: String) : Boolean; Function TMenuEngine.ExecuteByHotkey (Key: String; Interval: LongInt) : Boolean;
Var Var
Count : LongInt; Count : LongInt;
Begin Begin
@ -382,6 +384,7 @@ Begin
End; End;
If Data.Item[Count]^.HotKey = Key Then If Data.Item[Count]^.HotKey = Key Then
If (Key <> 'TIMER') or ((Key = 'TIMER') And (Interval MOD Data.Item[Count]^.Timer = 0)) Then
If ExecuteCommandList(Count, -1) = 2 Then Begin If ExecuteCommandList(Count, -1) = 2 Then Begin
Result := True; Result := True;
Exit; Exit;
@ -452,7 +455,7 @@ Begin
TBBSCore(Owner).io.BufFlush; TBBSCore(Owner).io.BufFlush;
End; End;
If ExecuteByHotKey('AFTER') Then Exit; If ExecuteByHotKey('AFTER', 0) Then Exit;
If Data.Info.Footer <> '' Then If Data.Info.Footer <> '' Then
TBBSCore(Owner).io.OutFull(Data.Info.Footer); TBBSCore(Owner).io.OutFull(Data.Info.Footer);
@ -497,7 +500,7 @@ Var
Begin Begin
While Not TBBSCore(Owner).ShutDown Do Begin While Not TBBSCore(Owner).ShutDown Do Begin
If Not ViewOnly Then If Not ViewOnly Then
If ExecuteByHotKey('EVERY') Then Exit; If ExecuteByHotKey('EVERY', 0) Then Exit;
If ReDraw Then GenerateMenu; If ReDraw Then GenerateMenu;
@ -567,7 +570,7 @@ Begin
If ViewOnly Then Exit; If ViewOnly Then Exit;
If Not TBBSCore(Owner).ShutDown Then If Not TBBSCore(Owner).ShutDown Then
If ExecuteByHotKey(Temp) Then If ExecuteByHotKey(Temp, 0) Then
Exit; Exit;
End; End;
End; End;
@ -664,7 +667,7 @@ Begin
While Not TBBSCore(Owner).ShutDown Do Begin While Not TBBSCore(Owner).ShutDown Do Begin
If Not ViewOnly Then If Not ViewOnly Then
ExecuteByHotKey('EVERY'); ExecuteByHotKey('EVERY', 0);
If SetAction Then If SetAction Then
If Data.Info.NodeStatus <> '' Then If Data.Info.NodeStatus <> '' Then
@ -697,7 +700,7 @@ Begin
TBBSCore(Owner).io.AllowArrow := True; TBBSCore(Owner).io.AllowArrow := True;
If Not ViewOnly Then If Not ViewOnly Then
ExecuteByHotKey('AFTER'); ExecuteByHotKey('AFTER', 0);
DrawBar (CursorPos, True); DrawBar (CursorPos, True);
@ -770,12 +773,24 @@ Begin
End; End;
End; End;
End; End;
#71 : If Data.Info.MenuType = 2 Then
Case ExecuteCommandList(CursorPos, 9) of
0 : ;
1 : Break;
2 : Exit;
End;
#73 : If Data.Info.MenuType = 2 Then #73 : If Data.Info.MenuType = 2 Then
Case ExecuteCommandList(CursorPos, 7) of Case ExecuteCommandList(CursorPos, 7) of
0 : ; 0 : ;
1 : Break; 1 : Break;
2 : Exit; 2 : Exit;
End; End;
#79 : If Data.Info.MenuType = 2 Then
Case ExecuteCommandList(CursorPos, 10) of
0 : ;
1 : Break;
2 : Exit;
End;
#81 : If Data.Info.MenuType = 2 Then #81 : If Data.Info.MenuType = 2 Then
Case ExecuteCommandList(CursorPos, 8) of Case ExecuteCommandList(CursorPos, 8) of
0 : ; 0 : ;
@ -878,6 +893,18 @@ 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
Result := False;
Inc (TimerCount);
ExecuteByHotkey('TIMER', TimerCount);
If TimerCount = 100000 Then TimerCount := 0;
End;
Var Var
Count : LongInt; Count : LongInt;
Begin Begin
@ -924,6 +951,7 @@ Begin
ReDraw := NextReDraw; ReDraw := NextReDraw;
NextReDraw := True; NextReDraw := True;
UseLongKey := False; UseLongKey := False;
TimerCount := 0;
For Count := 1 to Data.NumItems Do Begin For Count := 1 to Data.NumItems Do Begin
If (Data.Item[Count]^.HotKey = 'EVERY') or If (Data.Item[Count]^.HotKey = 'EVERY') or
@ -947,6 +975,9 @@ Begin
If Byte(Data.Item[Count]^.HotKey[0]) > 1 Then UseLongKey := 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,
@ -955,6 +986,8 @@ Begin
Else Else
DoStandardMenu; DoStandardMenu;
End; End;
Session.io.GetKeyCallback := NIL;
End; End;
End. End.