mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-04 04:37:35 +01:00
implemented context help system for compiler/make messages
git-svn-id: trunk@7247 -
This commit is contained in:
parent
683ed7e2c0
commit
19553ee2d3
@ -1020,6 +1020,8 @@ var
|
||||
IdentifierStart: PChar;
|
||||
begin
|
||||
Result:=false;
|
||||
NewTool:=nil;
|
||||
NewNode:=nil;
|
||||
SkipChecks:=false;
|
||||
ActivateGlobalWriteLock;
|
||||
try
|
||||
@ -1078,7 +1080,7 @@ begin
|
||||
NewPos,NewTopLine);
|
||||
NewNode:=nil;
|
||||
NewTool:=nil;
|
||||
if fsfSearchSourceName in SearchSmartFlags then
|
||||
if Result and (fsfSearchSourceName in SearchSmartFlags) then
|
||||
Result:=FindSourceName(NewPos.Code);
|
||||
exit;
|
||||
end;
|
||||
@ -2887,6 +2889,8 @@ begin
|
||||
Result:=true;
|
||||
ListOfPCodeXYPosition:=nil;
|
||||
AddCodePosition(CursorPos);
|
||||
NewTool:=nil;
|
||||
NewNode:=nil;
|
||||
|
||||
ActivateGlobalWriteLock;
|
||||
try
|
||||
|
||||
@ -480,7 +480,7 @@ end;
|
||||
procedure TAnchorDesigner.KeyUp(var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
inherited KeyUp(Key, Shift);
|
||||
ExecuteIDECommand(Self,Key,Shift,caMenuOnly);
|
||||
ExecuteIDEShortCut(Self,Key,Shift,caMenuOnly);
|
||||
end;
|
||||
|
||||
procedure TAnchorDesigner.FillComboBoxWithSiblings(AComboBox: TComboBox);
|
||||
|
||||
@ -417,7 +417,7 @@ end;
|
||||
procedure TCodeExplorerView.KeyUp(var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
inherited KeyUp(Key, Shift);
|
||||
ExecuteIDECommand(Self,Key,Shift,caMenuOnly);
|
||||
ExecuteIDEShortCut(Self,Key,Shift,caMenuOnly);
|
||||
end;
|
||||
|
||||
procedure TCodeExplorerView.BeginUpdate;
|
||||
|
||||
@ -39,7 +39,7 @@ uses
|
||||
PropEdits, HelpIntf, HelpHTML, HelpFPDoc, MacroIntf,
|
||||
LazarusIDEStrConsts, TransferMacros, DialogProcs, IDEOptionDefs,
|
||||
EnvironmentOpts, AboutFrm, MsgView, Project, PackageDefs, MainBar,
|
||||
HelpOptions, MainIntf, LazConf;
|
||||
OutputFilter, HelpOptions, MainIntf, LazConf;
|
||||
|
||||
type
|
||||
{ TBaseHelpManager }
|
||||
@ -672,15 +672,32 @@ end;
|
||||
|
||||
procedure THelpManager.ShowHelpForMessage(Line: integer);
|
||||
|
||||
function ParseMessage(const Msg: string): TStringList;
|
||||
function ParseMessage(MsgItem: TMessageLine): TStringList;
|
||||
var
|
||||
AnOutputFilter: TOutputFilter;
|
||||
CurParts: TOutputLine;
|
||||
begin
|
||||
Result:=TStringList.Create;
|
||||
Result.Values['Message']:=Msg;
|
||||
Result.Values['Message']:=MsgItem.Msg;
|
||||
AnOutputFilter:=TOutputFilter.Create;
|
||||
try
|
||||
AnOutputFilter.ReadLine(MsgItem.Msg,false);
|
||||
AnOutputFilter.CurrentDirectory:=MsgItem.Directory;
|
||||
CurParts:=AnOutputFilter.CurrentMessageParts;
|
||||
if CurParts<>nil then
|
||||
debugln('THelpManager.ShowHelpForMessage ',CurParts.Text)
|
||||
else
|
||||
debugln('THelpManager.ShowHelpForMessage no parts');
|
||||
if CurParts<>nil then
|
||||
Result.Assign(CurParts);
|
||||
finally
|
||||
AnOutputFilter.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
MessageParts: TStringList;
|
||||
MsgItem: TMessageLine;
|
||||
MessageParts: TStringList;
|
||||
begin
|
||||
debugln('THelpManager.ShowHelpForMessage A Line=',dbgs(Line));
|
||||
if MessagesView=nil then exit;
|
||||
@ -690,7 +707,7 @@ begin
|
||||
MsgItem:=MessagesView.VisibleItems[Line];
|
||||
if MsgItem=nil then exit;
|
||||
if MsgItem.Msg<>'' then begin
|
||||
MessageParts:=ParseMessage(MsgItem.Msg);
|
||||
MessageParts:=ParseMessage(MsgItem);
|
||||
ShowHelpOrErrorForMessageLine(MsgItem.Msg,MessageParts);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -191,6 +191,7 @@ resourcestring
|
||||
lisMenuViewUnitInfo = 'View Unit Information';
|
||||
lisMenuViewToggleFormUnit = 'Toggle form/unit view';
|
||||
lisMenuViewMessages = 'Messages';
|
||||
lisCopySelectedMessagesToClipboard = 'Copy selected messages to clipboard';
|
||||
lisCopyAllMessagesToClipboard = 'Copy all messages to clipboard';
|
||||
lisSaveAllMessagesToFile = 'Save all messages to file';
|
||||
lisMenuViewSearchResults = 'Search Results';
|
||||
|
||||
23
ide/main.pp
23
ide/main.pp
@ -284,9 +284,10 @@ type
|
||||
public
|
||||
// Global IDE events
|
||||
procedure OnProcessIDECommand(Sender: TObject; Command: word;
|
||||
var Handled: boolean);
|
||||
procedure OnExecuteIDECommand(Sender: TObject;
|
||||
var Key: word; Shift: TShiftState; Areas: TCommandAreas);
|
||||
var Handled: boolean);
|
||||
procedure OnExecuteIDEShortCut(Sender: TObject;
|
||||
var Key: word; Shift: TShiftState; Areas: TCommandAreas);
|
||||
procedure OnExecuteIDECommand(Sender: TObject; Command: word);
|
||||
|
||||
// Environment options dialog events
|
||||
procedure OnLoadEnvironmentSettings(Sender: TObject;
|
||||
@ -1132,7 +1133,7 @@ end;
|
||||
procedure TMainIDE.OIRemainingKeyUp(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
begin
|
||||
OnExecuteIDECommand(Sender,Key,Shift,caDesign);
|
||||
OnExecuteIDEShortCut(Sender,Key,Shift,caDesign);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.OIOnAddToFavourites(Sender: TObject);
|
||||
@ -1508,6 +1509,7 @@ end;
|
||||
procedure TMainIDE.SetupIDEInterface;
|
||||
begin
|
||||
IDECommands.OnExecuteIDECommand:=@OnExecuteIDECommand;
|
||||
IDECommands.OnExecuteIDEShortCut:=@OnExecuteIDEShortCut;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.SetupStartProject;
|
||||
@ -2304,7 +2306,15 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.OnExecuteIDECommand(Sender: TObject; var Key: word;
|
||||
procedure TMainIDE.OnExecuteIDECommand(Sender: TObject; Command: word);
|
||||
var
|
||||
Handled: Boolean;
|
||||
begin
|
||||
Handled:=false;
|
||||
OnProcessIDECommand(Sender,Command,Handled);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.OnExecuteIDEShortCut(Sender: TObject; var Key: word;
|
||||
Shift: TShiftState; Areas: TCommandAreas);
|
||||
var
|
||||
CommandRelation: TKeyCommandRelation;
|
||||
@ -11716,6 +11726,9 @@ end.
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.877 2005/06/18 08:49:32 mattias
|
||||
implemented context help system for compiler/make messages
|
||||
|
||||
Revision 1.876 2005/06/17 16:06:16 mattias
|
||||
added message window to persistent IDE windows
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ uses
|
||||
Classes, SysUtils, LCLProc, Controls, StdCtrls, Forms, Menus, LResources,
|
||||
ClipBrd, Dialogs, InputHistory, FileUtil,
|
||||
IDEProcs, IDEOptionDefs, DialogProcs, IDECommands, EnvironmentOpts,
|
||||
LazarusIDEStrConsts;
|
||||
LazarusIDEStrConsts, KeyMapping;
|
||||
|
||||
type
|
||||
{ TMessageLine }
|
||||
@ -71,12 +71,18 @@ type
|
||||
|
||||
TOnFilterLine = procedure(MsgLine: TMessageLine; var Show: boolean) of object;
|
||||
|
||||
{ TMessagesView }
|
||||
|
||||
TMessagesView = class(TForm)
|
||||
MessageView: TListBox;
|
||||
MainPopupMenu: TPopupMenu;
|
||||
CopyMenuItem: TMenuItem;
|
||||
CopyAllMenuItem: TMenuItem;
|
||||
HelpMenuItem: TMenuItem;
|
||||
SaveAllToFileMenuItem: TMenuItem;
|
||||
procedure CopyAllMenuItemClick(Sender: TObject);
|
||||
procedure CopyMenuItemClick(Sender: TObject);
|
||||
procedure HelpMenuItemClick(Sender: TObject);
|
||||
procedure MessageViewDblClicked(Sender: TObject);
|
||||
Procedure MessageViewClicked(sender : TObject);
|
||||
procedure MessagesViewKeyDown(Sender: TObject; var Key: Word;
|
||||
@ -161,6 +167,22 @@ Begin
|
||||
MainPopupMenu:=TPopupMenu.Create(Self);
|
||||
MessageView.PopupMenu:=MainPopupMenu;
|
||||
|
||||
HelpMenuItem:=TMenuItem.Create(Self);
|
||||
with HelpMenuItem do begin
|
||||
Name:='HelpMenuItem';
|
||||
Caption:=srVK_HELP;
|
||||
OnClick:=@HelpMenuItemClick;
|
||||
end;
|
||||
MainPopupMenu.Items.Add(HelpMenuItem);
|
||||
|
||||
CopyMenuItem:=TMenuItem.Create(Self);
|
||||
with CopyMenuItem do begin
|
||||
Name:='CopyMenuItem';
|
||||
Caption:=lisCopySelectedMessagesToClipboard;
|
||||
OnClick:=@CopyMenuItemClick;
|
||||
end;
|
||||
MainPopupMenu.Items.Add(CopyMenuItem);
|
||||
|
||||
CopyAllMenuItem:=TMenuItem.Create(Self);
|
||||
with CopyAllMenuItem do begin
|
||||
Name:='CopyAllMenuItem';
|
||||
@ -168,7 +190,7 @@ Begin
|
||||
OnClick:=@CopyAllMenuItemClick;
|
||||
end;
|
||||
MainPopupMenu.Items.Add(CopyAllMenuItem);
|
||||
|
||||
|
||||
SaveAllToFileMenuItem:=TMenuItem.Create(Self);
|
||||
with SaveAllToFileMenuItem do begin
|
||||
Name:='SaveAllToFileMenuItem';
|
||||
@ -422,6 +444,17 @@ begin
|
||||
Clipboard.AsText:=MessageView.Items.Text;
|
||||
end;
|
||||
|
||||
procedure TMessagesView.CopyMenuItemClick(Sender: TObject);
|
||||
begin
|
||||
if MessageView.ItemIndex<0 then exit;
|
||||
Clipboard.AsText:=MessageView.GetSelectedText;
|
||||
end;
|
||||
|
||||
procedure TMessagesView.HelpMenuItemClick(Sender: TObject);
|
||||
begin
|
||||
ExecuteIDECommand(Self,ecContextHelp);
|
||||
end;
|
||||
|
||||
Procedure TMessagesView.MessageViewClicked(sender : TObject);
|
||||
begin
|
||||
if EnvironmentOptions.MsgViewDblClickJumps then exit;
|
||||
@ -435,7 +468,7 @@ procedure TMessagesView.MessagesViewKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
begin
|
||||
//debugln('TMessagesView.MessagesViewKeyDown ',dbgs(Key));
|
||||
ExecuteIDECommand(Self,Key,Shift);
|
||||
ExecuteIDEShortCut(Self,Key,Shift);
|
||||
end;
|
||||
|
||||
procedure TMessagesView.SaveAllToFileMenuItemClick(Sender: TObject);
|
||||
|
||||
@ -164,7 +164,8 @@ type
|
||||
procedure BeginBufferingOutput;
|
||||
procedure EndBufferingOutput;
|
||||
public
|
||||
property CurrentDirectory: string read fCurrentDirectory;
|
||||
property CurrentDirectory: string read fCurrentDirectory
|
||||
write fCurrentDirectory;
|
||||
property FilteredLines: TFilteredOutputLines read fFilteredOutput;
|
||||
property StopExecute: boolean read FStopExecute write SetStopExecute;
|
||||
property Lines: TOutputLines read fOutput;
|
||||
@ -210,6 +211,8 @@ begin
|
||||
inherited Create;
|
||||
fFilteredOutput:=TFilteredOutputLines.Create;
|
||||
fOutput:=TOutputLines.Create;
|
||||
fOptions:=[ofoSearchForFPCMessages,ofoSearchForMakeMessages,
|
||||
ofoMakeFilenamesAbsolute];
|
||||
Clear;
|
||||
end;
|
||||
|
||||
|
||||
@ -631,7 +631,7 @@ end;
|
||||
procedure TProjectInspectorForm.KeyUp(var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
inherited KeyDown(Key, Shift);
|
||||
ExecuteIDECommand(Self,Key,Shift,caMenuOnly);
|
||||
ExecuteIDEShortCut(Self,Key,Shift,caMenuOnly);
|
||||
end;
|
||||
|
||||
function TProjectInspectorForm.GetSelectedFile: TUnitInfo;
|
||||
|
||||
@ -419,7 +419,7 @@ end;
|
||||
procedure TUnitDependenciesView.KeyUp(var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
inherited KeyUp(Key, Shift);
|
||||
ExecuteIDECommand(Self,Key,Shift,caMenuOnly);
|
||||
ExecuteIDEShortCut(Self,Key,Shift,caMenuOnly);
|
||||
end;
|
||||
|
||||
function TUnitDependenciesView.RootValid: boolean;
|
||||
|
||||
@ -111,17 +111,20 @@ function IDEShortCut(Key1: word; Shift1: TShiftState;
|
||||
|
||||
|
||||
type
|
||||
TExecuteIDECommand = procedure(Sender: TObject;
|
||||
var Key: word; Shift: TShiftState;
|
||||
Areas: TCommandAreas) of object;
|
||||
TExecuteIDEShortCut = procedure(Sender: TObject;
|
||||
var Key: word; Shift: TShiftState;
|
||||
Areas: TCommandAreas) of object;
|
||||
TExecuteIDECommand = procedure(Sender: TObject; Command: word) of object;
|
||||
|
||||
var
|
||||
// will be set by the IDE
|
||||
OnExecuteIDEShortCut: TExecuteIDEShortCut;
|
||||
OnExecuteIDECommand: TExecuteIDECommand;
|
||||
|
||||
procedure ExecuteIDECommand(Sender: TObject; var Key: word; Shift: TShiftState;
|
||||
Areas: TCommandAreas);
|
||||
procedure ExecuteIDECommand(Sender: TObject; var Key: word; Shift: TShiftState);
|
||||
procedure ExecuteIDEShortCut(Sender: TObject; var Key: word; Shift: TShiftState;
|
||||
Areas: TCommandAreas);
|
||||
procedure ExecuteIDEShortCut(Sender: TObject; var Key: word; Shift: TShiftState);
|
||||
procedure ExecuteIDECommand(Sender: TObject; Command: word);
|
||||
|
||||
|
||||
implementation
|
||||
@ -136,16 +139,23 @@ begin
|
||||
Result.Shift2:=Shift2;
|
||||
end;
|
||||
|
||||
procedure ExecuteIDECommand(Sender: TObject; var Key: word; Shift: TShiftState;
|
||||
Areas: TCommandAreas);
|
||||
procedure ExecuteIDEShortCut(Sender: TObject; var Key: word; Shift: TShiftState;
|
||||
Areas: TCommandAreas);
|
||||
begin
|
||||
if (OnExecuteIDECommand<>nil) and (Key<>VK_UNKNOWN) then
|
||||
OnExecuteIDECommand(Sender,Key,Shift,Areas);
|
||||
OnExecuteIDEShortCut(Sender,Key,Shift,Areas);
|
||||
end;
|
||||
|
||||
procedure ExecuteIDECommand(Sender: TObject; var Key: word; Shift: TShiftState);
|
||||
procedure ExecuteIDEShortCut(Sender: TObject; var Key: word;
|
||||
Shift: TShiftState);
|
||||
begin
|
||||
OnExecuteIDECommand(Sender,Key,Shift,caMenuOnly);
|
||||
OnExecuteIDEShortCut(Sender,Key,Shift,caMenuOnly);
|
||||
end;
|
||||
|
||||
procedure ExecuteIDECommand(Sender: TObject; Command: word);
|
||||
begin
|
||||
if (OnExecuteIDECommand<>nil) and (Command<>0) then
|
||||
OnExecuteIDECommand(Sender,Command);
|
||||
end;
|
||||
|
||||
{ TIDECommandCategory }
|
||||
|
||||
@ -555,6 +555,21 @@ begin
|
||||
Result:=GetListBoxIndexAtY(Self, Y);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
function TCustomListBox.GetSelectedText: string;
|
||||
|
||||
Returns Text of all selected items, separated by LineEnding
|
||||
------------------------------------------------------------------------------}
|
||||
function TCustomListBox.GetSelectedText: string;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
Result:='';
|
||||
if ItemIndex<0 then exit;
|
||||
for i:=0 to Items.Count-1 do
|
||||
if Selected[i] then Result:=Result+Items[i]+LineEnding;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
function TCustomListBox.ItemAtPos(const Pos: TPoint; Existing: Boolean
|
||||
): Integer;
|
||||
|
||||
@ -447,6 +447,7 @@ type
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
function GetIndexAtY(Y: integer): integer;
|
||||
function GetSelectedText: string;
|
||||
function ItemAtPos(const Pos: TPoint; Existing: Boolean): Integer;
|
||||
function ItemRect(Index: Integer): TRect;
|
||||
function ItemVisible(Index: Integer): boolean;
|
||||
@ -1262,6 +1263,9 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.208 2005/06/18 08:49:32 mattias
|
||||
implemented context help system for compiler/make messages
|
||||
|
||||
Revision 1.207 2005/06/13 08:04:38 vincents
|
||||
fixed crashed with csOwnerDrawVariable combobox style (bug 934) from Jesus
|
||||
|
||||
|
||||
@ -452,7 +452,7 @@ end;
|
||||
procedure TPkgGraphExplorer.KeyUp(var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
inherited KeyUp(Key, Shift);
|
||||
ExecuteIDECommand(Self,Key,Shift,caMenuOnly);
|
||||
ExecuteIDEShortCut(Self,Key,Shift,caMenuOnly);
|
||||
end;
|
||||
|
||||
constructor TPkgGraphExplorer.Create(TheOwner: TComponent);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user