mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-03 20:07:25 +01:00
IDE: build modes diff: clearer captions
git-svn-id: trunk@41576 -
This commit is contained in:
parent
19d10cfdcb
commit
ea5e5bec16
@ -28,9 +28,10 @@ unit BuildModeDiffDlg;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, LazUTF8, LazLogger, Forms, ButtonPanel, StdCtrls, ComCtrls,
|
Classes, sysutils, LazUTF8, LazLogger, AvgLvlTree, Forms, ButtonPanel,
|
||||||
LazarusIDEStrConsts, EnvironmentOpts, Project,
|
StdCtrls, ComCtrls,
|
||||||
ModeMatrixOpts, CompOptsModes;
|
LazarusIDEStrConsts, EnvironmentOpts, Project, ModeMatrixOpts,
|
||||||
|
CompOptsModes;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -56,8 +57,6 @@ type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function ShowBuildModeDiffDialog(BuildModes: TProjectBuildModes; aMode: TProjectBuildMode): TModalResult;
|
function ShowBuildModeDiffDialog(BuildModes: TProjectBuildModes; aMode: TProjectBuildMode): TModalResult;
|
||||||
procedure AddDiff(MatrixOptions: TBuildMatrixOptions; OldMode, NewMode: string;
|
|
||||||
Diff: TStrings; var OldOutputDir, NewOutputDir: string);
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -76,39 +75,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure AddDiff(MatrixOptions: TBuildMatrixOptions; OldMode, NewMode: string;
|
|
||||||
Diff: TStrings; var OldOutputDir, NewOutputDir: string);
|
|
||||||
var
|
|
||||||
i: Integer;
|
|
||||||
Option: TBuildMatrixOption;
|
|
||||||
HasOldMode: Boolean;
|
|
||||||
HasNewMode: Boolean;
|
|
||||||
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;
|
|
||||||
if HasOldMode then
|
|
||||||
s:=lisDoesNotHaveMatrixOption
|
|
||||||
else
|
|
||||||
s:=lisHasMatrixOption;
|
|
||||||
s+=BuildMatrixOptionTypeNames[Option.Typ]+':';
|
|
||||||
if Option.Typ=bmotIDEMacro then
|
|
||||||
s+=dbgstr(Option.MacroName)+':=';
|
|
||||||
s+=dbgstr(Option.Value);
|
|
||||||
Diff.Add(s);
|
|
||||||
end;
|
|
||||||
|
|
||||||
MatrixOptions.GetOutputDirectory(BuildMatrixProjectName,OldMode,OldOutputDir);
|
|
||||||
MatrixOptions.GetOutputDirectory(BuildMatrixProjectName,NewMode,NewOutputDir);
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
{ TBuildModeDiffDialog }
|
{ TBuildModeDiffDialog }
|
||||||
|
|
||||||
procedure TBuildModeDiffDialog.FormCreate(Sender: TObject);
|
procedure TBuildModeDiffDialog.FormCreate(Sender: TObject);
|
||||||
@ -157,6 +123,55 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TBuildModeDiffDialog.FillDiffTreeView;
|
procedure TBuildModeDiffDialog.FillDiffTreeView;
|
||||||
|
|
||||||
|
procedure DiffsForMatrixCustomOptions(MatrixOptions: TBuildMatrixOptions;
|
||||||
|
OldMode, NewMode: string; Diff: TStringList);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
Option: TBuildMatrixOption;
|
||||||
|
HasOldMode: Boolean;
|
||||||
|
HasNewMode: Boolean;
|
||||||
|
s: String;
|
||||||
|
begin
|
||||||
|
for i:=0 to MatrixOptions.Count-1 do begin
|
||||||
|
Option:=MatrixOptions[i];
|
||||||
|
if Option.Typ<>bmotCustom then continue;
|
||||||
|
HasOldMode:=Option.FitsMode(OldMode);
|
||||||
|
HasNewMode:=Option.FitsMode(NewMode);
|
||||||
|
if HasOldMode=HasNewMode then continue;
|
||||||
|
if HasNewMode then
|
||||||
|
s:=lisMMAddsCustomOptions
|
||||||
|
else
|
||||||
|
s:=lisMMDoesNotAddCustomOptions;
|
||||||
|
s+=' '+dbgstr(Option.Value);
|
||||||
|
//debugln(['AddDiff OldMode="',OldMode,'" NewMode="',NewMode,'" Option="',Option.AsString,'" Diff="',s,'"']);
|
||||||
|
Diff.Add(s);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure DiffsForMatrixOutputDirectory(MatrixOptions: TBuildMatrixOptions;
|
||||||
|
OldMode, NewMode: string; var OldOutputDir, NewOutputDir: string);
|
||||||
|
begin
|
||||||
|
MatrixOptions.GetOutputDirectory(BuildMatrixProjectName,OldMode,OldOutputDir);
|
||||||
|
MatrixOptions.GetOutputDirectory(BuildMatrixProjectName,NewMode,NewOutputDir);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure GetIDEMacros(MatrixOptions: TBuildMatrixOptions;
|
||||||
|
OldMode, NewMode: string; OldMacroValues, NewMacroValues: TStringToStringTree);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
Option: TBuildMatrixOption;
|
||||||
|
begin
|
||||||
|
for i:=0 to MatrixOptions.Count-1 do begin
|
||||||
|
Option:=MatrixOptions[i];
|
||||||
|
if Option.Typ<>bmotIDEMacro then continue;
|
||||||
|
if Option.FitsMode(OldMode) then
|
||||||
|
OldMacroValues.Values[Option.MacroName]:=Option.Value;
|
||||||
|
if Option.FitsMode(NewMode) then
|
||||||
|
NewMacroValues.Values[Option.MacroName]:=Option.Value;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
CurMode: TProjectBuildMode;
|
CurMode: TProjectBuildMode;
|
||||||
@ -166,6 +181,13 @@ var
|
|||||||
j: Integer;
|
j: Integer;
|
||||||
OldOutDir: String;
|
OldOutDir: String;
|
||||||
NewOutDir: String;
|
NewOutDir: String;
|
||||||
|
OldMode: String;
|
||||||
|
NewMode: String;
|
||||||
|
OldMacroValues: TStringToStringTree;
|
||||||
|
NewMacroValues: TStringToStringTree;
|
||||||
|
OldValue: String;
|
||||||
|
S2SItem: PStringToStringItem;
|
||||||
|
s: String;
|
||||||
begin
|
begin
|
||||||
DiffTreeView.BeginUpdate;
|
DiffTreeView.BeginUpdate;
|
||||||
DiffTreeView.Items.Clear;
|
DiffTreeView.Items.Clear;
|
||||||
@ -175,24 +197,68 @@ begin
|
|||||||
begin
|
begin
|
||||||
CurMode:=BuildModes[i];
|
CurMode:=BuildModes[i];
|
||||||
if CurMode=BaseMode then continue;
|
if CurMode=BaseMode then continue;
|
||||||
ModeNode:=DiffTreeView.Items.Add(nil,CurMode.GetCaption);
|
|
||||||
|
// add differences from each CurMode to BaseMode
|
||||||
|
ModeNode:=DiffTreeView.Items.Add(nil, Format(lisMMFromTo, [CurMode.
|
||||||
|
GetCaption, BaseMode.GetCaption]));
|
||||||
Diff:=TStringList.Create;
|
Diff:=TStringList.Create;
|
||||||
DiffTool:=TCompilerDiffTool.Create(Diff);
|
DiffTool:=TCompilerDiffTool.Create(Diff);
|
||||||
BaseMode.CreateDiff(CurMode,DiffTool);
|
BaseMode.CreateDiff(CurMode,DiffTool);
|
||||||
|
|
||||||
// add diffs for matrix options
|
NewMode:=BaseMode.Identifier;
|
||||||
|
OldMode:=CurMode.Identifier;
|
||||||
|
|
||||||
|
// add diffs for matrix custom options
|
||||||
|
DiffsForMatrixCustomOptions(EnvironmentOptions.BuildMatrixOptions,
|
||||||
|
OldMode,NewMode,Diff);
|
||||||
|
DiffsForMatrixCustomOptions(BuildModes.SharedMatrixOptions,
|
||||||
|
OldMode,NewMode,Diff);
|
||||||
|
DiffsForMatrixCustomOptions(BuildModes.SessionMatrixOptions,
|
||||||
|
OldMode,NewMode,Diff);
|
||||||
|
|
||||||
|
// add diffs for matrix IDE macros
|
||||||
|
OldMacroValues:=TStringToStringTree.Create(false);
|
||||||
|
NewMacroValues:=TStringToStringTree.Create(false);
|
||||||
|
GetIDEMacros(EnvironmentOptions.BuildMatrixOptions,OldMode,NewMode,
|
||||||
|
OldMacroValues,NewMacroValues);
|
||||||
|
GetIDEMacros(BuildModes.SharedMatrixOptions,OldMode,NewMode,
|
||||||
|
OldMacroValues,NewMacroValues);
|
||||||
|
GetIDEMacros(BuildModes.SessionMatrixOptions,OldMode,NewMode,
|
||||||
|
OldMacroValues,NewMacroValues);
|
||||||
|
for S2SItem in NewMacroValues do begin
|
||||||
|
OldValue:=OldMacroValues.Values[S2SItem^.Name];
|
||||||
|
if OldValue=S2SItem^.Value then continue;
|
||||||
|
s:=Format(lisMMIDEMacro2, [S2SItem^.Name, S2SItem^.Value]);
|
||||||
|
if OldValue<>'' then
|
||||||
|
s+=' '+Format(lisMMWas, [OldValue]);
|
||||||
|
Diff.Add(s);
|
||||||
|
end;
|
||||||
|
for S2SItem in OldMacroValues do begin
|
||||||
|
if NewMacroValues.Contains(S2SItem^.Name) then continue;
|
||||||
|
s:=Format(lisMMDoesNotHaveIDEMacro, [S2SItem^.Name, S2SItem^.Value]);
|
||||||
|
Diff.Add(s);
|
||||||
|
end;
|
||||||
|
OldMacroValues.Free;
|
||||||
|
NewMacroValues.Free;
|
||||||
|
|
||||||
|
// add diffs for matrix output directory overrides
|
||||||
OldOutDir:='';
|
OldOutDir:='';
|
||||||
NewOutDir:='';
|
NewOutDir:='';
|
||||||
AddDiff(EnvironmentOptions.BuildMatrixOptions,
|
DiffsForMatrixOutputDirectory(EnvironmentOptions.BuildMatrixOptions,
|
||||||
CurMode.Identifier,BaseMode.Identifier,Diff,OldOutDir,NewOutDir);
|
OldMode,NewMode,OldOutDir,NewOutDir);
|
||||||
AddDiff(BuildModes.SharedMatrixOptions,
|
DiffsForMatrixOutputDirectory(BuildModes.SharedMatrixOptions,
|
||||||
CurMode.Identifier,BaseMode.Identifier,Diff,OldOutDir,NewOutDir);
|
OldMode,NewMode,OldOutDir,NewOutDir);
|
||||||
AddDiff(BuildModes.SessionMatrixOptions,
|
DiffsForMatrixOutputDirectory(BuildModes.SessionMatrixOptions,
|
||||||
CurMode.Identifier,BaseMode.Identifier,Diff,OldOutDir,NewOutDir);
|
OldMode,NewMode,OldOutDir,NewOutDir);
|
||||||
if OldOutDir<>NewOutDir then begin
|
if OldOutDir<>NewOutDir then begin
|
||||||
Diff.Add('Matrix override OutDir (-FU): '+NewOutDir);
|
if NewOutDir='' then
|
||||||
|
s:=lisMMDoesNotOverrideOutDirFU
|
||||||
|
else
|
||||||
|
s:=Format(lisMMOverrideOutDirFU, [NewOutDir]);
|
||||||
|
Diff.Add(s);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// create trre nodes
|
||||||
for j:=0 to Diff.Count-1 do
|
for j:=0 to Diff.Count-1 do
|
||||||
DiffTreeView.Items.AddChild(ModeNode,Diff[j]);
|
DiffTreeView.Items.AddChild(ModeNode,Diff[j]);
|
||||||
DiffTool.Free;
|
DiffTool.Free;
|
||||||
|
|||||||
@ -24,6 +24,7 @@
|
|||||||
Options frame for build mode matrix options.
|
Options frame for build mode matrix options.
|
||||||
|
|
||||||
ToDo:
|
ToDo:
|
||||||
|
- bug: change type in last row does not work
|
||||||
- undo: combine changes while editing a cell
|
- undo: combine changes while editing a cell
|
||||||
}
|
}
|
||||||
unit Compiler_ModeMatrix;
|
unit Compiler_ModeMatrix;
|
||||||
|
|||||||
@ -67,6 +67,8 @@ resourcestring
|
|||||||
lisNew = 'New';
|
lisNew = 'New';
|
||||||
lisClose = 'Close';
|
lisClose = 'Close';
|
||||||
lisBtnClose = '&Close';
|
lisBtnClose = '&Close';
|
||||||
|
lisMMAddsCustomOptions = 'Adds custom options:';
|
||||||
|
lisMMDoesNotAddCustomOptions = 'Does not add custom options:';
|
||||||
lisOk = 'OK';
|
lisOk = 'OK';
|
||||||
lisMenuOk = '&OK';
|
lisMenuOk = '&OK';
|
||||||
lisCancel = 'Cancel';
|
lisCancel = 'Cancel';
|
||||||
@ -5388,8 +5390,12 @@ resourcestring
|
|||||||
|
|
||||||
//Build mode differences dialog
|
//Build mode differences dialog
|
||||||
lisBuildModeDiffDifferencesBetweenBuildModes = 'Differences between build modes';
|
lisBuildModeDiffDifferencesBetweenBuildModes = 'Differences between build modes';
|
||||||
lisDoesNotHaveMatrixOption = 'Does not have matrix option ';
|
lisMMWas = '(was "%s")';
|
||||||
lisHasMatrixOption = 'Has matrix option ';
|
lisMMIDEMacro2 = 'IDE Macro %s:=%s';
|
||||||
|
lisMMFromTo = 'From %s to %s';
|
||||||
|
lisMMDoesNotHaveIDEMacro = 'Does not have IDE Macro %s:=%s';
|
||||||
|
lisMMDoesNotOverrideOutDirFU = 'Does not override OutDir (-FU)';
|
||||||
|
lisMMOverrideOutDirFU = 'Override OutDir (-FU): %s';
|
||||||
lisBuildModeDiffMode = 'Mode:';
|
lisBuildModeDiffMode = 'Mode:';
|
||||||
lisBuildModeDiffDifferencesToOtherBuildModes = 'Differences to other build modes';
|
lisBuildModeDiffDifferencesToOtherBuildModes = 'Differences to other build modes';
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user