41
41
Classes, SysUtils, LCLProc, Forms, Controls, Buttons, LResources,
42
42
ExtCtrls, StdCtrls, Spin, Dialogs, PathEditorDlg, IDEProcs, IDEWindowIntf,
43
IDEDialogs, MacroIntf,
43
44
LazarusIDEStrConsts, BrokenDependenciesDlg, PackageDefs, PackageSystem,
49
{ TPackageOptionsDialog }
47
51
TPackageOptionsDialog = class(TForm)
48
52
Notebook: TNotebook;
49
53
// Description page
89
93
PkgTypeRadioGroup: TRadioGroup;
90
94
UpdateRadioGroup: TRadioGroup;
95
LazDocGroupBox: TGroupBox;
96
LazDocPathEdit: TEdit;
97
LazDocPathButton: TPathEditorButton;
98
RSTOutputGroupBox: TGroupBox;
99
RSTOutputDirectoryEdit: TEdit;
100
RSTOutputDirectoryButton: TButton;
92
102
OkButton: TButton;
93
103
CancelButton: TButton;
95
105
procedure AddPathsGroupBoxResize(Sender: TObject);
96
106
procedure DescriptionPageResize(Sender: TObject);
97
107
procedure IDEPageResize(Sender: TObject);
108
procedure LazDocPathButtonClick(Sender: TObject);
98
109
procedure OkButtonClick(Sender: TObject);
110
procedure RSTOutputDirectoryButtonClick(Sender: TObject);
99
111
procedure PackageOptionsDialogClose(Sender: TObject;
100
112
var CloseAction: TCloseAction);
101
113
procedure PackageOptionsDialogResize(Sender: TObject);
194
209
AButton: TPathEditorButton;
215
DlgResult: TModalResult;
216
OldStartPos: LongInt;
198
218
if not (Sender is TPathEditorButton) then exit;
199
219
AButton:=TPathEditorButton(Sender);
200
220
if AButton.CurrentPathEditor.ModalResult<>mrOk then exit;
201
221
NewPath:=AButton.CurrentPathEditor.Path;
202
222
AnEdit:=GetEditForPathButton(AButton);
223
OldPath:=AnEdit.Text;
224
if OldPath<>NewPath then begin
228
OldStartPos:=StartPos;
229
CurDir:=GetNextDirectoryInSearchPath(NewPath,StartPos);
230
if CurDir<>'' then begin
231
IDEMacros.SubstituteMacros(CurDir);
232
LazPackage.LongenFilename(CurDir);
233
if not FileExists(CurDir) then begin
234
DlgResult:=QuestionDlg('Directory not found',
235
'Directory "'+CurDir+'" not found.',
236
mtError,[mrIgnore,mrYes,'Remove from search path',mrCancel],0);
241
// remove directory from search path
242
NewPath:=copy(NewPath,1,OldStartPos-1)
243
+copy(NewPath,StartPos,length(NewPath));
244
StartPos:=OldStartPos;
253
until StartPos>length(NewPath);
203
255
AnEdit.Text:=NewPath;
401
453
LinkerOptions:=LinkerOptionsMemo.Text;
402
454
CustomOptions:=CustomOptionsMemo.Text;
456
LazPackage.LazDocPaths:=LazDocPathEdit.Text;
457
LazPackage.RSTOutputDirectory:=RSTOutputDirectoryEdit.Text;
405
459
ModalResult:=mrOk;
462
procedure TPackageOptionsDialog.RSTOutputDirectoryButtonClick(Sender: TObject);
464
NewDirectory: string;
466
NewDirectory:=LazSelectDirectory(lisPOChoosePoFileDirectory,
467
LazPackage.Directory);
468
if NewDirectory='' then exit;
469
LazPackage.ShortenFilename(NewDirectory,true);
470
RSTOutputDirectoryEdit.Text:=NewDirectory;
408
473
procedure TPackageOptionsDialog.PackageOptionsDialogClose(Sender: TObject;
409
474
var CloseAction: TCloseAction);
748
AnchorToCompanion(akTop,6,PkgTypeRadioGroup);
752
LazDocGroupBox:=TGroupBox.Create(Self);
753
with LazDocGroupBox do begin
754
Name:='LazDocGroupBox';
755
Caption:='LazDoc - Lazarus documentation';
756
AnchorToCompanion(akTop,6,UpdateRadioGroup);
761
LazDocPathEdit:=TEdit.Create(Self);
762
with LazDocPathEdit do begin
763
Name:='LazDocPathEdit';
764
SetBounds(6,0,Width,Height);
765
Parent:=LazDocGroupBox;
768
LazDocPathButton:=TPathEditorButton.Create(Self);
769
with LazDocPathButton do begin
770
Name:='LazDocPathButton';
773
Anchors:=[akTop,akRight,akBottom];
774
AnchorParallel(akRight,6,LazDocGroupBox);
776
AnchorParallel(akBottom,0,LazDocPathEdit);
777
OnClick:=@PathEditBtnClick;
778
OnExecuted:=@PathEditBtnExecuted;
779
Parent:=LazDocGroupBox;
781
LazDocPathEdit.AnchorToNeighbour(akRight,0,LazDocPathButton);
784
RSTOutputGroupBox:=TGroupBox.Create(Self);
785
with RSTOutputGroupBox do begin
786
Name:='POFilesGroupBox';
787
Caption:='Directory of .po files';
788
AnchorToCompanion(akTop,6,LazDocGroupBox);
793
RSTOutputDirectoryEdit:=TEdit.Create(Self);
794
with RSTOutputDirectoryEdit do begin
795
Name:='POFilesPathEdit';
796
SetBounds(6,0,Width,Height);
797
Parent:=RSTOutputGroupBox;
800
RSTOutputDirectoryButton:=TButton.Create(Self);
801
with RSTOutputDirectoryButton do begin
802
Name:='POFilesPathButton';
805
Anchors:=[akTop,akRight,akBottom];
806
AnchorParallel(akRight,6,RSTOutputGroupBox);
808
AnchorParallel(akBottom,0,RSTOutputDirectoryEdit);
809
OnClick:=@RSTOutputDirectoryButtonClick;
810
Parent:=RSTOutputGroupBox;
812
RSTOutputDirectoryEdit.AnchorToNeighbour(akRight,0,RSTOutputDirectoryButton);
685
815
procedure TPackageOptionsDialog.SetupUsagePage(PageIndex: integer);