mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 15:21:48 +02:00
ide, packager: add IDE integration page
git-svn-id: trunk@29499 -
This commit is contained in:
parent
78d68ef5a6
commit
a4f6f1e56a
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -5502,6 +5502,8 @@ packager/confirmpkglistdlg.lfm svneol=native#text/plain
|
|||||||
packager/confirmpkglistdlg.pas svneol=native#text/plain
|
packager/confirmpkglistdlg.pas svneol=native#text/plain
|
||||||
packager/frames/package_description_options.lfm svneol=native#text/plain
|
packager/frames/package_description_options.lfm svneol=native#text/plain
|
||||||
packager/frames/package_description_options.pas svneol=native#text/pascal
|
packager/frames/package_description_options.pas svneol=native#text/pascal
|
||||||
|
packager/frames/package_integration_options.lfm svneol=native#text/plain
|
||||||
|
packager/frames/package_integration_options.pas svneol=native#text/pascal
|
||||||
packager/frames/package_usage_options.lfm svneol=native#text/plain
|
packager/frames/package_usage_options.lfm svneol=native#text/plain
|
||||||
packager/frames/package_usage_options.pas svneol=native#text/pascal
|
packager/frames/package_usage_options.pas svneol=native#text/pascal
|
||||||
packager/globallinks/README.txt svneol=native#text/plain
|
packager/globallinks/README.txt svneol=native#text/plain
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
<PackageName Value="SynEdit"/>
|
<PackageName Value="SynEdit"/>
|
||||||
</Item6>
|
</Item6>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units Count="79">
|
<Units Count="80">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="lazarus.pp"/>
|
<Filename Value="lazarus.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
@ -600,6 +600,13 @@
|
|||||||
<ResourceBaseClass Value="Frame"/>
|
<ResourceBaseClass Value="Frame"/>
|
||||||
<UnitName Value="package_description_options"/>
|
<UnitName Value="package_description_options"/>
|
||||||
</Unit78>
|
</Unit78>
|
||||||
|
<Unit79>
|
||||||
|
<Filename Value="../packager/frames/package_integration_options.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<ComponentName Value="PackageIntegrationOptionsFrame"/>
|
||||||
|
<ResourceBaseClass Value="Frame"/>
|
||||||
|
<UnitName Value="package_integration_options"/>
|
||||||
|
</Unit79>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
|
@ -131,7 +131,7 @@ uses
|
|||||||
compiler_other_options, compiler_inherited_options, compiler_compilation_options,
|
compiler_other_options, compiler_inherited_options, compiler_compilation_options,
|
||||||
BuildModesEditor,
|
BuildModesEditor,
|
||||||
// package option frames
|
// package option frames
|
||||||
package_usage_options, package_description_options,
|
package_usage_options, package_description_options, package_integration_options,
|
||||||
|
|
||||||
// rest of the ide
|
// rest of the ide
|
||||||
Splash, IDEDefs, LazarusIDEStrConsts, LazConf, MsgView, SearchResultView,
|
Splash, IDEDefs, LazarusIDEStrConsts, LazConf, MsgView, SearchResultView,
|
||||||
|
101
packager/frames/package_integration_options.lfm
Normal file
101
packager/frames/package_integration_options.lfm
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
inherited PackageIntegrationOptionsFrame: TPackageIntegrationOptionsFrame
|
||||||
|
Height = 352
|
||||||
|
Width = 461
|
||||||
|
ClientHeight = 352
|
||||||
|
ClientWidth = 461
|
||||||
|
TabOrder = 0
|
||||||
|
DesignLeft = 517
|
||||||
|
DesignTop = 273
|
||||||
|
object PkgTypeRadioGroup: TRadioGroup[0]
|
||||||
|
AnchorSideLeft.Control = Owner
|
||||||
|
AnchorSideTop.Control = Owner
|
||||||
|
AnchorSideRight.Control = Owner
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 0
|
||||||
|
Height = 116
|
||||||
|
Top = 0
|
||||||
|
Width = 461
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
AutoFill = True
|
||||||
|
Caption = 'PackageType'
|
||||||
|
ChildSizing.LeftRightSpacing = 6
|
||||||
|
ChildSizing.TopBottomSpacing = 6
|
||||||
|
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||||
|
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||||
|
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||||
|
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||||
|
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||||
|
ChildSizing.ControlsPerLine = 1
|
||||||
|
ClientHeight = 98
|
||||||
|
ClientWidth = 457
|
||||||
|
ItemIndex = 2
|
||||||
|
Items.Strings = (
|
||||||
|
'Designtime only'
|
||||||
|
'Runtime only'
|
||||||
|
'Designtime and Runtime'
|
||||||
|
)
|
||||||
|
OnClick = PkgTypeRadioGroupClick
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object UpdateRadioGroup: TRadioGroup[1]
|
||||||
|
AnchorSideLeft.Control = Owner
|
||||||
|
AnchorSideTop.Control = PkgTypeRadioGroup
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = Owner
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 0
|
||||||
|
Height = 116
|
||||||
|
Top = 122
|
||||||
|
Width = 461
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
AutoFill = True
|
||||||
|
BorderSpacing.Top = 6
|
||||||
|
Caption = 'Update/Rebuild'
|
||||||
|
ChildSizing.LeftRightSpacing = 6
|
||||||
|
ChildSizing.TopBottomSpacing = 6
|
||||||
|
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||||
|
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||||
|
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||||
|
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||||
|
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||||
|
ChildSizing.ControlsPerLine = 1
|
||||||
|
ClientHeight = 98
|
||||||
|
ClientWidth = 457
|
||||||
|
ItemIndex = 0
|
||||||
|
Items.Strings = (
|
||||||
|
'Automatically rebuild as needed'
|
||||||
|
'Auto rebuild when rebuilding all'
|
||||||
|
'Manual compilation (never automatically)'
|
||||||
|
)
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
object LazDocGroupBox: TGroupBox[2]
|
||||||
|
AnchorSideLeft.Control = Owner
|
||||||
|
AnchorSideTop.Control = UpdateRadioGroup
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = Owner
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 0
|
||||||
|
Height = 53
|
||||||
|
Top = 244
|
||||||
|
Width = 461
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
AutoSize = True
|
||||||
|
BorderSpacing.Top = 6
|
||||||
|
Caption = 'LazDoc - Lazarus documentation'
|
||||||
|
ClientHeight = 35
|
||||||
|
ClientWidth = 457
|
||||||
|
TabOrder = 2
|
||||||
|
object LazDocPathEdit: TEdit
|
||||||
|
AnchorSideLeft.Control = LazDocGroupBox
|
||||||
|
AnchorSideTop.Control = LazDocGroupBox
|
||||||
|
Left = 6
|
||||||
|
Height = 23
|
||||||
|
Top = 6
|
||||||
|
Width = 365
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Around = 6
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
234
packager/frames/package_integration_options.pas
Normal file
234
packager/frames/package_integration_options.pas
Normal file
@ -0,0 +1,234 @@
|
|||||||
|
unit package_integration_options;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, FileUtil, Forms, Controls, ExtCtrls, StdCtrls, Dialogs,
|
||||||
|
IDEOptionsIntf, MacroIntf,
|
||||||
|
LazarusIDEStrConsts, PackageDefs, PathEditorDlg, IDEProcs;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
{ TPackageIntegrationOptionsFrame }
|
||||||
|
|
||||||
|
TPackageIntegrationOptionsFrame = class(TAbstractIDEOptionsEditor)
|
||||||
|
LazDocGroupBox: TGroupBox;
|
||||||
|
LazDocPathEdit: TEdit;
|
||||||
|
PkgTypeRadioGroup: TRadioGroup;
|
||||||
|
UpdateRadioGroup: TRadioGroup;
|
||||||
|
procedure PkgTypeRadioGroupClick(Sender: TObject);
|
||||||
|
private
|
||||||
|
FLazPackage: TLazPackage;
|
||||||
|
LazDocPathButton: TPathEditorButton;
|
||||||
|
FStoredPkgType: Integer;
|
||||||
|
procedure PathEditBtnClick(Sender: TObject);
|
||||||
|
procedure PathEditBtnExecuted(Sender: TObject);
|
||||||
|
function ShowMsgPackageTypeMustBeDesign: boolean;
|
||||||
|
public
|
||||||
|
function Check: Boolean; override;
|
||||||
|
function GetTitle: string; override;
|
||||||
|
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
|
||||||
|
procedure ReadSettings(AOptions: TAbstractIDEOptions); override;
|
||||||
|
procedure WriteSettings(AOptions: TAbstractIDEOptions); override;
|
||||||
|
class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{$R *.lfm}
|
||||||
|
|
||||||
|
{ TPackageIntegrationOptionsFrame }
|
||||||
|
|
||||||
|
procedure TPackageIntegrationOptionsFrame.PkgTypeRadioGroupClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if (PkgTypeRadioGroup.ItemIndex = 1) and (FLazPackage.PackageType <> lptRunTime) then
|
||||||
|
begin
|
||||||
|
// user sets to runtime only
|
||||||
|
if (FLazPackage.AutoInstall <> pitNope) then
|
||||||
|
ShowMsgPackageTypeMustBeDesign;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPackageIntegrationOptionsFrame.PathEditBtnClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
AButton: TPathEditorButton absolute Sender;
|
||||||
|
begin
|
||||||
|
AButton.CurrentPathEditor.Path := LazDocPathEdit.Text;
|
||||||
|
AButton.CurrentPathEditor.Templates := '';
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPackageIntegrationOptionsFrame.PathEditBtnExecuted(Sender: TObject);
|
||||||
|
var
|
||||||
|
AButton: TPathEditorButton absolute Sender;
|
||||||
|
NewPath: string;
|
||||||
|
OldPath: string;
|
||||||
|
CurDir: string;
|
||||||
|
StartPos: integer;
|
||||||
|
DlgResult: TModalResult;
|
||||||
|
OldStartPos: longint;
|
||||||
|
begin
|
||||||
|
if AButton.CurrentPathEditor.ModalResult <> mrOk then
|
||||||
|
Exit;
|
||||||
|
NewPath := AButton.CurrentPathEditor.Path;
|
||||||
|
OldPath := LazDocPathEdit.Text;
|
||||||
|
if OldPath <> NewPath then
|
||||||
|
begin
|
||||||
|
// check NewPath
|
||||||
|
StartPos := 1;
|
||||||
|
repeat
|
||||||
|
OldStartPos := StartPos;
|
||||||
|
CurDir := GetNextDirectoryInSearchPath(NewPath, StartPos);
|
||||||
|
if CurDir <> '' then
|
||||||
|
begin
|
||||||
|
IDEMacros.SubstituteMacros(CurDir);
|
||||||
|
FLazPackage.LongenFilename(CurDir);
|
||||||
|
if not DirPathExists(CurDir) then
|
||||||
|
begin
|
||||||
|
DlgResult := QuestionDlg(lisEnvOptDlgDirectoryNotFound,
|
||||||
|
Format(lisDirectoryNotFound, ['"', CurDir, '"']),
|
||||||
|
mtError, [mrIgnore, mrYes, lisRemoveFromSearchPath, mrCancel], 0);
|
||||||
|
case DlgResult of
|
||||||
|
mrIgnore: ;
|
||||||
|
mrYes:
|
||||||
|
begin
|
||||||
|
// remove directory from search path
|
||||||
|
NewPath := copy(NewPath, 1, OldStartPos - 1) +
|
||||||
|
copy(NewPath, StartPos, length(NewPath));
|
||||||
|
StartPos := OldStartPos;
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
// undo
|
||||||
|
NewPath := OldPath;
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
until StartPos > length(NewPath);
|
||||||
|
end;
|
||||||
|
LazDocPathEdit.Text := NewPath;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TPackageIntegrationOptionsFrame.GetTitle: string;
|
||||||
|
begin
|
||||||
|
Result := lisPckOptsIDEIntegration;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPackageIntegrationOptionsFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
|
||||||
|
begin
|
||||||
|
PkgTypeRadioGroup.Caption := lisPckOptsPackageType;
|
||||||
|
PkgTypeRadioGroup.Items[0] := lisPckOptsDesigntimeOnly;
|
||||||
|
PkgTypeRadioGroup.Items[1] := lisPckOptsRuntimeOnly;
|
||||||
|
PkgTypeRadioGroup.Items[2] := lisPckOptsDesigntimeAndRuntime;
|
||||||
|
UpdateRadioGroup.Caption := lisPckOptsUpdateRebuild;
|
||||||
|
UpdateRadioGroup.Items[0] := lisPckOptsAutomaticallyRebuildAsNeeded;
|
||||||
|
UpdateRadioGroup.Items[1] := lisPckOptsAutoRebuildWhenRebuildingAll;
|
||||||
|
UpdateRadioGroup.Items[2] := lisPckOptsManualCompilationNeverAutomatically;
|
||||||
|
LazDocGroupBox.Caption := lisPckOptsLazDocLazarusDocumentation;
|
||||||
|
|
||||||
|
LazDocPathButton := TPathEditorButton.Create(Self);
|
||||||
|
with LazDocPathButton do
|
||||||
|
begin
|
||||||
|
Name := 'LazDocPathButton';
|
||||||
|
Caption := '...';
|
||||||
|
AutoSize := True;
|
||||||
|
Anchors := [akRight];
|
||||||
|
AnchorParallel(akRight, 6, LazDocGroupBox);
|
||||||
|
AnchorParallel(akTop, 0, LazDocPathEdit);
|
||||||
|
AnchorParallel(akBottom, 0, LazDocPathEdit);
|
||||||
|
OnClick := @PathEditBtnClick;
|
||||||
|
OnExecuted := @PathEditBtnExecuted;
|
||||||
|
Parent := LazDocGroupBox;
|
||||||
|
end;
|
||||||
|
LazDocPathEdit.AnchorToNeighbour(akRight, 0, LazDocPathButton);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPackageIntegrationOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
|
||||||
|
var
|
||||||
|
LazPackage: TLazPackage absolute AOptions;
|
||||||
|
begin
|
||||||
|
FLazPackage := LazPackage;
|
||||||
|
case LazPackage.PackageType of
|
||||||
|
lptDesignTime: PkgTypeRadioGroup.ItemIndex := 0;
|
||||||
|
lptRunTime: PkgTypeRadioGroup.ItemIndex := 1;
|
||||||
|
else
|
||||||
|
PkgTypeRadioGroup.ItemIndex := 2;
|
||||||
|
end;
|
||||||
|
FStoredPkgType := PkgTypeRadioGroup.ItemIndex;
|
||||||
|
case LazPackage.AutoUpdate of
|
||||||
|
pupAsNeeded: UpdateRadioGroup.ItemIndex := 0;
|
||||||
|
pupOnRebuildingAll: UpdateRadioGroup.ItemIndex := 1;
|
||||||
|
else
|
||||||
|
UpdateRadioGroup.ItemIndex := 2;
|
||||||
|
end;
|
||||||
|
LazDocPathEdit.Text := LazPackage.LazDocPaths;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TPackageIntegrationOptionsFrame.ShowMsgPackageTypeMustBeDesign: boolean;
|
||||||
|
begin
|
||||||
|
if MessageDlg(lisPckOptsInvalidPackageType,
|
||||||
|
Format(lisPckOptsThePackageHasTheAutoInstallFlagThisMeans,
|
||||||
|
['"', FLazPackage.IDAsString, '"', #13, #13]), mtWarning,
|
||||||
|
[mbIgnore, mbCancel], 0) <> mrIgnore then
|
||||||
|
begin
|
||||||
|
Result := True;
|
||||||
|
PkgTypeRadioGroup.ItemIndex := FStoredPkgType;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := False;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TPackageIntegrationOptionsFrame.Check: Boolean;
|
||||||
|
var
|
||||||
|
NewPackageType: TLazPackageType;
|
||||||
|
begin
|
||||||
|
case PkgTypeRadioGroup.ItemIndex of
|
||||||
|
0: NewPackageType := lptDesignTime;
|
||||||
|
1: NewPackageType := lptRunTime;
|
||||||
|
else
|
||||||
|
NewPackageType := lptRunAndDesignTime;
|
||||||
|
end;
|
||||||
|
if NewPackageType <> FLazPackage.PackageType then
|
||||||
|
begin
|
||||||
|
if (NewPackageType = lptRunTime) and (FLazPackage.AutoInstall <> pitNope) then
|
||||||
|
begin
|
||||||
|
if ShowMsgPackageTypeMustBeDesign then
|
||||||
|
Exit(False);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPackageIntegrationOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
|
||||||
|
var
|
||||||
|
LazPackage: TLazPackage absolute AOptions;
|
||||||
|
NewPackageType: TLazPackageType;
|
||||||
|
begin
|
||||||
|
case PkgTypeRadioGroup.ItemIndex of
|
||||||
|
0: NewPackageType := lptDesignTime;
|
||||||
|
1: NewPackageType := lptRunTime;
|
||||||
|
else
|
||||||
|
NewPackageType := lptRunAndDesignTime;
|
||||||
|
end;
|
||||||
|
LazPackage.PackageType := NewPackageType;
|
||||||
|
case UpdateRadioGroup.ItemIndex of
|
||||||
|
2: LazPackage.AutoUpdate := pupManually;
|
||||||
|
1: LazPackage.AutoUpdate := pupOnRebuildingAll;
|
||||||
|
else
|
||||||
|
LazPackage.AutoUpdate := pupAsNeeded;
|
||||||
|
end;
|
||||||
|
|
||||||
|
LazPackage.LazDocPaths := LazDocPathEdit.Text;
|
||||||
|
end;
|
||||||
|
|
||||||
|
class function TPackageIntegrationOptionsFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
|
||||||
|
begin
|
||||||
|
Result := TLazPackage;
|
||||||
|
end;
|
||||||
|
|
||||||
|
initialization
|
||||||
|
RegisterIDEOptionsEditor(GroupPackage, TPackageIntegrationOptionsFrame,
|
||||||
|
PackageOptionsIntegration);
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user