mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-25 13:43:15 +02:00
IDE: Formatting for BuildMode stuff. Rename some variables.
git-svn-id: trunk@62119 -
This commit is contained in:
parent
4b43ae528d
commit
18912d2ef6
@ -447,10 +447,8 @@ var
|
||||
i: Integer;
|
||||
begin
|
||||
i:=BuildModesStringGrid.Row-1;
|
||||
if (i>=0) then
|
||||
CurMode:=fBuildModes[i]
|
||||
else
|
||||
exit;
|
||||
if (i<0) then exit;
|
||||
CurMode:=fBuildModes[i];
|
||||
Value:=CurMode.Identifier;
|
||||
if InputQuery(lisRename, lisUIDName, Value) then
|
||||
begin
|
||||
|
@ -753,7 +753,7 @@ end;
|
||||
|
||||
function TCompOptModeMatrixFrame.ActiveModeAsText: string;
|
||||
begin
|
||||
Result:=Grid.Modes[Grid.ActiveMode].Caption;
|
||||
Result:=Grid.Modes[Grid.ActiveModeIndex].Caption;
|
||||
end;
|
||||
|
||||
procedure TCompOptModeMatrixFrame.CreateNewOption(aTyp, aValue: string);
|
||||
@ -991,37 +991,33 @@ var
|
||||
GridHasChanged: Boolean;
|
||||
ValuesHaveChanged: Boolean;
|
||||
aMode: TGroupedMatrixMode;
|
||||
BuildMode: TProjectBuildMode;
|
||||
BuildModes: TProjectBuildModes;
|
||||
BM: TProjectBuildMode;
|
||||
begin
|
||||
GridHasChanged:=false;
|
||||
ValuesHaveChanged:=false;
|
||||
|
||||
// add/update build modes
|
||||
BuildModes:=LazProject.BuildModes;
|
||||
for i:=0 to BuildModes.Count-1 do begin
|
||||
BuildMode:=BuildModes[i];
|
||||
for i:=0 to LazProject.BuildModes.Count-1 do begin
|
||||
BM:=LazProject.BuildModes[i];
|
||||
aColor:=clDefault;
|
||||
if BuildMode.InSession then aColor:=SessionColor;
|
||||
if BM.InSession then aColor:=SessionColor;
|
||||
if i=Grid.Modes.Count then begin
|
||||
Grid.Modes.Add(BuildMode.Identifier,aColor);
|
||||
Grid.Modes.Add(BM.Identifier,aColor);
|
||||
GridHasChanged:=true;
|
||||
end
|
||||
else begin
|
||||
aMode:=Grid.Modes[i];
|
||||
//debugln(['TCompOptModeMatrix.UpdateModes aMode.Caption=',aMode.Caption,' BuildMode.Identifier=',BuildMode.Identifier]);
|
||||
if aMode.Caption<>BuildMode.Identifier then begin
|
||||
aMode.Caption:=BuildMode.Identifier;
|
||||
if aMode.Caption<>BM.Identifier then begin
|
||||
aMode.Caption:=BM.Identifier;
|
||||
GridHasChanged:=true;
|
||||
end;
|
||||
if aMode.Color<>aColor then begin
|
||||
ValuesHaveChanged:=true;
|
||||
aMode.Color:=aColor;
|
||||
ValuesHaveChanged:=true;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
// delete leftover build modes
|
||||
while Grid.Modes.Count>BuildModes.Count do begin
|
||||
while Grid.Modes.Count>LazProject.BuildModes.Count do begin
|
||||
Grid.Modes.Delete(Grid.Modes.Count-1);
|
||||
GridHasChanged:=true;
|
||||
end;
|
||||
@ -1045,7 +1041,7 @@ var
|
||||
begin
|
||||
i:=LazProject.BuildModes.IndexOf(LazProject.ActiveBuildMode);
|
||||
if i>=Grid.Modes.Count then exit;
|
||||
Grid.ActiveMode:=i;
|
||||
Grid.ActiveModeIndex:=i;
|
||||
end;
|
||||
|
||||
procedure TCompOptModeMatrixFrame.MoveRow(Direction: integer);
|
||||
@ -1268,7 +1264,6 @@ procedure TCompOptModeMatrixFrame.ReadSettings(AOptions: TAbstractIDEOptions);
|
||||
var
|
||||
CompOptions: TProjectCompilerOptions;
|
||||
begin
|
||||
//debugln(['TCompOptModeMatrix.ReadSettings ',DbgSName(AOptions)]);
|
||||
if not (AOptions is TProjectCompilerOptions) then exit;
|
||||
CompOptions:=TProjectCompilerOptions(AOptions);
|
||||
if LazProject=CompOptions.LazProject then begin
|
||||
@ -1276,9 +1271,7 @@ begin
|
||||
UpdateActiveMode;
|
||||
exit;
|
||||
end;
|
||||
|
||||
fProject:=CompOptions.LazProject;
|
||||
|
||||
UpdateModes(false);
|
||||
FillMenus;
|
||||
|
||||
@ -1297,7 +1290,6 @@ begin
|
||||
|
||||
// update Grid
|
||||
Grid.MatrixChanged;
|
||||
|
||||
// select project
|
||||
Grid.Row:=Grid.Matrix.IndexOfRow(GroupProject)+1;
|
||||
Grid.Col:=Grid.FixedCols;
|
||||
|
@ -62,11 +62,7 @@ type
|
||||
destructor Destroy; override;
|
||||
procedure Clear; virtual;
|
||||
function Equals(Obj: TObject): boolean; override;
|
||||
property Matrix: TGroupedMatrix read FMatrix;
|
||||
property Group: TGroupedMatrixGroup read FGroup write SetGroup;
|
||||
function GetGroupIndex: integer;
|
||||
property RowInGrid: integer read FRowInGrid; // in Grid, not in Group
|
||||
property LastDrawValueX: integer read FLastDrawValueX write FLastDrawValueX;
|
||||
function Level: integer;
|
||||
function GetNextSibling: TGroupedMatrixRow;
|
||||
function GetNext: TGroupedMatrixRow; virtual;
|
||||
@ -76,6 +72,10 @@ type
|
||||
function GetLastLeaf: TGroupedMatrixRow; virtual; // get last child of last child of ...
|
||||
function GetTopLvlItem: TGroupedMatrixRow;
|
||||
function AsString: string; virtual;
|
||||
property LastDrawValueX: integer read FLastDrawValueX write FLastDrawValueX;
|
||||
property Matrix: TGroupedMatrix read FMatrix;
|
||||
property Group: TGroupedMatrixGroup read FGroup write SetGroup;
|
||||
property RowInGrid: integer read FRowInGrid; // in Grid, not in Group
|
||||
end;
|
||||
TGroupedMatrixRowClass = class of TGroupedMatrixRow;
|
||||
|
||||
@ -96,18 +96,18 @@ type
|
||||
destructor Destroy; override;
|
||||
procedure Clear; override;
|
||||
function Equals(Obj: TObject): boolean; override;
|
||||
property Caption: TCaption read FCaption write FCaption;
|
||||
property Value: string read FValue write FValue;
|
||||
property Writable: boolean read FWritable write FWritable;
|
||||
property Count: integer read GetCount;
|
||||
property Items[Index: integer]: TGroupedMatrixRow read GetItems; default;
|
||||
function IndexOfRow(aRow: TGroupedMatrixRow): integer;
|
||||
procedure Move(CurIndex, NewIndex: integer);
|
||||
function GetNext: TGroupedMatrixRow; override;
|
||||
function GetLastLeaf: TGroupedMatrixRow; override;
|
||||
property Color: TColor read FColor write FColor;
|
||||
function GetEffectiveColor: TColor;
|
||||
function AsString: string; override;
|
||||
property Caption: TCaption read FCaption write FCaption;
|
||||
property Color: TColor read FColor write FColor;
|
||||
property Items[Index: integer]: TGroupedMatrixRow read GetItems; default;
|
||||
property Value: string read FValue write FValue;
|
||||
property Writable: boolean read FWritable write FWritable;
|
||||
property Count: integer read GetCount;
|
||||
end;
|
||||
|
||||
{ TGroupedMatrixValue }
|
||||
@ -126,11 +126,11 @@ type
|
||||
constructor Create(aControl: TGroupedMatrix); override;
|
||||
destructor Destroy; override;
|
||||
function Equals(Obj: TObject): boolean; override;
|
||||
property Value: string read FValue write SetValue;
|
||||
property Typ: string read FTyp write SetTyp;
|
||||
property ModeList: TStrings read FModeList write SetModes;
|
||||
function GetNormalizedModes(IgnoreModes: TStrings = nil): string;
|
||||
function AsString: string; override;
|
||||
property Typ: string read FTyp write SetTyp;
|
||||
property Value: string read FValue write SetValue;
|
||||
end;
|
||||
|
||||
{ TGroupedMatrixMode }
|
||||
@ -160,10 +160,10 @@ type
|
||||
destructor Destroy; override;
|
||||
procedure Clear;
|
||||
function Equals(Obj: TObject): boolean; override;
|
||||
property Items[Index: integer]: TGroupedMatrixMode read GetItems; default;
|
||||
function Count: integer;
|
||||
function Add(aCaption: string; aColor: TColor = clDefault): TGroupedMatrixMode;
|
||||
procedure Delete(Index: integer);
|
||||
property Items[Index: integer]: TGroupedMatrixMode read GetItems; default;
|
||||
end;
|
||||
TGroupedMatrixModesClass = class of TGroupedMatrixModes;
|
||||
|
||||
@ -187,12 +187,8 @@ type
|
||||
procedure Clear;
|
||||
function Equals(Obj: TObject): boolean; override;
|
||||
procedure RebuildRows;
|
||||
property RowCount: integer read GetRowCount;
|
||||
property Rows[Index: integer]: TGroupedMatrixRow read GetRows; default;
|
||||
procedure DeleteRow(Index: integer);
|
||||
function IndexOfRow(Row: TGroupedMatrixRow): integer;
|
||||
property TopLvlCount: integer read GetTopLvlCount;
|
||||
property TopLvlItems[Index: integer]: TGroupedMatrixRow read GetTopLvlItems;
|
||||
function IndexOfTopLvlItem(Row: TGroupedMatrixRow): integer;
|
||||
function IndexOfTopLvlGroup(aCaption: TCaption): integer;
|
||||
function GetTopLvlGroup(aCaption: TCaption): TGroupedMatrixGroup;
|
||||
@ -201,9 +197,13 @@ type
|
||||
aCaption: TCaption; aValue: string = ''): TGroupedMatrixGroup;
|
||||
function AddValue(ParentGroup: TGroupedMatrixGroup;
|
||||
ModesAsText, aType, AValue, aID: string): TGroupedMatrixValue;
|
||||
procedure WriteDebugReport;
|
||||
property RowCount: integer read GetRowCount;
|
||||
property Rows[Index: integer]: TGroupedMatrixRow read GetRows; default;
|
||||
property TopLvlCount: integer read GetTopLvlCount;
|
||||
property TopLvlItems[Index: integer]: TGroupedMatrixRow read GetTopLvlItems;
|
||||
property Modes: TGroupedMatrixModes read FModes;
|
||||
property Control: TGroupedMatrixControl read FControl;
|
||||
procedure WriteDebugReport;
|
||||
end;
|
||||
|
||||
TOnGetCellHightlightColor = procedure(Sender: TObject; aCol,aRow: integer;
|
||||
@ -213,7 +213,7 @@ type
|
||||
|
||||
TGroupedMatrixControl = class(TCustomDrawGrid)
|
||||
private
|
||||
FActiveMode: integer;
|
||||
FActiveModeIndex: integer;
|
||||
FActiveModeColor: TColor;
|
||||
FIndent: integer;
|
||||
FMatrix: TGroupedMatrix;
|
||||
@ -228,7 +228,7 @@ type
|
||||
function GetModeColumns(Index: integer): TGridColumn;
|
||||
function GetModes: TGroupedMatrixModes;
|
||||
procedure InvalidateGroupedCells({%H-}aCol, aRow: Integer);
|
||||
procedure SetActiveMode(AValue: integer);
|
||||
procedure SetActiveModeIndex(AValue: integer);
|
||||
procedure SetActiveModeColor(AValue: TColor);
|
||||
procedure SetIndent(AValue: integer);
|
||||
procedure SetMaxUndo(AValue: integer);
|
||||
@ -260,33 +260,31 @@ type
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
procedure Clear;
|
||||
public
|
||||
property ActiveModeColor: TColor read FActiveModeColor write SetActiveModeColor;
|
||||
procedure DefaultDrawCell(aCol, aRow: Integer; var aRect: TRect;
|
||||
aState: TGridDrawState); override;
|
||||
property Matrix: TGroupedMatrix read FMatrix;
|
||||
property Modes: TGroupedMatrixModes read GetModes;
|
||||
procedure MatrixChanging;
|
||||
procedure MatrixChanged;
|
||||
procedure DeleteMatrixRow(aRow: integer);
|
||||
property ActiveMode: integer read FActiveMode write SetActiveMode;
|
||||
function ModeColFirst: integer;
|
||||
function ModeColLast: integer;
|
||||
property ModeColumns[Index: integer]: TGridColumn read GetModeColumns;
|
||||
property TypeColumn: TGridColumn read FTypeColumn;
|
||||
function TypeCol: integer;
|
||||
property ValueColumn: TGridColumn read FValueColumn;
|
||||
function ValueCol: integer;
|
||||
property Indent: integer read FIndent write SetIndent default DefaultModeMatrixIndent;
|
||||
public
|
||||
// undo/redo
|
||||
function CanUndo: boolean;
|
||||
function CanRedo: boolean;
|
||||
procedure Undo;
|
||||
procedure Redo;
|
||||
property MaxUndo: integer read FMaxUndo write SetMaxUndo default DefaultModeMatrixMaxUndo;
|
||||
procedure StoreUndo(EvenIfNothingChanged: boolean = false);
|
||||
public
|
||||
property ActiveModeColor: TColor read FActiveModeColor write SetActiveModeColor;
|
||||
property Matrix: TGroupedMatrix read FMatrix;
|
||||
property Modes: TGroupedMatrixModes read GetModes;
|
||||
property ActiveModeIndex: integer read FActiveModeIndex write SetActiveModeIndex;
|
||||
property ModeColumns[Index: integer]: TGridColumn read GetModeColumns;
|
||||
property TypeColumn: TGridColumn read FTypeColumn;
|
||||
property ValueColumn: TGridColumn read FValueColumn;
|
||||
property Indent: integer read FIndent write SetIndent default DefaultModeMatrixIndent;
|
||||
property MaxUndo: integer read FMaxUndo write SetMaxUndo default DefaultModeMatrixMaxUndo;
|
||||
property Options default DefaultModeMatrixOptions;
|
||||
property TitleStyle default tsNative;
|
||||
property OnGetCellHightlightColor: TOnGetCellHightlightColor
|
||||
@ -1113,10 +1111,10 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TGroupedMatrixControl.SetActiveMode(AValue: integer);
|
||||
procedure TGroupedMatrixControl.SetActiveModeIndex(AValue: integer);
|
||||
begin
|
||||
if FActiveMode=AValue then Exit;
|
||||
FActiveMode:=AValue;
|
||||
if FActiveModeIndex=AValue then Exit;
|
||||
FActiveModeIndex:=AValue;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
@ -1247,17 +1245,19 @@ procedure TGroupedMatrixControl.GetCheckBoxState(const aCol, aRow: Integer;
|
||||
var aState: TCheckboxState);
|
||||
var
|
||||
MatRow: TGroupedMatrixRow;
|
||||
ValueRow: TGroupedMatrixValue;
|
||||
ModeName: String;
|
||||
begin
|
||||
if (aCol>=1) and (aCol<=Modes.Count)
|
||||
and (aRow>0) then begin
|
||||
if (aCol>=1) and (aCol<=Modes.Count) and (aRow>0) then
|
||||
begin
|
||||
MatRow:=Matrix.Rows[aRow-1];
|
||||
if MatRow is TGroupedMatrixValue then begin
|
||||
//debugln(['TGroupedMatrixControl.GetCheckBoxState ',aCol,' ',aRow,' "',Modes[aCol-1],'" ',TGroupedMatrixValue(MatRow).ModeList.Text]);
|
||||
if IndexInStringList(TGroupedMatrixValue(MatRow).ModeList,cstCaseInsensitive,Modes[aCol-1].Caption)>=0
|
||||
then begin
|
||||
aState:=cbChecked;
|
||||
//debugln(['TGroupedMatrixControl.GetCheckBoxState ',aCol,' ',aRow,' "',Modes[aCol-1],'" ',TGroupedMatrixValue(MatRow).ModeList.Text]);
|
||||
end else
|
||||
if MatRow is TGroupedMatrixValue then
|
||||
begin
|
||||
ValueRow:=TGroupedMatrixValue(MatRow);
|
||||
ModeName:=Modes[aCol-1].Caption;
|
||||
if IndexInStringList(ValueRow.ModeList,cstCaseInsensitive,ModeName)>=0 then
|
||||
aState:=cbChecked
|
||||
else
|
||||
aState:=cbUnchecked;
|
||||
end;
|
||||
end;
|
||||
@ -1272,8 +1272,8 @@ var
|
||||
ModeName: String;
|
||||
i: Integer;
|
||||
begin
|
||||
if (aCol>=1) and (aCol<=Modes.Count)
|
||||
and (aRow>0) then begin
|
||||
if (aCol>=1) and (aCol<=Modes.Count) and (aRow>0) then
|
||||
begin
|
||||
MatRow:=Matrix.Rows[aRow-1];
|
||||
if MatRow is TGroupedMatrixValue then begin
|
||||
ValueRow:=TGroupedMatrixValue(MatRow);
|
||||
@ -1283,11 +1283,10 @@ begin
|
||||
i:=IndexInStringList(ValueRow.ModeList,cstCaseInsensitive,ModeName);
|
||||
if (i<0) = (aState=cbUnchecked) then exit;
|
||||
StoreUndo;
|
||||
if i>=0 then begin
|
||||
ValueRow.ModeList.Delete(i);
|
||||
end else begin
|
||||
if i>=0 then
|
||||
ValueRow.ModeList.Delete(i)
|
||||
else
|
||||
ValueRow.ModeList.Add(ModeName);
|
||||
end;
|
||||
InvalidateRow(aRow);
|
||||
EditingDone;
|
||||
exit;
|
||||
@ -1525,13 +1524,15 @@ procedure TGroupedMatrixControl.DefaultDrawCell(aCol, aRow: Integer; var aRect:
|
||||
aState: TGridDrawState);
|
||||
|
||||
procedure DrawActiveModeRow(ValueRow: TGroupedMatrixValue);
|
||||
var
|
||||
ModeName: String;
|
||||
begin
|
||||
if ActiveMode<0 then exit;
|
||||
if IndexInStringList(ValueRow.ModeList,cstCaseInsensitive,Modes[ActiveMode].Caption)<0
|
||||
then
|
||||
if ActiveModeIndex<0 then exit;
|
||||
ModeName:=Modes[ActiveModeIndex].Caption;
|
||||
if IndexInStringList(ValueRow.ModeList,cstCaseInsensitive,ModeName)<0 then
|
||||
exit;
|
||||
Canvas.GradientFill(Rect(aRect.Left,(aRect.Top+aRect.Bottom) div 2,aRect.Right,aRect.Bottom),
|
||||
Color,ActiveModeColor,gdVertical);
|
||||
Color,ActiveModeColor,gdVertical);
|
||||
end;
|
||||
|
||||
var
|
||||
@ -1544,7 +1545,6 @@ var
|
||||
StateColor: TColor;
|
||||
aHighlightColor: TColor;
|
||||
begin
|
||||
//DebugLn(['TModeMatrixControl.DefaultDrawCell ']);
|
||||
if aRow=0 then begin
|
||||
// titles
|
||||
if aCol=0 then begin
|
||||
@ -1575,7 +1575,7 @@ begin
|
||||
ModeColor:=Modes[aCol-ModeColFirst].Color;
|
||||
if ModeColor=clDefault then ModeColor:=Color;
|
||||
StateColor:=Color;
|
||||
if ActiveMode=aCol-ModeColFirst then
|
||||
if ActiveModeIndex=aCol-ModeColFirst then
|
||||
StateColor:=ActiveModeColor;
|
||||
if (ModeColor<>Color) or (StateColor<>Color) then begin
|
||||
Canvas.GradientFill(aRect,ModeColor,StateColor,gdHorizontal);
|
||||
|
Loading…
Reference in New Issue
Block a user