mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-03 14:47:21 +01:00
IDE: Simplify PathEditorDialog. Move list of templates to a separate window.
git-svn-id: trunk@56826 -
This commit is contained in:
parent
6add3b79ed
commit
025579133c
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -6830,6 +6830,8 @@ ide/genericchecklist.lfm svneol=native#text/plain
|
|||||||
ide/genericchecklist.pas svneol=native#text/plain
|
ide/genericchecklist.pas svneol=native#text/plain
|
||||||
ide/genericlisteditor.lfm svneol=native#text/plain
|
ide/genericlisteditor.lfm svneol=native#text/plain
|
||||||
ide/genericlisteditor.pas svneol=native#text/plain
|
ide/genericlisteditor.pas svneol=native#text/plain
|
||||||
|
ide/genericlistselect.lfm svneol=native#text/plain
|
||||||
|
ide/genericlistselect.pas svneol=native#text/pascal
|
||||||
ide/gotofrm.lfm svneol=native#text/plain
|
ide/gotofrm.lfm svneol=native#text/plain
|
||||||
ide/gotofrm.pas svneol=native#text/plain
|
ide/gotofrm.pas svneol=native#text/plain
|
||||||
ide/helpfpcmessages.lfm svneol=native#text/plain
|
ide/helpfpcmessages.lfm svneol=native#text/plain
|
||||||
|
|||||||
@ -9,11 +9,11 @@ object GenericCheckListForm: TGenericCheckListForm
|
|||||||
ClientWidth = 343
|
ClientWidth = 343
|
||||||
OnShow = FormShow
|
OnShow = FormShow
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
LCLVersion = '1.5'
|
LCLVersion = '1.9.0.0'
|
||||||
object ButtonPanel1: TButtonPanel
|
object ButtonPanel1: TButtonPanel
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 29
|
Height = 30
|
||||||
Top = 242
|
Top = 241
|
||||||
Width = 331
|
Width = 331
|
||||||
OKButton.Name = 'OKButton'
|
OKButton.Name = 'OKButton'
|
||||||
OKButton.DefaultCaption = True
|
OKButton.DefaultCaption = True
|
||||||
@ -36,19 +36,18 @@ object GenericCheckListForm: TGenericCheckListForm
|
|||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 202
|
Height = 200
|
||||||
Top = 29
|
Top = 31
|
||||||
Width = 331
|
Width = 331
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
ItemHeight = 0
|
ItemHeight = 0
|
||||||
OnItemClick = CheckListBox1ItemClick
|
OnItemClick = CheckListBox1ItemClick
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
TopIndex = -1
|
|
||||||
end
|
end
|
||||||
object InfoLabel: TLabel
|
object InfoLabel: TLabel
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 17
|
Height = 19
|
||||||
Top = 6
|
Top = 6
|
||||||
Width = 331
|
Width = 331
|
||||||
Align = alTop
|
Align = alTop
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
{ ToDo: move to lazcontrols }
|
|
||||||
unit GenericCheckList;
|
unit GenericCheckList;
|
||||||
|
|
||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
@ -6,8 +5,10 @@ unit GenericCheckList;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ButtonPanel,
|
Classes, SysUtils,
|
||||||
CheckLst, Buttons, IDEImagesIntf, StdCtrls;
|
Forms, Controls, StdCtrls, Dialogs, ButtonPanel, CheckLst, Buttons,
|
||||||
|
// IdeIntf
|
||||||
|
IDEImagesIntf;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
|||||||
@ -7,11 +7,11 @@ object GenericListEditForm: TGenericListEditForm
|
|||||||
ClientHeight = 301
|
ClientHeight = 301
|
||||||
ClientWidth = 343
|
ClientWidth = 343
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
LCLVersion = '1.1'
|
LCLVersion = '1.9.0.0'
|
||||||
object ButtonPanel1: TButtonPanel
|
object ButtonPanel1: TButtonPanel
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 33
|
Height = 30
|
||||||
Top = 262
|
Top = 265
|
||||||
Width = 331
|
Width = 331
|
||||||
OKButton.Name = 'OKButton'
|
OKButton.Name = 'OKButton'
|
||||||
OKButton.DefaultCaption = True
|
OKButton.DefaultCaption = True
|
||||||
@ -29,7 +29,7 @@ object GenericListEditForm: TGenericListEditForm
|
|||||||
end
|
end
|
||||||
object Memo1: TMemo
|
object Memo1: TMemo
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 256
|
Height = 259
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 343
|
Width = 343
|
||||||
Align = alClient
|
Align = alClient
|
||||||
|
|||||||
@ -5,8 +5,7 @@ unit GenericListEditor;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ButtonPanel,
|
Forms, StdCtrls, ButtonPanel;
|
||||||
StdCtrls;
|
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
|||||||
59
ide/genericlistselect.lfm
Normal file
59
ide/genericlistselect.lfm
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
object GenericListSelectForm: TGenericListSelectForm
|
||||||
|
Left = 389
|
||||||
|
Height = 277
|
||||||
|
Top = 463
|
||||||
|
Width = 466
|
||||||
|
Caption = 'GenericCheckListForm'
|
||||||
|
ClientHeight = 277
|
||||||
|
ClientWidth = 466
|
||||||
|
OnShow = FormShow
|
||||||
|
Position = poScreenCenter
|
||||||
|
LCLVersion = '1.9.0.0'
|
||||||
|
object ButtonPanel1: TButtonPanel
|
||||||
|
Left = 6
|
||||||
|
Height = 30
|
||||||
|
Top = 241
|
||||||
|
Width = 454
|
||||||
|
OKButton.Name = 'OKButton'
|
||||||
|
OKButton.DefaultCaption = True
|
||||||
|
HelpButton.Name = 'HelpButton'
|
||||||
|
HelpButton.DefaultCaption = True
|
||||||
|
HelpButton.Enabled = False
|
||||||
|
CloseButton.Name = 'CloseButton'
|
||||||
|
CloseButton.DefaultCaption = True
|
||||||
|
CloseButton.Enabled = False
|
||||||
|
CancelButton.Name = 'CancelButton'
|
||||||
|
CancelButton.DefaultCaption = True
|
||||||
|
TabOrder = 0
|
||||||
|
ShowButtons = [pbOK, pbCancel]
|
||||||
|
ShowBevel = False
|
||||||
|
end
|
||||||
|
object InfoLabel: TLabel
|
||||||
|
Left = 6
|
||||||
|
Height = 19
|
||||||
|
Top = 6
|
||||||
|
Width = 454
|
||||||
|
Align = alTop
|
||||||
|
BorderSpacing.Around = 6
|
||||||
|
Caption = 'InfoLabel'
|
||||||
|
ParentColor = False
|
||||||
|
WordWrap = True
|
||||||
|
end
|
||||||
|
object ListBox: TListBox
|
||||||
|
AnchorSideLeft.Control = Owner
|
||||||
|
AnchorSideTop.Control = InfoLabel
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = Owner
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 6
|
||||||
|
Height = 200
|
||||||
|
Top = 31
|
||||||
|
Width = 454
|
||||||
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
|
BorderSpacing.Around = 6
|
||||||
|
ItemHeight = 0
|
||||||
|
OnClick = ListBoxClick
|
||||||
|
OnDblClick = ListBoxDblClick
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
end
|
||||||
72
ide/genericlistselect.pas
Normal file
72
ide/genericlistselect.pas
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
unit GenericListSelect;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils,
|
||||||
|
Controls, Forms, StdCtrls, Dialogs, ButtonPanel;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
{ TGenericListSelectForm }
|
||||||
|
|
||||||
|
TGenericListSelectForm = class(TForm)
|
||||||
|
ButtonPanel1: TButtonPanel;
|
||||||
|
ListBox: TListBox;
|
||||||
|
InfoLabel: TLabel;
|
||||||
|
procedure FormShow(Sender: TObject);
|
||||||
|
procedure ListBoxClick(Sender: TObject);
|
||||||
|
procedure ListBoxDblClick(Sender: TObject);
|
||||||
|
private
|
||||||
|
procedure UpdateButtons;
|
||||||
|
public
|
||||||
|
constructor Create(TheOwner: TComponent); override;
|
||||||
|
destructor Destroy; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
GenericListSelectForm: TGenericListSelectForm;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{$R *.lfm}
|
||||||
|
|
||||||
|
{ TGenericListSelectForm }
|
||||||
|
|
||||||
|
constructor TGenericListSelectForm.Create(TheOwner: TComponent);
|
||||||
|
begin
|
||||||
|
inherited Create(TheOwner);
|
||||||
|
InfoLabel.Caption := '';
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TGenericListSelectForm.Destroy;
|
||||||
|
begin
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TGenericListSelectForm.FormShow(Sender: TObject);
|
||||||
|
begin
|
||||||
|
UpdateButtons;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TGenericListSelectForm.ListBoxClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
UpdateButtons;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TGenericListSelectForm.ListBoxDblClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
UpdateButtons;
|
||||||
|
ModalResult:=mrOK;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TGenericListSelectForm.UpdateButtons;
|
||||||
|
begin
|
||||||
|
ButtonPanel1.OKButton.Enabled := ListBox.ItemIndex >= 0;
|
||||||
|
//ListBox.Selected[1];
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
||||||
@ -10,23 +10,21 @@ object PathEditorDialog: TPathEditorDialog
|
|||||||
Constraints.MinHeight = 400
|
Constraints.MinHeight = 400
|
||||||
Constraints.MinWidth = 500
|
Constraints.MinWidth = 500
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
|
OnDestroy = FormDestroy
|
||||||
OnResize = FormResize
|
OnResize = FormResize
|
||||||
OnShow = FormShow
|
OnShow = FormShow
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
LCLVersion = '1.9.0.0'
|
LCLVersion = '1.9.0.0'
|
||||||
object PathGroupBox: TGroupBox
|
object PathGroupBox: TGroupBox
|
||||||
|
AnchorSideBottom.Control = AddTemplateButton
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 237
|
Height = 366
|
||||||
Top = 6
|
Top = 6
|
||||||
Width = 558
|
Width = 558
|
||||||
Align = alClient
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
Anchors = [akTop, akLeft, akRight]
|
BorderSpacing.Around = 6
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Left = 6
|
|
||||||
BorderSpacing.Top = 6
|
|
||||||
BorderSpacing.Right = 6
|
|
||||||
Caption = 'PathGroupBox'
|
Caption = 'PathGroupBox'
|
||||||
ClientHeight = 219
|
ClientHeight = 335
|
||||||
ClientWidth = 554
|
ClientWidth = 554
|
||||||
Constraints.MinHeight = 194
|
Constraints.MinHeight = 194
|
||||||
Constraints.MinWidth = 488
|
Constraints.MinWidth = 488
|
||||||
@ -36,10 +34,10 @@ object PathEditorDialog: TPathEditorDialog
|
|||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideBottom.Control = PathGroupBox
|
AnchorSideBottom.Control = PathGroupBox
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 191
|
Left = 210
|
||||||
Height = 23
|
Height = 30
|
||||||
Top = 190
|
Top = 299
|
||||||
Width = 89
|
Width = 100
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
@ -56,7 +54,7 @@ object PathEditorDialog: TPathEditorDialog
|
|||||||
AnchorSideRight.Control = MoveUpButton
|
AnchorSideRight.Control = MoveUpButton
|
||||||
AnchorSideBottom.Control = DirectoryEdit
|
AnchorSideBottom.Control = DirectoryEdit
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 151
|
Height = 248
|
||||||
Top = 6
|
Top = 6
|
||||||
Width = 511
|
Width = 511
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
@ -69,7 +67,6 @@ object PathEditorDialog: TPathEditorDialog
|
|||||||
OnKeyDown = PathListBoxKeyDown
|
OnKeyDown = PathListBoxKeyDown
|
||||||
OnSelectionChange = PathListBoxSelectionChange
|
OnSelectionChange = PathListBoxSelectionChange
|
||||||
PopupMenu = PopupMenu1
|
PopupMenu = PopupMenu1
|
||||||
ScrollWidth = 492
|
|
||||||
Style = lbOwnerDrawFixed
|
Style = lbOwnerDrawFixed
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
@ -78,9 +75,9 @@ object PathEditorDialog: TPathEditorDialog
|
|||||||
AnchorSideBottom.Control = PathGroupBox
|
AnchorSideBottom.Control = PathGroupBox
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 23
|
Height = 30
|
||||||
Top = 190
|
Top = 299
|
||||||
Width = 96
|
Width = 108
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
@ -96,10 +93,10 @@ object PathEditorDialog: TPathEditorDialog
|
|||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideBottom.Control = PathGroupBox
|
AnchorSideBottom.Control = PathGroupBox
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 108
|
Left = 120
|
||||||
Height = 23
|
Height = 30
|
||||||
Top = 190
|
Top = 299
|
||||||
Width = 77
|
Width = 84
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
@ -115,10 +112,10 @@ object PathEditorDialog: TPathEditorDialog
|
|||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideBottom.Control = PathGroupBox
|
AnchorSideBottom.Control = PathGroupBox
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 286
|
Left = 316
|
||||||
Height = 23
|
Height = 30
|
||||||
Top = 190
|
Top = 299
|
||||||
Width = 148
|
Width = 179
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
@ -135,8 +132,8 @@ object PathEditorDialog: TPathEditorDialog
|
|||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = ReplaceButton
|
AnchorSideBottom.Control = ReplaceButton
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 21
|
Height = 33
|
||||||
Top = 163
|
Top = 260
|
||||||
Width = 511
|
Width = 511
|
||||||
OnAcceptDirectory = DirectoryEditAcceptDirectory
|
OnAcceptDirectory = DirectoryEditAcceptDirectory
|
||||||
ShowHidden = False
|
ShowHidden = False
|
||||||
@ -155,7 +152,7 @@ object PathEditorDialog: TPathEditorDialog
|
|||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 523
|
Left = 523
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 49
|
Top = 81
|
||||||
Width = 25
|
Width = 25
|
||||||
Anchors = [akRight]
|
Anchors = [akRight]
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
@ -172,7 +169,7 @@ object PathEditorDialog: TPathEditorDialog
|
|||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 523
|
Left = 523
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 83
|
Top = 115
|
||||||
Width = 25
|
Width = 25
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
BorderSpacing.Top = 9
|
BorderSpacing.Top = 9
|
||||||
@ -181,62 +178,10 @@ object PathEditorDialog: TPathEditorDialog
|
|||||||
ParentShowHint = False
|
ParentShowHint = False
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object TemplateGroupBox: TGroupBox
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
Left = 6
|
|
||||||
Height = 164
|
|
||||||
Top = 248
|
|
||||||
Width = 558
|
|
||||||
Align = alBottom
|
|
||||||
Anchors = []
|
|
||||||
BorderSpacing.Left = 6
|
|
||||||
BorderSpacing.Right = 6
|
|
||||||
BorderSpacing.Bottom = 6
|
|
||||||
Caption = 'TemplateGroupBox'
|
|
||||||
ClientHeight = 146
|
|
||||||
ClientWidth = 554
|
|
||||||
TabOrder = 1
|
|
||||||
object TemplatesListBox: TListBox
|
|
||||||
AnchorSideLeft.Control = TemplateGroupBox
|
|
||||||
AnchorSideTop.Control = TemplateGroupBox
|
|
||||||
AnchorSideRight.Control = TemplateGroupBox
|
|
||||||
AnchorSideRight.Side = asrBottom
|
|
||||||
AnchorSideBottom.Control = AddTemplateButton
|
|
||||||
Left = 6
|
|
||||||
Height = 105
|
|
||||||
Top = 6
|
|
||||||
Width = 542
|
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
|
||||||
BorderSpacing.Around = 6
|
|
||||||
ItemHeight = 0
|
|
||||||
MultiSelect = True
|
|
||||||
OnDblClick = TemplatesListBoxDblClick
|
|
||||||
OnSelectionChange = TemplatesListBoxSelectionChange
|
|
||||||
ScrollWidth = 523
|
|
||||||
TabOrder = 0
|
|
||||||
end
|
|
||||||
object AddTemplateButton: TBitBtn
|
|
||||||
AnchorSideLeft.Control = TemplateGroupBox
|
|
||||||
AnchorSideBottom.Control = TemplateGroupBox
|
|
||||||
AnchorSideBottom.Side = asrBottom
|
|
||||||
Left = 6
|
|
||||||
Height = 23
|
|
||||||
Top = 117
|
|
||||||
Width = 121
|
|
||||||
Anchors = [akLeft, akBottom]
|
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Around = 6
|
|
||||||
Caption = 'AddTemplateButton'
|
|
||||||
OnClick = AddTemplateButtonClick
|
|
||||||
ParentShowHint = False
|
|
||||||
ShowHint = True
|
|
||||||
TabOrder = 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
object ButtonPanel1: TButtonPanel
|
object ButtonPanel1: TButtonPanel
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 26
|
Height = 30
|
||||||
Top = 418
|
Top = 414
|
||||||
Width = 558
|
Width = 558
|
||||||
OKButton.Name = 'OKButton'
|
OKButton.Name = 'OKButton'
|
||||||
OKButton.DefaultCaption = True
|
OKButton.DefaultCaption = True
|
||||||
@ -246,27 +191,33 @@ object PathEditorDialog: TPathEditorDialog
|
|||||||
CloseButton.DefaultCaption = True
|
CloseButton.DefaultCaption = True
|
||||||
CancelButton.Name = 'CancelButton'
|
CancelButton.Name = 'CancelButton'
|
||||||
CancelButton.DefaultCaption = True
|
CancelButton.DefaultCaption = True
|
||||||
TabOrder = 2
|
TabOrder = 1
|
||||||
ShowButtons = [pbOK, pbCancel]
|
ShowButtons = [pbOK, pbCancel]
|
||||||
ShowBevel = False
|
ShowBevel = False
|
||||||
end
|
end
|
||||||
object Splitter1: TSplitter
|
object AddTemplateButton: TBitBtn
|
||||||
Cursor = crVSplit
|
AnchorSideBottom.Control = ButtonPanel1
|
||||||
Left = 0
|
Left = 16
|
||||||
Height = 5
|
Height = 30
|
||||||
Top = 243
|
Top = 378
|
||||||
Width = 570
|
Width = 142
|
||||||
Align = alBottom
|
Anchors = [akLeft, akBottom]
|
||||||
ResizeAnchor = akBottom
|
AutoSize = True
|
||||||
|
BorderSpacing.Around = 6
|
||||||
|
Caption = 'AddTemplateButton'
|
||||||
|
OnClick = AddTemplateButtonClick
|
||||||
|
ParentShowHint = False
|
||||||
|
ShowHint = True
|
||||||
|
TabOrder = 2
|
||||||
end
|
end
|
||||||
object BrowseDialog: TSelectDirectoryDialog
|
object BrowseDialog: TSelectDirectoryDialog
|
||||||
Options = [ofFileMustExist, ofEnableSizing, ofViewDetail]
|
Options = [ofFileMustExist, ofEnableSizing, ofViewDetail]
|
||||||
left = 350
|
Left = 350
|
||||||
top = 50
|
Top = 50
|
||||||
end
|
end
|
||||||
object PopupMenu1: TPopupMenu
|
object PopupMenu1: TPopupMenu
|
||||||
left = 130
|
Left = 130
|
||||||
top = 100
|
Top = 100
|
||||||
object CopyMenuItem: TMenuItem
|
object CopyMenuItem: TMenuItem
|
||||||
Caption = 'Copy All'
|
Caption = 'Copy All'
|
||||||
OnClick = CopyMenuItemClick
|
OnClick = CopyMenuItemClick
|
||||||
@ -288,11 +239,11 @@ object PathEditorDialog: TPathEditorDialog
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
object OpenDialog1: TOpenDialog
|
object OpenDialog1: TOpenDialog
|
||||||
left = 240
|
Left = 240
|
||||||
top = 100
|
Top = 100
|
||||||
end
|
end
|
||||||
object SaveDialog1: TSaveDialog
|
object SaveDialog1: TSaveDialog
|
||||||
left = 350
|
Left = 350
|
||||||
top = 100
|
Top = 100
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -21,9 +21,18 @@ unit PathEditorDlg;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, types, Forms, Controls, Buttons, StdCtrls, Dialogs, Graphics,
|
Classes, SysUtils, types,
|
||||||
Menus, ButtonPanel, ExtCtrls, FileUtil, LazFileUtils, MacroIntf, IDEImagesIntf,
|
// LCL
|
||||||
LCLType, TransferMacros, LazarusIDEStrConsts, ShortPathEdit, Clipbrd, LCLProc;
|
LCLType, LCLProc, Forms, Controls, Buttons, StdCtrls, Dialogs, Menus, Graphics,
|
||||||
|
ButtonPanel, Clipbrd,
|
||||||
|
// LazUtils
|
||||||
|
FileUtil, LazFileUtils,
|
||||||
|
// LazControls
|
||||||
|
ShortPathEdit,
|
||||||
|
// IdeIntf
|
||||||
|
MacroIntf, IDEImagesIntf,
|
||||||
|
// IDE
|
||||||
|
TransferMacros, GenericListSelect, LazarusIDEStrConsts;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -46,17 +55,15 @@ type
|
|||||||
AddButton: TBitBtn;
|
AddButton: TBitBtn;
|
||||||
DeleteInvalidPathsButton: TBitBtn;
|
DeleteInvalidPathsButton: TBitBtn;
|
||||||
DirectoryEdit: TShortPathEdit;
|
DirectoryEdit: TShortPathEdit;
|
||||||
Splitter1: TSplitter;
|
|
||||||
DeleteButton: TBitBtn;
|
DeleteButton: TBitBtn;
|
||||||
PathListBox: TListBox;
|
PathListBox: TListBox;
|
||||||
TemplatesListBox: TListBox;
|
|
||||||
TemplateGroupBox: TGroupBox;
|
|
||||||
PathGroupBox: TGroupBox;
|
PathGroupBox: TGroupBox;
|
||||||
BrowseDialog: TSelectDirectoryDialog;
|
BrowseDialog: TSelectDirectoryDialog;
|
||||||
procedure AddButtonClick(Sender: TObject);
|
procedure AddButtonClick(Sender: TObject);
|
||||||
procedure AddTemplateButtonClick(Sender: TObject);
|
procedure AddTemplateButtonClick(Sender: TObject);
|
||||||
procedure CopyMenuItemClick(Sender: TObject);
|
procedure CopyMenuItemClick(Sender: TObject);
|
||||||
procedure ExportMenuItemClick(Sender: TObject);
|
procedure ExportMenuItemClick(Sender: TObject);
|
||||||
|
procedure FormDestroy(Sender: TObject);
|
||||||
procedure PasteMenuItemClick(Sender: TObject);
|
procedure PasteMenuItemClick(Sender: TObject);
|
||||||
procedure DeleteInvalidPathsButtonClick(Sender: TObject);
|
procedure DeleteInvalidPathsButtonClick(Sender: TObject);
|
||||||
procedure DeleteButtonClick(Sender: TObject);
|
procedure DeleteButtonClick(Sender: TObject);
|
||||||
@ -79,6 +86,8 @@ type
|
|||||||
private
|
private
|
||||||
FBaseDirectory: string;
|
FBaseDirectory: string;
|
||||||
FEffectiveBaseDirectory: string;
|
FEffectiveBaseDirectory: string;
|
||||||
|
FTemplateList: TStringList;
|
||||||
|
procedure AddPath(aPath: String; aObject: TObject);
|
||||||
function GetPath: string;
|
function GetPath: string;
|
||||||
function GetTemplates: string;
|
function GetTemplates: string;
|
||||||
function BaseRelative(const APath: string): String;
|
function BaseRelative(const APath: string): String;
|
||||||
@ -231,20 +240,21 @@ begin
|
|||||||
Result:=TObject(1);
|
Result:=TObject(1);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPathEditorDialog.AddButtonClick(Sender: TObject);
|
procedure TPathEditorDialog.AddPath(aPath: String; aObject: TObject);
|
||||||
var
|
var
|
||||||
y: integer;
|
y: integer;
|
||||||
RelPath: String;
|
|
||||||
begin
|
begin
|
||||||
with PathListBox do begin
|
y:=PathListBox.ItemIndex+1;
|
||||||
y:=ItemIndex+1;
|
|
||||||
if y=0 then
|
if y=0 then
|
||||||
y:=Count;
|
y:=PathListBox.Count;
|
||||||
RelPath:=BaseRelative(DirectoryEdit.Text);
|
PathListBox.Items.InsertObject(y, aPath, aObject);
|
||||||
Items.InsertObject(y, RelPath, PathMayExist(DirectoryEdit.Text));
|
PathListBox.ItemIndex:=y;
|
||||||
ItemIndex:=y;
|
|
||||||
UpdateButtons;
|
UpdateButtons;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TPathEditorDialog.AddButtonClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
AddPath(BaseRelative(DirectoryEdit.Text), PathMayExist(DirectoryEdit.Text));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPathEditorDialog.ReplaceButtonClick(Sender: TObject);
|
procedure TPathEditorDialog.ReplaceButtonClick(Sender: TObject);
|
||||||
@ -286,19 +296,20 @@ end;
|
|||||||
|
|
||||||
procedure TPathEditorDialog.AddTemplateButtonClick(Sender: TObject);
|
procedure TPathEditorDialog.AddTemplateButtonClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
i, y: integer;
|
TemplateForm: TGenericListSelectForm;
|
||||||
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
y:=-1;
|
TemplateForm := TGenericListSelectForm.Create(Nil);
|
||||||
for i:=0 to TemplatesListBox.Items.Count-1 do begin
|
try
|
||||||
if TemplatesListBox.Selected[i]
|
// Let a user select only templates which are not in the list already.
|
||||||
and (PathListBox.Items.IndexOf(TemplatesListBox.Items[i])=-1) then begin
|
for i := 0 to FTemplateList.Count-1 do
|
||||||
PathListBox.Items.AddObject(TemplatesListBox.Items[i], TObject(1));
|
if PathListBox.Items.IndexOf(FTemplateList[i]) = -1 then
|
||||||
y:=PathListBox.Count-1;
|
TemplateForm.ListBox.Items.Add(FTemplateList[i]);
|
||||||
end;
|
if TemplateForm.ShowModal = mrOK then
|
||||||
end;
|
with TemplateForm.ListBox do
|
||||||
if y>=1 then begin
|
AddPath(Items[ItemIndex], TObject(1));
|
||||||
PathListBox.ItemIndex:=y;
|
finally
|
||||||
UpdateButtons;
|
TemplateForm.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -356,7 +367,6 @@ begin
|
|||||||
PathListBox.Items.InsertObject(y, BaseRelative(s), PathMayExist(s));
|
PathListBox.Items.InsertObject(y, BaseRelative(s), PathMayExist(s));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
//PathListBox.ItemIndex := y;
|
|
||||||
UpdateButtons;
|
UpdateButtons;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -420,12 +430,11 @@ procedure TPathEditorDialog.FormCreate(Sender: TObject);
|
|||||||
const
|
const
|
||||||
Filt = 'Text file (*.txt)|*.txt|All files (*)|*';
|
Filt = 'Text file (*.txt)|*.txt|All files (*)|*';
|
||||||
begin
|
begin
|
||||||
|
FTemplateList := TStringList.Create;
|
||||||
Caption:=dlgDebugOptionsPathEditorDlgCaption;
|
Caption:=dlgDebugOptionsPathEditorDlgCaption;
|
||||||
|
|
||||||
PathGroupBox.Caption:=lisPathEditSearchPaths;
|
PathGroupBox.Caption:=lisPathEditSearchPaths;
|
||||||
MoveUpButton.Hint:=lisPathEditMovePathUp;
|
MoveUpButton.Hint:=lisPathEditMovePathUp;
|
||||||
MoveDownButton.Hint:=lisPathEditMovePathDown;
|
MoveDownButton.Hint:=lisPathEditMovePathDown;
|
||||||
|
|
||||||
ReplaceButton.Caption:=lisReplace;
|
ReplaceButton.Caption:=lisReplace;
|
||||||
ReplaceButton.Hint:=lisPathEditorReplaceHint;
|
ReplaceButton.Hint:=lisPathEditorReplaceHint;
|
||||||
AddButton.Caption:=lisAdd;
|
AddButton.Caption:=lisAdd;
|
||||||
@ -434,8 +443,6 @@ begin
|
|||||||
DeleteButton.Hint:=lisPathEditorDeleteHint;
|
DeleteButton.Hint:=lisPathEditorDeleteHint;
|
||||||
DeleteInvalidPathsButton.Caption:=lisPathEditDeleteInvalidPaths;
|
DeleteInvalidPathsButton.Caption:=lisPathEditDeleteInvalidPaths;
|
||||||
DeleteInvalidPathsButton.Hint:=lisPathEditorDeleteInvalidHint;
|
DeleteInvalidPathsButton.Hint:=lisPathEditorDeleteInvalidHint;
|
||||||
|
|
||||||
TemplateGroupBox.Caption:=lisPathEditPathTemplates;
|
|
||||||
AddTemplateButton.Caption:=lisCodeTemplAdd;
|
AddTemplateButton.Caption:=lisCodeTemplAdd;
|
||||||
AddTemplateButton.Hint:=lisPathEditorTemplAddHint;
|
AddTemplateButton.Hint:=lisPathEditorTemplAddHint;
|
||||||
|
|
||||||
@ -461,6 +468,17 @@ begin
|
|||||||
TIDEImages.AssignImage(AddTemplateButton.Glyph, 'laz_add');
|
TIDEImages.AssignImage(AddTemplateButton.Glyph, 'laz_add');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TPathEditorDialog.FormDestroy(Sender: TObject);
|
||||||
|
begin
|
||||||
|
FTemplateList.Free;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPathEditorDialog.FormShow(Sender: TObject);
|
||||||
|
begin
|
||||||
|
PathListBox.ItemIndex:=-1;
|
||||||
|
UpdateButtons;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TPathEditorDialog.FormResize(Sender: TObject);
|
procedure TPathEditorDialog.FormResize(Sender: TObject);
|
||||||
var
|
var
|
||||||
PathGroupBoxHeight: integer;
|
PathGroupBoxHeight: integer;
|
||||||
@ -471,13 +489,6 @@ begin
|
|||||||
PathGroupBox.Height:=PathGroupBoxHeight;
|
PathGroupBox.Height:=PathGroupBoxHeight;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPathEditorDialog.FormShow(Sender: TObject);
|
|
||||||
begin
|
|
||||||
PathListBox.ItemIndex:=-1;
|
|
||||||
TemplatesListBox.ItemIndex:=-1;
|
|
||||||
UpdateButtons;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TPathEditorDialog.MoveDownButtonClick(Sender: TObject);
|
procedure TPathEditorDialog.MoveDownButtonClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
y: integer;
|
y: integer;
|
||||||
@ -531,11 +542,6 @@ begin
|
|||||||
Result:=TextToPath(PathListBox.Items.Text);
|
Result:=TextToPath(PathListBox.Items.Text);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TPathEditorDialog.GetTemplates: string;
|
|
||||||
begin
|
|
||||||
Result:=TextToPath(TemplatesListBox.Items.Text);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TPathEditorDialog.SetPath(const AValue: string);
|
procedure TPathEditorDialog.SetPath(const AValue: string);
|
||||||
var
|
var
|
||||||
sl: TStringList;
|
sl: TStringList;
|
||||||
@ -554,16 +560,17 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPathEditorDialog.SetTemplates(const AValue: string);
|
function TPathEditorDialog.GetTemplates: string;
|
||||||
var
|
|
||||||
NewVis: Boolean;
|
|
||||||
begin
|
begin
|
||||||
TemplatesListBox.Items.Text := PathToText(AValue);
|
raise Exception.Create('TPathEditorDialog.GetTemplates is called.');
|
||||||
NewVis := TemplatesListBox.Count > 0;
|
//Result := TextToPath(FTemplateList.Text);
|
||||||
if NewVis = TemplateGroupBox.Visible then Exit;
|
end;
|
||||||
TemplateGroupBox.Visible := NewVis;
|
|
||||||
if NewVis then
|
procedure TPathEditorDialog.SetTemplates(const AValue: string);
|
||||||
TemplateGroupBox.Top:=0;
|
begin
|
||||||
|
// ToDo: Split the path directly to StringList without Text property.
|
||||||
|
FTemplateList.Text := PathToText(GetForcedPathDelims(AValue));
|
||||||
|
AddTemplateButton.Enabled := FTemplateList.Count > 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPathEditorDialog.UpdateButtons;
|
procedure TPathEditorDialog.UpdateButtons;
|
||||||
@ -576,8 +583,6 @@ begin
|
|||||||
and (PathListBox.Items.IndexOf(BaseRelative(DirectoryEdit.Text))=-1);
|
and (PathListBox.Items.IndexOf(BaseRelative(DirectoryEdit.Text))=-1);
|
||||||
ReplaceButton.Enabled:=AddButton.Enabled and (PathListBox.ItemIndex>-1) ;
|
ReplaceButton.Enabled:=AddButton.Enabled and (PathListBox.ItemIndex>-1) ;
|
||||||
DeleteButton.Enabled:=PathListBox.SelCount=1; // or ItemIndex>-1; ?
|
DeleteButton.Enabled:=PathListBox.SelCount=1; // or ItemIndex>-1; ?
|
||||||
AddTemplateButton.Enabled:=(TemplatesListBox.SelCount>1) or ((TemplatesListBox.ItemIndex>-1)
|
|
||||||
and (PathListBox.Items.IndexOf(TemplatesListBox.Items[TemplatesListBox.ItemIndex])=-1));
|
|
||||||
// Delete non-existent paths button. Check if there are any.
|
// Delete non-existent paths button. Check if there are any.
|
||||||
InValidPathsExist:=False;
|
InValidPathsExist:=False;
|
||||||
for i:=0 to PathListBox.Items.Count-1 do
|
for i:=0 to PathListBox.Items.Count-1 do
|
||||||
@ -608,7 +613,7 @@ begin
|
|||||||
FCurrentPathEditor:=PathEditorDialog;
|
FCurrentPathEditor:=PathEditorDialog;
|
||||||
try
|
try
|
||||||
inherited Click;
|
inherited Click;
|
||||||
FCurrentPathEditor.Templates := GetForcedPathDelims(FTemplates);
|
FCurrentPathEditor.Templates := FTemplates;
|
||||||
FCurrentPathEditor.Path := AssociatedEdit.Text;
|
FCurrentPathEditor.Path := AssociatedEdit.Text;
|
||||||
FCurrentPathEditor.ShowModal;
|
FCurrentPathEditor.ShowModal;
|
||||||
DoOnPathEditorExecuted;
|
DoOnPathEditorExecuted;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user