|
@@ -8,7 +8,7 @@ interface
|
|
uses
|
|
uses
|
|
Classes, SysUtils,
|
|
Classes, SysUtils,
|
|
Forms, Menus,
|
|
Forms, Menus,
|
|
- fMain, uMyDarwin,
|
|
|
|
|
|
+ fMain, uMyDarwin, uDCUtils,
|
|
uFileView, uBriefFileView, uColumnsFileView, uThumbFileView,
|
|
uFileView, uBriefFileView, uColumnsFileView, uThumbFileView,
|
|
CocoaAll, CocoaConfig, CocoaToolBar, Cocoa_Extra;
|
|
CocoaAll, CocoaConfig, CocoaToolBar, Cocoa_Extra;
|
|
|
|
|
|
@@ -68,6 +68,11 @@ begin
|
|
showMacOSAirDropDialog;
|
|
showMacOSAirDropDialog;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure quickLookAction( const Sender: id );
|
|
|
|
+begin
|
|
|
|
+ showQuickLookPanel;
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure finderRevealAction( const Sender: id );
|
|
procedure finderRevealAction( const Sender: id );
|
|
begin
|
|
begin
|
|
performMacOSService( 'Finder/Reveal' );
|
|
performMacOSService( 'Finder/Reveal' );
|
|
@@ -78,17 +83,16 @@ begin
|
|
performMacOSService( 'Finder/Show Info' );
|
|
performMacOSService( 'Finder/Show Info' );
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure quickLookAction( const Sender: id );
|
|
|
|
-begin
|
|
|
|
- showQuickLookPanel;
|
|
|
|
-end;
|
|
|
|
-
|
|
|
|
|
|
|
|
type
|
|
type
|
|
|
|
+
|
|
|
|
+ { TToolBarMenuHandler }
|
|
|
|
+
|
|
TToolBarMenuHandler = class
|
|
TToolBarMenuHandler = class
|
|
public
|
|
public
|
|
procedure showFavoriteTabs( Sender: TObject );
|
|
procedure showFavoriteTabs( Sender: TObject );
|
|
procedure showHotlist( Sender: TObject );
|
|
procedure showHotlist( Sender: TObject );
|
|
|
|
+ procedure goToFolder( Sender: TObject );
|
|
end;
|
|
end;
|
|
|
|
|
|
var
|
|
var
|
|
@@ -104,7 +108,70 @@ begin
|
|
frmMain.Commands.cm_LoadFavoriteTabs(['position=cursor'])
|
|
frmMain.Commands.cm_LoadFavoriteTabs(['position=cursor'])
|
|
end;
|
|
end;
|
|
|
|
|
|
-function onGetMainFormMenu: TMenuItem;
|
|
|
|
|
|
+procedure TToolBarMenuHandler.goToFolder(Sender: TObject);
|
|
|
|
+const
|
|
|
|
+ folders: TStringArray = (
|
|
|
|
+ '~/Documents',
|
|
|
|
+ '~/Desktop',
|
|
|
|
+ '~',
|
|
|
|
+ '~/Pictures',
|
|
|
|
+ '~/Movies',
|
|
|
|
+ '~/Music',
|
|
|
|
+
|
|
|
|
+ '~/Downloads',
|
|
|
|
+ '~/Library',
|
|
|
|
+ '/Applications',
|
|
|
|
+ '/Applications/Utilities'
|
|
|
|
+ );
|
|
|
|
+var
|
|
|
|
+ menuItem: TMenuItem absolute Sender;
|
|
|
|
+ path: String;
|
|
|
|
+begin
|
|
|
|
+ path:= uDCUtils.ReplaceTilde( folders[menuItem.Tag] );
|
|
|
|
+ frmMain.Commands.cm_ChangeDir( [path] );
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function onGetFolderMenu: TMenuItem;
|
|
|
|
+var
|
|
|
|
+ menu: TMenuItem;
|
|
|
|
+ tag: PtrInt = 0;
|
|
|
|
+
|
|
|
|
+ function newItem( caption: String ): TMenuItem;
|
|
|
|
+ begin
|
|
|
|
+ Result:= TMenuItem.Create( menu );
|
|
|
|
+ Result.Caption:= caption;
|
|
|
|
+ Result.onClick:= @toolBarMenuHandler.goToFolder;
|
|
|
|
+ Result.Tag:= tag;
|
|
|
|
+ inc( tag );
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+begin
|
|
|
|
+ menu:= TMenuItem.Create( frmMain );
|
|
|
|
+ menu.Add( newItem(' Documents') );
|
|
|
|
+ menu.Add( newItem(' Desktop') );
|
|
|
|
+ menu.Add( newItem(' Home') );
|
|
|
|
+ menu.Add( newItem(' Pictures') );
|
|
|
|
+ menu.Add( newItem(' Movies') );
|
|
|
|
+ menu.Add( newItem(' Music') );
|
|
|
|
+ menu.AddSeparator;
|
|
|
|
+ menu.Add( newItem(' Downloads') );
|
|
|
|
+ menu.Add( newItem(' Library') );
|
|
|
|
+ menu.Add( newItem(' Applications') );
|
|
|
|
+ menu.Add( newItem(' Utilities') );
|
|
|
|
+ Result:= menu;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure showFolderMenu( const Sender: id );
|
|
|
|
+var
|
|
|
|
+ popupMenu: TPopupMenu;
|
|
|
|
+begin
|
|
|
|
+ popupMenu:= TPopupMenu.Create( nil );
|
|
|
|
+ popupMenu.Items.Assign( onGetFolderMenu );
|
|
|
|
+ popupMenu.PopUp;
|
|
|
|
+ popupMenu.Free;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function onGetCommandMenu: TMenuItem;
|
|
var
|
|
var
|
|
menu: TMenuItem;
|
|
menu: TMenuItem;
|
|
|
|
|
|
@@ -130,8 +197,6 @@ var
|
|
end;
|
|
end;
|
|
|
|
|
|
begin
|
|
begin
|
|
- toolBarMenuHandler:= TToolBarMenuHandler.Create;
|
|
|
|
-
|
|
|
|
menu:= TMenuItem.Create( frmMain );
|
|
menu:= TMenuItem.Create( frmMain );
|
|
menu.Add( toItem(frmMain.miMultiRename) );
|
|
menu.Add( toItem(frmMain.miMultiRename) );
|
|
menu.Add( toItem(frmMain.mnuFilesCmpCnt) );
|
|
menu.Add( toItem(frmMain.mnuFilesCmpCnt) );
|
|
@@ -283,6 +348,30 @@ const
|
|
);
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
+ quickLookItemConfig: TCocoaConfigToolBarItem = (
|
|
|
|
+ identifier: 'MainForm.QuickLook';
|
|
|
|
+ priority: NSToolbarItemVisibilityPriorityStandard;
|
|
|
|
+ navigational: False;
|
|
|
|
+ iconName: 'eye';
|
|
|
|
+ title: 'Preview';
|
|
|
|
+ tips: 'Preview...';
|
|
|
|
+ bordered: True;
|
|
|
|
+ onAction: @quickLookAction;
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ goItemConfig: TCocoaConfigToolBarItemMenu = (
|
|
|
|
+ identifier: 'MainForm.Go';
|
|
|
|
+ iconName: 'folder';
|
|
|
|
+ title: 'Go';
|
|
|
|
+ tips: 'Go...';
|
|
|
|
+ bordered: True;
|
|
|
|
+ onAction: @showFolderMenu;
|
|
|
|
+
|
|
|
|
+ showsIndicator: False;
|
|
|
|
+ menu: nil;
|
|
|
|
+ onGetMenu: @onGetFolderMenu;
|
|
|
|
+ );
|
|
|
|
+
|
|
finderRevealItemConfig: TCocoaConfigToolBarItem = (
|
|
finderRevealItemConfig: TCocoaConfigToolBarItem = (
|
|
identifier: 'MainForm.FinderReveal';
|
|
identifier: 'MainForm.FinderReveal';
|
|
priority: NSToolbarItemVisibilityPriorityStandard;
|
|
priority: NSToolbarItemVisibilityPriorityStandard;
|
|
@@ -305,29 +394,18 @@ const
|
|
onAction: @finderInfoAction;
|
|
onAction: @finderInfoAction;
|
|
);
|
|
);
|
|
|
|
|
|
- quickLookItemConfig: TCocoaConfigToolBarItem = (
|
|
|
|
- identifier: 'MainForm.QuickLook';
|
|
|
|
- priority: NSToolbarItemVisibilityPriorityStandard;
|
|
|
|
- navigational: False;
|
|
|
|
- iconName: 'eye';
|
|
|
|
- title: 'Preview';
|
|
|
|
- tips: 'Preview...';
|
|
|
|
- bordered: True;
|
|
|
|
- onAction: @quickLookAction;
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
|
|
|
|
- menuItemConfig: TCocoaConfigToolBarItemMenu = (
|
|
|
|
- identifier: 'MainForm.Menu';
|
|
|
|
|
|
+ commandItemConfig: TCocoaConfigToolBarItemMenu = (
|
|
|
|
+ identifier: 'MainForm.Command';
|
|
iconName: 'ellipsis.circle';
|
|
iconName: 'ellipsis.circle';
|
|
- title: 'Menu';
|
|
|
|
|
|
+ title: 'Command';
|
|
tips: '';
|
|
tips: '';
|
|
bordered: True;
|
|
bordered: True;
|
|
onAction: nil;
|
|
onAction: nil;
|
|
|
|
|
|
showsIndicator: True;
|
|
showsIndicator: True;
|
|
menu: nil;
|
|
menu: nil;
|
|
- onGetMenu: @onGetMainFormMenu;
|
|
|
|
|
|
+ onGetMenu: @onGetCommandMenu;
|
|
);
|
|
);
|
|
|
|
|
|
|
|
|
|
@@ -348,7 +426,7 @@ const
|
|
navigational: False;
|
|
navigational: False;
|
|
iconName: 'terminal';
|
|
iconName: 'terminal';
|
|
title: 'Terminal';
|
|
title: 'Terminal';
|
|
- tips: 'Run Terminal';
|
|
|
|
|
|
+ tips: 'Open in Terminal';
|
|
bordered: True;
|
|
bordered: True;
|
|
onAction: @terminalAction;
|
|
onAction: @terminalAction;
|
|
);
|
|
);
|
|
@@ -394,11 +472,12 @@ const
|
|
'MainForm.Share',
|
|
'MainForm.Share',
|
|
'MainForm.AirDrop',
|
|
'MainForm.AirDrop',
|
|
'NSToolbarFlexibleSpaceItem',
|
|
'NSToolbarFlexibleSpaceItem',
|
|
|
|
+ 'MainForm.QuickLook',
|
|
|
|
+ 'MainForm.Go',
|
|
'MainForm.FinderReveal',
|
|
'MainForm.FinderReveal',
|
|
'MainForm.FinderInfo',
|
|
'MainForm.FinderInfo',
|
|
- 'MainForm.QuickLook',
|
|
|
|
'NSToolbarFlexibleSpaceItem',
|
|
'NSToolbarFlexibleSpaceItem',
|
|
- 'MainForm.Menu',
|
|
|
|
|
|
+ 'MainForm.Command',
|
|
'NSToolbarFlexibleSpaceItem',
|
|
'NSToolbarFlexibleSpaceItem',
|
|
'MainForm.Terminal',
|
|
'MainForm.Terminal',
|
|
'MainForm.Refresh',
|
|
'MainForm.Refresh',
|
|
@@ -412,10 +491,11 @@ const
|
|
'MainForm.ShowMode',
|
|
'MainForm.ShowMode',
|
|
'MainForm.Share',
|
|
'MainForm.Share',
|
|
'MainForm.AirDrop',
|
|
'MainForm.AirDrop',
|
|
|
|
+ 'MainForm.QuickLook',
|
|
|
|
+ 'MainForm.Go',
|
|
'MainForm.FinderReveal',
|
|
'MainForm.FinderReveal',
|
|
'MainForm.FinderInfo',
|
|
'MainForm.FinderInfo',
|
|
- 'MainForm.QuickLook',
|
|
|
|
- 'MainForm.Menu',
|
|
|
|
|
|
+ 'MainForm.Command',
|
|
'MainForm.Terminal',
|
|
'MainForm.Terminal',
|
|
'MainForm.Refresh',
|
|
'MainForm.Refresh',
|
|
'MainForm.SearchFiles'
|
|
'MainForm.SearchFiles'
|
|
@@ -440,23 +520,29 @@ begin
|
|
TCocoaToolBarUtils.toClass(showModeItemConfig),
|
|
TCocoaToolBarUtils.toClass(showModeItemConfig),
|
|
TCocoaToolBarUtils.toClass(shareItemConfig),
|
|
TCocoaToolBarUtils.toClass(shareItemConfig),
|
|
TCocoaToolBarUtils.toClass(airdropItemConfig),
|
|
TCocoaToolBarUtils.toClass(airdropItemConfig),
|
|
- TCocoaToolBarUtils.toClass(menuItemConfig),
|
|
|
|
|
|
+ TCocoaToolBarUtils.toClass(commandItemConfig),
|
|
|
|
+ TCocoaToolBarUtils.toClass(quickLookItemConfig),
|
|
|
|
+ TCocoaToolBarUtils.toClass(goItemConfig),
|
|
TCocoaToolBarUtils.toClass(finderRevealItemConfig),
|
|
TCocoaToolBarUtils.toClass(finderRevealItemConfig),
|
|
TCocoaToolBarUtils.toClass(finderInfoItemConfig),
|
|
TCocoaToolBarUtils.toClass(finderInfoItemConfig),
|
|
- TCocoaToolBarUtils.toClass(quickLookItemConfig),
|
|
|
|
TCocoaToolBarUtils.toClass(terminalItemConfig),
|
|
TCocoaToolBarUtils.toClass(terminalItemConfig),
|
|
TCocoaToolBarUtils.toClass(refreshItemConfig),
|
|
TCocoaToolBarUtils.toClass(refreshItemConfig),
|
|
TCocoaToolBarUtils.toClass(searchFilesItemConfig)
|
|
TCocoaToolBarUtils.toClass(searchFilesItemConfig)
|
|
];
|
|
];
|
|
|
|
|
|
CocoaConfigForms:= [ mainFormConfig ];
|
|
CocoaConfigForms:= [ mainFormConfig ];
|
|
|
|
+end;
|
|
|
|
|
|
|
|
+procedure init;
|
|
|
|
+begin
|
|
fMain.onFileViewUpdated:= @onFileViewUpdated;
|
|
fMain.onFileViewUpdated:= @onFileViewUpdated;
|
|
|
|
+ toolBarMenuHandler:= TToolBarMenuHandler.Create;
|
|
|
|
+ initCocoaModernFormConfig;
|
|
end;
|
|
end;
|
|
|
|
|
|
initialization
|
|
initialization
|
|
if NSAppKitVersionNumber >= NSAppKitVersionNumber11_0 then
|
|
if NSAppKitVersionNumber >= NSAppKitVersionNumber11_0 then
|
|
- initCocoaModernFormConfig;
|
|
|
|
|
|
+ init;
|
|
|
|
|
|
end.
|
|
end.
|
|
|
|
|