mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-27 18:33:50 +02:00
IDE: optoional: ask for new filename for new files
git-svn-id: trunk@22223 -
This commit is contained in:
parent
b0afada3e2
commit
8cf10cd42f
@ -6,25 +6,27 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
OnResize = FrameResize
|
||||
TabOrder = 0
|
||||
Visible = False
|
||||
DesignLeft = 154
|
||||
DesignTop = 203
|
||||
DesignLeft = 308
|
||||
DesignTop = 202
|
||||
object GridGroupBox: TGroupBox[0]
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = Owner
|
||||
Left = 0
|
||||
Height = 212
|
||||
Top = 0
|
||||
Width = 337
|
||||
Caption = 'GridGroupBox'
|
||||
ClientHeight = 194
|
||||
ClientWidth = 333
|
||||
ClientHeight = 190
|
||||
ClientWidth = 329
|
||||
TabOrder = 0
|
||||
object GridColorLabel: TLabel
|
||||
AnchorSideLeft.Control = GridGroupBox
|
||||
AnchorSideTop.Control = GridSizeYLabel
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 14
|
||||
Top = 119
|
||||
Width = 70
|
||||
Height = 18
|
||||
Top = 124
|
||||
Width = 91
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'GridColorLabel'
|
||||
@ -35,9 +37,9 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideTop.Control = SnapToGridCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 14
|
||||
Top = 71
|
||||
Width = 70
|
||||
Height = 18
|
||||
Top = 68
|
||||
Width = 92
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'GridSizeXLabel'
|
||||
ParentColor = False
|
||||
@ -47,9 +49,9 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideTop.Control = GridSizeXLabel
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 14
|
||||
Top = 95
|
||||
Width = 70
|
||||
Height = 18
|
||||
Top = 96
|
||||
Width = 92
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'GridSizeYLabel'
|
||||
@ -60,12 +62,13 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = GridColorLabel
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 82
|
||||
Left = 103
|
||||
Height = 23
|
||||
Top = 115
|
||||
Top = 122
|
||||
Width = 50
|
||||
BorderWidth = 2
|
||||
ButtonColorSize = 16
|
||||
ButtonColor = clBlack
|
||||
Color = clBtnFace
|
||||
end
|
||||
object SnapToGridCheckBox: TCheckBox
|
||||
@ -75,9 +78,9 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideRight.Control = GridGroupBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 19
|
||||
Top = 46
|
||||
Width = 128
|
||||
Height = 18
|
||||
Top = 44
|
||||
Width = 156
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Right = 6
|
||||
@ -87,8 +90,9 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
object ShowGridCheckBox: TCheckBox
|
||||
AnchorSideLeft.Control = GridGroupBox
|
||||
Left = 6
|
||||
Height = 19
|
||||
Width = 118
|
||||
Height = 18
|
||||
Top = 0
|
||||
Width = 142
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'ShowGridCheckBox'
|
||||
TabOrder = 0
|
||||
@ -98,11 +102,11 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = GridSizeXLabel
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 82
|
||||
Left = 104
|
||||
Height = 21
|
||||
Top = 68
|
||||
Top = 67
|
||||
Width = 100
|
||||
ItemHeight = 13
|
||||
ItemHeight = 0
|
||||
Items.Strings = (
|
||||
'2'
|
||||
'5'
|
||||
@ -123,11 +127,11 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = GridSizeYLabel
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 82
|
||||
Left = 104
|
||||
Height = 21
|
||||
Top = 92
|
||||
Top = 95
|
||||
Width = 100
|
||||
ItemHeight = 13
|
||||
ItemHeight = 0
|
||||
Items.Strings = (
|
||||
'2'
|
||||
'5'
|
||||
@ -148,9 +152,9 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideTop.Control = ShowGridCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 19
|
||||
Top = 23
|
||||
Width = 160
|
||||
Height = 18
|
||||
Top = 22
|
||||
Width = 193
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 4
|
||||
Caption = 'ShowBorderSpaceCheckBox'
|
||||
@ -165,12 +169,13 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 343
|
||||
Height = 212
|
||||
Top = 0
|
||||
Width = 194
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'RubberbandGroupBox'
|
||||
ClientHeight = 194
|
||||
ClientWidth = 190
|
||||
ClientHeight = 190
|
||||
ClientWidth = 186
|
||||
Color = clBtnFace
|
||||
ParentColor = False
|
||||
TabOrder = 1
|
||||
@ -180,10 +185,11 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 23
|
||||
Top = 26
|
||||
Top = 30
|
||||
Width = 50
|
||||
BorderWidth = 2
|
||||
ButtonColorSize = 16
|
||||
ButtonColor = clBlack
|
||||
Color = clBtnFace
|
||||
end
|
||||
object RubberbandCreateColorButton: TColorButton
|
||||
@ -192,10 +198,11 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 23
|
||||
Top = 75
|
||||
Top = 83
|
||||
Width = 50
|
||||
BorderWidth = 2
|
||||
ButtonColorSize = 16
|
||||
ButtonColor = clBlack
|
||||
Color = clBtnFace
|
||||
end
|
||||
object RubberbandSelectColorLabel: TLabel
|
||||
@ -204,9 +211,9 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideRight.Control = RubberbandGroupBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 14
|
||||
Height = 18
|
||||
Top = 6
|
||||
Width = 178
|
||||
Width = 174
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'RubberbandSelectColorLabel'
|
||||
@ -219,9 +226,9 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideRight.Control = RubberbandGroupBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 14
|
||||
Top = 55
|
||||
Width = 178
|
||||
Height = 18
|
||||
Top = 59
|
||||
Width = 174
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'RubberbandCreateColorLabel'
|
||||
@ -234,9 +241,9 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideRight.Control = RubberbandGroupBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 19
|
||||
Top = 104
|
||||
Width = 178
|
||||
Height = 18
|
||||
Top = 112
|
||||
Width = 174
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'RubberbandSelectsGrandChildsCheckBox'
|
||||
@ -250,26 +257,28 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 226
|
||||
Top = 218
|
||||
Width = 337
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'FormEditMiscGroupBox'
|
||||
ClientHeight = 208
|
||||
ClientWidth = 333
|
||||
ClientHeight = 204
|
||||
ClientWidth = 329
|
||||
TabOrder = 2
|
||||
object GrabberColorButton: TColorButton
|
||||
AnchorSideLeft.Control = GrabberColorLabel
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = GrabberColorLabel
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 102
|
||||
Left = 128
|
||||
Height = 23
|
||||
Top = 94
|
||||
Top = 92
|
||||
Width = 50
|
||||
BorderWidth = 2
|
||||
ButtonColorSize = 16
|
||||
ButtonColor = clBlack
|
||||
Color = clBtnFace
|
||||
end
|
||||
object MarkerColorButton: TColorButton
|
||||
@ -277,12 +286,13 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = MarkerColorLabel
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 96
|
||||
Left = 120
|
||||
Height = 23
|
||||
Top = 118
|
||||
Top = 120
|
||||
Width = 50
|
||||
BorderWidth = 2
|
||||
ButtonColorSize = 16
|
||||
ButtonColor = clBlack
|
||||
Color = clBtnFace
|
||||
end
|
||||
object GrabberColorLabel: TLabel
|
||||
@ -290,9 +300,9 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideTop.Control = RightClickSelectsCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 14
|
||||
Top = 98
|
||||
Width = 90
|
||||
Height = 18
|
||||
Top = 94
|
||||
Width = 116
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'GrabberColorLabel'
|
||||
@ -303,9 +313,9 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideTop.Control = GrabberColorLabel
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 14
|
||||
Height = 18
|
||||
Top = 122
|
||||
Width = 84
|
||||
Width = 108
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'MarkerColorLabel'
|
||||
@ -316,8 +326,9 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideRight.Control = FormEditMiscGroupBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 19
|
||||
Width = 196
|
||||
Height = 18
|
||||
Top = 0
|
||||
Width = 245
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Right = 6
|
||||
Caption = 'ShowComponentCaptionsCheckBox'
|
||||
@ -330,9 +341,9 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideRight.Control = FormEditMiscGroupBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 19
|
||||
Top = 23
|
||||
Width = 151
|
||||
Height = 18
|
||||
Top = 22
|
||||
Width = 186
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Right = 6
|
||||
@ -346,9 +357,9 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideRight.Control = FormEditMiscGroupBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 19
|
||||
Top = 46
|
||||
Width = 198
|
||||
Height = 18
|
||||
Top = 44
|
||||
Width = 244
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Right = 6
|
||||
@ -362,9 +373,9 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideRight.Control = FormEditMiscGroupBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 19
|
||||
Top = 69
|
||||
Width = 153
|
||||
Height = 18
|
||||
Top = 66
|
||||
Width = 190
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 4
|
||||
Caption = 'RightClickSelectsCheckBox'
|
||||
@ -377,9 +388,9 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideRight.Control = FormEditMiscGroupBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 19
|
||||
Top = 146
|
||||
Width = 161
|
||||
Height = 18
|
||||
Top = 150
|
||||
Width = 198
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'DesignerPaintLazyCheckBox'
|
||||
@ -387,6 +398,20 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
ShowHint = True
|
||||
TabOrder = 4
|
||||
end
|
||||
object CreateCompFocusNameCheckBox: TCheckBox
|
||||
AnchorSideLeft.Control = DesignerPaintLazyCheckBox
|
||||
AnchorSideTop.Control = DesignerPaintLazyCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 18
|
||||
Top = 174
|
||||
Width = 233
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'CreateCompFocusNameCheckBox'
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 5
|
||||
end
|
||||
end
|
||||
object GuideLinesGroupBox: TGroupBox[3]
|
||||
AnchorSideLeft.Control = FormEditMiscGroupBox
|
||||
@ -405,18 +430,19 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'GuideLinesGroupBox'
|
||||
ClientHeight = 208
|
||||
ClientWidth = 190
|
||||
ClientHeight = 204
|
||||
ClientWidth = 186
|
||||
TabOrder = 3
|
||||
object GuideLineColorLeftTopButton: TColorButton
|
||||
AnchorSideTop.Control = GuideLineColorLeftTopLabel
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 23
|
||||
Top = 94
|
||||
Top = 98
|
||||
Width = 50
|
||||
BorderWidth = 2
|
||||
ButtonColorSize = 16
|
||||
ButtonColor = clBlack
|
||||
Color = clBtnFace
|
||||
end
|
||||
object GuideLineColorRightBottomButton: TColorButton
|
||||
@ -424,10 +450,11 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 23
|
||||
Top = 143
|
||||
Top = 151
|
||||
Width = 50
|
||||
BorderWidth = 2
|
||||
ButtonColorSize = 16
|
||||
ButtonColor = clBlack
|
||||
Color = clBtnFace
|
||||
end
|
||||
object GuideLineColorLeftTopLabel: TLabel
|
||||
@ -435,9 +462,9 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideRight.Control = GuideLinesGroupBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 14
|
||||
Height = 18
|
||||
Top = 74
|
||||
Width = 178
|
||||
Width = 174
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'GuideLineColorLeftTopLabel'
|
||||
@ -450,9 +477,9 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideRight.Control = GuideLinesGroupBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 14
|
||||
Top = 123
|
||||
Width = 178
|
||||
Height = 18
|
||||
Top = 127
|
||||
Width = 174
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'GuideLineColorRightBottomLabel'
|
||||
@ -463,8 +490,9 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideRight.Control = GuideLinesGroupBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 19
|
||||
Width = 178
|
||||
Height = 18
|
||||
Top = 0
|
||||
Width = 174
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'ShowGuideLinesCheckBox'
|
||||
@ -477,9 +505,9 @@ inherited FormEditorOptionsFrame: TFormEditorOptionsFrame
|
||||
AnchorSideRight.Control = GuideLinesGroupBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 19
|
||||
Top = 25
|
||||
Width = 178
|
||||
Height = 18
|
||||
Top = 24
|
||||
Width = 174
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'SnapToGuideLinesCheckBox'
|
||||
|
@ -34,6 +34,7 @@ type
|
||||
|
||||
TFormEditorOptionsFrame = class(TAbstractIDEOptionsEditor)
|
||||
AutoCreateFormsOnOpenCheckBox: TCheckBox;
|
||||
CreateCompFocusNameCheckBox: TCheckBox;
|
||||
DesignerPaintLazyCheckBox: TCheckBox;
|
||||
FormEditMiscGroupBox: TGroupBox;
|
||||
GrabberColorButton: TColorButton;
|
||||
@ -119,6 +120,10 @@ procedure TFormEditorOptionsFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
|
||||
Caption:=lisFEPaintDesignerItemsOnIdle;
|
||||
Hint:=lisFEPaintDesignerItemsOnIdleReduceOverheadForSlowCompu;
|
||||
end;
|
||||
with CreateCompFocusNameCheckBox do begin
|
||||
Caption:=lisFocusNameOnCreate;
|
||||
Hint:=lisAfterPuttingANewComponentOnADesignerFormFocusTheNa;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure SetupRubberbandBox;
|
||||
@ -162,6 +167,7 @@ begin
|
||||
RubberbandCreateColorButton.ButtonColor:=RubberbandCreationColor;
|
||||
RubberbandSelectsGrandChildsCheckBox.Checked:=RubberbandSelectsGrandChilds;
|
||||
DesignerPaintLazyCheckBox.Checked:=DesignerPaintLazy;
|
||||
CreateCompFocusNameCheckBox.Checked:=CreateComponentFocusNameProperty;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -189,6 +195,7 @@ begin
|
||||
RubberbandCreationColor:=RubberbandCreateColorButton.ButtonColor;
|
||||
RubberbandSelectsGrandChilds:=RubberbandSelectsGrandChildsCheckBox.Checked;
|
||||
DesignerPaintLazy:=DesignerPaintLazyCheckBox.Checked;
|
||||
CreateComponentFocusNameProperty:=CreateCompFocusNameCheckBox.Checked;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
100
ide/main.pp
100
ide/main.pp
@ -606,12 +606,12 @@ type
|
||||
// methods for 'new unit'
|
||||
function CreateNewCodeBuffer(Descriptor: TProjectFileDescriptor;
|
||||
NewOwner: TObject; NewFilename: string; var NewCodeBuffer: TCodeBuffer;
|
||||
var NewUnitName: string): TModalResult;
|
||||
var NewUnitName: string; AskForFilename: boolean): TModalResult;
|
||||
function CreateNewForm(NewUnitInfo: TUnitInfo;
|
||||
AncestorType: TPersistentClass; ResourceCode: TCodeBuffer; UseCreateFormStatements: Boolean): TModalResult;
|
||||
|
||||
// methods for 'save unit'
|
||||
function DoShowSaveFileAsDialog(AnUnitInfo: TUnitInfo;
|
||||
function DoShowSaveFileAsDialog(var AFilename: string; AnUnitInfo: TUnitInfo;
|
||||
var ResourceCode: TCodeBuffer; CanAbort: boolean): TModalResult;
|
||||
function DoSaveUnitComponent(AnUnitInfo: TUnitInfo;
|
||||
ResourceCode, LFMCode: TCodeBuffer; Flags: TSaveFlags): TModalResult;
|
||||
@ -2477,6 +2477,7 @@ var
|
||||
Category: TNewIDEItemCategory;
|
||||
Template: TNewIDEItemTemplate;
|
||||
Desc: TProjectFileDescriptor;
|
||||
Flags: TNewFlags;
|
||||
begin
|
||||
Category:=NewIDEItems.FindByName(FileDescGroupName);
|
||||
Template:=Category.FindTemplateByName(EnvironmentOptions.NewUnitTemplate);
|
||||
@ -2484,7 +2485,10 @@ begin
|
||||
Desc:=TNewItemProjectFile(Template).Descriptor
|
||||
else
|
||||
Desc:=FileDescriptorUnit;
|
||||
DoNewEditorFile(Desc,'','',[nfOpenInEditor,nfCreateDefaultSrc]);
|
||||
Flags:=[nfOpenInEditor,nfCreateDefaultSrc];
|
||||
if (not Project1.IsVirtual) and EnvironmentOptions.AskForFilenameOnNewFile then
|
||||
Flags:=Flags+[nfAskForFilename,nfSave];
|
||||
DoNewEditorFile(Desc,'','',Flags);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.mnuNewFormClicked(Sender: TObject);
|
||||
@ -2492,6 +2496,7 @@ var
|
||||
Category: TNewIDEItemCategory;
|
||||
Template: TNewIDEItemTemplate;
|
||||
Desc: TProjectFileDescriptor;
|
||||
Flags: TNewFlags;
|
||||
begin
|
||||
Category:=NewIDEItems.FindByName(FileDescGroupName);
|
||||
Template:=Category.FindTemplateByName(EnvironmentOptions.NewFormTemplate);
|
||||
@ -2499,7 +2504,10 @@ begin
|
||||
Desc:=TNewItemProjectFile(Template).Descriptor
|
||||
else
|
||||
Desc:=FileDescriptorForm;
|
||||
DoNewEditorFile(Desc,'','',[nfOpenInEditor,nfCreateDefaultSrc]);
|
||||
Flags:=[nfOpenInEditor,nfCreateDefaultSrc];
|
||||
if (not Project1.IsVirtual) and EnvironmentOptions.AskForFilenameOnNewFile then
|
||||
Flags:=Flags+[nfAskForFilename,nfSave];
|
||||
DoNewEditorFile(Desc,'','',Flags);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.mnuNewOtherClicked(Sender: TObject);
|
||||
@ -4256,12 +4264,17 @@ end;
|
||||
|
||||
function TMainIDE.CreateNewCodeBuffer(Descriptor: TProjectFileDescriptor;
|
||||
NewOwner: TObject; NewFilename: string;
|
||||
var NewCodeBuffer: TCodeBuffer; var NewUnitName: string): TModalResult;
|
||||
var NewCodeBuffer: TCodeBuffer; var NewUnitName: string;
|
||||
AskForFilename: boolean): TModalResult;
|
||||
var
|
||||
NewShortFilename: String;
|
||||
NewFileExt: String;
|
||||
SearchFlags: TSearchIDEFileFlags;
|
||||
ResourceCode: TCodeBuffer;
|
||||
CanAbort: Boolean;
|
||||
begin
|
||||
CanAbort:=false;
|
||||
|
||||
//debugln('TMainIDE.CreateNewCodeBuffer START NewFilename=',NewFilename,' ',Descriptor.DefaultFilename,' ',Descriptor.ClassName);
|
||||
NewUnitName:='';
|
||||
if NewFilename='' then begin
|
||||
@ -4302,6 +4315,12 @@ begin
|
||||
+lowercase(ExtractFileName(NewFilename));
|
||||
end;
|
||||
|
||||
if AskForFilename then begin
|
||||
ResourceCode:=nil;
|
||||
Result:=DoShowSaveFileAsDialog(NewFilename,nil,ResourceCode,CanAbort);
|
||||
if Result<>mrOk then exit;
|
||||
end;
|
||||
|
||||
NewCodeBuffer:=CodeToolBoss.CreateFile(NewFilename);
|
||||
if NewCodeBuffer<>nil then
|
||||
Result:=mrOk
|
||||
@ -4477,7 +4496,8 @@ begin
|
||||
Result:=mrCancel;
|
||||
end;
|
||||
|
||||
function TMainIDE.DoShowSaveFileAsDialog(AnUnitInfo: TUnitInfo;
|
||||
function TMainIDE.DoShowSaveFileAsDialog(var AFilename: string;
|
||||
AnUnitInfo: TUnitInfo;
|
||||
var ResourceCode: TCodeBuffer; CanAbort: boolean): TModalResult;
|
||||
var
|
||||
SaveDialog: TSaveDialog;
|
||||
@ -4490,28 +4510,34 @@ var
|
||||
OldUnitName: String;
|
||||
IsPascal: Boolean;
|
||||
begin
|
||||
SrcEdit:=GetSourceEditorForUnitInfo(AnUnitInfo);
|
||||
if AnUnitInfo<>nil then
|
||||
SrcEdit:=GetSourceEditorForUnitInfo(AnUnitInfo)
|
||||
else
|
||||
SrcEdit:=nil;
|
||||
//debugln('TMainIDE.DoShowSaveFileAsDialog ',AnUnitInfo.Filename);
|
||||
|
||||
// try to keep the old filename and extension
|
||||
SaveAsFileExt:=ExtractFileExt(AnUnitInfo.FileName);
|
||||
if SaveAsFileExt='' then begin
|
||||
if SrcEdit.SyntaxHighlighterType in [lshFreePascal, lshDelphi]
|
||||
SaveAsFileExt:=ExtractFileExt(AFileName);
|
||||
if (SaveAsFileExt='') and (SrcEdit<>nil) then begin
|
||||
if (SrcEdit.SyntaxHighlighterType in [lshFreePascal, lshDelphi])
|
||||
then
|
||||
SaveAsFileExt:=PascalExtension[EnvironmentOptions.PascalFileExtension]
|
||||
else
|
||||
SaveAsFileExt:=EditorOpts.HighlighterList.GetDefaultFilextension(
|
||||
SrcEdit.SyntaxHighlighterType);
|
||||
end;
|
||||
IsPascal:=FilenameIsPascalSource(AnUnitInfo.Filename);
|
||||
if IsPascal then
|
||||
OldUnitName:=AnUnitInfo.ParseUnitNameFromSource(false)
|
||||
else
|
||||
IsPascal:=FilenameIsPascalSource(AFilename);
|
||||
if IsPascal then begin
|
||||
if AnUnitInfo<>nil then
|
||||
OldUnitName:=AnUnitInfo.ParseUnitNameFromSource(false)
|
||||
else
|
||||
OldUnitName:=ExtractFileNameOnly(AFilename);
|
||||
end else
|
||||
OldUnitName:='';
|
||||
//debugln('TMainIDE.DoShowSaveFileAsDialog sourceunitname=',OldUnitName);
|
||||
SaveAsFilename:=OldUnitName;
|
||||
if SaveAsFilename='' then
|
||||
SaveAsFilename:=ExtractFileNameOnly(AnUnitInfo.Filename);
|
||||
SaveAsFilename:=ExtractFileNameOnly(AFilename);
|
||||
if SaveAsFilename='' then
|
||||
SaveAsFilename:=lisnoname;
|
||||
|
||||
@ -4522,14 +4548,15 @@ begin
|
||||
SaveDialog.Title:=lisSaveSpace+SaveAsFilename+' (*'+SaveAsFileExt+')';
|
||||
SaveDialog.FileName:=SaveAsFilename+SaveAsFileExt;
|
||||
// if this is a project file, start in project directory
|
||||
if AnUnitInfo.IsPartOfProject and (not Project1.IsVirtual)
|
||||
and (not FileIsInPath(SaveDialog.InitialDir,Project1.ProjectDirectory)) then
|
||||
begin
|
||||
if (AnUnitInfo=nil)
|
||||
or (AnUnitInfo.IsPartOfProject and (not Project1.IsVirtual)
|
||||
and (not FileIsInPath(SaveDialog.InitialDir,Project1.ProjectDirectory)))
|
||||
then begin
|
||||
SaveDialog.InitialDir:=Project1.ProjectDirectory;
|
||||
end;
|
||||
// if this is a package file, then start in package directory
|
||||
PkgDefaultDirectory:=
|
||||
PkgBoss.GetDefaultSaveDirectoryForFile(AnUnitInfo.Filename);
|
||||
PkgBoss.GetDefaultSaveDirectoryForFile(AFilename);
|
||||
if (PkgDefaultDirectory<>'')
|
||||
and (not FileIsInPath(SaveDialog.InitialDir,PkgDefaultDirectory)) then
|
||||
SaveDialog.InitialDir:=PkgDefaultDirectory;
|
||||
@ -4618,8 +4645,8 @@ begin
|
||||
end;
|
||||
|
||||
// check overwrite existing file
|
||||
if (AnUnitInfo.IsVirtual
|
||||
or (CompareFilenames(NewFilename,AnUnitInfo.Filename)<>0))
|
||||
if ((not FilenameIsAbsolute(AFilename))
|
||||
or (CompareFilenames(NewFilename,AFilename)<>0))
|
||||
and FileExistsUTF8(NewFilename) then begin
|
||||
ACaption:=lisOverwriteFile;
|
||||
AText:=Format(lisAFileAlreadyExistsReplaceIt, ['"', NewFilename, '"', #13]);
|
||||
@ -4629,7 +4656,15 @@ begin
|
||||
if Result=mrCancel then exit;
|
||||
end;
|
||||
|
||||
Result:=DoRenameUnit(AnUnitInfo,NewFilename,NewUnitName,ResourceCode);
|
||||
if AnUnitInfo<>nil then begin
|
||||
// rename unit
|
||||
Result:=DoRenameUnit(AnUnitInfo,NewFilename,NewUnitName,ResourceCode);
|
||||
AFilename:=AnUnitInfo.Filename;
|
||||
if Result<>mrOk then exit;
|
||||
end else begin
|
||||
Result:=mrOk;
|
||||
AFilename:=NewFilename;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TLRTGrubber }
|
||||
@ -7134,7 +7169,7 @@ begin
|
||||
|
||||
// create new codebuffer and apply naming conventions
|
||||
Result:=CreateNewCodeBuffer(NewFileDescriptor,NewOwner,NewFilename,NewBuffer,
|
||||
NewUnitName);
|
||||
NewUnitName,nfAskForFilename in NewFlags);
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
NewFilename:=NewBuffer.Filename;
|
||||
@ -7415,7 +7450,8 @@ begin
|
||||
|
||||
if [sfSaveAs,sfSaveToTestDir]*Flags=[sfSaveAs] then begin
|
||||
// let user choose a filename
|
||||
Result:=DoShowSaveFileAsDialog(ActiveUnitInfo,ResourceCode,CanAbort);
|
||||
NewFilename:=OldFilename;
|
||||
Result:=DoShowSaveFileAsDialog(NewFilename,ActiveUnitInfo,ResourceCode,CanAbort);
|
||||
if Result in [mrIgnore,mrOk] then
|
||||
Result:=mrCancel
|
||||
else
|
||||
@ -11886,8 +11922,24 @@ begin
|
||||
end;
|
||||
|
||||
procedure TMainIDE.OnDesignerComponentAdded(Sender: TObject);
|
||||
var
|
||||
Grid: TOICustomPropertyGrid;
|
||||
Row: TOIPropertyGridRow;
|
||||
begin
|
||||
TComponentPalette(IDEComponentPalette).DoAfterComponentAdded;
|
||||
if EnvironmentOptions.CreateComponentFocusNameProperty
|
||||
and (ObjectInspector1<>nil) then begin
|
||||
if ObjectInspector1.ShowFavorites then
|
||||
Grid:=ObjectInspector1.FavouriteGrid
|
||||
else
|
||||
Grid:=ObjectInspector1.PropertyGrid;
|
||||
ObjectInspector1.ActivateGrid(Grid);
|
||||
Row:=Grid.GetRowByPath('Name');
|
||||
if Row<>nil then begin
|
||||
Grid.ItemIndex:=Row.Index;
|
||||
ObjectInspector1.FocusGrid(Grid);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.OnDesignerSetDesigning(Sender: TObject;
|
||||
|
Loading…
Reference in New Issue
Block a user