added TMaskEdit.EditMask property editor from Lagunov Aleksey

git-svn-id: trunk@7576 -
This commit is contained in:
mattias 2005-08-27 12:55:55 +00:00
parent 76f6b894c2
commit 7bccdc9896
11 changed files with 247 additions and 166 deletions

6
.gitattributes vendored
View File

@ -968,9 +968,9 @@ ideintf/imagelisteditor.pp svneol=native#text/pascal
ideintf/lazideintf.pas svneol=native#text/pascal
ideintf/listviewpropedit.pp svneol=native#text/pascal
ideintf/macrointf.pas svneol=native#text/pascal
ideintf/maskeditorunit.lfm svneol=native#text/plain
ideintf/maskeditorunit.lrs svneol=native#text/plain
ideintf/maskeditorunit.pas svneol=native#text/plain
ideintf/maskpropedit.lfm svneol=native#text/plain
ideintf/maskpropedit.lrs svneol=native#text/plain
ideintf/maskpropedit.pas svneol=native#text/plain
ideintf/menuintf.pas svneol=native#text/plain
ideintf/newfield.lfm svneol=native#text/plain
ideintf/newfield.lrs svneol=native#text/pascal

View File

@ -2026,7 +2026,9 @@ begin
if (Count=0) or (IsResizing) then exit;
{$IFDEF VerboseDesigner}
DebugLn('[TControlSelection.MoveSelectionWithSnapping] A ',
TotalDX,',',TotalDY,' OldBounds=',FLeft,',',FTop,',',FWidth,',',FHeight);
'TotalD='+dbgs(TotalDX)+','+dbgs(TotalDY),
' CurBounds='+dbgs(FLeft)+','+dbgs(FTop)+','+dbgs(FWidth)+','+dbgs(FHeight),
' OldBounds='+dbgs(FOldLeft)+','+dbgs(FOldTop)+','+dbgs(FOldWidth)+','+dbgs(FOldHeight));
{$ENDIF}
NewLeft:=FindNearestSnapLeft(FOldLeft+TotalDX,FWidth);
NewTop:=FindNearestSnapTop(FOldTop+TotalDY,FHeight);
@ -2037,7 +2039,7 @@ begin
FTop:=NewTop;
{$IFDEF VerboseDesigner}
DebugLn('[TControlSelection.MoveSelectionWithSnapping] B ',
FLeft,',',FTop,',',FWidth,',',FHeight);
' Bounds='+dbgs(FLeft)+','+dbgs(FTop)+','+dbgs(FWidth)+','+dbgs(FHeight));
{$ENDIF}
EndResizing(true);
end;

View File

@ -256,6 +256,8 @@ type
function NonVisualComponentLeftTop(AComponent: TComponent): TPoint;
function NonVisualComponentAtPos(x,y: integer): TComponent;
procedure MoveNonVisualComponentIntoForm(AComponent: TComponent);
procedure MoveNonVisualComponentsIntoForm;
function WinControlAtPos(x,y: integer; UseRootAsDefault,
IgnoreHidden: boolean): TWinControl;
function ControlAtPos(x,y: integer; UseRootAsDefault,
@ -1128,7 +1130,10 @@ Begin
MouseDownSender:=nil;
NonVisualComp:=NonVisualComponentAtPos(MouseDownPos.X,MouseDownPos.Y);
if NonVisualComp<>nil then MouseDownComponent:=NonVisualComp;
if NonVisualComp<>nil then begin
MouseDownComponent:=NonVisualComp;
MoveNonVisualComponentIntoForm(NonVisualComp);
end;
if (MouseDownComponent=nil) then begin
MouseDownComponent:=ComponentAtPos(MouseDownPos.X,MouseDownPos.Y,true,true);
@ -1384,6 +1389,8 @@ var
// check if start new selection or add/remove:
NewRubberbandSelection:= (not (ssShift in Shift))
or (ControlSelection.SelectionForm<>Form);
// update non visual components
MoveNonVisualComponentsIntoForm;
// if user press the Control key, then component candidates are only
// childs of the control, where the mouse started
if (ssCtrl in shift) and (MouseDownComponent is TControl) then
@ -1529,7 +1536,7 @@ begin
LastMouseMovePos:= GetFormRelativeMousePosition(Form);
if (OldMouseMovePos.X=LastMouseMovePos.X)
and (OldMouseMovePos.Y=LastMouseMovePos.Y) then exit;
if ControlSelection.SelectionForm=Form then
Grabber:=ControlSelection.GrabberAtPos(
LastMouseMovePos.X, LastMouseMovePos.Y)
@ -1589,6 +1596,7 @@ begin
ControlSelection.SaveBounds;
Include(FFlags,dfHasSized);
end;
//debugln('TDesigner.MouseMoveOnControl Move MouseDownComponent=',dbgsName(MouseDownComponent),' OldMouseMovePos=',dbgs(OldMouseMovePos),' MouseMovePos',dbgs(LastMouseMovePos),' MouseDownPos=',dbgs(MouseDownPos));
if ControlSelection.MoveSelectionWithSnapping(
LastMouseMovePos.X-MouseDownPos.X,LastMouseMovePos.Y-MouseDownPos.Y)
then begin
@ -2311,6 +2319,29 @@ begin
Result:=nil;
end;
procedure TDesigner.MoveNonVisualComponentIntoForm(AComponent: TComponent);
var
p: TPoint;
begin
p:=NonVisualComponentLeftTop(AComponent);
LongRec(AComponent.DesignInfo).Lo:=p.x;
LongRec(AComponent.DesignInfo).Hi:=p.y;
end;
procedure TDesigner.MoveNonVisualComponentsIntoForm;
var
i: Integer;
AComponent: TComponent;
begin
for i:=0 to FLookupRoot.ComponentCount-1 do begin
AComponent:=FLookupRoot.Components[i];
if (not (AComponent is TControl))
and (not ComponentIsInvisible(AComponent)) then begin
MoveNonVisualComponentIntoForm(AComponent);
end;
end;
end;
function TDesigner.ComponentClassAtPos(const AClass: TComponentClass;
const APos: TPoint; const UseRootAsDefault, IgnoreHidden: boolean): TComponent;

View File

@ -16,29 +16,37 @@ options=-gl
[target]
units=allideintf
implicitunits=actionseditor \
columndlg \
componenteditors \
componentreg \
componenttreeview \
configstorage \
fieldseditor \
fieldslist \
formeditingintf \
graphpropedits \
helpfpdoc \
helphtml \
helpintf \
idecommands \
imagelisteditor \
listviewpropedit \
newfield \
objectinspector \
objinspstrconsts \
projectintf \
propedits \
srceditorintf \
texttools
implicitunits=a \
ActionsEditor \
ColumnDlg \
ComponentEditors \
ComponentReg \
ComponentTreeView \
ConfigStorage \
DBPropEdits \
FieldsEditor \
FormEditingIntf \
FrmSelectProps \
GraphPropEdits \
HelpFPDoc \
HelpHTML \
HelpIntf \
IDECommands \
IDEWindowIntf \
ImageListEditor \
LazIDEIntf \
ListViewPropEdit \
MacroIntf \
MaskPropEdit \
MenuIntf \
NewItemIntf \
ObjectInspector \
ObjInspStrConsts \
PackageIntf \
ProjectIntf \
PropEdits \
SrcEditorIntf \
TextTools
[clean]
files=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT)) \

View File

@ -40,6 +40,7 @@ uses
LazIDEIntf,
ListViewPropEdit,
MacroIntf,
MaskPropEdit,
MenuIntf,
NewItemIntf,
ObjectInspector,

View File

@ -1,45 +0,0 @@
{ Ýòî - ôàéë ðåñóðñîâ, àâòîìàòè÷åñêè ñîçäàííûé lazarus }
LazarusResources.Add('TMaskEditorForm','FORMDATA',[
'TPF0'#15'TMaskEditorForm'#14'MaskEditorForm'#11'BorderStyle'#7#8'bsDialog'#7
+'Caption'#6#17'Input Mask Editor'#12'ClientHeight'#3#209#0#11'ClientWidth'#3
+#228#1#8'OnCreate'#7#20'MaskEditorFormCreate'#13'PixelsPerInch'#2'`'#8'Posit'
+'ion'#7#15'poDesktopCenter'#18'HorzScrollBar.Page'#3#227#1#18'VertScrollBar.'
+'Page'#3#208#0#4'Left'#3#202#1#6'Height'#3#209#0#3'Top'#3#248#0#5'Width'#3
+#228#1#0#6'TLabel'#6'Label1'#7'Caption'#6#12'&Input Mask:'#5'Color'#7#6'clNo'
+'ne'#12'FocusControl'#7#5'Edit1'#4'Left'#2#8#6'Height'#2#17#3'Top'#2#8#5'Wid'
+'th'#2'A'#0#0#6'TLabel'#6'Label2'#7'Caption'#6#14'&Sample Masks:'#5'Color'#7
+#6'clNone'#4'Left'#3#208#0#6'Height'#2#17#3'Top'#2#5#5'Width'#3#192#0#0#0#6
+'TLabel'#6'Label3'#7'Caption'#6#21'Character for Blanks:'#5'Color'#7#6'clNon'
+'e'#12'FocusControl'#7#5'Edit2'#4'Left'#2#26#6'Height'#2#17#3'Top'#2'>'#5'Wi'
+'dth'#2'v'#0#0#5'TEdit'#5'Edit1'#8'OnChange'#7#11'Edit1Change'#8'TabOrder'#2
+#0#4'Left'#2#8#6'Height'#2#23#3'Top'#2#22#5'Width'#3#192#0#0#0#8'TListBox'#8
+'ListBox1'#7'OnClick'#7#13'ListBox1Click'#8'TabOrder'#2#1#4'Left'#3#208#0#6
+'Height'#3#144#0#3'Top'#2#24#5'Width'#3#8#1#0#0#7'TButton'#7'Button1'#7'Anch'
+'ors'#11#7'akRight'#8'akBottom'#0#7'Caption'#6#2'OK'#11'ModalResult'#2#1#8'T'
+'abOrder'#2#2#4'Left'#3#240#0#6'Height'#2#25#3'Top'#3#176#0#5'Width'#2'K'#0#0
+#7'TButton'#7'Button2'#7'Anchors'#11#7'akRight'#8'akBottom'#0#7'Caption'#6#6
+'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#3#4'Left'#3'@'#1#6'Height'#2#25#3
+'Top'#3#176#0#5'Width'#2'K'#0#0#7'TButton'#7'Button3'#7'Anchors'#11#7'akRigh'
+'t'#8'akBottom'#0#7'Caption'#6#5'&Help'#8'TabOrder'#2#4#4'Left'#3#144#1#6'He'
+'ight'#2#25#3'Top'#3#176#0#5'Width'#2'K'#0#0#7'TButton'#10'BtnLoadDem'#7'Anc'
+'hors'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6#9'&Masks...'#7'OnClick'#7#15
+'BtnLoadDemClick'#8'TabOrder'#2#5#4'Left'#2#16#6'Height'#2#25#3'Top'#3#176#0
+#5'Width'#2'K'#0#0#5'TEdit'#5'Edit2'#9'MaxLength'#2#1#8'OnChange'#7#11'Edit2'
+'Change'#8'TabOrder'#2#6#4'Left'#3#144#0#6'Height'#2#23#3'Top'#2'8'#5'Width'
+#2'8'#0#0#9'TCheckBox'#9'CheckBox1'#7'Caption'#6#24'Save &Literal Characters'
+#7'OnClick'#7#14'CheckBox1Click'#8'TabOrder'#2#7#11'UseOnChange'#9#4'Left'#2
+#8#6'Height'#2#23#3'Top'#2'X'#5'Width'#3#194#0#0#0#6'TPanel'#6'Panel1'#10'Be'
+'velInner'#7#8'bvRaised'#10'BevelOuter'#7#9'bvLowered'#12'ClientHeight'#2'2'
+#11'ClientWidth'#3#192#0#11'FullRepaint'#8#8'TabOrder'#2#8#4'Left'#2#8#6'Hei'
+'ght'#2'2'#3'Top'#2'v'#5'Width'#3#192#0#0#6'TLabel'#6'Label4'#7'Caption'#6#12
+'&Test Input:'#5'Color'#7#6'clNone'#4'Left'#2#8#6'Height'#2#17#3'Top'#2#2#5
+'Width'#2'A'#0#0#9'TMaskEdit'#12'TestMaskEdit'#8'TabOrder'#2#0#4'Left'#2#8#6
+'Height'#2#23#3'Top'#2#20#5'Width'#3#176#0#0#0#0#11'TOpenDialog'#11'OpenDial'
+'og1'#7'Options'#11#13'ofNoChangeDir'#14'ofEnableSizing'#12'ofViewDetail'#0#5
+'Title'#6#25#206#242#234#240#251#242#252' '#241#243#249#229#241#242#226#243
+#254#249#232#233' '#244#224#233#235#10'DefaultExt'#6#4'.dem'#6'Filter'#6',Ed'
+'it Masks (*.dem)|*.dem|All Files (*.*)|*.*'#11'FilterIndex'#2#0#5'Title'#6
+#25#206#242#234#240#251#242#252' '#241#243#249#229#241#242#226#243#254#249
+#232#233' '#244#224#233#235#4'left'#3#176#0#3'top'#2'h'#0#0#0
]);

View File

@ -1,27 +1,29 @@
object MaskEditorForm: TMaskEditorForm
BorderStyle = bsDialog
Caption = 'Input Mask Editor'
ClientHeight = 209
ClientWidth = 484
ClientHeight = 239
ClientWidth = 507
OnCreate = MaskEditorFormCreate
PixelsPerInch = 96
PixelsPerInch = 112
Position = poDesktopCenter
HorzScrollBar.Page = 483
VertScrollBar.Page = 208
HorzScrollBar.Page = 506
VertScrollBar.Page = 238
Left = 458
Height = 209
Height = 239
Top = 248
Width = 484
object Label1: TLabel
Width = 507
object InputMaskLabel: TLabel
BorderSpacing.OnChange = nil
Caption = '&Input Mask:'
Color = clNone
FocusControl = Edit1
FocusControl = InputMaskEdit
Left = 8
Height = 17
Top = 8
Width = 65
end
object Label2: TLabel
object SampleMasksLabel: TLabel
BorderSpacing.OnChange = nil
Caption = '&Sample Masks:'
Color = clNone
Left = 208
@ -29,82 +31,98 @@ object MaskEditorForm: TMaskEditorForm
Top = 5
Width = 192
end
object Label3: TLabel
object CharactersForBlanksLabel: TLabel
BorderSpacing.OnChange = nil
Caption = 'Character for Blanks:'
Color = clNone
FocusControl = Edit2
Left = 26
FocusControl = CharactersForBlanksEdit
Left = 8
Height = 17
Top = 62
Width = 118
end
object Edit1: TEdit
OnChange = Edit1Change
object InputMaskEdit: TEdit
BorderSpacing.OnChange = nil
OnChange = InputMaskEditChange
TabOrder = 0
Left = 8
Height = 23
Top = 22
Top = 24
Width = 192
end
object ListBox1: TListBox
OnClick = ListBox1Click
object SampleMasksListBox: TListBox
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.OnChange = nil
OnClick = SampleMasksListBoxClick
TabOrder = 1
TopIndex = -1
Left = 208
Height = 144
Height = 174
Top = 24
Width = 264
Width = 287
end
object Button1: TButton
object OkButton: TButton
Anchors = [akRight, akBottom]
BorderSpacing.OnChange = nil
Caption = 'OK'
ModalResult = 1
TabOrder = 2
Left = 240
Left = 263
Height = 25
Top = 176
Top = 206
Width = 75
end
object Button2: TButton
object CancelButton: TButton
Anchors = [akRight, akBottom]
BorderSpacing.OnChange = nil
Caption = 'Cancel'
ModalResult = 2
TabOrder = 3
Left = 320
Left = 343
Height = 25
Top = 176
Top = 206
Width = 75
end
object Button3: TButton
object HelpButton: TButton
Anchors = [akRight, akBottom]
BorderSpacing.OnChange = nil
Caption = '&Help'
TabOrder = 4
Left = 400
Left = 423
Height = 25
Top = 176
Top = 206
Width = 75
end
object BtnLoadDem: TButton
object LoadSampleMasksButton: TButton
Anchors = [akLeft, akBottom]
BorderSpacing.OnChange = nil
Caption = '&Masks...'
OnClick = BtnLoadDemClick
OnClick = LoadSampleMasksButtonClick
TabOrder = 5
Left = 16
Height = 25
Top = 176
Top = 206
Width = 75
end
object Edit2: TEdit
object CharactersForBlanksEdit: TEdit
Anchors = [akTop, akLeft, akRight]
BorderSpacing.OnChange = nil
BorderSpacing.Left = 3
MaxLength = 1
OnChange = Edit2Change
OnChange = CharactersForBlankEditChange
TabOrder = 6
Left = 144
AnchorSideLeft.Control = CharactersForBlanksLabel
AnchorSideRight.Control = InputMaskEdit
AnchorSideRight.Side = asrBottom
Left = 129
Height = 23
Top = 56
Width = 56
Width = 71
end
object CheckBox1: TCheckBox
object SaveLiteralCheckBox: TCheckBox
BorderSpacing.OnChange = nil
Caption = 'Save &Literal Characters'
OnClick = CheckBox1Click
OnClick = SaveLiteralCheckBoxClick
TabOrder = 7
UseOnChange = True
Left = 8
@ -113,29 +131,32 @@ object MaskEditorForm: TMaskEditorForm
Width = 194
end
object Panel1: TPanel
BorderSpacing.OnChange = nil
BevelInner = bvRaised
BevelOuter = bvLowered
ClientHeight = 50
ClientHeight = 66
ClientWidth = 192
FullRepaint = False
TabOrder = 8
Left = 8
Height = 50
Height = 66
Top = 118
Width = 192
object Label4: TLabel
object TestInputLabel: TLabel
BorderSpacing.OnChange = nil
Caption = '&Test Input:'
Color = clNone
Left = 8
Height = 17
Top = 2
Top = 6
Width = 65
end
object TestMaskEdit: TMaskEdit
BorderSpacing.OnChange = nil
TabOrder = 0
Left = 8
Height = 23
Top = 20
Top = 26
Width = 176
end
end
@ -146,7 +167,7 @@ object MaskEditorForm: TMaskEditorForm
Filter = 'Edit Masks (*.dem)|*.dem|All Files (*.*)|*.*'
FilterIndex = 0
Title = 'Îòêðûòü ñóùåñòâóþùèé ôàéë'
left = 176
top = 104
left = 48
top = 240
end
end

57
ideintf/maskpropedit.lrs Normal file
View File

@ -0,0 +1,57 @@
{ Ýòî - ôàéë ðåñóðñîâ, àâòîìàòè÷åñêè ñîçäàííûé lazarus }
LazarusResources.Add('TMaskEditorForm','FORMDATA',[
'TPF0'#15'TMaskEditorForm'#14'MaskEditorForm'#11'BorderStyle'#7#8'bsDialog'#7
+'Caption'#6#17'Input Mask Editor'#12'ClientHeight'#3#239#0#11'ClientWidth'#3
+#251#1#8'OnCreate'#7#20'MaskEditorFormCreate'#13'PixelsPerInch'#2'p'#8'Posit'
+'ion'#7#15'poDesktopCenter'#18'HorzScrollBar.Page'#3#250#1#18'VertScrollBar.'
+'Page'#3#238#0#4'Left'#3#202#1#6'Height'#3#239#0#3'Top'#3#248#0#5'Width'#3
+#251#1#0#6'TLabel'#14'InputMaskLabel'#22'BorderSpacing.OnChange'#13#7'Captio'
+'n'#6#12'&Input Mask:'#5'Color'#7#6'clNone'#12'FocusControl'#7#13'InputMaskE'
+'dit'#4'Left'#2#8#6'Height'#2#17#3'Top'#2#8#5'Width'#2'A'#0#0#6'TLabel'#16'S'
+'ampleMasksLabel'#22'BorderSpacing.OnChange'#13#7'Caption'#6#14'&Sample Mask'
+'s:'#5'Color'#7#6'clNone'#4'Left'#3#208#0#6'Height'#2#17#3'Top'#2#5#5'Width'
+#3#192#0#0#0#6'TLabel'#24'CharactersForBlanksLabel'#22'BorderSpacing.OnChang'
+'e'#13#7'Caption'#6#21'Character for Blanks:'#5'Color'#7#6'clNone'#12'FocusC'
+'ontrol'#7#23'CharactersForBlanksEdit'#4'Left'#2#8#6'Height'#2#17#3'Top'#2'>'
+#5'Width'#2'v'#0#0#5'TEdit'#13'InputMaskEdit'#22'BorderSpacing.OnChange'#13#8
+'OnChange'#7#19'InputMaskEditChange'#8'TabOrder'#2#0#4'Left'#2#8#6'Height'#2
+#23#3'Top'#2#24#5'Width'#3#192#0#0#0#8'TListBox'#18'SampleMasksListBox'#7'An'
+'chors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#22'BorderSpacing.OnCh'
+'ange'#13#7'OnClick'#7#23'SampleMasksListBoxClick'#8'TabOrder'#2#1#8'TopInde'
+'x'#2#255#4'Left'#3#208#0#6'Height'#3#174#0#3'Top'#2#24#5'Width'#3#31#1#0#0#7
+'TButton'#8'OkButton'#7'Anchors'#11#7'akRight'#8'akBottom'#0#22'BorderSpacin'
+'g.OnChange'#13#7'Caption'#6#2'OK'#11'ModalResult'#2#1#8'TabOrder'#2#2#4'Lef'
+'t'#3#7#1#6'Height'#2#25#3'Top'#3#206#0#5'Width'#2'K'#0#0#7'TButton'#12'Canc'
+'elButton'#7'Anchors'#11#7'akRight'#8'akBottom'#0#22'BorderSpacing.OnChange'
+#13#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#3#4'Left'#3'W'#1
+#6'Height'#2#25#3'Top'#3#206#0#5'Width'#2'K'#0#0#7'TButton'#10'HelpButton'#7
+'Anchors'#11#7'akRight'#8'akBottom'#0#22'BorderSpacing.OnChange'#13#7'Captio'
+'n'#6#5'&Help'#8'TabOrder'#2#4#4'Left'#3#167#1#6'Height'#2#25#3'Top'#3#206#0
+#5'Width'#2'K'#0#0#7'TButton'#21'LoadSampleMasksButton'#7'Anchors'#11#6'akLe'
+'ft'#8'akBottom'#0#22'BorderSpacing.OnChange'#13#7'Caption'#6#9'&Masks...'#7
+'OnClick'#7#26'LoadSampleMasksButtonClick'#8'TabOrder'#2#5#4'Left'#2#16#6'He'
+'ight'#2#25#3'Top'#3#206#0#5'Width'#2'K'#0#0#5'TEdit'#23'CharactersForBlanks'
+'Edit'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#22'BorderSpacing.OnChan'
+'ge'#13#18'BorderSpacing.Left'#2#3#9'MaxLength'#2#1#8'OnChange'#7#28'Charact'
+'ersForBlankEditChange'#8'TabOrder'#2#6#22'AnchorSideLeft.Control'#7#24'Char'
+'actersForBlanksLabel'#23'AnchorSideRight.Control'#7#13'InputMaskEdit'#20'An'
+'chorSideRight.Side'#7#9'asrBottom'#4'Left'#3#129#0#6'Height'#2#23#3'Top'#2
+'8'#5'Width'#2'G'#0#0#9'TCheckBox'#19'SaveLiteralCheckBox'#22'BorderSpacing.'
+'OnChange'#13#7'Caption'#6#24'Save &Literal Characters'#7'OnClick'#7#24'Save'
+'LiteralCheckBoxClick'#8'TabOrder'#2#7#11'UseOnChange'#9#4'Left'#2#8#6'Heigh'
+'t'#2#23#3'Top'#2'X'#5'Width'#3#194#0#0#0#6'TPanel'#6'Panel1'#22'BorderSpaci'
+'ng.OnChange'#13#10'BevelInner'#7#8'bvRaised'#10'BevelOuter'#7#9'bvLowered'
+#12'ClientHeight'#2'B'#11'ClientWidth'#3#192#0#11'FullRepaint'#8#8'TabOrder'
+#2#8#4'Left'#2#8#6'Height'#2'B'#3'Top'#2'v'#5'Width'#3#192#0#0#6'TLabel'#14
+'TestInputLabel'#22'BorderSpacing.OnChange'#13#7'Caption'#6#12'&Test Input:'
+#5'Color'#7#6'clNone'#4'Left'#2#8#6'Height'#2#17#3'Top'#2#6#5'Width'#2'A'#0#0
+#9'TMaskEdit'#12'TestMaskEdit'#22'BorderSpacing.OnChange'#13#8'TabOrder'#2#0
+#4'Left'#2#8#6'Height'#2#23#3'Top'#2#26#5'Width'#3#176#0#0#0#0#11'TOpenDialo'
+'g'#11'OpenDialog1'#7'Options'#11#13'ofNoChangeDir'#14'ofEnableSizing'#12'of'
+'ViewDetail'#0#5'Title'#6#25#206#242#234#240#251#242#252' '#241#243#249#229
+#241#242#226#243#254#249#232#233' '#244#224#233#235#10'DefaultExt'#6#4'.dem'
+#6'Filter'#6',Edit Masks (*.dem)|*.dem|All Files (*.*)|*.*'#11'FilterIndex'#2
+#0#5'Title'#6#25#206#242#234#240#251#242#252' '#241#243#249#229#241#242#226
+#243#254#249#232#233' '#244#224#233#235#4'left'#2'0'#3'top'#3#240#0#0#0#0
]);

View File

@ -17,7 +17,7 @@
Property Editors for TMaskEdit.EditMask of FCL and LCL.
}
unit MaskEditorUnit;
unit MaskPropEdit;
{$mode objfpc}{$H+}
@ -25,33 +25,33 @@ interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
Buttons, ExtCtrls, MaskEdit, PropEdits, Componenteditors, TypInfo;
Buttons, ExtCtrls, FileUtil, MaskEdit, LazIDEIntf, PropEdits, TypInfo;
type
{ TMaskEditorForm }
TMaskEditorForm = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
BtnLoadDem: TButton;
CheckBox1: TCheckBox;
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
ListBox1: TListBox;
OkButton: TButton;
CancelButton: TButton;
HelpButton: TButton;
LoadSampleMasksButton: TButton;
SaveLiteralCheckBox: TCheckBox;
InputMaskEdit: TEdit;
CharactersForBlanksEdit: TEdit;
InputMaskLabel: TLabel;
SampleMasksLabel: TLabel;
CharactersForBlanksLabel: TLabel;
TestInputLabel: TLabel;
SampleMasksListBox: TListBox;
TestMaskEdit: TMaskEdit;
OpenDialog1: TOpenDialog;
Panel1: TPanel;
procedure BtnLoadDemClick(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure Edit1Change(Sender: TObject);
procedure Edit2Change(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
procedure LoadSampleMasksButtonClick(Sender: TObject);
procedure SaveLiteralCheckBoxClick(Sender: TObject);
procedure InputMaskEditChange(Sender: TObject);
procedure CharactersForBlankEditChange(Sender: TObject);
procedure SampleMasksListBoxClick(Sender: TObject);
procedure MaskEditorFormCreate(Sender: TObject);
private
function GetEditMask: string;
@ -62,8 +62,8 @@ type
property EditMask:string read GetEditMask write SetEditMask;
end;
type
{ TEditMaskProperty }
TEditMaskProperty = class(TStringPropertyEditor)
public
function GetAttributes: TPropertyAttributes; override;
@ -71,96 +71,101 @@ type
end;
implementation
uses StrUtils;
{ TMaskEditorForm }
procedure TMaskEditorForm.BtnLoadDemClick(Sender: TObject);
procedure TMaskEditorForm.LoadSampleMasksButtonClick(Sender: TObject);
begin
OpenDialog1.InitialDir:=ExtractFileDir(ParamStr(0));
if OpenDialog1.Execute then
LoadDEMFile(OpenDialog1.FileName);
end;
procedure TMaskEditorForm.CheckBox1Click(Sender: TObject);
procedure TMaskEditorForm.SaveLiteralCheckBoxClick(Sender: TObject);
var
I:integer;
S1:string;
begin
S1:=Edit1.Text;
S1:=InputMaskEdit.Text;
I:=Pos(';', S1);
if (I>0) and (I<Length(S1)) then
begin
S1[i+1]:=IntToStr(Ord(CheckBox1.Checked))[1];
Edit1.Text:=S1;
S1[i+1]:=IntToStr(Ord(SaveLiteralCheckBox.Checked))[1];
InputMaskEdit.Text:=S1;
end;
end;
procedure TMaskEditorForm.Edit1Change(Sender: TObject);
procedure TMaskEditorForm.InputMaskEditChange(Sender: TObject);
begin
UpdateTestEditor;
end;
procedure TMaskEditorForm.Edit2Change(Sender: TObject);
procedure TMaskEditorForm.CharactersForBlankEditChange(Sender: TObject);
var
I:integer;
S1:string;
begin
S1:=Edit1.Text;
S1:=InputMaskEdit.Text;
I:=NPos(';', S1, 2);
if (I>0) and (I<Length(S1)) and (Edit2.Text<>'') then
if (I>0) and (I<Length(S1)) and (CharactersForBlanksEdit.Text<>'') then
begin
S1[i+1]:=Edit2.Text[1];
Edit1.Text:=S1;
S1[i+1]:=CharactersForBlanksEdit.Text[1];
InputMaskEdit.Text:=S1;
end;
end;
procedure TMaskEditorForm.ListBox1Click(Sender: TObject);
procedure TMaskEditorForm.SampleMasksListBoxClick(Sender: TObject);
var
S1, S2:string;
begin
TestMaskEdit.Text:='';
S1:=ListBox1.Items[ListBox1.ItemIndex];
S1:=SampleMasksListBox.Items[SampleMasksListBox.ItemIndex];
Delete(S1, 1, Pos('|', S1));
S2:=Copy(S1, 1, Pos('|', S1)-1);
Delete(S1, 1, Pos('|', S1));
EditMask:=S1;
EditMask:=S2;
end;
procedure TMaskEditorForm.MaskEditorFormCreate(Sender: TObject);
var
aDemFile:string;
begin
aDemFile:=ExtractFileDir(ParamStr(0))+DirectorySeparator+'us.dem';
if LazarusIDE<>nil then
aDemFile:=LazarusIDE.GetPrimaryConfigPath
else
aDemFile:=ExtractFileDir(ParamStr(0));
aDemFile:=CleanAndExpandDirectory(aDemFile)+'maskeditmasks.txt';
if FileExists(aDemFile) then
LoadDEMFile(aDemFile);
end;
function TMaskEditorForm.GetEditMask: string;
begin
Result:=Edit1.Text;
Result:=InputMaskEdit.Text;
end;
procedure TMaskEditorForm.LoadDEMFile(AFileName: string);
begin
ListBox1.Items.Clear;
ListBox1.Items.LoadFromFile(AFileName);
SampleMasksListBox.Items.Clear;
SampleMasksListBox.Items.LoadFromFile(AFileName);
end;
procedure TMaskEditorForm.SetEditMask(AValue: string);
begin
Edit1.Text:=AValue;
InputMaskEdit.Text:=AValue;
Delete(AValue, 1, Pos(';', AValue));
if AValue<>'' then
CheckBox1.Checked:=AValue[1]='1';
SaveLiteralCheckBox.Checked:=AValue[1]='1';
Delete(AValue, 1, Pos(';', AValue));
Edit2.Text:=AValue;
CharactersForBlanksEdit.Text:=AValue;
UpdateTestEditor;
end;
procedure TMaskEditorForm.UpdateTestEditor;
begin
TestMaskEdit.EditMask:=Edit1.Text;
TestMaskEdit.EditMask:=InputMaskEdit.Text;
end;
{ TEditMaskProperty }
@ -186,8 +191,9 @@ end;
initialization
{$I maskeditorunit.lrs}
RegisterPropertyEditor(TypeInfo(string), TCustomMaskEdit, 'EditMask', TEditMaskProperty);
{$I maskpropedit.lrs}
RegisterPropertyEditor(TypeInfo(string), TCustomMaskEdit, 'EditMask',
TEditMaskProperty);
end.

View File

@ -1382,7 +1382,7 @@ begin
{ for i:= 0 to MDIChildCount - 1 do begin
if not MDIChildren[i].CloseQuery then begin
Result:= false;
Exit;
Exit;
end;
end;}
end;

View File

@ -1630,7 +1630,7 @@ var
else
WriteInteger(StrToInt(s));
end;
function WideStringNeeded(const s: widestring): Boolean;
var
i: Integer;