diff --git a/cocoa/base/AppDelegate.m b/cocoa/base/AppDelegate.m
index d3e9c045..e26de2c6 100644
--- a/cocoa/base/AppDelegate.m
+++ b/cocoa/base/AppDelegate.m
@@ -17,13 +17,13 @@ http://www.hardcoded.net/licenses/bsd_license
@implementation AppDelegateBase
- (void)awakeFromNib
{
- _resultWindow = nil;
- _directoryPanel = nil;
- _detailsPanel = nil;
- _aboutBox = nil;
- _preferencesPanel = nil;
_recentResults = [[HSRecentFiles alloc] initWithName:@"recentResults" menu:recentResultsMenu];
[_recentResults setDelegate:self];
+ _resultWindow = [self createResultWindow];
+ _directoryPanel = [self createDirectoryPanel];
+ _detailsPanel = nil; // Lazily loaded
+ _aboutBox = nil; // Lazily loaded
+ _preferencesPanel = nil; // Lazily loaded
[[[self directoryPanel] window] makeKeyAndOrderFront:self];
}
@@ -54,15 +54,11 @@ http://www.hardcoded.net/licenses/bsd_license
/* Public */
- (ResultWindowBase *)resultWindow
{
- if (!_resultWindow)
- _resultWindow = [self createResultWindow];
return _resultWindow;
}
- (DirectoryPanel *)directoryPanel
{
- if (!_directoryPanel)
- _directoryPanel = [self createDirectoryPanel];
return _directoryPanel;
}
diff --git a/cocoa/base/DirectoryPanel.h b/cocoa/base/DirectoryPanel.h
index 255345d4..46805520 100644
--- a/cocoa/base/DirectoryPanel.h
+++ b/cocoa/base/DirectoryPanel.h
@@ -12,23 +12,28 @@ http://www.hardcoded.net/licenses/bsd_license
#import "DirectoryOutline.h"
#import "PyDupeGuru.h"
+@class AppDelegateBase;
+
@interface DirectoryPanel : NSWindowController
{
IBOutlet NSPopUpButton *addButtonPopUp;
+ IBOutlet NSPopUpButton *loadRecentButtonPopUp;
IBOutlet HSOutlineView *outlineView;
IBOutlet NSButton *removeButton;
+ AppDelegateBase *_app;
PyDupeGuruBase *_py;
HSRecentFiles *_recentDirectories;
DirectoryOutline *outline;
BOOL _alwaysShowPopUp;
}
-- (id)initWithParentApp:(id)aParentApp;
+- (id)initWithParentApp:(AppDelegateBase *)aParentApp;
- (void)fillPopUpMenu; // Virtual
- (IBAction)askForDirectory:(id)sender;
- (IBAction)popupAddDirectoryMenu:(id)sender;
+- (IBAction)popupLoadRecentMenu:(id)sender;
- (IBAction)removeSelectedDirectory:(id)sender;
- (void)addDirectory:(NSString *)directory;
diff --git a/cocoa/base/DirectoryPanel.m b/cocoa/base/DirectoryPanel.m
index dbe6e336..88bf0aa0 100644
--- a/cocoa/base/DirectoryPanel.m
+++ b/cocoa/base/DirectoryPanel.m
@@ -12,12 +12,12 @@ http://www.hardcoded.net/licenses/bsd_license
#import "AppDelegate.h"
@implementation DirectoryPanel
-- (id)initWithParentApp:(id)aParentApp
+- (id)initWithParentApp:(AppDelegateBase *)aParentApp
{
self = [super initWithWindowNibName:@"DirectoryPanel"];
[self window];
- AppDelegateBase *app = aParentApp;
- _py = [app py];
+ _app = aParentApp;
+ _py = [_app py];
_alwaysShowPopUp = NO;
[self fillPopUpMenu];
_recentDirectories = [[HSRecentFiles alloc] initWithName:@"recentDirectories" menu:[addButtonPopUp menu]];
@@ -74,6 +74,25 @@ http://www.hardcoded.net/licenses/bsd_license
}
}
+- (IBAction)popupLoadRecentMenu:(id)sender
+{
+ if ([[[_app recentResults] filepaths] count] > 0) {
+ NSMenu *m = [loadRecentButtonPopUp menu];
+ while ([m numberOfItems] > 0) {
+ [m removeItemAtIndex:0];
+ }
+ NSMenuItem *mi = [m addItemWithTitle:@"Load from file..." action:@selector(loadResults:) keyEquivalent:@""];
+ [mi setTarget:_app];
+ [m addItem:[NSMenuItem separatorItem]];
+ [[_app recentResults] fillMenu:m];
+ [loadRecentButtonPopUp selectItem:nil];
+ [[loadRecentButtonPopUp cell] performClickWithFrame:[sender frame] inView:[sender superview]];
+ }
+ else {
+ [_app loadResults:nil];
+ }
+}
+
- (IBAction)removeSelectedDirectory:(id)sender
{
[[self window] makeKeyAndOrderFront:nil];
diff --git a/cocoa/base/xib/DirectoryPanel.xib b/cocoa/base/xib/DirectoryPanel.xib
index 4e5cba20..f5527a67 100644
--- a/cocoa/base/xib/DirectoryPanel.xib
+++ b/cocoa/base/xib/DirectoryPanel.xib
@@ -306,7 +306,7 @@
109199615
1
-
+
289
@@ -424,6 +461,26 @@
+
+
+ 289
+ {{144, 12}, {120, 32}}
+
+ YES
+
+ 67239424
+ 134217728
+ Load Results
+
+
+ -2038284033
+ 129
+
+
+ 200
+ 25
+
+
{369, 294}
@@ -501,6 +558,22 @@
69
+
+
+ loadRecentButtonPopUp
+
+
+
+ 77
+
+
+
+ popupLoadRecentMenu:
+
+
+
+ 78
+
@@ -552,6 +625,8 @@
+
+
@@ -732,6 +807,43 @@
+
+ 72
+
+
+ YES
+
+
+
+
+
+ 73
+
+
+
+
+ 74
+
+
+ YES
+
+
+
+
+
+ 75
+
+
+ YES
+
+
+
+
+
+ 76
+
+
+
@@ -789,6 +901,16 @@
7.ImportedFromIB2
70.IBPluginDependency
71.IBPluginDependency
+ 72.IBPluginDependency
+ 72.IBViewBoundsToFrameTransform
+ 73.IBPluginDependency
+ 74.IBPluginDependency
+ 74.IBViewBoundsToFrameTransform
+ 74.ImportedFromIB2
+ 75.IBPluginDependency
+ 76.IBEditorWindowLastContentRect
+ 76.IBPluginDependency
+ 76.ImportedFromIB2
8.IBEditorWindowLastContentRect
8.IBPluginDependency
8.ImportedFromIB2
@@ -851,11 +973,25 @@
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
- P4AAAL+AAABCsgAAwigAAA
+ P4AAAL+AAABCsgAAwiAAAA
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
+ com.apple.InterfaceBuilder.CocoaPlugin
+
+ P4AAAL+AAABDHAAAwigAAA
+
+ com.apple.InterfaceBuilder.CocoaPlugin
+ com.apple.InterfaceBuilder.CocoaPlugin
+
+ P4AAAL+AAABCvAAAwgwAAA
+
+
+ com.apple.InterfaceBuilder.CocoaPlugin
+ {{241, 510}, {64, 6}}
+ com.apple.InterfaceBuilder.CocoaPlugin
+
{{95, 586}, {197, 33}}
com.apple.InterfaceBuilder.CocoaPlugin
@@ -877,7 +1013,7 @@
- 71
+ 78
@@ -1012,6 +1148,7 @@
YES
askForDirectory:
popupAddDirectoryMenu:
+ popupLoadRecentMenu:
removeSelectedDirectory:
@@ -1019,6 +1156,7 @@
id
id
id
+ id
@@ -1027,6 +1165,7 @@
YES
askForDirectory:
popupAddDirectoryMenu:
+ popupLoadRecentMenu:
removeSelectedDirectory:
@@ -1039,6 +1178,10 @@
popupAddDirectoryMenu:
id
+
+ popupLoadRecentMenu:
+ id
+
removeSelectedDirectory:
id
@@ -1050,12 +1193,14 @@
YES
addButtonPopUp
+ loadRecentButtonPopUp
outlineView
removeButton
YES
NSPopUpButton
+ NSPopUpButton
HSOutlineView
NSButton
@@ -1065,6 +1210,7 @@
YES
addButtonPopUp
+ loadRecentButtonPopUp
outlineView
removeButton
@@ -1074,6 +1220,10 @@
addButtonPopUp
NSPopUpButton
+
+ loadRecentButtonPopUp
+ NSPopUpButton
+
outlineView
HSOutlineView
@@ -1705,7 +1855,7 @@
YES
- ../../me/dupeguru.xcodeproj
+ ../../se/dupeguru.xcodeproj
3
YES