a seperate new gallery controller to make it more portable.
IBOutlet NSProgressIndicator *spinner;
IBOutlet NSWindow *newGallerySheet;
IBOutlet NSImageView *defaultImageView;
-
- // New Gallery Panel
- IBOutlet NSTextField *galleryNameTextField;
- IBOutlet NSTextField *gallerySlugTextField;
- IBOutlet NSTextField *galleryDescTextField;
// Progress struct (This one is part of the protocol, but we don't use it)
ExportPluginProgress progress;
// This is our real progress controller (stolen from Facebook exporter).
FBProgressController *progressController;
- // New Gallery dialog controller (Can't get this to work with the modal
- // iPhoto plugin interface??)
- //TURNewGalleryController *newGalleryController;
-
// Mutex lock (required for the protocol, but not used)
NSRecursiveLock *progressLock;
// Actions
- (IBAction) doConnect: (id)sender;
-- (IBAction) doNewGallery: (id)sender;
- (IBAction) showNewGallery: (id)sender;
-- (IBAction) cancelNewGallery: (id)sender;
// overrides
- (void)awakeFromNib;
#import "TURAnsel.h";
#import "TURAnselGallery.h";
#import "AnselExportController.h";
+#import "TURAnselGalleryPanelController.h";
#import "FBProgressController.h";
#import "ImageResizer.h";
- (void)privatePerformExport;
- (void)runExport;
- (void)canExport;
-- (void)newGallery;
@end
@implementation AnselExportController
[pool release];
}
-
-// Start the process of creating a new gallery. This is called from an action
-// from the newGallerySheet NSPanel.
-- (void)doNewGallery: (id)sender
-{
- [NSApplication detachDrawingThread: @selector(newGallery)
- toTarget: self
- withObject:nil];
-}
-
// Put up the newGallerySheet NSPanel
- (IBAction)showNewGallery: (id)sender
{
// Make sure we're not doing this for nothing
if ([anselController state] == TURAnselStateConnected) {
-
- if (!newGallerySheet) {
-
- [NSBundle loadNibNamed: @"AnselGalleryPanel"
- owner: self];
-
- [galleryNameTextField setStringValue:@"Untitled"];
- }
-
- [NSApp beginSheet: newGallerySheet
- modalForWindow: [self window]
- modalDelegate: nil
- didEndSelector: nil
- contextInfo: nil];
+ TURAnselGalleryPanelController *newGalleryController = [[TURAnselGalleryPanelController alloc] initWithController: anselController];
+ [newGalleryController setDelegate: self];
+ [newGalleryController showSheetForWindow: [self window]];
}
}
-- (IBAction)cancelNewGallery: (id)sender
-{
- [NSApp endSheet: newGallerySheet];
- [newGallerySheet orderOut: nil];
-}
+//- (IBAction)cancelNewGallery: (id)sender
+//{
+// [NSApp endSheet: newGallerySheet];
+// [newGallerySheet orderOut: nil];
+//}
#pragma mark ExportPluginProtocol
// Initialize
- (id)initWithExportImageObj:(id <ExportImageProtocol>)obj
{
- if(self = [super init])
+ if (self = [super init])
{
mExportMgr = obj;
}
}
#pragma mark PrivateAPI
-
-- (void)newGallery
-{
- // Get Gallery Properties from the panel.
- NSString *galleryName = [galleryNameTextField stringValue];
- NSString *gallerySlug = [gallerySlugTextField stringValue];
- NSString *galleryDescription = [galleryDescTextField stringValue];
-
- if (!galleryName) {
- NSAlert *alert = [[NSAlert alloc] init];
- [alert setMessageText:@"Gallery names cannot be empty"];
- [alert setAlertStyle: NSCriticalAlertStyle];
- [alert beginSheetModalForWindow: [self window]
- modalDelegate: nil
- didEndSelector: nil
- contextInfo: nil];
- [alert release];
- return;
- }
- NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
- galleryName, @"name",
- gallerySlug, @"slug",
- galleryDescription, @"desc", nil];
-
- NSDictionary *results = [[anselController createNewGallery: params] retain];
-
- [NSApp endSheet: newGallerySheet];
- [newGallerySheet orderOut: nil];
-
- if ([anselController state] != TURAnselStateError) {
- NSAlert *alert = [[NSAlert alloc] init];
- [alert setMessageText: @"Gallery successfully created."];
- [alert beginSheetModalForWindow: [self window]
- modalDelegate: nil
- didEndSelector: nil
- contextInfo: nil];
-
- // Reload the NSComboBox and autoselect the last item.
- [galleryCombo reloadData];
- [galleryCombo selectItemAtIndex: [galleryCombo numberOfItems] - 1];
- [alert release];
- }
-
- [results release];
-}
-
// See if we have everything we need to export...
- (void)canExport
{
[theImage release];
[self canExport];
}
+
+- (void)TURAnselGalleryPanelDidAddGallery
+{
+ NSLog(@"Before reload");
+ // Reload the NSComboBox and autoselect the last item.
+ [galleryCombo reloadData];
+ [galleryCombo selectItemAtIndex: [galleryCombo numberOfItems] - 1];
+}
@end
\ No newline at end of file
<string key="IBDocument.HIToolboxVersion">352.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="2"/>
+ <integer value="15"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomObject" id="1001">
- <string key="NSClassName">AnselExportController</string>
+ <string key="NSClassName">TURAnselGalleryPanelController</string>
</object>
<object class="NSCustomObject" id="1003">
<string key="NSClassName">FirstResponder</string>
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
- <string key="label">gallerySlugTextField</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="887381497"/>
- </object>
- <int key="connectionID">38</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">galleryParentCombo</string>
+ <string key="label">newGallerySheet</string>
<reference key="source" ref="1001"/>
- <reference key="destination" ref="137843971"/>
+ <reference key="destination" ref="1005"/>
</object>
- <int key="connectionID">39</int>
+ <int key="connectionID">43</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">galleryNameTextField</string>
+ <object class="IBActionConnection" key="connection">
+ <string key="label">doNewGallery:</string>
<reference key="source" ref="1001"/>
- <reference key="destination" ref="142371246"/>
+ <reference key="destination" ref="184111456"/>
</object>
- <int key="connectionID">40</int>
+ <int key="connectionID">48</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<reference key="source" ref="1001"/>
<reference key="destination" ref="703267117"/>
</object>
- <int key="connectionID">41</int>
+ <int key="connectionID">49</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
- <string key="label">newGallerySheet</string>
+ <string key="label">galleryNameTextField</string>
<reference key="source" ref="1001"/>
- <reference key="destination" ref="1005"/>
+ <reference key="destination" ref="142371246"/>
</object>
- <int key="connectionID">43</int>
+ <int key="connectionID">50</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBActionConnection" key="connection">
- <string key="label">doNewGallery:</string>
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">gallerySlugTextField</string>
<reference key="source" ref="1001"/>
- <reference key="destination" ref="13003559"/>
+ <reference key="destination" ref="887381497"/>
</object>
- <int key="connectionID">46</int>
+ <int key="connectionID">51</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">cancelNewGallery:</string>
<reference key="source" ref="1001"/>
- <reference key="destination" ref="64211119"/>
+ <reference key="destination" ref="490284298"/>
</object>
- <int key="connectionID">47</int>
+ <int key="connectionID">53</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">47</int>
+ <int key="maxID">53</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
- <string key="className">AnselExportController</string>
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">TURAnsel.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">TURAnselGallery.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier" id="855842895">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">TURAnselGalleryPanelController.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">xmlrpc-1.5.1/XMLRPCConnection.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">TURAnselGalleryPanelController</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>cancelNewGallery:</string>
- <string>doConnect:</string>
<string>doNewGallery:</string>
- <string>showNewGallery:</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
- <string>id</string>
- <string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>anselHostURL</string>
- <string>beginButton</string>
- <string>connectedLabel</string>
- <string>firstView</string>
- <string>galleryCombo</string>
+ <string>delegate</string>
<string>galleryDescTextField</string>
<string>galleryNameTextField</string>
<string>gallerySlugTextField</string>
- <string>mExportMgr</string>
- <string>mQualityPopUp</string>
- <string>mSettingsBox</string>
- <string>mSizePopUp</string>
- <string>newGalleryButton</string>
<string>newGallerySheet</string>
- <string>password</string>
- <string>spinner</string>
- <string>username</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>NSTextField</string>
- <string>NSButton</string>
- <string>NSTextField</string>
- <string>NSControl</string>
- <string>NSComboBox</string>
- <string>NSTextField</string>
+ <string>id</string>
<string>NSTextField</string>
<string>NSTextField</string>
- <string>id</string>
- <string>NSPopUpButton</string>
- <string>NSBox</string>
- <string>NSPopUpButton</string>
- <string>NSButton</string>
- <string>NSWindow</string>
- <string>NSSecureTextField</string>
- <string>NSProgressIndicator</string>
<string>NSTextField</string>
+ <string>NSPanel</string>
</object>
</object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">AnselExportController.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">TURAnsel.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">TURAnselGallery.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">xmlrpc-1.5.1/XMLRPCConnection.h</string>
- </object>
+ <reference key="sourceIdentifier" ref="855842895"/>
</object>
</object>
</object>
--- /dev/null
+//
+// TURAnselGalleryPanelController.h
+// iPhoto2Ansel
+//
+// Created by Michael Rubinsky on 12/7/08.
+// Copyright 2008 __MyCompanyName__. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+#import "TURAnsel.h"
+
+@interface NSObject (TURAnselGalleryPaneControllerDelegate)
+-(void)TURAnselGalleryPanelDidAddGallery;
+@end
+
+@interface TURAnselGalleryPanelController : NSObject {
+ // Outlets
+ IBOutlet NSTextField *galleryNameTextField;
+ IBOutlet NSTextField *gallerySlugTextField;
+ IBOutlet NSTextField *galleryDescTextField;
+ IBOutlet NSPanel *newGallerySheet;
+
+ TURAnsel *anselController;
+ NSWindow *controllerWindow;
+ id delegate;
+}
+
+// Actions
+- (IBAction)doNewGallery: (id)sender;
+- (IBAction)cancelNewGallery: (id)sender;
+- (id)initWithController: (TURAnsel *)theController;
+- (void)showSheetForWindow: (NSWindow *)theWindow;
+- (void)setDelegate: (id)theDelegate;
+@end
--- /dev/null
+//
+// TURAnselGalleryPanelController.m
+// iPhoto2Ansel
+//
+// Created by Michael Rubinsky on 12/7/08.
+// Copyright 2008 __MyCompanyName__. All rights reserved.
+//
+
+#import "TURAnselGalleryPanelController.h"
+
+@implementation TURAnselGalleryPanelController
+
+#pragma mark IBActions
+- (IBAction)cancelNewGallery: (id)sender
+{
+ [NSApp endSheet: newGallerySheet];
+ [newGallerySheet orderOut: nil];
+}
+
+- (IBAction)doNewGallery: (id)sender
+{
+ // Get Gallery Properties from the panel.
+ NSString *galleryName = [galleryNameTextField stringValue];
+ NSString *gallerySlug = [gallerySlugTextField stringValue];
+ NSString *galleryDescription = [galleryDescTextField stringValue];
+
+ if (!galleryName) {
+
+ [NSApp endSheet: newGallerySheet];
+ [newGallerySheet orderOut: nil];
+
+ NSAlert *alert = [[NSAlert alloc] init];
+ [alert setMessageText:@"Gallery names cannot be empty"];
+ [alert setAlertStyle: NSCriticalAlertStyle];
+ [alert beginSheetModalForWindow: controllerWindow
+ modalDelegate: nil
+ didEndSelector: nil
+ contextInfo: nil];
+ [alert release];
+ return;
+ }
+ NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
+ galleryName, @"name",
+ gallerySlug, @"slug",
+ galleryDescription, @"desc", nil];
+
+ NSDictionary *results = [[anselController createNewGallery: params] retain];
+
+ [NSApp endSheet: newGallerySheet];
+ [newGallerySheet orderOut: nil];
+
+ if ([anselController state] != TURAnselStateError) {
+ NSAlert *alert = [[NSAlert alloc] init];
+ [alert setMessageText: @"Gallery successfully created."];
+ [alert beginSheetModalForWindow: controllerWindow
+ modalDelegate: nil
+ didEndSelector: nil
+ contextInfo: nil];
+ [alert release];
+ if ([delegate respondsToSelector:@selector(TURAnselGalleryPanelDidAddGallery)]) {
+ [delegate TURAnselGalleryPanelDidAddGallery];
+ }
+ }
+
+ [results release];
+}
+
+-(id)initWithController: (TURAnsel *)theController
+{
+ [super init];
+ anselController = [theController retain];
+ [NSBundle loadNibNamed: @"AnselGalleryPanel"
+ owner: self];
+
+ return self;
+}
+
+- (void)setDelegate: (id)theDelegate
+{
+ delegate = theDelegate; // weak
+}
+
+
+- (void)showSheetForWindow: (NSWindow *)theWindow
+{
+ [controllerWindow release];
+ controllerWindow = [theWindow retain];
+ [NSApp beginSheet: newGallerySheet
+ modalForWindow: theWindow
+ modalDelegate: nil
+ didEndSelector: nil
+ contextInfo: nil];
+}
+
+- (void)dealloc
+{
+ [anselController release];
+ [controllerWindow release];
+ [super dealloc];
+}
+
+@end
B0BFBCAA0ED5B32B006581A5 /* XMLRPCResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = B0BFBC960ED5B32B006581A5 /* XMLRPCResponse.m */; };
B0C888490ED85DEA000E19FB /* ProgressSheet.nib in Resources */ = {isa = PBXBuildFile; fileRef = B0C888480ED85DEA000E19FB /* ProgressSheet.nib */; };
B0C8884E0ED85E02000E19FB /* FBProgressController.m in Sources */ = {isa = PBXBuildFile; fileRef = B0C8884D0ED85E02000E19FB /* FBProgressController.m */; };
+ B0CCED420EEC6E810012D3D3 /* TURAnselGalleryPanelController.m in Sources */ = {isa = PBXBuildFile; fileRef = B0CCED410EEC6E810012D3D3 /* TURAnselGalleryPanelController.m */; };
B0DF843C0EE9E6EB000DAA9E /* QuickTime.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B0DF843B0EE9E6EB000DAA9E /* QuickTime.framework */; };
/* End PBXBuildFile section */
B0C888480ED85DEA000E19FB /* ProgressSheet.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; path = ProgressSheet.nib; sourceTree = "<group>"; };
B0C8884C0ED85E02000E19FB /* FBProgressController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBProgressController.h; sourceTree = "<group>"; };
B0C8884D0ED85E02000E19FB /* FBProgressController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBProgressController.m; sourceTree = "<group>"; };
+ B0CCED400EEC6E810012D3D3 /* TURAnselGalleryPanelController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TURAnselGalleryPanelController.h; sourceTree = "<group>"; };
+ B0CCED410EEC6E810012D3D3 /* TURAnselGalleryPanelController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TURAnselGalleryPanelController.m; sourceTree = "<group>"; };
B0DF843B0EE9E6EB000DAA9E /* QuickTime.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickTime.framework; path = /System/Library/Frameworks/QuickTime.framework; sourceTree = "<absolute>"; };
/* End PBXFileReference section */
B00076DE0EBA573900A95FC0 /* AnselToolkit */ = {
isa = PBXGroup;
children = (
+ B0CCED400EEC6E810012D3D3 /* TURAnselGalleryPanelController.h */,
+ B0CCED410EEC6E810012D3D3 /* TURAnselGalleryPanelController.m */,
B07D426C0EC230B100B59765 /* TURAnsel.h */,
B07D426D0EC230B100B59765 /* TURAnsel.m */,
B07D426E0EC230B100B59765 /* TURAnselGallery.h */,
B07D44F70EC2AEC700B59765 /* TURXMLConnection.m in Sources */,
B0C8884E0ED85E02000E19FB /* FBProgressController.m in Sources */,
B05C4A060EE9E001005B4B28 /* ImageResizer.m in Sources */,
+ B0CCED420EEC6E810012D3D3 /* TURAnselGalleryPanelController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};