mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 13:39:11 +02:00
IDE: build modes: stared group includes
git-svn-id: trunk@23199 -
This commit is contained in:
parent
f2a6193637
commit
e77c7bec7b
@ -181,6 +181,7 @@ type
|
|||||||
procedure ClearIncludedBys;
|
procedure ClearIncludedBys;
|
||||||
procedure Include(aMode: TBuildMode);
|
procedure Include(aMode: TBuildMode);
|
||||||
procedure Exclude(aMode: TBuildMode);
|
procedure Exclude(aMode: TBuildMode);
|
||||||
|
function IsIncludedBy(aMode: TBuildMode): boolean;
|
||||||
function AddFlag(FlagType: TBuildModeFlagType; Value: string;
|
function AddFlag(FlagType: TBuildModeFlagType; Value: string;
|
||||||
Variable: string = ''): TBuildModeFlag;
|
Variable: string = ''): TBuildModeFlag;
|
||||||
function InsertFlag(InsertPos: integer; FlagType: TBuildModeFlagType;
|
function InsertFlag(InsertPos: integer; FlagType: TBuildModeFlagType;
|
||||||
@ -5026,6 +5027,15 @@ begin
|
|||||||
if aMode<>nil then aMode.FIncludedBy.Remove(Self);
|
if aMode<>nil then aMode.FIncludedBy.Remove(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TBuildMode.IsIncludedBy(aMode: TBuildMode): boolean;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
for i:=0 to IncludedByCount-1 do
|
||||||
|
if IncludedBy[i]=aMode then exit(true);
|
||||||
|
Result:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
function TBuildMode.AddFlag(FlagType: TBuildModeFlagType; Value: string;
|
function TBuildMode.AddFlag(FlagType: TBuildModeFlagType; Value: string;
|
||||||
Variable: string): TBuildModeFlag;
|
Variable: string): TBuildModeFlag;
|
||||||
begin
|
begin
|
||||||
|
@ -26,7 +26,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, LCLProc, Controls, FileUtil, LResources, Forms, Grids,
|
Classes, SysUtils, LCLProc, Controls, FileUtil, LResources, Forms, Grids,
|
||||||
Menus, ComCtrls, Dialogs, AvgLvlTree, DefineTemplates,
|
Menus, ComCtrls, Dialogs, AvgLvlTree, DefineTemplates, StdCtrls,
|
||||||
ProjectIntf, IDEImagesIntf,
|
ProjectIntf, IDEImagesIntf,
|
||||||
PathEditorDlg, Project, PackageSystem, LazarusIDEStrConsts, CompilerOptions,
|
PathEditorDlg, Project, PackageSystem, LazarusIDEStrConsts, CompilerOptions,
|
||||||
IDEProcs;
|
IDEProcs;
|
||||||
@ -73,6 +73,10 @@ type
|
|||||||
out Vars: TLazBuildVariables; out aVariable: TLazBuildVariable);
|
out Vars: TLazBuildVariables; out aVariable: TLazBuildVariable);
|
||||||
function SelectCell(aCol, aRow: Integer): boolean; override;
|
function SelectCell(aCol, aRow: Integer): boolean; override;
|
||||||
procedure BuildModesGridEditButtonClick(Sender: TObject);
|
procedure BuildModesGridEditButtonClick(Sender: TObject);
|
||||||
|
procedure GetCheckBoxState(const aCol, aRow: Integer;
|
||||||
|
var aState: TCheckboxState); override;
|
||||||
|
procedure SetCheckboxState(const aCol, aRow: Integer;
|
||||||
|
const aState: TCheckboxState); override;
|
||||||
public
|
public
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -81,6 +85,7 @@ type
|
|||||||
procedure DeleteSelectedModeRow;
|
procedure DeleteSelectedModeRow;
|
||||||
function BuildGroupToCol(GroupIndex: integer): integer;
|
function BuildGroupToCol(GroupIndex: integer): integer;
|
||||||
function ColToBuildGroup(aCol: integer): integer;
|
function ColToBuildGroup(aCol: integer): integer;
|
||||||
|
function CellToInclude(aCol, aRow: integer): boolean;
|
||||||
property Graph: TBuildModeGraph read FGraph;
|
property Graph: TBuildModeGraph read FGraph;
|
||||||
procedure RebuildGrid; // call this after Graph changed
|
procedure RebuildGrid; // call this after Graph changed
|
||||||
property ModeRowCount: integer read GetModeRowCount;
|
property ModeRowCount: integer read GetModeRowCount;
|
||||||
@ -185,8 +190,13 @@ begin
|
|||||||
else
|
else
|
||||||
Cells[0,i]:='';
|
Cells[0,i]:='';
|
||||||
// included by
|
// included by
|
||||||
for j:=0 to GroupModeCount-1 do
|
for j:=0 to GroupModeCount-1 do begin
|
||||||
Cells[j+1,i]:='';
|
if CellToInclude(j+1,i) then
|
||||||
|
Cells[j+1,i]:=Columns[j+1].ValueChecked
|
||||||
|
else
|
||||||
|
Cells[j+1,i]:=Columns[j+1].ValueUnchecked;
|
||||||
|
DebugLn(['TBuildModesGrid.FillGridRow ',j+1,' ',i,' ',Cells[j+1,i]]);
|
||||||
|
end;
|
||||||
// type + value
|
// type + value
|
||||||
CurFlag:=CurRow.Flag;
|
CurFlag:=CurRow.Flag;
|
||||||
TypeStr:='';
|
TypeStr:='';
|
||||||
@ -474,6 +484,69 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TBuildModesGrid.GetCheckBoxState(const aCol, aRow: Integer;
|
||||||
|
var aState: TCheckboxState);
|
||||||
|
var
|
||||||
|
CurModeRow: TBuildModeGridRow;
|
||||||
|
GrpID: LongInt;
|
||||||
|
begin
|
||||||
|
CurModeRow:=GetSelectedModeRow;
|
||||||
|
aState:=cbUnchecked;
|
||||||
|
if (CurModeRow<>nil) and (CurModeRow.IndexInGroup=0) then begin
|
||||||
|
GrpID:=ColToBuildGroup(aCol);
|
||||||
|
if (GrpID>=0) and (GrpID<GroupModeCount) then begin
|
||||||
|
if CurModeRow.Mode.IsIncludedBy(ModeRows[GrpID].Mode) then
|
||||||
|
aState:=cbChecked;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
DebugLn(['TBuildModesGrid.GetCheckBoxState ',acol,' ',arow,' ',ord(aState)]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TBuildModesGrid.SetCheckboxState(const aCol, aRow: Integer;
|
||||||
|
const aState: TCheckboxState);
|
||||||
|
var
|
||||||
|
CurModeRow: TBuildModeGridRow;
|
||||||
|
GrpID: LongInt;
|
||||||
|
GrpMode: TBuildMode;
|
||||||
|
NewState: TCheckBoxState;
|
||||||
|
begin
|
||||||
|
DebugLn(['TBuildModesGrid.SetCheckboxState ',acol,' ',arow,' ',ord(aState)]);
|
||||||
|
NewState:=cbUnchecked;
|
||||||
|
CurModeRow:=GetSelectedModeRow;
|
||||||
|
if (CurModeRow<>nil) and (CurModeRow.IndexInGroup=0) then begin
|
||||||
|
GrpID:=ColToBuildGroup(aCol);
|
||||||
|
if (GrpID>=0) and (GrpID<GroupModeCount) then begin
|
||||||
|
GrpMode:=ModeRows[GrpID].Mode;
|
||||||
|
if CurModeRow.Mode=GrpMode then begin
|
||||||
|
// invalid circle
|
||||||
|
DebugLn(['TBuildModesGrid.SetCheckboxState invalid circle']);
|
||||||
|
end else if CurModeRow.Mode.IsIncludedBy(GrpMode)<>(aState=cbChecked) then
|
||||||
|
begin
|
||||||
|
// state changed
|
||||||
|
DebugLn(['TBuildModesGrid.SetCheckboxState STATE CHANGED']);
|
||||||
|
if aState=cbChecked then begin
|
||||||
|
GrpMode.Include(CurModeRow.Mode);
|
||||||
|
NewState:=cbChecked;
|
||||||
|
end else begin
|
||||||
|
GrpMode.Exclude(CurModeRow.Mode);
|
||||||
|
end;
|
||||||
|
end else if CurModeRow.Mode.IsIncludedBy(GrpMode) then begin
|
||||||
|
// state kept
|
||||||
|
DebugLn(['TBuildModesGrid.SetCheckboxState STATE KEPT']);
|
||||||
|
NewState:=cbChecked;
|
||||||
|
end;
|
||||||
|
end else begin
|
||||||
|
// invalid column
|
||||||
|
DebugLn(['TBuildModesGrid.SetCheckboxState invalid col ',ACol,' ',GrpId,' ',GroupModeCount]);
|
||||||
|
end;
|
||||||
|
end else begin
|
||||||
|
// invalid row
|
||||||
|
DebugLn(['TBuildModesGrid.SetCheckboxState invalid row']);
|
||||||
|
end;
|
||||||
|
DebugLn(['TBuildModesGrid.SetCheckboxState END ',aCol,' ',aRow,' ',ord(NewState)]);
|
||||||
|
inherited SetCheckboxState(aCol, aRow, NewState);
|
||||||
|
end;
|
||||||
|
|
||||||
function TBuildModesGrid.GetSelectedModeRow: TBuildModeGridRow;
|
function TBuildModesGrid.GetSelectedModeRow: TBuildModeGridRow;
|
||||||
begin
|
begin
|
||||||
if (Row<1) or (Row>ModeRowCount) then
|
if (Row<1) or (Row>ModeRowCount) then
|
||||||
@ -518,6 +591,8 @@ begin
|
|||||||
InsertCol:=BuildGroupToCol(GroupModeCount-1);
|
InsertCol:=BuildGroupToCol(GroupModeCount-1);
|
||||||
InsertColRow(true,InsertCol);
|
InsertColRow(true,InsertCol);
|
||||||
Columns[InsertCol].Title.Caption:=' ';
|
Columns[InsertCol].Title.Caption:=' ';
|
||||||
|
Columns[InsertCol].ButtonStyle:=cbsCheckboxColumn;
|
||||||
|
inc(FGroupModeCount);
|
||||||
end else begin
|
end else begin
|
||||||
CurFlag:=Result.AddFlag(bmftNone,'');
|
CurFlag:=Result.AddFlag(bmftNone,'');
|
||||||
InsertPos:=ModeRowCount;
|
InsertPos:=ModeRowCount;
|
||||||
@ -619,6 +694,22 @@ begin
|
|||||||
Result:=GroupModeCount-aCol;
|
Result:=GroupModeCount-aCol;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TBuildModesGrid.CellToInclude(aCol, aRow: integer): boolean;
|
||||||
|
var
|
||||||
|
GrpID: LongInt;
|
||||||
|
CurMode: TBuildModeGridRow;
|
||||||
|
begin
|
||||||
|
if (aRow>=1) and (ARow<=GroupModeCount) then begin
|
||||||
|
CurMode:=ModeRows[aRow-1];
|
||||||
|
GrpID:=ColToBuildGroup(aCol);
|
||||||
|
if (GrpID>=0) and (GrpID<GroupModeCount) then begin
|
||||||
|
if CurMode.Mode.IsIncludedBy(ModeRows[GrpID].Mode) then
|
||||||
|
exit(true);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Result:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TBuildModesGrid.RebuildGrid;
|
procedure TBuildModesGrid.RebuildGrid;
|
||||||
var
|
var
|
||||||
GroupInsertPos: Integer;
|
GroupInsertPos: Integer;
|
||||||
@ -680,8 +771,10 @@ begin
|
|||||||
TypeCol:=GroupModeCount+1;
|
TypeCol:=GroupModeCount+1;
|
||||||
ValueCol:=TypeCol+1;
|
ValueCol:=TypeCol+1;
|
||||||
Columns[0].Width:=150;
|
Columns[0].Width:=150;
|
||||||
for i:=1 to TypeCol-1 do
|
for i:=1 to TypeCol-1 do begin
|
||||||
Columns[i].Width:=20;
|
Columns[i].Width:=15;
|
||||||
|
Columns[i].ButtonStyle:=cbsCheckboxColumn;
|
||||||
|
end;
|
||||||
Columns[TypeCol].Width:=120;
|
Columns[TypeCol].Width:=120;
|
||||||
Columns[TypeCol].ButtonStyle:=cbsPickList;
|
Columns[TypeCol].ButtonStyle:=cbsPickList;
|
||||||
Columns[ValueCol].Width:=300;
|
Columns[ValueCol].Width:=300;
|
||||||
|
@ -8043,6 +8043,7 @@ var
|
|||||||
begin
|
begin
|
||||||
AState := cbUnchecked;
|
AState := cbUnchecked;
|
||||||
GetCheckBoxState(aCol, aRow, aState);
|
GetCheckBoxState(aCol, aRow, aState);
|
||||||
|
DebugLn(['TCustomDrawGrid.DrawCellCheckboxBitmaps ',aCol,' ',aRow,' State=',ord(aState)]);
|
||||||
DrawGridCheckboxBitmaps(aRect, aState);
|
DrawGridCheckboxBitmaps(aRect, aState);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user