From c7044c641fac9a74545354b44f63a97796195fd2 Mon Sep 17 00:00:00 2001 From: mysticbbs Date: Mon, 5 Mar 2012 21:18:37 -0500 Subject: [PATCH] Theme/prompt editor complete! --- mdl/m_menuinput.pas | 4 + mdl/m_output_windows.pas | 22 +- mystic/bbs_ansi_menubox.pas | 50 +++- mystic/bbs_ansi_menuinput.pas | 201 +++++++++++-- mystic/bbs_cfg_main.pas | 13 - mystic/bbs_cfg_theme.pas | 534 ++++++++++++++++++++++++++++++++++ mystic/bbs_io.pas | 16 +- mystic/todo.pas | 1 + 8 files changed, 786 insertions(+), 55 deletions(-) diff --git a/mdl/m_menuinput.pas b/mdl/m_menuinput.pas index f1e0248..9bb6e62 100644 --- a/mdl/m_menuinput.pas +++ b/mdl/m_menuinput.pas @@ -244,7 +244,9 @@ Begin Str := Default; StrPos := Length(Str) + 1; Junk := Length(Str) - Field + 1; + If Junk < 1 Then Junk := 1; + CurPos := StrPos - Junk + 1; Console.CursorXY (X, Y); @@ -254,9 +256,11 @@ Begin Repeat Ch := Key.ReadKey; + Case Ch of #00 : Begin Ch := Key.ReadKey; + Case Ch of #77 : If StrPos < Length(Str) + 1 Then Begin If (CurPos = Field) and (StrPos < Length(Str)) Then ScrollRight; diff --git a/mdl/m_output_windows.pas b/mdl/m_output_windows.pas index db0c62b..29acfad 100644 --- a/mdl/m_output_windows.pas +++ b/mdl/m_output_windows.pas @@ -682,18 +682,20 @@ Begin //If PosY > ScreenSize Then PosY := ScreenSize; - BufSize.Y := PosY - (Y - 1); - BufSize.X := Width; - BufCoord.X := 0; - BufCoord.Y := 0; - Region.Left := X - 1; - Region.Top := Y - 1; - Region.Right := Width - 1; - Region.Bottom := PosY - 1; +// If Active Then Begin + BufSize.Y := PosY - (Y - 1); + BufSize.X := Width; + BufCoord.X := 0; + BufCoord.Y := 0; + Region.Left := X - 1; + Region.Top := Y - 1; + Region.Right := Width - 1; + Region.Bottom := PosY - 1; - WriteConsoleOutput (ConOut, @Screen[1][1], BufSize, BufCoord, Region); + WriteConsoleOutput (ConOut, @Screen[1][1], BufSize, BufCoord, Region); - CursorXY(PosX, PosY); + CursorXY(PosX, PosY); +// End; End; Function TOutputWindows.ReadCharXY (X, Y: Byte) : Char; diff --git a/mystic/bbs_ansi_menubox.pas b/mystic/bbs_ansi_menubox.pas index ec3ac0e..56f6564 100644 --- a/mystic/bbs_ansi_menubox.pas +++ b/mystic/bbs_ansi_menubox.pas @@ -94,18 +94,49 @@ Uses Procedure WriteXY (X, Y, A: Byte; S: String); Begin - Session.io.AnsiGotoXY(X, Y); - Session.io.AnsiColor(A); - Session.io.OutRaw(S); + Session.io.AnsiGotoXY (X, Y); + Session.io.AnsiColor (A); + Session.io.OutRaw (S); End; Procedure WriteXYPipe (X, Y, A, SZ: Byte; S: String); +Var + Count : Byte; + Code : String[2]; Begin - Session.io.AnsiGotoXY(X, Y); - Session.io.AnsiColor(A); - Session.io.OutPipe(S); + Session.io.AnsiGotoXY (X, Y); + Session.io.AnsiColor (A); - While Screen.CursorX < SZ Do Session.io.BufAddChar(' '); + Count := 1; + + While Count <= Length(S) Do Begin + If S[Count] = '|' Then Begin + Code := Copy(S, Count + 1, 2); + + If (Code[1] in ['0'..'2']) and (Code[2] in ['0'..'9']) Then Begin + Inc (Count, 2); + + Session.io.BufAddStr(Session.io.Pipe2Ansi(strS2I(Code))); + End Else Begin + Session.io.BufAddChar(S[Count]); + Dec (SZ); + End; + End Else Begin + Session.io.BufAddChar(S[Count]); + Dec (SZ); + End; + + If SZ = 0 Then Break; + + Inc (Count); + End; + + While SZ > 0 Do Begin + Session.io.BufAddChar(' '); + Dec(SZ); + End; + + Session.io.BufFlush; End; Function InXY (X, Y, Field, Max, Mode: Byte; Default: String) : String; @@ -189,7 +220,8 @@ Begin Until False; End; - MsgBox.Close; + If BoxType < 2 Then MsgBox.Close; + MsgBox.Free; End; @@ -556,6 +588,8 @@ Begin Inc (A); End; + + Update; End; Until False; End; diff --git a/mystic/bbs_ansi_menuinput.pas b/mystic/bbs_ansi_menuinput.pas index 5a7126c..8cc282a 100644 --- a/mystic/bbs_ansi_menuinput.pas +++ b/mystic/bbs_ansi_menuinput.pas @@ -23,11 +23,11 @@ Type Constructor Create; Destructor Destroy; Override; - Function GetStr (X, Y, Field, Len, Mode: Byte; Default: String) : String; - Function GetNum (X, Y, Field, Len: Byte; Min, Max, Default: LongInt) : LongInt; - Function GetChar (X, Y : Byte; Default: Char) : Char; + Function GetStr (X, Y, Field, Len, Mode: Byte; Default: String) : String; + Function GetNum (X, Y, Field, Len: Byte; Min, Max, Default: LongInt) : LongInt; + Function GetChar (X, Y : Byte; Default: Char) : Char; Function GetEnter (X, Y, Len: Byte; Default : String) : Boolean; - Function GetYN (X, Y : Byte; Default: Boolean) : Boolean; + Function GetYN (X, Y : Byte; Default: Boolean) : Boolean; End; Implementation @@ -161,24 +161,191 @@ Begin GetEnter := Res; End; +// 0 = numbers only 1 = as typed 2 = all caps 3 = date input Function TAnsiMenuInput.GetStr (X, Y, Field, Len, Mode : Byte; Default : String) : String; -{ mode options: } -{ 0 = numbers only } -{ 1 = as typed } -{ 2 = all caps } -{ 3 = date input } Var - Str : String; -Begin - Session.io.AnsiGotoXY(X, Y); + Ch : Char; + Str : String; + StrPos : Integer; + Junk : Integer; + CurPos : Integer; - Case Mode of - 0, - 1 : Str := Session.io.GetInput(Field, Len, 11, Default); - 2 : Str := Session.io.GetInput(Field, Len, 12, Default); - 3 : Str := Session.io.GetInput(Field, Len, 15, Default); + Procedure ReDraw; + Var + T : String; + Begin + T := Copy(Str, Junk, Field); + + WriteXY (X, Y, Attr, T); + WriteXY (X + Length(T), Y, FillAttr, strRep(FillChar, Field - Length(T))); + + Session.io.AnsiGotoXY (X + CurPos - 1, Screen.CursorY); End; + Procedure ReDrawPart; + Begin + Session.io.AnsiColor (Attr); + Session.io.BufAddStr (Copy(Str, StrPos, Field - CurPos + 1)); + Session.io.AnsiColor (FillAttr); + Session.io.BufAddStr (strRep(FillChar, (Field - CurPos + 1) - Length(Copy(Str, StrPos, Field - CurPos + 1)))); + Session.io.AnsiMoveX (X + CurPos - 1); + End; + + Procedure ScrollRight; + Begin + Inc (Junk); + + If Junk > Length(Str) Then Junk := Length(Str); + If Junk > Len then Junk := Len; + + CurPos := StrPos - Junk + 1; + + ReDraw; + End; + + Procedure ScrollLeft; + Begin + If Junk > 1 Then Begin + Dec (Junk); + + CurPos := StrPos - Junk + 1; + + ReDraw; + End; + End; + + Procedure AddChar (Ch : Char); + Begin + If Length(Str) >= Len Then Exit; + + If (CurPos >= Field) and (Field <> Len) Then ScrollRight; + + Insert (Ch, Str, StrPos); + + If StrPos < Length(Str) Then ReDrawPart; + + Inc (StrPos); + Inc (CurPos); + + Session.io.AnsiColor (Attr); + Session.io.BufAddChar (Ch); + End; + +Begin + Changed := False; + Str := Default; + StrPos := Length(Str) + 1; + Junk := Length(Str) - Field + 1; + + If Junk < 1 Then Junk := 1; + + CurPos := StrPos - Junk + 1; + + ReDraw; + + Repeat + Ch := Session.io.GetKey; + + If Session.io.IsArrow Then Begin + Case Ch of + #77 : If StrPos < Length(Str) + 1 Then Begin + If (CurPos = Field) and (StrPos < Length(Str)) Then ScrollRight; + + Inc (CurPos); + Inc (StrPos); + + Session.io.AnsiGotoXY (Screen.CursorX + 1, Screen.CursorY); + End; + #75 : If StrPos > 1 Then Begin + If CurPos = 1 Then ScrollLeft; + + Dec (StrPos); + Dec (CurPos); + + Session.io.AnsiGotoXY (Screen.CursorX - 1, Screen.CursorY); + End; + #71 : If StrPos > 1 Then Begin + StrPos := 1; + Junk := 1; + CurPos := 1; + + ReDraw; + End; + #79 : Begin + StrPos := Length(Str) + 1; + Junk := Length(Str) - Field + 1; + + If Junk < 1 Then Junk := 1; + + CurPos := StrPos - Junk + 1; + + ReDraw; + End; + #83 : If (StrPos <= Length(Str)) and (Length(Str) > 0) Then Begin + Delete (Str, StrPos, 1); + + ReDrawPart; + End; + Else + If Pos(Ch, HiChars) > 0 Then Begin + ExitCode := Ch; + + Break; + End; + End; + End Else + Case Ch of + #08 : If StrPos > 1 Then Begin + Dec (StrPos); + + Delete (Str, StrPos, 1); + + If CurPos = 1 Then + ScrollLeft + Else Begin + Session.io.AnsiMoveX(Screen.CursorX - 1); + + Dec (CurPos); + + ReDrawPart; + End; + End; + ^Y : Begin + Str := ''; + StrPos := 1; + Junk := 1; + CurPos := 1; + + ReDraw; + End; + #32.. + #254: Case Mode of + 0 : If Ch in ['0'..'9', '-'] Then AddChar(Ch); + 1 : AddChar (Ch); + 2 : AddChar (UpCase(Ch)); + 3 : If (Ch > '/') and (Ch < ':') Then + Case StrPos of + 2,5 : Begin + AddChar (Ch); + AddChar ('/'); + End; + 3,6 : Begin + AddChar ('/'); + AddChar (Ch); + End; + Else + AddChar (Ch); + End; + End; + Else + If Pos(Ch, LoChars) > 0 Then Begin + ExitCode := Ch; + + Break; + End; + End; + Until False; + Changed := (Str <> Default); Result := Str; End; diff --git a/mystic/bbs_cfg_main.pas b/mystic/bbs_cfg_main.pas index 3b21793..b3c4394 100644 --- a/mystic/bbs_cfg_main.pas +++ b/mystic/bbs_cfg_main.pas @@ -82,7 +82,6 @@ Var Box : TAnsiMenuBox; Image : TConsoleImageRec; MenuPos : Array[0..4] of Byte = (1, 1, 1, 1, 1); - ThemeOld : RecTheme; Res : Char; Procedure BoxOpen (X1, Y1, X2, Y2: Byte); @@ -284,16 +283,6 @@ Begin #77 : MenuPtr := 4; End; End Else Begin - ThemeOld := Session.Lang; - - Session.Lang.FieldColor1 := 15 + 1 * 16; - Session.Lang.FieldColor2 := 7 + 1 * 16; - Session.Lang.FieldChar := #176; - Session.Lang.EchoChar := '*'; - - // theme will need to be reloaded after the theme edito - // just in case that specific theme is changed. - Case Res of 'A' : Configuration_ArchiveEditor; 'B' : Configuration_MessageBaseEditor; @@ -311,8 +300,6 @@ Begin Else MenuPtr := 0; End; - - Session.Lang := ThemeOld; End; End; 4 : Begin diff --git a/mystic/bbs_cfg_theme.pas b/mystic/bbs_cfg_theme.pas index 3b6fbed..51ee8dc 100644 --- a/mystic/bbs_cfg_theme.pas +++ b/mystic/bbs_cfg_theme.pas @@ -9,13 +9,546 @@ Function Configuration_ThemeEditor (Select: Boolean) : String; Implementation Uses + m_Types, m_FileIO, m_Strings, bbs_Ansi_MenuBox, bbs_Ansi_MenuForm, + bbs_Ansi_MenuInput, + bbs_Core, bbs_Common, bbs_Cfg_Common; +Procedure CompileTheme (Var Theme: RecTheme); +Var + LastPer : Byte = 0; + + Procedure UpdateBar (Cur : Integer); + Var + Percent : Byte; + Begin + Percent := Round(Cur / mysMaxThemeText * 100 / 5); + + If Percent <> LastPer Then Begin + LastPer := Percent; + WriteXY (34, 12, 113, strRep(#178, Percent) + strRep(#176, 20 - Percent) + strPadL(strI2S(Percent * 5) + '%', 5, ' ')); + End; + End; + +Var + InFile : Text; + PromptFile : File of RecPrompt; + Prompt : RecPrompt; + Count : Integer; + Done : Array[0..mysMaxThemeText] of Boolean; + Temp : String; + DoneNum : Integer; +Begin + Assign (PromptFile, Config.DataPath + Theme.FileName + '.thm'); + + {$I-} ReWrite (PromptFile); {$I+} + + If IoResult <> 0 Then Begin + ShowMsgBox(0, 'Cannot compile theme while using it'); + Exit; + End; + + Assign (InFile, Config.SystemPath + Theme.FileName + '.txt'); + Reset (InFile); + + ShowMsgBox (3, 'Compiling: '); + + Prompt := ''; + DoneNum := 0; + + For Count := 0 to mysMaxThemeText Do Begin + Done[Count] := False; + Write (PromptFile, Prompt); + End; + + Reset (PromptFile); + + While Not Eof(InFile) Do Begin + ReadLn (InFile, Temp); + + If Copy(Temp, 1, 3) = '000' Then Count := 0 Else + If strS2I(Copy(Temp, 1, 3)) > 0 Then Count := strS2I(Copy(Temp, 1, 3)) Else + Count := -1; + + If Count <> -1 Then Begin + Inc (DoneNum); + + UpdateBar(DoneNum); + + If Count > mysMaxThemeText Then Begin + ShowMsgBox(0, 'String #' + strI2S(Count) + ' was not expected'); + + Close (InFile); + Close (PromptFile); + Erase (PromptFile); + Exit; + End; + + Done[Count] := True; + + Seek (PromptFile, Count); + + Prompt := Copy(Temp, 5, Length(Temp)); + + Write (PromptFile, Prompt); + End; + End; + + Close (InFile); + Close (PromptFile); + + For Count := 0 to mysMaxThemeText Do Begin + If Not Done[Count] Then Begin + ShowMsgBox (0, 'String #' + strI2S(Count) + ' was not found'); + Erase (PromptFile); + Break; + End; + End; +End; + +Procedure EditPrompts (Var Theme: RecTheme); +Const + MaxText = 3000; + LinesPerPage = 16; + WinStartX = 3; + WinStartY = 1; +Var + Box : TAnsiMenuBox; + Input : TAnsiMenuInput; + InFile : Text; + TotalText : Word; + StrData : Array[1..MaxText] of ^String; + Comment : Array[1..LinesPerPage] of Array[1..3] of String[75]; + PageData : Array[1..LinesPerPage] of Integer; + PageStart : Array[1..100] of Integer; + PageTotal : Integer; + CurPage : Byte = 1; + CurLine : Byte = 1; + CurPageLines : Byte; + TotalPrompt : Integer; + SearchMask : String; + CopyStr : String = ''; + + Procedure DisposeStringData; + Var + Count : Word; + Begin + For Count := TotalText DownTo 1 Do + Dispose (StrData[Count]); + End; + + Function LoadStringData : Boolean; + Var + Str : String; + Buffer : Array[1..4096] of Byte; + Begin + Result := False; + + Assign (InFile, Config.SystemPath + Theme.FileName + '.txt'); + SetTextBuf (InFile, Buffer, SizeOf(Buffer)); + + {$I-} Reset (InFile); {$I+} + + If IoResult <> 0 Then Begin + ShowMsgBox (0, 'Unable to open ' + Config.SystemPath + Theme.FileName + '.txt'); + Exit; + End; + + ShowMsgBox (2, 'Loading ' + Theme.FileName + '.txt'); + + TotalText := 0; + + While Not Eof(InFile) Do Begin + If TotalText = MaxText Then Begin + Close (InFile); + + ShowMsgBox (0, 'File too large'); + + DisposeStringData; + Exit; + End; + + ReadLn (InFile, Str); + Inc (TotalText); + + New (StrData[TotalText]); + + StrData[TotalText]^ := Str; + End; + + Close (InFile); + + Result := True; + End; + + Procedure GetTotalPages; + Var + Str : String; + Count : Integer; + Lines : Integer; + Last : Integer; + Begin + PageTotal := 0; + Lines := 0; + Last := 1; + Count := 0; + TotalPrompt := -1; + + While Count < TotalText Do Begin + Inc (Count); + + Str := StrData[Count]^; + + If (Str <> '') and (Str[1] <> ';') and (Str[1] <> '#') Then Begin + Inc (TotalPrompt); + Inc (Lines); + + If Lines = 1 Then Begin + Inc (PageTotal); + + PageStart[PageTotal] := Last; + End; + End; + + If Lines = LinesPerPage Then Begin + Lines := 0; + Last := Count + 1; + End; + End; + End; + + Procedure DrawPage (Silent: Boolean); + Var + Str : String; + A : Byte; + Count : Integer; + Begin + For A := 1 to LinesPerPage Do Begin + Comment[A][1] := ''; + Comment[A][2] := ''; + Comment[A][3] := ''; + End; + + CurPageLines := 0; + Count := PageStart[CurPage]; + + While (CurPageLines < LinesPerPage) and (Count <= TotalText) Do Begin + Str := StrData[Count]^; + + Inc (Count); + + If Str[1] = ';' Then Begin + Delete (Str, 1, 2); + + Comment[CurPageLines + 1][1] := Comment[CurPageLines + 1][2]; + Comment[CurPageLines + 1][2] := Comment[CurPageLines + 1][3]; + Comment[CurPageLines + 1][3] := Str; + End Else + If (Str <> '') and (Str[1] <> '#') Then Begin + Inc(CurPageLines); + + PageData[CurPageLines] := Count - 1; + + If Not Silent Then + WriteXYPipe (WinStartX, WinStartY + CurPageLines, 7, 75, Copy(Str, 5, 255)); + End; + End; + + If Not Silent Then + If CurPageLines < LinesPerPage Then + For A := CurPageLines + 1 to LinesPerPage Do + WriteXY (WinStartX, A + WinStartY, 7, strRep(' ', 75)); + End; + + Procedure DrawComments; + Begin + WriteXY (3, 19, 15, strPadR(Comment[CurLine][1], 75, ' ')); + WriteXY (3, 20, 15, strPadR(Comment[CurLine][2], 75, ' ')); + WriteXY (3, 21, 15, strPadR(Comment[CurLine][3], 75, ' ')); + End; + + Procedure JumpToPrompt (Cur : Word); + Var + Box : TAnsiMenuBox; + Input : TAnsiMenuInput; + Num : Word; + Count : Word; + PageEnd : Word; + LineNum : Word; + B : Word; + Begin + Box := TAnsiMenuBox.Create; + Input := TAnsiMenuInput.Create; + + Box.Open (27, 8, 53, 12); + + WriteXY (30, 10, 112, 'Jump to prompt #:'); + + Num := Input.GetNum(48, 10, 4, 4, 0, mysMaxThemeText, Cur); + + Box.Close; + Input.Free; + Box.Free; + + If Num <> Cur Then + For Count := 1 to PageTotal Do Begin + If Count = PageTotal Then + PageEnd := TotalText + Else + PageEnd := PageStart[Count + 1] - 1; + + LineNum := 0; + + For B := PageStart[Count] to PageEnd Do Begin + If (StrData[B]^[1] <> ';') and (StrData[B]^[1] <> '#') Then Begin + Inc (LineNum); + + If strS2I(Copy(StrData[B]^, 1, 3)) = Num Then Begin + If Not ((Count = CurPage) and (CurLine = LineNum)) Then Begin + CurPage := Count; + CurLine := LineNum; + + DrawPage(False); + + Exit; + End; + End; + End; + End; + End; + + DrawPage(False); + End; + + Procedure Search (Again : Boolean); + Var + Temp : String; + Start : Byte; + A : Byte; + B : Integer; + PageEnd : Integer; + LineNum : Integer; + Box : TAnsiMenuBox; + Input : TAnsiMenuInput; + Begin + If (Not Again) or ((Again) and (SearchMask = '')) Then Begin + Box := TAnsiMenuBox.Create; + Input := TAnsiMenuInput.Create; + + Box.Header := ' Search '; + + Box.Open(14, 8, 67, 10); + + SearchMask := Input.GetStr(16, 9, 50, 50, 1, SearchMask); + + Input.Free; + Box.Free; + + If SearchMask = '' Then Begin + DrawPage(False); + Exit; + End; + + Start := 1; + Again := False; + End Else + Start := CurPage; + + For A := Start to PageTotal Do Begin + + If A = PageTotal Then + PageEnd := TotalText + Else + PageEnd := PageStart[A+1]-1; + + LineNum := 0; + + For B := PageStart[A] to PageEnd Do Begin + Temp := StrData[B]^; + + If (Temp[1] <> ';') and (Temp[1] <> '#') Then Begin + Inc (LineNum); + + If Again and (A = CurPage) Then + If (LineNum <= CurLine) and (LineNum < LinesPerPage) Then Continue; + + If Pos(strUpper(SearchMask), strUpper(strStripPipe(StrData[B]^))) > 0 Then Begin + If Not ((A = CurPage) and (CurLine = LineNum)) Then Begin + CurPage := A; + CurLine := LineNum; + + DrawPage(False); + + Exit; + End; + End; + End; + End; + End; + + ShowMsgBox(0, 'No maching text was found'); + + DrawPage(False); + End; + +Var + EditStr : String; + UndoStr : String; + CurStr : String[3]; + Changed : Boolean = False; + Saved : Boolean = False; + Count : Integer; + Image : TConsoleImageRec; +Begin + Screen.GetScreenImage(1, 1, 79, 24, Image); + + If Not LoadStringData Then Exit; + + GetTotalPages; + + Session.io.AnsiColor(7); + Session.io.AnsiClear; + + Box := TAnsiMenuBox.Create; + Input := TAnsiMenuInput.Create; + + Box.FrameType := 1; + Box.BoxAttr := 8; + Box.Box3D := False; + Box.Shadow := False; + + Input.HiChars := #72#73#80#81; + Input.LoChars := #01#02#06#07#11#16#20#21#27; + + Box.Open (1, 1, 79, 22); + + WriteXY (2, 18, 8, strRep('Ä', 77)); + WriteXY (3, 1, 8, ' / '); + WriteXY (8, 1, 7, strI2S(TotalPrompt)); + WriteXY (73 - Length(Theme.FileName), 1, 7, ' ' + Theme.FileName + '.txt '); + + WriteXYPipe (1, 23, 112, 79, ' Prompts ³ |01Press |15CTRL |01+ |15T|01op |15B|01ottom |15F|01ind |15A|01gain |15G|01oto |15K|01ut |15P|01aste |15U|01ndo |00³ ESC/Quit '); + + DrawPage(False); + + Repeat + DrawComments; + + CurStr := Copy(StrData[PageData[CurLine]]^, 1, 3); + EditStr := Copy(StrData[PageData[CurLine]]^, 5, 255); + UndoStr := EditStr; + + WriteXY (4, 1, 7, CurStr); + + EditStr := Input.GetStr(WinStartX, WinStartY + CurLine, 75, 254, 1, EditStr); + + Case Input.ExitCode of + #16 : If CopyStr <> '' Then Begin + EditStr := CopyStr; + Input.Changed := True; + End; + #21 : Begin + EditStr := UndoStr; + Input.Changed := False; + End; + End; + + WriteXYPipe (WinStartX, WinStartY + CurLine, 7, 75, EditStr); + + StrData[PageData[CurLine]]^ := CurStr + ' ' + EditStr; + + If Input.Changed Then Changed := True; + + Case Input.ExitCode of + #01 : Search(True); + #02 : Begin + CurPage := PageTotal; + + DrawPage(False); + + CurLine := CurPageLines; + End; + + #06 : Search(False); + #07 : JumpToPrompt(strS2I(CurStr)); + #11 : CopyStr := EditStr; + #20 : Begin + CurPage := 1; + CurLine := 1; + + DrawPage(False); + End; + #27 : Break; + #72 : If CurLine > 1 Then + Dec(CurLine) + Else Begin + If CurPage > 1 Then Begin + Dec (CurPage); + + DrawPage(False); + + CurLine := CurPageLines; + End; + End; + #73 : If CurPage > 1 Then Begin + Dec (CurPage); + + DrawPage(False); + End Else + CurLine := 1; + #80 : If CurLine < CurPageLines Then + Inc(CurLine) + Else Begin + If CurPage < PageTotal Then Begin + Inc (CurPage); + + DrawPage(False); + + CurLine := 1; + End; + End; + #81 : If CurPage < PageTotal Then Begin + Inc (CurPage); + + DrawPage(False); + + CurLine := 1; + End Else + CurLine := CurPageLines; + End; + Until False; + + If Changed Then + If ShowMsgBox(1, 'Save changes?') Then Begin + Saved := True; + + Assign (InFile, Config.SystemPath + Theme.FileName + '.txt'); + ReWrite (InFile); + + For Count := 1 to TotalText Do Begin + EditStr := StrData[Count]^; + WriteLn (InFile, EditStr); + End; + + Close (InFile); + End; + + DisposeStringData; + + If Saved Then + CompileTheme(Theme); + + Box.Free; + Input.Free; + + Session.io.RemoteRestore(Image); +End; + Procedure EditBars (Var Theme: RecTheme); Var Box : TAnsiMenuBox; @@ -136,6 +669,7 @@ Begin Repeat Case Form.Execute of + '1' : EditPrompts(Theme); '2' : EditOptions(Theme); '3' : Begin Box.Hide; diff --git a/mystic/bbs_io.pas b/mystic/bbs_io.pas index 82ed66b..c71c7c0 100644 --- a/mystic/bbs_io.pas +++ b/mystic/bbs_io.pas @@ -1094,7 +1094,7 @@ End; {$IFDEF UNIX} Function TBBSIO.InKey : Char; Begin - Result := #1; + Result := #255; IsArrow := False; If Input.KeyWait(1000) Then Begin @@ -1109,7 +1109,7 @@ Begin Exit; End; - Result := #1; + Result := #255; End; End; End; @@ -1121,7 +1121,7 @@ Var Handles : Array[0..1] of THandle; InType : Byte; Begin - Result := #1; + Result := #255; Handles[0] := Input.ConIn; @@ -1162,10 +1162,10 @@ Begin ProcessSysopCommand(Result); - Result := #1; + Result := #255; End; - If Not Screen.Active Then Result := #1; + If Not Screen.Active Then Result := #255; End; 2 : Begin // SOCKET read event If TBBSCore(Core).Client.ReadBuf(Result, 1) < 0 Then Begin @@ -1179,12 +1179,14 @@ Begin IsArrow := True; Case Result of +(* #03 : Result := #81; { pgdn } #04 : Result := #77; { right } #05 : Result := #72; { up } #18 : Result := #73; { pgup } #19 : Result := #75; { left } #24 : Result := #80; { down } +*) #27 : Begin If Not TBBSCore(Core).Client.DataWaiting Then WaitMS(25); If Not TBBSCore(Core).Client.DataWaiting Then WaitMS(25); @@ -1218,7 +1220,7 @@ Var TimeCount : LongInt; LastSec : LongInt; Begin - Result := #1; + Result := #255; TBBSCore(Core).TimeOut := TimerSeconds; @@ -1286,7 +1288,7 @@ Begin End; Result := InKey; - Until Result <> #1; + Until Result <> #255; End; Function TBBSIO.GetYNL (Str: String; Yes: Boolean) : Boolean; diff --git a/mystic/todo.pas b/mystic/todo.pas index d715ba5..fcf53be 100644 --- a/mystic/todo.pas +++ b/mystic/todo.pas @@ -20,6 +20,7 @@ BUGS AND POSSIBLE ISSUES FPC BUG? DirAttr is suspect in MPL is it 1 byte or 4 in size? ! MDL screensave/restore in local console is broken in Windows(?) only? ! View archive not working if its external view? [Griffin] +! Editing current theme will prob not save right [g00r00] FUTURE / IDEAS / WORK IN PROGRESS / NOTES =========================================