mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-03 06:59:29 +01:00
IDE: new other: save/restore last created
git-svn-id: trunk@31605 -
This commit is contained in:
parent
12f390c94f
commit
7fcd93177c
@ -210,6 +210,8 @@ type
|
||||
FLastConvertDelphiPackage: string;
|
||||
FLastConvertDelphiProject: string;
|
||||
FLastConvertDelphiUnit: string;
|
||||
FNewFileType: string;
|
||||
FNewProjectType: string;
|
||||
FReplaceHistory: TStringList;
|
||||
FFindInFilesPathHistory: TStringList;
|
||||
FFindInFilesMaskHistory: TStringList;
|
||||
@ -301,6 +303,10 @@ type
|
||||
property DiffText2OnlySelection: boolean read FDiffText2OnlySelection
|
||||
write FDiffText2OnlySelection;
|
||||
|
||||
// new dialog
|
||||
property NewProjectType: string read FNewProjectType write FNewProjectType;
|
||||
property NewFileType: string read FNewFileType write FNewFileType;
|
||||
|
||||
// Delphi conversion
|
||||
property LastConvertDelphiProject: string read FLastConvertDelphiProject
|
||||
write FLastConvertDelphiProject;
|
||||
@ -466,6 +472,8 @@ begin
|
||||
FDiffFlags:=DefaultDiffFlags;
|
||||
FDiffText2:='';
|
||||
FDiffText2OnlySelection:=false;
|
||||
FNewProjectType:='';
|
||||
FNewFileType:='';
|
||||
FFPCConfigCache.Clear;
|
||||
FLastConvertDelphiProject:='';
|
||||
FLastConvertDelphiUnit:='';
|
||||
@ -542,7 +550,11 @@ begin
|
||||
FDiffText2:=XMLConfig.GetValue(Path+'DiffDialog/Text2/Name','');
|
||||
FDiffText2OnlySelection:=
|
||||
XMLConfig.GetValue(Path+'DiffDialog/Text2/OnlySelection',false);
|
||||
|
||||
|
||||
// new items
|
||||
FNewProjectType:=XMLConfig.GetValue(Path+'New/Project/Type','');
|
||||
FNewFileType:=XMLConfig.GetValue(Path+'New/File/Type','');
|
||||
|
||||
// delphi conversion
|
||||
FLastConvertDelphiProject:=XMLConfig.GetValue(Path+'Conversion/Delphi/Project','');
|
||||
FLastConvertDelphiPackage:=XMLConfig.GetValue(Path+'Conversion/Delphi/Package','');
|
||||
@ -611,6 +623,11 @@ begin
|
||||
XMLConfig.SetDeleteValue(Path+'DiffDialog/Text2/Name',FDiffText2,'');
|
||||
XMLConfig.SetDeleteValue(Path+'DiffDialog/Text2/OnlySelection',
|
||||
FDiffText2OnlySelection,false);
|
||||
|
||||
// new items
|
||||
XMLConfig.SetDeleteValue(Path+'New/Project/Type',FNewProjectType,'');
|
||||
XMLConfig.SetDeleteValue(Path+'New/File/Type',FNewFileType,'');
|
||||
|
||||
// delphi conversion
|
||||
XMLConfig.SetDeleteValue(Path+'Conversion/Delphi/Project',
|
||||
FLastConvertDelphiProject,'');
|
||||
|
||||
@ -8,27 +8,27 @@ object NewOtherDialog: TNewOtherDialog
|
||||
ClientHeight = 421
|
||||
ClientWidth = 561
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '0.9.29'
|
||||
LCLVersion = '0.9.31'
|
||||
object Panel1: TPanel
|
||||
Left = 6
|
||||
Height = 377
|
||||
Height = 369
|
||||
Top = 6
|
||||
Width = 549
|
||||
Align = alClient
|
||||
BorderSpacing.Around = 6
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 377
|
||||
ClientHeight = 369
|
||||
ClientWidth = 549
|
||||
TabOrder = 0
|
||||
object ItemsTreeView: TTreeView
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = Owner
|
||||
Left = 0
|
||||
Height = 377
|
||||
Height = 369
|
||||
Top = 0
|
||||
Width = 263
|
||||
Align = alClient
|
||||
DefaultItemHeight = 15
|
||||
DefaultItemHeight = 19
|
||||
ReadOnly = True
|
||||
ScrollBars = ssAutoBoth
|
||||
TabOrder = 0
|
||||
@ -41,21 +41,20 @@ object NewOtherDialog: TNewOtherDialog
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = Owner
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 268
|
||||
Height = 377
|
||||
Height = 369
|
||||
Top = 0
|
||||
Width = 281
|
||||
Align = alRight
|
||||
Caption = 'DescriptionGroupBox'
|
||||
ClientHeight = 359
|
||||
ClientWidth = 277
|
||||
ClientHeight = 348
|
||||
ClientWidth = 273
|
||||
TabOrder = 1
|
||||
object DescriptionLabel: TLabel
|
||||
Left = 6
|
||||
Height = 14
|
||||
Height = 18
|
||||
Top = 6
|
||||
Width = 265
|
||||
Width = 261
|
||||
Align = alTop
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'DescriptionLabel'
|
||||
@ -64,9 +63,9 @@ object NewOtherDialog: TNewOtherDialog
|
||||
end
|
||||
object InheritableComponentsListView: TListView
|
||||
Left = 0
|
||||
Height = 333
|
||||
Top = 26
|
||||
Width = 277
|
||||
Height = 318
|
||||
Top = 30
|
||||
Width = 273
|
||||
Align = alClient
|
||||
Columns = <
|
||||
item
|
||||
@ -78,7 +77,6 @@ object NewOtherDialog: TNewOtherDialog
|
||||
Width = 250
|
||||
end>
|
||||
HideSelection = False
|
||||
ItemIndex = -1
|
||||
ReadOnly = True
|
||||
RowSelect = True
|
||||
ScrollBars = ssAutoBoth
|
||||
@ -88,7 +86,7 @@ object NewOtherDialog: TNewOtherDialog
|
||||
end
|
||||
object Splitter1: TSplitter
|
||||
Left = 263
|
||||
Height = 377
|
||||
Height = 369
|
||||
Top = 0
|
||||
Width = 5
|
||||
Align = alRight
|
||||
@ -97,8 +95,8 @@ object NewOtherDialog: TNewOtherDialog
|
||||
end
|
||||
object ButtonPanel: TButtonPanel
|
||||
Left = 6
|
||||
Height = 26
|
||||
Top = 389
|
||||
Height = 34
|
||||
Top = 381
|
||||
Width = 549
|
||||
OKButton.Name = 'OKButton'
|
||||
OKButton.Caption = '&OK'
|
||||
|
||||
@ -40,10 +40,10 @@ interface
|
||||
|
||||
uses
|
||||
Buttons, SysUtils, Classes, LCLProc, ComCtrls, Controls, Dialogs,
|
||||
Forms, StdCtrls, ExtCtrls, FileProcs,
|
||||
Forms, StdCtrls, ExtCtrls, FileProcs, ButtonPanel,
|
||||
IDEWindowIntf, IDEImagesIntf, NewItemIntf, PackageIntf, ProjectIntf,
|
||||
LazIDEIntf, IDEHelpIntf,
|
||||
LazarusIDEStrConsts, Project, MainIntf, ButtonPanel;
|
||||
InputHistory, LazarusIDEStrConsts, Project, MainIntf;
|
||||
|
||||
type
|
||||
{ TNewLazIDEItemCategory }
|
||||
@ -136,6 +136,7 @@ type
|
||||
procedure FillItemsTree;
|
||||
procedure SetupComponents;
|
||||
procedure UpdateDescription;
|
||||
function FindItem(const aName: string): TTreeNode;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
@ -189,11 +190,16 @@ begin
|
||||
exit;
|
||||
end;
|
||||
FNewItem := TNewIDEItemTemplate(ANode.Data);
|
||||
|
||||
|
||||
InputHistories.NewFileType:=FNewItem.Name;
|
||||
//debugln(['TNewOtherDialog.OKButtonClick InputHistories.NewFileType=',InputHistories.NewFileType]);
|
||||
|
||||
// if the selected item is an inherited one
|
||||
if FNewItem is TNewItemProjectFile then
|
||||
begin
|
||||
//
|
||||
InputHistories.NewProjectType:=FNewItem.Name;
|
||||
|
||||
NewFile:=TNewItemProjectFile(FNewItem);
|
||||
if (NewFile.Descriptor is TFileDescInheritedItem) then
|
||||
begin
|
||||
@ -368,7 +374,22 @@ begin
|
||||
DescriptionLabel.Caption := Desc;
|
||||
end;
|
||||
|
||||
function TNewOtherDialog.FindItem(const aName: string): TTreeNode;
|
||||
begin
|
||||
if aName='' then exit(nil);
|
||||
Result:=ItemsTreeView.Items.GetFirstNode;
|
||||
while Result<>nil do begin
|
||||
if (Result.Data<>nil)
|
||||
and (TObject(Result.Data) is TNewIDEItemTemplate)
|
||||
and (CompareText(TNewIDEItemTemplate(Result.Data).Name,aName)=0) then
|
||||
exit;
|
||||
Result:=Result.GetNext;
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TNewOtherDialog.Create(TheOwner: TComponent);
|
||||
var
|
||||
Node: TTreeNode;
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
Caption := lisMenuNewOther;
|
||||
@ -377,6 +398,12 @@ begin
|
||||
FillProjectInheritableItemsList;
|
||||
InheritableComponentsListView.Visible := false;
|
||||
IDEDialogLayoutList.ApplyLayout(Self, 570, 400);
|
||||
|
||||
Node:=FindItem(InputHistories.NewFileType);
|
||||
if Node=nil then
|
||||
Node:=FindItem(InputHistories.NewProjectType);
|
||||
if Node<>nil then
|
||||
ItemsTreeView.Selected:=Node;
|
||||
end;
|
||||
|
||||
destructor TNewOtherDialog.Destroy;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user