IDE: started dialog to help with the message recompiling checksum changed

git-svn-id: trunk@28934 -
This commit is contained in:
mattias 2011-01-10 14:02:09 +00:00
parent c2f59b31e3
commit a322156f23
8 changed files with 315 additions and 45 deletions

2
.gitattributes vendored
View File

@ -3813,6 +3813,8 @@ ide/infobuild.pp svneol=native#text/plain
ide/initialsetupdlgs.pas svneol=native#text/pascal
ide/inputfiledialog.pas svneol=native#text/pascal
ide/inputhistory.pas svneol=native#text/pascal
ide/inspectchksumchangeddlg.lfm svneol=native#text/plain
ide/inspectchksumchangeddlg.pas svneol=native#text/pascal
ide/invertassigntool.pas svneol=native#text/pascal
ide/jumphistoryview.lfm svneol=native#text/plain
ide/jumphistoryview.pas svneol=native#text/plain

View File

@ -8,7 +8,7 @@ object FindUnitDialog: TFindUnitDialog
ClientWidth = 584
OnCreate = FormCreate
OnDestroy = FormDestroy
Position = poDesktopCenter
Position = poScreenCenter
LCLVersion = '0.9.29'
object BtnPanel: TPanel
Left = 0

View File

@ -530,7 +530,7 @@ begin
try
InfoTreeView.Items.Add(nil,'Message: '+dbgstr(Line));
InfoTreeView.Items.Add(nil,'File: '+dbgstr(aCode.Filename));
InfoTreeView.Items.Add(nil,'Missingg unit: '+dbgstr(aMissingUnitName));
InfoTreeView.Items.Add(nil,'Missing unit: '+dbgstr(aMissingUnitName));
Directory:=ExtractFilePath(aCode.Filename);
DirNode:=InfoTreeView.Items.Add(nil,'Directory: '+dbgstr(Directory));

View File

@ -0,0 +1,97 @@
object InspectChksumChgDialog: TInspectChksumChgDialog
Left = 275
Height = 471
Top = 250
Width = 494
Caption = 'InspectChksumChgDialog'
ClientHeight = 471
ClientWidth = 494
OnCreate = FormCreate
OnDestroy = FormDestroy
Position = poScreenCenter
LCLVersion = '0.9.31'
object InfoGroupBox: TGroupBox
AnchorSideBottom.Control = Splitter1
Left = 6
Height = 324
Top = 6
Width = 482
Align = alTop
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6
Caption = 'InfoGroupBox'
ClientHeight = 305
ClientWidth = 478
TabOrder = 0
object InfoTreeView: TTreeView
Left = 0
Height = 285
Top = 0
Width = 478
Align = alClient
DefaultItemHeight = 19
TabOrder = 0
end
object ProgressBar1: TProgressBar
Left = 0
Height = 20
Top = 285
Width = 478
Align = alBottom
TabOrder = 1
end
end
object Splitter1: TSplitter
AnchorSideLeft.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Cursor = crVSplit
Left = 0
Height = 5
Top = 336
Width = 494
Align = alNone
Anchors = [akTop, akLeft, akRight]
ResizeAnchor = akBottom
end
object ActionsRadioGroup: TRadioGroup
AnchorSideTop.Control = Splitter1
AnchorSideTop.Side = asrBottom
Left = 6
Height = 72
Top = 347
Width = 482
Align = alBottom
Anchors = [akTop, akLeft, akRight, akBottom]
AutoFill = True
BorderSpacing.Around = 6
Caption = 'ActionsRadioGroup'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
TabOrder = 2
end
object ButtonPanel1: TButtonPanel
Left = 6
Height = 40
Top = 425
Width = 482
OKButton.Name = 'OKButton'
OKButton.Caption = '&OK'
HelpButton.Name = 'HelpButton'
HelpButton.Caption = '&Help'
HelpButton.Enabled = False
CloseButton.Name = 'CloseButton'
CloseButton.Caption = '&Close'
CloseButton.Enabled = False
CancelButton.Name = 'CancelButton'
CancelButton.Caption = 'Cancel'
TabOrder = 3
ShowButtons = [pbOK, pbCancel]
end
end

View File

@ -0,0 +1,201 @@
{
***************************************************************************
* *
* 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. *
* *
***************************************************************************
Author: Mattias Gaertner
Abstract:
Dialog to show information about the message
"recompiling unit1, checksum changed for unit2"
ToDo:
- show the location(s) of the first unit
- show the location(s) of the second unit
- actions:
- open a source file
- open a package
- delete a ppu+o file
- recompile a package clean (remove the .compiled file)
}
unit InspectChksumChangedDlg;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LCLProc, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls, ComCtrls, ButtonPanel,
// codetools
CodeCache,
// IDEIntf
LazIDEIntf, TextTools, IDEMsgIntf, PackageIntf,
LazarusIDEStrConsts;
type
TInspectChksumChgDialog = class;
{ TQuickFixMissingUnit }
{ TICCAction }
TICCAction = class
public
Dlg: TInspectChksumChgDialog;
Caption: string;
constructor Create(aDlg: TInspectChksumChgDialog; aCaption: string);
end;
{ TInspectChksumChgDialog }
TInspectChksumChgDialog = class(TForm)
ButtonPanel1: TButtonPanel;
InfoGroupBox: TGroupBox;
ProgressBar1: TProgressBar;
ActionsRadioGroup: TRadioGroup;
Splitter1: TSplitter;
InfoTreeView: TTreeView;
procedure CancelClick(Sender: TObject);
procedure OkClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
FMsg: string;
FUnit1: string;
FUnit2: string;
public
procedure InitWithMsg(aMsg: TIDEMessageLine);
property Msg: string read FMsg;
property Unit1: string read FUnit1;
property Unit2: string read FUnit2;
end;
{ TQuickFixRecompilingChecksumChanged }
TQuickFixRecompilingChecksumChanged = class(TIDEMsgQuickFixItem)
public
constructor Create;
function IsApplicable(Line: TIDEMessageLine): boolean; override;
procedure Execute(const Msg: TIDEMessageLine; Step: TIMQuickFixStep); override;
end;
procedure InitInspectChecksumChangedQuickFixItems;
implementation
procedure InitInspectChecksumChangedQuickFixItems;
begin
RegisterIDEMsgQuickFix(TQuickFixRecompilingChecksumChanged.Create);
end;
{ TICCAction }
constructor TICCAction.Create(aDlg: TInspectChksumChgDialog; aCaption: string);
begin
Dlg:=aDlg;
Caption:=aCaption;
end;
{$R *.lfm}
{ TInspectChksumChgDialog }
procedure TInspectChksumChgDialog.FormCreate(Sender: TObject);
begin
Caption:='Inspect checksum changed message';
InfoGroupBox.Caption:='Hints:';
ActionsRadioGroup.Caption:='Actions';
ButtonPanel1.OKButton.OnClick:=@OkClick;
ButtonPanel1.CancelButton.OnClick:=@CancelClick;
end;
procedure TInspectChksumChgDialog.OkClick(Sender: TObject);
begin
ModalResult:=mrOK;
end;
procedure TInspectChksumChgDialog.CancelClick(Sender: TObject);
begin
ModalResult:=mrCancel;
end;
procedure TInspectChksumChgDialog.FormDestroy(Sender: TObject);
begin
end;
procedure TInspectChksumChgDialog.InitWithMsg(aMsg: TIDEMessageLine);
begin
FMsg:=aMsg.Msg;
REMatches(Msg,'Recompiling ([a-z_][a-z_0-9]*), checksum changed for ([a-z_][a-z_0-9]*)','i');
FUnit1:=REVar(1);
FUnit2:=REVar(2);
InfoTreeView.BeginUpdate;
InfoTreeView.Items.Clear;
InfoTreeView.Items.Add(nil,'Message: '+dbgstr(Msg));
InfoTreeView.Items.Add(nil,'ToDo: search for unit '+Unit1);
InfoTreeView.Items.Add(nil,'ToDo: search for unit '+Unit2);
InfoTreeView.Items.Add(nil,'ToDo: search for ppu files of '+Unit2);
InfoTreeView.EndUpdate;
end;
{ TQuickFixRecompilingChecksumChanged }
constructor TQuickFixRecompilingChecksumChanged.Create;
begin
Name:='Show dialog for message Recompiling Unit1, checksum changed for Unit1';
Caption:='Explore message "checksum changed"';
Steps:=[imqfoMenuItem];
end;
function TQuickFixRecompilingChecksumChanged.IsApplicable(Line: TIDEMessageLine
): boolean;
begin
Result:=false;
if not REMatches(Line.Msg,'Recompiling ([a-z_][a-z_0-9]*), checksum changed for ([a-z_][a-z_0-9]*)','i')
then exit;
Result:=true;
end;
procedure TQuickFixRecompilingChecksumChanged.Execute(
const Msg: TIDEMessageLine; Step: TIMQuickFixStep);
var
Dlg: TInspectChksumChgDialog;
begin
if Step=imqfoMenuItem then begin
debugln(['TQuickFixRecompilingChecksumChanged.Execute ']);
if not REMatches(Msg.Msg,'Recompiling ([a-z_][a-z_0-9]*), checksum changed for ([a-z_][a-z_0-9]*)','i')
then exit;
debugln(['TQuickFixRecompilingChecksumChanged.Execute Unit1=',REVar(1),', checksum changed for Unit2=',REVar(2)]);
Dlg:=TInspectChksumChgDialog.Create(nil);
try
Dlg.InitWithMsg(Msg);
Dlg.ShowModal;
finally
Dlg.Free;
end;
end;
end;
end.

View File

@ -56,7 +56,7 @@
<PackageName Value="SynEdit"/>
</Item5>
</RequiredPackages>
<Units Count="75">
<Units Count="76">
<Unit0>
<Filename Value="lazarus.pp"/>
<IsPartOfProject Value="True"/>
@ -569,6 +569,13 @@
<ResourceBaseClass Value="Form"/>
<UnitName Value="IDEInfoDlg"/>
</Unit74>
<Unit75>
<Filename Value="inspectchksumchangeddlg.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="InspectChksumChgDialog"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="InspectChksumChangedDlg"/>
</Unit75>
</Units>
</ProjectOptions>
<CompilerOptions>

View File

@ -133,9 +133,10 @@ uses
// rest of the ide
Splash, IDEDefs, LazarusIDEStrConsts, LazConf, MsgView, SearchResultView,
CodeTemplatesDlg, CodeBrowser, FindUnitDlg, IdeOptionsDlg, EditDefineTree,
PublishModule, EnvironmentOpts, TransferMacros, KeyMapping, IDETranslations,
IDEProcs, ExtToolDialog, ExtToolEditDlg, OutputFilter, JumpHistoryView,
CodeTemplatesDlg, CodeBrowser, FindUnitDlg, InspectChksumChangedDlg,
IdeOptionsDlg, EditDefineTree, PublishModule, EnvironmentOpts, TransferMacros,
KeyMapping, IDETranslations, IDEProcs, ExtToolDialog, ExtToolEditDlg,
OutputFilter, JumpHistoryView,
BuildLazDialog, BuildProfileManager, BuildManager, CheckCompOptsForNewUnitDlg,
MiscOptions, InputHistory, UnitDependencies, ClipBoardHistory,
IDEFPCInfo, IDEInfoDlg, ProcessList, InitialSetupDlgs, NewDialog,
@ -2058,6 +2059,7 @@ begin
InitStandardIDEQuickFixItems;
InitCodeBrowserQuickFixItems;
InitFindUnitQuickFixItems;
InitInspectChecksumChangedQuickFixItems;
end;
procedure TMainIDE.SetupStartProject;

View File

@ -109,15 +109,6 @@ type
procedure Execute(const Msg: TIDEMessageLine; Step: TIMQuickFixStep); override;
end;
{ TQuickFixRecompilingChecksumChanged }
TQuickFixRecompilingChecksumChanged = class(TIDEMsgQuickFixItem)
public
constructor Create;
function IsApplicable(Line: TIDEMessageLine): boolean; override;
procedure Execute(const Msg: TIDEMessageLine; Step: TIMQuickFixStep); override;
end;
procedure QuickFixParameterNotUsed(Sender: TObject; Step: TIMQuickFixStep;
Msg: TIDEMessageLine);
procedure QuickFixUnitNotUsed(Sender: TObject; Step: TIMQuickFixStep;
@ -259,7 +250,6 @@ begin
RegisterIDEMsgQuickFix(TQuickFixIdentifierNotFoundAddLocal.Create);
RegisterIDEMsgQuickFix(TQuickFixLocalVariableNotUsed_Remove.Create);
RegisterIDEMsgQuickFix(TQuickFixHint_Hide.Create);
RegisterIDEMsgQuickFix(TQuickFixRecompilingChecksumChanged.Create);
end;
procedure FreeStandardIDEQuickFixItems;
@ -267,35 +257,6 @@ begin
FreeThenNil(IDEMsgQuickFixes);
end;
{ TQuickFixRecompilingChecksumChanged }
constructor TQuickFixRecompilingChecksumChanged.Create;
begin
Name:='Show dialog for message Recompiling Unit1, checksum changed for Unit1';
Caption:='Explore message "checksum changed"';
Steps:=[imqfoMenuItem];
end;
function TQuickFixRecompilingChecksumChanged.IsApplicable(Line: TIDEMessageLine
): boolean;
begin
Result:=false;
if not REMatches(Line.Msg,'Recompiling ([a-z_][a-z_0-9]*), checksum changed for ([a-z_][a-z_0-9]*)','i')
then exit;
Result:=true;
end;
procedure TQuickFixRecompilingChecksumChanged.Execute(
const Msg: TIDEMessageLine; Step: TIMQuickFixStep);
begin
if Step=imqfoMenuItem then begin
debugln(['TQuickFixRecompilingChecksumChanged.Execute ']);
if not REMatches(Msg.Msg,'Recompiling ([a-z_][a-z_0-9]*), checksum changed for ([a-z_][a-z_0-9]*)','i')
then exit;
debugln(['TQuickFixRecompilingChecksumChanged.Execute Unit1=',REVar(1),', checksum changed for Unit2=',REVar(2)]);
end;
end;
{ TQuickFixUnitNotFoundPosition }
constructor TQuickFixUnitNotFoundPosition.Create;