diff --git a/ide/buildlazdialog.pas b/ide/buildlazdialog.pas index 904d57f9f4..95265404ae 100644 --- a/ide/buildlazdialog.pas +++ b/ide/buildlazdialog.pas @@ -34,11 +34,13 @@ unit BuildLazDialog; interface uses - Classes, SysUtils, Forms, Controls, StdCtrls, ExtCtrls, Buttons, LResources, - Laz_XMLCfg, LazarusIDEStrConsts, ExtToolDialog, ExtToolEditDlg, - TransferMacros, LazConf, FileCtrl, IDEProcs; + Classes, SysUtils, Forms, Controls, LCLType, LCLLinux, Graphics, GraphType, + StdCtrls, ExtCtrls, Buttons, LResources, Laz_XMLCfg, LazarusIDEStrConsts, + ExtToolDialog, ExtToolEditDlg, TransferMacros, LazConf, FileCtrl, IDEProcs; type + { TBuildLazarusItem } + TMakeMode = ( mmNone, mmBuild, @@ -54,36 +56,81 @@ type ); TLCLPlatforms = set of TLCLPlatform; + TBuildLazarusItem = class + private + fCommands: array[TMakeMode] of string; + FDefaultMakeMode: TMakeMode; + FDescription: string; + FDirectory: string; + FMakeMode: TMakeMode; + FName: string; + function GetCommands(Mode: TMakeMode): string; + procedure SetCommands(Mode: TMakeMode; const AValue: string); + procedure SetDefaultMakeMode(const AValue: TMakeMode); + procedure SetDescription(const AValue: string); + procedure SetDirectory(const AValue: string); + procedure SetMakeMode(const AValue: TMakeMode); + procedure SetName(const AValue: string); + public + constructor Create; + constructor Create(const NewName, NewDescription, NewDirectory: string; + const NewMakeMode: TMakeMode); + destructor Destroy; override; + procedure Clear; + procedure Assign(Source: TBuildLazarusItem); + property Name: string read FName write SetName; + property Description: string read FDescription write SetDescription; + property Directory: string read FDirectory write SetDirectory; + property MakeMode: TMakeMode read FMakeMode write SetMakeMode; + property DefaultMakeMode: TMakeMode read FDefaultMakeMode write SetDefaultMakeMode; + property Commands[Mode: TMakeMode]: string read GetCommands write SetCommands; + end; + + + { TBuildLazarusOptions } + TBuildLazarusOptions = class private - fBuildJITForm: TMakeMode; - fBuildLCL: TMakeMode; - fBuildComponents: TMakeMode; - fBuildSynEdit: TMakeMode; - fBuildCodeTools: TMakeMode; - fBuildIDE: TMakeMode; - fBuildExamples: TMakeMode; fCleanAll: boolean; + FItemCodeTools: TBuildLazarusItem; + FItemExamples: TBuildLazarusItem; + FItemIDE: TBuildLazarusItem; + FItemJITForm: TBuildLazarusItem; + FItemLCL: TBuildLazarusItem; + FItemPkgReg: TBuildLazarusItem; + FItemSynEdit: TBuildLazarusItem; fMakeFilename: string; fExtraOptions: string; FTargetDirectory: string; fTargetOS: string; fLCLPlatform: TLCLPlatform; fStaticAutoInstallPackages: TStringList; + FWithStaticPackages: boolean; + fItems: TList; // list of TBuildLazarusItem + function GetCount: integer; + function GetItems(Index: integer): TBuildLazarusItem; procedure SetTargetDirectory(const AValue: string); + procedure SetWithStaticPackages(const AValue: boolean); public constructor Create; destructor Destroy; override; + procedure Clear; + procedure CreateDefaults; procedure Load(XMLConfig: TXMLConfig; const Path: string); procedure Save(XMLConfig: TXMLConfig; const Path: string); - property BuildLCL: TMakeMode read fBuildLCL write fBuildLCL; - property BuildComponents: TMakeMode - read fBuildComponents write fBuildComponents; - property BuildSynEdit: TMakeMode read fBuildSynEdit write fBuildSynEdit; - property BuildCodeTools: TMakeMode read fBuildCodeTools write fBuildCodeTools; - property BuildJITForm: TMakeMode read fBuildJITForm write fBuildJITForm; - property BuildIDE: TMakeMode read fBuildIDE write fBuildIDE; - property BuildExamples: TMakeMode read fBuildExamples write fBuildExamples; + procedure Assign(Source: TBuildLazarusOptions); + procedure SetBuildAll; + function FindName(const Name: string): TBuildLazarusItem; + public + property Count: integer read GetCount; + property Items[Index: integer]: TBuildLazarusItem read GetItems; + property ItemLCL: TBuildLazarusItem read FItemLCL; + property ItemSynEdit: TBuildLazarusItem read FItemSynEdit; + property ItemCodeTools: TBuildLazarusItem read FItemCodeTools; + property ItemPkgReg: TBuildLazarusItem read FItemPkgReg; + property ItemJITForm: TBuildLazarusItem read FItemJITForm; + property ItemIDE: TBuildLazarusItem read FItemIDE; + property ItemExamples: TBuildLazarusItem read FItemExamples; property CleanAll: boolean read fCleanAll write fCleanAll; property MakeFilename: string read fMakeFilename write fMakeFilename; property ExtraOptions: string read fExtraOptions write fExtraOptions; @@ -91,18 +138,17 @@ type property LCLPlatform: TLCLPlatform read fLCLPlatform write fLCLPlatform; property StaticAutoInstallPackages: TStringList read fStaticAutoInstallPackages; property TargetDirectory: string read FTargetDirectory write SetTargetDirectory; + property WithStaticPackages: boolean read FWithStaticPackages write SetWithStaticPackages; end; + + + { TConfigureBuildLazarusDlg } TConfigureBuildLazarusDlg = class(TForm) CleanAllCheckBox: TCheckBox; BuildAllButton: TButton; - BuildLCLRadioGroup: TRadioGroup; - BuildComponentsRadioGroup: TRadioGroup; - BuildSynEditRadioGroup: TRadioGroup; - BuildCodeToolsRadioGroup: TRadioGroup; - BuildIDERadioGroup: TRadioGroup; - BuildExamplesRadioGroup: TRadioGroup; - BuildJITFormCheckBox: TCheckBox; + ItemsListBox: TListBox; + WithStaticPackagesCheckBox: TCheckBox; OptionsLabel: TLabel; OptionsEdit: TEdit; LCLInterfaceRadioGroup: TRadioGroup; @@ -110,19 +156,30 @@ type TargetOSEdit: TEdit; OkButton: TButton; CancelButton: TButton; + ImageList: TImageList; procedure BuildAllButtonClick(Sender: TObject); procedure ConfigureBuildLazarusDlgKeyDown(Sender: TObject; var Key: Word; - Shift: TShiftState); + Shift: TShiftState); procedure ConfigureBuildLazarusDlgResize(Sender: TObject); + procedure ItemsListBoxDrawItem(Control: TWinControl; Index: Integer; + ARect: TRect; State: TOwnerDrawState); + procedure ItemsListBoxMouseDown(Sender: TOBject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); procedure OkButtonClick(Sender: TObject); procedure CancelButtonClick(Sender: TObject); private + Options: TBuildLazarusOptions; + ImageIndexNone: integer; + ImageIndexBuild: integer; + ImageIndexCleanBuild: integer; function MakeModeToInt(MakeMode: TMakeMode): integer; function IntToMakeMode(i: integer): TMakeMode; + procedure SetupComponents; public - procedure Load(Options: TBuildLazarusOptions); - procedure Save(Options: TBuildLazarusOptions); + procedure Load(SourceOptions: TBuildLazarusOptions); + procedure Save(DestOptions: TBuildLazarusOptions); constructor Create(AnOwner: TComponent); override; + destructor Destroy; override; end; function ShowConfigureBuildLazarusDlg( @@ -132,11 +189,11 @@ function BuildLazarus(Options: TBuildLazarusOptions; ExternalTools: TExternalToolList; Macros: TTransferMacroList; const PackageOptions: string): TModalResult; + implementation - uses - LCLType; + Math; const MakeModeNames: array[TMakeMode] of string = ( @@ -146,7 +203,7 @@ const 'gtk', 'gtk2', 'gnome', 'win32' ); - DefaultTargetDirectory = '$(ConfDir)/bin'; + DefaultTargetDirectory = ''; //'$(ConfDir)/bin'; function GetTranslatedMakeModes(MakeMode: TMakeMode): string; begin @@ -195,26 +252,15 @@ function BuildLazarus(Options: TBuildLazarusOptions; const PackageOptions: string): TModalResult; var Tool: TExternalToolOptions; - IDEOptions: String; + i: Integer; + CurItem: TBuildLazarusItem; + ExtraOptions: String; - procedure SetMakeParams(MakeMode: TMakeMode; - const ExtraOpts, TargetOS: string); - begin - if MakeMode=mmBuild then - Tool.CmdLineParams:='all' - else - Tool.CmdLineParams:='clean all'; - if TargetOS<>'' then - Tool.CmdLineParams:= 'OS_TARGET='+ TargetOS+' '+Tool.CmdLineParams; - if ExtraOpts<>'' then - Tool.CmdLineParams:='OPT='''+ExtraOpts+''' '+Tool.CmdLineParams; - end; - - function CreateJITFormOptions: string; + function RemoveProfilerOption(const ExtraOptions: string): string; var p, StartPos: integer; begin - Result:=Options.ExtraOptions; + Result:=ExtraOptions; // delete profiler option p:=Pos('-pg',Result); if (p>0) @@ -228,28 +274,6 @@ var end; end; - function DoBuildJITForm: TModalResult; - begin - // build IDE jitform - Tool.Title:=lisBuildJITForm; - Tool.WorkingDirectory:='$(LazarusDir)/designer/jitform'; - SetMakeParams(Options.BuildJITForm,CreateJITFormOptions, - Options.TargetOS); - Result:=ExternalTools.Run(Tool,Macros); - if Result<>mrOk then exit; - end; - - function DoBuildPackager: TModalResult; - begin - // build packager interface - Tool.Title:=lisBuildJITForm; - Tool.WorkingDirectory:='$(LazarusDir)/packager/registration'; - SetMakeParams(Options.BuildJITForm,Options.ExtraOptions, - Options.TargetOS); - Result:=ExternalTools.Run(Tool,Macros); - if Result<>mrOk then exit; - end; - begin Result:=mrCancel; Tool:=TExternalToolOptions.Create; @@ -271,79 +295,32 @@ begin Result:=ExternalTools.Run(Tool,Macros); if Result<>mrOk then exit; end; - if Options.BuildLCL<>mmNone then begin - // build lcl - Tool.Title:=lisBuildLCL; - Tool.WorkingDirectory:='$(LazarusDir)/lcl'; - SetMakeParams(Options.BuildLCL,Options.ExtraOptions,Options.TargetOS); - Result:=ExternalTools.Run(Tool,Macros); - if Result<>mrOk then exit; - end; - if Options.BuildComponents<>mmNone then begin - // build components - Tool.Title:=lisBuildComponent; - Tool.WorkingDirectory:='$(LazarusDir)/components'; - SetMakeParams(Options.BuildComponents,Options.ExtraOptions, - Options.TargetOS); - Result:=ExternalTools.Run(Tool,Macros); - if Result<>mrOk then exit; - end else begin - if Options.BuildSynEdit<>mmNone then begin - // build SynEdit - Tool.Title:=lisBuildSynEdit; - Tool.WorkingDirectory:='$(LazarusDir)/components/synedit'; - SetMakeParams(Options.BuildSynEdit,Options.ExtraOptions, - Options.TargetOS); + for i:=0 to Options.Count-1 do begin + // build item + CurItem:=Options.Items[i]; + if CurItem.MakeMode<>mmNone then begin + Tool.Title:=CurItem.Description; + Tool.WorkingDirectory:='$(LazarusDir)/'+CurItem.Directory; + Tool.CmdLineParams:=CurItem.Commands[CurItem.MakeMode]; + // append extra options + ExtraOptions:=Options.ExtraOptions; + if CurItem=Options.ItemJITForm then begin + ExtraOptions:=RemoveProfilerOption(ExtraOptions); + end else if CurItem=Options.ItemIDE then begin + if PackageOptions<>'' then begin + if ExtraOptions<>'' then ExtraOptions:=ExtraOptions+' '; + ExtraOptions:=ExtraOptions+PackageOptions; + end; + end; + if ExtraOptions<>'' then + Tool.CmdLineParams:=Tool.CmdLineParams+' OPT='''+ExtraOptions+''''; + // append target OS + if Options.TargetOS<>'' then + Tool.CmdLineParams:=Tool.CmdLineParams+' OS_TARGET='+Options.TargetOS; + // run Result:=ExternalTools.Run(Tool,Macros); if Result<>mrOk then exit; end; - if Options.BuildCodeTools<>mmNone then begin - // build CodeTools - Tool.Title:='Build CodeTools'; - Tool.WorkingDirectory:='$(LazarusDir)/components/codetools'; - SetMakeParams(Options.BuildCodeTools,Options.ExtraOptions, - Options.TargetOS); - Result:=ExternalTools.Run(Tool,Macros); - if Result<>mrOk then exit; - end; - end; - if Options.BuildJITForm<>mmNone then begin - Result:=DoBuildJITForm; - if Result<>mrOk then exit; - Result:=DoBuildPackager; - if Result<>mrOk then exit; - end; - if Options.BuildIDE<>mmNone then begin - // build IDE - Tool.Title:=lisBuildIDE; - Tool.WorkingDirectory:='$(LazarusDir)'; - IDEOptions:=Options.ExtraOptions; - if PackageOptions<>'' then begin - if IDEOptions<>'' then IDEOptions:=IDEOptions+' '; - IDEOptions:=IDEOptions+PackageOptions; - end; - if Options.ExtraOptions<>'' then - Tool.CmdLineParams:='OPT='''+IDEOptions+''' ' - else - Tool.CmdLineParams:=''; - if Options.TargetOS<>'' then - Tool.CmdLineParams:= 'OS_TARGET='+Options.TargetOS+' ' - +Tool.CmdLineParams; - if Options.BuildIDE=mmBuild then - Tool.CmdLineParams:='' + Tool.CmdLineParams+'ide' - else - Tool.CmdLineParams:='' + Tool.CmdLineParams+'cleanide ide'; - Result:=ExternalTools.Run(Tool,Macros); - if Result<>mrOk then exit; - end; - if Options.BuildExamples<>mmNone then begin - // build Examples - Tool.Title:=lisBuildExamples; - Tool.WorkingDirectory:='$(LazarusDir)/examples'; - SetMakeParams(Options.BuildComponents,Options.ExtraOptions, - Options.TargetOS); - Result:=ExternalTools.Run(Tool,Macros); - if Result<>mrOk then exit; end; Result:=mrOk; finally @@ -354,224 +331,30 @@ end; { TConfigureBuildLazarusDlg } constructor TConfigureBuildLazarusDlg.Create(AnOwner: TComponent); -var - MakeMode: TMakeMode; - LCLInterface: TLCLPlatform; begin inherited Create(AnOwner); - if LazarusResources.Find(Classname)=nil then begin - Width:=480; - Height:=435; - Position:=poScreenCenter; - Caption:=Format(lisConfigureBuildLazarus, ['"', '"']); - OnResize:=@ConfigureBuildLazarusDlgResize; - OnKeyDown:=@ConfigureBuildLazarusDlgKeyDown; - - CleanAllCheckBox:=TCheckBox.Create(Self); - with CleanAllCheckBox do begin - Parent:=Self; - Name:='CleanAllCheckBox'; - SetBounds(10,10,Self.ClientWidth-150,20); - Caption:=lisLazBuildCleanAll; - Visible:=true; - end; - - BuildAllButton:=TButton.Create(Self); - with BuildAllButton do begin - Name:='BuildAllButton'; - Parent:=Self; - Left:=CleanAllCheckBox.Left; - Top:=CleanAllCheckBox.Top+CleanAllCheckBox.Height+5; - Width:=200; - Caption:=Format(lisLazBuildSetToBuildAll, ['"', '"']); - OnClick:=@BuildAllButtonClick; - Visible:=true; - end; - - BuildLCLRadioGroup:=TRadioGroup.Create(Self); - with BuildLCLRadioGroup do begin - Parent:=Self; - Name:='BuildLCLRadioGroup'; - SetBounds(10,BuildAllButton.Top+BuildAllButton.Height+5, - CleanAllCheckBox.Width,40); - Caption:='Build LCL'; - for MakeMode:=Low(TMakeMode) to High(TMakeMode) do - Items.Add(GetTranslatedMakeModes(MakeMode)); - Columns:=3; - Visible:=true; - end; + Options:=TBuildLazarusOptions.Create; + Width:=480; + Height:=435; + Position:=poScreenCenter; + Caption:=Format(lisConfigureBuildLazarus, ['"', '"']); + OnResize:=@ConfigureBuildLazarusDlgResize; + OnKeyDown:=@ConfigureBuildLazarusDlgKeyDown; + + SetupComponents; + OnResize(nil); +end; - BuildComponentsRadioGroup:=TRadioGroup.Create(Self); - with BuildComponentsRadioGroup do begin - Parent:=Self; - Name:='BuildComponentsRadioGroup'; - SetBounds(10,BuildLCLRadioGroup.Top+BuildLCLRadioGroup.Height+5, - BuildLCLRadioGroup.Width,BuildLCLRadioGroup.Height); - Caption:=lisLazBuildBuildComponentsSynEditCodeTools; - for MakeMode:=Low(TMakeMode) to High(TMakeMode) do - Items.Add(GetTranslatedMakeModes(MakeMode)); - Columns:=3; - Visible:=true; - end; - - BuildSynEditRadioGroup:=TRadioGroup.Create(Self); - with BuildSynEditRadioGroup do begin - Parent:=Self; - Name:='BuildSynEditRadioGroup'; - SetBounds(10, - BuildComponentsRadioGroup.Top+BuildComponentsRadioGroup.Height+5, - BuildComponentsRadioGroup.Width, - BuildLCLRadioGroup.Height); - Caption:=lisLazBuildBuildSynEdit; - for MakeMode:=Low(TMakeMode) to High(TMakeMode) do - Items.Add(GetTranslatedMakeModes(MakeMode)); - Columns:=3; - Visible:=true; - end; - - BuildCodeToolsRadioGroup:=TRadioGroup.Create(Self); - with BuildCodeToolsRadioGroup do begin - Parent:=Self; - Name:='BuildCodeToolsRadioGroup'; - SetBounds(10,BuildSynEditRadioGroup.Top+BuildSynEditRadioGroup.Height+5, - BuildLCLRadioGroup.Width,BuildLCLRadioGroup.Height); - Caption:=lisLazBuildBuildCodeTools; - for MakeMode:=Low(TMakeMode) to High(TMakeMode) do - Items.Add(GetTranslatedMakeModes(MakeMode)); - Columns:=3; - Visible:=true; - end; - - BuildIDERadioGroup:=TRadioGroup.Create(Self); - with BuildIDERadioGroup do begin - Parent:=Self; - Name:='BuildIDERadioGroup'; - SetBounds(10,BuildCodeToolsRadioGroup.Top+BuildCodeToolsRadioGroup.Height+5, - BuildLCLRadioGroup.Width,BuildLCLRadioGroup.Height); - Caption:=lisLazBuildBuildIDE; - for MakeMode:=Low(TMakeMode) to High(TMakeMode) do - Items.Add(GetTranslatedMakeModes(MakeMode)); - Columns:=3; - Visible:=true; - end; - - BuildExamplesRadioGroup:=TRadioGroup.Create(Self); - with BuildExamplesRadioGroup do begin - Parent:=Self; - Name:='BuildExamplesRadioGroup'; - SetBounds(10,BuildIDERadioGroup.Top+BuildIDERadioGroup.Height+5, - BuildLCLRadioGroup.Width,BuildLCLRadioGroup.Height); - Caption:=lisLazBuildBuildExamples; - for MakeMode:=Low(TMakeMode) to High(TMakeMode) do - Items.Add(GetTranslatedMakeModes(MakeMode)); - Columns:=3; - Visible:=true; - end; - - OptionsLabel:=TLabel.Create(Self); - with OptionsLabel do begin - Name:='OptionsLabel'; - Parent:=Self; - SetBounds(10, - BuildExamplesRadioGroup.Top+BuildExamplesRadioGroup.Height+5, - 80,Height); - Caption:=lisLazBuildOptions; - Visible:=true; - end; - - OptionsEdit:=TEdit.Create(Self); - with OptionsEdit do begin - Name:='OptionsEdit'; - Parent:=Self; - SetBounds(OptionsLabel.Left+OptionsLabel.Width+5, - OptionsLabel.Top, - BuildExamplesRadioGroup.Width-OptionsLabel.Width-5, - Height); - Visible:=true; - end; - - TargetOSLabel:=TLabel.Create(Self); - with TargetOSLabel do begin - Name:='TargetOSLabel'; - Parent:=Self; - SetBounds(10,OptionsLabel.Top+OptionsLabel.Height+12, - 80,Height); - Caption:=lisLazBuildTargetOS; - Visible:=true; - end; - - TargetOSEdit:=TEdit.Create(Self); - with TargetOSEdit do begin - Name:='TargetOSEdit'; - Parent:=Self; - SetBounds(TargetOSLabel.Left+TargetOSLabel.Width+5, - TargetOSLabel.Top, - OptionsEdit.Width, - Height); - Visible:=true; - end; - - LCLInterfaceRadioGroup:=TRadioGroup.Create(Self); - with LCLInterfaceRadioGroup do begin - Name:='LCLInterfaceRadioGroup'; - Parent:=Self; - Left:=BuildLCLRadioGroup.Left+BuildLCLRadioGroup.Width+10; - Top:=BuildLCLRadioGroup.Top; - Width:=Parent.ClientHeight-Left-BuildLCLRadioGroup.Left; - Height:=120; - Caption:=lisLazBuildLCLInterface; - for LCLInterface:=Low(TLCLPlatform) to High(TLCLPlatform) do begin - Items.Add(LCLPlatformNames[LCLInterface]); - end; - Visible:=true; - end; - - BuildJITFormCheckBox:=TCheckBox.Create(Self); - with BuildJITFormCheckBox do begin - Name:='BuildJITFormCheckBox'; - Parent:=Self; - SetBounds(LCLInterfaceRadioGroup.Left, - LCLInterfaceRadioGroup.Top+LCLInterfaceRadioGroup.Height+50, - LCLInterfaceRadioGroup.Width,Height); - Caption:=lisLazBuildBuildJITForm; - Visible:=true; - end; - - OkButton:=TButton.Create(Self); - with OkButton do begin - Parent:=Self; - Name:='OkButton'; - SetBounds(Self.ClientWidth-180,Self.ClientHeight-38,80,25); - Caption:=lisLazBuildOk; - OnClick:=@OkButtonClick; - Visible:=true; - end; - - CancelButton:=TButton.Create(Self); - with CancelButton do begin - Parent:=Self; - Name:='CancelButton'; - SetBounds(Self.ClientWidth-90,OkButton.Top,OkButton.Width,OkButton.Height); - Caption:=lisLazBuildCancel; - OnClick:=@CancelButtonClick; - Visible:=true; - end; - - end; - ConfigureBuildLazarusDlgResize(nil); +destructor TConfigureBuildLazarusDlg.Destroy; +begin + Options.Free; + inherited Destroy; end; procedure TConfigureBuildLazarusDlg.BuildAllButtonClick(Sender: TObject); begin - CleanAllCheckBox.Checked:=true; - BuildLCLRadioGroup.ItemIndex:=1; - BuildComponentsRadioGroup.ItemIndex:=1; - BuildSynEditRadioGroup.ItemIndex:=0; - BuildCodeToolsRadioGroup.ItemIndex:=0; - BuildIDERadioGroup.ItemIndex:=1; - BuildJITFormCheckBox.Checked:=true; - BuildExamplesRadioGroup.ItemIndex:=1; - OptionsEdit.Text:=''; + Options.SetBuildAll; + Load(Options); end; procedure TConfigureBuildLazarusDlg.ConfigureBuildLazarusDlgKeyDown( @@ -583,58 +366,151 @@ end; procedure TConfigureBuildLazarusDlg.ConfigureBuildLazarusDlgResize( Sender: TObject); +var + x: Integer; + y: Integer; + w: Integer; begin - CleanAllCheckBox.SetBounds(10,10,Self.ClientWidth-150,20); - BuildAllButton.SetBounds(CleanAllCheckBox.Left, - CleanAllCheckBox.Top+CleanAllCheckBox.Height+5, - 200,BuildAllButton.Height); - BuildLCLRadioGroup.SetBounds(10, - BuildAllButton.Top+BuildAllButton.Height+5, - CleanAllCheckBox.Width,40); - BuildComponentsRadioGroup.SetBounds(10, - BuildLCLRadioGroup.Top+BuildLCLRadioGroup.Height+5, - BuildLCLRadioGroup.Width,BuildLCLRadioGroup.Height); - BuildSynEditRadioGroup.SetBounds(10, - BuildComponentsRadioGroup.Top+BuildComponentsRadioGroup.Height+5, - BuildComponentsRadioGroup.Width,BuildComponentsRadioGroup.Height); - BuildCodeToolsRadioGroup.SetBounds(10, - BuildSynEditRadioGroup.Top+BuildSynEditRadioGroup.Height+5, - BuildLCLRadioGroup.Width,BuildLCLRadioGroup.Height); - BuildIDERadioGroup.SetBounds(10, - BuildCodeToolsRadioGroup.Top+BuildCodeToolsRadioGroup.Height+5, - BuildLCLRadioGroup.Width,BuildLCLRadioGroup.Height); - BuildExamplesRadioGroup.SetBounds(10, - BuildIDERadioGroup.Top+BuildIDERadioGroup.Height+5, - BuildLCLRadioGroup.Width,BuildLCLRadioGroup.Height); - OptionsLabel.SetBounds(10, - BuildExamplesRadioGroup.Top+BuildExamplesRadioGroup.Height+5, - 80,OptionsLabel.Height); - OptionsEdit.SetBounds(OptionsLabel.Left+OptionsLabel.Width+5, - OptionsLabel.Top, - BuildExamplesRadioGroup.Width-OptionsLabel.Width-5, - OptionsEdit.Height); - TargetOSLabel.SetBounds(10, - OptionsLabel.Top+OptionsLabel.Height+12, - 80,TargetOsLabel.Height); - TargetOSEdit.SetBounds(TargetOSLabel.Left+TargetOSLabel.Width+5, - TargetOSLabel.Top, - OptionsEdit.Width, - TargetOSEdit.Height); - with LCLInterfaceRadioGroup do begin - Left:=BuildLCLRadioGroup.Left+BuildLCLRadioGroup.Width+10; - Top:=BuildLCLRadioGroup.Top; - Width:=Parent.ClientWidth-Left-10; + x:=10; + y:=10; + w:=ClientWidth-150; + with CleanAllCheckBox do begin + SetBounds(x,y,w,Height); + inc(y,Height+5); + end; + with BuildAllButton do begin + SetBounds(x,y,200,Height); + inc(y,Height+5); + end; + with ItemsListBox do begin + SetBounds(x,y,w,Max(30,Parent.ClientHeight-200)); + inc(y,Height+5); + end; + with OptionsLabel do begin + SetBounds(x,y+3,80,Height); + inc(x,Width+3); + end; + with OptionsEdit do begin + SetBounds(x,y,Parent.ClientWidth-x-10,Height); + x:=OptionsLabel.Left; + inc(y,Height+3); + end; + with TargetOSLabel do begin + SetBounds(x,y+3,80,Height); + inc(x,Width+3); + end; + with TargetOSEdit do begin + SetBounds(x,y,Parent.ClientWidth-x-10,Height); + x:=OptionsLabel.Left; + inc(y,Height+3); + end; + + inc(x,w+10); + y:=ItemsListBox.Top; + w:=ClientWidth-10-x; + with LCLInterfaceRadioGroup do begin + SetBounds(x,y,w,120); + inc(y,Height+60); + end; + with WithStaticPackagesCheckBox do begin + SetBounds(x,y,w,Height); + inc(y,Height+40); end; - with BuildJITFormCheckBox do - BuildJITFormCheckBox.SetBounds(LCLInterfaceRadioGroup.Left, - LCLInterfaceRadioGroup.Top+LCLInterfaceRadioGroup.Height+50, - LCLInterfaceRadioGroup.Width,Height); - OkButton.SetBounds(Self.ClientWidth-180,Self.ClientHeight-38,80,25); - CancelButton.SetBounds(Self.ClientWidth-90,OkButton.Top, + with OkButton do + SetBounds(Parent.ClientWidth-180,Parent.ClientHeight-38,80,25); + with CancelButton do + SetBounds(Parent.ClientWidth-90,OkButton.Top, OkButton.Width,OkButton.Height); end; +procedure TConfigureBuildLazarusDlg.ItemsListBoxDrawItem(Control: TWinControl; + Index: Integer; ARect: TRect; State: TOwnerDrawState); +var + ButtonState: integer; + x: Integer; + ButtonWidth: Integer; + ButtonHeight: Integer; + ButtonRect: TRect; + CurItem: TBuildLazarusItem; + CurStr: String; + TxtH: Integer; + CurRect: TRect; + ImgIndex: Integer; + CurIcon: TBitmap; + Mask: TBitMap; + mm: TMakeMode; + IconWidth: Integer; + IconHeight: Integer; +begin + if (Index<0) or (Index>=Options.Count) then exit; + CurItem:=Options.Items[Index]; + CurStr:=CurItem.Description; + TxtH:=ItemsListBox.Canvas.TextHeight(CurStr); + CurRect:=ARect; + ItemsListBox.Canvas.FillRect(CurRect); + // draw the buttons + x:=0; + ButtonWidth:=ImageList.Width+4; + ButtonHeight:=ButtonWidth; + for mm:=Low(TMakeMode) to High(TMakeMode) do begin + // draw button + ButtonRect:=Rect(x,ARect.Top+((ARect.Bottom-ARect.Top-ButtonWidth) div 2), + x+ButtonWidth,ButtonHeight); + ButtonState:=DFCS_BUTTONPUSH; + if CurItem.MakeMode=mm then + inc(ButtonState,DFCS_PUSHED); + DrawFrameControl( + ItemsListBox.Canvas.GetUpdatedHandle([csBrushValid,csPenValid]), + ButtonRect, DFC_BUTTON, ButtonState); + // draw icon + case mm of + mmBuild: ImgIndex:=ImageIndexBuild; + mmCleanBuild: ImgIndex:=ImageIndexCleanBuild; + else ImgIndex:=ImageIndexNone; + end; + ImageList.GetInternalImage(ImgIndex,CurIcon,Mask); + if CurIcon<>nil then begin + IconWidth:=CurIcon.Width; + IconHeight:=CurIcon.Height; + ItemsListBox.Canvas.Draw(x+((ButtonWidth-IconWidth) div 2), + ARect.Top+((ARect.Bottom-ARect.Top-IconHeight) div 2), + CurIcon); + end; + inc(x,ButtonWidth); + end; + // draw description + ItemsListBox.Canvas.TextOut(x+2, + ARect.Top+(ARect.Bottom-ARect.Top-TxtH) div 2, + CurStr); + // draw make mode text + x:=ItemsListBox.ClientWidth-90; + ItemsListBox.Canvas.TextOut(x+2, + ARect.Top+(ARect.Bottom-ARect.Top-TxtH) div 2, + MakeModeNames[CurItem.MakeMode]); +end; + +procedure TConfigureBuildLazarusDlg.ItemsListBoxMouseDown(Sender: TOBject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +var + ButtonWidth: Integer; + NewMakeMode: TMakeMode; + i: Integer; +begin + ButtonWidth:=ImageList.Width+4; + i:=X div ButtonWidth; + case i of + 0: NewMakeMode:=mmNone; + 1: NewMakeMode:=mmBuild; + 2: NewMakeMode:=mmCleanBuild; + else exit; + end; + i:=ItemsListBox.GetIndexAtY(Y); + if (i<0) or (i>=Options.Count) then exit; + Options.Items[i].MakeMode:=NewMakeMode; + ItemsListBox.Invalidate; +end; + procedure TConfigureBuildLazarusDlg.OkButtonClick(Sender: TObject); begin ModalResult:=mrOk; @@ -645,38 +521,45 @@ begin ModalResult:=mrCancel; end; -procedure TConfigureBuildLazarusDlg.Load(Options: TBuildLazarusOptions); +procedure TConfigureBuildLazarusDlg.Load(SourceOptions: TBuildLazarusOptions); +var + i: Integer; begin + Options.Assign(SourceOptions); + CleanAllCheckBox.Checked:=Options.CleanAll; - BuildLCLRadioGroup.ItemIndex:=MakeModeToInt(Options.BuildLCL); - BuildComponentsRadioGroup.ItemIndex:=MakeModeToInt(Options.BuildComponents); - BuildSynEditRadioGroup.ItemIndex:=MakeModeToInt(Options.BuildSynEdit); - BuildCodeToolsRadioGroup.ItemIndex:=MakeModeToInt(Options.BuildCodeTools); - BuildIDERadioGroup.ItemIndex:=MakeModeToInt(Options.BuildIDE); - BuildExamplesRadioGroup.ItemIndex:=MakeModeToInt(Options.BuildExamples); + + // items + ItemsListBox.Items.BeginUpdate; + i:=0; + while ii do + ItemsListBox.Items.Delete(ItemsListBox.Items.Count-1); + ItemsListBox.Items.EndUpdate; + OptionsEdit.Text:=Options.ExtraOptions; LCLInterfaceRadioGroup.ItemIndex:=ord(Options.LCLPlatform); - BuildJITFormCheckBox.Checked:=Options.BuildJITForm in [mmBuild, mmCleanBuild]; + WithStaticPackagesCheckBox.Checked:=Options.WithStaticPackages; TargetOSEdit.Text:=Options.TargetOS; end; -procedure TConfigureBuildLazarusDlg.Save(Options: TBuildLazarusOptions); +procedure TConfigureBuildLazarusDlg.Save(DestOptions: TBuildLazarusOptions); begin - if Options=nil then exit; + if DestOptions=nil then exit; + Options.CleanAll:=CleanAllCheckBox.Checked; - Options.BuildLCL:=IntToMakeMode(BuildLCLRadioGroup.ItemIndex); - Options.BuildComponents:=IntToMakeMode(BuildComponentsRadioGroup.ItemIndex); - Options.BuildSynEdit:=IntToMakeMode(BuildSynEditRadioGroup.ItemIndex); - Options.BuildCodeTools:=IntToMakeMode(BuildCodeToolsRadioGroup.ItemIndex); - Options.BuildIDE:=IntToMakeMode(BuildIDERadioGroup.ItemIndex); - Options.BuildExamples:=IntToMakeMode(BuildExamplesRadioGroup.ItemIndex); Options.ExtraOptions:=OptionsEdit.Text; Options.LCLPlatform:=TLCLPlatform(LCLInterfaceRadioGroup.ItemIndex); - if BuildJITFormCheckBox.Checked then - Options.BuildJITForm:=mmBuild - else - Options.BuildJITForm:=mmNone; + Options.WithStaticPackages:=WithStaticPackagesCheckBox.Checked; Options.TargetOS:=TargetOSEdit.Text; + + DestOptions.Assign(Options); end; function TConfigureBuildLazarusDlg.MakeModeToInt(MakeMode: TMakeMode): integer; @@ -697,31 +580,140 @@ begin end; end; +procedure TConfigureBuildLazarusDlg.SetupComponents; + + procedure AddResImg(const ResName: string); + var Pixmap: TPixmap; + begin + Pixmap:=TPixmap.Create; + Pixmap.TransparentColor:=clWhite; + Pixmap.LoadFromLazarusResource(ResName); + ImageList.Add(Pixmap,nil) + end; + + function LoadPixmap(const ResourceName:string): TPixmap; + begin + Result:=TPixmap.Create; + Result.LoadFromLazarusResource(ResourceName); + end; + +var + LCLInterface: TLCLPlatform; +begin + ImageList:=TImageList.Create(Self); + with ImageList do begin + Width:=20; + Height:=20; + Name:='ImageList'; + ImageIndexNone:=Count; + AddResImg('menu_stepover'); + ImageIndexBuild:=Count; + AddResImg('menu_build'); + ImageIndexCleanBuild:=Count; + AddResImg('menu_buildall'); + end; + + CleanAllCheckBox:=TCheckBox.Create(Self); + with CleanAllCheckBox do begin + Parent:=Self; + Name:='CleanAllCheckBox'; + Caption:=lisLazBuildCleanAll; + end; + + BuildAllButton:=TButton.Create(Self); + with BuildAllButton do begin + Name:='BuildAllButton'; + Parent:=Self; + Caption:=Format(lisLazBuildSetToBuildAll, ['"', '"']); + OnClick:=@BuildAllButtonClick; + end; + + ItemsListBox:=TListBox.Create(Self); + with ItemsListBox do begin + Name:='ItemsListBox'; + Parent:=Self; + OnMouseDown:=@ItemsListBoxMouseDown; + OnDrawItem:=@ItemsListBoxDrawItem; + ItemHeight:=ImageList.Height+6; + end; + + OptionsLabel:=TLabel.Create(Self); + with OptionsLabel do begin + Name:='OptionsLabel'; + Parent:=Self; + Caption:=lisLazBuildOptions; + end; + + OptionsEdit:=TEdit.Create(Self); + with OptionsEdit do begin + Name:='OptionsEdit'; + Parent:=Self; + end; + + TargetOSLabel:=TLabel.Create(Self); + with TargetOSLabel do begin + Name:='TargetOSLabel'; + Parent:=Self; + Caption:=lisLazBuildTargetOS; + end; + + TargetOSEdit:=TEdit.Create(Self); + with TargetOSEdit do begin + Name:='TargetOSEdit'; + Parent:=Self; + end; + + LCLInterfaceRadioGroup:=TRadioGroup.Create(Self); + with LCLInterfaceRadioGroup do begin + Name:='LCLInterfaceRadioGroup'; + Parent:=Self; + Caption:=lisLazBuildLCLInterface; + for LCLInterface:=Low(TLCLPlatform) to High(TLCLPlatform) do begin + Items.Add(LCLPlatformNames[LCLInterface]); + end; + end; + + WithStaticPackagesCheckBox:=TCheckBox.Create(Self); + with WithStaticPackagesCheckBox do begin + Name:='WithStaticPackagesCheckBox'; + Parent:=Self; + Caption:=lisLazBuildWithStaticPackages; + {$IFNDEF EnablePkgs} + Visible:=false; + {$ENDIF} + end; + + OkButton:=TButton.Create(Self); + with OkButton do begin + Parent:=Self; + Name:='OkButton'; + Caption:=lisLazBuildOk; + OnClick:=@OkButtonClick; + end; + + CancelButton:=TButton.Create(Self); + with CancelButton do begin + Parent:=Self; + Name:='CancelButton'; + Caption:=lisLazBuildCancel; + OnClick:=@CancelButtonClick; + end; + +end; + { TBuildLazarusOptions } procedure TBuildLazarusOptions.Save(XMLConfig: TXMLConfig; const Path: string); +var + i: Integer; begin - XMLConfig.SetDeleteValue(Path+'BuildLCL/Value', - MakeModeNames[fBuildLCL], - MakeModeNames[mmBuild]); - XMLConfig.SetDeleteValue(Path+'BuildComponents/Value', - MakeModeNames[fBuildComponents], - MakeModeNames[mmBuild]); - XMLConfig.SetDeleteValue(Path+'BuildSynEdit/Value', - MakeModeNames[fBuildSynEdit], - MakeModeNames[mmNone]); - XMLConfig.SetDeleteValue(Path+'BuildCodeTools/Value', - MakeModeNames[fBuildCodeTools], - MakeModeNames[mmNone]); - XMLConfig.SetDeleteValue(Path+'BuildJITForm/Value', - MakeModeNames[fBuildJITForm], - MakeModeNames[mmBuild]); - XMLConfig.SetDeleteValue(Path+'BuildIDE/Value', - MakeModeNames[fBuildIDE], - MakeModeNames[mmBuild]); - XMLConfig.SetDeleteValue(Path+'BuildExamples/Value', - MakeModeNames[fBuildExamples], - MakeModeNames[mmBuild]); + for i:=0 to Count-1 do begin + XMLConfig.SetDeleteValue( + Path+'Build'+Items[i].Name+'/Value', + MakeModeNames[Items[i].MakeMode], + MakeModeNames[Items[i].DefaultMakeMode]); + end; + XMLConfig.SetDeleteValue(Path+'CleanAll/Value',fCleanAll,true); XMLConfig.SetDeleteValue(Path+'ExtraOptions/Value',fExtraOptions,''); XMLConfig.SetDeleteValue(Path+'TargetOS/Value',fTargetOS,''); @@ -731,27 +723,75 @@ begin LCLPlatformNames[lpGtk]); XMLConfig.SetDeleteValue(Path+'TargetDirectory/Value', FTargetDirectory,DefaultTargetDirectory); + XMLConfig.SetDeleteValue(Path+'WithStaticPackages/Value',FWithStaticPackages, + true); + // auto install packages SaveStringList(XMLConfig,fStaticAutoInstallPackages, Path+'StaticAutoInstallPackages/'); end; -procedure TBuildLazarusOptions.Load(XMLConfig: TXMLConfig; const Path: string); +procedure TBuildLazarusOptions.Assign(Source: TBuildLazarusOptions); +var + i: Integer; + SrcItem: TBuildLazarusItem; + NewItem: TBuildLazarusItem; begin - fBuildLCL:=StrToMakeMode(XMLConfig.GetValue(Path+'BuildLCL/Value', - MakeModeNames[mmBuild])); - fBuildComponents:=StrToMakeMode(XMLConfig.GetValue(Path+'BuildComponents/Value', - MakeModeNames[mmBuild])); - fBuildSynEdit:=StrToMakeMode(XMLConfig.GetValue(Path+'BuildSynEdit/Value', - MakeModeNames[mmNone])); - fBuildCodeTools:=StrToMakeMode(XMLConfig.GetValue(Path+'BuildCodeTools/Value', - MakeModeNames[mmNone])); - fBuildJITForm:=StrToMakeMode(XMLConfig.GetValue(Path+'BuildJITForm/Value', - MakeModeNames[mmBuild])); - fBuildIDE:=StrToMakeMode(XMLConfig.GetValue(Path+'BuildIDE/Value', - MakeModeNames[mmBuild])); - fBuildExamples:=StrToMakeMode(XMLConfig.GetValue(Path+'BuildExamples/Value', - MakeModeNames[mmBuild])); + if (Source=nil) or (Source=Self) then exit; + Clear; + CleanAll:=Source.CleanAll; + ExtraOptions:=Source.ExtraOptions; + TargetOS:=Source.TargetOS; + MakeFilename:=Source.MakeFilename; + LCLPlatform:=Source.LCLPlatform; + TargetDirectory:=Source.TargetDirectory; + WithStaticPackages:=Source.WithStaticPackages; + fStaticAutoInstallPackages.Assign(Source.fStaticAutoInstallPackages); + for i:=0 to Source.Count-1 do begin + SrcItem:=Source.Items[i]; + NewItem:=TBuildLazarusItem.Create; + NewItem.Assign(SrcItem); + fItems.Add(NewItem); + end; + FItemLCL:=FindName('LCL'); + FItemSynEdit:=FindName('SynEdit'); + FItemCodeTools:=FindName('CodeTools'); + FItemPkgReg:=FindName('PkgReg'); + FItemJITForm:=FindName('JITForm'); + FItemIDE:=FindName('IDE'); + FItemExamples:=FindName('Examples'); +end; + +procedure TBuildLazarusOptions.SetBuildAll; +var + i: Integer; +begin + fCleanAll:=true; + for i:=0 to Count-1 do Items[i].MakeMode:=mmBuild; +end; + +function TBuildLazarusOptions.FindName(const Name: string): TBuildLazarusItem; +var + i: Integer; +begin + Result:=nil; + for i:=0 to Count-1 do if AnsiCompareText(Name,Items[i].Name)=0 then begin + Result:=Items[i]; + exit; + end; +end; + +procedure TBuildLazarusOptions.Load(XMLConfig: TXMLConfig; const Path: string); +var + i: Integer; +begin + Clear; + CreateDefaults; + for i:=0 to Count-1 do begin + Items[i].MakeMode:=StrToMakeMode(XMLConfig.GetValue( + Path+'Build'+Items[i].Name+'/Value', + MakeModeNames[Items[i].MakeMode])); + end; fCleanAll:=XMLConfig.GetValue(Path+'CleanAll/Value',true); fExtraOptions:=XMLConfig.GetValue(Path+'ExtraOptions/Value',''); fTargetOS:=XMLConfig.GetValue(Path+'TargetOS/Value',''); @@ -761,6 +801,7 @@ begin FTargetDirectory:=AppendPathDelim(SetDirSeparators( XMLConfig.GetValue(Path+'TargetDirectory/Value', DefaultTargetDirectory))); + FWithStaticPackages:=XMLConfig.GetValue(Path+'WithStaticPackages/Value',true); // auto install packages LoadStringList(XMLConfig,fStaticAutoInstallPackages, @@ -773,16 +814,42 @@ begin FTargetDirectory:=AValue; end; +function TBuildLazarusOptions.GetCount: integer; +begin + Result:=FItems.Count; +end; + +function TBuildLazarusOptions.GetItems(Index: integer): TBuildLazarusItem; +begin + Result:=TBuildLazarusItem(fItems[Index]); +end; + +procedure TBuildLazarusOptions.SetWithStaticPackages(const AValue: boolean); +begin + if FWithStaticPackages=AValue then exit; + FWithStaticPackages:=AValue; +end; + constructor TBuildLazarusOptions.Create; begin inherited Create; - fBuildJITForm:=mmBuild; - fBuildLCL:=mmNone; - fBuildComponents:=mmBuild; - fBuildSynEdit:=mmNone; - fBuildCodeTools:=mmNone; - fBuildIDE:=mmBuild; - fBuildExamples:=mmBuild; + fItems:=TList.Create; + fStaticAutoInstallPackages:=TStringList.Create; + Clear; + CreateDefaults; +end; + +destructor TBuildLazarusOptions.Destroy; +begin + Clear; + fStaticAutoInstallPackages.Free; + inherited Destroy; +end; + +procedure TBuildLazarusOptions.Clear; +var + i: Integer; +begin fCleanAll:=true; fMakeFilename:=''; fExtraOptions:=''; @@ -791,15 +858,150 @@ begin fLCLPlatform:=lpGtk; // auto install packages - fStaticAutoInstallPackages:=TStringList.Create; + fStaticAutoInstallPackages.Clear; + + // items + for i:=0 to FItems.Count-1 do begin + Items[i].Free; + end; + fItems.Clear; + + FItemLCL:=nil; + FItemSynEdit:=nil; + FItemCodeTools:=nil; + FItemPkgReg:=nil; + FItemJITForm:=nil; + FItemIDE:=nil; + FItemExamples:=nil; end; -destructor TBuildLazarusOptions.Destroy; +procedure TBuildLazarusOptions.CreateDefaults; begin - fStaticAutoInstallPackages.Free; + // LCL + FItemLCL:=TBuildLazarusItem.Create( + 'LCL',lisBuildLCL,'lcl',mmCleanBuild); + fItems.Add(FItemLCL); + + // SynEdit + FItemSynEdit:=TBuildLazarusItem.Create( + 'SynEdit',lisBuildSynEdit,'components/synedit',mmBuild); + fItems.Add(FItemSynEdit); + + // CodeTools + FItemCodeTools:=TBuildLazarusItem.Create( + 'CodeTools',lisBuildCodeTools,'components/codetools',mmBuild); + fItems.Add(FItemCodeTools); + + // package registration units + FItemPkgReg:=TBuildLazarusItem.Create( + 'PackageRegistration',lisBuildPkgReg,'packager/registration', + mmBuild); + fItems.Add(FItemPkgReg); + + // JITForm + FItemJITForm:=TBuildLazarusItem.Create( + 'JITForm',lisBuildJITForm,'designer/jitform',mmBuild); + fItems.Add(FItemJITForm); + + // IDE + FItemIDE:=TBuildLazarusItem.Create('IDE',lisBuildIDE,'',mmBuild); + FItemIDE.Commands[mmBuild]:='ide'; + FItemIDE.Commands[mmCleanBuild]:='cleanide'; + fItems.Add(FItemIDE); + + // Examples + FItemExamples:=TBuildLazarusItem.Create( + 'Examples',lisBuildExamples,'examples',mmBuild); + fItems.Add(FItemExamples); +end; + +{ TBuildLazarusItem } + +function TBuildLazarusItem.GetCommands(Mode: TMakeMode): string; +begin + Result:=fCommands[Mode]; +end; + +procedure TBuildLazarusItem.SetCommands(Mode: TMakeMode; const AValue: string); +begin + fCommands[Mode]:=AValue; +end; + +procedure TBuildLazarusItem.SetDefaultMakeMode(const AValue: TMakeMode); +begin + if FDefaultMakeMode=AValue then exit; + FDefaultMakeMode:=AValue; +end; + +procedure TBuildLazarusItem.SetDescription(const AValue: string); +begin + if FDescription=AValue then exit; + FDescription:=AValue; +end; + +procedure TBuildLazarusItem.SetDirectory(const AValue: string); +begin + if FDirectory=AValue then exit; + FDirectory:=AValue; +end; + +procedure TBuildLazarusItem.SetMakeMode(const AValue: TMakeMode); +begin + if FMakeMode=AValue then exit; + FMakeMode:=AValue; +end; + +procedure TBuildLazarusItem.SetName(const AValue: string); +begin + if FName=AValue then exit; + FName:=AValue; +end; + +constructor TBuildLazarusItem.Create; +begin + Clear; +end; + +constructor TBuildLazarusItem.Create(const NewName, NewDescription, + NewDirectory: string; const NewMakeMode: TMakeMode); +begin + Clear; + Name:=NewName; + Description:=NewDescription; + Directory:=NewDirectory; + MakeMode:=NewMakeMode; + DefaultMakeMode:=MakeMode; +end; + +destructor TBuildLazarusItem.Destroy; +begin + Clear; inherited Destroy; end; +procedure TBuildLazarusItem.Clear; +begin + fCommands[mmNone]:=''; + fCommands[mmBuild]:='all'; + fCommands[mmCleanBuild]:='clean all'; + FDirectory:=''; + fName:=''; + FMakeMode:=mmNone; +end; + +procedure TBuildLazarusItem.Assign(Source: TBuildLazarusItem); +var + mm: TMakeMode; +begin + if (Source=nil) or (Source=Self) then exit; + Name:=Source.Name; + Description:=Source.Description; + Directory:=Source.Directory; + MakeMode:=Source.MakeMode; + DefaultMakeMode:=Source.DefaultMakeMode; + for mm:=Low(TMakeMode) to High(TMakeMode) do + Commands[mm]:=Source.Commands[mm]; +end; end. diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index af71c708e5..00e0930ea5 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -1016,11 +1016,13 @@ resourcestring dlgUnitDepRefresh = 'Refresh'; // Build lazarus dialog - lisBuildJITForm = 'Build JITForm'; lisCleanLazarusSource = 'Clean Lazarus Source'; lisBuildLCL = 'Build LCL'; lisBuildComponent = 'Build Component'; + lisBuildCodeTools = 'Build CodeTools'; lisBuildSynEdit = 'Build SynEdit'; + lisBuildJITForm = 'Build JIT Form'; + lisBuildPkgReg = 'Build Package Registration'; lisBuildIDE = 'Build IDE'; lisBuildExamples = 'Build Examples'; lisConfigureBuildLazarus = 'Configure %sBuild Lazarus%s'; @@ -1036,6 +1038,7 @@ resourcestring lisLazBuildTargetOS = 'Target OS:'; lisLazBuildLCLInterface = 'LCL interface'; lisLazBuildBuildJITForm = 'Build JITForm'; + lisLazBuildWithStaticPackages = 'With Packages'; lisLazBuildOk = 'Ok'; lisLazBuildCancel = 'Cancel'; lisLazBuildNone = 'None'; diff --git a/lcl/include/customlistbox.inc b/lcl/include/customlistbox.inc index 8ebf8cd46a..bbff6c73c2 100644 --- a/lcl/include/customlistbox.inc +++ b/lcl/include/customlistbox.inc @@ -388,20 +388,27 @@ begin if (Val >= FItems.Count) then raise Exception.CreateFmt(rsIndexOutOfRange,[ClassName,Val,FItems.Count]); if Val<0 then Val:=-1; -//writeln('[TCustomListBox.SetItemIndex] A ',FItems.ClassName,' ',Val); +writeln('[TCustomListBox.SetItemIndex] A ',FItems.ClassName,' ',Val); FItemIndex:=Val; if HandleAllocated then CNSendMessage(LM_SETITEMINDEX, Self, Pointer(Val)); -//writeln('[TCustomListBox.SetItemIndex] END ',FItems.ClassName); +writeln('[TCustomListBox.SetItemIndex] END ',FItems.ClassName); end; -{------------------------------------------------------------------------------} -{ procedure TCustomListBox.Clear } -{------------------------------------------------------------------------------} +{------------------------------------------------------------------------------ + procedure TCustomListBox.Clear +------------------------------------------------------------------------------} procedure TCustomListBox.Clear; begin FItems.Clear; end; +function TCustomListBox.GetIndexAtY(Y: integer): integer; +begin + Result:=-1; + if (not HandleAllocated) then exit; + Result:=CNSendMessage(LM_LB_GETINDEXAT, Self, @Y); +end; + // back to stdctrls.pp diff --git a/lcl/lmessages.pp b/lcl/lmessages.pp index ff3282733b..2a47cf826e 100644 --- a/lcl/lmessages.pp +++ b/lcl/lmessages.pp @@ -144,7 +144,8 @@ const LM_LB_First = LM_NB_Last +1; LM_LB_GETTOPINDEX = LM_LB_First +1; LM_LB_SETTOPINDEX = LM_LB_First +2; - LM_LB_Last = LM_LB_SETTOPINDEX; + LM_LB_GETINDEXAT = LM_LB_First +3; + LM_LB_Last = LM_LB_GETINDEXAT; //------------- @@ -1044,6 +1045,9 @@ end. { $Log$ + Revision 1.48 2003/04/29 13:35:39 mattias + improved configure build lazarus dialog + Revision 1.47 2003/04/08 00:09:03 mattias added LM_APPENDTEXT from hernan diff --git a/lcl/stdctrls.pp b/lcl/stdctrls.pp index 8809618caf..03d860539e 100644 --- a/lcl/stdctrls.pp +++ b/lcl/stdctrls.pp @@ -368,6 +368,7 @@ type constructor Create(AOwner : TComponent); override; destructor Destroy; override; procedure Clear; + function GetIndexAtY(Y: integer): integer; property BorderStyle : TBorderStyle read FBorderStyle write SetBorderStyle default bsSingle; property Canvas: TCanvas read FCanvas; property ItemIndex : integer read GetItemIndex write SetItemIndex; @@ -1449,6 +1450,9 @@ end. { ============================================================================= $Log$ + Revision 1.91 2003/04/29 13:35:39 mattias + improved configure build lazarus dialog + Revision 1.90 2003/04/16 22:59:35 mattias added TMaskEdit from Tony diff --git a/packager/pkgmanager.pas b/packager/pkgmanager.pas index 561f5d5580..f641f24c06 100644 --- a/packager/pkgmanager.pas +++ b/packager/pkgmanager.pas @@ -2339,7 +2339,6 @@ var AddOptionsList: TList; InheritedOptionStrings: TInheritedCompOptsStrings; ConfigDir: String; - TargetDir: String; begin Result:=''; if not Assigned(OnGetAllRequiredPackages) then exit; @@ -2363,11 +2362,12 @@ begin AddOption('-Fi'+ConfigDir); // add target option - TargetDir:=MiscellaneousOptions.BuildLazOpts.TargetDirectory; + // ToDo + {TargetDir:=MiscellaneousOptions.BuildLazOpts.TargetDirectory; MainIDE.MacroList.SubstituteStr(TargetDir); - // ToDo write a function in lazconf for this - AddOption('-FE'+TargetDir); + //if TargetDir<>'' then + AddOption('-FE'+TargetDir);} end; function TPkgManager.OnProjectInspectorOpen(Sender: TObject): boolean;