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