IDE: comp opts dlg: new build modes

git-svn-id: trunk@18275 -
This commit is contained in:
mattias 2009-01-13 16:35:04 +00:00
parent 20c99e44fb
commit 7f7c0b3387
4 changed files with 52 additions and 26 deletions

View File

@ -112,7 +112,7 @@ type
destructor Destroy; override;
function FindModeWithIdentifier(Identifier: string; out BuildModes: TIDEBuildModes;
out BuildMode: TIDEBuildMode): boolean;
function GetUniqueModeName: string;
function GetUniqueModeName(CheckToo: TIDEBuildModes): string;
property Evaluator: TExpressionEvaluator read FEvaluator;
end;
@ -3298,7 +3298,7 @@ begin
Result:=false;
end;
function TBuildModeSet.GetUniqueModeName: string;
function TBuildModeSet.GetUniqueModeName(CheckToo: TIDEBuildModes): string;
var
i: Integer;
BuildModes: TIDEBuildModes;
@ -3308,7 +3308,8 @@ begin
repeat
inc(i);
Result:='Mode'+IntToStr(i);
until not FindModeWithIdentifier(Result,BuildModes,BuildMode);
until (not FindModeWithIdentifier(Result,BuildModes,BuildMode))
and ((CheckToo=nil) or (CheckToo.IndexOfIdentifier(Result)<0));
end;
{ TIDEBuildMode }
@ -3316,8 +3317,8 @@ end;
procedure TIDEBuildMode.SetIdentifier(const AValue: string);
begin
if FIdentifier=AValue then exit;
if (FIdentifier='') or (not IsValidIdent(FIdentifier)) then
raise Exception.Create('TIDEBuildMode.SetIdentifier invalid identifier: '+FIdentifier);
if (AValue='') or (not IsValidIdent(AValue)) then
raise Exception.Create('TIDEBuildMode.SetIdentifier invalid identifier: '+AValue);
FIdentifier:=AValue;
end;

View File

@ -47,7 +47,7 @@ uses
TransferMacros, PathEditorDlg, LazarusIDEStrConsts, IDEOptionDefs, LazConf,
IDEProcs, IDEImagesIntf, ShowCompilerOpts, Project, PackageDefs,
CompilerOptions, CheckCompilerOpts, CompOptsModes,
Compiler_Conditionals_Options, compiler_buildmodes_options;
Compiler_Conditionals_Options, Compiler_BuildModes_Options;
type
{ Compiler options form }
@ -62,13 +62,7 @@ type
{ TfrmCompilerOptions }
TfrmCompilerOptions = class(TForm)
chkUseExternalDbgSyms: TCheckBox;
BuildModesFrame: TCompOptBuildModesFrame;
ConditionalOptionsFrame: TCompOptsConditionalsFrame;
ConditionalsGroupBox: TGroupBox;
MainNoteBook: TNoteBook;
BtnPanel: TPanel;
ConditionalPage: TPage;
{ Search Paths Controls }
PathPage: TPage;
@ -150,6 +144,7 @@ type
chkUseValgrind: TCheckBox;
chkGenGProfCode: TCheckBox;
chkSymbolsStrip: TCheckBox;
chkUseExternalDbgSyms: TCheckBox;
grpLinkLibraries: TGroupBox;
chkLinkSmart: TCheckBox;
@ -176,6 +171,12 @@ type
grpCustomOptions: TGroupBox;
memCustomOptions: TMemo;
{ Conditionals }
ConditionalPage: TPage;
ConditionalOptionsFrame: TCompOptsConditionalsFrame;
ConditionalsGroupBox: TGroupBox;
BuildModesFrame: TCompOptBuildModesFrame;
{ Inherited Options }
InheritedPage: TPage;
InhSplitter: TSplitter;
@ -220,6 +221,7 @@ type
ExecuteAfterShowAllCheckBox: TCheckBox;
{ Buttons }
BtnPanel: TPanel;
btnShowOptions: TBitBtn;
btnOK: TBitBtn;
btnCancel: TBitBtn;
@ -269,9 +271,9 @@ type
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
procedure GetCompilerOptions;
procedure GetCompilerOptions; // options to dialog
procedure GetCompilerOptions(SrcCompilerOptions: TBaseCompilerOptions);
function PutCompilerOptions(CheckAndWarn: TCheckCompileOptionsMsgLvl): boolean;
function PutCompilerOptions(CheckAndWarn: TCheckCompileOptionsMsgLvl): boolean; // dlg to options
function PutCompilerOptions(CheckAndWarn: TCheckCompileOptionsMsgLvl;
DestCompilerOptions: TBaseCompilerOptions): boolean;
public
@ -690,6 +692,7 @@ begin
// conditional
{$IFDEF EnableBuildModes}
ConditionalOptionsFrame.Conditionals:=Options.Conditionals as TCompOptConditionals;
BuildModesFrame.BuildModes:=Options.BuildModes as TIDEBuildModes;
{$ENDIF}
// inherited tab
@ -881,6 +884,7 @@ begin
if not CheckPutSearchPath('debugger search path',OldPath,Options.GetDebugPath(false)) then
exit(false);
// ToDo: will be replaced by buildmodes
i:=LCLWidgetTypeComboBox.Itemindex;
if i<=0 then
Options.LCLWidgetType:=''
@ -983,6 +987,9 @@ begin
Options.WriteFPCLogo := Checked[19];
end;
// conditionals
// these are all done via the frames
// other
Options.DontUseConfigFile := not chkConfigFile.Checked;
Options.CustomConfigFile := chkCustomConfigFile.Checked;

View File

@ -272,7 +272,7 @@
<HasResources Value="True"/>
<IsPartOfProject Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="compiler_buildmodes_options"/>
<UnitName Value="Compiler_BuildModes_Options"/>
</Unit33>
<Unit34>
<Filename Value="sourceeditor.pp"/>
@ -504,6 +504,11 @@
<OtherUnitFiles Value="frames/;../debugger/;../debugger/frames/"/>
<UnitOutputDirectory Value="$(LazarusDir)/units/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<CStyleOperator Value="False"/>
</SyntaxOptions>
</Parsing>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>

View File

@ -17,7 +17,7 @@
* *
***************************************************************************
}
unit compiler_buildmodes_options;
unit Compiler_BuildModes_Options;
{$mode objfpc}{$H+}
@ -72,7 +72,7 @@ procedure TCompOptBuildModesFrame.NewSpeedButtonClick(Sender: TObject);
var
NewIdentifier: String;
begin
NewIdentifier:=GlobalBuildModeSet.GetUniqueModeName;
NewIdentifier:=GlobalBuildModeSet.GetUniqueModeName(BuildModes);
BuildModes.Add(NewIdentifier);
ModesGrid.RowCount:=BuildModes.Count;
ModesGrid.Cells[0,BuildModes.Count-1]:=NewIdentifier;
@ -183,12 +183,29 @@ begin
end;
procedure TCompOptBuildModesFrame.UpdateButtons;
var
BuildMode: TIDEBuildMode;
begin
GetSelectedBuildMode(BuildMode);
NewSpeedButton.Enabled:=BuildModes<>nil;
DeleteSpeedButton.Enabled:=(ModesGrid.Row>=0);
MoveDownSpeedButton.Enabled:=(ModesGrid.Row>=0)
and (ModesGrid.Row<ModesGrid.RowCount-1);
MoveUpSpeedButton.Enabled:=(ModesGrid.Row>0);
NewSpeedButton.Hint:='Create new build mode';
if BuildMode<>nil then begin
DeleteSpeedButton.Enabled:=true;
MoveDownSpeedButton.Enabled:=(ModesGrid.Row<ModesGrid.RowCount-1);
MoveUpSpeedButton.Enabled:=(ModesGrid.Row>0);
DeleteSpeedButton.Hint:='Delete '+BuildMode.Identifier;
MoveDownSpeedButton.Hint:='Move '+BuildMode.Identifier+' down';
MoveUpSpeedButton.Hint:='Move '+BuildMode.Identifier+' up';
end else begin
DeleteSpeedButton.Enabled:=false;
MoveDownSpeedButton.Enabled:=false;
MoveUpSpeedButton.Enabled:=false;
DeleteSpeedButton.Hint:='Delete ...';
MoveDownSpeedButton.Hint:='Move down';
MoveUpSpeedButton.Hint:='Move up';
end;
end;
function TCompOptBuildModesFrame.GetSelectedBuildMode(
@ -196,7 +213,7 @@ function TCompOptBuildModesFrame.GetSelectedBuildMode(
begin
BuildMode:=nil;
if BuildModes=nil then exit(false);
if ModesGrid.Row<0 then exit(false);
if (ModesGrid.Row<0) or (ModesGrid.Row>=BuildModes.Count) then exit(false);
BuildMode:=TIDEBuildMode(BuildModes.Items[ModesGrid.Row]);
Result:=true;
end;
@ -210,16 +227,12 @@ begin
ModesGroupBox.Caption:='Build modes';
NewSpeedButton.LoadGlyphFromLazarusResource('menu_new');
NewSpeedButton.ShowHint:=true;
NewSpeedButton.Hint:='Create new build mode';
DeleteSpeedButton.LoadGlyphFromLazarusResource('menu_project_remove');
DeleteSpeedButton.ShowHint:=true;
DeleteSpeedButton.Hint:='Delete ...';
MoveDownSpeedButton.LoadGlyphFromLazarusResource('arrow_down');
MoveDownSpeedButton.ShowHint:=true;
MoveDownSpeedButton.Hint:='Move down';
MoveUpSpeedButton.LoadGlyphFromLazarusResource('arrow_up');
MoveUpSpeedButton.ShowHint:=true;
MoveUpSpeedButton.Hint:='Move up';
end;
destructor TCompOptBuildModesFrame.Destroy;