IDE: TPathEditorDialog: relative path stays relative, issue #22222

git-svn-id: trunk@37572 -
This commit is contained in:
mattias 2012-06-07 16:44:56 +00:00
parent 2ad9e952c2
commit ee27ca6289
2 changed files with 33 additions and 29 deletions

View File

@ -12,7 +12,7 @@ object PathEditorDialog: TPathEditorDialog
OnCreate = FormCreate
OnResize = FormResize
Position = poScreenCenter
LCLVersion = '0.9.31'
LCLVersion = '1.1'
object PathGroupBox: TGroupBox
Left = 6
Height = 221
@ -41,7 +41,6 @@ object PathEditorDialog: TPathEditorDialog
Anchors = [akRight]
BorderSpacing.Around = 6
GlyphShowMode = gsmAlways
NumGlyphs = 0
OnClick = MoveUpButtonClick
ParentShowHint = False
ShowHint = True
@ -60,7 +59,6 @@ object PathEditorDialog: TPathEditorDialog
Width = 25
BorderSpacing.Around = 14
GlyphShowMode = gsmAlways
NumGlyphs = 0
OnClick = MoveDownButtonClick
ParentShowHint = False
ShowHint = True
@ -80,7 +78,6 @@ object PathEditorDialog: TPathEditorDialog
BorderSpacing.Around = 6
Caption = 'DeleteButton'
Enabled = False
NumGlyphs = 0
OnClick = DeleteButtonClick
ParentShowHint = False
ShowHint = True
@ -90,7 +87,6 @@ object PathEditorDialog: TPathEditorDialog
AnchorSideLeft.Control = PathGroupBox
AnchorSideTop.Control = PathGroupBox
AnchorSideRight.Control = MoveUpButton
AnchorSideBottom.Control = DirectoryEdit
Left = 6
Height = 135
Top = 6
@ -104,23 +100,6 @@ object PathEditorDialog: TPathEditorDialog
Style = lbOwnerDrawFixed
TabOrder = 0
end
object DirectoryEdit: TDirectoryEdit
AnchorSideLeft.Control = ReplaceButton
AnchorSideRight.Control = PathListBox
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = ReplaceButton
Left = 6
Height = 21
Top = 147
Width = 494
ShowHidden = False
ButtonWidth = 23
NumGlyphs = 0
Anchors = [akLeft, akRight, akBottom]
MaxLength = 0
TabOrder = 3
OnChange = DirectoryEditChange
end
object ReplaceButton: TBitBtn
AnchorSideLeft.Control = PathGroupBox
AnchorSideBottom.Control = PathGroupBox
@ -134,7 +113,6 @@ object PathEditorDialog: TPathEditorDialog
BorderSpacing.Around = 6
Caption = 'ReplaceButton'
Enabled = False
NumGlyphs = 0
OnClick = ReplaceButtonClick
ParentShowHint = False
ShowHint = True
@ -154,7 +132,6 @@ object PathEditorDialog: TPathEditorDialog
BorderSpacing.Around = 6
Caption = 'AddButton'
Enabled = False
NumGlyphs = 0
OnClick = AddButtonClick
ParentShowHint = False
ShowHint = True
@ -174,12 +151,28 @@ object PathEditorDialog: TPathEditorDialog
BorderSpacing.Around = 6
Caption = 'DeleteInvalidPathsButton'
Enabled = False
NumGlyphs = 0
OnClick = DeleteInvalidPathsButtonClick
ParentShowHint = False
ShowHint = True
TabOrder = 7
end
object DirectoryEdit: TShortPathEdit
AnchorSideRight.Control = PathListBox
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = ReplaceButton
Left = 6
Height = 21
Top = 147
Width = 494
OnAcceptDirectory = DirectoryEditAcceptDirectory
ShowHidden = False
ButtonWidth = 23
NumGlyphs = 1
Anchors = [akLeft, akRight, akBottom]
MaxLength = 0
TabOrder = 3
OnChange = DirectoryEditChange
end
end
object TemplateGroupBox: TGroupBox
AnchorSideTop.Side = asrBottom
@ -224,7 +217,6 @@ object PathEditorDialog: TPathEditorDialog
AutoSize = True
BorderSpacing.Around = 6
Caption = 'AddTemplateButton'
NumGlyphs = 0
OnClick = AddTemplateButtonClick
ParentShowHint = False
ShowHint = True

View File

@ -29,7 +29,7 @@ interface
uses
Classes, SysUtils, Forms, Controls, Buttons, StdCtrls, Dialogs,
FileUtil, ButtonPanel, ExtCtrls, EditBtn, MacroIntf, LCLType, Graphics,
types, TransferMacros, LazarusIDEStrConsts;
types, TransferMacros, LazarusIDEStrConsts, shortpathedit;
type
@ -41,7 +41,7 @@ type
ReplaceButton: TBitBtn;
AddButton: TBitBtn;
DeleteInvalidPathsButton: TBitBtn;
DirectoryEdit: TDirectoryEdit;
DirectoryEdit: TShortPathEdit;
Splitter1: TSplitter;
DeleteButton: TBitBtn;
PathListBox: TListBox;
@ -55,6 +55,7 @@ type
procedure AddTemplateButtonClick(Sender: TObject);
procedure DeleteInvalidPathsButtonClick(Sender: TObject);
procedure DeleteButtonClick(Sender: TObject);
procedure DirectoryEditAcceptDirectory(Sender: TObject; var Value: String);
procedure DirectoryEditChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormResize(Sender: TObject);
@ -184,6 +185,12 @@ begin
UpdateButtons;
end;
procedure TPathEditorDialog.DirectoryEditAcceptDirectory(Sender: TObject;
var Value: String);
begin
DirectoryEdit.Text := BaseRelative(Value);
end;
procedure TPathEditorDialog.DeleteInvalidPathsButtonClick(Sender: TObject);
var
i: Integer;
@ -218,10 +225,15 @@ begin
end;
procedure TPathEditorDialog.PathListBoxSelectionChange(Sender: TObject; User: boolean);
Var
FullPath : String;
begin
with PathListBox do
if ItemIndex>-1 then begin
DirectoryEdit.Text:=PathAsAbsolute(Items[ItemIndex]);
DirectoryEdit.Text:=BaseRelative(Items[ItemIndex]);
FullPath := Items[ItemIndex];
IDEMacros.SubstituteMacros(FullPath);
DirectoryEdit.Directory:=PathAsAbsolute(FullPath);
UpdateButtons;
end;
end;