Skip to content
Browse files

Initial revision

  • Loading branch information...
1 parent 1ccc0d3 commit c58c6e03aeb29f67fef1aada4df51ee3362c5dc6 @jaz303 committed Apr 4, 2012
View
36 JFImageSavePanel.xcodeproj/project.pbxproj
@@ -13,6 +13,8 @@
96D7ACC2152CB953002945F0 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 96D7ACC0152CB953002945F0 /* Credits.rtf */; };
96D7ACC5152CB953002945F0 /* OFTAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 96D7ACC4152CB953002945F0 /* OFTAppDelegate.m */; };
96D7ACC8152CB954002945F0 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 96D7ACC6152CB954002945F0 /* MainMenu.xib */; };
+ 96D7ACD0152CB9E7002945F0 /* JFImageSavePanel.m in Sources */ = {isa = PBXBuildFile; fileRef = 96D7ACCF152CB9E7002945F0 /* JFImageSavePanel.m */; };
+ 96D7ACD2152CBB6E002945F0 /* JFImageSavePanelAccessoryView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 96D7ACD1152CBB6E002945F0 /* JFImageSavePanelAccessoryView.xib */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -21,14 +23,17 @@
96D7ACB4152CB953002945F0 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
96D7ACB5152CB953002945F0 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
96D7ACB6152CB953002945F0 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
- 96D7ACB9152CB953002945F0 /* JFImageSavePanel-Info.plist */ = {isa = PBXFileReference; path = "JFImageSavePanel-Info.plist"; sourceTree = "<group>"; };
+ 96D7ACB9152CB953002945F0 /* JFImageSavePanel-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "JFImageSavePanel-Info.plist"; sourceTree = "<group>"; };
96D7ACBB152CB953002945F0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
96D7ACBD152CB953002945F0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
- 96D7ACBF152CB953002945F0 /* JFImageSavePanel-Prefix.pch */ = {isa = PBXFileReference; path = "JFImageSavePanel-Prefix.pch"; sourceTree = "<group>"; };
+ 96D7ACBF152CB953002945F0 /* JFImageSavePanel-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "JFImageSavePanel-Prefix.pch"; sourceTree = "<group>"; };
96D7ACC1152CB953002945F0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = "<group>"; };
- 96D7ACC3152CB953002945F0 /* OFTAppDelegate.h */ = {isa = PBXFileReference; path = OFTAppDelegate.h; sourceTree = "<group>"; };
- 96D7ACC4152CB953002945F0 /* OFTAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OFTAppDelegate.m; sourceTree = "<group>"; };
+ 96D7ACC3152CB953002945F0 /* OFTAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OFTAppDelegate.h; path = JFImageSavePanel/OFTAppDelegate.h; sourceTree = "<group>"; };
+ 96D7ACC4152CB953002945F0 /* OFTAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = OFTAppDelegate.m; path = JFImageSavePanel/OFTAppDelegate.m; sourceTree = "<group>"; };
96D7ACC7152CB954002945F0 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = "<group>"; };
+ 96D7ACCE152CB9E7002945F0 /* JFImageSavePanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JFImageSavePanel.h; sourceTree = "<group>"; };
+ 96D7ACCF152CB9E7002945F0 /* JFImageSavePanel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JFImageSavePanel.m; sourceTree = "<group>"; };
+ 96D7ACD1152CBB6E002945F0 /* JFImageSavePanelAccessoryView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = JFImageSavePanelAccessoryView.xib; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -46,6 +51,7 @@
96D7ACA2152CB953002945F0 = {
isa = PBXGroup;
children = (
+ 96D7ACD3152CDF24002945F0 /* Test */,
96D7ACB7152CB953002945F0 /* JFImageSavePanel */,
96D7ACB0152CB953002945F0 /* Frameworks */,
96D7ACAE152CB953002945F0 /* Products */,
@@ -82,10 +88,9 @@
96D7ACB7152CB953002945F0 /* JFImageSavePanel */ = {
isa = PBXGroup;
children = (
- 96D7ACC3152CB953002945F0 /* OFTAppDelegate.h */,
- 96D7ACC4152CB953002945F0 /* OFTAppDelegate.m */,
- 96D7ACC6152CB954002945F0 /* MainMenu.xib */,
- 96D7ACB8152CB953002945F0 /* Supporting Files */,
+ 96D7ACCE152CB9E7002945F0 /* JFImageSavePanel.h */,
+ 96D7ACCF152CB9E7002945F0 /* JFImageSavePanel.m */,
+ 96D7ACD1152CBB6E002945F0 /* JFImageSavePanelAccessoryView.xib */,
);
path = JFImageSavePanel;
sourceTree = "<group>";
@@ -100,6 +105,18 @@
96D7ACC0152CB953002945F0 /* Credits.rtf */,
);
name = "Supporting Files";
+ path = JFImageSavePanel;
+ sourceTree = "<group>";
+ };
+ 96D7ACD3152CDF24002945F0 /* Test */ = {
+ isa = PBXGroup;
+ children = (
+ 96D7ACB8152CB953002945F0 /* Supporting Files */,
+ 96D7ACC3152CB953002945F0 /* OFTAppDelegate.h */,
+ 96D7ACC4152CB953002945F0 /* OFTAppDelegate.m */,
+ 96D7ACC6152CB954002945F0 /* MainMenu.xib */,
+ );
+ name = Test;
sourceTree = "<group>";
};
/* End PBXGroup section */
@@ -155,6 +172,7 @@
96D7ACBC152CB953002945F0 /* InfoPlist.strings in Resources */,
96D7ACC2152CB953002945F0 /* Credits.rtf in Resources */,
96D7ACC8152CB954002945F0 /* MainMenu.xib in Resources */,
+ 96D7ACD2152CBB6E002945F0 /* JFImageSavePanelAccessoryView.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -167,6 +185,7 @@
files = (
96D7ACBE152CB953002945F0 /* main.m in Sources */,
96D7ACC5152CB953002945F0 /* OFTAppDelegate.m in Sources */,
+ 96D7ACD0152CB9E7002945F0 /* JFImageSavePanel.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -195,6 +214,7 @@
96D7ACC7152CB954002945F0 /* en */,
);
name = MainMenu.xib;
+ path = JFImageSavePanel;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
View
7 JFImageSavePanel.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:JFImageSavePanel.xcodeproj">
+ </FileRef>
+</Workspace>
View
BIN ...xcodeproj/project.xcworkspace/xcuserdata/jason.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
View
84 JFImageSavePanel.xcodeproj/xcuserdata/jason.xcuserdatad/xcschemes/JFImageSavePanel.xcscheme
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ version = "1.3">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "96D7ACAC152CB953002945F0"
+ BuildableName = "JFImageSavePanel.app"
+ BlueprintName = "JFImageSavePanel"
+ ReferencedContainer = "container:JFImageSavePanel.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ buildConfiguration = "Debug">
+ <Testables>
+ </Testables>
+ <MacroExpansion>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "96D7ACAC152CB953002945F0"
+ BuildableName = "JFImageSavePanel.app"
+ BlueprintName = "JFImageSavePanel"
+ ReferencedContainer = "container:JFImageSavePanel.xcodeproj">
+ </BuildableReference>
+ </MacroExpansion>
+ </TestAction>
+ <LaunchAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Debug"
+ debugDocumentVersioning = "YES"
+ allowLocationSimulation = "YES">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "96D7ACAC152CB953002945F0"
+ BuildableName = "JFImageSavePanel.app"
+ BlueprintName = "JFImageSavePanel"
+ ReferencedContainer = "container:JFImageSavePanel.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ <AdditionalOptions>
+ </AdditionalOptions>
+ </LaunchAction>
+ <ProfileAction
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Release"
+ debugDocumentVersioning = "YES">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "96D7ACAC152CB953002945F0"
+ BuildableName = "JFImageSavePanel.app"
+ BlueprintName = "JFImageSavePanel"
+ ReferencedContainer = "container:JFImageSavePanel.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Debug">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Release"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+</Scheme>
View
22 JFImageSavePanel.xcodeproj/xcuserdata/jason.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>SchemeUserState</key>
+ <dict>
+ <key>JFImageSavePanel.xcscheme</key>
+ <dict>
+ <key>orderHint</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <key>SuppressBuildableAutocreation</key>
+ <dict>
+ <key>96D7ACAC152CB953002945F0</key>
+ <dict>
+ <key>primary</key>
+ <true/>
+ </dict>
+ </dict>
+</dict>
+</plist>
View
14 JFImageSavePanel/JFImageSavePanel.h
@@ -0,0 +1,14 @@
+#import <Foundation/Foundation.h>
+
+@interface JFImageSavePanel : NSObject
+{
+}
+
+@property (retain,nonatomic) NSString *title;
+@property (assign,nonatomic) const CFStringRef imageType;
+
++ (JFImageSavePanel *)savePanel;
+
+- (NSInteger)runModalForImage:(NSImage *)image error:(NSError **)error;
+
+@end
View
153 JFImageSavePanel/JFImageSavePanel.m
@@ -0,0 +1,153 @@
+#import "JFImageSavePanel.h"
+
+@interface JFImageSavePanel ()
+@property (retain) NSSavePanel *savePanel;
+@property (assign) IBOutlet NSView *accessoryView;
+@property (assign) IBOutlet NSPopUpButton *fileTypes;
+@property (assign) IBOutlet NSSlider *compressionFactor;
+
+- (void)configureSavePanel;
+- (void)fileTypeChanged:(id)sender;
+- (void)saveImage:(NSImage *)image;
+
+@end
+
+@implementation JFImageSavePanel
+
+@synthesize title, imageType;
+@synthesize savePanel, accessoryView, fileTypes, compressionFactor;
+
++ (JFImageSavePanel *)savePanel
+{
+ JFImageSavePanel *panel = [[JFImageSavePanel alloc] init];
+ return [panel autorelease];
+}
+
+- (id)init
+{
+ self = [super init];
+ if (self) {
+
+ self.title = @"Save Image";
+ self.imageType = kUTTypePNG;
+
+ self.savePanel = [NSSavePanel savePanel];
+
+ NSNib *accessoryNib = [[NSNib alloc] initWithNibNamed:@"JFImageSavePanelAccessoryView" bundle:nil];
+ [accessoryNib instantiateNibWithOwner:self topLevelObjects:nil];
+
+ [self.fileTypes setTarget:self];
+ [self.fileTypes setAction:@selector(fileTypeChanged:)];
+
+ [accessoryNib release];
+
+ }
+ return self;
+}
+
+- (void)dealloc
+{
+ self.title = nil;
+
+ self.savePanel = nil;
+
+ [self.accessoryView release];
+}
+
+- (NSInteger)runModalForImage:(NSImage *)image error:(NSError **)error
+{
+ [self configureSavePanel];
+ NSInteger result = [self.savePanel runModal];
+
+ if (result == NSFileHandlingPanelOKButton) {
+ [self saveImage:image];
+ }
+
+ return result;
+}
+
+- (void)configureSavePanel
+{
+ [self.savePanel setAccessoryView:self.accessoryView];
+
+ [self.savePanel setCanCreateDirectories:YES];
+ [self.savePanel setCanSelectHiddenExtension:YES];
+ [self.savePanel setExtensionHidden:NO];
+ [self.savePanel setAllowsOtherFileTypes:YES];
+
+ [self.savePanel setTitle:self.title];
+
+ if (UTTypeEqual(self.imageType, kUTTypeJPEG)) {
+ [self.fileTypes selectItemAtIndex:0];
+ } else if (UTTypeEqual(self.imageType, kUTTypePNG)) {
+ [self.fileTypes selectItemAtIndex:1];
+ } else if (UTTypeEqual(self.imageType, kUTTypeTIFF)) {
+ [self.fileTypes selectItemAtIndex:2];
+ }
+
+ [self fileTypeChanged:nil];
+
+}
+
+- (void)fileTypeChanged:(id)sender
+{
+ switch ([self.fileTypes indexOfSelectedItem]) {
+ case 0:
+ {
+ self.imageType = kUTTypeJPEG;
+ [self.compressionFactor setEnabled:YES];
+ [self.savePanel setAllowedFileTypes:[NSArray arrayWithObjects:(NSString*)kUTTypeJPEG, nil]];
+ break;
+ }
+ case 1:
+ {
+ self.imageType = kUTTypePNG;
+ [self.compressionFactor setEnabled:NO];
+ [self.savePanel setAllowedFileTypes:[NSArray arrayWithObjects:(NSString*)kUTTypePNG, nil]];
+ break;
+ }
+ case 2:
+ {
+ self.imageType = kUTTypeTIFF;
+ [self.compressionFactor setEnabled:NO];
+ [self.savePanel setAllowedFileTypes:[NSArray arrayWithObjects:(NSString*)kUTTypeTIFF, nil]];
+ break;
+ }
+ }
+
+ NSString *name = [self.savePanel nameFieldStringValue];
+ NSString *nameWithoutExtension = [name stringByDeletingPathExtension];
+
+ if (![name isEqualToString:nameWithoutExtension]) {
+ NSString *correctExtension = (NSString *) UTTypeCopyPreferredTagWithClass(self.imageType, kUTTagClassFilenameExtension);
+ name = [nameWithoutExtension stringByAppendingPathExtension:correctExtension];
+ [self.savePanel setNameFieldStringValue:name];
+ }
+}
+
+- (void)saveImage:(NSImage *)image
+{
+ NSData *outData = nil;
+
+ if (UTTypeEqual(self.imageType, kUTTypeJPEG)) {
+ CGFloat compression = [self.compressionFactor floatValue] / 100.0f;
+ outData = [NSBitmapImageRep representationOfImageRepsInArray:[image representations]
+ usingType:NSJPEGFileType
+ properties:[NSDictionary dictionaryWithObjectsAndKeys:
+ [NSNumber numberWithFloat:compression], NSImageCompressionFactor, nil]];
+ } else if (UTTypeEqual(self.imageType, kUTTypePNG)) {
+ outData = [NSBitmapImageRep representationOfImageRepsInArray:[image representations]
+ usingType:NSPNGFileType
+ properties:nil];
+ } else if (UTTypeEqual(self.imageType, kUTTypeTIFF)) {
+ outData = [NSBitmapImageRep representationOfImageRepsInArray:[image representations]
+ usingType:NSTIFFFileType
+ properties:nil];
+ }
+
+ if (outData) {
+ [outData writeToURL:[savePanel URL] atomically:YES];
+ }
+}
+
+@end
View
502 JFImageSavePanel/JFImageSavePanelAccessoryView.xib
@@ -0,0 +1,502 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
+ <data>
+ <int key="IBDocument.SystemTarget">1070</int>
+ <string key="IBDocument.SystemVersion">11C74</string>
+ <string key="IBDocument.InterfaceBuilderVersion">1938</string>
+ <string key="IBDocument.AppKitVersion">1138.23</string>
+ <string key="IBDocument.HIToolboxVersion">567.00</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="NS.object.0">1938</string>
+ </object>
+ <object class="NSArray" key="IBDocument.IntegratedClassDependencies">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSMenuItem</string>
+ <string>NSMenu</string>
+ <string>NSTextField</string>
+ <string>NSSliderCell</string>
+ <string>NSTextFieldCell</string>
+ <string>NSPopUpButton</string>
+ <string>NSCustomView</string>
+ <string>NSPopUpButtonCell</string>
+ <string>NSSlider</string>
+ <string>NSCustomObject</string>
+ </object>
+ <object class="NSArray" key="IBDocument.PluginDependencies">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ </object>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
+ <integer value="1" key="NS.object.0"/>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSCustomObject" id="1001">
+ <string key="NSClassName">JFImageSavePanel</string>
+ </object>
+ <object class="NSCustomObject" id="1003">
+ <string key="NSClassName">FirstResponder</string>
+ </object>
+ <object class="NSCustomObject" id="1004">
+ <string key="NSClassName">NSApplication</string>
+ </object>
+ <object class="NSCustomView" id="1005">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">268</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSTextField" id="890821255">
+ <reference key="NSNextResponder" ref="1005"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{17, 20}, {53, 17}}</string>
+ <reference key="NSSuperview" ref="1005"/>
+ <reference key="NSNextKeyView" ref="743725801"/>
+ <string key="NSReuseIdentifierKey">_NS:3944</string>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="642943433">
+ <int key="NSCellFlags">605158976</int>
+ <int key="NSCellFlags2">272630784</int>
+ <string key="NSContents">Quality:</string>
+ <object class="NSFont" key="NSSupport" id="1067612685">
+ <string key="NSName">LucidaGrande</string>
+ <double key="NSSize">13</double>
+ <int key="NSfFlags">1044</int>
+ </object>
+ <string key="NSCellIdentifier">_NS:3944</string>
+ <reference key="NSControlView" ref="890821255"/>
+ <object class="NSColor" key="NSBackgroundColor" id="362662559">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">controlColor</string>
+ <object class="NSColor" key="NSColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
+ </object>
+ </object>
+ <object class="NSColor" key="NSTextColor" id="514963743">
+ <int key="NSColorSpace">6</int>
+ <string key="NSCatalogName">System</string>
+ <string key="NSColorName">controlTextColor</string>
+ <object class="NSColor" key="NSColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MAA</bytes>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="NSTextField" id="972579204">
+ <reference key="NSNextResponder" ref="1005"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{17, 50}, {53, 17}}</string>
+ <reference key="NSSuperview" ref="1005"/>
+ <reference key="NSNextKeyView" ref="289686524"/>
+ <string key="NSReuseIdentifierKey">_NS:3944</string>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="61490112">
+ <int key="NSCellFlags">68288064</int>
+ <int key="NSCellFlags2">272630784</int>
+ <string key="NSContents">Format:</string>
+ <reference key="NSSupport" ref="1067612685"/>
+ <string key="NSCellIdentifier">_NS:3944</string>
+ <reference key="NSControlView" ref="972579204"/>
+ <reference key="NSBackgroundColor" ref="362662559"/>
+ <reference key="NSTextColor" ref="514963743"/>
+ </object>
+ </object>
+ <object class="NSSlider" id="743725801">
+ <reference key="NSNextResponder" ref="1005"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{71, 10}, {160, 25}}</string>
+ <reference key="NSSuperview" ref="1005"/>
+ <reference key="NSNextKeyView"/>
+ <string key="NSReuseIdentifierKey">_NS:779</string>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSSliderCell" key="NSCell" id="1069481334">
+ <int key="NSCellFlags">604110336</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents"/>
+ <string key="NSCellIdentifier">_NS:779</string>
+ <reference key="NSControlView" ref="743725801"/>
+ <double key="NSMaxValue">100</double>
+ <double key="NSMinValue">0.0</double>
+ <double key="NSValue">80</double>
+ <double key="NSAltIncValue">0.0</double>
+ <int key="NSNumberOfTickMarks">10</int>
+ <int key="NSTickMarkPosition">0</int>
+ <bool key="NSAllowsTickMarkValuesOnly">NO</bool>
+ <bool key="NSVertical">NO</bool>
+ </object>
+ </object>
+ <object class="NSPopUpButton" id="289686524">
+ <reference key="NSNextResponder" ref="1005"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{72, 43}, {160, 26}}</string>
+ <reference key="NSSuperview" ref="1005"/>
+ <reference key="NSNextKeyView" ref="890821255"/>
+ <string key="NSReuseIdentifierKey">_NS:868</string>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSPopUpButtonCell" key="NSCell" id="512535838">
+ <int key="NSCellFlags">-2076049856</int>
+ <int key="NSCellFlags2">2048</int>
+ <reference key="NSSupport" ref="1067612685"/>
+ <string key="NSCellIdentifier">_NS:868</string>
+ <reference key="NSControlView" ref="289686524"/>
+ <int key="NSButtonFlags">109199615</int>
+ <int key="NSButtonFlags2">129</int>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">400</int>
+ <int key="NSPeriodicInterval">75</int>
+ <object class="NSMenuItem" key="NSMenuItem" id="18005859">
+ <reference key="NSMenu" ref="1060606921"/>
+ <string key="NSTitle">PNG</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <object class="NSCustomResource" key="NSOnImage" id="226779713">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">NSMenuCheckmark</string>
+ </object>
+ <object class="NSCustomResource" key="NSMixedImage" id="803443460">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">NSMenuMixedState</string>
+ </object>
+ <string key="NSAction">_popUpItemAction:</string>
+ <reference key="NSTarget" ref="512535838"/>
+ </object>
+ <bool key="NSMenuItemRespectAlignment">YES</bool>
+ <object class="NSMenu" key="NSMenu" id="1060606921">
+ <string key="NSTitle">OtherViews</string>
+ <object class="NSMutableArray" key="NSMenuItems">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMenuItem" id="618402458">
+ <reference key="NSMenu" ref="1060606921"/>
+ <string key="NSTitle">JPEG</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="226779713"/>
+ <reference key="NSMixedImage" ref="803443460"/>
+ <string key="NSAction">_popUpItemAction:</string>
+ <reference key="NSTarget" ref="512535838"/>
+ </object>
+ <reference ref="18005859"/>
+ <object class="NSMenuItem" id="355696351">
+ <reference key="NSMenu" ref="1060606921"/>
+ <string key="NSTitle">TIFF</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="226779713"/>
+ <reference key="NSMixedImage" ref="803443460"/>
+ <string key="NSAction">_popUpItemAction:</string>
+ <reference key="NSTarget" ref="512535838"/>
+ </object>
+ </object>
+ <reference key="NSMenuFont" ref="1067612685"/>
+ </object>
+ <int key="NSSelectedIndex">-1</int>
+ <int key="NSPreferredEdge">1</int>
+ <bool key="NSUsesItemFromMenu">YES</bool>
+ <bool key="NSAltersState">YES</bool>
+ <int key="NSArrowPosition">2</int>
+ </object>
+ </object>
+ </object>
+ <string key="NSFrameSize">{249, 77}</string>
+ <reference key="NSSuperview"/>
+ <reference key="NSNextKeyView" ref="972579204"/>
+ <string key="NSClassName">NSView</string>
+ </object>
+ </object>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <object class="NSMutableArray" key="connectionRecords">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">fileTypes_</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="289686524"/>
+ </object>
+ <int key="connectionID">16</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">compressionFactor_</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="743725801"/>
+ </object>
+ <int key="connectionID">17</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">accessoryView_</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="1005"/>
+ </object>
+ <int key="connectionID">18</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">fileTypes</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="289686524"/>
+ </object>
+ <int key="connectionID">22</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">compressionFactor</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="743725801"/>
+ </object>
+ <int key="connectionID">23</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">accessoryView</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="1005"/>
+ </object>
+ <int key="connectionID">24</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">menuItemJPEG</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="618402458"/>
+ </object>
+ <int key="connectionID">25</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">menuItemPNG</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="18005859"/>
+ </object>
+ <int key="connectionID">26</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">menuItemTIFF</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="355696351"/>
+ </object>
+ <int key="connectionID">27</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">menu</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="1060606921"/>
+ </object>
+ <int key="connectionID">28</int>
+ </object>
+ </object>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <object class="NSArray" key="orderedObjects">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <object class="NSArray" key="object" id="1002">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <reference key="children" ref="1000"/>
+ <nil key="parent"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-2</int>
+ <reference key="object" ref="1001"/>
+ <reference key="parent" ref="1002"/>
+ <string key="objectName">File's Owner</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-1</int>
+ <reference key="object" ref="1003"/>
+ <reference key="parent" ref="1002"/>
+ <string key="objectName">First Responder</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-3</int>
+ <reference key="object" ref="1004"/>
+ <reference key="parent" ref="1002"/>
+ <string key="objectName">Application</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1</int>
+ <reference key="object" ref="1005"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="289686524"/>
+ <reference ref="743725801"/>
+ <reference ref="972579204"/>
+ <reference ref="890821255"/>
+ </object>
+ <reference key="parent" ref="1002"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">2</int>
+ <reference key="object" ref="289686524"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="512535838"/>
+ </object>
+ <reference key="parent" ref="1005"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">3</int>
+ <reference key="object" ref="512535838"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="1060606921"/>
+ </object>
+ <reference key="parent" ref="289686524"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">4</int>
+ <reference key="object" ref="1060606921"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="618402458"/>
+ <reference ref="355696351"/>
+ <reference ref="18005859"/>
+ </object>
+ <reference key="parent" ref="512535838"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5</int>
+ <reference key="object" ref="618402458"/>
+ <reference key="parent" ref="1060606921"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">7</int>
+ <reference key="object" ref="355696351"/>
+ <reference key="parent" ref="1060606921"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">8</int>
+ <reference key="object" ref="743725801"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="1069481334"/>
+ </object>
+ <reference key="parent" ref="1005"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">9</int>
+ <reference key="object" ref="1069481334"/>
+ <reference key="parent" ref="743725801"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">10</int>
+ <reference key="object" ref="972579204"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="61490112"/>
+ </object>
+ <reference key="parent" ref="1005"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">11</int>
+ <reference key="object" ref="61490112"/>
+ <reference key="parent" ref="972579204"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">12</int>
+ <reference key="object" ref="890821255"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="642943433"/>
+ </object>
+ <reference key="parent" ref="1005"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">13</int>
+ <reference key="object" ref="642943433"/>
+ <reference key="parent" ref="890821255"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">15</int>
+ <reference key="object" ref="18005859"/>
+ <reference key="parent" ref="1060606921"/>
+ </object>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="flattenedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>-1.IBPluginDependency</string>
+ <string>-2.IBPluginDependency</string>
+ <string>-3.IBPluginDependency</string>
+ <string>1.IBPluginDependency</string>
+ <string>10.IBPluginDependency</string>
+ <string>11.IBPluginDependency</string>
+ <string>12.IBPluginDependency</string>
+ <string>13.IBPluginDependency</string>
+ <string>15.IBPluginDependency</string>
+ <string>2.IBPluginDependency</string>
+ <string>3.IBPluginDependency</string>
+ <string>4.IBPluginDependency</string>
+ <string>5.IBPluginDependency</string>
+ <string>7.IBPluginDependency</string>
+ <string>8.IBPluginDependency</string>
+ <string>9.IBPluginDependency</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="unlocalizedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="1002"/>
+ <reference key="dict.values" ref="1002"/>
+ </object>
+ <nil key="activeLocalization"/>
+ <object class="NSMutableDictionary" key="localizations">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="1002"/>
+ <reference key="dict.values" ref="1002"/>
+ </object>
+ <nil key="sourceID"/>
+ <int key="maxID">28</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes"/>
+ <int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
+ <integer value="3000" key="NS.object.0"/>
+ </object>
+ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSMenuCheckmark</string>
+ <string>NSMenuMixedState</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>{9, 8}</string>
+ <string>{7, 2}</string>
+ </object>
+ </object>
+ </data>
+</archive>
View
2 JFImageSavePanel/OFTAppDelegate.h
@@ -12,4 +12,6 @@
@property (assign) IBOutlet NSWindow *window;
+- (IBAction)showSavePanel:(id)sender;
+
@end
View
11 JFImageSavePanel/OFTAppDelegate.m
@@ -7,6 +7,7 @@
//
#import "OFTAppDelegate.h"
+#import "JFImageSavePanel.h"
@implementation OFTAppDelegate
@@ -22,4 +23,14 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
// Insert code here to initialize your application
}
+- (IBAction)showSavePanel:(id)sender
+{
+ JFImageSavePanel *panel = [JFImageSavePanel savePanel];
+
+ NSImage *image = [[NSImage alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://upload.wikimedia.org/wikipedia/commons/thumb/5/5c/Double-alaskan-rainbow.jpg/400px-Double-alaskan-rainbow.jpg"]];
+
+ [panel setImageType:kUTTypeJPEG];
+ [panel runModalForImage:image error:NULL];
+}
+
@end
View
1,479 JFImageSavePanel/en.lproj/MainMenu.xib
102 additions, 1,377 deletions not shown because the diff is too large. Please use a local Git client to view these changes.

0 comments on commit c58c6e0

Please sign in to comment.
Something went wrong with that request. Please try again.