IDE: package options: replaced package type radiogroup with radiobuttons

git-svn-id: trunk@40711 -
This commit is contained in:
mattias 2013-04-04 10:42:19 +00:00
parent 10f425b162
commit e4ef60948a
2 changed files with 130 additions and 89 deletions

View File

@ -1,55 +1,19 @@
inherited PackageIntegrationOptionsFrame: TPackageIntegrationOptionsFrame object PackageIntegrationOptionsFrame: TPackageIntegrationOptionsFrame
Left = 0
Height = 352 Height = 352
Top = 0
Width = 461 Width = 461
ClientHeight = 352 ClientHeight = 352
ClientWidth = 461 ClientWidth = 461
TabOrder = 0 TabOrder = 0
DesignLeft = 517 DesignLeft = 768
DesignTop = 273 DesignTop = 267
object PkgTypeRadioGroup: TRadioGroup[0] object UpdateRadioGroup: TRadioGroup
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 0 Left = 0
Height = 124 Height = 103
Top = 0 Top = 133
Width = 461 Width = 461
Anchors = [akTop, akLeft, akRight] Align = alTop
AutoFill = True
AutoSize = 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 = 108
ClientWidth = 457
ItemIndex = 2
Items.Strings = (
'Designtime'
'Runtime'
'Designtime and Runtime'
'Runtime only, can not be installed in IDE'
)
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 = 100
Top = 130
Width = 461
Anchors = [akTop, akLeft, akRight]
AutoFill = True AutoFill = True
AutoSize = True AutoSize = True
BorderSpacing.Top = 6 BorderSpacing.Top = 6
@ -70,35 +34,30 @@ inherited PackageIntegrationOptionsFrame: TPackageIntegrationOptionsFrame
'Auto rebuild when rebuilding all' 'Auto rebuild when rebuilding all'
'Manual compilation (never automatically)' 'Manual compilation (never automatically)'
) )
TabOrder = 1 TabOrder = 0
end end
object DocGroupBox: TGroupBox[2] object DocGroupBox: TGroupBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = UpdateRadioGroup
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 0 Left = 0
Height = 82 Height = 91
Top = 236 Top = 242
Width = 461 Width = 461
Anchors = [akTop, akLeft, akRight] Align = alTop
AutoSize = True AutoSize = True
BorderSpacing.Top = 6 BorderSpacing.Top = 6
Caption = 'FPDoc settings' Caption = 'FPDoc settings'
ClientHeight = 66 ClientHeight = 72
ClientWidth = 457 ClientWidth = 457
TabOrder = 2 TabOrder = 1
object FPDocSearchPathsEdit: TEdit object FPDocSearchPathsEdit: TEdit
AnchorSideLeft.Control = FPDocSearchPathsLabel AnchorSideLeft.Control = FPDocSearchPathsLabel
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = DocGroupBox AnchorSideTop.Control = DocGroupBox
AnchorSideRight.Control = DocGroupBox AnchorSideRight.Control = DocGroupBox
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 146 Left = 175
Height = 24 Height = 27
Top = 6 Top = 6
Width = 305 Width = 276
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6 BorderSpacing.Around = 6
ParentShowHint = False ParentShowHint = False
@ -111,9 +70,9 @@ inherited PackageIntegrationOptionsFrame: TPackageIntegrationOptionsFrame
AnchorSideTop.Control = FPDocSearchPathsEdit AnchorSideTop.Control = FPDocSearchPathsEdit
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 6 Left = 6
Height = 15 Height = 17
Top = 11 Top = 11
Width = 134 Width = 163
BorderSpacing.Left = 6 BorderSpacing.Left = 6
BorderSpacing.Top = 6 BorderSpacing.Top = 6
Caption = 'FPDocSearchPathsLabel' Caption = 'FPDocSearchPathsLabel'
@ -124,9 +83,9 @@ inherited PackageIntegrationOptionsFrame: TPackageIntegrationOptionsFrame
AnchorSideTop.Control = FPDocPackageNameEdit AnchorSideTop.Control = FPDocPackageNameEdit
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 6 Left = 6
Height = 15 Height = 17
Top = 41 Top = 44
Width = 145 Width = 176
BorderSpacing.Left = 6 BorderSpacing.Left = 6
Caption = 'FPDocPackageNameLabel' Caption = 'FPDocPackageNameLabel'
ParentColor = False ParentColor = False
@ -136,9 +95,9 @@ inherited PackageIntegrationOptionsFrame: TPackageIntegrationOptionsFrame
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = FPDocSearchPathsEdit AnchorSideTop.Control = FPDocSearchPathsEdit
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 157 Left = 188
Height = 24 Height = 27
Top = 36 Top = 39
Width = 116 Width = 116
BorderSpacing.Around = 6 BorderSpacing.Around = 6
OnEnter = FPDocPackageNameEditEnter OnEnter = FPDocPackageNameEditEnter
@ -149,4 +108,60 @@ inherited PackageIntegrationOptionsFrame: TPackageIntegrationOptionsFrame
Text = 'FPDocPackageNameEdit' Text = 'FPDocPackageNameEdit'
end end
end end
object PkgTypeGroupBox: TGroupBox
Left = 0
Height = 127
Top = 0
Width = 461
Align = alTop
AutoSize = 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 = 108
ClientWidth = 457
Constraints.MinHeight = 30
TabOrder = 2
OnClick = PkgTypeGroupBoxClick
object RunAndDesignTimeRadioButton: TRadioButton
Left = 6
Height = 24
Top = 6
Width = 445
Caption = 'RunAndDesignTimeRadioButton'
Checked = True
TabOrder = 0
TabStop = True
end
object DesignTimeRadioButton: TRadioButton
Left = 6
Height = 24
Top = 30
Width = 445
Caption = 'DesignTimeRadioButton'
TabOrder = 1
end
object RunTimeRadioButton: TRadioButton
Left = 6
Height = 24
Top = 54
Width = 445
Caption = 'RunTimeRadioButton'
TabOrder = 2
end
object RunTimeOnlyRadioButton: TRadioButton
Left = 6
Height = 24
Top = 78
Width = 445
Caption = 'RunTimeOnlyRadioButton'
TabOrder = 3
end
end
end end

View File

@ -14,22 +14,28 @@ type
{ TPackageIntegrationOptionsFrame } { TPackageIntegrationOptionsFrame }
TPackageIntegrationOptionsFrame = class(TAbstractIDEOptionsEditor) TPackageIntegrationOptionsFrame = class(TAbstractIDEOptionsEditor)
DesignTimeRadioButton: TRadioButton;
FPDocPackageNameEdit: TEdit; FPDocPackageNameEdit: TEdit;
FPDocPackageNameLabel: TLabel; FPDocPackageNameLabel: TLabel;
FPDocSearchPathsLabel: TLabel; FPDocSearchPathsLabel: TLabel;
DocGroupBox: TGroupBox; DocGroupBox: TGroupBox;
FPDocSearchPathsEdit: TEdit; FPDocSearchPathsEdit: TEdit;
PkgTypeRadioGroup: TRadioGroup; PkgTypeGroupBox: TGroupBox;
RunAndDesignTimeRadioButton: TRadioButton;
RunTimeOnlyRadioButton: TRadioButton;
RunTimeRadioButton: TRadioButton;
UpdateRadioGroup: TRadioGroup; UpdateRadioGroup: TRadioGroup;
procedure FPDocPackageNameEditEnter(Sender: TObject); procedure FPDocPackageNameEditEnter(Sender: TObject);
procedure FPDocPackageNameEditExit(Sender: TObject); procedure FPDocPackageNameEditExit(Sender: TObject);
procedure PkgTypeRadioGroupClick(Sender: TObject); procedure PkgTypeGroupBoxClick(Sender: TObject);
private private
FLazPackage: TLazPackage; FLazPackage: TLazPackage;
FPDocPathButton: TPathEditorButton; FPDocPathButton: TPathEditorButton;
FStoredPkgType: Integer; FStoredPkgType: TLazPackageType;
function GetSelectedPkgType: TLazPackageType;
procedure PathEditBtnClick(Sender: TObject); procedure PathEditBtnClick(Sender: TObject);
procedure PathEditBtnExecuted(Sender: TObject); procedure PathEditBtnExecuted(Sender: TObject);
procedure SetSelectedPkgType(PkgType: TLazPackageType);
function ShowMsgPackageTypeMustBeDesign: boolean; function ShowMsgPackageTypeMustBeDesign: boolean;
function GetFPDocPkgNameEditValue: string; function GetFPDocPkgNameEditValue: string;
public public
@ -49,12 +55,12 @@ implementation
{ TPackageIntegrationOptionsFrame } { TPackageIntegrationOptionsFrame }
procedure TPackageIntegrationOptionsFrame.PkgTypeRadioGroupClick(Sender: TObject); procedure TPackageIntegrationOptionsFrame.PkgTypeGroupBoxClick(Sender: TObject);
var var
NewPkgType: TLazPackageType; NewPkgType: TLazPackageType;
begin begin
NewPkgType:=CaptionToPkgType(PkgTypeRadioGroup.Items[PkgTypeRadioGroup.ItemIndex]); NewPkgType:=GetSelectedPkgType;
if (FStoredPkgType<>PkgTypeRadioGroup.ItemIndex) if (FStoredPkgType<>NewPkgType)
and (NewPkgType in [lptRunTime,lptRunTimeOnly]) and (NewPkgType in [lptRunTime,lptRunTimeOnly])
then begin then begin
// user sets to runtime // user sets to runtime
@ -87,6 +93,18 @@ begin
AButton.CurrentPathEditor.Templates := ''; AButton.CurrentPathEditor.Templates := '';
end; end;
function TPackageIntegrationOptionsFrame.GetSelectedPkgType: TLazPackageType;
begin
if RunTimeOnlyRadioButton.Checked then
Result:=lptRunTimeOnly
else if DesignTimeRadioButton.Checked then
Result:=lptDesignTime
else if RunTimeRadioButton.Checked then
Result:=lptRunTime
else
Result:=lptRunAndDesignTime;
end;
procedure TPackageIntegrationOptionsFrame.PathEditBtnExecuted(Sender: TObject); procedure TPackageIntegrationOptionsFrame.PathEditBtnExecuted(Sender: TObject);
var var
AButton: TPathEditorButton absolute Sender; AButton: TPathEditorButton absolute Sender;
@ -138,6 +156,17 @@ begin
FPDocSearchPathsEdit.Text := NewPath; FPDocSearchPathsEdit.Text := NewPath;
end; end;
procedure TPackageIntegrationOptionsFrame.SetSelectedPkgType(
PkgType: TLazPackageType);
begin
case PkgType of
lptRunTime: RunTimeRadioButton.Checked:=true;
lptDesignTime: DesignTimeRadioButton.Checked:=true;
lptRunAndDesignTime: RunAndDesignTimeRadioButton.Checked:=true;
lptRunTimeOnly: RunTimeOnlyRadioButton.Checked:=true;
end;
end;
function TPackageIntegrationOptionsFrame.GetTitle: string; function TPackageIntegrationOptionsFrame.GetTitle: string;
begin begin
Result := lisPckOptsIDEIntegration; Result := lisPckOptsIDEIntegration;
@ -145,15 +174,17 @@ end;
procedure TPackageIntegrationOptionsFrame.Setup(ADialog: TAbstractOptionsEditorDialog); procedure TPackageIntegrationOptionsFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
begin begin
PkgTypeRadioGroup.Caption := lisPckOptsPackageType; PkgTypeGroupBox.Caption := lisPckOptsPackageType;
PkgTypeRadioGroup.Items[0] := PkgTypeToCaption(lptRunAndDesignTime); RunAndDesignTimeRadioButton.Caption:=PkgTypeToCaption(lptRunAndDesignTime);
PkgTypeRadioGroup.Items[1] := PkgTypeToCaption(lptDesignTime); DesignTimeRadioButton.Caption:=PkgTypeToCaption(lptDesignTime);
PkgTypeRadioGroup.Items[2] := PkgTypeToCaption(lptRunTime); RunTimeRadioButton.Caption:=PkgTypeToCaption(lptRunTime);
PkgTypeRadioGroup.Items[3] := PkgTypeToCaption(lptRunTimeOnly); RunTimeOnlyRadioButton.Caption:=PkgTypeToCaption(lptRunTimeOnly);
UpdateRadioGroup.Caption := lisPckOptsUpdateRebuild; UpdateRadioGroup.Caption := lisPckOptsUpdateRebuild;
UpdateRadioGroup.Items[0] := lisPckOptsAutomaticallyRebuildAsNeeded; UpdateRadioGroup.Items[0] := lisPckOptsAutomaticallyRebuildAsNeeded;
UpdateRadioGroup.Items[1] := lisPckOptsAutoRebuildWhenRebuildingAll; UpdateRadioGroup.Items[1] := lisPckOptsAutoRebuildWhenRebuildingAll;
UpdateRadioGroup.Items[2] := lisPckOptsManualCompilationNeverAutomatically; UpdateRadioGroup.Items[2] := lisPckOptsManualCompilationNeverAutomatically;
DocGroupBox.Caption := lisCodeHelpGroupBox; DocGroupBox.Caption := lisCodeHelpGroupBox;
FPDocPackageNameLabel.Caption:=lisPckPackage; FPDocPackageNameLabel.Caption:=lisPckPackage;
@ -181,13 +212,10 @@ end;
procedure TPackageIntegrationOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions); procedure TPackageIntegrationOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
var var
LazPackage: TLazPackage absolute AOptions; LazPackage: TLazPackage absolute AOptions;
i: Integer;
begin begin
FLazPackage := LazPackage; FLazPackage := LazPackage;
for i:=0 to PkgTypeRadioGroup.Items.Count-1 do FStoredPkgType := LazPackage.PackageType;
if PkgTypeRadioGroup.Items[i]=PkgTypeToCaption(LazPackage.PackageType) then SetSelectedPkgType(FStoredPkgType);
PkgTypeRadioGroup.ItemIndex:=i;
FStoredPkgType := PkgTypeRadioGroup.ItemIndex;
case LazPackage.AutoUpdate of case LazPackage.AutoUpdate of
pupAsNeeded: UpdateRadioGroup.ItemIndex := 0; pupAsNeeded: UpdateRadioGroup.ItemIndex := 0;
pupOnRebuildingAll: UpdateRadioGroup.ItemIndex := 1; pupOnRebuildingAll: UpdateRadioGroup.ItemIndex := 1;
@ -209,7 +237,7 @@ begin
mtWarning, [mbIgnore, mbCancel], 0) <> mrIgnore then mtWarning, [mbIgnore, mbCancel], 0) <> mrIgnore then
begin begin
Result := True; Result := True;
PkgTypeRadioGroup.ItemIndex := FStoredPkgType; SetSelectedPkgType(FStoredPkgType);
end end
else else
Result := False; Result := False;
@ -227,7 +255,7 @@ function TPackageIntegrationOptionsFrame.Check: Boolean;
var var
NewPkgType: TLazPackageType; NewPkgType: TLazPackageType;
begin begin
NewPkgType:=CaptionToPkgType(PkgTypeRadioGroup.Items[PkgTypeRadioGroup.ItemIndex]); NewPkgType:=GetSelectedPkgType;
if NewPkgType <> FLazPackage.PackageType then if NewPkgType <> FLazPackage.PackageType then
begin begin
if (NewPkgType in [lptRunTime,lptRunTimeOnly]) if (NewPkgType in [lptRunTime,lptRunTimeOnly])
@ -243,10 +271,8 @@ end;
procedure TPackageIntegrationOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions); procedure TPackageIntegrationOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
var var
LazPackage: TLazPackage absolute AOptions; LazPackage: TLazPackage absolute AOptions;
NewPkgType: TLazPackageType;
begin begin
NewPkgType:=CaptionToPkgType(PkgTypeRadioGroup.Items[PkgTypeRadioGroup.ItemIndex]); LazPackage.PackageType := GetSelectedPkgType;
LazPackage.PackageType := NewPkgType;
case UpdateRadioGroup.ItemIndex of case UpdateRadioGroup.ItemIndex of
2: LazPackage.AutoUpdate := pupManually; 2: LazPackage.AutoUpdate := pupManually;
1: LazPackage.AutoUpdate := pupOnRebuildingAll; 1: LazPackage.AutoUpdate := pupOnRebuildingAll;