mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 17:49:14 +02:00
IDE: mode matrix: update matrix grid when renaming build mode
git-svn-id: trunk@41514 -
This commit is contained in:
parent
dbf54a7429
commit
17b483d20a
@ -30,11 +30,10 @@ unit BuildModesManager;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
Classes, SysUtils, Forms, Controls, Dialogs, StdCtrls,
|
||||||
Grids, Buttons, Menus, ButtonPanel, LCLProc,
|
Grids, Buttons, Menus, ButtonPanel, LCLProc, IDEOptionsIntf, IDEDialogs,
|
||||||
ProjectIntf, IDEImagesIntf, IDEOptionsIntf, CompOptsIntf, IDEDialogs,
|
TransferMacros, Project, LazarusIDEStrConsts,
|
||||||
PackageDefs, TransferMacros, PathEditorDlg, Project, LazarusIDEStrConsts,
|
CompilerOptions, Compiler_ModeMatrix, BuildModeDiffDlg;
|
||||||
CompilerOptions, IDEProcs, Compiler_ModeMatrix, BuildModeDiffDlg;
|
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -114,7 +113,7 @@ begin
|
|||||||
// Save changes
|
// Save changes
|
||||||
OnSaveIDEOptionsHook(Nil, Project1.CompilerOptions);
|
OnSaveIDEOptionsHook(Nil, Project1.CompilerOptions);
|
||||||
// Copy to dialog
|
// Copy to dialog
|
||||||
frm.fBuildModes.Assign(Project1.BuildModes, True);
|
frm.BuildModes.Assign(Project1.BuildModes, True);
|
||||||
frm.SetActiveBuildModeByID(Project1.ActiveBuildMode.Identifier,true);
|
frm.SetActiveBuildModeByID(Project1.ActiveBuildMode.Identifier,true);
|
||||||
frm.fShowSession:=aShowSession;
|
frm.fShowSession:=aShowSession;
|
||||||
// Show the form. Let user add / edit / delete.
|
// Show the form. Let user add / edit / delete.
|
||||||
@ -122,7 +121,7 @@ begin
|
|||||||
if Result = mrOk then
|
if Result = mrOk then
|
||||||
begin
|
begin
|
||||||
// Copy back from dialog
|
// Copy back from dialog
|
||||||
Project1.BuildModes.Assign(frm.fBuildModes, True);
|
Project1.BuildModes.Assign(frm.BuildModes, True);
|
||||||
// Switch
|
// Switch
|
||||||
Project1.ActiveBuildModeID:=frm.fActiveBuildMode.Identifier;
|
Project1.ActiveBuildModeID:=frm.fActiveBuildMode.Identifier;
|
||||||
IncreaseBuildMacroChangeStamp;
|
IncreaseBuildMacroChangeStamp;
|
||||||
@ -180,7 +179,7 @@ end;
|
|||||||
|
|
||||||
destructor TBuildModesForm.Destroy;
|
destructor TBuildModesForm.Destroy;
|
||||||
begin
|
begin
|
||||||
fBuildModes.Free;
|
FreeAndNil(fBuildModes);
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -324,7 +323,7 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
Grid: TStringGrid;
|
Grid: TStringGrid;
|
||||||
begin
|
begin
|
||||||
debugln(['TBuildModesForm.BuildModesCheckboxToggled Row=',aRow,' Col=',aCol,' ',ord(aState)]);
|
//debugln(['TBuildModesForm.BuildModesCheckboxToggled Row=',aRow,' Col=',aCol,' ',ord(aState)]);
|
||||||
i:=aRow-1;
|
i:=aRow-1;
|
||||||
if (i<0) or (i>=fBuildModes.Count) then exit;
|
if (i<0) or (i>=fBuildModes.Count) then exit;
|
||||||
CurMode:=fBuildModes[i];
|
CurMode:=fBuildModes[i];
|
||||||
@ -333,12 +332,12 @@ begin
|
|||||||
begin
|
begin
|
||||||
// activate
|
// activate
|
||||||
if CurMode=fActiveBuildMode then begin
|
if CurMode=fActiveBuildMode then begin
|
||||||
debugln(['TBuildModesForm.BuildModesCheckboxToggled, is ActiveBuildMode',i]);
|
//debugln(['TBuildModesForm.BuildModesCheckboxToggled, is ActiveBuildMode',i]);
|
||||||
// Switch back to Checked state. There must always be an active mode
|
// Switch back to Checked state. There must always be an active mode
|
||||||
Grid.Cells[aCol,aRow]:=Grid.Columns[aCol].ValueChecked;
|
Grid.Cells[aCol,aRow]:=Grid.Columns[aCol].ValueChecked;
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
debugln(['TBuildModesForm.BuildModesCheckboxToggled, another Mode',i]);
|
//debugln(['TBuildModesForm.BuildModesCheckboxToggled, another Mode',i]);
|
||||||
fActiveBuildMode:=CurMode;
|
fActiveBuildMode:=CurMode;
|
||||||
FillBuildModesGrid(True);
|
FillBuildModesGrid(True);
|
||||||
end;
|
end;
|
||||||
@ -405,7 +404,7 @@ begin
|
|||||||
NewValue:=CurMode.Identifier;
|
NewValue:=CurMode.Identifier;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
Project1.BuildModes.RenameMatrixMode(CurMode.Identifier,s);
|
BuildModes.RenameMatrixMode(CurMode.Identifier,s);
|
||||||
CurMode.Identifier:=s;
|
CurMode.Identifier:=s;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
Options frame for build mode matrix options.
|
Options frame for build mode matrix options.
|
||||||
|
|
||||||
ToDo:
|
ToDo:
|
||||||
- when rename build mode, update grid checkboxes
|
|
||||||
- check modified
|
- check modified
|
||||||
- build modes diff
|
- build modes diff
|
||||||
- add button to ideoptionsdlg
|
- add button to ideoptionsdlg
|
||||||
@ -42,9 +41,7 @@ unit Compiler_ModeMatrix;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, types, LazFileUtils, LazLogger,
|
Classes, SysUtils, types, LazLogger, Controls, Graphics, ComCtrls, Menus,
|
||||||
LResources, Forms, Controls, Graphics, ComCtrls, Menus,
|
|
||||||
KeywordFuncLists,
|
|
||||||
IDEOptionsIntf, IDEImagesIntf, CompOptsIntf,
|
IDEOptionsIntf, IDEImagesIntf, CompOptsIntf,
|
||||||
EnvironmentOpts,
|
EnvironmentOpts,
|
||||||
PackageSystem, PackageDefs, Project, LazarusIDEStrConsts, TransferMacros,
|
PackageSystem, PackageDefs, Project, LazarusIDEStrConsts, TransferMacros,
|
||||||
@ -111,6 +108,8 @@ type
|
|||||||
procedure CreateNewOption(aTyp, aValue: string);
|
procedure CreateNewOption(aTyp, aValue: string);
|
||||||
procedure CreateNewTarget;
|
procedure CreateNewTarget;
|
||||||
function GetCaptionValue(aCaption, aPattern: string): string;
|
function GetCaptionValue(aCaption, aPattern: string): string;
|
||||||
|
procedure UpdateEnabledModesInGrid(Options: TBuildMatrixOptions;
|
||||||
|
StorageGroup: TGroupedMatrixGroup; var HasChanged: boolean);
|
||||||
protected
|
protected
|
||||||
procedure VisibleChanged; override;
|
procedure VisibleChanged; override;
|
||||||
public
|
public
|
||||||
@ -752,6 +751,41 @@ begin
|
|||||||
Result:=copy(aCaption,p,length(aCaption)-length(aPattern)+2);
|
Result:=copy(aCaption,p,length(aCaption)-length(aPattern)+2);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCompOptModeMatrix.UpdateEnabledModesInGrid(
|
||||||
|
Options: TBuildMatrixOptions; StorageGroup: TGroupedMatrixGroup;
|
||||||
|
var HasChanged: boolean);
|
||||||
|
// update enabled modes in grid
|
||||||
|
var
|
||||||
|
GrpIndex: Integer;
|
||||||
|
Target: TGroupedMatrixGroup;
|
||||||
|
i: Integer;
|
||||||
|
ValueRow: TGroupedMatrixValue;
|
||||||
|
OptionIndex: Integer;
|
||||||
|
Option: TBuildMatrixOption;
|
||||||
|
begin
|
||||||
|
OptionIndex:=0;
|
||||||
|
for GrpIndex:=0 to StorageGroup.Count-1 do begin
|
||||||
|
Target:=TGroupedMatrixGroup(StorageGroup[GrpIndex]);
|
||||||
|
if not (Target is TGroupedMatrixGroup) then
|
||||||
|
exit;
|
||||||
|
//debugln(['TCompOptModeMatrix.UpdateEnabledModesInGrid Target=',Target.AsString]);
|
||||||
|
for i:=0 to Target.Count-1 do begin
|
||||||
|
ValueRow:=TGroupedMatrixValue(Target[i]);
|
||||||
|
if not (ValueRow is TGroupedMatrixValue) then
|
||||||
|
exit;
|
||||||
|
//debugln(['TCompOptModeMatrix.UpdateEnabledModesInGrid ValueRow=',ValueRow.AsString]);
|
||||||
|
if OptionIndex>=Options.Count then exit;
|
||||||
|
Option:=Options[OptionIndex];
|
||||||
|
//debugln(['TCompOptModeMatrix.UpdateEnabledModesInGrid Option.Modes="',dbgstr(Option.Modes),'" ValueRow.GetNormalizedModes="',dbgstr(ValueRow.GetNormalizedModes),'"']);
|
||||||
|
if Option.Modes<>ValueRow.GetNormalizedModes then begin
|
||||||
|
HasChanged:=true;
|
||||||
|
ValueRow.Modes.Text:=Option.Modes;
|
||||||
|
end;
|
||||||
|
inc(OptionIndex);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCompOptModeMatrix.VisibleChanged;
|
procedure TCompOptModeMatrix.VisibleChanged;
|
||||||
begin
|
begin
|
||||||
inherited VisibleChanged;
|
inherited VisibleChanged;
|
||||||
@ -796,6 +830,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
UpdateEnabledModesInGrid(EnvironmentOptions.BuildMatrixOptions,GroupIDE,ValuesHaveChanged);
|
||||||
|
UpdateEnabledModesInGrid(LazProject.BuildModes.SharedMatrixOptions,GroupProject,ValuesHaveChanged);
|
||||||
|
UpdateEnabledModesInGrid(LazProject.BuildModes.SessionMatrixOptions,GroupSession,ValuesHaveChanged);
|
||||||
|
|
||||||
UpdateActiveMode;
|
UpdateActiveMode;
|
||||||
|
|
||||||
//debugln(['TCompOptModeMatrix.UpdateModes UpdateGrid=',UpdateGrid,' GridHasChanged=',GridHasChanged]);
|
//debugln(['TCompOptModeMatrix.UpdateModes UpdateGrid=',UpdateGrid,' GridHasChanged=',GridHasChanged]);
|
||||||
|
@ -27,9 +27,9 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, math, types, contnrs, Controls, LCLType, LCLIntf, Grids,
|
Classes, SysUtils, math, types, contnrs, Controls, LCLType, LCLIntf, Grids,
|
||||||
Graphics, StdCtrls, Menus, LazLogger, LazConfigStorage, Laz2_XMLCfg,
|
Graphics, StdCtrls, Menus, LazLogger,
|
||||||
FileProcs, KeywordFuncLists,
|
FileProcs,
|
||||||
IDEProcs, ModeMatrixOpts;
|
IDEProcs;
|
||||||
|
|
||||||
const
|
const
|
||||||
DefaultModeMatrixMaxUndo = 100;
|
DefaultModeMatrixMaxUndo = 100;
|
||||||
|
Loading…
Reference in New Issue
Block a user