mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-16 09:19:58 +02:00
IDE: messages: menu item for open package
git-svn-id: trunk@45158 -
This commit is contained in:
parent
bbd5c7e16f
commit
30ae28a289
@ -33,10 +33,10 @@ interface
|
||||
|
||||
uses
|
||||
Math, strutils, Classes, SysUtils, UTF8Process, FileProcs, LazFileCache,
|
||||
LazUTF8Classes, LazFileUtils, LazUTF8, AvgLvlTree, SynEdit,
|
||||
LResources, Forms, Buttons, ExtCtrls, Controls, LMessages, LCLType, Graphics,
|
||||
LCLIntf, Themes, ImgList, GraphType, Menus, Clipbrd, Dialogs, StdCtrls,
|
||||
IDEExternToolIntf, IDEImagesIntf, MenuIntf, etSrcEditMarks, etQuickFixes,
|
||||
LazUTF8Classes, LazFileUtils, LazUTF8, AvgLvlTree, SynEdit, LResources, Forms,
|
||||
Buttons, ExtCtrls, Controls, LMessages, LCLType, Graphics, LCLIntf, Themes,
|
||||
ImgList, GraphType, Menus, Clipbrd, Dialogs, StdCtrls, IDEExternToolIntf,
|
||||
IDEImagesIntf, MenuIntf, PackageIntf, etSrcEditMarks, etQuickFixes,
|
||||
LazarusIDEStrConsts, EnvironmentOpts;
|
||||
|
||||
const
|
||||
@ -409,6 +409,7 @@ type
|
||||
procedure MsgCtrlPopupMenuClose(Sender: TObject);
|
||||
procedure MsgCtrlPopupMenuPopup(Sender: TObject);
|
||||
procedure OnSelectFilterClick(Sender: TObject);
|
||||
procedure OpenToolsOptionsMenuItemClick(Sender: TObject);
|
||||
procedure SaveAllToFileMenuItemClick(Sender: TObject);
|
||||
procedure SaveShownToFileMenuItemClick(Sender: TObject);
|
||||
procedure SearchEditChange(Sender: TObject);
|
||||
@ -421,6 +422,7 @@ type
|
||||
procedure UnhideMsgTypeClick(Sender: TObject);
|
||||
private
|
||||
function AllMessagesAsString(const OnlyShown: boolean): String;
|
||||
function GetAboutView: TLMsgWndView;
|
||||
function GetViews(Index: integer): TLMsgWndView;
|
||||
procedure SaveClicked(OnlyShown: boolean);
|
||||
procedure CopyAllClicked(OnlyShown: boolean);
|
||||
@ -499,7 +501,9 @@ var
|
||||
MsgFileStyleFullMenuItem: TIDEMenuCommand;
|
||||
MsgTranslateMenuItem: TIDEMenuCommand;
|
||||
MsgShowIDMenuItem: TIDEMenuCommand;
|
||||
MsgAboutToolMenuItem: TIDEMenuCommand;
|
||||
MsgAboutSection: TIDEMenuSection;
|
||||
MsgAboutToolMenuItem: TIDEMenuCommand;
|
||||
MsgOpenToolOptionsMenuItem: TIDEMenuCommand;
|
||||
|
||||
procedure RegisterStandardMessagesViewMenuItems;
|
||||
|
||||
@ -565,7 +569,12 @@ begin
|
||||
MsgFileStyleFullMenuItem:=RegisterIDEMenuCommand(Parent,'Full','Full');
|
||||
MsgTranslateMenuItem:=RegisterIDEMenuCommand(Root, 'Translate', 'Translate the English Messages');
|
||||
MsgShowIDMenuItem:=RegisterIDEMenuCommand(Root, 'ShowID', 'Show Message Type ID');
|
||||
MsgAboutToolMenuItem:=RegisterIDEMenuCommand(Root, 'About', 'About Tool');
|
||||
MsgAboutSection:=RegisterIDEMenuSection(Root,'About');
|
||||
Parent:=MsgAboutSection;
|
||||
Parent.ChildsAsSubMenu:=true;
|
||||
Parent.Caption:='About ...';
|
||||
MsgAboutToolMenuItem:=RegisterIDEMenuCommand(Parent, 'About', 'About Tool');
|
||||
MsgOpenToolOptionsMenuItem:=RegisterIDEMenuCommand(Parent, 'Open Tool Options', 'Open Tool Options');
|
||||
end;
|
||||
|
||||
function CompareHideMsgType(HideMsgType1, HideMsgType2: Pointer): integer;
|
||||
@ -3022,6 +3031,8 @@ var
|
||||
MsgType: String;
|
||||
CanHideMsgType: Boolean;
|
||||
MinUrgency: TMessageLineUrgency;
|
||||
ToolData: TIDEExternalToolData;
|
||||
ToolOptionsCaption: String;
|
||||
begin
|
||||
MessagesMenuRoot.MenuItem:=MsgCtrlPopupMenu.Items;
|
||||
MessagesMenuRoot.BeginUpdate;
|
||||
@ -3059,15 +3070,26 @@ begin
|
||||
CanHideMsgType:=ord(Line.Urgency)<ord(mluError);
|
||||
end;
|
||||
end;
|
||||
|
||||
MsgAboutToolMenuItem.Caption:='About '+View.Caption;
|
||||
MsgAboutToolMenuItem.Visible:=true;
|
||||
end else begin
|
||||
// no line selected => use last visible View
|
||||
View:=MessagesCtrl.GetLastViewWithContent;
|
||||
MsgAboutToolMenuItem.Visible:=View<>nil;
|
||||
end;
|
||||
ToolOptionsCaption:='';
|
||||
if View<>nil then
|
||||
begin
|
||||
MsgAboutToolMenuItem.Caption:='About '+View.Caption;
|
||||
MsgAboutToolMenuItem.Visible:=true;
|
||||
if View.Tool.Data is TIDEExternalToolData then begin
|
||||
ToolData:=TIDEExternalToolData(View.Tool.Data);
|
||||
if ToolData.Kind=IDEToolCompilePackage then
|
||||
ToolOptionsCaption:='Open Package '+ToolData.ModuleName;
|
||||
end;
|
||||
end else
|
||||
MsgAboutToolMenuItem.Visible:=false;
|
||||
MsgAboutToolMenuItem.OnClick:=@AboutToolMenuItemClick;
|
||||
MsgOpenToolOptionsMenuItem.Visible:=ToolOptionsCaption<>'';
|
||||
MsgOpenToolOptionsMenuItem.Caption:=ToolOptionsCaption;
|
||||
MsgOpenToolOptionsMenuItem.OnClick:=@OpenToolsOptionsMenuItemClick;
|
||||
|
||||
if CanHideMsgType then begin
|
||||
MsgHideMsgOfTypeMenuItem.Caption:='Hide all messages of type '+MsgType;
|
||||
@ -3137,6 +3159,21 @@ begin
|
||||
MessagesCtrl.ActiveFilter:=Filter;
|
||||
end;
|
||||
|
||||
procedure TMessagesFrame.OpenToolsOptionsMenuItemClick(Sender: TObject);
|
||||
var
|
||||
View: TLMsgWndView;
|
||||
ToolData: TIDEExternalToolData;
|
||||
begin
|
||||
View:=GetAboutView;
|
||||
if View=nil then exit;
|
||||
if not (View.Tool.Data is TIDEExternalToolData) then exit;
|
||||
ToolData:=TIDEExternalToolData(View.Tool.Data);
|
||||
if ToolData.Kind=IDEToolCompilePackage then begin
|
||||
PackageEditingInterface.DoOpenPackageFile(ToolData.Filename,
|
||||
[pofAddToRecent],false);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMessagesFrame.SaveAllToFileMenuItemClick(Sender: TObject);
|
||||
begin
|
||||
SaveClicked(false);
|
||||
@ -3237,6 +3274,13 @@ begin
|
||||
Result:=s;
|
||||
end;
|
||||
|
||||
function TMessagesFrame.GetAboutView: TLMsgWndView;
|
||||
begin
|
||||
Result:=MessagesCtrl.SelectedView;
|
||||
if Result=nil then
|
||||
Result:=MessagesCtrl.GetLastViewWithContent;
|
||||
end;
|
||||
|
||||
procedure TMessagesFrame.CopyMsgMenuItemClick(Sender: TObject);
|
||||
begin
|
||||
CopyMsgToClipboard(false);
|
||||
@ -3329,12 +3373,8 @@ var
|
||||
Proc: TProcessUTF8;
|
||||
Memo: TMemo;
|
||||
begin
|
||||
View:=MessagesCtrl.SelectedView;
|
||||
if View=nil then begin
|
||||
View:=MessagesCtrl.GetLastViewWithContent;
|
||||
if View=nil then exit;
|
||||
end;
|
||||
|
||||
View:=GetAboutView;
|
||||
if View=nil then exit;
|
||||
s:=View.Caption+LineEnding;
|
||||
s+=LineEnding;
|
||||
Tool:=View.Tool;
|
||||
|
Loading…
Reference in New Issue
Block a user