--- /dev/null
+//
+// AnselGalleryViewItem.h
+// iPhoto2Ansel
+//
+// Created by Michael Rubinsky on 5/7/09.
+// Copyright 2009 __MyCompanyName__. All rights reserved.
+//
+#import <Cocoa/Cocoa.h>
+#import <Quartz/Quartz.h>
+
+@interface AnselGalleryViewItem: NSObject
+{
+ NSURL *image;
+ NSString *imageID;
+ NSString *imageTitle;
+ NSCalendarDate *imageDate;
+}
+
+@property(readwrite,copy) NSURL * image;
+@property(readwrite,copy) NSString * imageID;
+
+- (id)initWithURL: (NSURL *)theUrl withTitle: (NSString *)theTitle withDate: (NSDate *)theDate;
+
+#pragma mark -
+#pragma mark Required Methods IKImageBrowserItem Informal Protocol
+- (NSString *)imageUID;
+- (NSString *)imageRepresentationType;
+- (id)imageRepresentation;
+
+- (NSString *)imageTitle;
+- (NSString *)imageSubtitle;
+
+@end
+
--- /dev/null
+//
+// AnselGalleryViewItem.m
+// iPhoto2Ansel
+//
+// Implementation of the IKImageBrowserItem protocol
+
+// Created by Michael Rubinsky on 5/7/09.
+// Copyright 2009 __MyCompanyName__. All rights reserved.
+//
+
+#import "AnselGalleryViewItem.h"
+
+@implementation AnselGalleryViewItem
+@synthesize image;
+@synthesize imageID;
+
+- (id)initWithURL: (NSURL *)theURL
+ withTitle: (NSString *)theTitle
+ withDate: (NSDate *)theDate
+{
+ [super init];
+ image = [theURL retain];
+ imageID = [[theURL absoluteString] retain];
+ imageTitle = [theTitle retain];
+ imageDate = [theDate retain];
+ return self;
+}
+
+- (void)dealloc
+{
+ [image release];
+ [imageID release];
+ [imageTitle release];
+ [imageDate release];
+ [super dealloc];
+}
+
+#pragma mark
+#pragma mark Required methods
+- (NSString *)imageUID
+{
+ return imageID;
+}
+
+- (NSString *)imageRepresentationType
+{
+ return IKImageBrowserNSURLRepresentationType;
+}
+
+- (id)imageRepresentation
+{
+ return [[image retain] autorelease];
+}
+
+#pragma mark
+#pragma mark Optional methods.
+- (NSString *)imageTitle
+{
+ return imageTitle;
+}
+
+- (NSString *)imageSubtitle
+{
+ return [imageDate description];
+}
+
+@end
#import <Cocoa/Cocoa.h>
#import <Quartz/Quartz.h>
-#import <Foundation/Foundation.h>
+
#import "ApertureExportManager.h"
#import "ApertureExportPlugIn.h"
// The structure used to pass all progress information back to Aperture
ApertureExportProgress exportProgress;
+ // TURAnsel objects
+ TURAnselGallery *_currentGallery;
+ TURAnsel *_anselController;
+
// Outlets to your plug-ins user interface
IBOutlet NSView *settingsView;
IBOutlet NSView *firstView;
IBOutlet NSWindow *mviewGallerySheet;
IBOutlet NSButton *closeGalleryView;
IBOutlet IKImageBrowserView *browserView;
+ NSMutableArray *_browserData;
+ // Flags, counters etc...
BOOL cancelExport;
- TURAnselGallery *_currentGallery;
int _currentImageCount;
- TURAnsel *_anselController;
- NSMutableArray *_browserData;
BOOL isExporting;
}
#import "ApertureToAnselExportPlugin.h"
#import "TURAnsel.h"
#import "TURAnselGallery.h"
+#import "TURAnselGalleryPanelController.h"
+#import "AnselGalleryViewItem.h"
@interface ApertureToAnselExportPlugin (PrivateAPI)
- (void)showNewServerSheet;
}
}
}
+
+#pragma mark -
+#pragma mark Actions
// Server setup sheet
-(IBAction)doAddServer: (id)sender
{
- // TODO: Sanity checks
NSDictionary *newServer = [[NSDictionary alloc] initWithObjectsAndKeys:
[mServerSheetServerNickName stringValue], TURAnselServerNickKey,
[mServerSheetHostURL stringValue], TURAnselServerEndpointKey,
}
}
+// Show the gallery's image browser
+- (IBAction)clickViewGallery: (id)sender
+{
+ [spinner startAnimation: self];
+ [self setStatusText: @"Getting image list..."];
+ NSMutableArray *images = [_currentGallery listImages];
+ if ([images count] == 0) {
+ [spinner stopAnimation: self];
+ [self setStatusText: @"Connected" withColor: [NSColor greenColor]];
+ return;
+ }
+
+ for (NSDictionary *image in images) {
+ NSString *caption = [image objectForKey:@"caption"];
+ if (caption == nil) {
+ caption = [image objectForKey:@"filename"];
+ }
+
+ NSDate *theDate = [NSDate dateWithTimeIntervalSince1970: [[image objectForKey:@"original_date"] doubleValue]];
+ AnselGalleryViewItem *item = [[AnselGalleryViewItem alloc] initWithURL: [NSURL URLWithString: [image objectForKey:@"url"]]
+ withTitle: caption
+ withDate: theDate];
+ [_browserData addObject: item];
+ }
+
+ [NSApp beginSheet: mviewGallerySheet
+ modalForWindow: [self window]
+ modalDelegate: nil
+ didEndSelector: nil
+ contextInfo: nil];
+
+ [spinner stopAnimation: self];
+ [self setStatusText: @"Connected" withColor: [NSColor greenColor]];
+
+ [browserView reloadData];
+
+}
+
+- (IBAction) closeGalleryView: (id)sender
+{
+ [NSApp endSheet: mviewGallerySheet];
+ [mviewGallerySheet orderOut: nil];
+ [_browserData removeAllObjects];
+ [browserView reloadData];
+}
+
+- (IBAction) closeServerList: (id)sender
+{
+ [serverTable setDelegate: nil];
+ [NSApp endSheet: serverListPanel];
+ [serverListPanel orderOut: nil];
+}
+
+// Remove the selected server from the saved list.
+- (IBAction)removeServer: (id)sender
+{
+ NSTableColumn *theCol = [serverTable tableColumnWithIdentifier:@"nickname"];
+
+ // We are deleting the entry for the currently selected server - make sure
+ // we disconnect.
+ if ([_currentServer objectForKey:TURAnselServerNickKey] == [[theCol dataCell] stringValue]) {
+ [self disconnect];
+ }
+
+ NSUserDefaults *userPrefs = [NSUserDefaults standardUserDefaults];
+
+ // See if the removed server is the current default.
+ if ([[userPrefs objectForKey:TURAnselDefaultServerKey] objectForKey: TURAnselServerNickKey] == [[theCol dataCell] stringValue]) {
+ [userPrefs setObject: nil forKey:TURAnselDefaultServerKey];
+ }
+
+ // Remove it from the servers dictionary
+ [_anselServers removeObjectAtIndex: [serverTable selectedRow]];
+ [userPrefs setObject:_anselServers forKey:TURAnselServersKey];
+
+ [userPrefs synchronize];
+ [serverTable reloadData];
+ [self updateServersPopupMenu];
+}
+
+// Put up the newGallerySheet NSPanel
+- (IBAction)showNewGallery: (id)sender
+{
+ TURAnselGalleryPanelController *newGalleryController;
+ //NSString *albumName;
+
+ // Make sure we're not doing this for nothing
+ if ([_anselController state] == TURAnselStateConnected) {
+
+ //albumName = [mExportMgr albumNameAtIndex: 0];
+ newGalleryController = [[TURAnselGalleryPanelController alloc] initWithController: _anselController
+ withGalleryName: nil];
+ [newGalleryController setDelegate: self];
+ [newGalleryController showSheetForWindow: [self window]];
+ }
+}
+
#pragma mark -
#pragma mark PrivateAPI
_anselController = nil;
[self setStatusText:@"Not logged in" withColor: [NSColor redColor]];
}
+
+#pragma mark -
+#pragma mark IKImageBrowserView Datasource methods
+- (NSUInteger)numberOfItemsInImageBrowser:(IKImageBrowserView *) aBrowser
+{
+ return [_browserData count];
+}
+
+- (id)imageBrowser:(IKImageBrowserView *) aBrowser itemAtIndex:(NSUInteger)index
+{
+ return [_browserData objectAtIndex:index];
+}
@end
archiveVersion = 1;
classes = {
};
- objectVersion = 42;
+ objectVersion = 45;
objects = {
/* Begin PBXBuildFile section */
B0D312691049AD7F006B06C6 /* README in Resources */ = {isa = PBXBuildFile; fileRef = B0D312171049A977006B06C6 /* README */; };
B0D3126A1049AD9A006B06C6 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = B0D312141049A977006B06C6 /* Localizable.strings */; };
B0D312A01049B26B006B06C6 /* XMLRPC.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = B0D312941049B24A006B06C6 /* XMLRPC.framework */; };
+ B0DEA058104D7012001D1509 /* AnselGalleryViewItem.m in Sources */ = {isa = PBXBuildFile; fileRef = B0DEA057104D7012001D1509 /* AnselGalleryViewItem.m */; };
+ B0DEA1CE104D7DE2001D1509 /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B0DEA1CD104D7DE2001D1509 /* Quartz.framework */; };
D118EA660AC08CCB006DD2FE /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = D118EA640AC08CCB006DD2FE /* Localizable.strings */; };
D15DEA4A0ABF639500CBE3A5 /* PluginManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D15DEA490ABF639500CBE3A5 /* PluginManager.framework */; };
D15DEA4F0ABF63C600CBE3A5 /* ApertureToAnselExportPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = D15DEA4D0ABF63C600CBE3A5 /* ApertureToAnselExportPlugin.m */; };
B0D312311049A9F2006B06C6 /* XMLRPC-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "XMLRPC-Info.plist"; sourceTree = "<group>"; };
B0D312391049AACC006B06C6 /* XMLRPC-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "XMLRPC-Info.plist"; sourceTree = "<group>"; };
B0D312941049B24A006B06C6 /* XMLRPC.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = XMLRPC.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ B0DEA056104D7012001D1509 /* AnselGalleryViewItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnselGalleryViewItem.h; sourceTree = "<group>"; };
+ B0DEA057104D7012001D1509 /* AnselGalleryViewItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AnselGalleryViewItem.m; sourceTree = "<group>"; };
+ B0DEA1CD104D7DE2001D1509 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = /System/Library/Frameworks/Quartz.framework; sourceTree = "<absolute>"; };
D118EA650AC08CCB006DD2FE /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = "<group>"; };
D118EB0F0AC08EAE006DD2FE /* ApertureToAnselExportPlugin.ApertureExport */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ApertureToAnselExportPlugin.ApertureExport; sourceTree = BUILT_PRODUCTS_DIR; };
D15DEA490ABF639500CBE3A5 /* PluginManager.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PluginManager.framework; path = /Library/Frameworks/PluginManager.framework; sourceTree = "<absolute>"; };
files = (
8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */,
D15DEA4A0ABF639500CBE3A5 /* PluginManager.framework in Frameworks */,
+ B0DEA1CE104D7DE2001D1509 /* Quartz.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
08FB77AFFE84173DC02AAC07 /* Classes */ = {
isa = PBXGroup;
children = (
+ B0DEA056104D7012001D1509 /* AnselGalleryViewItem.h */,
+ B0DEA057104D7012001D1509 /* AnselGalleryViewItem.m */,
D15DEA4E0ABF63C600CBE3A5 /* ApertureToAnselExportPlugin.h */,
D15DEA4D0ABF63C600CBE3A5 /* ApertureToAnselExportPlugin.m */,
);
1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
+ B0DEA1CD104D7DE2001D1509 /* Quartz.framework */,
D15DEA490ABF639500CBE3A5 /* PluginManager.framework */,
1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */,
);
089C1669FE841209C02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB913E08733D840010E9CD /* Build configuration list for PBXProject "ApertureToAnselExportPlugin" */;
- compatibilityVersion = "Xcode 2.4";
+ compatibilityVersion = "Xcode 3.1";
hasScannedForEncodings = 1;
mainGroup = 089C166AFE841209C02AAC07 /* MyApertureExportPlugIn */;
productRefGroup = 089C166AFE841209C02AAC07 /* MyApertureExportPlugIn */;
B0D3122D1049A977006B06C6 /* XMLRPCRequest.m in Sources */,
B0D3122E1049A977006B06C6 /* XMLRPCResponse.m in Sources */,
B0AE23391049F7770096565B /* TURAnselGalleryPanelController.m in Sources */,
+ B0DEA058104D7012001D1509 /* AnselGalleryViewItem.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "/Users/mrubinsk/Library/Application Support/Aperture/Plug-Ins";
PRODUCT_NAME = ApertureToAnselExportPlugin;
- SDKROOT = /Developer/SDKs/MacOSX10.5.sdk;
+ SDKROOT = macosx10.5;
WRAPPER_EXTENSION = ApertureExport;
ZERO_LINK = YES;
};
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
- SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
+ SDKROOT = macosx10.4;
};
name = Debug;
};
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
- SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
+ SDKROOT = macosx10.4;
};
name = Release;
};
<key>IBOpenObjects</key>
<array>
<integer>63</integer>
+ <integer>176</integer>
</array>
<key>IBSystem Version</key>
<string>9L30</string>