wth is going on?!?

This commit is contained in:
mysticbbs 2013-08-31 00:38:55 -04:00
parent 46777d7727
commit 91545dce6e
1 changed files with 109 additions and 53 deletions

View File

@ -11,6 +11,20 @@ Uses
Const Const
fseMaxCutText = 60; fseMaxCutText = 60;
GlyphTypeMax = 10;
GlyphTypeStr : Array[1..10] of String[10] = (
('纶坷倌趁戳'),
('松蝗纪禾故'),
('颜冈就称迪'),
('抑酚侥呵缎'),
('锱呜阻闆湙'),
('<27>辈圻茌撖'),
('<06> '),
(''),
('<27><><EFBFBD>霁'),
('<27>耵蹶濅<E8B9B6>')
);
Type Type
TEditorANSI = Class TEditorANSI = Class
Owner : Pointer; Owner : Pointer;
@ -31,6 +45,7 @@ Type
InsertMode : Boolean; InsertMode : Boolean;
DrawMode : Boolean; DrawMode : Boolean;
GlyphMode : Boolean; GlyphMode : Boolean;
GlyphPtr : Byte;
WrapMode : Boolean; WrapMode : Boolean;
ClearEOL : Boolean; ClearEOL : Boolean;
LastLine : LongInt; LastLine : LongInt;
@ -44,6 +59,8 @@ Type
Done : Boolean; Done : Boolean;
Subject : String; Subject : String;
Template : String; Template : String;
DrawTemplate : String;
SavedInsert : Boolean;
MaxMsgLines : Word; MaxMsgLines : Word;
MaxMsgCols : Byte; MaxMsgCols : Byte;
@ -81,7 +98,8 @@ Type
Function Edit : Boolean; Function Edit : Boolean;
Procedure Quote; Procedure Quote;
Procedure QuoteWindow; Procedure QuoteWindow;
Procedure Commands; Procedure EditorCommands;
Procedure DrawCommands;
Procedure MessageUpload; Procedure MessageUpload;
End; End;
@ -114,6 +132,7 @@ Begin
InsertMode := True; InsertMode := True;
DrawMode := False; DrawMode := False;
GlyphMode := False; GlyphMode := False;
GlyphPtr := 6;
WrapMode := True; WrapMode := True;
ClearEOL := RowSize >= 79; ClearEOL := RowSize >= 79;
LastLine := 1; LastLine := 1;
@ -387,7 +406,7 @@ Begin
Session.io.AnsiColor (Session.io.ScreenInfo[3].A); Session.io.AnsiColor (Session.io.ScreenInfo[3].A);
Session.io.AnsiGotoXY (Session.io.ScreenInfo[3].X, Session.io.ScreenInfo[3].Y); Session.io.AnsiGotoXY (Session.io.ScreenInfo[3].X, Session.io.ScreenInfo[3].Y);
If InsertMode Then Session.io.BufAddStr('INS') else Session.io.BufAddStr('OVR'); { ++lang++ } If InsertMode Then Session.io.BufAddStr('INS') Else Session.io.BufAddStr('OVR'); { ++lang++ }
End; End;
Procedure TEditorANSI.ReDrawTemplate (Reset: Boolean); Procedure TEditorANSI.ReDrawTemplate (Reset: Boolean);
@ -398,10 +417,24 @@ Begin
TBBSCore(Owner).io.AllowArrow := True; TBBSCore(Owner).io.AllowArrow := True;
Session.io.PromptInfo[2] := Subject; If DrawMode Then Begin
// temp until we show file
Session.io.ScreenInfo[1].Y := 3;
Session.io.ScreenInfo[2].Y := 24;
Session.io.AnsiColor(7);
Session.io.AnsiClear;
WriteXY (1, 1, 7, 'Draw Mode ESC/Menu - Insert: ' + Session.io.OutON(InsertMode) + ' GlyphMode: ' + Session.io.OutON(GlyphMode) + ' Set: ');
WriteXY (53, 1, CurAttr, GlyphTypeStr[GlyphPtr]);
WriteXY (1, 2, 8, strRep('-', 79));
End Else Begin
Session.io.PromptInfo[2] := Subject;
Session.io.OutFile (Template, True, 0); Session.io.OutFile (Template, True, 0);
ToggleInsert (False);
End;
WinX1 := 1; WinX1 := 1;
WinX2 := MaxMsgCols; //79 WinX2 := MaxMsgCols; //79
// WinX1 := Session.io.ScreenInfo[1].X; // WinX1 := Session.io.ScreenInfo[1].X;
@ -431,8 +464,6 @@ Begin
End; End;
DrawPage (1, WinSize, False); DrawPage (1, WinSize, False);
ToggleInsert (False);
End; End;
Procedure TEditorANSI.LocateCursor; Procedure TEditorANSI.LocateCursor;
@ -446,17 +477,6 @@ Begin
While TopLine + CurY - 1 > LastLine Do While TopLine + CurY - 1 > LastLine Do
Dec (CurY); Dec (CurY);
(*
If Not DrawMode Then Begin
If (CurX > 1) and (CurX = CurLength + 1) Then
CurAttr := ANSI.Data[CurLine][CurX - 1].Attr
Else
CurAttr := ANSI.Data[CurLine][CurX].Attr;
If CurAttr = 0 Then CurAttr := 7;
End;
*)
// With TBBSCore(Owner).io Do Begin // With TBBSCore(Owner).io Do Begin
// AnsiGotoXY (1, 1); // AnsiGotoXY (1, 1);
// BufAddStr ('X:' + strI2S(CurX) + ' Y:' + strI2S(CurY) + ' CL:' + strI2S(CurLine) + ' TopL:' + strI2S(TopLine) + ' Last:' + strI2S(LastLine) + ' Len:' + strI2S(GetLineLength(ANSI.Data[CurLine], 80)) + ' Row:' + strI2S(RowSize) + ' '); // BufAddStr ('X:' + strI2S(CurX) + ' Y:' + strI2S(CurY) + ' CL:' + strI2S(CurLine) + ' TopL:' + strI2S(TopLine) + ' Last:' + strI2S(LastLine) + ' Len:' + strI2S(GetLineLength(ANSI.Data[CurLine], 80)) + ' Row:' + strI2S(RowSize) + ' ');
@ -688,6 +708,12 @@ Procedure TEditorANSI.DoChar (Ch: Char);
Var Var
CharAttr : Byte; CharAttr : Byte;
Begin Begin
CharAttr := CurAttr;
If DrawMode Then Begin
If (Ch in ['0'..'9']) And GlyphMode Then
Ch := GlyphTypeStr[GlyphPtr][strS2I(Ch) + 1]
End Else
If (Session.io.ScreenInfo[6].A <> 0) and (Pos(Ch, '0123456789') > 0) Then If (Session.io.ScreenInfo[6].A <> 0) and (Pos(Ch, '0123456789') > 0) Then
CharAttr := Session.io.ScreenInfo[6].A CharAttr := Session.io.ScreenInfo[6].A
Else Else
@ -695,9 +721,7 @@ Begin
CharAttr := Session.io.ScreenInfo[5].A CharAttr := Session.io.ScreenInfo[5].A
Else Else
If (Session.io.ScreenInfo[4].A <> 0) and (Ch = UpCase(Ch)) Then If (Session.io.ScreenInfo[4].A <> 0) and (Ch = UpCase(Ch)) Then
CharAttr := Session.io.ScreenInfo[4].A CharAttr := Session.io.ScreenInfo[4].A;
Else
CharAttr := CurAttr;
If InsertMode Then Begin If InsertMode Then Begin
Move (ANSI.Data[CurLine][CurX], ANSI.Data[CurLine][CurX + 1], SizeOf(RecAnsiBufferChar) * (CurLength - CurX + 1)); Move (ANSI.Data[CurLine][CurX], ANSI.Data[CurLine][CurX + 1], SizeOf(RecAnsiBufferChar) * (CurLength - CurX + 1));
@ -813,8 +837,13 @@ Begin
If Not LineDown(True) Then If Not LineDown(True) Then
DrawPage (CurY - 1, WinSize, True); DrawPage (CurY - 1, WinSize, True);
End; End;
End Else End Else Begin
LineDown(True); If CurLine = LastLine Then
InsertLine (CurLine + 1);
If Not LineDown(True) Then
DrawPage (CurY - 1, WinSize, True);
End;
End; End;
Procedure TEditorANSI.Quote; Procedure TEditorANSI.Quote;
@ -1142,7 +1171,7 @@ Begin
End; End;
End; End;
Procedure TEditorANSI.Commands; Procedure TEditorANSI.EditorCommands;
Var Var
Ch : Char; Ch : Char;
Str : String; Str : String;
@ -1153,7 +1182,11 @@ Begin
Repeat Repeat
Session.io.OutFull (Session.GetPrompt(354)); Session.io.OutFull (Session.GetPrompt(354));
{$IFDEF TESTEDITOR}
Ch := Session.io.OneKey ('?ACDHQRSTU', True);
{$ELSE}
Ch := Session.io.OneKey ('?ACHQRSTU', True); Ch := Session.io.OneKey ('?ACHQRSTU', True);
{$ENDIF}
Case Ch of Case Ch of
'?' : Session.io.OutFullLn (Session.GetPrompt(355)); '?' : Session.io.OutFullLn (Session.GetPrompt(355));
@ -1162,9 +1195,17 @@ Begin
Exit; Exit;
End Else Begin End Else Begin
Done := Session.io.GetYN(Session.GetPrompt(356), False); Done := Session.io.GetYN(Session.GetPrompt(356), False);
Exit; Exit;
End; End;
'C' : Exit; 'C' : Exit;
'D' : Begin
DrawMode := True;
SavedInsert := InsertMode;
InsertMode := False;
Exit;
End;
'H' : Begin 'H' : Begin
Session.io.OutFile ('fshelp', True, 0); Session.io.OutFile ('fshelp', True, 0);
Exit; Exit;
@ -1196,6 +1237,32 @@ Begin
Until Done; Until Done;
End; End;
Procedure TEditorANSI.DrawCommands;
Var
Ch : Char;
Begin
Repeat
Session.io.OutFull ('|CR|09Draw Commands (?/Help): ');
Ch := Session.io.OneKey ('?GQ', True);
Case Ch of
'?' : Session.io.OutFullLn ('|CR(Q)uit Draw Mode (G)lyph Mode');
'G' : Begin
GlyphMode := Not GlyphMode;
Exit;
End;
'Q' : Begin
DrawMode := False;
InsertMode := SavedInsert;
Exit;
End;
End;
Until False;
End;
Procedure TEditorANSI.MessageUpload; Procedure TEditorANSI.MessageUpload;
Var Var
FN : String[100]; FN : String[100];
@ -1334,21 +1401,11 @@ Begin
End; End;
End Else End Else
Case Ch of Case Ch of
(*
^A : Begin
If Forced Then
Session.io.OutFull (Session.GetPrompt(307))
Else
Done := Session.io.GetYN(Session.GetPrompt(356), False);
If Not Done Then ReDrawTemplate(False);
End;
*)
^B : ReformParagraph; ^B : ReformParagraph;
^F : CurX := 1; ^F : CurX := 1;
^G : CurX := CurLength + 1; ^G : CurX := CurLength + 1;
^H : DoBackSpace; ^H : DoBackSpace;
^I : Begin ^I : If CurLength < RowSize Then Begin
If (CurX < RowSize) and (CurX MOD 5 = 0) Then If (CurX < RowSize) and (CurX MOD 5 = 0) Then
DoChar(' '); DoChar(' ');
@ -1379,7 +1436,7 @@ Begin
Session.io.OutFile('fshelp', True, 0); Session.io.OutFile('fshelp', True, 0);
ReDrawTemplate(False); ReDrawTemplate(False);
End; End;
^Q : Begin ^Q : If Not DrawMode Then Begin
If Session.User.ThisUser.UseLBQuote Then If Session.User.ThisUser.UseLBQuote Then
QuoteWindow QuoteWindow
Else Else
@ -1410,22 +1467,21 @@ Begin
End; End;
^Z, ^Z,
^[ : Begin ^[ : Begin
Commands; If DrawMode Then
DrawCommands
Else
EditorCommands;
If (Not Save) and (Not Done) Then ReDrawTemplate(False); If (Not Save) and (Not Done) Then ReDrawTemplate(False);
Session.io.AllowArrow := True;
End; End;
#32.. #32..
#254 : If (CurLength >= RowSize) and (GetWrapPos(ANSI.Data[CurLine], RowSize, RowSize) = 0) Then Begin #254 : If (CurLength >= RowSize) and (GetWrapPos(ANSI.Data[CurLine], RowSize, RowSize) = 0) And InsertMode Then Begin
// dont do anything // dont do anything
End Else End Else
If (CurX = 1) and (Ch = '/') Then Begin If (CurX = 1) and (Ch = '/') and (Not DrawMode) Then Begin
Commands; EditorCommands;
If (Not Save) and (Not Done) Then ReDrawTemplate(False); If (Not Save) and (Not Done) Then ReDrawTemplate(False);
Session.io.AllowArrow := True;
End Else End Else
DoChar(Ch); DoChar(Ch);
End; End;