From 04b03bbb5dbb551f85440030885e7e9273ee0a08 Mon Sep 17 00:00:00 2001 From: mattias Date: Fri, 4 Sep 2009 15:49:55 +0000 Subject: [PATCH] IDE: started build modes grid git-svn-id: trunk@21576 - --- ide/compileroptionsdlg.pp | 12 +++++- ide/frames/buildmodeseditor.pas | 67 ++++++++++++++++++++++++++++++++- 2 files changed, 77 insertions(+), 2 deletions(-) diff --git a/ide/compileroptionsdlg.pp b/ide/compileroptionsdlg.pp index e48baee7b3..16fc9848b5 100644 --- a/ide/compileroptionsdlg.pp +++ b/ide/compileroptionsdlg.pp @@ -46,7 +46,7 @@ uses MacroIntf, ProjectIntf, IDEWindowIntf, IDEContextHelpEdit, TransferMacros, PathEditorDlg, LazarusIDEStrConsts, IDEOptionDefs, LazConf, IDEProcs, IDEImagesIntf, ShowCompilerOpts, Project, PackageDefs, - CompilerOptions, CheckCompilerOpts, CompOptsModes, + CompilerOptions, CheckCompilerOpts, CompOptsModes, BuildModesEditor, Compiler_Conditionals_Options, Compiler_BuildVar_Options, CheckLst; type @@ -263,6 +263,7 @@ type private fPathsTVNode: TTreeNode; FBuildModesTVNode: TTreeNode; + fBuildModeGrid: TBuildModesGrid; procedure SetupSearchPathsTab(Page: integer); procedure SetupBuildModesTab(Page: integer); procedure SetupParsingTab(Page: integer); @@ -670,6 +671,8 @@ begin FBuildModesTVNode:=CategoryTreeView.Items.AddObject(fPathsTVNode, BuildModesPage.Caption,BuildModesPage); end; + fBuildModeGrid.Graph.Assign(TProjectCompilerOptions(Options).BuildModes); + fBuildModeGrid.RebuildGrid; end else begin // hide build modes if FBuildModesTVNode<>nil then begin @@ -1749,6 +1752,13 @@ begin // Setup the Build Modes Tab MainNoteBook.Page[Page].Caption:='Build modes'; fBuildModesTVNode:=CategoryTreeView.Items.AddObject(nil,MainNoteBook.Page[Page].Caption,MainNoteBook.Page[Page]); + + fBuildModeGrid:=TBuildModesGrid.Create(Self); + with fBuildModeGrid do begin + Name:='fBuildModeGrid'; + Align:=alClient; + Parent:=BuildModesPage; + end; end; {------------------------------------------------------------------------------ diff --git a/ide/frames/buildmodeseditor.pas b/ide/frames/buildmodeseditor.pas index a9554c71f1..4ffc1240e1 100644 --- a/ide/frames/buildmodeseditor.pas +++ b/ide/frames/buildmodeseditor.pas @@ -25,10 +25,36 @@ unit BuildModesEditor; interface uses - Classes, SysUtils, FileUtil, LResources, Forms; + Classes, SysUtils, FileUtil, LResources, Forms, Grids, + CompilerOptions; type + { TBuildModeGridRow } + + TBuildModeGridRow = class + private + FFlag: TBuildModeFlag; + FMode: TBuildMode; + public + constructor Create(aMode: TBuildMode; aFlag: TBuildModeFlag); + destructor Destroy; override; + property Mode: TBuildMode read FMode; + property Flag: TBuildModeFlag read FFlag; + end; + + { TBuildModesGrid } + + TBuildModesGrid = class(TStringGrid) + private + FGraph: TBuildModeGraph; + FModeRows: array of TBuildModeGridRow; + public + constructor Create(TheOwner: TComponent); override; + destructor Destroy; override; + property Graph: TBuildModeGraph read FGraph; + procedure RebuildGrid; // call this after Graph changed + end; TBuildModesEditorFrame = class(TFrame) private @@ -37,6 +63,45 @@ type implementation +{ TBuildModesGrid } + +constructor TBuildModesGrid.Create(TheOwner: TComponent); +begin + fGraph:=TBuildModeGraph.Create; + inherited Create(TheOwner); +end; + +destructor TBuildModesGrid.Destroy; +begin + inherited Destroy; + FreeAndNil(FGraph); +end; + +procedure TBuildModesGrid.RebuildGrid; +var + i: Integer; + Cnt: Integer; +begin + for i:=0 to Length(FModeRows)-1 do FModeRows[i].Free; + Cnt:=0; + for i:=0 to FGraph.ModeCount-1 do + ; + SetLength(FModeRows,Cnt); +end; + +{ TBuildModeGridRow } + +constructor TBuildModeGridRow.Create(aMode: TBuildMode; aFlag: TBuildModeFlag); +begin + FMode:=aMode; + FFlag:=aFlag; +end; + +destructor TBuildModeGridRow.Destroy; +begin + inherited Destroy; +end; + initialization {$I buildmodeseditor.lrs}