mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-16 16:37:47 +02:00
IDE: Improve adding a new file to package, reuse the "New..." dialog. Issue #28097, patch from Alexey Torgashin.
git-svn-id: trunk@49096 -
This commit is contained in:
parent
33cd7f6258
commit
4be547210a
@ -8,23 +8,23 @@ object NewOtherDialog: TNewOtherDialog
|
||||
ClientHeight = 421
|
||||
ClientWidth = 561
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.1'
|
||||
LCLVersion = '1.5'
|
||||
object Panel1: TPanel
|
||||
Left = 6
|
||||
Height = 370
|
||||
Height = 374
|
||||
Top = 6
|
||||
Width = 549
|
||||
Align = alClient
|
||||
BorderSpacing.Around = 6
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 370
|
||||
ClientHeight = 374
|
||||
ClientWidth = 549
|
||||
TabOrder = 0
|
||||
object ItemsTreeView: TTreeView
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = Owner
|
||||
Left = 0
|
||||
Height = 370
|
||||
Height = 374
|
||||
Top = 0
|
||||
Width = 263
|
||||
Align = alClient
|
||||
@ -41,19 +41,19 @@ object NewOtherDialog: TNewOtherDialog
|
||||
AnchorSideTop.Control = Owner
|
||||
AnchorSideRight.Control = Owner
|
||||
Left = 268
|
||||
Height = 370
|
||||
Height = 374
|
||||
Top = 0
|
||||
Width = 281
|
||||
Align = alRight
|
||||
Caption = 'DescriptionGroupBox'
|
||||
ClientHeight = 349
|
||||
ClientWidth = 273
|
||||
ClientHeight = 353
|
||||
ClientWidth = 277
|
||||
TabOrder = 1
|
||||
object DescriptionLabel: TLabel
|
||||
Left = 6
|
||||
Height = 17
|
||||
Top = 6
|
||||
Width = 261
|
||||
Width = 265
|
||||
Align = alTop
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'DescriptionLabel'
|
||||
@ -62,9 +62,9 @@ object NewOtherDialog: TNewOtherDialog
|
||||
end
|
||||
object InheritableComponentsListView: TListView
|
||||
Left = 0
|
||||
Height = 320
|
||||
Height = 324
|
||||
Top = 29
|
||||
Width = 273
|
||||
Width = 277
|
||||
Align = alClient
|
||||
Columns = <
|
||||
item
|
||||
@ -86,7 +86,7 @@ object NewOtherDialog: TNewOtherDialog
|
||||
end
|
||||
object Splitter1: TSplitter
|
||||
Left = 263
|
||||
Height = 370
|
||||
Height = 374
|
||||
Top = 0
|
||||
Width = 5
|
||||
Align = alRight
|
||||
@ -95,8 +95,8 @@ object NewOtherDialog: TNewOtherDialog
|
||||
end
|
||||
object ButtonPanel: TButtonPanel
|
||||
Left = 6
|
||||
Height = 33
|
||||
Top = 382
|
||||
Height = 29
|
||||
Top = 386
|
||||
Width = 549
|
||||
OKButton.Name = 'OKButton'
|
||||
OKButton.DefaultCaption = True
|
||||
|
@ -133,31 +133,34 @@ type
|
||||
ImageIndexTemplate: integer;
|
||||
FNewItem: TNewIDEItemTemplate;
|
||||
procedure FillProjectInheritableItemsList;
|
||||
procedure FillItemsTree;
|
||||
procedure FillItemsTree(AOnlyModules: boolean);
|
||||
procedure SetupComponents;
|
||||
procedure UpdateDescription;
|
||||
function FindItem(const aName: string): TTreeNode;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
constructor Create(TheOwner: TComponent; AOnlyModules: boolean);
|
||||
destructor Destroy; override;
|
||||
public
|
||||
property NewItem: TNewIDEItemTemplate Read FNewItem;
|
||||
end;
|
||||
|
||||
function ShowNewIDEItemDialog(out NewItem: TNewIDEItemTemplate): TModalResult;
|
||||
function ShowNewIDEItemDialog(out NewItem: TNewIDEItemTemplate;
|
||||
AOnlyModules: boolean = false): TModalResult;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses Math;
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
function ShowNewIDEItemDialog(out NewItem: TNewIDEItemTemplate): TModalResult;
|
||||
function ShowNewIDEItemDialog(out NewItem: TNewIDEItemTemplate;
|
||||
AOnlyModules: boolean): TModalResult;
|
||||
var
|
||||
NewOtherDialog: TNewOtherDialog;
|
||||
begin
|
||||
NewItem := nil;
|
||||
NewOtherDialog := TNewOtherDialog.Create(nil);
|
||||
NewOtherDialog := TNewOtherDialog.Create(nil, AOnlyModules);
|
||||
Result := NewOtherDialog.ShowModal;
|
||||
if Result = mrOk then
|
||||
NewItem := NewOtherDialog.NewItem;
|
||||
@ -278,37 +281,35 @@ Begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TNewOtherDialog.FillItemsTree;
|
||||
procedure TNewOtherDialog.FillItemsTree(AOnlyModules: boolean);
|
||||
var
|
||||
NewParentNode: TTreeNode;
|
||||
CategoryID: integer;
|
||||
Category: TNewIDEItemCategory;
|
||||
TemplateID: integer;
|
||||
Template: TNewIDEItemTemplate;
|
||||
NewParentNode, ChildNode: TTreeNode;
|
||||
CategoryID, TemplateID, CategoryCount: integer;
|
||||
Category: TNewIDEItemCategory;
|
||||
Template: TNewIDEItemTemplate;
|
||||
begin
|
||||
ItemsTreeView.BeginUpdate;
|
||||
ItemsTreeView.Items.Clear;
|
||||
for CategoryID := 0 to NewIDEItems.Count - 1 do
|
||||
CategoryCount := NewIDEItems.Count;
|
||||
if AOnlyModules and (CategoryCount > 1) then
|
||||
CategoryCount := 1;
|
||||
for CategoryID := 0 to CategoryCount-1 do
|
||||
begin
|
||||
Category := NewIDEItems[CategoryID];
|
||||
if not Category.VisibleInNewDialog then continue;
|
||||
NewParentNode := ItemsTreeView.Items.AddObject(nil,
|
||||
Category.LocalizedName, Category);
|
||||
|
||||
NewParentNode := ItemsTreeView.Items.AddObject(nil,Category.LocalizedName, Category);
|
||||
NewParentNode.ImageIndex := ImageIndexFolder;
|
||||
NewParentNode.SelectedIndex := ImageIndexFolder;
|
||||
|
||||
for TemplateID := 0 to Category.Count - 1 do
|
||||
begin
|
||||
Template := Category[TemplateID];
|
||||
//DebugLn('TNewOtherDialog.FillItemsTree ',Template.Name,' ',dbgs(Template.VisibleInNewDialog));
|
||||
if Template.VisibleInNewDialog then
|
||||
with ItemsTreeView.Items.AddChildObject(NewParentNode,
|
||||
Template.LocalizedName, Template)
|
||||
do begin
|
||||
ImageIndex := ImageIndexTemplate;
|
||||
SelectedIndex := ImageIndexTemplate;
|
||||
end;
|
||||
begin
|
||||
ChildNode := ItemsTreeView.Items.AddChildObject(NewParentNode, Template.LocalizedName, Template);
|
||||
ChildNode.ImageIndex := ImageIndexTemplate;
|
||||
ChildNode.SelectedIndex := ImageIndexTemplate;
|
||||
end;
|
||||
end;
|
||||
NewParentNode.Expand(True);
|
||||
end;
|
||||
@ -388,14 +389,14 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TNewOtherDialog.Create(TheOwner: TComponent);
|
||||
constructor TNewOtherDialog.Create(TheOwner: TComponent; AOnlyModules: boolean);
|
||||
var
|
||||
Node: TTreeNode;
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
Caption := lisMenuNewOther;
|
||||
SetupComponents;
|
||||
FillItemsTree;
|
||||
FillItemsTree(AOnlyModules);
|
||||
FillProjectInheritableItemsList;
|
||||
InheritableComponentsListView.Visible := false;
|
||||
IDEDialogLayoutList.ApplyLayout(Self, 570, 400);
|
||||
|
@ -3,7 +3,6 @@ object AddToPackageDlg: TAddToPackageDlg
|
||||
Height = 357
|
||||
Top = 535
|
||||
Width = 658
|
||||
ActiveControl = PageControl1
|
||||
BorderIcons = [biSystemMenu, biMaximize]
|
||||
Caption = 'Add to package'
|
||||
ClientHeight = 357
|
||||
@ -15,450 +14,22 @@ object AddToPackageDlg: TAddToPackageDlg
|
||||
OnKeyDown = AddToPackageDlgKeyDown
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.5'
|
||||
object PageControl1: TPageControl
|
||||
object AddToPackageBtnPanel: TPanel
|
||||
Left = 0
|
||||
Height = 319
|
||||
Top = 0
|
||||
Width = 658
|
||||
ActivePage = NewFilePage
|
||||
Align = alClient
|
||||
TabIndex = 0
|
||||
TabOrder = 0
|
||||
OnChange = PageControl1Change
|
||||
object NewFilePage: TTabSheet
|
||||
Caption = 'New File'
|
||||
ClientHeight = 291
|
||||
ClientWidth = 650
|
||||
OnResize = NewFilePageResize
|
||||
object NewFileTreeView: TTreeView
|
||||
Left = 6
|
||||
Height = 279
|
||||
Top = 6
|
||||
Width = 249
|
||||
Align = alLeft
|
||||
BorderSpacing.Around = 6
|
||||
DefaultItemHeight = 18
|
||||
ReadOnly = True
|
||||
RightClickSelect = True
|
||||
TabOrder = 0
|
||||
OnClick = NewFileTreeViewClick
|
||||
OnDblClick = NewFileTreeViewDblClick
|
||||
OnSelectionChanged = NewFileTreeViewSelectionChanged
|
||||
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoRightClickSelect, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips]
|
||||
end
|
||||
object NewFileDescriptionGroupBox: TGroupBox
|
||||
AnchorSideLeft.Control = NewFileTreeView
|
||||
Left = 261
|
||||
Height = 279
|
||||
Top = 6
|
||||
Width = 383
|
||||
Align = alClient
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'NewFileDescriptionGroupBox'
|
||||
ClientHeight = 259
|
||||
ClientWidth = 379
|
||||
TabOrder = 1
|
||||
object NewFileHelpLabel: TLabel
|
||||
Left = 4
|
||||
Height = 251
|
||||
Top = 4
|
||||
Width = 371
|
||||
Align = alClient
|
||||
Anchors = []
|
||||
BorderSpacing.Around = 4
|
||||
Caption = 'NewFileHelpLabel'
|
||||
ParentColor = False
|
||||
WordWrap = True
|
||||
end
|
||||
end
|
||||
end
|
||||
object NewComponentPage: TTabSheet
|
||||
Caption = 'New Component'
|
||||
ClientHeight = 291
|
||||
ClientWidth = 650
|
||||
OnResize = NewComponentPageResize
|
||||
object AncestorTypeLabel: TLabel
|
||||
AnchorSideTop.Control = AncestorComboBox
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 5
|
||||
Height = 15
|
||||
Top = 10
|
||||
Width = 101
|
||||
Caption = 'AncestorTypeLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object ClassNameLabel: TLabel
|
||||
AnchorSideTop.Control = ClassNameEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 5
|
||||
Height = 15
|
||||
Top = 39
|
||||
Width = 87
|
||||
Caption = 'ClassNameLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object PalettePageLabel: TLabel
|
||||
AnchorSideTop.Control = PalettePageCombobox
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 5
|
||||
Height = 15
|
||||
Top = 68
|
||||
Width = 90
|
||||
Caption = 'PalettePageLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object ComponentUnitFileLabel: TLabel
|
||||
AnchorSideTop.Control = ComponentUnitFileEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 5
|
||||
Height = 15
|
||||
Top = 97
|
||||
Width = 132
|
||||
Caption = 'ComponentUnitFileLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object ComponentUnitNameLabel: TLabel
|
||||
AnchorSideTop.Control = ComponentUnitNameEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 5
|
||||
Height = 15
|
||||
Top = 126
|
||||
Width = 146
|
||||
Caption = 'ComponentUnitNameLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object AncestorComboBox: TComboBox
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = NewComponentPage
|
||||
Left = 184
|
||||
Height = 23
|
||||
Top = 6
|
||||
Width = 200
|
||||
BorderSpacing.Top = 6
|
||||
ItemHeight = 15
|
||||
OnChange = AncestorComboBoxChange
|
||||
OnCloseUp = AncestorComboBoxCloseUp
|
||||
TabOrder = 0
|
||||
Text = 'AncestorComboBox'
|
||||
end
|
||||
object AncestorShowAllCheckBox: TCheckBox
|
||||
AnchorSideLeft.Control = AncestorComboBox
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = AncestorComboBox
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 390
|
||||
Height = 19
|
||||
Top = 8
|
||||
Width = 162
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'AncestorShowAllCheckBox'
|
||||
Checked = True
|
||||
OnClick = AncestorShowAllCheckBoxClick
|
||||
State = cbChecked
|
||||
TabOrder = 1
|
||||
end
|
||||
object ClassNameEdit: TEdit
|
||||
AnchorSideLeft.Control = AncestorComboBox
|
||||
AnchorSideTop.Control = AncestorComboBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = AncestorComboBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 184
|
||||
Height = 23
|
||||
Top = 35
|
||||
Width = 200
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
OnChange = ClassNameEditChange
|
||||
TabOrder = 2
|
||||
Text = 'ClassNameEdit'
|
||||
end
|
||||
object PalettePageCombobox: TComboBox
|
||||
AnchorSideLeft.Control = AncestorComboBox
|
||||
AnchorSideTop.Control = ClassNameEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = AncestorComboBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 184
|
||||
Height = 23
|
||||
Top = 64
|
||||
Width = 200
|
||||
BorderSpacing.Top = 6
|
||||
ItemHeight = 15
|
||||
TabOrder = 3
|
||||
Text = 'PalettePageCombobox'
|
||||
end
|
||||
object ComponentUnitFileEdit: TEdit
|
||||
AnchorSideLeft.Control = AncestorComboBox
|
||||
AnchorSideTop.Control = PalettePageCombobox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = ComponentUnitFileBrowseButton
|
||||
Left = 184
|
||||
Height = 23
|
||||
Top = 93
|
||||
Width = 383
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
TabOrder = 4
|
||||
Text = 'ComponentUnitFileEdit'
|
||||
end
|
||||
object ComponentUnitFileBrowseButton: TButton
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = ComponentUnitFileEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = ComponentUnitFileShortenButton
|
||||
Left = 567
|
||||
Height = 25
|
||||
Hint = 'Save file dialog'
|
||||
Top = 92
|
||||
Width = 35
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
Caption = '...'
|
||||
OnClick = ComponentUnitFileBrowseButtonClick
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 5
|
||||
end
|
||||
object ComponentUnitFileShortenButton: TButton
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = ComponentUnitFileEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = NewComponentPage
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 602
|
||||
Height = 25
|
||||
Hint = 'Shorten or expand filename'
|
||||
Top = 92
|
||||
Width = 42
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Right = 6
|
||||
Caption = '<>'
|
||||
OnClick = ComponentUnitFileShortenButtonClick
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 6
|
||||
end
|
||||
object ComponentUnitNameEdit: TEdit
|
||||
AnchorSideLeft.Control = AncestorComboBox
|
||||
AnchorSideTop.Control = ComponentUnitFileEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = AncestorComboBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 184
|
||||
Height = 23
|
||||
Top = 122
|
||||
Width = 200
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
OnChange = ComponentUnitNameEditChange
|
||||
TabOrder = 7
|
||||
Text = 'ComponentUnitNameEdit'
|
||||
end
|
||||
object ComponentIconLabel: TLabel
|
||||
AnchorSideLeft.Control = ComponentUnitNameLabel
|
||||
AnchorSideTop.Control = ComponentIconSpeedButton
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 5
|
||||
Height = 15
|
||||
Top = 157
|
||||
Width = 115
|
||||
Caption = 'ComponentIconLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object ComponentIconSpeedButton: TSpeedButton
|
||||
AnchorSideLeft.Control = ComponentUnitNameEdit
|
||||
AnchorSideTop.Control = ComponentUnitNameEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 184
|
||||
Height = 26
|
||||
Top = 151
|
||||
Width = 28
|
||||
BorderSpacing.Top = 6
|
||||
OnClick = ComponentIconSpeedButtonClick
|
||||
ShowHint = True
|
||||
ParentShowHint = False
|
||||
end
|
||||
end
|
||||
object NewRequirementPage: TTabSheet
|
||||
Caption = 'New Requirement'
|
||||
ClientHeight = 291
|
||||
ClientWidth = 650
|
||||
object NewDepPanel: TPanel
|
||||
Left = 0
|
||||
Height = 291
|
||||
Top = 0
|
||||
Width = 650
|
||||
Align = alClient
|
||||
BevelOuter = bvNone
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ChildSizing.HorizontalSpacing = 6
|
||||
ChildSizing.VerticalSpacing = 6
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 2
|
||||
ClientHeight = 291
|
||||
ClientWidth = 650
|
||||
TabOrder = 0
|
||||
object DependPkgNameLabel: TLabel
|
||||
Left = 6
|
||||
Height = 15
|
||||
Top = 10
|
||||
Width = 121
|
||||
BorderSpacing.CellAlignHorizontal = ccaLeftTop
|
||||
BorderSpacing.CellAlignVertical = ccaCenter
|
||||
Caption = 'DependPkgNameLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object DependPkgNameComboBox: TComboBox
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
Left = 142
|
||||
Height = 23
|
||||
Top = 6
|
||||
Width = 200
|
||||
AutoComplete = True
|
||||
AutoCompleteText = [cbactEnabled, cbactEndOfLineComplete, cbactSearchAscending]
|
||||
Constraints.MinWidth = 200
|
||||
ItemHeight = 15
|
||||
OnChange = DependPkgNameComboBoxChange
|
||||
TabOrder = 0
|
||||
Text = 'DependPkgNameComboBox'
|
||||
end
|
||||
object DependMinVersionLabel: TLabel
|
||||
Left = 6
|
||||
Height = 15
|
||||
Top = 39
|
||||
Width = 129
|
||||
BorderSpacing.CellAlignHorizontal = ccaLeftTop
|
||||
BorderSpacing.CellAlignVertical = ccaCenter
|
||||
Caption = 'DependMinVersionLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object DependMinVersionEdit: TEdit
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
Left = 142
|
||||
Height = 23
|
||||
Top = 35
|
||||
Width = 200
|
||||
BorderSpacing.Top = 6
|
||||
TabOrder = 1
|
||||
Text = 'DependMinVersionEdit'
|
||||
end
|
||||
object DependMaxVersionLabel: TLabel
|
||||
Left = 6
|
||||
Height = 15
|
||||
Top = 68
|
||||
Width = 130
|
||||
BorderSpacing.CellAlignHorizontal = ccaLeftTop
|
||||
BorderSpacing.CellAlignVertical = ccaCenter
|
||||
Caption = 'DependMaxVersionLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object DependMaxVersionEdit: TEdit
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
Left = 142
|
||||
Height = 23
|
||||
Top = 64
|
||||
Width = 200
|
||||
BorderSpacing.Top = 6
|
||||
TabOrder = 2
|
||||
Text = 'DependMaxVersionEdit'
|
||||
end
|
||||
end
|
||||
end
|
||||
object AddFilesPage: TTabSheet
|
||||
Caption = 'Add Files'
|
||||
ClientHeight = 291
|
||||
ClientWidth = 650
|
||||
object FilesListView: TListView
|
||||
Left = 6
|
||||
Height = 242
|
||||
Top = 6
|
||||
Width = 638
|
||||
Align = alClient
|
||||
BorderSpacing.Around = 6
|
||||
Columns = <
|
||||
item
|
||||
Caption = 'Filename'
|
||||
Width = 200
|
||||
end
|
||||
item
|
||||
Caption = 'Type'
|
||||
Width = 436
|
||||
end>
|
||||
MultiSelect = True
|
||||
SortType = stText
|
||||
TabOrder = 0
|
||||
ViewStyle = vsReport
|
||||
OnSelectItem = FilesListViewSelectItem
|
||||
end
|
||||
object AddFilesBtnPanel: TPanel
|
||||
Left = 0
|
||||
Height = 37
|
||||
Top = 254
|
||||
Width = 650
|
||||
Align = alBottom
|
||||
AutoSize = True
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 37
|
||||
ClientWidth = 650
|
||||
TabOrder = 1
|
||||
object FilesShortenButton: TBitBtn
|
||||
Left = 112
|
||||
Height = 25
|
||||
Top = 6
|
||||
Width = 126
|
||||
Align = alLeft
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'FilesShortenButton'
|
||||
OnClick = FilesShortenButtonClick
|
||||
TabOrder = 0
|
||||
end
|
||||
object FilesDeleteButton: TBitBtn
|
||||
Left = 244
|
||||
Height = 25
|
||||
Top = 6
|
||||
Width = 118
|
||||
Align = alLeft
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'FilesDeleteButton'
|
||||
OnClick = FilesDeleteButtonClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object FilesDirButton: TBitBtn
|
||||
Left = 6
|
||||
Height = 25
|
||||
Top = 6
|
||||
Width = 100
|
||||
Align = alLeft
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'FilesDirButton'
|
||||
OnClick = FilesDirButtonClick
|
||||
TabOrder = 2
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
object NewFileBtnPanel: TPanel
|
||||
Left = 0
|
||||
Height = 38
|
||||
Top = 319
|
||||
Height = 41
|
||||
Top = 316
|
||||
Width = 658
|
||||
Align = alBottom
|
||||
AutoSize = True
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 38
|
||||
ClientHeight = 41
|
||||
ClientWidth = 658
|
||||
TabOrder = 1
|
||||
TabOrder = 0
|
||||
object OkButton: TBitBtn
|
||||
Left = 431
|
||||
Height = 26
|
||||
Left = 437
|
||||
Height = 29
|
||||
Top = 6
|
||||
Width = 97
|
||||
Width = 94
|
||||
Align = alRight
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
@ -505,10 +76,10 @@ object AddToPackageDlg: TAddToPackageDlg
|
||||
end
|
||||
object CancelButton: TBitBtn
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
Left = 534
|
||||
Height = 26
|
||||
Left = 537
|
||||
Height = 29
|
||||
Top = 6
|
||||
Width = 118
|
||||
Width = 115
|
||||
Align = alRight
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
@ -554,4 +125,385 @@ object AddToPackageDlg: TAddToPackageDlg
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
||||
object PageControl1: TPageControl
|
||||
Left = 0
|
||||
Height = 316
|
||||
Top = 0
|
||||
Width = 658
|
||||
ActivePage = NewComponentPage
|
||||
Align = alClient
|
||||
TabIndex = 0
|
||||
TabOrder = 1
|
||||
OnChange = PageControl1Change
|
||||
object NewComponentPage: TTabSheet
|
||||
Caption = 'New Component'
|
||||
ClientHeight = 289
|
||||
ClientWidth = 654
|
||||
OnResize = NewComponentPageResize
|
||||
object AncestorTypeLabel: TLabel
|
||||
AnchorSideTop.Control = AncestorComboBox
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 5
|
||||
Height = 17
|
||||
Top = 9
|
||||
Width = 108
|
||||
Caption = 'AncestorTypeLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object ClassNameLabel: TLabel
|
||||
AnchorSideTop.Control = ClassNameEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 5
|
||||
Height = 17
|
||||
Top = 38
|
||||
Width = 94
|
||||
Caption = 'ClassNameLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object PalettePageLabel: TLabel
|
||||
AnchorSideTop.Control = PalettePageCombobox
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 5
|
||||
Height = 17
|
||||
Top = 67
|
||||
Width = 99
|
||||
Caption = 'PalettePageLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object ComponentUnitFileLabel: TLabel
|
||||
AnchorSideTop.Control = ComponentUnitFileEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 5
|
||||
Height = 17
|
||||
Top = 96
|
||||
Width = 141
|
||||
Caption = 'ComponentUnitFileLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object ComponentUnitNameLabel: TLabel
|
||||
AnchorSideTop.Control = ComponentUnitNameEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 5
|
||||
Height = 17
|
||||
Top = 125
|
||||
Width = 156
|
||||
Caption = 'ComponentUnitNameLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object AncestorComboBox: TComboBox
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = NewComponentPage
|
||||
Left = 184
|
||||
Height = 23
|
||||
Top = 6
|
||||
Width = 200
|
||||
BorderSpacing.Top = 6
|
||||
ItemHeight = 17
|
||||
OnChange = AncestorComboBoxChange
|
||||
OnCloseUp = AncestorComboBoxCloseUp
|
||||
TabOrder = 0
|
||||
Text = 'AncestorComboBox'
|
||||
end
|
||||
object AncestorShowAllCheckBox: TCheckBox
|
||||
AnchorSideLeft.Control = AncestorComboBox
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = AncestorComboBox
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 390
|
||||
Height = 22
|
||||
Top = 6
|
||||
Width = 176
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'AncestorShowAllCheckBox'
|
||||
Checked = True
|
||||
OnClick = AncestorShowAllCheckBoxClick
|
||||
State = cbChecked
|
||||
TabOrder = 1
|
||||
end
|
||||
object ClassNameEdit: TEdit
|
||||
AnchorSideLeft.Control = AncestorComboBox
|
||||
AnchorSideTop.Control = AncestorComboBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = AncestorComboBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 184
|
||||
Height = 23
|
||||
Top = 35
|
||||
Width = 200
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
OnChange = ClassNameEditChange
|
||||
TabOrder = 2
|
||||
Text = 'ClassNameEdit'
|
||||
end
|
||||
object PalettePageCombobox: TComboBox
|
||||
AnchorSideLeft.Control = AncestorComboBox
|
||||
AnchorSideTop.Control = ClassNameEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = AncestorComboBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 184
|
||||
Height = 23
|
||||
Top = 64
|
||||
Width = 200
|
||||
BorderSpacing.Top = 6
|
||||
ItemHeight = 17
|
||||
TabOrder = 3
|
||||
Text = 'PalettePageCombobox'
|
||||
end
|
||||
object ComponentUnitFileEdit: TEdit
|
||||
AnchorSideLeft.Control = AncestorComboBox
|
||||
AnchorSideTop.Control = PalettePageCombobox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = ComponentUnitFileBrowseButton
|
||||
Left = 184
|
||||
Height = 23
|
||||
Top = 93
|
||||
Width = 416
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
TabOrder = 4
|
||||
Text = 'ComponentUnitFileEdit'
|
||||
end
|
||||
object ComponentUnitFileBrowseButton: TButton
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = ComponentUnitFileEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = ComponentUnitFileShortenButton
|
||||
Left = 600
|
||||
Height = 29
|
||||
Hint = 'Save file dialog'
|
||||
Top = 90
|
||||
Width = 22
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
Caption = '...'
|
||||
OnClick = ComponentUnitFileBrowseButtonClick
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 5
|
||||
end
|
||||
object ComponentUnitFileShortenButton: TButton
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = ComponentUnitFileEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = NewComponentPage
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 622
|
||||
Height = 29
|
||||
Hint = 'Shorten or expand filename'
|
||||
Top = 90
|
||||
Width = 26
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Right = 6
|
||||
Caption = '<>'
|
||||
OnClick = ComponentUnitFileShortenButtonClick
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 6
|
||||
end
|
||||
object ComponentUnitNameEdit: TEdit
|
||||
AnchorSideLeft.Control = AncestorComboBox
|
||||
AnchorSideTop.Control = ComponentUnitFileEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = AncestorComboBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 184
|
||||
Height = 23
|
||||
Top = 122
|
||||
Width = 200
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
OnChange = ComponentUnitNameEditChange
|
||||
TabOrder = 7
|
||||
Text = 'ComponentUnitNameEdit'
|
||||
end
|
||||
object ComponentIconLabel: TLabel
|
||||
AnchorSideLeft.Control = ComponentUnitNameLabel
|
||||
AnchorSideTop.Control = ComponentIconSpeedButton
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 5
|
||||
Height = 17
|
||||
Top = 156
|
||||
Width = 123
|
||||
Caption = 'ComponentIconLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object ComponentIconSpeedButton: TSpeedButton
|
||||
AnchorSideLeft.Control = ComponentUnitNameEdit
|
||||
AnchorSideTop.Control = ComponentUnitNameEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 184
|
||||
Height = 26
|
||||
Top = 151
|
||||
Width = 28
|
||||
BorderSpacing.Top = 6
|
||||
OnClick = ComponentIconSpeedButtonClick
|
||||
ShowHint = True
|
||||
ParentShowHint = False
|
||||
end
|
||||
end
|
||||
object NewRequirementPage: TTabSheet
|
||||
Caption = 'New Requirement'
|
||||
ClientHeight = 289
|
||||
ClientWidth = 654
|
||||
object NewDepPanel: TPanel
|
||||
Left = 0
|
||||
Height = 289
|
||||
Top = 0
|
||||
Width = 654
|
||||
Align = alClient
|
||||
BevelOuter = bvNone
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ChildSizing.HorizontalSpacing = 6
|
||||
ChildSizing.VerticalSpacing = 6
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 2
|
||||
ClientHeight = 289
|
||||
ClientWidth = 654
|
||||
TabOrder = 0
|
||||
object DependPkgNameLabel: TLabel
|
||||
Left = 6
|
||||
Height = 17
|
||||
Top = 9
|
||||
Width = 131
|
||||
BorderSpacing.CellAlignHorizontal = ccaLeftTop
|
||||
BorderSpacing.CellAlignVertical = ccaCenter
|
||||
Caption = 'DependPkgNameLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object DependPkgNameComboBox: TComboBox
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
Left = 154
|
||||
Height = 23
|
||||
Top = 6
|
||||
Width = 200
|
||||
AutoComplete = True
|
||||
AutoCompleteText = [cbactEnabled, cbactEndOfLineComplete, cbactSearchAscending]
|
||||
Constraints.MinWidth = 200
|
||||
ItemHeight = 17
|
||||
OnChange = DependPkgNameComboBoxChange
|
||||
TabOrder = 0
|
||||
Text = 'DependPkgNameComboBox'
|
||||
end
|
||||
object DependMinVersionLabel: TLabel
|
||||
Left = 6
|
||||
Height = 17
|
||||
Top = 38
|
||||
Width = 140
|
||||
BorderSpacing.CellAlignHorizontal = ccaLeftTop
|
||||
BorderSpacing.CellAlignVertical = ccaCenter
|
||||
Caption = 'DependMinVersionLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object DependMinVersionEdit: TEdit
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
Left = 154
|
||||
Height = 23
|
||||
Top = 35
|
||||
Width = 200
|
||||
BorderSpacing.Top = 6
|
||||
TabOrder = 1
|
||||
Text = 'DependMinVersionEdit'
|
||||
end
|
||||
object DependMaxVersionLabel: TLabel
|
||||
Left = 6
|
||||
Height = 17
|
||||
Top = 67
|
||||
Width = 142
|
||||
BorderSpacing.CellAlignHorizontal = ccaLeftTop
|
||||
BorderSpacing.CellAlignVertical = ccaCenter
|
||||
Caption = 'DependMaxVersionLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object DependMaxVersionEdit: TEdit
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
Left = 154
|
||||
Height = 23
|
||||
Top = 64
|
||||
Width = 200
|
||||
BorderSpacing.Top = 6
|
||||
TabOrder = 2
|
||||
Text = 'DependMaxVersionEdit'
|
||||
end
|
||||
end
|
||||
end
|
||||
object AddFilesPage: TTabSheet
|
||||
Caption = 'Add Files'
|
||||
ClientHeight = 289
|
||||
ClientWidth = 654
|
||||
object FilesListView: TListView
|
||||
Left = 6
|
||||
Height = 236
|
||||
Top = 6
|
||||
Width = 642
|
||||
Align = alClient
|
||||
BorderSpacing.Around = 6
|
||||
Columns = <
|
||||
item
|
||||
Caption = 'Filename'
|
||||
Width = 200
|
||||
end
|
||||
item
|
||||
Caption = 'Type'
|
||||
Width = 436
|
||||
end>
|
||||
MultiSelect = True
|
||||
SortType = stText
|
||||
TabOrder = 0
|
||||
ViewStyle = vsReport
|
||||
OnSelectItem = FilesListViewSelectItem
|
||||
end
|
||||
object AddFilesBtnPanel: TPanel
|
||||
Left = 0
|
||||
Height = 41
|
||||
Top = 248
|
||||
Width = 654
|
||||
Align = alBottom
|
||||
AutoSize = True
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 41
|
||||
ClientWidth = 654
|
||||
TabOrder = 1
|
||||
object FilesShortenButton: TBitBtn
|
||||
Left = 106
|
||||
Height = 29
|
||||
Top = 6
|
||||
Width = 122
|
||||
Align = alLeft
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'FilesShortenButton'
|
||||
OnClick = FilesShortenButtonClick
|
||||
TabOrder = 0
|
||||
end
|
||||
object FilesDeleteButton: TBitBtn
|
||||
Left = 234
|
||||
Height = 29
|
||||
Top = 6
|
||||
Width = 113
|
||||
Align = alLeft
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'FilesDeleteButton'
|
||||
OnClick = FilesDeleteButtonClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object FilesDirButton: TBitBtn
|
||||
Left = 6
|
||||
Height = 29
|
||||
Top = 6
|
||||
Width = 94
|
||||
Align = alLeft
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'FilesDirButton'
|
||||
OnClick = FilesDirButtonClick
|
||||
TabOrder = 2
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -45,8 +45,7 @@ type
|
||||
d2ptNewComponent,
|
||||
d2ptRequiredPkg,
|
||||
d2ptFile,
|
||||
d2ptFiles,
|
||||
d2ptNewFile
|
||||
d2ptFiles
|
||||
);
|
||||
|
||||
{ TAddToPkgResult }
|
||||
@ -79,46 +78,40 @@ type
|
||||
{ TAddToPackageDlg }
|
||||
|
||||
TAddToPackageDlg = class(TForm)
|
||||
FilesDirButton: TBitBtn;
|
||||
// PageControl1
|
||||
PageControl1: TPageControl;
|
||||
NewFilePage: TTabSheet;
|
||||
NewComponentPage: TTabSheet;
|
||||
NewRequirementPage: TTabSheet;
|
||||
AddFilesBtnPanel: TPanel;
|
||||
AddFilesPage: TTabSheet;
|
||||
// new file page
|
||||
NewFileTreeView: TTreeView;
|
||||
NewFileDescriptionGroupBox: TGroupBox;
|
||||
NewFileHelpLabel: TLabel;
|
||||
CancelButton: TBitBtn;
|
||||
OkButton: TBitBtn;
|
||||
AncestorTypeLabel: TLabel;
|
||||
AncestorComboBox: TComboBox;
|
||||
AncestorShowAllCheckBox: TCheckBox;
|
||||
ClassNameLabel: TLabel;
|
||||
AncestorTypeLabel: TLabel;
|
||||
CancelButton: TBitBtn;
|
||||
ClassNameEdit: TEdit;
|
||||
PalettePageLabel: TLabel;
|
||||
PalettePageCombobox: TCombobox;
|
||||
ClassNameLabel: TLabel;
|
||||
ComponentIconLabel: TLabel;
|
||||
ComponentIconSpeedButton: TSpeedButton;
|
||||
ComponentUnitFileLabel: TLabel;
|
||||
ComponentUnitFileEdit: TEdit;
|
||||
ComponentUnitFileBrowseButton: TButton;
|
||||
ComponentUnitFileEdit: TEdit;
|
||||
ComponentUnitFileLabel: TLabel;
|
||||
ComponentUnitFileShortenButton: TButton;
|
||||
ComponentUnitNameLabel: TLabel;
|
||||
ComponentUnitNameEdit: TEdit;
|
||||
NewDepPanel: TPanel;
|
||||
DependPkgNameLabel: TLabel;
|
||||
DependPkgNameComboBox: TComboBox;
|
||||
DependMinVersionLabel: TLabel;
|
||||
DependMinVersionEdit: TEdit;
|
||||
DependMaxVersionLabel: TLabel;
|
||||
ComponentUnitNameLabel: TLabel;
|
||||
DependMaxVersionEdit: TEdit;
|
||||
DependMaxVersionLabel: TLabel;
|
||||
DependMinVersionEdit: TEdit;
|
||||
DependMinVersionLabel: TLabel;
|
||||
DependPkgNameComboBox: TComboBox;
|
||||
DependPkgNameLabel: TLabel;
|
||||
FilesDeleteButton: TBitBtn;
|
||||
FilesShortenButton: TBitBtn;
|
||||
FilesDirButton: TBitBtn;
|
||||
FilesListView: TListView;
|
||||
NewFileBtnPanel: TPanel;
|
||||
AddFilesBtnPanel: TPanel;
|
||||
FilesShortenButton: TBitBtn;
|
||||
NewComponentPage: TTabSheet;
|
||||
NewDepPanel: TPanel;
|
||||
NewRequirementPage: TTabSheet;
|
||||
OkButton: TBitBtn;
|
||||
AddToPackageBtnPanel: TPanel;
|
||||
PageControl1: TPageControl;
|
||||
PalettePageCombobox: TComboBox;
|
||||
PalettePageLabel: TLabel;
|
||||
procedure AddToPackageDlgClose(Sender: TObject; var {%H-}CloseAction: TCloseAction);
|
||||
procedure AddToPackageDlgKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure AncestorComboBoxChange(Sender: TObject);
|
||||
@ -142,11 +135,6 @@ type
|
||||
procedure NewComponentButtonClick(Sender: TObject);
|
||||
procedure NewComponentPageResize(Sender: TObject);
|
||||
procedure NewDependButtonClick(Sender: TObject);
|
||||
procedure NewFileOkButtonClick(Sender: TObject);
|
||||
procedure NewFilePageResize(Sender: TObject);
|
||||
procedure NewFileTreeViewClick(Sender: TObject);
|
||||
procedure NewFileTreeViewDblClick(Sender: TObject);
|
||||
procedure NewFileTreeViewSelectionChanged(Sender: TObject);
|
||||
procedure PageControl1Change(Sender: TObject);
|
||||
private
|
||||
fLastNewComponentAncestorType: string;
|
||||
@ -161,7 +149,6 @@ type
|
||||
procedure SetActivatePage(AValue: TAddToPkgType);
|
||||
procedure SetLazPackage(const AValue: TLazPackage);
|
||||
procedure SetupComponents;
|
||||
procedure SetupNewFilePage;
|
||||
procedure SetupNewComponentPage;
|
||||
procedure SetupAddDependencyPage;
|
||||
procedure SetupAddFilesPage;
|
||||
@ -173,7 +160,6 @@ type
|
||||
procedure AutoCompleteNewComponent;
|
||||
procedure AutoCompleteNewComponentUnitName;
|
||||
function SwitchRelativeAbsoluteFilename(const Filename: string): string;
|
||||
procedure FillNewFileTreeView;
|
||||
function FindFileInFilesList(AFilename: string): Integer;
|
||||
procedure LoadComponentIcon(AFilename: string);
|
||||
public
|
||||
@ -944,52 +930,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TAddToPackageDlg.NewFileOkButtonClick(Sender: TObject);
|
||||
var
|
||||
ANode: TTreeNode;
|
||||
begin
|
||||
ANode:=NewFileTreeView.Selected;
|
||||
if (ANode<>nil) and (ANode.Data<>nil) and (TObject(ANode.Data) is TNewItemProjectFile)
|
||||
then begin
|
||||
Params.Clear;
|
||||
Params.AddType:=d2ptNewFile;
|
||||
Params.NewItem:=TNewIDEItemTemplate(ANode.Data);
|
||||
ModalResult:=mrOk;
|
||||
end
|
||||
else
|
||||
IDEMessageDialog(lisNewDlgNoItemSelected,lisNewDlgPleaseSelectAnItemFirst,mtInformation,[mbOk]);
|
||||
end;
|
||||
|
||||
procedure TAddToPackageDlg.NewFilePageResize(Sender: TObject);
|
||||
begin
|
||||
NewFileTreeView.Width:=NewFilePage.ClientWidth div 2;
|
||||
end;
|
||||
|
||||
procedure TAddToPackageDlg.NewFileTreeViewClick(Sender: TObject);
|
||||
var
|
||||
Desc: String;
|
||||
ANode: TTreeNode;
|
||||
begin
|
||||
ANode:=NewFileTreeView.Selected;
|
||||
Desc:='';
|
||||
if (ANode<>nil) and (ANode.Data<>nil) then begin
|
||||
if TObject(ANode.Data) is TNewIDEItemTemplate then
|
||||
Desc:=TNewIDEItemTemplate(ANode.Data).Description;
|
||||
end;
|
||||
NewFileHelpLabel.Caption:=Desc;
|
||||
end;
|
||||
|
||||
procedure TAddToPackageDlg.NewFileTreeViewDblClick(Sender: TObject);
|
||||
begin
|
||||
NewFileOkButtonClick(Self);
|
||||
end;
|
||||
|
||||
procedure TAddToPackageDlg.NewFileTreeViewSelectionChanged(Sender: TObject);
|
||||
begin
|
||||
OkButton.Enabled:=(NewFileTreeView.Selected<>nil)
|
||||
and (TObject(NewFileTreeView.Selected.Data) is TNewIDEItemTemplate);
|
||||
end;
|
||||
|
||||
procedure TAddToPackageDlg.SetLazPackage(const AValue: TLazPackage);
|
||||
begin
|
||||
if FLazPackage=AValue then exit;
|
||||
@ -1006,10 +946,13 @@ begin
|
||||
Result:=d2ptNewComponent
|
||||
else if PageControl1.ActivePage=NewRequirementPage then
|
||||
Result:=d2ptRequiredPkg
|
||||
else if PageControl1.ActivePage=AddFilesPage then
|
||||
Result:=d2ptFiles
|
||||
else
|
||||
Result:=d2ptNewFile;
|
||||
else {if PageControl1.ActivePage=AddFilesPage then } begin
|
||||
Assert(PageControl1.ActivePage=AddFilesPage,
|
||||
'TAddToPackageDlg.GetActivatePage: PageControl1.ActivePage <> AddFilesPage');
|
||||
Result:=d2ptFiles;
|
||||
end;
|
||||
//else
|
||||
// Result:=d2ptNewFile;
|
||||
end;
|
||||
|
||||
procedure TAddToPackageDlg.SetActivatePage(AValue: TAddToPkgType);
|
||||
@ -1017,8 +960,8 @@ begin
|
||||
case AValue of
|
||||
d2ptNewComponent: PageControl1.ActivePage:=NewComponentPage;
|
||||
d2ptRequiredPkg: PageControl1.ActivePage:=NewRequirementPage;
|
||||
d2ptFile,d2ptFiles: PageControl1.ActivePage:=AddFilesPage;
|
||||
else PageControl1.ActivePage:=NewFilePage;
|
||||
d2ptFiles: PageControl1.ActivePage:=AddFilesPage;
|
||||
else raise Exception.Create('TAddToPackageDlg.SetActivatePage: invalid value.');
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -1037,23 +980,17 @@ end;
|
||||
procedure TAddToPackageDlg.PageControl1Change(Sender: TObject);
|
||||
begin
|
||||
case PageControl1.PageIndex of
|
||||
0: begin // New File
|
||||
OkButton.Caption:=lisA2PCreateNewFile;
|
||||
OkButton.OnClick:=@NewFileOkButtonClick;
|
||||
OkButton.Enabled:=(NewFileTreeView.Selected<>nil)
|
||||
and (TObject(NewFileTreeView.Selected.Data) is TNewIDEItemTemplate);
|
||||
end;
|
||||
1: begin // New Component
|
||||
0: begin // New Component
|
||||
OkButton.Caption:=lisA2PCreateNewComp;
|
||||
OkButton.OnClick:=@NewComponentButtonClick;
|
||||
CheckNewCompOk;
|
||||
end;
|
||||
2: begin // New Requirement
|
||||
1: begin // New Requirement
|
||||
OkButton.Caption:=lisA2PCreateNewReq;
|
||||
OkButton.OnClick:=@NewDependButtonClick;
|
||||
CheckNewReqOk;
|
||||
end;
|
||||
3: begin // Add Files
|
||||
2: begin // Add Files
|
||||
OkButton.Caption:=lisA2PAddFilesToPackage;
|
||||
OkButton.OnClick:=@FilesAddButtonClick;
|
||||
CheckFilesButtonsOk;
|
||||
@ -1063,7 +1000,7 @@ end;
|
||||
|
||||
procedure TAddToPackageDlg.SetupComponents;
|
||||
begin
|
||||
NewFilePage.Caption:=lisA2PNewFile;
|
||||
//NewFilePage.Caption:=lisA2PNewFile;
|
||||
NewComponentPage.Caption:=lisA2PNewComponent;
|
||||
NewRequirementPage.Caption:=lisProjAddNewRequirement;
|
||||
AddFilesPage.Caption:=lisA2PAddFiles;
|
||||
@ -1071,19 +1008,12 @@ begin
|
||||
PageControl1.PageIndex:=0;
|
||||
PageControl1Change(PageControl1);
|
||||
|
||||
SetupNewFilePage;
|
||||
//SetupNewFilePage;
|
||||
SetupNewComponentPage;
|
||||
SetupAddDependencyPage;
|
||||
SetupAddFilesPage;
|
||||
end;
|
||||
|
||||
procedure TAddToPackageDlg.SetupNewFilePage;
|
||||
begin
|
||||
NewFileDescriptionGroupBox.Caption:=lisCodeHelpDescrTag;
|
||||
NewFileHelpLabel.Caption:='';
|
||||
FillNewFileTreeView;
|
||||
end;
|
||||
|
||||
procedure TAddToPackageDlg.SetupNewComponentPage;
|
||||
begin
|
||||
AncestorTypeLabel.Caption:=lisA2PAncestorType;
|
||||
@ -1237,28 +1167,6 @@ begin
|
||||
Result:=TrimFilename(CreateAbsoluteSearchPath(Filename,LazPackage.Directory));
|
||||
end;
|
||||
|
||||
procedure TAddToPackageDlg.FillNewFileTreeView;
|
||||
var
|
||||
NewParentNode: TTreeNode;
|
||||
Category: TNewIDEItemCategory;
|
||||
TemplateID: Integer;
|
||||
Template: TNewIDEItemTemplate;
|
||||
begin
|
||||
NewFileTreeView.BeginUpdate;
|
||||
NewFileTreeView.Items.Clear;
|
||||
Category:=NewIDEItems.FindByName(FileDescGroupName);
|
||||
NewParentNode:=NewFileTreeView.Items.AddObject(nil,Category.LocalizedName,
|
||||
Category);
|
||||
for TemplateID:=0 to Category.Count-1 do begin
|
||||
Template:=Category[TemplateID];
|
||||
if Template.VisibleInNewDialog and (Template is TNewItemProjectFile) then
|
||||
NewFileTreeView.Items.AddChildObject(NewParentNode,Template.LocalizedName,
|
||||
Template);
|
||||
end;
|
||||
NewParentNode.Expand(true);
|
||||
NewFileTreeView.EndUpdate;
|
||||
end;
|
||||
|
||||
function TAddToPackageDlg.FindFileInFilesList(AFilename: string): Integer;
|
||||
var
|
||||
i: Integer;
|
||||
|
@ -42,6 +42,7 @@ uses
|
||||
IDEImagesIntf, MenuIntf, LazIDEIntf, ProjectIntf, CodeToolsStructs,
|
||||
FormEditingIntf, PackageIntf, IDEHelpIntf, IDEOptionsIntf,
|
||||
IDEExternToolIntf,
|
||||
NewItemIntf,
|
||||
// IDE
|
||||
IDEDialogs, IDEProcs, LazarusIDEStrConsts, IDEDefs, CompilerOptions,
|
||||
ComponentReg, UnitResources, EnvironmentOpts, DialogProcs, InputHistory,
|
||||
@ -313,6 +314,7 @@ type
|
||||
fUpdateLock: integer;
|
||||
fForcedFlags: TPEFlags;
|
||||
function AddOneFile(aFilename: string; var NewUnitPaths, NewIncPaths: String): TModalResult;
|
||||
procedure DoAddNewFile(NewItem: TNewIDEItemTemplate);
|
||||
procedure FreeNodeData(Typ: TPENodeType);
|
||||
function CreateNodeData(Typ: TPENodeType; aName: string; aRemoved: boolean): TPENodeData;
|
||||
procedure SetDependencyDefaultFilename(AsPreferred: boolean);
|
||||
@ -519,6 +521,9 @@ procedure RegisterStandardPackageEditorMenuItems;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
NewDialog;
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
var
|
||||
@ -1035,8 +1040,12 @@ begin
|
||||
end;
|
||||
|
||||
procedure TPackageEditorForm.mnuAddNewFileClick(Sender: TObject);
|
||||
var
|
||||
NewItem: TNewIDEItemTemplate;
|
||||
begin
|
||||
ShowAddDialogEx(d2ptNewFile);
|
||||
// Reuse the "New..." dialog for "Add new file".
|
||||
if ShowNewIDEItemDialog(NewItem, true)=mrOk then
|
||||
DoAddNewFile(NewItem);
|
||||
end;
|
||||
|
||||
procedure TPackageEditorForm.ItemsTreeViewSelectionChanged(Sender: TObject);
|
||||
@ -2040,6 +2049,47 @@ begin
|
||||
IdleConnected:=true;
|
||||
end;
|
||||
|
||||
procedure TPackageEditorForm.DoAddNewFile(NewItem: TNewIDEItemTemplate);
|
||||
var
|
||||
NewFilename: String;
|
||||
DummyResult: TModalResult;
|
||||
NewFileType: TPkgFileType;
|
||||
NewPkgFileFlags: TPkgFileFlags;
|
||||
Desc: TProjectFileDescriptor;
|
||||
NewUnitName: String;
|
||||
HasRegisterProc: Boolean;
|
||||
begin
|
||||
if NewItem is TNewItemProjectFile then begin
|
||||
// create new file
|
||||
Desc:=TNewItemProjectFile(NewItem).Descriptor;
|
||||
NewFilename:='';
|
||||
DummyResult:=LazarusIDE.DoNewFile(Desc,NewFilename,'',
|
||||
[nfOpenInEditor,nfCreateDefaultSrc,nfIsNotPartOfProject],LazPackage);
|
||||
if DummyResult=mrOk then begin
|
||||
// success -> now add it to package
|
||||
NewUnitName:='';
|
||||
NewFileType:=FileNameToPkgFileType(NewFilename);
|
||||
NewPkgFileFlags:=[];
|
||||
if (NewFileType in PkgFileUnitTypes) then begin
|
||||
Include(NewPkgFileFlags,pffAddToPkgUsesSection);
|
||||
NewUnitName:=ExtractFilenameOnly(NewFilename);
|
||||
if Assigned(PackageEditors.OnGetUnitRegisterInfo) then begin
|
||||
HasRegisterProc:=false;
|
||||
PackageEditors.OnGetUnitRegisterInfo(Self,NewFilename,
|
||||
NewUnitName,HasRegisterProc);
|
||||
if HasRegisterProc then
|
||||
Include(NewPkgFileFlags,pffHasRegisterProc);
|
||||
end;
|
||||
end;
|
||||
LazPackage.AddFile(NewFilename,NewUnitName,NewFileType,
|
||||
NewPkgFileFlags, cpNormal);
|
||||
FreeAndNil(FNextSelectedPart);
|
||||
FNextSelectedPart:=TPENodeData.Create(penFile,NewFilename,false);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
function TPackageEditorForm.ShowAddDialog(var DlgPage: TAddToPkgType): TModalResult;
|
||||
var
|
||||
IgnoreUnitPaths, IgnoreIncPaths: TFilenameToStringTree;
|
||||
@ -2137,46 +2187,6 @@ var
|
||||
FNextSelectedPart:=TPENodeData.Create(penFile,AddParams.UnitFilename,false);
|
||||
end;
|
||||
|
||||
procedure AddNewFile(AddParams: TAddToPkgResult);
|
||||
var
|
||||
NewFilename: String;
|
||||
DummyResult: TModalResult;
|
||||
NewFileType: TPkgFileType;
|
||||
NewPkgFileFlags: TPkgFileFlags;
|
||||
Desc: TProjectFileDescriptor;
|
||||
NewUnitName: String;
|
||||
HasRegisterProc: Boolean;
|
||||
begin
|
||||
if AddParams.NewItem is TNewItemProjectFile then begin
|
||||
// create new file
|
||||
Desc:=TNewItemProjectFile(AddParams.NewItem).Descriptor;
|
||||
NewFilename:='';
|
||||
DummyResult:=LazarusIDE.DoNewFile(Desc,NewFilename,'',
|
||||
[nfOpenInEditor,nfCreateDefaultSrc,nfIsNotPartOfProject],LazPackage);
|
||||
if DummyResult=mrOk then begin
|
||||
// success -> now add it to package
|
||||
NewUnitName:='';
|
||||
NewFileType:=FileNameToPkgFileType(NewFilename);
|
||||
NewPkgFileFlags:=[];
|
||||
if (NewFileType in PkgFileUnitTypes) then begin
|
||||
Include(NewPkgFileFlags,pffAddToPkgUsesSection);
|
||||
NewUnitName:=ExtractFilenameOnly(NewFilename);
|
||||
if Assigned(PackageEditors.OnGetUnitRegisterInfo) then begin
|
||||
HasRegisterProc:=false;
|
||||
PackageEditors.OnGetUnitRegisterInfo(Self,NewFilename,
|
||||
NewUnitName,HasRegisterProc);
|
||||
if HasRegisterProc then
|
||||
Include(NewPkgFileFlags,pffHasRegisterProc);
|
||||
end;
|
||||
end;
|
||||
LazPackage.AddFile(NewFilename,NewUnitName,NewFileType,
|
||||
NewPkgFileFlags, cpNormal);
|
||||
FreeAndNil(FNextSelectedPart);
|
||||
FNextSelectedPart:=TPENodeData.Create(penFile,NewFilename,false);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
AddParams: TAddToPkgResult;
|
||||
OldParams: TAddToPkgResult;
|
||||
@ -2197,25 +2207,11 @@ begin
|
||||
try
|
||||
while AddParams<>nil do begin
|
||||
case AddParams.AddType of
|
||||
|
||||
d2ptUnit:
|
||||
AddUnit(AddParams);
|
||||
|
||||
d2ptVirtualUnit:
|
||||
AddVirtualUnit(AddParams);
|
||||
|
||||
d2ptNewComponent:
|
||||
AddNewComponent(AddParams);
|
||||
|
||||
d2ptRequiredPkg:
|
||||
AddRequiredPkg(AddParams);
|
||||
|
||||
d2ptFile:
|
||||
AddFile(AddParams);
|
||||
|
||||
d2ptNewFile:
|
||||
AddNewFile(AddParams);
|
||||
|
||||
d2ptUnit: AddUnit(AddParams);
|
||||
d2ptVirtualUnit: AddVirtualUnit(AddParams);
|
||||
d2ptNewComponent: AddNewComponent(AddParams);
|
||||
d2ptRequiredPkg: AddRequiredPkg(AddParams);
|
||||
d2ptFile: AddFile(AddParams);
|
||||
end;
|
||||
OldParams:=AddParams;
|
||||
AddParams:=AddParams.Next;
|
||||
|
Loading…
Reference in New Issue
Block a user