New Theme editor (missing prompts)

This commit is contained in:
mysticbbs 2012-03-05 03:41:15 -05:00
parent 6df7b6bb4e
commit 832eba47e4
4 changed files with 68 additions and 21 deletions

View File

@ -868,7 +868,6 @@ Procedure ConvertThemes;
Result.HiAttr := P.HiAttr; Result.HiAttr := P.HiAttr;
Result.Format := 0; Result.Format := 0;
Result.StartY := 1; Result.StartY := 1;
Result.EndY := 20;
Result.StartX := 79; Result.StartX := 79;
End; End;
@ -901,7 +900,6 @@ Begin
TempBar.HiAttr := 25; TempBar.HiAttr := 25;
TempBar.Format := 0; TempBar.Format := 0;
TempBar.StartY := 1; TempBar.StartY := 1;
TempBar.EndY := 20;
TempBar.StartX := 79; TempBar.StartX := 79;
Theme.FileName := OldLang.FileName; Theme.FileName := OldLang.FileName;

View File

@ -6,7 +6,8 @@ Interface
Uses Uses
m_Types, m_Types,
bbs_ansi_MenuInput; bbs_Ansi_MenuInput,
bbs_Common;
Const Const
FormMaxItems = 50; FormMaxItems = 50;
@ -31,7 +32,8 @@ Type
ItemPass, ItemPass,
ItemPipe, ItemPipe,
ItemCaps, ItemCaps,
ItemBits ItemBits,
ItemBar
); );
FormItemPTR = ^FormItemRec; FormItemPTR = ^FormItemRec;
@ -56,6 +58,7 @@ Type
L : ^LongInt; L : ^LongInt;
C : ^Char; C : ^Char;
F : ^TMenuFormFlagsRec; F : ^TMenuFormFlagsRec;
R : ^RecPercent;
Toggle : String[68]; Toggle : String[68];
End; End;
@ -65,6 +68,7 @@ Type
TAnsiMenuForm = Class TAnsiMenuForm = Class
Private Private
Procedure EditPercentBar (Var Bar: RecPercent);
Function GetColorAttr (C: Byte) : Byte; Function GetColorAttr (C: Byte) : Byte;
Function DrawAccessFlags (Var Flags: TMenuFormFlagsRec) : String; Function DrawAccessFlags (Var Flags: TMenuFormFlagsRec) : String;
Procedure EditAccessFlags (Var Flags: TMenuFormFlagsRec); Procedure EditAccessFlags (Var Flags: TMenuFormFlagsRec);
@ -121,6 +125,7 @@ Type
Procedure AddDate (HK: Char; D: String; X, Y, FX, FY, DS: Byte; P: Pointer; H: String); Procedure AddDate (HK: Char; D: String; X, Y, FX, FY, DS: Byte; P: Pointer; H: String);
Procedure AddCaps (HK: Char; D: String; X, Y, FX, FY, DS, FS, MX: Byte; P: Pointer; H: String); Procedure AddCaps (HK: Char; D: String; X, Y, FX, FY, DS, FS, MX: Byte; P: Pointer; H: String);
Procedure AddBits (HK: Char; D: String; X, Y, FX, FY, DS: Byte; Flag: LongInt; P: Pointer; H: String); Procedure AddBits (HK: Char; D: String; X, Y, FX, FY, DS: Byte; Flag: LongInt; P: Pointer; H: String);
Procedure AddBar (HK: Char; D: String; X, Y, FX, FY, DS: Byte; P: Pointer; H: String);
Function Execute : Char; Function Execute : Char;
End; End;
@ -181,6 +186,40 @@ Begin
Changed := False; Changed := False;
End; End;
Procedure TAnsiMenuForm.EditPercentBar (Var Bar: RecPercent);
Var
Box : TAnsiMenuBox;
Form : TAnsiMenuForm;
Begin
Box := TAnsiMenuBox.Create;
Form := TAnsiMenuForm.Create;
Box.Open (7, 5, 73, 12);
VerticalLine (23, 7, 10);
VerticalLine (61, 7, 10);
Form.AddTog ('F', ' Bar Format' , 11, 7, 25, 7, 12, 10, 0, 1, 'Horizontal Vertical', @Bar.Format, '');
Form.AddChar ('B', ' BG Character', 9, 8, 25, 8, 14, 32, 255, @Bar.LoChar, '');
Form.AddAttr ('G', ' BG Color', 13, 9, 25, 9, 10, @Bar.LoAttr, '');
Form.AddByte ('X', ' Start X', 14, 10, 25, 10, 9, 2, 1, 50, @Bar.StartX, '');
Form.AddByte ('A', ' Bar Length', 49, 7, 63, 7, 12, 2, 1, 50, @Bar.BarLength, '');
Form.AddChar ('C', ' FG Character', 47, 8, 63, 8, 14, 32, 255, @Bar.Hichar, '');
Form.AddAttr ('O', ' FG Color', 51, 9, 63, 9, 10, @Bar.HiAttr, '');
Form.AddByte ('Y', ' Start Y', 52, 10, 63, 10, 9, 2, 1, 50, @Bar.StartY, '');
Repeat
Case Form.Execute of
#27 : Break;
End;
Until False;
Box.Close;
Form.Free;
Box.Free;
End;
Function TAnsiMenuForm.DrawAccessFlags (Var Flags: TMenuFormFlagsRec) : String; Function TAnsiMenuForm.DrawAccessFlags (Var Flags: TMenuFormFlagsRec) : String;
Var Var
Str : String; Str : String;
@ -322,6 +361,7 @@ Begin
ItemLong : L := P; ItemLong : L := P;
ItemChar : C := P; ItemChar : C := P;
ItemFlags : F := P; ItemFlags : F := P;
ItemBar : R := P;
End; End;
End; End;
End; End;
@ -455,6 +495,13 @@ Begin
AddBasic (HK, D, X, Y, FX, FY, DS, 8, 8, ItemDate, P, H); AddBasic (HK, D, X, Y, FX, FY, DS, 8, 8, ItemDate, P, H);
End; End;
Procedure TAnsiMenuForm.AddBar (HK: Char; D: String; X, Y, FX, FY, DS: Byte; P: Pointer; H: String);
Begin
If Items = FormMaxItems Then Exit;
AddBasic (HK, D, X, Y, FX, FY, DS, 8, 8, ItemBar, P, H);
End;
Procedure TAnsiMenuForm.BarON; Procedure TAnsiMenuForm.BarON;
Var Var
A : Byte; A : Byte;
@ -477,27 +524,22 @@ End;
Procedure TAnsiMenuForm.BarOFF (RecPos: Word); Procedure TAnsiMenuForm.BarOFF (RecPos: Word);
Var Var
A : Byte; Count : Byte;
Begin Begin
If RecPos = 0 Then Exit; If RecPos = 0 Then Exit;
With ItemData[RecPos]^ Do Begin With ItemData[RecPos]^ Do Begin
WriteXY (DescX, DescY, cLo, strPadR(Desc, DescSize, ' ')); WriteXY (DescX, DescY, cLo, strPadR(Desc, DescSize, ' '));
A := Pos(HotKey, strUpper(Desc)); Count := Pos(HotKey, strUpper(Desc));
If A > 0 Then If Count > 0 Then
WriteXY (DescX + A - 1, DescY, cLoKey, Desc[A]); WriteXY (DescX + Count - 1, DescY, cLoKey, Desc[Count]);
End; End;
End; End;
Procedure TAnsiMenuForm.FieldWrite (RecPos : Word); Procedure TAnsiMenuForm.FieldWrite (RecPos : Word);
Begin Begin
// This could be changed to case itemtype and save display into string
// variable. Then we would only require a single Screen.WriteXY function.
// It would be a tiny bit slower (obviously, not really noticable) but
// would reduce code size.
With ItemData[RecPos]^ Do Begin With ItemData[RecPos]^ Do Begin
Case ItemType of Case ItemType of
ItemPass : WriteXY (FieldX, FieldY, cData, strPadR(strRep('*', Length(S^)), FieldSize, ' ')); ItemPass : WriteXY (FieldX, FieldY, cData, strPadR(strRep('*', Length(S^)), FieldSize, ' '));
@ -515,6 +557,10 @@ Begin
ItemFlags : WriteXY (FieldX, FieldY, cData, DrawAccessFlags(F^)); ItemFlags : WriteXY (FieldX, FieldY, cData, DrawAccessFlags(F^));
ItemPipe : WriteXYPipe (FieldX, FieldY, 7, FieldSize, S^); ItemPipe : WriteXYPipe (FieldX, FieldY, 7, FieldSize, S^);
ItemBits : WriteXY (FieldX, FieldY, cData, strPadR(YesNoStr[L^ AND MaxNum <> 0], FieldSize, ' ')); ItemBits : WriteXY (FieldX, FieldY, cData, strPadR(YesNoStr[L^ AND MaxNum <> 0], FieldSize, ' '));
ItemBar : Begin
WriteXY (FieldX, FieldY, R^.HiAttr, strRep(R^.HiChar, 3));
WriteXY (FieldX + 3, FieldY, R^.LoAttr, strRep(R^.LoChar, 3));
End;
End; End;
End; End;
End; End;
@ -561,6 +607,7 @@ Begin
TempLong := TempLong XOR MaxNum; TempLong := TempLong XOR MaxNum;
L^ := TempLong; L^ := TempLong;
End; End;
ItemBar : EditPercentBar(R^);
End; End;
FieldWrite (ItemPos); FieldWrite (ItemPos);

View File

@ -24,11 +24,11 @@ Uses
bbs_cfg_MsgBase, bbs_cfg_MsgBase,
bbs_cfg_Groups, bbs_cfg_Groups,
bbs_cfg_SecLevel, bbs_cfg_SecLevel,
bbs_cfg_Theme,
//old editors to be rewritten //old editors to be rewritten
bbs_cfg_useredit, bbs_cfg_useredit,
bbs_cfg_events, bbs_cfg_events,
bbs_cfg_language,
bbs_cfg_vote, bbs_cfg_vote,
bbs_cfg_menuedit; bbs_cfg_menuedit;
@ -124,7 +124,6 @@ Var
Case Mode of Case Mode of
'U' : User_Editor(False, False); 'U' : User_Editor(False, False);
'M' : Menu_Editor; 'M' : Menu_Editor;
'T' : Lang_Editor;
'E' : Event_Editor; 'E' : Event_Editor;
'V' : Vote_Editor; 'V' : Vote_Editor;
End; End;
@ -288,10 +287,13 @@ Begin
ThemeOld := Session.Lang; ThemeOld := Session.Lang;
Session.Lang.FieldColor1 := 15 + 1 * 16; Session.Lang.FieldColor1 := 15 + 1 * 16;
Session.Lang.FieldColor2 := 9 + 1 * 16; Session.Lang.FieldColor2 := 7 + 1 * 16;
Session.Lang.FieldChar := 'm'; Session.Lang.FieldChar := #176;
Session.Lang.EchoChar := '*'; Session.Lang.EchoChar := '*';
// theme will need to be reloaded after the theme edito
// just in case that specific theme is changed.
Case Res of Case Res of
'A' : Configuration_ArchiveEditor; 'A' : Configuration_ArchiveEditor;
'B' : Configuration_MessageBaseEditor; 'B' : Configuration_MessageBaseEditor;
@ -300,9 +302,9 @@ Begin
'P' : Configuration_ProtocolEditor; 'P' : Configuration_ProtocolEditor;
'R' : Configuration_GroupEditor(False); 'R' : Configuration_GroupEditor(False);
'S' : Configuration_SecurityEditor(True); 'S' : Configuration_SecurityEditor(True);
'T' : Configuration_ThemeEditor(False);
'U', 'U',
'M', 'M',
'T',
'E', 'E',
'V' : ExecuteOldConfiguration(Res); 'V' : ExecuteOldConfiguration(Res);
'X' : Break; 'X' : Break;

View File

@ -553,9 +553,9 @@ Type
HiAttr : Byte; HiAttr : Byte;
Format : Byte; Format : Byte;
StartY : Byte; StartY : Byte;
EndY : Byte; Reserved2 : Byte;
StartX : Byte; StartX : Byte;
RESERVED : LongInt; Reserved : LongInt;
End; End;
Const Const