diff --git a/mystic/HISTORY.txt b/mystic/HISTORY.txt index 3e807db..88e08a5 100644 --- a/mystic/HISTORY.txt +++ b/mystic/HISTORY.txt @@ -4326,6 +4326,10 @@ there may be issues - particularly in lightbar grid menus I would guess 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 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 @@ -4378,6 +4382,8 @@ Page Down Escape Tab + Home + End + In a lightbar grid menu, each menu command now has the ability to execute on a grid-specific event. The following are available options: @@ -4391,14 +4397,21 @@ Escape PgUp PgDn + Home + End + 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 Always, it will always been displayed, and if it is set to Never, it - will never be displayed. + to Always, it will always been displayed. If its set to Never, it will + never be displayed. + 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 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 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! diff --git a/mystic/bbs_io.pas b/mystic/bbs_io.pas index e8f83ac..f75f162 100644 --- a/mystic/bbs_io.pas +++ b/mystic/bbs_io.pas @@ -54,6 +54,7 @@ Type LastMCIValue : String; InputPos : Byte; GetKeyCallBack : TGetKeyCallBack; + LastSecond : LongInt; {$IFDEF WINDOWS} OutBuffer : Array[0..TBBSIOBufferSize] of Char; @@ -1260,16 +1261,15 @@ End; Function TBBSIO.GetKey : Char; Var TimeCount : LongInt; - LastSec : LongInt = 0; Begin - Result := #255; + Result := #255; TBBSCore(Core).TimeOut := TimerSeconds; BufFlush; Repeat - If LastSec <> TimerSeconds Then Begin + If LastSecond <> TimerSeconds Then Begin If Assigned(GetKeyCallBack) Then If GetKeyCallBack(False) Then Begin @@ -1277,7 +1277,7 @@ Begin Exit; End; - LastSec := TimerSeconds; + LastSecond := TimerSeconds; If InMacro Then If InMacroPos <= Length(InMacroStr) Then Begin diff --git a/mystic/bbs_menus.pas b/mystic/bbs_menus.pas index f89e8b1..9a7c692 100644 --- a/mystic/bbs_menus.pas +++ b/mystic/bbs_menus.pas @@ -24,6 +24,7 @@ Type SetAction : Boolean; UseLongKey : Boolean; UseTimer : Boolean; + TimerCount : LongInt; ViewOnly : Boolean; Constructor Create (O: Pointer); @@ -34,7 +35,7 @@ Type Function LoadMenu (Forced: Boolean) : Boolean; Procedure ExecuteMenu (Load, Forced, View, Action: Boolean); 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 ShowMenu : Boolean; Procedure GenerateMenu; @@ -359,6 +360,7 @@ Begin If TBBSCore(Owner).User.Access(Data.Item[Num]^.CmdData[Count]^.Access) Then Begin Result := 1; + If ExecuteCommand(Data.Item[Num]^.CmdData[Count]^.MenuCmd, Data.Item[Num]^.CmdData[Count]^.Data) Then Begin Result := 2; Exit; @@ -367,7 +369,7 @@ Begin End; End; -Function TMenuEngine.ExecuteByHotkey (Key: String) : Boolean; +Function TMenuEngine.ExecuteByHotkey (Key: String; Interval: LongInt) : Boolean; Var Count : LongInt; Begin @@ -382,10 +384,11 @@ Begin End; If Data.Item[Count]^.HotKey = Key Then - If ExecuteCommandList(Count, -1) = 2 Then Begin - Result := True; - Exit; - End; + If (Key <> 'TIMER') or ((Key = 'TIMER') And (Interval MOD Data.Item[Count]^.Timer = 0)) Then + If ExecuteCommandList(Count, -1) = 2 Then Begin + Result := True; + Exit; + End; End; End; @@ -452,7 +455,7 @@ Begin TBBSCore(Owner).io.BufFlush; End; - If ExecuteByHotKey('AFTER') Then Exit; + If ExecuteByHotKey('AFTER', 0) Then Exit; If Data.Info.Footer <> '' Then TBBSCore(Owner).io.OutFull(Data.Info.Footer); @@ -497,7 +500,7 @@ Var Begin While Not TBBSCore(Owner).ShutDown Do Begin If Not ViewOnly Then - If ExecuteByHotKey('EVERY') Then Exit; + If ExecuteByHotKey('EVERY', 0) Then Exit; If ReDraw Then GenerateMenu; @@ -567,7 +570,7 @@ Begin If ViewOnly Then Exit; If Not TBBSCore(Owner).ShutDown Then - If ExecuteByHotKey(Temp) Then + If ExecuteByHotKey(Temp, 0) Then Exit; End; End; @@ -664,7 +667,7 @@ Begin While Not TBBSCore(Owner).ShutDown Do Begin If Not ViewOnly Then - ExecuteByHotKey('EVERY'); + ExecuteByHotKey('EVERY', 0); If SetAction Then If Data.Info.NodeStatus <> '' Then @@ -697,7 +700,7 @@ Begin TBBSCore(Owner).io.AllowArrow := True; If Not ViewOnly Then - ExecuteByHotKey('AFTER'); + ExecuteByHotKey('AFTER', 0); DrawBar (CursorPos, True); @@ -770,12 +773,24 @@ Begin 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 Case ExecuteCommandList(CursorPos, 7) of 0 : ; 1 : Break; 2 : Exit; 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 Case ExecuteCommandList(CursorPos, 8) of 0 : ; @@ -878,11 +893,23 @@ Begin End; 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 Count : LongInt; Begin - SetAction := Action; - ViewOnly := View; + SetAction := Action; + ViewOnly := View; If ViewOnly Then Begin Case Data.Info.MenuType of @@ -924,6 +951,7 @@ Begin ReDraw := NextReDraw; NextReDraw := True; UseLongKey := False; + TimerCount := 0; For Count := 1 to Data.NumItems Do Begin If (Data.Item[Count]^.HotKey = 'EVERY') or @@ -947,6 +975,9 @@ Begin If Byte(Data.Item[Count]^.HotKey[0]) > 1 Then UseLongKey := True; End; + If UseTimer Then + Session.io.GetKeyCallBack := TimerController; + Case Data.Info.MenuType of 0 : DoStandardMenu; 1, @@ -955,6 +986,8 @@ Begin Else DoStandardMenu; End; + + Session.io.GetKeyCallback := NIL; End; End.