MaskEdit property editor: adapt for EnableSets.

This commit is contained in:
Bart 2024-01-17 21:44:24 +01:00
parent c2d546e251
commit 310abc6966
24 changed files with 170 additions and 12 deletions

View File

@ -593,6 +593,10 @@ msgstr ""
msgid "%d lines, %d chars"
msgstr "%d línies, %d caràcters"
#: objinspstrconsts.oisenablesetshint
msgid "Only affects the EnableSets property of the Test Input"
msgstr ""
#: objinspstrconsts.oisenumeration
msgid "Enumeration"
msgstr "Enumeració"

View File

@ -571,6 +571,10 @@ msgstr "Smazat označené položky"
msgid "%d lines, %d chars"
msgstr "%d řádků, %d znaků"
#: objinspstrconsts.oisenablesetshint
msgid "Only affects the EnableSets property of the Test Input"
msgstr ""
#: objinspstrconsts.oisenumeration
msgid "Enumeration"
msgstr "Výčet"

View File

@ -570,6 +570,10 @@ msgstr "Gewählte(s) Feld(er) löschen"
msgid "%d lines, %d chars"
msgstr "%d Zeilen, %d Zeichen"
#: objinspstrconsts.oisenablesetshint
msgid "Only affects the EnableSets property of the Test Input"
msgstr ""
#: objinspstrconsts.oisenumeration
msgid "Enumeration"
msgstr "Aufzählung"

View File

@ -573,6 +573,10 @@ msgstr "Borrar campo(s) seleccionados"
msgid "%d lines, %d chars"
msgstr "%d líneas, %d caracteres"
#: objinspstrconsts.oisenablesetshint
msgid "Only affects the EnableSets property of the Test Input"
msgstr ""
#: objinspstrconsts.oisenumeration
msgid "Enumeration"
msgstr "Enumeración"

View File

@ -564,6 +564,10 @@ msgstr "Poista valitut kentät"
msgid "%d lines, %d chars"
msgstr "%d riviä, %d merkkiä"
#: objinspstrconsts.oisenablesetshint
msgid "Only affects the EnableSets property of the Test Input"
msgstr ""
#: objinspstrconsts.oisenumeration
msgid "Enumeration"
msgstr "Lueteltu tyyppi"

View File

@ -568,6 +568,10 @@ msgstr "Supprimer le(s) champ(s) sélectionné(s)"
msgid "%d lines, %d chars"
msgstr "%d lignes, %d caractères"
#: objinspstrconsts.oisenablesetshint
msgid "Only affects the EnableSets property of the Test Input"
msgstr ""
#: objinspstrconsts.oisenumeration
msgid "Enumeration"
msgstr "Énumération"

View File

@ -590,6 +590,10 @@ msgstr "מחק את השדה(ות) שנבחרו"
msgid "%d lines, %d chars"
msgstr "שורות d%, תווים d%"
#: objinspstrconsts.oisenablesetshint
msgid "Only affects the EnableSets property of the Test Input"
msgstr ""
#: objinspstrconsts.oisenumeration
msgid "Enumeration"
msgstr "Enumeration"

View File

@ -571,6 +571,10 @@ msgstr "Kijelölt mező(k) törlése"
msgid "%d lines, %d chars"
msgstr "%d sor, %d karakter"
#: objinspstrconsts.oisenablesetshint
msgid "Only affects the EnableSets property of the Test Input"
msgstr ""
#: objinspstrconsts.oisenumeration
msgid "Enumeration"
msgstr "Felsorolás"

View File

@ -593,6 +593,10 @@ msgstr ""
msgid "%d lines, %d chars"
msgstr "%d baris, %d chars"
#: objinspstrconsts.oisenablesetshint
msgid "Only affects the EnableSets property of the Test Input"
msgstr ""
#: objinspstrconsts.oisenumeration
msgid "Enumeration"
msgstr "Enumeration"

View File

@ -574,6 +574,10 @@ msgstr "Cancellare i campi selezionati"
msgid "%d lines, %d chars"
msgstr "%d righe, %d caratteri"
#: objinspstrconsts.oisenablesetshint
msgid "Only affects the EnableSets property of the Test Input"
msgstr ""
#: objinspstrconsts.oisenumeration
msgid "Enumeration"
msgstr "Enumerazione"

View File

@ -573,6 +573,10 @@ msgstr "選択したフィールドを削除"
msgid "%d lines, %d chars"
msgstr "%d 行, %d 文字"
#: objinspstrconsts.oisenablesetshint
msgid "Only affects the EnableSets property of the Test Input"
msgstr ""
#: objinspstrconsts.oisenumeration
msgid "Enumeration"
msgstr "一覧"

View File

@ -572,6 +572,10 @@ msgstr "Šalinti pažymėtuosius laukelius"
msgid "%d lines, %d chars"
msgstr "%d eilučių, %d simbolių"
#: objinspstrconsts.oisenablesetshint
msgid "Only affects the EnableSets property of the Test Input"
msgstr ""
#: objinspstrconsts.oisenumeration
msgid "Enumeration"
msgstr "Vardinis tipas"

View File

@ -582,6 +582,10 @@ msgstr ""
msgid "%d lines, %d chars"
msgstr "%d regels, %d letters"
#: objinspstrconsts.oisenablesetshint
msgid "Only affects the EnableSets property of the Test Input"
msgstr ""
#: objinspstrconsts.oisenumeration
msgid "Enumeration"
msgstr "Enumeration"

View File

@ -566,6 +566,10 @@ msgstr ""
msgid "%d lines, %d chars"
msgstr "%d linii, %d znaków"
#: objinspstrconsts.oisenablesetshint
msgid "Only affects the EnableSets property of the Test Input"
msgstr ""
#: objinspstrconsts.oisenumeration
msgid "Enumeration"
msgstr ""

View File

@ -558,6 +558,10 @@ msgstr ""
msgid "%d lines, %d chars"
msgstr ""
#: objinspstrconsts.oisenablesetshint
msgid "Only affects the EnableSets property of the Test Input"
msgstr ""
#: objinspstrconsts.oisenumeration
msgid "Enumeration"
msgstr ""

View File

@ -567,6 +567,10 @@ msgstr "Excluir campo(s) selecionado(s)"
msgid "%d lines, %d chars"
msgstr "%d linhas, %d caracteres"
#: objinspstrconsts.oisenablesetshint
msgid "Only affects the EnableSets property of the Test Input"
msgstr ""
#: objinspstrconsts.oisenumeration
msgid "Enumeration"
msgstr "Enumeração"

View File

@ -567,6 +567,10 @@ msgstr "Удалить выбранные поля"
msgid "%d lines, %d chars"
msgstr "%d строк, %d символов"
#: objinspstrconsts.oisenablesetshint
msgid "Only affects the EnableSets property of the Test Input"
msgstr ""
#: objinspstrconsts.oisenumeration
msgid "Enumeration"
msgstr "Перечисление"

View File

@ -576,6 +576,10 @@ msgstr "Zmazať vybraté polia"
msgid "%d lines, %d chars"
msgstr "%d riadkov, %d znakov"
#: objinspstrconsts.oisenablesetshint
msgid "Only affects the EnableSets property of the Test Input"
msgstr ""
#: objinspstrconsts.oisenumeration
msgid "Enumeration"
msgstr "Vymenovaný typ"

View File

@ -567,6 +567,10 @@ msgstr "Seçili alnları sil"
msgid "%d lines, %d chars"
msgstr "%d satırı, %d karakteri"
#: objinspstrconsts.oisenablesetshint
msgid "Only affects the EnableSets property of the Test Input"
msgstr ""
#: objinspstrconsts.oisenumeration
msgid "Enumeration"
msgstr "Numaralandırma"

View File

@ -570,6 +570,10 @@ msgstr "Видалити вибрані поля"
msgid "%d lines, %d chars"
msgstr "%d рядків, %d символів"
#: objinspstrconsts.oisenablesetshint
msgid "Only affects the EnableSets property of the Test Input"
msgstr ""
#: objinspstrconsts.oisenumeration
msgid "Enumeration"
msgstr "Перелік"

View File

@ -568,6 +568,10 @@ msgstr "删除选择的字段"
msgid "%d lines, %d chars"
msgstr "%d行, %d字符"
#: objinspstrconsts.oisenablesetshint
msgid "Only affects the EnableSets property of the Test Input"
msgstr ""
#: objinspstrconsts.oisenumeration
msgid "Enumeration"
msgstr "枚举"

View File

@ -1,13 +1,13 @@
object MaskEditorForm: TMaskEditorForm
Left = 458
Height = 287
Height = 326
Top = 248
Width = 507
ActiveControl = InputMaskEdit
AutoSize = True
BorderStyle = bsDialog
Caption = 'Input Mask Editor'
ClientHeight = 287
ClientHeight = 326
ClientWidth = 507
Position = poScreenCenter
LCLVersion = '3.99.0.0'
@ -74,7 +74,7 @@ object MaskEditorForm: TMaskEditorForm
AnchorSideBottom.Control = LoadSampleMasksButton
AnchorSideBottom.Side = asrBottom
Left = 201
Height = 198
Height = 223
Top = 24
Width = 300
Anchors = [akTop, akLeft, akRight, akBottom]
@ -94,7 +94,7 @@ object MaskEditorForm: TMaskEditorForm
AnchorSideTop.Side = asrBottom
Left = 6
Height = 25
Top = 197
Top = 222
Width = 75
BorderSpacing.Around = 6
Caption = '&Masks...'
@ -134,13 +134,13 @@ object MaskEditorForm: TMaskEditorForm
end
object TestInputPanel: TPanel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = SaveLiteralCheckBox
AnchorSideTop.Control = EnableSetsCheckBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = InputMaskEdit
AnchorSideRight.Side = asrBottom
Left = 6
Height = 66
Top = 125
Top = 150
Width = 189
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
@ -187,8 +187,8 @@ object MaskEditorForm: TMaskEditorForm
AnchorSideTop.Control = LoadSampleMasksButton
AnchorSideTop.Side = asrBottom
Left = 6
Height = 53
Top = 228
Height = 67
Top = 253
Width = 495
Anchors = [akTop, akLeft, akRight, akBottom]
OKButton.Name = 'OKButton'
@ -202,6 +202,23 @@ object MaskEditorForm: TMaskEditorForm
TabOrder = 6
ShowButtons = [pbOK, pbCancel, pbHelp]
end
object EnableSetsCheckBox: TCheckBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = SaveLiteralCheckBox
AnchorSideTop.Side = asrBottom
Left = 6
Height = 19
Hint = 'Only affects the EnableSets property of the Test Input'
Top = 125
Width = 74
BorderSpacing.Left = 6
BorderSpacing.Top = 6
Caption = 'EnableSets'
ParentShowHint = False
ShowHint = True
TabOrder = 7
OnClick = EnableSetsCheckBoxClick
end
object OpenDialog1: TOpenDialog
Title = 'Open mask file (*.dem)'
DefaultExt = '.dem'

View File

@ -32,6 +32,7 @@ type
TMaskEditorForm = class(TForm)
ButtonPanel1: TButtonPanel;
EnableSetsCheckBox: TCheckBox;
LoadSampleMasksButton: TButton;
SaveLiteralCheckBox: TCheckBox;
InputMaskEdit: TEdit;
@ -44,6 +45,7 @@ type
TestMaskEdit: TMaskEdit;
OpenDialog1: TOpenDialog;
TestInputPanel: TPanel;
procedure EnableSetsCheckBoxClick(Sender: TObject);
procedure FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction);
procedure LoadSampleMasksButtonClick(Sender: TObject);
procedure SampleMasksListBoxDrawItem(Control: TWinControl; Index: Integer;
@ -54,14 +56,17 @@ type
procedure SampleMasksListBoxClick(Sender: TObject);
procedure MaskEditorFormCreate(Sender: TObject);
private
FEnableSets: Boolean;
function ConstructEditmask: String;
function GetEditMask: string;
procedure LoadDEMFile(AFileName: string);
procedure ReConstructEditmask;
procedure SetEditMask(AValue: string);
procedure SetEnableSets(AValue: Boolean);
procedure UpdateTestEditor;
public
property EditMask: string read GetEditMask write SetEditMask;
property EnableSets: Boolean write SetEnableSets;
end;
{ TEditMaskProperty }
@ -70,6 +75,7 @@ type
public
function GetAttributes: TPropertyAttributes; override;
procedure Edit; override;
function GetMaskEdit: TCustomMaskEdit;
end;
{ TMaskEditEditor }
@ -105,7 +111,7 @@ begin
Mask := Line;
end;
function MaskDoFormatText(const EditMask: string; const Value: string; Blank: Char): String;
function MaskDoFormatText(const EditMask: string; const Value: string; EnableSets: Boolean): String;
var
P: Integer;
S: String;
@ -115,7 +121,7 @@ begin
P := LastDelimiter(';', S);
if P <> 0 then
begin
S[P + 1] := Blank;
S[P + 1] := #32;
dec(P);
while (P > 0) and (S[P] <> ';') do
dec(P);
@ -123,7 +129,7 @@ begin
S[P + 1] := '0';
end;
try
Result := FormatMaskText(S, Value);
Result := FormatMaskText(S, Value, EnableSets);
except
Result := Value;
end;
@ -157,6 +163,11 @@ begin
IDEDialogLayoutList.SaveLayout(Self);
end;
procedure TMaskEditorForm.EnableSetsCheckBoxClick(Sender: TObject);
begin
SetEnableSets(EnableSetsCheckBox.Checked);
end;
procedure TMaskEditorForm.LoadSampleMasksButtonClick(Sender: TObject);
begin
OpenDialog1.InitialDir:=ExtractFileDir(ParamStrUTF8(0));
@ -186,7 +197,7 @@ begin
ListBox.Canvas.TextStyle := NewTextStyle;
ParseMaskLine(ListBox.Items[Index], AMaskCaption, AMaskExample, AEditMask);
AMaskExample := MaskDoFormatText(AEditMask, AMaskExample, ' ');
AMaskExample := MaskDoFormatText(AEditMask, AMaskExample, FEnableSets);
R1 := ARect;
R2 := ARect;
@ -293,6 +304,27 @@ begin
UpdateTestEditor;
end;
procedure TMaskEditorForm.SetEnableSets(AValue: Boolean);
var
OldMask: String;
WasMasked: Boolean;
begin
FEnableSets := AValue;
WasMasked := TestMaskEdit.IsMasked;
if WasMasked then
begin
OldMask := TestMaskEdit.EditMask;
TestMaskEdit.EditMask := '';
end;
TestMaskEdit.EnableSets := FEnableSets;
if WasMasked then
begin
TestMaskEdit.EditMask := OldMask;
end;
//since this is not only called from clicking on the checkbox
EnableSetsCheckBox.Checked := FEnableSets;
end;
procedure TMaskEditorForm.UpdateTestEditor;
begin
TestMaskEdit.EditMask:=InputMaskEdit.Text;
@ -308,9 +340,13 @@ end;
procedure TEditMaskProperty.Edit;
var
MaskEditorForm: TMaskEditorForm;
C: TPersistent;
AMaskEdit: TCustomMaskEdit;
begin
MaskEditorForm:=TMaskEditorForm.Create(Application);
try
AMaskEdit := GetMaskEdit;
MaskEditorForm.EnableSets := AMaskEdit.EnableSets;
MaskEditorForm.EditMask:=GetValue;
if MaskEditorForm.ShowModal = mrOk then
SetValue(MaskEditorForm.EditMask);
@ -319,6 +355,25 @@ begin
end;
end;
function TEditMaskProperty.GetMaskEdit: TCustomMaskEdit;
var
i: Integer;
C: TPersistent;
begin
Result := nil;
for i:=0 to PropCount-1 do
begin
C := GetComponent(i);
if C is TCustomMaskEdit then
begin
Result := TCustomMaskEdit(C);
Exit;
end;
end;
end;
{ TMaskEditEditor }
procedure TMaskEditEditor.ExecuteVerb(Index: Integer);
@ -329,6 +384,7 @@ begin
begin
MaskEditorForm := TMaskEditorForm.Create(Application);
try
MaskEditorForm.EnableSets := MaskEdit.EnableSets;
MaskEditorForm.EditMask := MaskEdit.EditMask;
if MaskEditorForm.ShowModal = mrOk then
MaskEdit.EditMask := MaskEditorForm.EditMask;

View File

@ -263,6 +263,7 @@ resourcestring
oisCharactersForBlanks = 'Characters for Blanks';
oisTestInput = 'Test Input';
oisOpenMaskFile = 'Open masks file (*.dem)';
oisEnableSetsHint = 'Only affects the EnableSets property of the Test Input';
cActionListEditorDialogCategory = 'Dialog';
cActionListEditorFileCategory = 'File';
cActionListEditorDatabaseCategory = 'Database';