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
Top = 0
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
DesignLeft = 768
DesignTop = 267
object UpdateRadioGroup: TRadioGroup
Left = 0
Height = 124
Top = 0
Height = 103
Top = 133
Width = 461
Anchors = [akTop, akLeft, akRight]
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]
Align = alTop
AutoFill = True
AutoSize = True
BorderSpacing.Top = 6
@ -70,35 +34,30 @@ inherited PackageIntegrationOptionsFrame: TPackageIntegrationOptionsFrame
'Auto rebuild when rebuilding all'
'Manual compilation (never automatically)'
)
TabOrder = 1
TabOrder = 0
end
object DocGroupBox: TGroupBox[2]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = UpdateRadioGroup
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
object DocGroupBox: TGroupBox
Left = 0
Height = 82
Top = 236
Height = 91
Top = 242
Width = 461
Anchors = [akTop, akLeft, akRight]
Align = alTop
AutoSize = True
BorderSpacing.Top = 6
Caption = 'FPDoc settings'
ClientHeight = 66
ClientHeight = 72
ClientWidth = 457
TabOrder = 2
TabOrder = 1
object FPDocSearchPathsEdit: TEdit
AnchorSideLeft.Control = FPDocSearchPathsLabel
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = DocGroupBox
AnchorSideRight.Control = DocGroupBox
AnchorSideRight.Side = asrBottom
Left = 146
Height = 24
Left = 175
Height = 27
Top = 6
Width = 305
Width = 276
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
ParentShowHint = False
@ -111,9 +70,9 @@ inherited PackageIntegrationOptionsFrame: TPackageIntegrationOptionsFrame
AnchorSideTop.Control = FPDocSearchPathsEdit
AnchorSideTop.Side = asrCenter
Left = 6
Height = 15
Height = 17
Top = 11
Width = 134
Width = 163
BorderSpacing.Left = 6
BorderSpacing.Top = 6
Caption = 'FPDocSearchPathsLabel'
@ -124,9 +83,9 @@ inherited PackageIntegrationOptionsFrame: TPackageIntegrationOptionsFrame
AnchorSideTop.Control = FPDocPackageNameEdit
AnchorSideTop.Side = asrCenter
Left = 6
Height = 15
Top = 41
Width = 145
Height = 17
Top = 44
Width = 176
BorderSpacing.Left = 6
Caption = 'FPDocPackageNameLabel'
ParentColor = False
@ -136,9 +95,9 @@ inherited PackageIntegrationOptionsFrame: TPackageIntegrationOptionsFrame
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = FPDocSearchPathsEdit
AnchorSideTop.Side = asrBottom
Left = 157
Height = 24
Top = 36
Left = 188
Height = 27
Top = 39
Width = 116
BorderSpacing.Around = 6
OnEnter = FPDocPackageNameEditEnter
@ -149,4 +108,60 @@ inherited PackageIntegrationOptionsFrame: TPackageIntegrationOptionsFrame
Text = 'FPDocPackageNameEdit'
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

View File

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