* Conversion to LFM of Path Editor Dialog and improved localization by Maxim Ganetsky

git-svn-id: trunk@13975 -
This commit is contained in:
marc 2008-02-04 22:24:30 +00:00
parent 75dbc4459a
commit 1932501559
2 changed files with 44 additions and 192 deletions

View File

@ -3571,6 +3571,7 @@ resourcestring
lisDebugOptionsFrmHandledByDebugger = 'Handled by Debugger';
lisDebugOptionsFrmResumeHandled = 'Resume Handled';
lisDebugOptionsFrmResumeUnhandled = 'Resume Unhandled';
dlgDebugOptionsPathEditorDlgCaption = 'Path Editor';
lisHFMHelpForFreePascalCompilerMessage = 'Help for FreePascal Compiler '
+'message';
lisRelativePaths = 'Relative paths';

View File

@ -32,27 +32,29 @@ uses
LResources, FileUtil, LazarusIDEStrConsts;
type
{ TPathEditorDialog }
TPathEditorDialog = class(TForm)
PathGroupBox: TGroupBox;
PathEdit: TSynEdit;
AddTemplateButton: TButton;
OKBitBtn: TBitBtn;
CancelBitBtn: TBitBtn;
TemplatesListBox: TListBox;
TemplateGroupBox: TGroupBox;
MoveUpButton: TButton;
MoveDownButton: TButton;
BrowseButton: TButton;
DeleteButton: TButton;
TemplateGroupBox: TGroupBox;
TemplatesListBox: TListBox;
AddTemplateButton: TButton;
OkButton: TButton;
CancelButton: TButton;
PathGroupBox: TGroupBox;
PathEdit: TSynEdit;
BrowseDialog: TSelectDirectoryDialog;
procedure AddTemplateButtonClick(Sender: TObject);
procedure BrowseButtonClick(Sender: TObject);
procedure CancelButtonClick(Sender: TObject);
procedure DeleteButtonClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure MoveDownButtonClick(Sender: TObject);
procedure MoveUpButtonClick(Sender: TObject);
procedure OkButtonClick(Sender: TObject);
procedure PathEditorDialogResize(Sender: TObject);
private
function GetPath: string;
function GetTemplates: string;
@ -60,11 +62,7 @@ type
procedure SelectCurrentPath;
procedure SetPath(const AValue: string);
procedure SetTemplates(const AValue: string);
procedure SetupComponents;
function TextToPath(const AText: string): string;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
public
property Path: string read GetPath write SetPath;
property Templates: string read GetTemplates write SetTemplates;
@ -119,10 +117,6 @@ end;
procedure TPathEditorDialog.BrowseButtonClick(Sender: TObject);
var y: integer;
begin
if BrowseDialog=nil then begin
BrowseDialog:=TSelectDirectoryDialog.Create(Self);
BrowseDialog.Options := BrowseDialog.Options + [ofFileMustExist];
end;
with BrowseDialog do begin
Title:=lisPathEditSelectDirectory;
if (not Execute) then exit;
@ -134,11 +128,6 @@ begin
SelectCurrentPath;
end;
procedure TPathEditorDialog.CancelButtonClick(Sender: TObject);
begin
ModalResult:=mrCancel;
end;
procedure TPathEditorDialog.DeleteButtonClick(Sender: TObject);
var y: integer;
begin
@ -149,6 +138,34 @@ begin
end;
end;
procedure TPathEditorDialog.FormCreate(Sender: TObject);
begin
Caption:=dlgDebugOptionsPathEditorDlgCaption;
PathGroupBox.Caption:=lisPathEditSearchPaths;
MoveUpButton.Caption:=lisPathEditMovePathUp;
MoveDownButton.Caption:=lisPathEditMovePathDown;
BrowseButton.Caption:=lisPathEditBrowse;
DeleteButton.Caption:=dlgEdDelete;
TemplateGroupBox.Caption:=lisPathEditPathTemplates;
AddTemplateButton.Caption:=lisCodeTemplAdd;
OKBitBtn.Caption:=lisOkBtn;
CancelBitBtn.Caption:=dlgCancel;
end;
procedure TPathEditorDialog.FormResize(Sender: TObject);
var PathGroupBoxHeight: integer;
begin
PathGroupBoxHeight:=((ClientHeight-70)*2) div 3;
if PathGroupBoxHeight<10 then PathGroupBoxHeight:=10;
PathGroupBox.Height:=PathGroupBoxHeight;
SelectCurrentPath;
end;
procedure TPathEditorDialog.MoveDownButtonClick(Sender: TObject);
var y: integer;
begin
@ -171,55 +188,6 @@ begin
end;
end;
procedure TPathEditorDialog.OkButtonClick(Sender: TObject);
begin
ModalResult:=mrOk;
end;
procedure TPathEditorDialog.PathEditorDialogResize(Sender: TObject);
var MaxX, MaxY, PathGroupBoxHeight: integer;
begin
MaxX:=ClientWidth;
MaxY:=ClientHeight;
PathGroupBoxHeight:=((MaxY-70)*2) div 3;
if PathGroupBoxHeight<10 then PathGroupBoxHeight:=10;
// path groupbox
PathGroupBox.SetBounds(6,6,MaxX-2*6,PathGroupBoxHeight);
PathEdit.SetBounds(2,2,
Max(1,PathGroupBox.Width-10),Max(1,PathGroupBox.Height-57));
MoveUpButton.SetBounds(8,PathEdit.Top+PathEdit.Height+8,
120,MoveUpButton.Height);
MoveDownButton.SetBounds(MoveUpButton.Left+MoveUpButton.Width+8,
MoveUpButton.Top,
MoveUpButton.Width,MoveUpButton.Height);
BrowseButton.SetBounds(MoveDownButton.Left+MoveDownButton.Width+8,
MoveDownButton.Top,
90,MoveDownButton.Height);
DeleteButton.SetBounds(BrowseButton.Left+BrowseButton.Width+8,
BrowseButton.Top,
BrowseButton.Width,BrowseButton.Height);
// template groupbox
with TemplateGroupBox do begin
Left:=PathGroupBox.Left;
Top:=PathGroupBox.Top+PathGroupBox.Height+8;
Width:=PathGroupBox.Width;
Height:=Max(1,MaxY-50-Top);
end;
TemplatesListBox.SetBounds(2,2,Max(1,TemplateGroupBox.Width-10),
Max(1,TemplateGroupBox.Height-57));
AddTemplateButton.SetBounds(8,TemplatesListBox.Top+TemplatesListBox.Height+8,
100,AddTemplateButton.Height);
// buttons at bottom
OkButton.SetBounds(20,Max(1,MaxY-35),100,OkButton.Height);
CancelButton.SetBounds(OkButton.Left+OkButton.Width+10,OkButton.Top,
OkButton.Width,OkButton.Height);
SelectCurrentPath;
end;
function TPathEditorDialog.GetPath: string;
begin
Result:=TextToPath(PathEdit.Text);
@ -261,107 +229,6 @@ begin
end;
end;
procedure TPathEditorDialog.SetupComponents;
begin
PathGroupBox:=TGroupBox.Create(Self);
with PathGroupBox do begin
Name:='PathGroupBox';
Parent:=Self;
Caption:=lisPathEditSearchPaths;
Visible:=true;
end;
PathEdit:=TSynEdit.Create(Self);
with PathEdit do begin
Name:='PathEdit';
Parent:=PathGroupBox;
Options:=[eoBracketHighlight, eoHideRightMargin, eoDragDropEditing,
eoHalfPageScroll, eoScrollByOneLess, eoScrollPastEol,
eoSmartTabs, eoTabsToSpaces, eoTrimTrailingSpaces];
Gutter.Visible:=false;
Visible:=true;
end;
MoveUpButton:=TButton.Create(Self);
with MoveUpButton do begin
Name:='MoveUpButton';
Parent:=PathGroupBox;
Caption:=lisPathEditMovePathUp;
OnClick:=@MoveUpButtonClick;
Visible:=true;
end;
MoveDownButton:=TButton.Create(Self);
with MoveDownButton do begin
Name:='MoveDownButton';
Parent:=PathGroupBox;
Caption:=lisPathEditMovePathDown;
OnClick:=@MoveDownButtonClick;
Visible:=true;
end;
BrowseButton:=TButton.Create(Self);
with BrowseButton do begin
Name:='BrowseButton';
Parent:=PathGroupBox;
Caption:=lisPathEditBrowse;
OnClick:=@BrowseButtonClick;
Visible:=true;
end;
DeleteButton:=TButton.Create(Self);
with DeleteButton do begin
Name:='DeleteButton';
Parent:=PathGroupBox;
Caption:=dlgEdDelete;
OnClick:=@DeleteButtonClick;
Visible:=true;
end;
TemplateGroupBox:=TGroupBox.Create(Self);
with TemplateGroupBox do begin
Name:='TemplateGroupBox';
Parent:=Self;
Caption:=lisPathEditPathTemplates;
Visible:=true;
end;
TemplatesListBox:=TListBox.Create(Self);
with TemplatesListBox do begin
Name:='TemplatesListBox';
Parent:=TemplateGroupBox;
MultiSelect:=true;
Visible:=true;
end;
AddTemplateButton:=TButton.Create(Self);
with AddTemplateButton do begin
Name:='AddTemplateButton';
Parent:=TemplateGroupBox;
Caption:=lisCodeTemplAdd;
OnClick:=@AddTemplateButtonClick;
Visible:=true;
end;
OkButton:=TButton.Create(Self);
with OkButton do begin
Name:='OkButton';
Parent:=Self;
Caption:=lisLazBuildOk;
OnClick:=@OkButtonClick;
Visible:=true;
end;
CancelButton:=TButton.Create(Self);
with CancelButton do begin
Name:='CancelButton';
Parent:=Self;
Caption:=dlgCancel;
OnClick:=@CancelButtonClick;
Visible:=true;
end;
end;
function TPathEditorDialog.TextToPath(const AText: string): string;
var i, j: integer;
PathAsText: string;
@ -426,25 +293,6 @@ begin
PathEdit.BlockEnd:=Point(length(PathEdit.Lines[y-1])+1,y);
end;
constructor TPathEditorDialog.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
if LazarusResources.Find(ClassName)=nil then begin
Width:=500;
Height:=400;
Position:=poScreenCenter;
OnResize:=@PathEditorDialogResize;
SetupComponents;
end;
PathEditorDialogResize(nil);
end;
destructor TPathEditorDialog.Destroy;
begin
inherited Destroy;
end;
{ TPathEditorButton }
procedure TPathEditorButton.Click;
@ -464,5 +312,8 @@ begin
if Assigned(OnExecuted) then OnExecuted(Self);
end;
initialization
{$I patheditordlg.lrs}
end.