mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: Modern Form Style - Reveal In Finder Control for macOS 11+
This commit is contained in:
parent
cc0bb25644
commit
ef764c8ae9
2 changed files with 52 additions and 20 deletions
|
|
@ -63,6 +63,11 @@ begin
|
|||
showMacOSAirDropDialog;
|
||||
end;
|
||||
|
||||
procedure finderRevealAction( const Sender: id );
|
||||
begin
|
||||
performMacOSService( 'Finder/Reveal' );
|
||||
end;
|
||||
|
||||
procedure swapPanelsAction( const Sender: id );
|
||||
begin
|
||||
frmMain.Commands.cm_Exchange([]);
|
||||
|
|
@ -169,6 +174,17 @@ const
|
|||
);
|
||||
|
||||
|
||||
finderRevealItemConfig: TCocoaConfigToolBarItem = (
|
||||
identifier: 'MainForm.FinderReveal';
|
||||
priority: NSToolbarItemVisibilityPriorityStandard;
|
||||
navigational: False;
|
||||
iconName: 'faceid';
|
||||
title: 'Reveal in Finder';
|
||||
tips: 'Reveal in Finder';
|
||||
bordered: True;
|
||||
onAction: @finderRevealAction;
|
||||
);
|
||||
|
||||
refreshItemConfig: TCocoaConfigToolBarItem = (
|
||||
identifier: 'MainForm.Refresh';
|
||||
priority: NSToolbarItemVisibilityPriorityStandard;
|
||||
|
|
@ -231,6 +247,7 @@ const
|
|||
'MainForm.Share',
|
||||
'MainForm.AirDrop',
|
||||
'NSToolbarFlexibleSpaceItem',
|
||||
'MainForm.FinderReveal',
|
||||
'MainForm.Refresh',
|
||||
'MainForm.MultiRename',
|
||||
'MainForm.SwapPanels'
|
||||
|
|
@ -242,6 +259,7 @@ const
|
|||
'MainForm.ShowMode',
|
||||
'MainForm.Share',
|
||||
'MainForm.AirDrop',
|
||||
'MainForm.FinderReveal',
|
||||
'MainForm.Refresh',
|
||||
'MainForm.MultiRename',
|
||||
'MainForm.SwapPanels'
|
||||
|
|
@ -265,6 +283,7 @@ begin
|
|||
TCocoaToolBarUtils.toClass(showModeItemConfig),
|
||||
TCocoaToolBarUtils.toClass(shareItemConfig),
|
||||
TCocoaToolBarUtils.toClass(airdropItemConfig),
|
||||
TCocoaToolBarUtils.toClass(finderRevealItemConfig),
|
||||
TCocoaToolBarUtils.toClass(swapPanelsItemConfig),
|
||||
TCocoaToolBarUtils.toClass(refreshItemConfig),
|
||||
TCocoaToolBarUtils.toClass(multiRenameItemConfig)
|
||||
|
|
|
|||
|
|
@ -153,6 +153,8 @@ procedure InitNSServiceProvider(
|
|||
isReadyFunc: TNSServiceMenuIsReady;
|
||||
getFilenamesFunc: TNSServiceMenuGetFilenames );
|
||||
|
||||
procedure performMacOSService( serviceName: String );
|
||||
|
||||
// MacOS Sharing
|
||||
procedure showMacOSSharingServiceMenu;
|
||||
procedure showMacOSAirDropDialog;
|
||||
|
|
@ -336,6 +338,28 @@ begin
|
|||
Result:= true;
|
||||
end;
|
||||
|
||||
procedure TDCCocoaApplication.observeValueForKeyPath_ofObject_change_context(
|
||||
keyPath: NSString; object_: id; change: NSDictionary; context: pointer);
|
||||
begin
|
||||
Inherited observeValueForKeyPath_ofObject_change_context( keyPath, object_, change, context );
|
||||
if keyPath.isEqualToString(NSSTR('effectiveAppearance')) then
|
||||
begin
|
||||
NSAppearance.setCurrentAppearance( self.appearance );
|
||||
if Assigned(NSThemeChangedHandler) then NSThemeChangedHandler;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure InitNSThemeChangedObserver( handler: TNSThemeChangedHandler );
|
||||
begin
|
||||
if Assigned(NSThemeChangedHandler) then exit;
|
||||
|
||||
NSApp.addObserver_forKeyPath_options_context(
|
||||
NSApp, NSSTR('effectiveAppearance'), 0, nil );
|
||||
|
||||
NSThemeChangedHandler:= handler;
|
||||
end;
|
||||
|
||||
|
||||
procedure showMacOSSharingServiceMenu;
|
||||
var
|
||||
picker: NSSharingServicePicker;
|
||||
|
|
@ -380,29 +404,18 @@ begin
|
|||
service.performWithItems( cocoaArray );
|
||||
end;
|
||||
|
||||
procedure TDCCocoaApplication.observeValueForKeyPath_ofObject_change_context(
|
||||
keyPath: NSString; object_: id; change: NSDictionary; context: pointer);
|
||||
procedure performMacOSService( serviceName: String );
|
||||
var
|
||||
pboard: NSPasteboard;
|
||||
ok: Boolean;
|
||||
begin
|
||||
Inherited observeValueForKeyPath_ofObject_change_context( keyPath, object_, change, context );
|
||||
if keyPath.isEqualToString(NSSTR('effectiveAppearance')) then
|
||||
begin
|
||||
NSAppearance.setCurrentAppearance( self.appearance );
|
||||
if Assigned(NSThemeChangedHandler) then NSThemeChangedHandler;
|
||||
end;
|
||||
pboard:= NSPasteboard.pasteboardWithUniqueName;
|
||||
ok:= TDCCocoaApplication(NSApp).writeSelectionToPasteboard_types(
|
||||
pboard , nil );
|
||||
if ok then
|
||||
NSPerformService( NSSTR(serviceName), pboard );
|
||||
end;
|
||||
|
||||
procedure InitNSThemeChangedObserver( handler: TNSThemeChangedHandler );
|
||||
begin
|
||||
if Assigned(NSThemeChangedHandler) then exit;
|
||||
|
||||
NSApp.addObserver_forKeyPath_options_context(
|
||||
NSApp, NSSTR('effectiveAppearance'), 0, nil );
|
||||
|
||||
NSThemeChangedHandler:= handler;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
function NSArrayToList(const theArray:NSArray): TStringList;
|
||||
var
|
||||
i: Integer;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue