Execute MPL support

This commit is contained in:
mysticbbs 2012-03-10 03:57:33 -05:00
parent dd4a156e91
commit 27e5120d3a
1 changed files with 40 additions and 43 deletions

View File

@ -1,21 +1,5 @@
Unit bbs_Ansi_Help; Unit bbs_Ansi_Help;
// leet online ansi help system (html-like with pipe colors too)
// ripped from genesis engine (my ansi editor) and slowly port into mystic
// 2. completely redo loading so text is stored in pointer of records...
// we can allow larger help files.
// 4. needs to use ansi template
// 5. quickjump/sitemap option
// 6. add linking to OTHER .hlp files?
// 7. how to better integrate with the bbs? execute MPL command? what else?
//
// needs to support lines longer than 255 characters too
//
// template, percentage bar, what to do with topic?
// export to text / download
// history view / jump to history
{$I M_OPS.PAS} {$I M_OPS.PAS}
Interface Interface
@ -26,14 +10,16 @@ Const
mysMaxHelpLineLinks = 10; mysMaxHelpLineLinks = 10;
Type Type
TLineInfoRec = Record // make into pointer TLinkInfoRec = Record
Text : String; // make into pointer of string Key : String[mysMaxHelpKeyLen];
LinkPos : Byte;
LinkLen : Byte;
End;
TLineInfoRec = Record
Text : String;
Links : Byte; Links : Byte;
Link : Array[1..mysMaxHelpLineLinks] of Record //make into pointer Link : Array[1..mysMaxHelpLineLinks] of TLinkInfoRec
Key : String[mysMaxHelpKeyLen];
LinkPos : Byte;
LinkLen : Byte;
End;
End; End;
TAnsiMenuHelp = Class TAnsiMenuHelp = Class
@ -54,8 +40,9 @@ Implementation
Uses Uses
m_Strings, m_Strings,
bbs_Ansi_MenuBox,
bbs_Core, bbs_Core,
bbs_Ansi_MenuBox; MPL_Execute;
Constructor TAnsiMenuHelp.Create; Constructor TAnsiMenuHelp.Create;
Begin Begin
@ -79,7 +66,7 @@ Begin
If A > 0 Then Begin If A > 0 Then Begin
B := 1; B := 1;
while Str[A + 6 + B] <> '>' Do Inc(B); While Str[A + 6 + B] <> '>' Do Inc(B);
Delete (Str, A, 7 + B); Delete (Str, A, 7 + B);
A := Pos('</link>', Str); A := Pos('</link>', Str);
@ -172,7 +159,7 @@ Const
WinY2 : Byte = 22; WinY2 : Byte = 22;
Var Var
FN : String; FN : String;
Template : String; Template : String[20];
Keyword : String; Keyword : String;
TopPage : Integer; TopPage : Integer;
CurLine : Integer; CurLine : Integer;
@ -248,6 +235,16 @@ Var
CurLine := Lines; CurLine := Lines;
End; End;
Procedure ShowTemplate;
Begin
Session.io.OutFile(Template, False, 0);
WinX1 := Session.io.ScreenInfo[1].X;
WinY1 := Session.io.ScreenInfo[1].Y;
WinX2 := Session.io.ScreenInfo[2].X;
WinY2 := Session.io.SCreenInfo[2].Y;
End;
Var Var
OK : Boolean; OK : Boolean;
Count : Byte; Count : Byte;
@ -264,12 +261,7 @@ Begin
Close (HelpFile); Close (HelpFile);
Session.io.OutFile(Template, False, 0); ShowTemplate;
WinX1 := Session.io.ScreenInfo[1].X;
WinY1 := Session.io.ScreenInfo[1].Y;
WinX2 := Session.io.ScreenInfo[2].X;
WinY2 := Session.io.SCreenInfo[2].Y;
TopPage := 1; TopPage := 1;
CurLine := 1; CurLine := 1;
@ -280,16 +272,11 @@ Begin
If Not OK and (CurKey <> 'INDEX') Then Begin If Not OK and (CurKey <> 'INDEX') Then Begin
CurKey := 'INDEX'; CurKey := 'INDEX';
OK := ReadKeywordData; OK := ReadKeywordData;
End; End;
If Not OK Then Exit; If Not OK Then Exit;
// Session.io.PurgeInputBuffer;
// DrawPage;
// UpdateCursor;
While OK Do Begin While OK Do Begin
TopPage := 1; TopPage := 1;
CurLine := 1; CurLine := 1;
@ -436,14 +423,24 @@ Begin
Dec (LastPos); Dec (LastPos);
End; End;
End Else Begin End Else Begin
If LastPos < 10 Then Case Text[TopPage + CurLine - 1].Link[CurLPos].Key[1] of
Inc (LastPos) '!' : Begin
Session.io.AnsiColor(7);
ExecuteMPL(NIL, Copy(Text[TopPage + CurLine - 1].Link[CurLPos].Key, 2, 255));
ShowTemplate;
End;
Else Else
For Count := 1 to 9 Do LastKey[Count] := LastKey[Count + 1]; If LastPos < 10 Then
Inc (LastPos)
Else
For Count := 1 to 9 Do LastKey[Count] := LastKey[Count + 1];
LastKey[LastPos] := CurKey; LastKey[LastPos] := CurKey;
CurKey := Text[TopPage + CurLine - 1].Link[CurLPos].Key; CurKey := Text[TopPage + CurLine - 1].Link[CurLPos].Key;
End;
End; End;
OK := ReadKeywordData; OK := ReadKeywordData;