IDE: mode matrix: fixed appending option to storage group

git-svn-id: trunk@41539 -
This commit is contained in:
mattias 2013-06-04 14:22:33 +00:00
parent f0211c4cf1
commit 17c8e70b97
3 changed files with 44 additions and 8 deletions

View File

@ -56,11 +56,11 @@ type
end;
function ShowBuildModeDiffDialog(BuildModes: TProjectBuildModes; aMode: TProjectBuildMode): TModalResult;
procedure AddDiff(MatrixOptions: TBuildMatrixOptions; OldMode, NewMode: string; Diff: TStrings);
procedure AddDiff(MatrixOptions: TBuildMatrixOptions; OldMode, NewMode: string;
Diff: TStrings; var OldOutputDir, NewOutputDir: string);
implementation
function ShowBuildModeDiffDialog(BuildModes: TProjectBuildModes;
aMode: TProjectBuildMode): TModalResult;
var
@ -77,7 +77,7 @@ begin
end;
procedure AddDiff(MatrixOptions: TBuildMatrixOptions; OldMode, NewMode: string;
Diff: TStrings);
Diff: TStrings; var OldOutputDir, NewOutputDir: string);
var
i: Integer;
Option: TBuildMatrixOption;
@ -86,8 +86,10 @@ var
s: String;
begin
if MatrixOptions=nil then exit;
for i:=0 to MatrixOptions.Count-1 do begin
Option:=MatrixOptions[i];
if not (Option.Typ in [bmotCustom,bmotIDEMacro]) then continue;
HasOldMode:=Option.FitsMode(OldMode);
HasNewMode:=Option.FitsMode(NewMode);
if HasOldMode=HasNewMode then continue;
@ -101,9 +103,11 @@ begin
s+=dbgstr(Option.Value);
Diff.Add(s);
end;
MatrixOptions.GetOutputDirectory(BuildMatrixProjectName,OldMode,OldOutputDir);
MatrixOptions.GetOutputDirectory(BuildMatrixProjectName,NewMode,NewOutputDir);
end;
{$R *.lfm}
{ TBuildModeDiffDialog }
@ -160,6 +164,8 @@ var
Diff: TStringList;
DiffTool: TCompilerDiffTool;
j: Integer;
OldOutDir: String;
NewOutDir: String;
begin
DiffTreeView.BeginUpdate;
DiffTreeView.Items.Clear;
@ -173,12 +179,23 @@ begin
Diff:=TStringList.Create;
DiffTool:=TCompilerDiffTool.Create(Diff);
BaseMode.CreateDiff(CurMode,DiffTool);
// add diffs for matrix options
OldOutDir:='';
NewOutDir:='';
AddDiff(EnvironmentOptions.BuildMatrixOptions,
CurMode.Identifier,BaseMode.Identifier,Diff);
CurMode.Identifier,BaseMode.Identifier,Diff,OldOutDir,NewOutDir);
AddDiff(BuildModes.SharedMatrixOptions,
CurMode.Identifier,BaseMode.Identifier,Diff);
CurMode.Identifier,BaseMode.Identifier,Diff,OldOutDir,NewOutDir);
AddDiff(BuildModes.SessionMatrixOptions,
CurMode.Identifier,BaseMode.Identifier,Diff);
CurMode.Identifier,BaseMode.Identifier,Diff,OldOutDir,NewOutDir);
if OldOutDir<>NewOutDir then begin
if OldOutDir<>'' then
Diff.Add('Matrix OutDir "'+CurMode.GetCaption+'":'+OldOutDir);
if NewOutDir<>'' then
Diff.Add('Matrix OutDir "'+BaseMode.GetCaption+'":'+NewOutDir);
end;
for j:=0 to Diff.Count-1 do
DiffTreeView.Items.AddChild(ModeNode,Diff[j]);
DiffTool.Free;
@ -204,5 +221,7 @@ begin
FillDiffTreeView;
end;
{$R *.lfm}
end.

View File

@ -277,7 +277,7 @@ begin
for GrpIndex:=0 to StorageGroup.Count-1 do begin
Target:=TGroupedMatrixGroup(StorageGroup[GrpIndex]);
if not (Target is TGroupedMatrixGroup) then begin
debugln(['AssignBuildMatrixGroupToOptions StorageGroup expected group, but found ',DbgSName(Target)]);
debugln(['AssignBuildMatrixGroupToOptions StorageGroup "',StorageGroup.AsString,'", expected group, but found ',DbgSName(Target)]);
exit;
end;
for i:=0 to Target.Count-1 do begin
@ -679,12 +679,16 @@ begin
try
Grid.StoreUndo;
MatRow:=Grid.Matrix[aRow-1];
debugln(['TCompOptModeMatrix.CreateNewOption ',DbgSName(MatRow),' ',MatRow.AsString]);
if MatRow is TGroupedMatrixGroup then begin
Group:=TGroupedMatrixGroup(MatRow);
if Group.Group=nil then begin
if Group.Count=0 then begin
// storage group without target => add a target
Group:=AddTarget(Group);
end else begin
// add to first target
Group:=Group[0] as TGroupedMatrixGroup;
end;
end;
// add option as first item of Group
@ -696,6 +700,7 @@ begin
Group.Move(Group.Count-1,MatRow.GetGroupIndex+1);
end;
Grid.Matrix.RebuildRows;
//Grid.Matrix.WriteDebugReport;
finally
Grid.MatrixChanged;
end;

View File

@ -195,6 +195,7 @@ type
ModesAsText, aType, AValue, aID: string): TGroupedMatrixValue;
property Modes: TGroupedMatrixModes read FModes;
property Control: TGroupedMatrixControl read FControl;
procedure WriteDebugReport;
end;
TOnGetCellHightlightColor = procedure(Sender: TObject; aCol,aRow: integer;
@ -584,6 +585,17 @@ begin
InternalAdd(ParentGroup,Result);
end;
procedure TGroupedMatrix.WriteDebugReport;
var
i: Integer;
MatRow: TGroupedMatrixRow;
begin
for i:=0 to RowCount-1 do begin
MatRow:=Rows[i];
debugln(Space(MatRow.Level*2),MatRow.AsString);
end;
end;
function TGroupedMatrix.IndexOfTopLvlGroup(aCaption: TCaption): integer;
var
i: Integer;