mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-16 11:19:25 +02:00
IDE: started compiler options diff dialog
git-svn-id: trunk@27760 -
This commit is contained in:
parent
303f533d2e
commit
b1f3a0a6c8
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -3489,6 +3489,8 @@ ide/buildfiledlg.pas svneol=native#text/pascal
|
||||
ide/buildlazdialog.lfm svneol=native#text/plain
|
||||
ide/buildlazdialog.pas svneol=native#text/pascal
|
||||
ide/buildmanager.pas svneol=native#text/plain
|
||||
ide/buildmodediffdlg.lfm svneol=native#text/plain
|
||||
ide/buildmodediffdlg.pas svneol=native#text/plain
|
||||
ide/charactermapdlg.lfm svneol=native#text/plain
|
||||
ide/charactermapdlg.pas svneol=native#text/pascal
|
||||
ide/checkcompileropts.lfm svneol=native#text/plain
|
||||
|
85
ide/buildmodediffdlg.lfm
Normal file
85
ide/buildmodediffdlg.lfm
Normal file
@ -0,0 +1,85 @@
|
||||
object BuildModeDiffDialog: TBuildModeDiffDialog
|
||||
Left = 453
|
||||
Height = 316
|
||||
Top = 261
|
||||
Width = 493
|
||||
Caption = 'BuildModeDiffDialog'
|
||||
ClientHeight = 316
|
||||
ClientWidth = 493
|
||||
OnCreate = FormCreate
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '0.9.29'
|
||||
object ButtonPanel1: TButtonPanel
|
||||
Left = 6
|
||||
Height = 30
|
||||
Top = 280
|
||||
Width = 481
|
||||
OKButton.Name = 'OKButton'
|
||||
OKButton.Caption = '&OK'
|
||||
OKButton.Enabled = False
|
||||
HelpButton.Name = 'HelpButton'
|
||||
HelpButton.Caption = '&Help'
|
||||
HelpButton.Enabled = False
|
||||
CloseButton.Name = 'CloseButton'
|
||||
CloseButton.Caption = '&Close'
|
||||
CancelButton.Name = 'CancelButton'
|
||||
CancelButton.Caption = 'Cancel'
|
||||
CancelButton.Enabled = False
|
||||
TabOrder = 0
|
||||
ShowButtons = [pbClose]
|
||||
end
|
||||
object ModeLabel: TLabel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = ModeComboBox
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 10
|
||||
Height = 17
|
||||
Top = 12
|
||||
Width = 69
|
||||
BorderSpacing.Left = 10
|
||||
Caption = 'ModeLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
object ModeComboBox: TComboBox
|
||||
AnchorSideLeft.Control = ModeLabel
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = Owner
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 89
|
||||
Height = 21
|
||||
Top = 10
|
||||
Width = 394
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Around = 10
|
||||
ItemHeight = 0
|
||||
TabOrder = 1
|
||||
Text = 'ModeComboBox'
|
||||
end
|
||||
object DiffsGroupBox: TGroupBox
|
||||
AnchorSideTop.Control = ModeComboBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 10
|
||||
Height = 233
|
||||
Top = 41
|
||||
Width = 473
|
||||
Align = alBottom
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 4
|
||||
BorderSpacing.Right = 4
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'DiffsGroupBox'
|
||||
ClientHeight = 211
|
||||
ClientWidth = 465
|
||||
TabOrder = 2
|
||||
object DiffTreeView: TTreeView
|
||||
Left = 0
|
||||
Height = 211
|
||||
Top = 0
|
||||
Width = 465
|
||||
Align = alClient
|
||||
DefaultItemHeight = 18
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
||||
end
|
147
ide/buildmodediffdlg.pas
Normal file
147
ide/buildmodediffdlg.pas
Normal file
@ -0,0 +1,147 @@
|
||||
{
|
||||
***************************************************************************
|
||||
* *
|
||||
* This source is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This code is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* General Public License for more details. *
|
||||
* *
|
||||
* A copy of the GNU General Public License is available on the World *
|
||||
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
|
||||
* obtain it by writing to the Free Software Foundation, *
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
Abstract:
|
||||
Modal dialog to show the differences between build modes.
|
||||
|
||||
}
|
||||
unit BuildModeDiffDlg;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ButtonPanel,
|
||||
StdCtrls, ComCtrls,
|
||||
LazarusIDEStrConsts, Project, CompilerOptions;
|
||||
|
||||
type
|
||||
|
||||
{ TBuildModeDiffDialog }
|
||||
|
||||
TBuildModeDiffDialog = class(TForm)
|
||||
ButtonPanel1: TButtonPanel;
|
||||
DiffsGroupBox: TGroupBox;
|
||||
DiffTreeView: TTreeView;
|
||||
ModeComboBox: TComboBox;
|
||||
ModeLabel: TLabel;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
private
|
||||
FBaseMode: TProjectBuildMode;
|
||||
fProject: TProject;
|
||||
procedure FillModeComboBox;
|
||||
procedure FillDiffTreeView;
|
||||
public
|
||||
procedure SetBuildMode(aMode: TProjectBuildMode);
|
||||
property aProject: TProject read fProject;
|
||||
property BaseMode: TProjectBuildMode read FBaseMode;
|
||||
end;
|
||||
|
||||
function ShowBuildModeDiffDialog(aMode: TProjectBuildMode): TModalResult;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
function ShowBuildModeDiffDialog(aMode: TProjectBuildMode): TModalResult;
|
||||
var
|
||||
BuildModeDiffDialog: TBuildModeDiffDialog;
|
||||
begin
|
||||
BuildModeDiffDialog:=TBuildModeDiffDialog.Create(nil);
|
||||
try
|
||||
BuildModeDiffDialog.SetBuildMode(aMode);
|
||||
Result:=BuildModeDiffDialog.ShowModal;
|
||||
finally
|
||||
BuildModeDiffDialog.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TBuildModeDiffDialog }
|
||||
|
||||
procedure TBuildModeDiffDialog.FormCreate(Sender: TObject);
|
||||
begin
|
||||
Caption:='Differences between build modes';
|
||||
|
||||
ModeLabel.Caption:='Mode:';
|
||||
DiffsGroupBox.Caption:='Differences to other build modes';
|
||||
end;
|
||||
|
||||
procedure TBuildModeDiffDialog.FillModeComboBox;
|
||||
var
|
||||
sl: TStringList;
|
||||
i: Integer;
|
||||
begin
|
||||
sl:=TStringList.Create;
|
||||
try
|
||||
if fProject<>nil then
|
||||
for i:=0 to fProject.BuildModes.Count-1 do
|
||||
sl.Add(fProject.BuildModes[i].GetCaption);
|
||||
ModeComboBox.Items.Assign(sl);
|
||||
if BaseMode<>nil then
|
||||
ModeComboBox.ItemIndex:=BaseMode.GetIndex
|
||||
else
|
||||
ModeComboBox.Text:='(none)';
|
||||
finally
|
||||
sl.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBuildModeDiffDialog.FillDiffTreeView;
|
||||
var
|
||||
i: Integer;
|
||||
CurMode: TProjectBuildMode;
|
||||
ModeNode: TTreeNode;
|
||||
begin
|
||||
DiffTreeView.BeginUpdate;
|
||||
DiffTreeView.Items.Clear;
|
||||
if fProject<>nil then
|
||||
begin
|
||||
for i := 0 to fProject.BuildModes.Count - 1 do
|
||||
begin
|
||||
CurMode:=fProject.BuildModes[i];
|
||||
if CurMode=BaseMode then continue;
|
||||
ModeNode:=DiffTreeView.Items.Add(nil,CurMode.GetCaption);
|
||||
DiffTreeView.Items.AddChild(ModeNode,'todo');
|
||||
ModeNode.Expand(true);
|
||||
end;
|
||||
end;
|
||||
DiffTreeView.EndUpdate;
|
||||
end;
|
||||
|
||||
procedure TBuildModeDiffDialog.SetBuildMode(aMode: TProjectBuildMode);
|
||||
begin
|
||||
if aMode<>nil then
|
||||
begin
|
||||
fProject:=aMode.LazProject;
|
||||
FBaseMode:=aMode;
|
||||
end else
|
||||
begin
|
||||
fProject:=nil;
|
||||
FBaseMode:=nil;
|
||||
end;
|
||||
FillModeComboBox;
|
||||
FillDiffTreeView;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -148,6 +148,21 @@ inherited BuildModesEditorFrame: TBuildModesEditorFrame
|
||||
ShowHint = True
|
||||
ParentShowHint = False
|
||||
end
|
||||
object BuildModeDiffSpeedButton: TSpeedButton
|
||||
AnchorSideLeft.Control = BuildModeMoveDownSpeedButton
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = BuildModesGroupBox
|
||||
Left = 102
|
||||
Height = 22
|
||||
Top = 0
|
||||
Width = 23
|
||||
BorderSpacing.Left = 10
|
||||
Color = clBtnFace
|
||||
NumGlyphs = 0
|
||||
OnClick = BuildModeDiffSpeedButtonClick
|
||||
ShowHint = True
|
||||
ParentShowHint = False
|
||||
end
|
||||
end
|
||||
object Splitter1: TSplitter[2]
|
||||
Cursor = crVSplit
|
||||
|
@ -36,13 +36,14 @@ uses
|
||||
ProjectIntf, IDEImagesIntf, IDEOptionsIntf,
|
||||
PackageDefs, compiler_inherited_options, TransferMacros,
|
||||
PathEditorDlg, Project, PackageSystem, LazarusIDEStrConsts, CompilerOptions,
|
||||
IDEProcs;
|
||||
IDEProcs, BuildModeDiffDlg;
|
||||
|
||||
type
|
||||
|
||||
{ TBuildModesEditorFrame }
|
||||
|
||||
TBuildModesEditorFrame = class(TAbstractIDEOptionsEditor)
|
||||
BuildModeDiffSpeedButton: TSpeedButton;
|
||||
BuildMacroValuesGroupBox: TGroupBox;
|
||||
BuildMacroValuesStringGrid: TStringGrid;
|
||||
BuildModeAddSpeedButton: TSpeedButton;
|
||||
@ -53,6 +54,7 @@ type
|
||||
BuildModesPopupMenu: TPopupMenu;
|
||||
BuildModesStringGrid: TStringGrid;
|
||||
Splitter1: TSplitter;
|
||||
procedure BuildModeDiffSpeedButtonClick(Sender: TObject);
|
||||
procedure BuildMacroValuesStringGridEditingDone(Sender: TObject);
|
||||
procedure BuildMacroValuesStringGridSelectEditor(Sender: TObject; aCol,
|
||||
aRow: Integer; var Editor: TWinControl);
|
||||
@ -104,6 +106,7 @@ type
|
||||
property ShowSession: boolean read FShowSession write SetShowSession;
|
||||
property LoadShowSessionFromProjects: boolean read FLoadShowSessionFromProject
|
||||
write FLoadShowSessionFromProject;
|
||||
function GetSelectedBuildMode: TProjectBuildMode;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -179,6 +182,22 @@ begin
|
||||
SaveMacros(true);
|
||||
end;
|
||||
|
||||
procedure TBuildModesEditorFrame.BuildModeDiffSpeedButtonClick(Sender: TObject);
|
||||
begin
|
||||
FSwitchingMode:=true;
|
||||
try
|
||||
// save changes
|
||||
OnSaveIDEOptions(Self,AProject.CompilerOptions);
|
||||
// show diff dialog
|
||||
ShowBuildModeDiffDialog(GetSelectedBuildMode);
|
||||
IncreaseBuildMacroChangeStamp;
|
||||
// load options
|
||||
OnLoadIDEOptions(Self,AProject.CompilerOptions);
|
||||
finally
|
||||
FSwitchingMode:=false;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBuildModesEditorFrame.BuildMacroValuesStringGridSelection(
|
||||
Sender: TObject; aCol, aRow: Integer);
|
||||
begin
|
||||
@ -606,6 +625,7 @@ begin
|
||||
i<BuildModesStringGrid.RowCount-2;
|
||||
BuildModeMoveDownSpeedButton.Hint:=Format(lisMoveOnePositionDown, [Identifier]
|
||||
);
|
||||
BuildModeDiffSpeedButton.Hint:=lisShowDifferencesBetweenModes;
|
||||
end;
|
||||
|
||||
procedure TBuildModesEditorFrame.ActivateMode(aMode: TProjectBuildMode);
|
||||
@ -661,6 +681,7 @@ begin
|
||||
BuildModeDeleteSpeedButton.LoadGlyphFromLazarusResource('laz_delete');
|
||||
BuildModeMoveUpSpeedButton.LoadGlyphFromLazarusResource('arrow_up');
|
||||
BuildModeMoveDownSpeedButton.LoadGlyphFromLazarusResource('arrow_down');
|
||||
BuildModeDiffSpeedButton.LoadGlyphFromLazarusResource('menu_tool_diff');
|
||||
|
||||
BuildMacroValuesGroupBox.Caption:=lisSetMacroValues;
|
||||
Grid:=BuildMacroValuesStringGrid;
|
||||
@ -711,6 +732,17 @@ begin
|
||||
Result := TProjectCompilerOptions;
|
||||
end;
|
||||
|
||||
function TBuildModesEditorFrame.GetSelectedBuildMode: TProjectBuildMode;
|
||||
var
|
||||
i: LongInt;
|
||||
begin
|
||||
Result:=nil;
|
||||
if aProject=nil then exit;
|
||||
i:=BuildModesStringGrid.Row-1;
|
||||
if (i<0) or (i>=AProject.BuildModes.Count) then exit;
|
||||
Result:=AProject.BuildModes[i];
|
||||
end;
|
||||
|
||||
{$IFDEF EnableBuildModes}
|
||||
initialization
|
||||
RegisterIDEOptionsEditor(GroupCompiler, TBuildModesEditorFrame,
|
||||
|
@ -56,7 +56,7 @@
|
||||
<PackageName Value="SynEdit"/>
|
||||
</Item5>
|
||||
</RequiredPackages>
|
||||
<Units Count="72">
|
||||
<Units Count="73">
|
||||
<Unit0>
|
||||
<Filename Value="lazarus.pp"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
@ -548,6 +548,13 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="IDEFPCInfo"/>
|
||||
</Unit71>
|
||||
<Unit72>
|
||||
<Filename Value="buildmodediffdlg.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="BuildModeDiffDialog"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="BuildModeDiffDlg"/>
|
||||
</Unit72>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
@ -563,7 +570,6 @@
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<CStyleOperator Value="False"/>
|
||||
<UseAnsiStrings Value="False"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<Other>
|
||||
|
@ -4910,6 +4910,7 @@ resourcestring
|
||||
lisDeleteMode = 'Delete mode "%s"';
|
||||
lisMoveOnePositionUp = 'Move "%s" one position up';
|
||||
lisMoveOnePositionDown = 'Move "%s" one position down';
|
||||
lisShowDifferencesBetweenModes = 'Show differences between modes ...';
|
||||
|
||||
implementation
|
||||
|
||||
|
10
ide/main.pp
10
ide/main.pp
@ -3282,8 +3282,6 @@ var
|
||||
procedure AddMode(CurMode: TProjectBuildMode);
|
||||
var
|
||||
AMenuItem: TMenuItem;
|
||||
i: Integer;
|
||||
aTitle: String;
|
||||
begin
|
||||
if aMenu.Items.Count > CurIndex then
|
||||
AMenuItem := aMenu.Items[CurIndex]
|
||||
@ -3294,13 +3292,7 @@ var
|
||||
AMenuItem.OnClick := @mnuSetBuildModeClick;
|
||||
aMenu.Items.Add(AMenuItem);
|
||||
end;
|
||||
aTitle:=CurMode.Identifier;
|
||||
for i:=length(aTitle) downto 1 do
|
||||
if aTitle[i] in ['&',#0..#31,#127] then
|
||||
System.Delete(aTitle,i,1);
|
||||
if (aTitle='') then
|
||||
aTitle:='['+IntToStr(CurIndex)+']';
|
||||
AMenuItem.Caption := aTitle;
|
||||
AMenuItem.Caption := CurMode.GetCaption;
|
||||
AMenuItem.Checked:=Project1.ActiveBuildMode=CurMode;
|
||||
AMenuItem.ShowAlwaysCheckable:=true;
|
||||
inc(CurIndex);
|
||||
|
@ -665,6 +665,8 @@ type
|
||||
procedure IncreaseChangeStamp;
|
||||
procedure AddOnChangedHandler(const Handler: TNotifyEvent);
|
||||
procedure RemoveOnChangedHandler(const Handler: TNotifyEvent);
|
||||
function GetCaption: string;
|
||||
function GetIndex: integer;
|
||||
public
|
||||
property InSession: boolean read FInSession write SetInSession;
|
||||
property Identifier: string read FIdentifier write SetIdentifier;// arbitrary string
|
||||
@ -6771,6 +6773,28 @@ begin
|
||||
fOnChanged.Remove(TMethod(Handler));
|
||||
end;
|
||||
|
||||
function TProjectBuildMode.GetCaption: string;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
Result:=Identifier;
|
||||
for i:=length(Result) downto 1 do
|
||||
if Result[i] in ['&',#0..#31,#127] then
|
||||
System.Delete(Result,i,1);
|
||||
if Result<>'' then exit;
|
||||
i:=GetIndex;
|
||||
if i>=0 then
|
||||
Result:='['+IntToStr(i)+']';
|
||||
end;
|
||||
|
||||
function TProjectBuildMode.GetIndex: integer;
|
||||
begin
|
||||
if LazProject<>nil then
|
||||
Result:=LazProject.BuildModes.IndexOf(Self)
|
||||
else
|
||||
Result:=-1;
|
||||
end;
|
||||
|
||||
{ TProjectBuildModes }
|
||||
|
||||
function TProjectBuildModes.GetItems(Index: integer): TProjectBuildMode;
|
||||
|
Loading…
Reference in New Issue
Block a user