mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 14:49:29 +02:00
IDE: started filling build modes grid
git-svn-id: trunk@23098 -
This commit is contained in:
parent
6d778583c8
commit
0de4518618
@ -90,10 +90,11 @@ type
|
||||
TBuildModeGraph = class;
|
||||
|
||||
{ TIDEBuildVariables
|
||||
- every package and project has a list of variables
|
||||
- has a list of possible values
|
||||
- has a default value, or an expression to define the default
|
||||
the expression can use other build variables }
|
||||
- every package and project has this list of variables
|
||||
every variable has
|
||||
- a list of possible values
|
||||
- and has a default value, or an expression to define the default
|
||||
the expression can use other build variables }
|
||||
|
||||
TIDEBuildVariables = class(TLazBuildVariables)
|
||||
private
|
||||
@ -123,7 +124,10 @@ type
|
||||
property BuildModeGraph: TBuildModeGraph read FBuildModeGraph write SetBuildPropertySet;// active in BuildModeSet
|
||||
end;
|
||||
|
||||
{ TBuildModeFlag }
|
||||
{ TBuildModeFlag
|
||||
The project can set global values, which are used to set the
|
||||
build variables (TIDEBuildVariable). Either directly or indirectly via the
|
||||
conditionals (TLazCompOptConditionals). }
|
||||
|
||||
TBuildModeFlag = class(TPersistent)
|
||||
private
|
||||
@ -159,6 +163,7 @@ type
|
||||
FIncludes: TFPList;// list of TBuildMode
|
||||
FIncludedBy: TFPList;// list of TBuildMode
|
||||
FName: string;
|
||||
FShowIncludes: boolean;
|
||||
FStoredInSession: boolean;
|
||||
function GetFlagCount: integer;
|
||||
function GetFlags(Index: integer): TBuildModeFlag;
|
||||
@ -194,6 +199,7 @@ type
|
||||
property IncludedByCount: integer read GetIncludedByCount;
|
||||
property IncludedBy[Index: integer]: TBuildMode read GetIncludedBy;
|
||||
property Active: boolean read FActive;
|
||||
property ShowIncludes: boolean read FShowIncludes write FShowIncludes;
|
||||
property FlagCount: integer read GetFlagCount;
|
||||
property Flags[Index: integer]: TBuildModeFlag read GetFlags;
|
||||
end;
|
||||
@ -5045,6 +5051,7 @@ begin
|
||||
DoSwitchPathDelims);
|
||||
end;
|
||||
|
||||
FShowIncludes:=XMLConfig.GetValue(Path+'Includes/Show',false);
|
||||
NewCnt:=XMLConfig.GetValue(Path+'Includes/Count',0);
|
||||
for i:=0 to NewCnt-1 do begin
|
||||
ModeName:=XMLConfig.GetValue(Path+'Includes/Mode'+IntToStr(i)+'/Name','');
|
||||
@ -5063,6 +5070,7 @@ begin
|
||||
for i:=0 to FlagCount-1 do
|
||||
Flags[i].SaveToXMLConfig(XMLConfig,Path+'Flags/Item'+IntToStr(i)+'/',
|
||||
UsePathDelim);
|
||||
XMLConfig.SetDeleteValue(Path+'Includes/Show',ShowIncludes,false);
|
||||
XMLConfig.SetDeleteValue(Path+'Includes/Count',IncludeCount,0);
|
||||
for i:=0 to IncludeCount-1 do
|
||||
XMLConfig.SetDeleteValue(Path+'Includes/Mode'+IntToStr(i)+'/Name',
|
||||
|
@ -3,7 +3,26 @@ object BuildModesEditorFrame: TBuildModesEditorFrame
|
||||
Height = 300
|
||||
Top = 0
|
||||
Width = 400
|
||||
ClientHeight = 300
|
||||
ClientWidth = 400
|
||||
TabOrder = 0
|
||||
DesignLeft = 460
|
||||
DesignTop = 269
|
||||
object BuildModesToolBar1: TToolBar
|
||||
Left = 0
|
||||
Height = 26
|
||||
Top = 0
|
||||
Width = 400
|
||||
Caption = 'BuildModesToolBar1'
|
||||
TabOrder = 0
|
||||
object NewBuildModeToolButton: TToolButton
|
||||
Left = 1
|
||||
Top = 2
|
||||
Caption = 'NewBuildModeToolButton'
|
||||
end
|
||||
end
|
||||
object BuildModesPopupMenu: TPopupMenu
|
||||
left = 83
|
||||
top = 115
|
||||
end
|
||||
end
|
||||
|
@ -2,6 +2,11 @@
|
||||
|
||||
LazarusResources.Add('TBuildModesEditorFrame','FORMDATA',[
|
||||
'TPF0'#22'TBuildModesEditorFrame'#21'BuildModesEditorFrame'#4'Left'#2#0#6'Hei'
|
||||
+'ght'#3','#1#3'Top'#2#0#5'Width'#3#144#1#8'TabOrder'#2#0#10'DesignLeft'#3#204
|
||||
+#1#9'DesignTop'#3#13#1#0#0
|
||||
+'ght'#3','#1#3'Top'#2#0#5'Width'#3#144#1#12'ClientHeight'#3','#1#11'ClientWi'
|
||||
+'dth'#3#144#1#8'TabOrder'#2#0#10'DesignLeft'#3#204#1#9'DesignTop'#3#13#1#0#8
|
||||
+'TToolBar'#18'BuildModesToolBar1'#4'Left'#2#0#6'Height'#2#26#3'Top'#2#0#5'Wi'
|
||||
+'dth'#3#144#1#7'Caption'#6#18'BuildModesToolBar1'#8'TabOrder'#2#0#0#11'TTool'
|
||||
+'Button'#22'NewBuildModeToolButton'#4'Left'#2#1#3'Top'#2#2#7'Caption'#6#22'N'
|
||||
+'ewBuildModeToolButton'#0#0#0#10'TPopupMenu'#19'BuildModesPopupMenu'#4'left'
|
||||
+#2'S'#3'top'#2's'#0#0#0
|
||||
]);
|
||||
|
@ -25,8 +25,8 @@ unit BuildModesEditor;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, LResources, Forms, Grids,
|
||||
CompilerOptions;
|
||||
Classes, SysUtils, Controls, FileUtil, LResources, Forms, Grids, Menus,
|
||||
ComCtrls, CompilerOptions;
|
||||
|
||||
type
|
||||
|
||||
@ -35,12 +35,14 @@ type
|
||||
TBuildModeGridRow = class
|
||||
private
|
||||
FFlag: TBuildModeFlag;
|
||||
FIndexInGroup: integer;
|
||||
FMode: TBuildMode;
|
||||
public
|
||||
constructor Create(aMode: TBuildMode; aFlag: TBuildModeFlag);
|
||||
destructor Destroy; override;
|
||||
property Mode: TBuildMode read FMode;
|
||||
property Flag: TBuildModeFlag read FFlag;
|
||||
property IndexInGroup: integer read FIndexInGroup write FIndexInGroup;
|
||||
end;
|
||||
|
||||
{ TBuildModesGrid }
|
||||
@ -48,45 +50,177 @@ type
|
||||
TBuildModesGrid = class(TStringGrid)
|
||||
private
|
||||
FGraph: TBuildModeGraph;
|
||||
FModeRows: array of TBuildModeGridRow;
|
||||
FGroupModeCount: integer;
|
||||
FModeRows: TFPList; // list of TBuildModeGridRow
|
||||
function GetModeRowCount: integer;
|
||||
function GetModeRows(Index: integer): TBuildModeGridRow;
|
||||
procedure ClearModeRows;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
property Graph: TBuildModeGraph read FGraph;
|
||||
procedure RebuildGrid; // call this after Graph changed
|
||||
property ModeRowCount: integer read GetModeRowCount;
|
||||
property ModeRows[Index: integer]: TBuildModeGridRow read GetModeRows;
|
||||
property GroupModeCount: integer read FGroupModeCount; // number of modes that are group of modes
|
||||
end;
|
||||
|
||||
{ TBuildModesEditorFrame }
|
||||
|
||||
TBuildModesEditorFrame = class(TFrame)
|
||||
BuildModesPopupMenu: TPopupMenu;
|
||||
BuildModesToolBar1: TToolBar;
|
||||
NewBuildModeToolButton: TToolButton;
|
||||
private
|
||||
FGrid: TBuildModesGrid;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
property Grid: TBuildModesGrid read FGrid;
|
||||
end;
|
||||
|
||||
function BuildModeFlagTypeCaptions(f: TBuildModeFlagType): string;
|
||||
|
||||
implementation
|
||||
|
||||
function BuildModeFlagTypeCaptions(f: TBuildModeFlagType): string;
|
||||
begin
|
||||
case f of
|
||||
bmftAddUnitPath: Result:='+UnitPath';
|
||||
bmftAddIncludePath: Result:='+IncludePath';
|
||||
bmftAddLinkerPath: Result:='+linkerPath';
|
||||
bmftAddObjectPath: Result:='+ObjectPath';
|
||||
bmftAddLinkerOption: Result:='+LinkerOptions';
|
||||
bmftAddCustomOption: Result:='+CustomOptions';
|
||||
else Result:='';
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TBuildModesGrid }
|
||||
|
||||
function TBuildModesGrid.GetModeRows(Index: integer): TBuildModeGridRow;
|
||||
begin
|
||||
Result:=TBuildModeGridRow(FModeRows[Index]);
|
||||
end;
|
||||
|
||||
procedure TBuildModesGrid.ClearModeRows;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i:=0 to FModeRows.Count-1 do
|
||||
TObject(FModeRows[i]).Free;
|
||||
FModeRows.Clear;
|
||||
FGroupModeCount:=0;
|
||||
end;
|
||||
|
||||
function TBuildModesGrid.GetModeRowCount: integer;
|
||||
begin
|
||||
Result:=FModeRows.Count;
|
||||
end;
|
||||
|
||||
constructor TBuildModesGrid.Create(TheOwner: TComponent);
|
||||
begin
|
||||
fGraph:=TBuildModeGraph.Create;
|
||||
inherited Create(TheOwner);
|
||||
fGraph:=TBuildModeGraph.Create;
|
||||
FModeRows:=TFPList.Create;
|
||||
end;
|
||||
|
||||
destructor TBuildModesGrid.Destroy;
|
||||
begin
|
||||
inherited Destroy;
|
||||
ClearModeRows;
|
||||
FreeAndNil(FModeRows);
|
||||
FreeAndNil(FGraph);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TBuildModesGrid.RebuildGrid;
|
||||
var
|
||||
GroupInsertPos: Integer;
|
||||
|
||||
procedure AddRow(CurMode: TBuildMode; NewRow: TBuildModeGridRow);
|
||||
var
|
||||
InsertPos: LongInt;
|
||||
begin
|
||||
if CurMode.ShowIncludes then begin
|
||||
InsertPos:=GroupInsertPos;
|
||||
inc(GroupInsertPos);
|
||||
end else begin
|
||||
InsertPos:=FModeRows.Count;
|
||||
end;
|
||||
if (InsertPos=0) or (ModeRows[InsertPos-1].Mode<>CurMode) then
|
||||
NewRow.IndexInGroup:=0
|
||||
else
|
||||
NewRow.IndexInGroup:=ModeRows[InsertPos-1].IndexInGroup+1;
|
||||
FModeRows.Insert(InsertPos,NewRow);
|
||||
end;
|
||||
|
||||
var
|
||||
i: Integer;
|
||||
Cnt: Integer;
|
||||
CurMode: TBuildMode;
|
||||
NewRow: TBuildModeGridRow;
|
||||
j: Integer;
|
||||
CurRow: TBuildModeGridRow;
|
||||
TypeCol: Integer;
|
||||
ValueCol: Integer;
|
||||
CurFlag: TBuildModeFlag;
|
||||
TypeStr: String;
|
||||
ValueStr: String;
|
||||
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);
|
||||
ClearModeRows;
|
||||
GroupInsertPos:=0;
|
||||
// create rows
|
||||
for i:=0 to Graph.ModeCount-1 do begin
|
||||
CurMode:=Graph.Modes[i];
|
||||
if CurMode.ShowIncludes then inc(FGroupModeCount);
|
||||
if (CurMode.FlagCount=0) then begin
|
||||
// no flags => create an empty one
|
||||
NewRow:=TBuildModeGridRow.Create(CurMode,nil);
|
||||
AddRow(CurMode,NewRow);
|
||||
end else begin
|
||||
for j:=0 to CurMode.FlagCount-1 do begin
|
||||
CurFlag:=CurMode.Flags[j];
|
||||
NewRow:=TBuildModeGridRow.Create(CurMode,CurFlag);
|
||||
AddRow(CurMode,NewRow);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
// grid size
|
||||
RowCount:=FModeRows.Count+1;
|
||||
ColCount:=GroupModeCount+3;
|
||||
// header
|
||||
Cells[0,0]:='Build mode';
|
||||
for i:=1 to GroupModeCount do Cells[i,0]:='';
|
||||
TypeCol:=GroupModeCount+1;
|
||||
ValueCol:=TypeCol+1;
|
||||
Cells[TypeCol,0]:='Type';
|
||||
Cells[ValueCol,0]:='Value';
|
||||
// values
|
||||
for i:=1 to ModeRowCount do begin
|
||||
CurRow:=ModeRows[i-1];
|
||||
// name
|
||||
if CurRow.IndexInGroup=0 then
|
||||
Cells[0,i]:=CurRow.Mode.Name
|
||||
else
|
||||
Cells[0,i]:='';
|
||||
// included by
|
||||
for j:=0 to GroupModeCount-1 do
|
||||
Cells[j+1,i]:='';
|
||||
// type + value
|
||||
CurFlag:=CurRow.Flag;
|
||||
TypeStr:='';
|
||||
ValueStr:='';
|
||||
if CurFlag<>nil then begin
|
||||
if CurFlag.FlagType=bmftSetVariable then
|
||||
begin
|
||||
TypeStr:=CurFlag.Variable;
|
||||
ValueStr:=CurFlag.Value;
|
||||
end else
|
||||
TypeStr:=BuildModeFlagTypeCaptions(CurFlag.FlagType);
|
||||
end;
|
||||
Cells[TypeCol,i]:=TypeStr;
|
||||
Cells[ValueCol,i]:=ValueStr;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
{ TBuildModeGridRow }
|
||||
@ -102,6 +236,24 @@ begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
{ TBuildModesEditorFrame }
|
||||
|
||||
constructor TBuildModesEditorFrame.Create(TheOwner: TComponent);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
FGrid:=TBuildModesGrid.Create(Self);
|
||||
with Grid do begin
|
||||
Name:='Grid';
|
||||
Parent:=Self;
|
||||
Align:=alClient;
|
||||
end;
|
||||
end;
|
||||
|
||||
destructor TBuildModesEditorFrame.Destroy;
|
||||
begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$I buildmodeseditor.lrs}
|
||||
|
||||
|
@ -102,7 +102,8 @@ const
|
||||
type
|
||||
TLazCompOptConditionals = class;
|
||||
|
||||
{ TCompOptCondNode - a node in the conditional tree of the compiler options
|
||||
{ TCompOptCondNode
|
||||
a node in the conditional tree of the compiler options
|
||||
of a project or package }
|
||||
|
||||
TCompOptCondNode = class
|
||||
@ -132,6 +133,7 @@ type
|
||||
procedure Move(NewParent: TCompOptCondNode; NewIndex: integer);
|
||||
procedure Delete(Index: integer);
|
||||
procedure Assign(Source: TCompOptCondNode);
|
||||
public
|
||||
property NodeType: TCOCNodeType read FNodeType write SetNodeType;
|
||||
property ValueType: TCOCValueType read FValueType write SetValueType;
|
||||
property Value: string read FValue write SetValue;
|
||||
@ -157,7 +159,7 @@ type
|
||||
property Root: TCompOptCondNode read FRoot write FRoot;
|
||||
end;
|
||||
|
||||
{ TLazBuildProperty }
|
||||
{ TLazBuildVariable }
|
||||
|
||||
TLazBuildVariable = class
|
||||
protected
|
||||
|
Loading…
Reference in New Issue
Block a user