mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-29 12:30:36 +02:00
Refactoring and finetuning for missing properties dlg.
git-svn-id: trunk@23987 -
This commit is contained in:
parent
e8e8dd5595
commit
dd1dc0c198
@ -636,7 +636,9 @@ begin
|
|||||||
if fLfmCode<>nil then begin
|
if fLfmCode<>nil then begin
|
||||||
LfmFixer:=TLfmFixer.Create(fUnitCode,fLfmCode,@IDEMessagesWindow.AddMsg);
|
LfmFixer:=TLfmFixer.Create(fUnitCode,fLfmCode,@IDEMessagesWindow.AddMsg);
|
||||||
try
|
try
|
||||||
// if RepairLFMBuffer(...,true,true)<>mrOk
|
LfmFixer.RootMustBeClassInIntf:=true;
|
||||||
|
LfmFixer.ObjectsMustExists:=true;
|
||||||
|
// was: if RepairLFMBuffer(...,true,true)<>mrOk
|
||||||
if LfmFixer.Repair<>mrOk then begin
|
if LfmFixer.Repair<>mrOk then begin
|
||||||
LazarusIDE.DoJumpToCompilerMessage(-1,true);
|
LazarusIDE.DoJumpToCompilerMessage(-1,true);
|
||||||
exit(mrAbort);
|
exit(mrAbort);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
{ $Id$ }
|
{ $Id$ }
|
||||||
{
|
{
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
checklfmdlg.pas
|
MissingPropertiesDlg.pas
|
||||||
---------------
|
------------------------
|
||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
@ -27,6 +27,12 @@
|
|||||||
}
|
}
|
||||||
unit MissingPropertiesDlg;
|
unit MissingPropertiesDlg;
|
||||||
|
|
||||||
|
// Use RegisterPropertyToSkip
|
||||||
|
// RegisterPropertyToSkip(TControl, 'Ctl3D', 'VCL compatibility property', '');
|
||||||
|
// RegisterPropertyToSkip(TControl, 'ParentCtl3D', 'VCL compatibility property', '');
|
||||||
|
// mail thread from 08.12.2008 "DefaultButtonControlUseOnChange,
|
||||||
|
// TButtonControl.UseOnChange (Mattias, you've added them long time ago)"
|
||||||
|
|
||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
@ -48,18 +54,18 @@ type
|
|||||||
|
|
||||||
{ TLfmChecker }
|
{ TLfmChecker }
|
||||||
|
|
||||||
TLfmChecker = class
|
TLFMChecker = class
|
||||||
private
|
private
|
||||||
fPascalBuffer: TCodeBuffer;
|
fPascalBuffer: TCodeBuffer;
|
||||||
fLfmBuffer: TCodeBuffer;
|
fLFMBuffer: TCodeBuffer;
|
||||||
fOnOutput: TOnAddFilteredLine;
|
fOnOutput: TOnAddFilteredLine;
|
||||||
fRootMustBeClassInIntf: boolean;
|
fRootMustBeClassInIntf: boolean;
|
||||||
fObjectsMustExists: boolean;
|
fObjectsMustExists: boolean;
|
||||||
fLfmTree: TLFMTree;
|
fLFMTree: TLFMTree;
|
||||||
// References to controls in UI:
|
// References to controls in UI:
|
||||||
fLfmSynEdit: TSynEdit;
|
fLFMSynEdit: TSynEdit;
|
||||||
fErrorsListBox: TListBox;
|
fErrorsListBox: TListBox;
|
||||||
procedure WriteUnitError(Code: TCodeBuffer; x, Y: integer;
|
procedure WriteUnitError(Code: TCodeBuffer; X, Y: integer;
|
||||||
const ErrorMessage: string);
|
const ErrorMessage: string);
|
||||||
procedure WriteCodeToolsError;
|
procedure WriteCodeToolsError;
|
||||||
procedure WriteLFMErrors;
|
procedure WriteLFMErrors;
|
||||||
@ -78,7 +84,7 @@ type
|
|||||||
protected
|
protected
|
||||||
function ShowRepairLFMWizard: TModalResult; virtual;
|
function ShowRepairLFMWizard: TModalResult; virtual;
|
||||||
public
|
public
|
||||||
constructor Create(APascalBuffer, ALfmBuffer: TCodeBuffer;
|
constructor Create(APascalBuffer, ALFMBuffer: TCodeBuffer;
|
||||||
const AOnOutput: TOnAddFilteredLine);
|
const AOnOutput: TOnAddFilteredLine);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
function Repair: TModalResult;
|
function Repair: TModalResult;
|
||||||
@ -86,7 +92,7 @@ type
|
|||||||
function AutomaticFixIsPossible: boolean;
|
function AutomaticFixIsPossible: boolean;
|
||||||
public
|
public
|
||||||
property PascalBuffer: TCodeBuffer read fPascalBuffer;
|
property PascalBuffer: TCodeBuffer read fPascalBuffer;
|
||||||
property LfmBuffer: TCodeBuffer read fLfmBuffer;
|
property LFMBuffer: TCodeBuffer read fLFMBuffer;
|
||||||
property OnOutput: TOnAddFilteredLine read fOnOutput;
|
property OnOutput: TOnAddFilteredLine read fOnOutput;
|
||||||
property RootMustBeClassInIntf: boolean read fRootMustBeClassInIntf
|
property RootMustBeClassInIntf: boolean read fRootMustBeClassInIntf
|
||||||
write fRootMustBeClassInIntf;
|
write fRootMustBeClassInIntf;
|
||||||
@ -96,14 +102,14 @@ type
|
|||||||
|
|
||||||
{ TLfmFixer }
|
{ TLfmFixer }
|
||||||
|
|
||||||
TLfmFixer = class(TLfmChecker)
|
TLFMFixer = class(TLFMChecker)
|
||||||
private
|
private
|
||||||
// References to controls in UI:
|
// References to controls in UI:
|
||||||
fPropReplaceGrid: TStringGrid;
|
fPropReplaceGrid: TStringGrid;
|
||||||
protected
|
protected
|
||||||
function ShowRepairLFMWizard: TModalResult; override;
|
function ShowRepairLFMWizard: TModalResult; override;
|
||||||
public
|
public
|
||||||
constructor Create(APascalBuffer, ALfmBuffer: TCodeBuffer;
|
constructor Create(APascalBuffer, ALFMBuffer: TCodeBuffer;
|
||||||
const AOnOutput: TOnAddFilteredLine);
|
const AOnOutput: TOnAddFilteredLine);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
function Repair: TModalResult;
|
function Repair: TModalResult;
|
||||||
@ -133,11 +139,11 @@ type
|
|||||||
Line: integer; var Special: boolean; AMarkup: TSynSelectedColor);
|
Line: integer; var Special: boolean; AMarkup: TSynSelectedColor);
|
||||||
procedure CheckLFMDialogCREATE(Sender: TObject);
|
procedure CheckLFMDialogCREATE(Sender: TObject);
|
||||||
private
|
private
|
||||||
// fLfmChecker: TLfmChecker;
|
// fLfmChecker: TLFMChecker;
|
||||||
fLfmFixer: TLfmFixer;
|
fLfmFixer: TLFMFixer;
|
||||||
procedure SetupComponents;
|
procedure SetupComponents;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent; ALfmFixer: TLfmFixer);
|
constructor Create(AOwner: TComponent; ALfmFixer: TLFMFixer);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -153,31 +159,31 @@ type
|
|||||||
NewText: string;
|
NewText: string;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TLfmChecker }
|
{ TLFMChecker }
|
||||||
|
|
||||||
constructor TLfmChecker.Create(APascalBuffer, ALfmBuffer: TCodeBuffer;
|
constructor TLFMChecker.Create(APascalBuffer, ALFMBuffer: TCodeBuffer;
|
||||||
const AOnOutput: TOnAddFilteredLine);
|
const AOnOutput: TOnAddFilteredLine);
|
||||||
begin
|
begin
|
||||||
fPascalBuffer:=APascalBuffer;
|
fPascalBuffer:=APascalBuffer;
|
||||||
fLfmBuffer:=ALfmBuffer;
|
fLFMBuffer:=ALFMBuffer;
|
||||||
fOnOutput:=AOnOutput;
|
fOnOutput:=AOnOutput;
|
||||||
fRootMustBeClassInIntf:=true;
|
fRootMustBeClassInIntf:=false;
|
||||||
fObjectsMustExists:=true;
|
fObjectsMustExists:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TLfmChecker.Destroy;
|
destructor TLFMChecker.Destroy;
|
||||||
begin
|
begin
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLfmChecker.ShowRepairLFMWizard: TModalResult;
|
function TLFMChecker.ShowRepairLFMWizard: TModalResult;
|
||||||
//var
|
//var
|
||||||
// FixLFMDialog: TFixLFMDialog;
|
// FixLFMDialog: TFixLFMDialog;
|
||||||
begin
|
begin
|
||||||
Result:=mrCancel;
|
Result:=mrCancel;
|
||||||
{ FixLFMDialog:=TFixLFMDialog.Create(nil, self);
|
{ FixLFMDialog:=TFixLFMDialog.Create(nil, self);
|
||||||
try
|
try
|
||||||
fLfmSynEdit:=FixLFMDialog.LFMSynEdit;
|
fLFMSynEdit:=FixLFMDialog.LFMSynEdit;
|
||||||
fErrorsListBox:=FixLFMDialog.ErrorsListBox;
|
fErrorsListBox:=FixLFMDialog.ErrorsListBox;
|
||||||
fPropReplaceGrid:=FixLFMDialog.PropertyReplaceGrid;
|
fPropReplaceGrid:=FixLFMDialog.PropertyReplaceGrid;
|
||||||
LoadLFM;
|
LoadLFM;
|
||||||
@ -187,33 +193,29 @@ begin
|
|||||||
end; }
|
end; }
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLfmChecker.LoadLFM;
|
procedure TLFMChecker.LoadLFM;
|
||||||
begin
|
begin
|
||||||
fLfmSynEdit.Lines.Text:=fLfmBuffer.Source;
|
fLFMSynEdit.Lines.Text:=fLFMBuffer.Source;
|
||||||
FillErrorsListBox;
|
FillErrorsListBox;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLfmChecker.Repair: TModalResult;
|
function TLFMChecker.Repair: TModalResult;
|
||||||
begin
|
begin
|
||||||
Result:=mrCancel;
|
Result:=mrCancel;
|
||||||
if not CheckUnit then begin
|
if not CheckUnit then exit;
|
||||||
exit;
|
if CodeToolBoss.CheckLFM(fPascalBuffer,fLFMBuffer,fLFMTree,
|
||||||
end;
|
|
||||||
if CodeToolBoss.CheckLFM(fPascalBuffer,fLfmBuffer,fLfmTree,
|
|
||||||
fRootMustBeClassInIntf,fObjectsMustExists)
|
fRootMustBeClassInIntf,fObjectsMustExists)
|
||||||
then begin
|
then begin
|
||||||
Result:=mrOk;
|
Result:=mrOk;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
Result:=FixMissingComponentClasses;
|
Result:=FixMissingComponentClasses;
|
||||||
if Result in [mrAbort,mrOk] then begin
|
if Result in [mrAbort,mrOk] then exit;
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
WriteLFMErrors;
|
WriteLFMErrors;
|
||||||
Result:=ShowRepairLFMWizard;
|
Result:=ShowRepairLFMWizard;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLfmChecker.WriteUnitError(Code: TCodeBuffer; x, Y: integer;
|
procedure TLFMChecker.WriteUnitError(Code: TCodeBuffer; X, Y: integer;
|
||||||
const ErrorMessage: string);
|
const ErrorMessage: string);
|
||||||
var
|
var
|
||||||
Dir: String;
|
Dir: String;
|
||||||
@ -232,13 +234,13 @@ begin
|
|||||||
fOnOutput(Msg,Dir,-1,nil);
|
fOnOutput(Msg,Dir,-1,nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLfmChecker.WriteCodeToolsError;
|
procedure TLFMChecker.WriteCodeToolsError;
|
||||||
begin
|
begin
|
||||||
WriteUnitError(CodeToolBoss.ErrorCode,CodeToolBoss.ErrorColumn,
|
WriteUnitError(CodeToolBoss.ErrorCode,CodeToolBoss.ErrorColumn,
|
||||||
CodeToolBoss.ErrorLine,CodeToolBoss.ErrorMessage);
|
CodeToolBoss.ErrorLine,CodeToolBoss.ErrorMessage);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLfmChecker.WriteLFMErrors;
|
procedure TLFMChecker.WriteLFMErrors;
|
||||||
var
|
var
|
||||||
CurError: TLFMError;
|
CurError: TLFMError;
|
||||||
Dir: String;
|
Dir: String;
|
||||||
@ -246,9 +248,9 @@ var
|
|||||||
Filename: String;
|
Filename: String;
|
||||||
begin
|
begin
|
||||||
if not Assigned(fOnOutput) then exit;
|
if not Assigned(fOnOutput) then exit;
|
||||||
CurError:=fLfmTree.FirstError;
|
CurError:=fLFMTree.FirstError;
|
||||||
Dir:=ExtractFilePath(fLfmBuffer.Filename);
|
Dir:=ExtractFilePath(fLFMBuffer.Filename);
|
||||||
Filename:=ExtractFilename(fLfmBuffer.Filename);
|
Filename:=ExtractFilename(fLFMBuffer.Filename);
|
||||||
while CurError<>nil do begin
|
while CurError<>nil do begin
|
||||||
Msg:=Filename
|
Msg:=Filename
|
||||||
+'('+IntToStr(CurError.Caret.Y)+','+IntToStr(CurError.Caret.X)+')'
|
+'('+IntToStr(CurError.Caret.Y)+','+IntToStr(CurError.Caret.X)+')'
|
||||||
@ -259,7 +261,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLfmChecker.FixMissingComponentClasses: TModalResult;
|
function TLFMChecker.FixMissingComponentClasses: TModalResult;
|
||||||
// returns true, if after adding units to uses section all errors are fixed
|
// returns true, if after adding units to uses section all errors are fixed
|
||||||
var
|
var
|
||||||
CurError: TLFMError;
|
CurError: TLFMError;
|
||||||
@ -272,7 +274,7 @@ begin
|
|||||||
MissingObjectTypes:=TStringList.Create;
|
MissingObjectTypes:=TStringList.Create;
|
||||||
try
|
try
|
||||||
// collect all missing object types
|
// collect all missing object types
|
||||||
CurError:=fLfmTree.FirstError;
|
CurError:=fLFMTree.FirstError;
|
||||||
while CurError<>nil do begin
|
while CurError<>nil do begin
|
||||||
if CurError.IsMissingObjectType then begin
|
if CurError.IsMissingObjectType then begin
|
||||||
TypeName:=(CurError.Node as TLFMObjectNode).TypeName;
|
TypeName:=(CurError.Node as TLFMObjectNode).TypeName;
|
||||||
@ -281,7 +283,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
CurError:=CurError.NextError;
|
CurError:=CurError.NextError;
|
||||||
end;
|
end;
|
||||||
// FixMissingComponentClasses Missing object types in unit.
|
// Missing object types in unit.
|
||||||
|
|
||||||
// keep all object types with a registered component class
|
// keep all object types with a registered component class
|
||||||
for i:=MissingObjectTypes.Count-1 downto 0 do begin
|
for i:=MissingObjectTypes.Count-1 downto 0 do begin
|
||||||
@ -290,17 +292,15 @@ begin
|
|||||||
MissingObjectTypes.Delete(i);
|
MissingObjectTypes.Delete(i);
|
||||||
end;
|
end;
|
||||||
if MissingObjectTypes.Count=0 then exit;
|
if MissingObjectTypes.Count=0 then exit;
|
||||||
//FixMissingComponentClasses Missing object types, but luckily found in IDE.
|
// Missing object types, but luckily found in IDE.
|
||||||
|
|
||||||
// there are missing object types with registered component classes
|
// there are missing object types with registered component classes
|
||||||
Result:=PackageEditingInterface.AddUnitDependenciesForComponentClasses(
|
Result:=PackageEditingInterface.AddUnitDependenciesForComponentClasses(
|
||||||
fPascalBuffer.Filename,MissingObjectTypes);
|
fPascalBuffer.Filename,MissingObjectTypes);
|
||||||
if Result<>mrOk then begin
|
if Result<>mrOk then exit;
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
|
|
||||||
// check LFM again
|
// check LFM again
|
||||||
if CodeToolBoss.CheckLFM(fPascalBuffer,fLfmBuffer,fLfmTree,
|
if CodeToolBoss.CheckLFM(fPascalBuffer,fLFMBuffer,fLFMTree,
|
||||||
fRootMustBeClassInIntf,fObjectsMustExists)
|
fRootMustBeClassInIntf,fObjectsMustExists)
|
||||||
then begin
|
then begin
|
||||||
Result:=mrOk;
|
Result:=mrOk;
|
||||||
@ -312,7 +312,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLfmChecker.CheckUnit: boolean;
|
function TLFMChecker.CheckUnit: boolean;
|
||||||
var
|
var
|
||||||
NewCode: TCodeBuffer;
|
NewCode: TCodeBuffer;
|
||||||
NewX, NewY, NewTopLine: integer;
|
NewX, NewY, NewTopLine: integer;
|
||||||
@ -347,7 +347,7 @@ begin
|
|||||||
Result:=true;
|
Result:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLfmChecker.RemoveAll: TModalResult;
|
function TLFMChecker.RemoveAll: TModalResult;
|
||||||
var
|
var
|
||||||
CurError: TLFMError;
|
CurError: TLFMError;
|
||||||
DeleteNode: TLFMTreeNode;
|
DeleteNode: TLFMTreeNode;
|
||||||
@ -359,7 +359,7 @@ begin
|
|||||||
Replacements:=TList.Create;
|
Replacements:=TList.Create;
|
||||||
try
|
try
|
||||||
// automatically delete each error location
|
// automatically delete each error location
|
||||||
CurError:=fLfmTree.LastError;
|
CurError:=fLFMTree.LastError;
|
||||||
while CurError<>nil do begin
|
while CurError<>nil do begin
|
||||||
DeleteNode:=CurError.FindContextNode;
|
DeleteNode:=CurError.FindContextNode;
|
||||||
if (DeleteNode<>nil) and (DeleteNode.Parent<>nil) then begin
|
if (DeleteNode<>nil) and (DeleteNode.Parent<>nil) then begin
|
||||||
@ -377,25 +377,25 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLfmChecker.FindNiceNodeBounds(LFMNode: TLFMTreeNode;
|
procedure TLFMChecker.FindNiceNodeBounds(LFMNode: TLFMTreeNode;
|
||||||
var StartPos, EndPos: integer);
|
var StartPos, EndPos: integer);
|
||||||
var
|
var
|
||||||
Src: String;
|
Src: String;
|
||||||
begin
|
begin
|
||||||
Src:=fLfmBuffer.Source;
|
Src:=fLFMBuffer.Source;
|
||||||
StartPos:=FindLineEndOrCodeInFrontOfPosition(Src,LFMNode.StartPos,1,false,true);
|
StartPos:=FindLineEndOrCodeInFrontOfPosition(Src,LFMNode.StartPos,1,false,true);
|
||||||
EndPos:=FindLineEndOrCodeInFrontOfPosition(Src,LFMNode.EndPos,1,false,true);
|
EndPos:=FindLineEndOrCodeInFrontOfPosition(Src,LFMNode.EndPos,1,false,true);
|
||||||
EndPos:=FindLineEndOrCodeAfterPosition(Src,EndPos,length(Src),false);
|
EndPos:=FindLineEndOrCodeAfterPosition(Src,EndPos,length(Src),false);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLfmChecker.FindListBoxError: TLFMError;
|
function TLFMChecker.FindListBoxError: TLFMError;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
Result:=nil;
|
Result:=nil;
|
||||||
i:=fErrorsListBox.ItemIndex;
|
i:=fErrorsListBox.ItemIndex;
|
||||||
if (i<0) or (i>=fErrorsListBox.Items.Count) then exit;
|
if (i<0) or (i>=fErrorsListBox.Items.Count) then exit;
|
||||||
Result:=fLfmTree.FirstError;
|
Result:=fLFMTree.FirstError;
|
||||||
while Result<>nil do begin
|
while Result<>nil do begin
|
||||||
if i=0 then exit;
|
if i=0 then exit;
|
||||||
Result:=Result.NextError;
|
Result:=Result.NextError;
|
||||||
@ -403,13 +403,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLfmChecker.JumpToError(LFMError: TLFMError);
|
procedure TLFMChecker.JumpToError(LFMError: TLFMError);
|
||||||
begin
|
begin
|
||||||
if LFMError=nil then exit;
|
if LFMError=nil then exit;
|
||||||
fLfmSynEdit.CaretXY:=LFMError.Caret;
|
fLFMSynEdit.CaretXY:=LFMError.Caret;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLfmChecker.AddReplacement(LFMChangeList: TList;
|
procedure TLFMChecker.AddReplacement(LFMChangeList: TList;
|
||||||
StartPos, EndPos: integer; const NewText: string);
|
StartPos, EndPos: integer; const NewText: string);
|
||||||
var
|
var
|
||||||
Entry: TLFMChangeEntry;
|
Entry: TLFMChangeEntry;
|
||||||
@ -471,7 +471,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLfmChecker.ApplyReplacements(LfmChangeList: TList): boolean;
|
function TLFMChecker.ApplyReplacements(LfmChangeList: TList): boolean;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
Entry: TLFMChangeEntry;
|
Entry: TLFMChangeEntry;
|
||||||
@ -481,14 +481,14 @@ begin
|
|||||||
Entry:=TLFMChangeEntry(LfmChangeList[i]);
|
Entry:=TLFMChangeEntry(LfmChangeList[i]);
|
||||||
// DebugLn('TCheckLFMDialog.ApplyReplacements A ',IntToStr(i),' ',
|
// DebugLn('TCheckLFMDialog.ApplyReplacements A ',IntToStr(i),' ',
|
||||||
// IntToStr(Entry.StartPos),',',IntToStr(Entry.EndPos),
|
// IntToStr(Entry.StartPos),',',IntToStr(Entry.EndPos),
|
||||||
// ' "',copy(fLfmBuffer.Source,Entry.StartPos,Entry.EndPos-Entry.StartPos),'" -> "',Entry.NewText,'"');
|
// ' "',copy(fLFMBuffer.Source,Entry.StartPos,Entry.EndPos-Entry.StartPos),'" -> "',Entry.NewText,'"');
|
||||||
fLfmBuffer.Replace(Entry.StartPos,Entry.EndPos-Entry.StartPos,Entry.NewText);
|
fLFMBuffer.Replace(Entry.StartPos,Entry.EndPos-Entry.StartPos,Entry.NewText);
|
||||||
end;
|
end;
|
||||||
//writeln(fLfmBuffer.Source);
|
//writeln(fLFMBuffer.Source);
|
||||||
Result:=true;
|
Result:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLfmChecker.FillErrorsListBox;
|
procedure TLFMChecker.FillErrorsListBox;
|
||||||
var
|
var
|
||||||
CurError: TLFMError;
|
CurError: TLFMError;
|
||||||
Filename: String;
|
Filename: String;
|
||||||
@ -496,9 +496,9 @@ var
|
|||||||
begin
|
begin
|
||||||
fErrorsListBox.Items.BeginUpdate;
|
fErrorsListBox.Items.BeginUpdate;
|
||||||
fErrorsListBox.Items.Clear;
|
fErrorsListBox.Items.Clear;
|
||||||
if fLfmTree<>nil then begin
|
if fLFMTree<>nil then begin
|
||||||
Filename:=ExtractFileName(fLfmBuffer.Filename);
|
Filename:=ExtractFileName(fLFMBuffer.Filename);
|
||||||
CurError:=fLfmTree.FirstError;
|
CurError:=fLFMTree.FirstError;
|
||||||
while CurError<>nil do begin
|
while CurError<>nil do begin
|
||||||
Msg:=Filename
|
Msg:=Filename
|
||||||
+'('+IntToStr(CurError.Caret.Y)+','+IntToStr(CurError.Caret.X)+')'
|
+'('+IntToStr(CurError.Caret.Y)+','+IntToStr(CurError.Caret.X)+')'
|
||||||
@ -511,12 +511,12 @@ begin
|
|||||||
fErrorsListBox.Items.EndUpdate;
|
fErrorsListBox.Items.EndUpdate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLfmChecker.AutomaticFixIsPossible: boolean;
|
function TLFMChecker.AutomaticFixIsPossible: boolean;
|
||||||
var
|
var
|
||||||
CurError: TLFMError;
|
CurError: TLFMError;
|
||||||
begin
|
begin
|
||||||
Result:=true;
|
Result:=true;
|
||||||
CurError:=fLfmTree.FirstError;
|
CurError:=fLFMTree.FirstError;
|
||||||
while CurError<>nil do begin
|
while CurError<>nil do begin
|
||||||
if CurError.ErrorType in [lfmeNoError,lfmeIdentifierNotFound,
|
if CurError.ErrorType in [lfmeNoError,lfmeIdentifierNotFound,
|
||||||
lfmeObjectNameMissing,lfmeObjectIncompatible,lfmePropertyNameMissing,
|
lfmeObjectNameMissing,lfmeObjectIncompatible,lfmePropertyNameMissing,
|
||||||
@ -533,28 +533,28 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TLfmFixer }
|
{ TLFMFixer }
|
||||||
|
|
||||||
constructor TLfmFixer.Create(APascalBuffer, ALfmBuffer: TCodeBuffer;
|
constructor TLFMFixer.Create(APascalBuffer, ALFMBuffer: TCodeBuffer;
|
||||||
const AOnOutput: TOnAddFilteredLine);
|
const AOnOutput: TOnAddFilteredLine);
|
||||||
begin
|
begin
|
||||||
inherited Create(APascalBuffer, ALfmBuffer, AOnOutput);
|
inherited Create(APascalBuffer, ALFMBuffer, AOnOutput);
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TLfmFixer.Destroy;
|
destructor TLFMFixer.Destroy;
|
||||||
begin
|
begin
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLfmFixer.ShowRepairLFMWizard: TModalResult;
|
function TLFMFixer.ShowRepairLFMWizard: TModalResult;
|
||||||
var
|
var
|
||||||
FixLFMDialog: TFixLFMDialog;
|
FixLFMDialog: TFixLFMDialog;
|
||||||
begin
|
begin
|
||||||
Result:=mrCancel;
|
Result:=mrCancel;
|
||||||
FixLFMDialog:=TFixLFMDialog.Create(nil, self);
|
FixLFMDialog:=TFixLFMDialog.Create(nil, self);
|
||||||
try
|
try
|
||||||
fLfmSynEdit:=FixLFMDialog.LFMSynEdit;
|
fLFMSynEdit:=FixLFMDialog.LFMSynEdit;
|
||||||
fErrorsListBox:=FixLFMDialog.ErrorsListBox;
|
fErrorsListBox:=FixLFMDialog.ErrorsListBox;
|
||||||
fPropReplaceGrid:=FixLFMDialog.PropertyReplaceGrid;
|
fPropReplaceGrid:=FixLFMDialog.PropertyReplaceGrid;
|
||||||
LoadLFM;
|
LoadLFM;
|
||||||
@ -564,7 +564,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLfmFixer.Repair: TModalResult;
|
function TLFMFixer.Repair: TModalResult;
|
||||||
begin
|
begin
|
||||||
Result:=inherited Repair;
|
Result:=inherited Repair;
|
||||||
end;
|
end;
|
||||||
@ -572,7 +572,7 @@ end;
|
|||||||
|
|
||||||
{ TFixLFMDialog }
|
{ TFixLFMDialog }
|
||||||
|
|
||||||
constructor TFixLFMDialog.Create(AOwner: TComponent; ALfmFixer: TLfmFixer);
|
constructor TFixLFMDialog.Create(AOwner: TComponent; ALfmFixer: TLFMFixer);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
fLfmFixer:=ALfmFixer;
|
fLfmFixer:=ALfmFixer;
|
||||||
@ -603,7 +603,7 @@ procedure TFixLFMDialog.LFMSynEditSpecialLineMarkup(Sender: TObject;
|
|||||||
var
|
var
|
||||||
CurError: TLFMError;
|
CurError: TLFMError;
|
||||||
begin
|
begin
|
||||||
CurError:=fLfmFixer.fLfmTree.FindErrorAtLine(Line);
|
CurError:=fLfmFixer.fLFMTree.FindErrorAtLine(Line);
|
||||||
if CurError = nil then Exit;
|
if CurError = nil then Exit;
|
||||||
Special := True;
|
Special := True;
|
||||||
EditorOpts.SetMarkupColor(SynLFMSyn1, ahaErrorLine, AMarkup);
|
EditorOpts.SetMarkupColor(SynLFMSyn1, ahaErrorLine, AMarkup);
|
||||||
@ -631,20 +631,7 @@ begin
|
|||||||
EditorOpts.GetHighlighterSettings(SynLFMSyn1);
|
EditorOpts.GetHighlighterSettings(SynLFMSyn1);
|
||||||
EditorOpts.GetSynEditSettings(LFMSynEdit);
|
EditorOpts.GetSynEditSettings(LFMSynEdit);
|
||||||
end;
|
end;
|
||||||
{
|
|
||||||
procedure TFixLFMDialog.SetLfmBuffer(const AValue: TCodeBuffer);
|
|
||||||
begin
|
|
||||||
if fLFMSource=AValue then exit;
|
|
||||||
fLFMSource:=AValue;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TFixLFMDialog.SetLfmTree(const AValue: TLFMTree);
|
|
||||||
begin
|
|
||||||
if fLFMTree=AValue then exit;
|
|
||||||
fLFMTree:=AValue;
|
|
||||||
RemoveAllButton.Enabled:=AutomaticFixIsPossible;
|
|
||||||
end;
|
|
||||||
}
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user