Implemented ANSI file viewer, changed gallery to use it by default
This commit is contained in:
parent
cc11df4162
commit
189a99ea60
|
@ -36,6 +36,7 @@ Procedure Voting_Booth (Forced: Boolean; Num: Integer);
|
||||||
Procedure Voting_Result (Data: Integer);
|
Procedure Voting_Result (Data: Integer);
|
||||||
Procedure Voting_Booth_New;
|
Procedure Voting_Booth_New;
|
||||||
Procedure View_Directory (Data: String; ViewType: Byte);
|
Procedure View_Directory (Data: String; ViewType: Byte);
|
||||||
|
Procedure AnsiViewer (Bar: RecPercent; Data: String);
|
||||||
|
|
||||||
{$IFNDEF UNIX}
|
{$IFNDEF UNIX}
|
||||||
Procedure PageForSysopChat (Forced: Boolean);
|
Procedure PageForSysopChat (Forced: Boolean);
|
||||||
|
@ -48,6 +49,7 @@ Uses
|
||||||
m_FileIO,
|
m_FileIO,
|
||||||
m_QuickSort,
|
m_QuickSort,
|
||||||
bbs_Core,
|
bbs_Core,
|
||||||
|
bbs_MsgBase_Ansi,
|
||||||
bbs_NodeInfo;
|
bbs_NodeInfo;
|
||||||
|
|
||||||
Function Editor (Var Lines: SmallInt; MaxLen, MaxLine: SmallInt; Forced: Boolean; Template: String; Var Subj: String) : Boolean;
|
Function Editor (Var Lines: SmallInt; MaxLen, MaxLine: SmallInt; Forced: Boolean; Template: String; Var Subj: String) : Boolean;
|
||||||
|
@ -889,39 +891,6 @@ Begin
|
||||||
End;
|
End;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Procedure View_Directory (Data: String; ViewType: Byte);
|
|
||||||
Const
|
|
||||||
vtMaxList = 1000;
|
|
||||||
|
|
||||||
Type
|
|
||||||
RecSauceInfo = Packed Record
|
|
||||||
Title : String[35];
|
|
||||||
Author : String[20];
|
|
||||||
Group : String[20];
|
|
||||||
End;
|
|
||||||
|
|
||||||
DirRec = Record
|
|
||||||
Desc : String[160];
|
|
||||||
Size : LongInt;
|
|
||||||
Date : LongInt;
|
|
||||||
IsDir : Boolean;
|
|
||||||
Title : String[34];
|
|
||||||
Author : String[19];
|
|
||||||
Group : String[19];
|
|
||||||
End;
|
|
||||||
|
|
||||||
Var
|
|
||||||
WinTop : Byte;
|
|
||||||
WinBot : Byte;
|
|
||||||
WinSize : Byte;
|
|
||||||
DirList : Array[1..vtMaxList] of ^DirRec;
|
|
||||||
DirCount : LongInt = 0;
|
|
||||||
CurTop : LongInt = 1;
|
|
||||||
CurBot : LongInt = 1;
|
|
||||||
CurPos : LongInt = 1;
|
|
||||||
CurPath : String;
|
|
||||||
Root : String;
|
|
||||||
|
|
||||||
Function ReadSauceInfo (FN: String; Var Sauce: RecSauceInfo) : Boolean;
|
Function ReadSauceInfo (FN: String; Var Sauce: RecSauceInfo) : Boolean;
|
||||||
Var
|
Var
|
||||||
DF : File;
|
DF : File;
|
||||||
|
@ -944,6 +913,7 @@ Var
|
||||||
End;
|
End;
|
||||||
|
|
||||||
BlockRead (DF, Str[1], 130);
|
BlockRead (DF, Str[1], 130);
|
||||||
|
|
||||||
Str[0] := #130;
|
Str[0] := #130;
|
||||||
|
|
||||||
Close (DF);
|
Close (DF);
|
||||||
|
@ -959,6 +929,33 @@ Var
|
||||||
End;
|
End;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
Procedure View_Directory (Data: String; ViewType: Byte);
|
||||||
|
Const
|
||||||
|
vtMaxList = 1000;
|
||||||
|
|
||||||
|
Type
|
||||||
|
DirRec = Record
|
||||||
|
Desc : String[160];
|
||||||
|
Size : LongInt;
|
||||||
|
Date : LongInt;
|
||||||
|
IsDir : Boolean;
|
||||||
|
Title : String[34];
|
||||||
|
Author : String[19];
|
||||||
|
Group : String[19];
|
||||||
|
End;
|
||||||
|
|
||||||
|
Var
|
||||||
|
WinTop : Byte;
|
||||||
|
WinBot : Byte;
|
||||||
|
WinSize : Byte;
|
||||||
|
DirList : Array[1..vtMaxList] of ^DirRec;
|
||||||
|
DirCount : LongInt = 0;
|
||||||
|
CurTop : LongInt = 1;
|
||||||
|
CurBot : LongInt = 1;
|
||||||
|
CurPos : LongInt = 1;
|
||||||
|
CurPath : String;
|
||||||
|
Root : String;
|
||||||
|
|
||||||
Procedure BuildDirectory (Path: String);
|
Procedure BuildDirectory (Path: String);
|
||||||
Var
|
Var
|
||||||
SR : SearchRec;
|
SR : SearchRec;
|
||||||
|
@ -1211,6 +1208,7 @@ Var
|
||||||
Ch : Char;
|
Ch : Char;
|
||||||
Count : Word;
|
Count : Word;
|
||||||
Speed : Byte;
|
Speed : Byte;
|
||||||
|
UseFull : Boolean;
|
||||||
Begin
|
Begin
|
||||||
If Session.io.Graphics = 0 Then Begin
|
If Session.io.Graphics = 0 Then Begin
|
||||||
Session.io.OutFullLn(Session.GetPrompt(466));
|
Session.io.OutFullLn(Session.GetPrompt(466));
|
||||||
|
@ -1221,6 +1219,7 @@ Begin
|
||||||
|
|
||||||
Root := DirSlash(strWordGet(1, Data, ';'));
|
Root := DirSlash(strWordGet(1, Data, ';'));
|
||||||
Speed := strS2I(strWordGet(2, Data, ';'));
|
Speed := strS2I(strWordGet(2, Data, ';'));
|
||||||
|
UseFull := Not (strUpper(strWordGet(3, Data, ';')) = 'DISPLAY');
|
||||||
CurPath := Root;
|
CurPath := Root;
|
||||||
|
|
||||||
BuildDirectory(CurPath);
|
BuildDirectory(CurPath);
|
||||||
|
@ -1344,8 +1343,13 @@ Begin
|
||||||
Session.io.AllowMCI := True;
|
Session.io.AllowMCI := True;
|
||||||
Session.io.AnsiColor(7);
|
Session.io.AnsiColor(7);
|
||||||
Session.io.AnsiClear;
|
Session.io.AnsiClear;
|
||||||
|
|
||||||
|
If UseFull Then
|
||||||
|
AnsiViewer (Session.Theme.ViewerBar, 'ansigalv;' + CurPath + DirList[CurPos]^.Desc)
|
||||||
|
Else Begin
|
||||||
Session.io.OutFile (CurPath + DirList[CurPos]^.Desc, False, Speed);
|
Session.io.OutFile (CurPath + DirList[CurPos]^.Desc, False, Speed);
|
||||||
Session.io.PauseScreen;
|
Session.io.PauseScreen;
|
||||||
|
End;
|
||||||
|
|
||||||
FullReDraw;
|
FullReDraw;
|
||||||
End;
|
End;
|
||||||
|
@ -1433,11 +1437,7 @@ Begin
|
||||||
End;
|
End;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
(* MYSTIC 2's ANSIVIEWER
|
Procedure AnsiViewer (Bar: RecPercent; Data: String);
|
||||||
- needs to be intergrated with the msgbases. there should NOT be a msgtext AND this
|
|
||||||
class. there should only be one place where the massive message buffer exists.
|
|
||||||
|
|
||||||
Procedure TBBSIO.AnsiViewer (Data: String);
|
|
||||||
Var
|
Var
|
||||||
Buf : Array[1..4096] of Char;
|
Buf : Array[1..4096] of Char;
|
||||||
BufLen : LongInt;
|
BufLen : LongInt;
|
||||||
|
@ -1452,39 +1452,45 @@ Var
|
||||||
Sauce : RecSauceInfo;
|
Sauce : RecSauceInfo;
|
||||||
|
|
||||||
Procedure Update;
|
Procedure Update;
|
||||||
|
Var
|
||||||
|
Per : SmallInt;
|
||||||
Begin
|
Begin
|
||||||
// add percentage bar and line number here
|
Session.io.AnsiGotoXY (Session.io.ScreenInfo[3].X, Session.io.ScreenInfo[4].Y);
|
||||||
Ansi.DrawPage (TBBSCore(Owner).Term.ScreenInfo[1].Y, TBBSCore(Owner).Term.ScreenInfo[2].Y, TopLine);
|
Session.io.OutRaw (Session.io.DrawPercent(Bar, TopLine + WinSize - 1, Ansi.Lines, Per));
|
||||||
|
Session.io.AnsiGotoXY (Session.io.ScreenInfo[4].X, Session.io.ScreenInfo[4].Y);
|
||||||
|
Session.io.AnsiColor (Session.io.Screeninfo[4].A);
|
||||||
|
Session.io.OutRaw (strPadL(strI2S(Per), 3, ' '));
|
||||||
|
|
||||||
|
Ansi.DrawPage (Session.io.ScreenInfo[1].Y, Session.io.ScreenInfo[2].Y, TopLine);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Begin
|
Begin
|
||||||
Template := strWordGet(1, Data, ';');
|
Template := strWordGet(1, Data, ';');
|
||||||
FN := strWordGet(2, Data, ';');
|
FN := strWordGet(2, Data, ';');
|
||||||
|
|
||||||
If Pos(mysPathSep, FN) = 0 Then
|
If Pos(PathChar, FN) = 0 Then
|
||||||
FN := TBBSCore(Owner).Theme.PathText + FN;
|
FN := Session.Theme.TextPath + FN;
|
||||||
|
|
||||||
If Pos('.', FN) = 0 Then
|
If Pos('.', FN) = 0 Then
|
||||||
FN := FN + '.ans';
|
FN := FN + '.ans';
|
||||||
|
|
||||||
If Not FileExist(FN) Then Exit;
|
If Not FileExist(FN) Then Exit;
|
||||||
|
|
||||||
PromptInfo['A'] := JustFile(FN);
|
|
||||||
|
|
||||||
If ReadSauceInfo(FN, Sauce) Then Begin
|
If ReadSauceInfo(FN, Sauce) Then Begin
|
||||||
PromptInfo['B'] := strStripR(strWide2Str(Sauce.Title, 35), ' ');
|
Session.io.PromptInfo[2] := Sauce.Title;
|
||||||
PromptInfo['C'] := strStripR(strWide2Str(Sauce.Author, 20), ' ');
|
Session.io.PromptInfo[3] := Sauce.Author;
|
||||||
PromptInfo['D'] := strStripR(strWide2Str(Sauce.Group, 20), ' ');
|
Session.io.PromptInfo[4] := Sauce.Group;
|
||||||
Str := strWide2Str(Sauce.Date, 8);
|
|
||||||
PromptInfo['E'] := Copy(Str, 5, 2) + '/' + Copy(Str, 7, 2) + '/' + Copy(Str, 1, 4);
|
|
||||||
End Else Begin
|
End Else Begin
|
||||||
PromptInfo['B'] := 'Unknown';
|
Str := Session.GetPrompt(473);
|
||||||
PromptInfo['C'] := PromptInfo['B'];
|
|
||||||
PromptInfo['D'] := PromptInfo['B'];
|
Session.io.PromptInfo[2] := strWordGet(1, Str, ';');
|
||||||
PromptInfo['E'] := '??/??/????';
|
Session.io.PromptInfo[3] := strWordGet(2, Str, ';');
|
||||||
|
Session.io.PromptInfo[4] := strWordGet(3, Str, ';');
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Ansi := TMsgBaseAnsi.Create(TBBSCore(Owner), False);
|
Session.io.PromptInfo[1] := JustFile(FN);
|
||||||
|
|
||||||
|
Ansi := TMsgBaseAnsi.Create(Session, False);
|
||||||
|
|
||||||
Assign (AFile, FN);
|
Assign (AFile, FN);
|
||||||
ioReset (AFile, 1, fmReadWrite + fmDenyNone);
|
ioReset (AFile, 1, fmReadWrite + fmDenyNone);
|
||||||
|
@ -1496,24 +1502,25 @@ Begin
|
||||||
|
|
||||||
Close (AFile);
|
Close (AFile);
|
||||||
|
|
||||||
TBBSCore(Owner).Term.AllowArrow := True;
|
Session.io.AllowArrow := True;
|
||||||
|
|
||||||
ShowTemplate(Template);
|
Session.io.OutFile(Template, False, 0);
|
||||||
|
|
||||||
WinSize := TBBSCore(Owner).Term.ScreenInfo[2].Y - TBBSCore(Owner).Term.ScreenInfo[1].Y + 1;
|
WinSize := Session.io.ScreenInfo[2].Y - Session.io.ScreenInfo[1].Y + 1;
|
||||||
|
|
||||||
If strUpper(strWordGet(3, Data, ';')) = 'END' Then Begin
|
If strUpper(strWordGet(3, Data, ';')) = 'END' Then Begin
|
||||||
TopLine := Ansi.Lines - WinSize + 1;
|
TopLine := Ansi.Lines - WinSize + 1;
|
||||||
|
|
||||||
If TopLine < 1 Then TopLine := 1;
|
If TopLine < 1 Then TopLine := 1;
|
||||||
End Else
|
End Else
|
||||||
TopLine := 1;
|
TopLine := 1;
|
||||||
|
|
||||||
Update;
|
Update;
|
||||||
|
|
||||||
While Not TBBSCore(Owner).ShutDown Do Begin
|
While Not Session.ShutDown Do Begin
|
||||||
Ch := UpCase(GetKey(0));
|
Ch := UpCase(Session.io.GetKey);
|
||||||
|
|
||||||
If IsArrow Then Begin
|
If Session.io.IsArrow Then Begin
|
||||||
Case Ch of
|
Case Ch of
|
||||||
#71 : If TopLine > 1 Then Begin
|
#71 : If TopLine > 1 Then Begin
|
||||||
TopLine := 1;
|
TopLine := 1;
|
||||||
|
@ -1545,12 +1552,23 @@ Begin
|
||||||
End;
|
End;
|
||||||
End;
|
End;
|
||||||
End Else
|
End Else
|
||||||
If Ch = #27 Then Break;
|
Case Ch of
|
||||||
|
#32,
|
||||||
|
#13 : If TopLine < Ansi.Lines - WinSize Then Begin
|
||||||
|
Inc (TopLine, WinSize);
|
||||||
|
|
||||||
|
If TopLine + WinSize > Ansi.Lines Then TopLine := Ansi.Lines - WinSize + 1;
|
||||||
|
|
||||||
|
Update;
|
||||||
|
End;
|
||||||
|
|
||||||
|
#27 : Break;
|
||||||
|
End;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Ansi.Free;
|
Ansi.Free;
|
||||||
|
|
||||||
OutRaw(AnsiGotoXY(1, TBBSCore(Owner).User.ThisUser.ScreenSize));
|
Session.io.AnsiGotoXY(1, Session.User.ThisUser.ScreenSize);
|
||||||
End;
|
End;
|
||||||
*)
|
|
||||||
End.
|
End.
|
||||||
|
|
Loading…
Reference in New Issue