diff --git a/.gitattributes b/.gitattributes index 12f3d836ad..c0825abcec 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1347,6 +1347,7 @@ ideintf/stringgriddlg.lfm svneol=native#text/plain ideintf/stringgriddlg.lrs svneol=native#text/plain ideintf/stringspropeditdlg.lfm svneol=native#text/plain ideintf/stringspropeditdlg.lrs svneol=native#text/plain +ideintf/stringspropeditdlg.pas svneol=native#text/plain ideintf/texttools.pas svneol=native#text/pascal ideintf/treeviewpropedit.lfm svneol=native#text/plain ideintf/treeviewpropedit.lrs svneol=native#text/plain diff --git a/designer/anchoreditor.lfm b/designer/anchoreditor.lfm index 07b26d35fe..e90cf3ea68 100644 --- a/designer/anchoreditor.lfm +++ b/designer/anchoreditor.lfm @@ -19,12 +19,12 @@ object AnchorDesigner: TAnchorDesigner Anchors = [akTop, akLeft, akBottom] Caption = 'BorderSpaceGroupBox' ClientHeight = 87 - ClientWidth = 168 + ClientWidth = 176 TabOrder = 0 - Left = 172 + Left = 170 Height = 104 Top = 80 - Width = 172 + Width = 180 object LeftBorderSpaceSpinEdit: TSpinEdit OnChange = BorderSpaceSpinEditChange ParentShowHint = False diff --git a/designer/anchoreditor.lrs b/designer/anchoreditor.lrs index 0ea8d6743f..466928fa48 100644 --- a/designer/anchoreditor.lrs +++ b/designer/anchoreditor.lrs @@ -1,3 +1,5 @@ +{ This is an automatically generated lazarus resource file } + LazarusResources.Add('TAnchorDesigner','FORMDATA',[ 'TPF0'#15'TAnchorDesigner'#14'AnchorDesigner'#13'ActiveControl'#7#23'LeftBord' +'erSpaceSpinEdit'#7'Caption'#6#14'AnchorDesigner'#12'ClientHeight'#3#3#1#11 @@ -7,8 +9,8 @@ LazarusResources.Add('TAnchorDesigner','FORMDATA',[ +#18'HorzScrollBar.Page'#3#7#2#18'VertScrollBar.Page'#3#2#1#4'Left'#3'*'#1#6 +'Height'#3#3#1#3'Top'#3#179#0#5'Width'#3#8#2#0#9'TGroupBox'#19'BorderSpaceGr' +'oupBox'#7'Anchors'#11#5'akTop'#6'akLeft'#8'akBottom'#0#7'Caption'#6#19'Bord' - +'erSpaceGroupBox'#12'ClientHeight'#2'W'#11'ClientWidth'#3#168#0#8'TabOrder'#2 - +#0#4'Left'#3#172#0#6'Height'#2'h'#3'Top'#2'P'#5'Width'#3#172#0#0#9'TSpinEdit' + +'erSpaceGroupBox'#12'ClientHeight'#2'W'#11'ClientWidth'#3#176#0#8'TabOrder'#2 + +#0#4'Left'#3#170#0#6'Height'#2'h'#3'Top'#2'P'#5'Width'#3#180#0#0#9'TSpinEdit' +#23'LeftBorderSpaceSpinEdit'#8'OnChange'#7#25'BorderSpaceSpinEditChange'#14 +'ParentShowHint'#8#8'ShowHint'#9#8'TabOrder'#2#0#5'Value'#2#1#6'Height'#2#20 +#3'Top'#2#30#5'Width'#2'8'#0#0#9'TSpinEdit'#24'RightBorderSpaceSpinEdit'#8'O' diff --git a/ideintf/allideintf.pas b/ideintf/allideintf.pas index 98f0c23406..0f4acd92b3 100644 --- a/ideintf/allideintf.pas +++ b/ideintf/allideintf.pas @@ -49,6 +49,7 @@ uses ProjectIntf, PropEdits, SrcEditorIntf, + StringsPropEditDlg, TextTools, TreeViewPropEdit; diff --git a/ideintf/propedits.pp b/ideintf/propedits.pp index f4d4c94bca..eabe062cfd 100644 --- a/ideintf/propedits.pp +++ b/ideintf/propedits.pp @@ -38,7 +38,7 @@ uses LCLProc, Forms, Controls, GraphType, Graphics, StdCtrls, Buttons, ComCtrls, Menus, LCLType, ExtCtrls, LCLIntf, Dialogs, Grids, EditBtn, PropertyStorage, TextTools, FrmSelectProps, - ColumnDlg, FileUtil, ObjInspStrConsts; + StringsPropEditDlg, ColumnDlg, FileUtil, ObjInspStrConsts; const MaxIdentLength: Byte = 63; @@ -1354,24 +1354,10 @@ type //============================================================================== -//============================================================================== - -{ TStringsPropEditorDlg } - type - TStringsPropEditorDlg = class(TForm) - OKButton: TBitBtn; - CancelButton: TBitBtn; - StatusLabel: TLabel; - SortButton: TButton; - GroupBox1: TGroupBox; - Memo: TMemo; - procedure FormCreate(Sender: TObject); - procedure MemoChange(Sender: TObject); - procedure SortButtonClick(Sender: TObject); + TStringsPropEditorDlg = class(TStringsPropEditorFrm) public Editor: TPropertyEditor; - procedure AddButtons; virtual; end; //============================================================================== @@ -4511,62 +4497,6 @@ begin Result := [paMultiSelect, paAutoUpdate, paRevertable]; end; -{ TStringsPropEditorDlg } - -procedure TStringsPropEditorDlg.FormCreate(Sender: TObject); -begin - Caption := oisStringsEditorDialog; - StatusLabel.Caption := ois0Lines0Chars; - SortButton.Caption := oisSort; - - AddButtons; -end; - -procedure TStringsPropEditorDlg.MemoChange(Sender: TObject); -var - NumChars: Integer; - I: Integer; -begin - NumChars := 0; - for I := 0 to Memo.Lines.Count - 1 do Inc(NumChars, Length(Memo.Lines[I])); - - if Memo.Lines.Count = 1 then - StatusLabel.Text := Format(ois1LineDChars, [NumChars]) - else - StatusLabel.Text := Format(oisDLinesDChars, [Memo.Lines.Count, NumChars]); -end; - -procedure TStringsPropEditorDlg.SortButtonClick(Sender: TObject); -var - OldText, NewSortedText: String; - SortOnlySelection: Boolean; -begin - if not Assigned(ShowSortSelectionDialogFunc) then - begin - SortButton.Enabled := False; - Exit; - end; - - SortOnlySelection := True; - OldText := Memo.SelText; - if OldText = '' then - begin - SortOnlySelection := False; - OldText := Memo.Lines.Text; - end; - - if ShowSortSelectionDialogFunc(OldText, nil, NewSortedText) <> mrOk then Exit; - if SortOnlySelection then - Memo.SelText := NewSortedText - else - Memo.Lines.Text := NewSortedText; -end; - -procedure TStringsPropEditorDlg.AddButtons; -begin - // -end; - { TStringsPropertyEditor } procedure TStringsPropertyEditor.Edit; diff --git a/ideintf/stringspropeditdlg.lfm b/ideintf/stringspropeditdlg.lfm index 740a5a63e7..7f02d11539 100644 --- a/ideintf/stringspropeditdlg.lfm +++ b/ideintf/stringspropeditdlg.lfm @@ -1,12 +1,12 @@ -object StringsPropEditorDlg: TStringsPropEditorDlg +object StringsPropEditorFrm: TStringsPropEditorFrm ActiveControl = Memo - Caption = 'StringsPropEditorDlg' + Caption = 'StringsPropEditorFrm' ClientHeight = 300 ClientWidth = 400 Constraints.MinHeight = 160 Constraints.MinWidth = 180 OnCreate = FormCreate - PixelsPerInch = 96 + PixelsPerInch = 112 Position = poScreenCenter HorzScrollBar.Page = 399 VertScrollBar.Page = 299 @@ -18,12 +18,12 @@ object StringsPropEditorDlg: TStringsPropEditorDlg Align = alTop Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Around = 6 - - ClientHeight = 240 + ClientHeight = 238 ClientWidth = 384 TabOrder = 0 + AnchorSideBottom.Control = OKButton Left = 6 - Height = 258 + Height = 255 Top = 6 Width = 388 object StatusLabel: TLabel @@ -34,7 +34,7 @@ object StringsPropEditorDlg: TStringsPropEditorDlg ParentColor = False Left = 9 Height = 14 - Top = 218 + Top = 216 Width = 57 end object Memo: TMemo @@ -45,14 +45,14 @@ object StringsPropEditorDlg: TStringsPropEditorDlg TabOrder = 0 WordWrap = False Left = 6 - Height = 208 + Height = 206 Top = 6 Width = 290 end object SortButton: TButton Anchors = [akTop, akRight] BorderSpacing.Around = 6 - + BorderSpacing.InnerBorder = 4 Caption = 'Sort' OnClick = SortButtonClick TabOrder = 1 @@ -64,32 +64,34 @@ object StringsPropEditorDlg: TStringsPropEditorDlg end object OKButton: TBitBtn Anchors = [akRight, akBottom] + AutoSize = True BorderSpacing.Around = 6 - Caption = '&OK' Default = True Kind = bkOK ModalResult = 1 NumGlyphs = 0 TabOrder = 1 - Left = 318 - Height = 25 - Top = 270 - Width = 75 + Left = 338 + Height = 28 + Top = 267 + Width = 55 end object CancelButton: TBitBtn Anchors = [akRight, akBottom] + AutoSize = True + BorderSpacing.Right = 6 BorderSpacing.Around = 6 - Cancel = True Caption = 'Cancel' Kind = bkCancel ModalResult = 2 NumGlyphs = 0 TabOrder = 2 - Left = 234 - Height = 25 - Top = 270 - Width = 75 + AnchorSideRight.Control = OKButton + Left = 249 + Height = 28 + Top = 267 + Width = 77 end end diff --git a/ideintf/stringspropeditdlg.lrs b/ideintf/stringspropeditdlg.lrs index cdd7b9d3b0..bf976ebbb8 100644 --- a/ideintf/stringspropeditdlg.lrs +++ b/ideintf/stringspropeditdlg.lrs @@ -1,28 +1,32 @@ -LazarusResources.Add('TStringsPropEditorDlg','FORMDATA',[ - 'TPF0'#21'TStringsPropEditorDlg'#20'StringsPropEditorDlg'#13'ActiveControl'#7 - +#4'Memo'#7'Caption'#6#20'StringsPropEditorDlg'#12'ClientHeight'#3','#1#11'Cl' +{ This is an automatically generated lazarus resource file } + +LazarusResources.Add('TStringsPropEditorFrm','FORMDATA',[ + 'TPF0'#21'TStringsPropEditorFrm'#20'StringsPropEditorFrm'#13'ActiveControl'#7 + +#4'Memo'#7'Caption'#6#20'StringsPropEditorFrm'#12'ClientHeight'#3','#1#11'Cl' +'ientWidth'#3#144#1#21'Constraints.MinHeight'#3#160#0#20'Constraints.MinWidt' - +'h'#3#180#0#8'OnCreate'#7#10'FormCreate'#13'PixelsPerInch'#2'`'#8'Position'#7 + +'h'#3#180#0#8'OnCreate'#7#10'FormCreate'#13'PixelsPerInch'#2'p'#8'Position'#7 +#14'poScreenCenter'#18'HorzScrollBar.Page'#3#143#1#18'VertScrollBar.Page'#3 +'+'#1#4'Left'#3'"'#1#6'Height'#3','#1#3'Top'#3#153#0#5'Width'#3#144#1#0#9'TG' +'roupBox'#9'GroupBox1'#5'Align'#7#5'alTop'#7'Anchors'#11#5'akTop'#6'akLeft'#7 - +'akRight'#8'akBottom'#0#20'BorderSpacing.Around'#2#6#12'ClientHeight'#3#240#0 - +#11'ClientWidth'#3#128#1#8'TabOrder'#2#0#4'Left'#2#6#6'Height'#3#2#1#3'Top'#2 - +#6#5'Width'#3#132#1#0#6'TLabel'#11'StatusLabel'#7'Anchors'#11#6'akLeft'#8'ak' - +'Bottom'#0#20'BorderSpacing.Around'#2#6#7'Caption'#6#11'StatusLabel'#5'Color' - +#7#6'clNone'#11'ParentColor'#8#4'Left'#2#9#6'Height'#2#14#3'Top'#3#218#0#5'W' - +'idth'#2'9'#0#0#5'TMemo'#4'Memo'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight' - +#8'akBottom'#0#20'BorderSpacing.Around'#2#6#8'OnChange'#7#10'MemoChange'#10 - +'ScrollBars'#7#10'ssAutoBoth'#8'TabOrder'#2#0#8'WordWrap'#8#4'Left'#2#6#6'He' - +'ight'#3#208#0#3'Top'#2#6#5'Width'#3'"'#1#0#0#7'TButton'#10'SortButton'#7'An' - +'chors'#11#5'akTop'#7'akRight'#0#20'BorderSpacing.Around'#2#6#7'Caption'#6#4 - +'Sort'#7'OnClick'#7#15'SortButtonClick'#8'TabOrder'#2#1#4'Left'#3'0'#1#6'Hei' - +'ght'#2#25#3'Top'#2#6#5'Width'#2'K'#0#0#0#7'TBitBtn'#8'OKButton'#7'Anchors' - +#11#7'akRight'#8'akBottom'#0#20'BorderSpacing.Around'#2#6#7'Caption'#6#3'&OK' - +#7'Default'#9#4'Kind'#7#4'bkOK'#11'ModalResult'#2#1#9'NumGlyphs'#2#0#8'TabOr' - +'der'#2#1#4'Left'#3'>'#1#6'Height'#2#25#3'Top'#3#14#1#5'Width'#2'K'#0#0#7'TB' - +'itBtn'#12'CancelButton'#7'Anchors'#11#7'akRight'#8'akBottom'#0#20'BorderSpa' - +'cing.Around'#2#6#6'Cancel'#9#7'Caption'#6#6'Cancel'#4'Kind'#7#8'bkCancel'#11 - +'ModalResult'#2#2#9'NumGlyphs'#2#0#8'TabOrder'#2#2#4'Left'#3#234#0#6'Height' - +#2#25#3'Top'#3#14#1#5'Width'#2'K'#0#0#0 + +'akRight'#8'akBottom'#0#20'BorderSpacing.Around'#2#6#12'ClientHeight'#3#238#0 + +#11'ClientWidth'#3#128#1#8'TabOrder'#2#0#24'AnchorSideBottom.Control'#7#8'OK' + +'Button'#4'Left'#2#6#6'Height'#3#255#0#3'Top'#2#6#5'Width'#3#132#1#0#6'TLabe' + +'l'#11'StatusLabel'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#20'BorderSpacing.A' + +'round'#2#6#7'Caption'#6#11'StatusLabel'#5'Color'#7#6'clNone'#11'ParentColor' + +#8#4'Left'#2#9#6'Height'#2#14#3'Top'#3#216#0#5'Width'#2'9'#0#0#5'TMemo'#4'Me' + +'mo'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#20'BorderSpac' + +'ing.Around'#2#6#8'OnChange'#7#10'MemoChange'#10'ScrollBars'#7#10'ssAutoBoth' + +#8'TabOrder'#2#0#8'WordWrap'#8#4'Left'#2#6#6'Height'#3#206#0#3'Top'#2#6#5'Wi' + +'dth'#3'"'#1#0#0#7'TButton'#10'SortButton'#7'Anchors'#11#5'akTop'#7'akRight' + +#0#20'BorderSpacing.Around'#2#6#25'BorderSpacing.InnerBorder'#2#4#7'Caption' + +#6#4'Sort'#7'OnClick'#7#15'SortButtonClick'#8'TabOrder'#2#1#4'Left'#3'0'#1#6 + +'Height'#2#25#3'Top'#2#6#5'Width'#2'K'#0#0#0#7'TBitBtn'#8'OKButton'#7'Anchor' + +'s'#11#7'akRight'#8'akBottom'#0#8'AutoSize'#9#20'BorderSpacing.Around'#2#6#7 + +'Caption'#6#3'&OK'#7'Default'#9#4'Kind'#7#4'bkOK'#11'ModalResult'#2#1#9'NumG' + +'lyphs'#2#0#8'TabOrder'#2#1#4'Left'#3'R'#1#6'Height'#2#28#3'Top'#3#11#1#5'Wi' + +'dth'#2'7'#0#0#7'TBitBtn'#12'CancelButton'#7'Anchors'#11#7'akRight'#8'akBott' + +'om'#0#8'AutoSize'#9#19'BorderSpacing.Right'#2#6#20'BorderSpacing.Around'#2#6 + +#6'Cancel'#9#7'Caption'#6#6'Cancel'#4'Kind'#7#8'bkCancel'#11'ModalResult'#2#2 + +#9'NumGlyphs'#2#0#8'TabOrder'#2#2#23'AnchorSideRight.Control'#7#8'OKButton'#4 + +'Left'#3#249#0#6'Height'#2#28#3'Top'#3#11#1#5'Width'#2'M'#0#0#0 ]); diff --git a/ideintf/stringspropeditdlg.pas b/ideintf/stringspropeditdlg.pas new file mode 100644 index 0000000000..9f5a6adb84 --- /dev/null +++ b/ideintf/stringspropeditdlg.pas @@ -0,0 +1,109 @@ +{ + ***************************************************************************** + * * + * See the file COPYING.modifiedLGPL, included in this distribution, * + * for details about the copyright. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * * + ***************************************************************************** + + Author: Mattias Gaertner + + Abstract: + Dialog for the TStrings property editor. +} +unit StringsPropEditDlg; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, LResources, Forms, Controls, Buttons, Dialogs, StdCtrls, + TextTools, ObjInspStrConsts; + +type + + { TStringsPropEditorFrm } + + TStringsPropEditorFrm = class(TForm) + OKButton: TBitBtn; + CancelButton: TBitBtn; + StatusLabel: TLabel; + SortButton: TButton; + GroupBox1: TGroupBox; + Memo: TMemo; + procedure FormCreate(Sender: TObject); + procedure MemoChange(Sender: TObject); + procedure SortButtonClick(Sender: TObject); + public + procedure AddButtons; virtual; + end; + + +implementation + +{ TStringsPropEditorFrm } + +procedure TStringsPropEditorFrm.FormCreate(Sender: TObject); +begin + Caption := oisStringsEditorDialog; + StatusLabel.Caption := ois0Lines0Chars; + SortButton.Caption := oisSort; + + AddButtons; +end; + +procedure TStringsPropEditorFrm.MemoChange(Sender: TObject); +var + NumChars: Integer; + I: Integer; +begin + NumChars := 0; + for I := 0 to Memo.Lines.Count - 1 do Inc(NumChars, Length(Memo.Lines[I])); + + if Memo.Lines.Count = 1 then + StatusLabel.Text := Format(ois1LineDChars, [NumChars]) + else + StatusLabel.Text := Format(oisDLinesDChars, [Memo.Lines.Count, NumChars]); +end; + +procedure TStringsPropEditorFrm.SortButtonClick(Sender: TObject); +var + OldText, NewSortedText: String; + SortOnlySelection: Boolean; +begin + if not Assigned(ShowSortSelectionDialogFunc) then + begin + SortButton.Enabled := False; + Exit; + end; + + SortOnlySelection := True; + OldText := Memo.SelText; + if OldText = '' then + begin + SortOnlySelection := False; + OldText := Memo.Lines.Text; + end; + + if ShowSortSelectionDialogFunc(OldText, nil, NewSortedText) <> mrOk then Exit; + if SortOnlySelection then + Memo.SelText := NewSortedText + else + Memo.Lines.Text := NewSortedText; +end; + +procedure TStringsPropEditorFrm.AddButtons; +begin + // +end; + +initialization + {$I stringspropeditdlg.lrs} + +end. + diff --git a/lcl/include/fileutil.inc b/lcl/include/fileutil.inc index 553ce78bcf..3772d604d3 100644 --- a/lcl/include/fileutil.inc +++ b/lcl/include/fileutil.inc @@ -1013,7 +1013,7 @@ end; ------------------------------------------------------------------------------} function CopyFile(const SrcFilename, DestFilename: string): boolean; begin - result := CopyFile(SrcFilename, DestFilename, false); + Result := CopyFile(SrcFilename, DestFilename, false); end; {------------------------------------------------------------------------------ diff --git a/lcl/intfgraphics.pas b/lcl/intfgraphics.pas index 3e124f24ca..78be3b4bc9 100644 --- a/lcl/intfgraphics.pas +++ b/lcl/intfgraphics.pas @@ -275,9 +275,9 @@ type TArrayNodesTree = class public Root: TArrayNode; - function FindNode(IntArray: PInteger; Count: integer): TArrayNode; - function FindData(IntArray: PInteger; Count: integer): Pointer; - function SetNode(IntArray: PInteger; Count: integer; + function FindNode(Path: PInteger; Count: integer): TArrayNode; + function FindData(Path: PInteger; Count: integer): Pointer; + function SetNode(Path: PInteger; Count: integer; Data: Pointer): TArrayNode; procedure Delete(Node: TArrayNode); procedure Clear; @@ -2914,7 +2914,7 @@ end; { TArrayNodesTree } -function TArrayNodesTree.FindNode(IntArray: PInteger; Count: integer +function TArrayNodesTree.FindNode(Path: PInteger; Count: integer ): TArrayNode; var i: Integer; @@ -2922,23 +2922,23 @@ begin Result:=Root; i:=0; while (Result<>nil) and (inil then Result:=ANode.Data else Result:=nil; end; -function TArrayNodesTree.SetNode(IntArray: PInteger; Count: integer; +function TArrayNodesTree.SetNode(Path: PInteger; Count: integer; Data: Pointer): TArrayNode; var i: Integer; @@ -2948,7 +2948,7 @@ begin Result:=Root; for i:=0 to Count-1 do begin //DebugLn('TArrayNodesTree.SetNode A ',DbgS(Result)); - Result:=Result.GetChildNode(IntArray[i],true); + Result:=Result.GetChildNode(Path[i],true); end; Result.Data:=Data; end;