mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-28 10:02:14 +00:00
UPD: refactoring onMainMenuCreate from uMyDarwin to uDarwinApplication
This commit is contained in:
parent
693f887652
commit
7f80cfcb70
3 changed files with 18 additions and 17 deletions
|
|
@ -2965,7 +2965,7 @@ constructor TfrmMain.Create(TheOwner: TComponent);
|
|||
begin
|
||||
CocoaConfigMenu.appMenu.aboutItem:= mnuHelpAbout;
|
||||
CocoaConfigMenu.appMenu.preferencesItem:= mnuConfigOptions;
|
||||
CocoaConfigMenu.appMenu.onCreate:= @onMainMenuCreate;
|
||||
CocoaConfigMenu.appMenu.onCreate:= @darwinOnMainMenuCreate;
|
||||
end;
|
||||
|
||||
procedure setMacOSDockMenu();
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ interface
|
|||
|
||||
uses
|
||||
Classes, SysUtils, fgl,
|
||||
MacOSAll, CocoaAll, CocoaInt, Cocoa_Extra, CocoaUtils, CocoaConst,
|
||||
MacOSAll, CocoaAll,
|
||||
CocoaInt, CocoaPrivate, Cocoa_Extra, CocoaMenus, CocoaUtils, CocoaConst,
|
||||
uDarwinUtil;
|
||||
|
||||
type
|
||||
|
|
@ -67,6 +68,8 @@ type
|
|||
class procedure openNewInstance;
|
||||
end;
|
||||
|
||||
procedure darwinOnMainMenuCreate( menu: NSMenu );
|
||||
|
||||
implementation
|
||||
|
||||
{ TDCCocoaApplication }
|
||||
|
|
@ -258,6 +261,19 @@ begin
|
|||
NSWorkspace.sharedWorkspace.openURL( url );
|
||||
end;
|
||||
|
||||
procedure darwinOnMainMenuCreate( menu: NSMenu );
|
||||
var
|
||||
lclForm: TObject;
|
||||
keyWindow: NSWindow;
|
||||
begin
|
||||
lclForm:= nil;
|
||||
keyWindow:= NSApplication(NSApp).keyWindow;
|
||||
if keyWindow <> nil then
|
||||
lclForm:= keyWindow.lclGetTarget;
|
||||
if (lclForm=nil) or (lclForm.ClassName='TfrmMain') then
|
||||
AttachEditMenu( menu, menu.numberOfItems, CocoaConst.NSSTR_EDIT_MENU );
|
||||
end;
|
||||
|
||||
initialization
|
||||
TDarwinApplicationUtil.init;
|
||||
|
||||
|
|
|
|||
|
|
@ -39,8 +39,6 @@ uses
|
|||
const
|
||||
FINDER_FAVORITE_TAGS_MENU_ITEM_CAPTION = #$EF#$BF#$BC'FinderFavoriteTags';
|
||||
|
||||
procedure onMainMenuCreate( menu: NSMenu );
|
||||
|
||||
type
|
||||
|
||||
{ TMacosServiceMenuHelper }
|
||||
|
|
@ -66,19 +64,6 @@ implementation
|
|||
uses
|
||||
DynLibs;
|
||||
|
||||
procedure onMainMenuCreate( menu: NSMenu );
|
||||
var
|
||||
lclForm: TObject;
|
||||
keyWindow: NSWindow;
|
||||
begin
|
||||
lclForm:= nil;
|
||||
keyWindow:= NSApplication(NSApp).keyWindow;
|
||||
if keyWindow <> nil then
|
||||
lclForm:= keyWindow.lclGetTarget;
|
||||
if (lclForm=nil) or (lclForm.ClassName='TfrmMain') then
|
||||
AttachEditMenu( menu, menu.numberOfItems, CocoaConst.NSSTR_EDIT_MENU );
|
||||
end;
|
||||
|
||||
procedure TMacosServiceMenuHelper.attachSystemMenu(Sender: TObject);
|
||||
begin
|
||||
self.attachServicesMenu( Sender );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue