IDE: CodeTools CodeCreation frame simpler. Issue #29104, patch from Alexey Torgashin.

git-svn-id: trunk@50696 -
This commit is contained in:
juha 2015-12-06 15:00:16 +00:00
parent 41aa946ab3
commit 2fe0fde59e
2 changed files with 64 additions and 93 deletions

View File

@ -14,9 +14,9 @@ object CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame
AnchorSideTop.Control = ForwardProcsInsertPolicyComboBox AnchorSideTop.Control = ForwardProcsInsertPolicyComboBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 19 Height = 24
Top = 45 Top = 53
Width = 200 Width = 261
BorderSpacing.Left = 6 BorderSpacing.Left = 6
BorderSpacing.Top = 6 BorderSpacing.Top = 6
Caption = 'ForwardProcsKeepOrderCheckBox' Caption = 'ForwardProcsKeepOrderCheckBox'
@ -27,9 +27,9 @@ object CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame
AnchorSideTop.Control = UsesInsertPolicyComboBox AnchorSideTop.Control = UsesInsertPolicyComboBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 19 Height = 24
Top = 99 Top = 120
Width = 217 Width = 279
BorderSpacing.Left = 6 BorderSpacing.Left = 6
BorderSpacing.Top = 6 BorderSpacing.Top = 6
Caption = 'UpdateMultiProcSignaturesCheckBox' Caption = 'UpdateMultiProcSignaturesCheckBox'
@ -40,9 +40,9 @@ object CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame
AnchorSideTop.Control = UpdateMultiProcSignaturesCheckBox AnchorSideTop.Control = UpdateMultiProcSignaturesCheckBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 19 Height = 24
Top = 118 Top = 144
Width = 244 Width = 315
BorderSpacing.Left = 6 BorderSpacing.Left = 6
Caption = 'UpdateOtherProcSignaturesCaseCheckBox' Caption = 'UpdateOtherProcSignaturesCaseCheckBox'
TabOrder = 4 TabOrder = 4
@ -52,53 +52,20 @@ object CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame
AnchorSideTop.Control = TemplateFileEdit AnchorSideTop.Control = TemplateFileEdit
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 6 Left = 6
Height = 15 Height = 17
Top = 195 Top = 240
Width = 95 Width = 124
Caption = 'TemplateFileLabel' Caption = 'TemplateFileLabel'
ParentColor = False ParentColor = False
end end
object TemplateFileEdit: TEdit
AnchorSideLeft.Control = TemplateFileLabel
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = EventMethodSectionComboBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = TemplateFileBrowseButton
Left = 107
Height = 23
Top = 191
Width = 418
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 6
TabOrder = 7
Text = 'TemplateFileEdit'
end
object TemplateFileBrowseButton: TButton
AnchorSideTop.Control = TemplateFileEdit
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = TemplateFileEdit
AnchorSideBottom.Side = asrBottom
Left = 525
Height = 23
Top = 191
Width = 35
Anchors = [akTop, akRight, akBottom]
AutoSize = True
BorderSpacing.Right = 6
Caption = '...'
OnClick = TemplateFileBrowseButtonClick
TabOrder = 8
end
object GroupLocalVariablesCheckBox: TCheckBox object GroupLocalVariablesCheckBox: TCheckBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = UpdateOtherProcSignaturesCaseCheckBox AnchorSideTop.Control = UpdateOtherProcSignaturesCaseCheckBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 19 Height = 24
Top = 137 Top = 168
Width = 180 Width = 234
BorderSpacing.Left = 6 BorderSpacing.Left = 6
Caption = 'GroupLocalVariablesCheckBox' Caption = 'GroupLocalVariablesCheckBox'
TabOrder = 5 TabOrder = 5
@ -106,11 +73,11 @@ object CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame
object ForwardProcsInsertPolicyComboBox: TComboBox object ForwardProcsInsertPolicyComboBox: TComboBox
AnchorSideLeft.Control = ForwardProcsInsertPolicyLabel AnchorSideLeft.Control = ForwardProcsInsertPolicyLabel
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
Left = 173 Left = 223
Height = 23 Height = 31
Top = 16 Top = 16
Width = 170 Width = 170
ItemHeight = 15 ItemHeight = 0
Style = csDropDownList Style = csDropDownList
TabOrder = 0 TabOrder = 0
end end
@ -120,9 +87,9 @@ object CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = ForwardProcsInsertPolicyComboBox AnchorSideRight.Control = ForwardProcsInsertPolicyComboBox
Left = 6 Left = 6
Height = 15 Height = 17
Top = 20 Top = 23
Width = 161 Width = 211
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'ForwardProcsInsertPolicyLabel' Caption = 'ForwardProcsInsertPolicyLabel'
ParentColor = False ParentColor = False
@ -133,9 +100,9 @@ object CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = UsesInsertPolicyComboBox AnchorSideRight.Control = UsesInsertPolicyComboBox
Left = 6 Left = 6
Height = 15 Height = 17
Top = 74 Top = 90
Width = 113 Width = 148
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'UsesInsertPolicyLabel' Caption = 'UsesInsertPolicyLabel'
ParentColor = False ParentColor = False
@ -145,12 +112,12 @@ object CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = ForwardProcsKeepOrderCheckBox AnchorSideTop.Control = ForwardProcsKeepOrderCheckBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 125 Left = 160
Height = 23 Height = 31
Top = 70 Top = 83
Width = 170 Width = 170
BorderSpacing.Top = 6 BorderSpacing.Top = 6
ItemHeight = 15 ItemHeight = 0
Style = csDropDownList Style = csDropDownList
TabOrder = 2 TabOrder = 2
end end
@ -160,9 +127,9 @@ object CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = EventMethodSectionComboBox AnchorSideRight.Control = EventMethodSectionComboBox
Left = 6 Left = 6
Height = 15 Height = 17
Top = 166 Top = 205
Width = 138 Width = 177
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'EventMethodSectionLabel' Caption = 'EventMethodSectionLabel'
ParentColor = False ParentColor = False
@ -172,13 +139,36 @@ object CodetoolsCodeCreationOptionsFrame: TCodetoolsCodeCreationOptionsFrame
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = GroupLocalVariablesCheckBox AnchorSideTop.Control = GroupLocalVariablesCheckBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 150 Left = 189
Height = 23 Height = 31
Top = 162 Top = 198
Width = 170 Width = 170
BorderSpacing.Top = 6 BorderSpacing.Top = 6
ItemHeight = 15 ItemHeight = 0
Style = csDropDownList Style = csDropDownList
TabOrder = 6 TabOrder = 6
end end
object TemplateFileEdit: TFileNameEdit
AnchorSideLeft.Control = TemplateFileLabel
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = EventMethodSectionComboBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 136
Height = 27
Top = 235
Width = 424
FilterIndex = 0
HideDirectories = False
ButtonWidth = 50
NumGlyphs = 1
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 6
BorderSpacing.Right = 6
MaxLength = 0
TabOrder = 7
Text = 'TemplateFileEdit'
end
end end

View File

@ -25,7 +25,7 @@ unit codetools_codecreation_options;
interface interface
uses uses
Classes, SysUtils, FileUtil, Forms, ExtCtrls, StdCtrls, Dialogs, Classes, SysUtils, FileUtil, Forms, ExtCtrls, StdCtrls, Dialogs, EditBtn,
SourceChanger, CodeToolsOptions, LazarusIDEStrConsts, IDEOptionsIntf, SourceChanger, CodeToolsOptions, LazarusIDEStrConsts, IDEOptionsIntf,
IDEDialogs; IDEDialogs;
@ -35,19 +35,17 @@ type
TCodetoolsCodeCreationOptionsFrame = class(TAbstractIDEOptionsEditor) TCodetoolsCodeCreationOptionsFrame = class(TAbstractIDEOptionsEditor)
ForwardProcsInsertPolicyComboBox: TComboBox; ForwardProcsInsertPolicyComboBox: TComboBox;
TemplateFileEdit: TFileNameEdit;
UsesInsertPolicyComboBox: TComboBox; UsesInsertPolicyComboBox: TComboBox;
ForwardProcsKeepOrderCheckBox: TCheckBox; ForwardProcsKeepOrderCheckBox: TCheckBox;
ForwardProcsInsertPolicyLabel: TLabel; ForwardProcsInsertPolicyLabel: TLabel;
EventMethodSectionComboBox: TComboBox; EventMethodSectionComboBox: TComboBox;
UsesInsertPolicyLabel: TLabel; UsesInsertPolicyLabel: TLabel;
TemplateFileBrowseButton: TButton;
TemplateFileEdit: TEdit;
TemplateFileLabel: TLabel; TemplateFileLabel: TLabel;
UpdateMultiProcSignaturesCheckBox: TCheckBox; UpdateMultiProcSignaturesCheckBox: TCheckBox;
UpdateOtherProcSignaturesCaseCheckBox: TCheckBox; UpdateOtherProcSignaturesCaseCheckBox: TCheckBox;
GroupLocalVariablesCheckBox: TCheckBox; GroupLocalVariablesCheckBox: TCheckBox;
EventMethodSectionLabel: TLabel; EventMethodSectionLabel: TLabel;
procedure TemplateFileBrowseButtonClick(Sender: TObject);
private private
public public
function GetTitle: String; override; function GetTitle: String; override;
@ -63,26 +61,6 @@ implementation
{ TCodetoolsCodeCreationOptionsFrame } { TCodetoolsCodeCreationOptionsFrame }
procedure TCodetoolsCodeCreationOptionsFrame.TemplateFileBrowseButtonClick(
Sender: TObject);
var
OpenDialog: TOpenDialog;
begin
OpenDialog:=TOpenDialog.Create(nil);
try
InitIDEFileDialog(OpenDialog);
OpenDialog.Title:=lisChooseAFileWithCodeToolsTemplates;
OpenDialog.Options:=OpenDialog.Options+[ofFileMustExist];
OpenDialog.Filter:=dlgFilterCodetoolsTemplateFile+' (*.xml)|*.xml|'+dlgFilterAll+
'|'+GetAllFilesMask;
if OpenDialog.Execute then
TemplateFileEdit.Text:=OpenDialog.FileName;
finally
StoreIDEFileDialog(OpenDialog);
OpenDialog.Free;
end;
end;
function TCodetoolsCodeCreationOptionsFrame.GetTitle: String; function TCodetoolsCodeCreationOptionsFrame.GetTitle: String;
begin begin
Result := dlgCodeCreation; Result := dlgCodeCreation;
@ -142,8 +120,11 @@ begin
{$IFNDEF EnableCodeCompleteTemplates} {$IFNDEF EnableCodeCompleteTemplates}
TemplateFileLabel.Enabled:=false; TemplateFileLabel.Enabled:=false;
TemplateFileEdit.Enabled:=false; TemplateFileEdit.Enabled:=false;
TemplateFileBrowseButton.Enabled:=false;
{$ENDIF} {$ENDIF}
TemplateFileEdit.DialogTitle:=lisChooseAFileWithCodeToolsTemplates;
TemplateFileEdit.Filter:=dlgFilterCodetoolsTemplateFile+' (*.xml)|*.xml|'+
dlgFilterAll+'|'+GetAllFilesMask;
end; end;
procedure TCodetoolsCodeCreationOptionsFrame.ReadSettings( procedure TCodetoolsCodeCreationOptionsFrame.ReadSettings(