implemented ShowAll and hide hints for unused package units option

git-svn-id: trunk@4931 -
This commit is contained in:
mattias 2003-12-21 18:21:32 +00:00
parent b46f2be0d6
commit c8a8052bd5
10 changed files with 230 additions and 150 deletions

View File

@ -156,9 +156,8 @@ begin
TheProcess.CurrentDirectory:=ProjectDir;
if OutputFilter<>nil then begin
OutputFilter.PrgSourceFilename:=ProjectFilename;
OutputFilter.Options:=[ofoSearchForFPCMessages,ofoExceptionOnError];
OutputFilter.Project:=AProject;
OutputFilter.CompilerOptions:=AProject.CompilerOptions;
OutputFilter.Execute(TheProcess);
end else begin
TheProcess.Execute;
@ -191,6 +190,9 @@ end.
{
$Log$
Revision 1.43 2003/12/21 18:21:32 mattias
implemented ShowAll and hide hints for unused package units option
Revision 1.42 2003/12/20 01:20:52 mattias
splitted output directories for cross compilation

View File

@ -151,6 +151,7 @@ type
Command: string;
ScanForFPCMessages: boolean;
ScanForMakeMessages: boolean;
ShowAllMessages: boolean;
procedure Clear;
function IsEqual(Params: TCompilationTool): boolean;
procedure Assign(Src: TCompilationTool);
@ -248,7 +249,7 @@ type
fShowCompProc: Boolean;
fShowCond: Boolean;
fShowNothing: Boolean;
fShowHintsForUnusedProjectUnits: Boolean;
fShowHintsForUnusedUnitsInMainSrc: Boolean;
fWriteFPCLogo: Boolean;
fStopAfterErrCount: integer;
@ -410,8 +411,8 @@ type
property ShowCompProc: Boolean read fShowCompProc write fShowCompProc;
property ShowCond: Boolean read fShowCond write fShowCond;
property ShowNothing: Boolean read fShowNothing write fShowNothing;
property ShowHintsForUnusedProjectUnits: Boolean
read fShowHintsForUnusedProjectUnits write fShowHintsForUnusedProjectUnits;
property ShowHintsForUnusedUnitsInMainSrc: Boolean
read fShowHintsForUnusedUnitsInMainSrc write fShowHintsForUnusedUnitsInMainSrc;
property WriteFPCLogo: Boolean read fWriteFPCLogo write fWriteFPCLogo;
property StopAfterErrCount: integer
read fStopAfterErrCount write fStopAfterErrCount;
@ -612,7 +613,7 @@ type
chkCompiledProc: TCheckBox;
chkConditionals: TCheckBox;
chkNothing: TCheckBox;
chkHintsForUnusedProjectUnits: TCheckBox;
chkHintsForUnusedUnitsInMainSrc: TCheckBox;
chkFPCLogo: TCheckBox;
grpErrorCnt: TGroupBox;
@ -641,6 +642,7 @@ type
ExecuteBeforeCommandEdit: TEdit;
ExecuteBeforeScanFPCCheckBox: TCheckBox;
ExecuteBeforeScanMakeCheckBox: TCheckBox;
ExecuteBeforeShowAllCheckBox: TCheckBox;
grpCompiler: TGroupBox;
edtCompiler: TEdit;
@ -652,6 +654,7 @@ type
ExecuteAfterCommandEdit: TEdit;
ExecuteAfterScanFPCCheckBox: TCheckBox;
ExecuteAfterScanMakeCheckBox: TCheckBox;
ExecuteAfterShowAllCheckBox: TCheckBox;
{ Buttons }
btnShowOptions: TButton;
@ -1255,7 +1258,7 @@ begin
ShowCompProc := XMLConfigFile.GetValue(p+'Verbosity/ShowCompProc/Value', false);
ShowCond := XMLConfigFile.GetValue(p+'Verbosity/ShowCond/Value', false);
ShowNothing := XMLConfigFile.GetValue(p+'Verbosity/ShowNothing/Value', false);
ShowHintsForUnusedProjectUnits := XMLConfigFile.GetValue(p+'Verbosity/ShowHintsForUnusedProjectUnits/Value', false);
ShowHintsForUnusedUnitsInMainSrc := XMLConfigFile.GetValue(p+'Verbosity/ShowHintsForUnusedUnitsInMainSrc/Value', false);
WriteFPCLogo := XMLConfigFile.GetValue(p+'WriteFPCLogo/Value', true);
StopAfterErrCount := XMLConfigFile.GetValue(p+'ConfigFile/StopAfterErrCount/Value', 1);
@ -1390,7 +1393,7 @@ begin
XMLConfigFile.SetDeleteValue(p+'Verbosity/ShowCompProc/Value', ShowCompProc,false);
XMLConfigFile.SetDeleteValue(p+'Verbosity/ShowCond/Value', ShowCond,false);
XMLConfigFile.SetDeleteValue(p+'Verbosity/ShowNothing/Value', ShowNothing,false);
XMLConfigFile.SetDeleteValue(p+'Verbosity/ShowHintsForUnusedProjectUnits/Value', ShowHintsForUnusedProjectUnits,false);
XMLConfigFile.SetDeleteValue(p+'Verbosity/ShowHintsForUnusedUnitsInMainSrc/Value', ShowHintsForUnusedUnitsInMainSrc,false);
XMLConfigFile.SetDeleteValue(p+'WriteFPCLogo/Value', WriteFPCLogo,true);
XMLConfigFile.SetDeleteValue(p+'ConfigFile/StopAfterErrCount/Value', StopAfterErrCount,1);
@ -2242,7 +2245,7 @@ begin
fShowCompProc := false;
fShowCond := false;
fShowNothing := false;
fShowHintsForUnusedProjectUnits := false;
fShowHintsForUnusedUnitsInMainSrc := false;
fWriteFPCLogo := true;
fStopAfterErrCount := 1;
@ -2337,7 +2340,7 @@ begin
fShowCompProc := CompOpts.fShowCompProc;
fShowCond := CompOpts.fShowCond;
fShowNothing := CompOpts.fShowNothing;
fShowHintsForUnusedProjectUnits := CompOpts.fShowHintsForUnusedProjectUnits;
fShowHintsForUnusedUnitsInMainSrc := CompOpts.fShowHintsForUnusedUnitsInMainSrc;
fWriteFPCLogo := CompOpts.fWriteFPCLogo;
fStopAfterErrCount := CompOpts.fStopAfterErrCount;
@ -2428,7 +2431,7 @@ begin
and (fShowCompProc = CompOpts.fShowCompProc)
and (fShowCond = CompOpts.fShowCond)
and (fShowNothing = CompOpts.fShowNothing)
and (fShowHintsForUnusedProjectUnits = CompOpts.fShowHintsForUnusedProjectUnits)
and (fShowHintsForUnusedUnitsInMainSrc = CompOpts.fShowHintsForUnusedUnitsInMainSrc)
and (fWriteFPCLogo = CompOpts.fWriteFPCLogo)
// other
@ -2627,13 +2630,16 @@ begin
inc(y,Height+5);
end;
with ExecuteAfterScanFPCCheckBox do begin
SetBounds(x,y,w,Height);
with ExecuteAfterScanFPCCheckBox do
SetBounds(x,y,w div 2,Height);
with ExecuteAfterScanMakeCheckBox do begin
SetBounds(x+(w div 2),y,w div 2,Height);
inc(y,Height+5);
end;
with ExecuteAfterScanMakeCheckBox do
SetBounds(x,y,w,Height);
with ExecuteAfterShowAllCheckBox do
SetBounds(x,y,w div 2,Height);
end;
procedure TfrmCompilerOptions.ExecuteBeforeGroupBoxResize(Sender: TObject);
@ -2654,13 +2660,16 @@ begin
inc(y,Height+5);
end;
with ExecuteBeforeScanFPCCheckBox do begin
SetBounds(x,y,w,Height);
with ExecuteBeforeScanFPCCheckBox do
SetBounds(x,y,w div 2,Height);
with ExecuteBeforeScanMakeCheckBox do begin
SetBounds(x+(w div 2),y,w div 2,Height);
inc(y,Height+5);
end;
with ExecuteBeforeScanMakeCheckBox do
SetBounds(x,y,w,Height);
with ExecuteBeforeShowAllCheckBox do
SetBounds(x,y,w div 2,Height);
end;
procedure TfrmCompilerOptions.FileBrowseBtnClick(Sender: TObject);
@ -2864,8 +2873,8 @@ begin
chkCompiledProc.Checked := Options.ShowCompProc;
chkConditionals.Checked := Options.ShowCond;
chkNothing.Checked := Options.ShowNothing;
chkHintsForUnusedProjectUnits.Checked :=
Options.ShowHintsForUnusedProjectUnits;
chkHintsForUnusedUnitsInMainSrc.Checked :=
Options.ShowHintsForUnusedUnitsInMainSrc;
chkFPCLogo.Checked := Options.WriteFPCLogo;
@ -2886,11 +2895,13 @@ begin
ExecuteBeforeScanFPCCheckBox.Checked:=Options.ExecuteBefore.ScanForFPCMessages;
ExecuteBeforeScanMakeCheckBox.Checked:=
Options.ExecuteBefore.ScanForMakeMessages;
ExecuteBeforeShowAllCheckBox.Checked:=Options.ExecuteBefore.ShowAllMessages;
edtCompiler.Text := Options.CompilerPath;
chkSkipCompiler.Checked := Options.SkipCompiler;
ExecuteAfterCommandEdit.Text:=Options.ExecuteAfter.Command;
ExecuteAfterScanFPCCheckBox.Checked:=Options.ExecuteAfter.ScanForFPCMessages;
ExecuteAfterScanMakeCheckBox.Checked:=Options.ExecuteAfter.ScanForMakeMessages;
ExecuteAfterShowAllCheckBox.Checked:=Options.ExecuteAfter.ShowAllMessages;
end;
{------------------------------------------------------------------------------}
@ -3032,7 +3043,8 @@ begin
Options.ShowCompProc := chkCompiledProc.Checked;
Options.ShowCond := chkConditionals.Checked;
Options.ShowNothing := chkNothing.Checked;
Options.ShowHintsForUnusedProjectUnits := chkHintsForUnusedProjectUnits.Checked;
Options.ShowHintsForUnusedUnitsInMainSrc :=
chkHintsForUnusedUnitsInMainSrc.Checked;
Options.WriteFPCLogo := chkFPCLogo.Checked;
@ -3056,6 +3068,7 @@ begin
ExecuteBeforeScanFPCCheckBox.Checked;
Options.ExecuteBefore.ScanForMakeMessages :=
ExecuteBeforeScanMakeCheckBox.Checked;
Options.ExecuteBefore.ShowAllMessages:=ExecuteBeforeShowAllCheckBox.Checked;
Options.CompilerPath := edtCompiler.Text;
Options.SkipCompiler := chkSkipCompiler.Checked;
Options.ExecuteAfter.Command := ExecuteAfterCommandEdit.Text;
@ -3063,6 +3076,7 @@ begin
ExecuteAfterScanFPCCheckBox.Checked;
Options.ExecuteAfter.ScanForMakeMessages :=
ExecuteAfterScanMakeCheckBox.Checked;
Options.ExecuteAfter.ShowAllMessages:=ExecuteAfterShowAllCheckBox.Checked;
// check for change and save
@ -4068,11 +4082,11 @@ begin
Width := chkDebugInfo.Width;
end;
chkHintsForUnusedProjectUnits := TCheckBox.Create(Self);
with chkHintsForUnusedProjectUnits do
chkHintsForUnusedUnitsInMainSrc := TCheckBox.Create(Self);
with chkHintsForUnusedUnitsInMainSrc do
begin
Parent := grpVerbosity;
Caption := dlgHintsUnused ;
Caption := dlgHintsUnused;
Top := 174;
Left := ChkErrors.Left;
Height := ChkErrors.Height;
@ -4259,6 +4273,13 @@ begin
Caption:=lisCOScanForMakeMessages;
end;
ExecuteBeforeShowAllCheckBox:=TCheckBox.Create(Self);
with ExecuteBeforeShowAllCheckBox do begin
Name:='ExecuteBeforeShowAllCheckBox';
Parent:=ExecuteBeforeGroupBox;
Caption:=lisCOShowAllMessages;
end;
{------------------------------------------------------------}
grpCompiler := TGroupBox.Create(Self);
@ -4345,6 +4366,13 @@ begin
Caption:=lisCOScanForMakeMessages;
end;
ExecuteAfterShowAllCheckBox:=TCheckBox.Create(Self);
with ExecuteAfterShowAllCheckBox do begin
Name:='ExecuteAfterShowAllCheckBox';
Parent:=ExecuteAfterGroupBox;
Caption:=lisCOShowAllMessages;
end;
end;
{------------------------------------------------------------------------------
@ -4996,6 +5024,7 @@ begin
Command:='';
ScanForFPCMessages:=false;
ScanForMakeMessages:=false;
ShowAllMessages:=false;
end;
function TCompilationTool.IsEqual(Params: TCompilationTool
@ -5004,6 +5033,7 @@ begin
Result:= (Command=Params.Command)
and ScanForFPCMessages=Params.ScanForFPCMessages
and ScanForMakeMessages=Params.ScanForMakeMessages
and ShowAllMessages=Params.ShowAllMessages
;
end;
@ -5012,6 +5042,7 @@ begin
Command:=Src.Command;
ScanForFPCMessages:=Src.ScanForFPCMessages;
ScanForMakeMessages:=Src.ScanForMakeMessages;
ShowAllMessages:=Src.ShowAllMessages;
end;
procedure TCompilationTool.LoadFromXMLConfig(XMLConfig: TXMLConfig;
@ -5021,6 +5052,7 @@ begin
DoSwitchPathDelims);
ScanForFPCMessages:=XMLConfig.GetValue(Path+'ScanForFPCMsgs/Value',false);
ScanForMakeMessages:=XMLConfig.GetValue(Path+'ScanForMakeMsgs/Value',false);
ShowAllMessages:=XMLConfig.GetValue(Path+'ShowAllMessages/Value',false);
end;
procedure TCompilationTool.SaveToXMLConfig(XMLConfig: TXMLConfig;
@ -5031,6 +5063,8 @@ begin
ScanForFPCMessages,false);
XMLConfig.SetDeleteValue(Path+'ScanForMakeMsgs/Value',
ScanForMakeMessages,false);
XMLConfig.SetDeleteValue(Path+'ShowAllMessages/Value',
ShowAllMessages,false);
end;
{ TGlobalCompilerOptions }

View File

@ -124,6 +124,8 @@ begin
until Result<>mrRetry;
if (ACodeBuffer=nil) and (lbfCreateClearOnError in Flags) then begin
ACodeBuffer:=CodeToolBoss.CreateFile(AFilename);
if ACodeBuffer<>nil then
Result:=mrOk;
end;
end;

View File

@ -41,7 +41,7 @@ uses
{$ENDIF}
Classes, SysUtils, LCLType, Controls, Forms, Buttons, StdCtrls, ComCtrls,
Dialogs, ExtCtrls, LResources, Laz_XMLCfg, ExtToolEditDlg, Process,
KeyMapping, TransferMacros, IDEProcs, OutputFilter, FileCtrl,
KeyMapping, TransferMacros, IDEProcs, CompilerOptions, OutputFilter, FileCtrl,
LazarusIDEStrConsts;
const
@ -79,7 +79,8 @@ type
Macros: TTransferMacroList): TModalResult;
function Run(ExtTool: TExternalToolOptions;
Macros: TTransferMacroList;
TheOutputFilter: TOutputFilter): TModalResult;
TheOutputFilter: TOutputFilter;
CompilerOptions: TBaseCompilerOptions): TModalResult;
function Run(Index: integer; Macros: TTransferMacroList): TModalResult;
function Save(XMLConfig: TXMLConfig; const Path: string): TModalResult;
procedure SaveShortCuts(KeyCommandRelationList: TKeyCommandRelationList);
@ -255,7 +256,7 @@ end;
function TExternalToolList.Run(ExtTool: TExternalToolOptions;
Macros: TTransferMacroList): TModalResult;
begin
Result:=Run(ExtTool,Macros,nil);
Result:=Run(ExtTool,Macros,nil,nil);
end;
function TExternalToolList.Run(Index: integer;
@ -267,7 +268,8 @@ begin
end;
function TExternalToolList.Run(ExtTool: TExternalToolOptions;
Macros: TTransferMacroList; TheOutputFilter: TOutputFilter): TModalResult;
Macros: TTransferMacroList; TheOutputFilter: TOutputFilter;
CompilerOptions: TBaseCompilerOptions): TModalResult;
var WorkingDir, Filename, Params, CmdLine, Title: string;
TheProcess: TProcess;
Abort, ErrorOccurred: boolean;
@ -309,7 +311,7 @@ begin
if TheOutputFilter<>nil then begin
ErrorOccurred:=false;
try
TheOutputFilter.PrgSourceFilename:='';
TheOutputFilter.CompilerOptions:=CompilerOptions;
TheOutputFilter.Options:=[ofoExceptionOnError,
ofoMakeFilenamesAbsolute];
if ExtTool.ScanOutputForFPCMessages then
@ -318,6 +320,8 @@ begin
if ExtTool.ScanOutputForMakeMessages then
TheOutputFilter.Options:=TheOutputFilter.Options
+[ofoSearchForMakeMessages];
if ExtTool.ShowAllOutput then
TheOutputFilter.Options:=TheOutputFilter.Options+[ofoShowAll];
try
Result:=mrCancel;
try

View File

@ -66,9 +66,11 @@ type
fScanOutputForFPCMessages: boolean;
fScanOutputForMakeMessages: boolean;
fShift: TShiftState;
FShowAllOutput: boolean;
fTitle: string;
fWorkingDirectory: string;
procedure SetScanOutput(const AValue: boolean);
procedure SetShowAllOutput(const AValue: boolean);
public
procedure Assign(Source: TExternalToolOptions);
constructor Create;
@ -93,6 +95,7 @@ type
read fWorkingDirectory write fWorkingDirectory;
property EnvironmentOverrides: TStringList read FEnvironmentOverrides;
property ScanOutput: boolean read FScanOutput write SetScanOutput;
property ShowAllOutput: boolean read FShowAllOutput write SetShowAllOutput;
end;
{
@ -182,6 +185,12 @@ begin
FScanOutput:=AValue;
end;
procedure TExternalToolOptions.SetShowAllOutput(const AValue: boolean);
begin
if FShowAllOutput=AValue then exit;
FShowAllOutput:=AValue;
end;
procedure TExternalToolOptions.Assign(Source: TExternalToolOptions);
begin
if Source=Self then exit;
@ -196,6 +205,8 @@ begin
fShift:=Source.fShift;
fScanOutputForFPCMessages:=Source.fScanOutputForFPCMessages;
fScanOutputForMakeMessages:=Source.fScanOutputForMakeMessages;
FScanOutput:=Source.FScanOutput;
FShowAllOutput:=Source.FShowAllOutput;
end;
end;
@ -222,23 +233,25 @@ begin
fShift:=[];
fScanOutputForFPCMessages:=false;
fScanOutputForMakeMessages:=false;
FScanOutput:=false;
FShowAllOutput:=false;
end;
function TExternalToolOptions.Load(XMLConfig: TXMLConfig;
const Path: string): TModalResult;
begin
Clear;
fTitle:=XMLConfig.GetValue(Path+'Title/Value',fTitle);
fFilename:=XMLConfig.GetValue(Path+'Filename/Value',fFilename);
fCmdLineParams:=XMLConfig.GetValue(Path+'CmdLineParams/Value',fCmdLineParams);
fWorkingDirectory:=XMLConfig.GetValue(
Path+'WorkingDirectory/Value',fWorkingDirectory);
fTitle:=XMLConfig.GetValue(Path+'Title/Value','');
fFilename:=XMLConfig.GetValue(Path+'Filename/Value','');
fCmdLineParams:=XMLConfig.GetValue(Path+'CmdLineParams/Value','');
fWorkingDirectory:=XMLConfig.GetValue(Path+'WorkingDirectory/Value','');
fScanOutputForFPCMessages:=XMLConfig.GetValue(
Path+'ScanOutputForFPCMessages/Value',fScanOutputForFPCMessages);
Path+'ScanOutputForFPCMessages/Value',false);
fScanOutputForMakeMessages:=XMLConfig.GetValue(
Path+'ScanOutputForMakeMessages/Value',fScanOutputForMakeMessages);
Path+'ScanOutputForMakeMessages/Value',false);
FShowAllOutput:=XMLConfig.GetValue(Path+'ShowAllOutput/Value',false);
LoadStringList(XMLConfig,FEnvironmentOverrides,Path+'EnvironmentOverrides/');
// key and shift are saved with the keymapping in the editoroptions
// key and shift are loaded with the keymapping in the editoroptions
Result:=mrOk;
end;
@ -246,14 +259,17 @@ function TExternalToolOptions.Save(XMLConfig: TXMLConfig;
const Path: string): TModalResult;
begin
XMLConfig.SetValue(Path+'Format/Version',ExternalToolOptionsFormat);
XMLConfig.SetValue(Path+'Title/Value',fTitle);
XMLConfig.SetValue(Path+'Filename/Value',fFilename);
XMLConfig.SetValue(Path+'CmdLineParams/Value',fCmdLineParams);
XMLConfig.SetValue(Path+'WorkingDirectory/Value',fWorkingDirectory);
XMLConfig.SetValue(
Path+'ScanOutputForFPCMessages/Value',fScanOutputForFPCMessages);
XMLConfig.SetValue(
Path+'ScanOutputForMakeMessages/Value',fScanOutputForMakeMessages);
XMLConfig.SetDeleteValue(Path+'Title/Value',fTitle,'');
XMLConfig.SetDeleteValue(Path+'Filename/Value',fFilename,'');
XMLConfig.SetDeleteValue(Path+'CmdLineParams/Value',fCmdLineParams,'');
XMLConfig.SetDeleteValue(Path+'WorkingDirectory/Value',fWorkingDirectory,'');
XMLConfig.SetDeleteValue(
Path+'ScanOutputForFPCMessages/Value',fScanOutputForFPCMessages,
false);
XMLConfig.SetDeleteValue(
Path+'ScanOutputForMakeMessages/Value',fScanOutputForMakeMessages,
false);
XMLConfig.SetDeleteValue(Path+'ShowAllOutput/Value',FShowAllOutput,false);
SaveStringList(XMLConfig,FEnvironmentOverrides,Path+'EnvironmentOverrides/');
// key and shift are saved with the keymapping in the editoroptions
Result:=mrOk;
@ -271,7 +287,8 @@ end;
function TExternalToolOptions.NeedsOutputFilter: boolean;
begin
Result:=ScanOutput or ScanOutputForFPCMessages or ScanOutputForMakeMessages;
Result:=ScanOutput or ScanOutputForFPCMessages or ScanOutputForMakeMessages
or ShowAllOutput;
end;

View File

@ -869,7 +869,7 @@ resourcestring
dlgShowConditionals = 'Show Conditionals';
dlgShowNothing = 'Show Nothing (only errors)';
dlgWriteFPCLogo = 'Write an FPC Logo';
dlgHintsUnused = 'Show Hints for unused project units';
dlgHintsUnused = 'Show Hints for unused units in main source';
dlgConfigFiles = 'Config Files:';
dlgUseFpcCfg = 'Use Compiler Config File (fpc.cfg)';
dlgUseAdditionalConfig = 'Use Additional Compiler Config File';
@ -886,6 +886,7 @@ resourcestring
lisCOCommand = 'Command:';
lisCOScanForFPCMessages = 'Scan for FPC messages';
lisCOScanForMakeMessages = 'Scan for Make messages';
lisCOShowAllMessages = 'Show all messages';
dlgUnitOutp = 'Unit output directory:';
dlgLCLWidgetType = 'LCL Widget Type';
lisCOdefault = 'default (%s)';

View File

@ -6116,6 +6116,7 @@ begin
ExtTool.ScanOutputForFPCMessages:=Tool.ScanForFPCMessages;
ExtTool.ScanOutputForMakeMessages:=Tool.ScanForMakeMessages;
ExtTool.ScanOutput:=true;
ExtTool.ShowAllOutput:=Tool.ShowAllMessages;
ExtTool.Title:=ToolTitle;
ExtTool.WorkingDirectory:=WorkingDir;
ExtTool.CmdLineParams:=Params;
@ -9705,7 +9706,6 @@ procedure TMainIDE.OnExtToolNeedsOutputFilter(var OutputFilter: TOutputFilter;
var Abort: boolean);
begin
OutputFilter:=TheOutputFilter;
OutputFilter.Project:=Project1;
if ToolStatus<>itNone then begin
Abort:=true;
exit;
@ -10250,6 +10250,9 @@ end.
{ =============================================================================
$Log$
Revision 1.685 2003/12/21 18:21:32 mattias
implemented ShowAll and hide hints for unused package units option
Revision 1.684 2003/12/21 18:14:29 micha
fix openfile popupmenu to appear at correct position

View File

@ -37,6 +37,7 @@ type
TOnGetIncludePath = function(const Directory: string): string of object;
TOuputFilterOption = (
ofoShowAll, // don't filter
ofoSearchForFPCMessages, // scan for freepascal compiler messages
ofoSearchForMakeMessages,// scan for make/gmake messages
ofoExceptionOnError, // raise exception on panic, fatal errors
@ -50,6 +51,7 @@ type
TOutputFilter = class
private
FCompilerOptions: TBaseCompilerOptions;
fCurrentDirectory: string;
fFilteredOutput: TStringList;
fOnReadLine: TOnOutputString;
@ -61,8 +63,6 @@ type
fOnGetIncludePath: TOnGetIncludePath;
fOnOutputString: TOnOutputString;
fOptions: TOuputFilterOptions;
fProject: TProject;
fPrgSourceFilename: string;
FStopExecute: boolean;
procedure DoAddFilteredLine(const s: string);
procedure DoAddLastLinkerMessages(SkipLastLine: boolean);
@ -79,8 +79,8 @@ type
procedure Clear;
constructor Create;
destructor Destroy; override;
function IsHintForUnusedProjectUnit(const OutputLine,
ProgramSrcFile: string): boolean;
function IsHintForUnusedUnit(const OutputLine,
MainSrcFile: string): boolean;
function IsParsing: boolean;
procedure ReadLine(const s: string; DontFilterLine: boolean);
function ReadFPCompilerLine(const s: string): boolean;
@ -92,15 +92,14 @@ type
property Lines: TStringList read fOutput;
property LastErrorType: TErrorType read fLastErrorType;
property LastMessageType: TOutputMessageType read fLastMessageType;
property PrgSourceFilename: string
read fPrgSourceFilename write fPrgSourceFilename;
property OnGetIncludePath: TOnGetIncludePath
read fOnGetIncludePath write fOnGetIncludePath;
read fOnGetIncludePath write fOnGetIncludePath;
property OnReadLine: TOnOutputString read fOnReadLine write fOnReadLine;
property OnOutputString: TOnOutputString
read fOnOutputString write fOnOutputString;
read fOnOutputString write fOnOutputString;
property Options: TOuputFilterOptions read fOptions write fOptions;
property Project: TProject read fProject write fProject;
property CompilerOptions: TBaseCompilerOptions read FCompilerOptions
write FCompilerOptions;
end;
EOutputFilterError = class(Exception)
@ -208,8 +207,10 @@ begin
fLastMessageType:=omtNone;
fLastErrorType:=etNone;
fOutput.Add(s);
if Assigned(OnReadLine) then OnReadLine(s,fCurrentDirectory);
if DontFilterLine then begin
if Assigned(OnReadLine) then
OnReadLine(s,fCurrentDirectory);
if DontFilterLine or (ofoShowAll in Options) then begin
DoAddFilteredLine(s);
end else if (ofoSearchForFPCMessages in Options) and (ReadFPCompilerLine(s))
then begin
@ -239,6 +240,7 @@ var i, j, FilenameEndPos: integer;
CurCompHistory: string;
CurFilenameLen: Integer;
CurCompHistLen: Integer;
MainSrcFilename: String;
function CheckForCompilingState: boolean;
var
@ -387,31 +389,34 @@ begin
fLastMessageType:=omtFPC;
SkipMessage:=true;
if Project<>nil then begin
if CompilerOptions<>nil then begin
case MsgType of
etHint:
begin
SkipMessage:=not (Project.CompilerOptions.ShowHints
or Project.CompilerOptions.ShowAll);
SkipMessage:=not (CompilerOptions.ShowHints
or CompilerOptions.ShowAll);
if (not SkipMessage)
and (not Project.CompilerOptions.ShowAll)
and (not Project.CompilerOptions.ShowHintsForUnusedProjectUnits)
and (PrgSourceFilename<>'')
and (IsHintForUnusedProjectUnit(s,PrgSourceFilename)) then
SkipMessage:=true;
and (not CompilerOptions.ShowAll)
and (not CompilerOptions.ShowHintsForUnusedUnitsInMainSrc) then
begin
MainSrcFilename:=CompilerOptions.GetDefaultMainSourceFileName;
if (MainSrcFilename<>'')
and (IsHintForUnusedUnit(s,MainSrcFilename)) then
SkipMessage:=true;
end;
end;
etNote:
begin
SkipMessage:=not (Project.CompilerOptions.ShowNotes
or Project.CompilerOptions.ShowAll);
SkipMessage:=not (CompilerOptions.ShowNotes
or CompilerOptions.ShowAll);
end;
etError:
begin
SkipMessage:=not (Project.CompilerOptions.ShowErrors
or Project.CompilerOptions.ShowAll);
SkipMessage:=not (CompilerOptions.ShowErrors
or CompilerOptions.ShowAll);
if copy(s,j+2,length(s)-j-1)='Error while linking' then begin
DoAddLastLinkerMessages(true);
end
@ -422,8 +427,8 @@ begin
etWarning:
begin
SkipMessage:=not (Project.CompilerOptions.ShowWarn
or Project.CompilerOptions.ShowAll);
SkipMessage:=not (CompilerOptions.ShowWarn
or CompilerOptions.ShowAll);
end;
etPanic, etFatal:
@ -569,8 +574,8 @@ begin
end;
end;
function TOutputFilter.IsHintForUnusedProjectUnit(const OutputLine,
ProgramSrcFile: string): boolean;
function TOutputFilter.IsHintForUnusedUnit(const OutputLine,
MainSrcFile: string): boolean;
{ recognizes hints of the form
mainprogram.pp(5,35) Hint: Unit UNUSEDUNIT not used in mainprogram
@ -578,7 +583,7 @@ function TOutputFilter.IsHintForUnusedProjectUnit(const OutputLine,
var Filename: string;
begin
Result:=false;
Filename:=ExtractFilename(ProgramSrcFile);
Filename:=ExtractFilename(MainSrcFile);
if CompareFilenames(Filename,copy(OutputLine,1,length(Filename)))<>0 then
exit;
if (pos(') Hint: Unit ',OutputLine)<>0)

View File

@ -231,6 +231,7 @@ const
LM_MOUSEENTER = LM_MOUSEFIRST2 +6;
LM_MOUSELEAVE = LM_MOUSEFIRST2 +7;
LM_MOUSELAST2 = LM_MOUSELEAVE;
// for triple and quad clicks see below
LM_GRABFOCUS = LM_USER+79;
@ -281,90 +282,89 @@ const
// Messages
//-------------
LM_NULL = $0000;
LM_NULL = $0000;
// not yet these are defined as messages to the interface
//LM_CREATE = $0001;
//LM_DESTROY = $0002;
LM_MOVE = $0003;
//LM_CREATE = $0001;
//LM_DESTROY = $0002;
LM_MOVE = $0003;
LM_SIZE = $0005;
LM_ACTIVATE = $0006;
LM_SETFOCUS = $0007;
LM_KILLFOCUS = $0008;
LM_ENABLE = $000A;
LM_GETTEXTLENGTH = $000E;
LM_ERASEBKGND = $0014;
LM_SIZE = $0005;
LM_ACTIVATE = $0006;
LM_SETFOCUS = $0007;
LM_KILLFOCUS = $0008;
LM_ENABLE = $000A;
LM_GETTEXTLENGTH = $000E;
LM_ERASEBKGND = $0014;
LM_SHOWWINDOW = $0018;
LM_SHOWWINDOW = $0018;
LM_CANCELMODE = $001F;
LM_SETCURSOR = $0020;
LM_DRAWITEM = $002B;
LM_MEASUREITEM = $002C;
LM_DELETEITEM = $002D;
LM_VKEYTOITEM = $002E;
LM_CHARTOITEM = $002F;
LM_SETFONT = $0030;
LM_CANCELMODE = $001F;
LM_SETCURSOR = $0020;
LM_DRAWITEM = $002B;
LM_MEASUREITEM = $002C;
LM_DELETEITEM = $002D;
LM_VKEYTOITEM = $002E;
LM_CHARTOITEM = $002F;
LM_SETFONT = $0030;
LM_COMPAREITEM = $0039;
LM_COMPAREITEM = $0039;
LM_WINDOWPOSCHANGING = $0046;
LM_WINDOWPOSCHANGED = $0047;
LM_NOTIFY = $004E;
LM_NOTIFYFORMAT = $0055;
LM_WINDOWPOSCHANGED = $0047;
LM_NOTIFY = $004E;
LM_NOTIFYFORMAT = $0055;
LM_NCCALCSIZE = $0083;
LM_NCHITTEST = $0084;
LM_NCPAINT = $0085;
LM_NCACTIVATE = $0086;
LM_GETDLGCODE = $0087;
LM_NCMOUSEMOVE = $00A0;
LM_NCLBUTTONDOWN = $00A1;
LM_NCLBUTTONUP = $00A2;
LM_NCLBUTTONDBLCLK = $00A3;
LM_NCCALCSIZE = $0083;
LM_NCHITTEST = $0084;
LM_NCPAINT = $0085;
LM_NCACTIVATE = $0086;
LM_GETDLGCODE = $0087;
LM_NCMOUSEMOVE = $00A0;
LM_NCLBUTTONDOWN = $00A1;
LM_NCLBUTTONUP = $00A2;
LM_NCLBUTTONDBLCLK = $00A3;
LM_KEYFIRST = $0100;
LM_KEYDOWN = $0100;
LM_KEYUP = $0101;
LM_CHAR = $0102;
LM_KEYFIRST = $0100;
LM_KEYDOWN = $0100;
LM_KEYUP = $0101;
LM_CHAR = $0102;
LM_SYSKEYDOWN = $0104;
LM_SYSKEYUP = $0105;
LM_SYSCHAR = $0106;
LM_SYSKEYDOWN = $0104;
LM_SYSKEYUP = $0105;
LM_SYSCHAR = $0106;
LM_KEYLAST = $0108;
LM_KEYLAST = $0108;
LM_COMMAND = $0111;
LM_SYSCOMMAND = $0112;
LM_COMMAND = $0111;
LM_SYSCOMMAND = $0112;
LM_HSCROLL = $0114;
LM_VSCROLL = $0115;
LM_CTLCOLORMSGBOX = $0132;
LM_CTLCOLOREDIT = $0133;
LM_CTLCOLORLISTBOX = $0134;
LM_CTLCOLORBTN = $0135;
LM_CTLCOLORDLG = $0136;
LM_CTLCOLORSCROLLBAR= $0137;
LM_CTLCOLORSTATIC = $0138;
LM_HSCROLL = $0114;
LM_VSCROLL = $0115;
LM_CTLCOLORMSGBOX = $0132;
LM_CTLCOLOREDIT = $0133;
LM_CTLCOLORLISTBOX = $0134;
LM_CTLCOLORBTN = $0135;
LM_CTLCOLORDLG = $0136;
LM_CTLCOLORSCROLLBAR = $0137;
LM_CTLCOLORSTATIC = $0138;
LM_MOUSEFIRST = $0200;
LM_MOUSEMOVE = $0200;
LM_LBUTTONDOWN = $0201;
LM_LBUTTONUP = $0202;
LM_LBUTTONDBLCLK = $0203;
LM_RBUTTONDOWN = $0204;
LM_RBUTTONUP = $0205;
LM_RBUTTONDBLCLK = $0206;
LM_MButtonDown = $0207;
LM_MBUTTONUP = $0208;
LM_MBUTTONDBLCLK = $0209;
LM_MOUSEWHEEL = $020A;
LM_MOUSELAST = $020A;
// for triple and quad clicks see below
LM_MOUSEFIRST = $0200;
LM_MOUSEMOVE = $0200;
LM_LBUTTONDOWN = $0201;
LM_LBUTTONUP = $0202;
LM_LBUTTONDBLCLK = $0203;
LM_RBUTTONDOWN = $0204;
LM_RBUTTONUP = $0205;
LM_RBUTTONDBLCLK = $0206;
LM_MButtonDown = $0207;
LM_MBUTTONUP = $0208;
LM_MBUTTONDBLCLK = $0209;
LM_MOUSEWHEEL = $020A;
LM_MOUSELAST = $020A;
LM_CAPTURECHANGED = $0215;
LM_DROPFILES = $0233;
LM_PARENTNOTIFY = $0210;
LM_CAPTURECHANGED = $0215;
LM_DROPFILES = $0233;
LM_PARENTNOTIFY = $0210;
//-------------
// End of Windows Compatability and messages
@ -1092,6 +1092,9 @@ end.
{
$Log$
Revision 1.57 2003/12/21 18:21:32 mattias
implemented ShowAll and hide hints for unused package units option
Revision 1.56 2003/11/15 13:07:09 mattias
added ambigious unit check for IDE

View File

@ -2117,7 +2117,7 @@ begin
// compile package
Result:=EnvironmentOptions.ExternalTools.Run(PkgCompileTool,
MainIDE.MacroList);
MainIDE.MacroList,nil,APackage.CompilerOptions);
if Result<>mrOk then exit;
// compilation succeded -> write state file
Result:=DoSavePackageCompiledState(APackage,
@ -2182,7 +2182,10 @@ begin
// delete ambigious files
Result:=MainIDE.DoDeleteAmbigiousFiles(SrcFilename);
if Result=mrAbort then exit;
if Result=mrAbort then begin
writeln('TPkgManager.DoSavePackageMainSource DoDeleteAmbigiousFiles failed');
exit;
end;
// collect unitnames
e:=EndOfLine;
@ -2258,7 +2261,10 @@ begin
// check if old code is already uptodate
Result:=LoadCodeBuffer(CodeBuffer,SrcFilename,[lbfQuiet,lbfCheckIfText,
lbfUpdateFromDisk,lbfCreateClearOnError]);
if Result<>mrOk then exit;
if Result<>mrOk then begin
writeln('TPkgManager.DoSavePackageMainSource LoadCodeBuffer ',SrcFilename,' failed');
exit;
end;
OldSrc:=CodeToolBoss.ExtractCodeWithoutComments(CodeBuffer);
if CompareTextIgnoringSpace(OldSrc,Src,true)=0 then begin
Result:=mrOk;
@ -2268,7 +2274,10 @@ begin
// save source
Result:=MainIDE.DoSaveStringToFile(SrcFilename, Src,
lisPkgMangpackageMainSourceFile);
if Result<>mrOk then exit;
if Result<>mrOk then begin
writeln('TPkgManager.DoSavePackageMainSource DoSaveStringToFile ',SrcFilename,' failed');
exit;
end;
Result:=mrOk;
end;