IDE: started build modes grid

git-svn-id: trunk@21576 -
This commit is contained in:
mattias 2009-09-04 15:49:55 +00:00
parent b83e38fcc4
commit 04b03bbb5d
2 changed files with 77 additions and 2 deletions

View File

@ -46,7 +46,7 @@ uses
MacroIntf, ProjectIntf, IDEWindowIntf, IDEContextHelpEdit, MacroIntf, ProjectIntf, IDEWindowIntf, IDEContextHelpEdit,
TransferMacros, PathEditorDlg, LazarusIDEStrConsts, IDEOptionDefs, LazConf, TransferMacros, PathEditorDlg, LazarusIDEStrConsts, IDEOptionDefs, LazConf,
IDEProcs, IDEImagesIntf, ShowCompilerOpts, Project, PackageDefs, IDEProcs, IDEImagesIntf, ShowCompilerOpts, Project, PackageDefs,
CompilerOptions, CheckCompilerOpts, CompOptsModes, CompilerOptions, CheckCompilerOpts, CompOptsModes, BuildModesEditor,
Compiler_Conditionals_Options, Compiler_BuildVar_Options, CheckLst; Compiler_Conditionals_Options, Compiler_BuildVar_Options, CheckLst;
type type
@ -263,6 +263,7 @@ type
private private
fPathsTVNode: TTreeNode; fPathsTVNode: TTreeNode;
FBuildModesTVNode: TTreeNode; FBuildModesTVNode: TTreeNode;
fBuildModeGrid: TBuildModesGrid;
procedure SetupSearchPathsTab(Page: integer); procedure SetupSearchPathsTab(Page: integer);
procedure SetupBuildModesTab(Page: integer); procedure SetupBuildModesTab(Page: integer);
procedure SetupParsingTab(Page: integer); procedure SetupParsingTab(Page: integer);
@ -670,6 +671,8 @@ begin
FBuildModesTVNode:=CategoryTreeView.Items.AddObject(fPathsTVNode, FBuildModesTVNode:=CategoryTreeView.Items.AddObject(fPathsTVNode,
BuildModesPage.Caption,BuildModesPage); BuildModesPage.Caption,BuildModesPage);
end; end;
fBuildModeGrid.Graph.Assign(TProjectCompilerOptions(Options).BuildModes);
fBuildModeGrid.RebuildGrid;
end else begin end else begin
// hide build modes // hide build modes
if FBuildModesTVNode<>nil then begin if FBuildModesTVNode<>nil then begin
@ -1749,6 +1752,13 @@ begin
// Setup the Build Modes Tab // Setup the Build Modes Tab
MainNoteBook.Page[Page].Caption:='Build modes'; MainNoteBook.Page[Page].Caption:='Build modes';
fBuildModesTVNode:=CategoryTreeView.Items.AddObject(nil,MainNoteBook.Page[Page].Caption,MainNoteBook.Page[Page]); 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; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------

View File

@ -25,10 +25,36 @@ unit BuildModesEditor;
interface interface
uses uses
Classes, SysUtils, FileUtil, LResources, Forms; Classes, SysUtils, FileUtil, LResources, Forms, Grids,
CompilerOptions;
type 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) TBuildModesEditorFrame = class(TFrame)
private private
@ -37,6 +63,45 @@ type
implementation 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 initialization
{$I buildmodeseditor.lrs} {$I buildmodeseditor.lrs}