All known bugs fixed, still plenty to do though before its done
This commit is contained in:
parent
fbf1e65dbe
commit
8f71d8b564
|
@ -1,33 +1,16 @@
|
||||||
Unit bbs_Ansi_Help;
|
Unit bbs_Ansi_Help;
|
||||||
|
|
||||||
// very old online-help class from Genesis Engine (my ansi editor)
|
// leet online ansi help system (html-like with pipe colors too)
|
||||||
// updated to compile with mystic but needs a lot of touch ups.
|
// ripped from genesis engine (my ansi editor) and slowly port into mystic
|
||||||
// idea is to template this out and have .hlp files that can be used in
|
|
||||||
// all help areas if they exist instead of just a display file.
|
|
||||||
// and of course a menu command to active this with ANY hlp files so sysops
|
|
||||||
// can use it however they'd like
|
|
||||||
//
|
|
||||||
// hlp files are text files which can have embedded pipe color codes in them
|
|
||||||
// and also have keywords and the ability to link around them, sort of like
|
|
||||||
// a very basic HTML system for BBS with an ansi interface to scroll around
|
|
||||||
// and follow links.
|
|
||||||
|
|
||||||
// first port to class system from object -- DONE
|
|
||||||
// second make sure it even works --- DONE (buggy)
|
|
||||||
// then:
|
|
||||||
|
|
||||||
// 1. change "<a href=" to "<link="
|
|
||||||
// 2. completely redo loading so text is stored in pointer of records...
|
// 2. completely redo loading so text is stored in pointer of records...
|
||||||
// we can allow larger help files.
|
// we can allow larger help files.
|
||||||
// 3. text file read needs to be buffered
|
|
||||||
// 4. needs to use ansi template
|
// 4. needs to use ansi template
|
||||||
// 5. quickjump/sitemap option
|
// 5. quickjump/sitemap option
|
||||||
// 6. add linking to OTHER .hlp files?
|
// 6. add linking to OTHER .hlp files?
|
||||||
// 7. how to better integrate with the bbs? execute MPL command? what else?
|
// 7. how to better integrate with the bbs? execute MPL command? what else?
|
||||||
//
|
//
|
||||||
// after this is done... port the ansi editor itself for online ansi editing
|
// needs to support lines longer than 255 characters too
|
||||||
// goodness! and also make file manager for sysops
|
|
||||||
// needs to support lines better than 255 characters too
|
|
||||||
|
|
||||||
{$I M_OPS.PAS}
|
{$I M_OPS.PAS}
|
||||||
|
|
||||||
|
@ -71,27 +54,29 @@ Uses
|
||||||
m_Strings,
|
m_Strings,
|
||||||
bbs_Core;
|
bbs_Core;
|
||||||
|
|
||||||
function striplinks (s:string):string;
|
Function StripLinks (S: String) : String;
|
||||||
var
|
Var
|
||||||
a : byte;
|
A : Byte;
|
||||||
B : byte;
|
B : Byte;
|
||||||
begin
|
Begin
|
||||||
a := 255;
|
A := 255;
|
||||||
|
|
||||||
while a > 0 do begin
|
While A > 0 Do Begin
|
||||||
a := pos('<a href=', s);
|
A := Pos('<link=', S);
|
||||||
if a > 0 then begin
|
|
||||||
b := 1;
|
|
||||||
while s[a+8+b] <> '>' do inc(b);
|
|
||||||
Delete (S, a, 9 + b);
|
|
||||||
a := Pos('</a>', S);
|
|
||||||
If a = 0 Then a := Length(S);
|
|
||||||
Delete (S, a, 4);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
striplinks := s;
|
If A > 0 Then Begin
|
||||||
end;
|
B := 1;
|
||||||
|
while S[A+6+B] <> '>' Do Inc(B);
|
||||||
|
Delete (S, A, 7 + B);
|
||||||
|
|
||||||
|
A := Pos('</link>', S);
|
||||||
|
If A = 0 Then A := Length(S);
|
||||||
|
Delete (S, A, 7);
|
||||||
|
End;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Result := S;
|
||||||
|
End;
|
||||||
|
|
||||||
Constructor TAnsiMenuHelp.Create;
|
Constructor TAnsiMenuHelp.Create;
|
||||||
Begin
|
Begin
|
||||||
|
@ -144,7 +129,7 @@ Begin
|
||||||
Str := strStripPipe(Str);
|
Str := strStripPipe(Str);
|
||||||
|
|
||||||
Repeat
|
Repeat
|
||||||
Temp1 := Pos('<a href=', Str);
|
Temp1 := Pos('<link=', Str);
|
||||||
|
|
||||||
If Temp1 = 0 Then Break;
|
If Temp1 = 0 Then Break;
|
||||||
|
|
||||||
|
@ -155,14 +140,14 @@ Begin
|
||||||
Temp2 := 0;
|
Temp2 := 0;
|
||||||
Key := '';
|
Key := '';
|
||||||
|
|
||||||
While Str[Temp1 + 8 + Temp2] <> '>' Do Begin
|
While Str[Temp1 + 6 + Temp2] <> '>' Do Begin
|
||||||
Key := Key + Str[Temp1 + 8 + Temp2];
|
Key := Key + Str[Temp1 + 6 + Temp2];
|
||||||
Inc(Temp2);
|
Inc (Temp2);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Delete (Str, Temp1, 9 + Temp2);
|
Delete (Str, Temp1, 7 + Temp2);
|
||||||
Temp2 := Pos('</a>', Str);
|
Temp2 := Pos('</link>', Str);
|
||||||
Delete (Str, Temp2, 4);
|
Delete (Str, Temp2, 7);
|
||||||
|
|
||||||
Text[Lines].Link[Text[Lines].Links].LinkLen := Temp2 - Temp1;
|
Text[Lines].Link[Text[Lines].Links].LinkLen := Temp2 - Temp1;
|
||||||
Text[Lines].Link[Text[Lines].Links].Key := Key;
|
Text[Lines].Link[Text[Lines].Links].Key := Key;
|
||||||
|
@ -204,6 +189,7 @@ Var
|
||||||
For Count1 := Y1 to WinSize Do Begin
|
For Count1 := Y1 to WinSize Do Begin
|
||||||
If TopPage + Count1 - Y1 <= Lines Then Begin
|
If TopPage + Count1 - Y1 <= Lines Then Begin
|
||||||
WriteXYPipe (X1 + 1, (Count1 - Y1) + Y1 + 1, 7, X2 - X1 - 1, Text[TopPage + (Count1 - Y1)].Text);
|
WriteXYPipe (X1 + 1, (Count1 - Y1) + Y1 + 1, 7, X2 - X1 - 1, Text[TopPage + (Count1 - Y1)].Text);
|
||||||
|
|
||||||
For Count2 := 1 to Text[TopPage + Count1 - 1].Links Do
|
For Count2 := 1 to Text[TopPage + Count1 - 1].Links Do
|
||||||
LinkOFF (TopPage + Count1 - 1, Count1 - Y1 + Y1 + 1, Count2);
|
LinkOFF (TopPage + Count1 - 1, Count1 - Y1 + Y1 + 1, Count2);
|
||||||
End Else
|
End Else
|
||||||
|
@ -240,9 +226,8 @@ Var
|
||||||
If Lines > WinSize Then Begin
|
If Lines > WinSize Then Begin
|
||||||
If TopPage + WinSize <= Lines - WinSize Then Begin
|
If TopPage + WinSize <= Lines - WinSize Then Begin
|
||||||
Inc (TopPage, WinSize);
|
Inc (TopPage, WinSize);
|
||||||
// Inc (CurLine, WinSize);
|
|
||||||
End Else Begin
|
End Else Begin
|
||||||
TopPage := Lines - WinSize + 1; //was - 1
|
TopPage := Lines - WinSize + 1;
|
||||||
CurLine := WinSize;
|
CurLine := WinSize;
|
||||||
End;
|
End;
|
||||||
End Else
|
End Else
|
||||||
|
@ -335,7 +320,6 @@ Begin
|
||||||
Dec (TopPage, WinSize);
|
Dec (TopPage, WinSize);
|
||||||
DrawPage;
|
DrawPage;
|
||||||
UpdateCursor;
|
UpdateCursor;
|
||||||
// Dec (CurLine, WinSize);
|
|
||||||
End Else If TopPage > 1 Then Begin
|
End Else If TopPage > 1 Then Begin
|
||||||
TopPage := 1;
|
TopPage := 1;
|
||||||
CurLine := 1;
|
CurLine := 1;
|
||||||
|
@ -380,8 +364,8 @@ Begin
|
||||||
End;
|
End;
|
||||||
End Else Begin
|
End Else Begin
|
||||||
Case Ch of
|
Case Ch of
|
||||||
#13 : If Text[CurLine].Links > 0 Then Begin
|
#13 : If Text[TopPage + CurLine - 1].Links > 0 Then Begin
|
||||||
If Text[CurLine].Link[CurLPos].Key = '@PREV' Then Begin
|
If Text[TopPage + CurLine - 1].Link[CurLPos].Key = '@PREV' Then Begin
|
||||||
If LastPos = 0 Then
|
If LastPos = 0 Then
|
||||||
CurKey := 'INDEX'
|
CurKey := 'INDEX'
|
||||||
Else Begin
|
Else Begin
|
||||||
|
@ -395,7 +379,8 @@ Begin
|
||||||
For Count := 1 to 9 Do LastKey[Count] := LastKey[Count + 1];
|
For Count := 1 to 9 Do LastKey[Count] := LastKey[Count + 1];
|
||||||
|
|
||||||
LastKey[LastPos] := CurKey;
|
LastKey[LastPos] := CurKey;
|
||||||
CurKey := Text[CurLine].Link[CurLPos].Key;
|
|
||||||
|
CurKey := Text[TopPage + CurLine - 1].Link[CurLPos].Key;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
OK := ReadKeywordData;
|
OK := ReadKeywordData;
|
||||||
|
|
Loading…
Reference in New Issue