Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add some much nicer UI for icon setting. Now includes a select button…

…, drag/drop and paste
  • Loading branch information...
commit 240aeb124a12ad006aaaa15d78f9770f15f3dee8 1 parent 0cddf55
Michael Gorbach authored
View
18 MFAdvancedViewController.h
@@ -0,0 +1,18 @@
+//
+// MFAdvancedViewController.h
+// MacFusion2
+//
+// Created by Michael Gorbach on 3/20/08.
+// Copyright 2008 Michael Gorbach. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+@class MFIconSettingImageView;
+@interface MFAdvancedViewController : NSViewController {
+ IBOutlet MFIconSettingImageView* iconView;
+}
+
+- (IBAction)chooseIcon:(id)sender;
+
+@end
View
33 MFAdvancedViewController.m
@@ -0,0 +1,33 @@
+//
+// MFAdvancedViewController.m
+// MacFusion2
+//
+// Created by Michael Gorbach on 3/20/08.
+// Copyright 2008 Michael Gorbach. All rights reserved.
+//
+
+#import "MFAdvancedViewController.h"
+#import "MFClientFS.h"
+
+@implementation MFAdvancedViewController
+- (void)awakeFromNib
+{
+ [iconView bind:@"fs" toObject:self withKeyPath:@"representedObject" options:nil];
+}
+
+- (IBAction)chooseIcon:(id)sender
+{
+ NSOpenPanel* panel = [NSOpenPanel openPanel];
+ [panel setAllowsMultipleSelection: NO];
+ [panel setAllowedFileTypes: [NSArray arrayWithObject: @"icns"]];
+ NSInteger returnValue = [panel runModalForTypes: [NSArray arrayWithObject: @"icns"]];
+ if (returnValue == NSOKButton && [[panel filenames] count] > 0)
+ {
+ NSString* filename = [[panel filenames] objectAtIndex: 0];
+ NSImage* iconImage = [[NSImage alloc] initWithContentsOfFile: filename];
+ if (iconImage)
+ [(MFClientFS*)[self representedObject] setIconImage: iconImage];
+ }
+}
+
+@end
View
1  MFClientFS.h
@@ -49,6 +49,7 @@
// UI
- (NSDictionary*)configurationViewControllers;
+- (void)setIconImage:(NSImage*)image;
@property(readwrite, assign) NSInteger displayOrder;
@property(readwrite, retain) id<MFClientFSDelegateProtocol> clientFSDelegate;
View
83 MFClientFS.m
@@ -19,6 +19,10 @@
#import "MFClientPlugin.h"
#import "MFServerFSProtocol.h"
#import "MFSecurity.h"
+#import "IconFamily.h"
+#import "MFAdvancedViewController.h"
+#import "MGNSImage.h"
+#import <QuartzCore/QuartzCore.h>
@interface MFClientFS (PrivateAPI)
- (void)fillInitialData;
@@ -42,7 +46,8 @@ + (MFClientFS*)clientFSWithRemoteFS:(id)remoteFS
+ (NSSet*)keyPathsForValuesAffectingValueForKey:(NSString*)key
{
- if ([key isEqualToString: @"displayDictionary"])
+ if ([key isEqualToString: @"displayDictionary"] ||
+ [key isEqualToString: @"imagePath"])
return [NSSet setWithObjects:
KMFStatusDict, kMFParameterDict, nil];
else
@@ -242,7 +247,7 @@ - (void)setPauseTimeout:(BOOL)p
- (NSDictionary*)configurationViewControllers
{
NSMutableDictionary* myControllers = [NSMutableDictionary dictionary];
- NSViewController* macfusionAdvancedController = [[NSViewController alloc] initWithNibName: @"macfusionAdvancedView"
+ NSViewController* macfusionAdvancedController = [[MFAdvancedViewController alloc] initWithNibName: @"macfusionAdvancedView"
bundle: [NSBundle bundleForClass: [self class]]];
[myControllers setObject: macfusionAdvancedController forKey:kMFUIMacfusionAdvancedViewKey];
NSDictionary* delegateControllers = [delegate configurationViewControllers];
@@ -255,5 +260,79 @@ - (NSDictionary*)configurationViewControllers
return [myControllers copy];
}
+- (void)setIconImage:(NSImage*)image
+{
+ if (image == nil)
+ {
+ [self willChangeValueForKey:@"parameters"];
+ [parameters removeObjectForKey: kMFFSVolumeIconPathParameter];
+ [parameters removeObjectForKey: kMFFSVolumeImagePathParameter];
+ [self didChangeValueForKey:@"parameters"];
+ return;
+ }
+
+ // MFLogS(self, @"Writing image %@", image);
+ BOOL isDir;
+ NSString* iconDirPath = [@"~/Library/Application Support/Macfusion/Icons" stringByExpandingTildeInPath];
+
+ // Make Icons Directory if needed
+ if (![[NSFileManager defaultManager] fileExistsAtPath:iconDirPath isDirectory:&isDir] || !isDir)
+ {
+ NSError* dirCreateError;
+ BOOL ok = [[NSFileManager defaultManager] createDirectoryAtPath:iconDirPath
+ withIntermediateDirectories:YES
+ attributes:nil
+ error:&dirCreateError];
+ if (!ok)
+ {
+ MFLogS(self, @"Directory create for icon storage failed. Error %@", dirCreateError);
+ return;
+ }
+ }
+
+ // Write Icon
+ NSString* fullIconPath = [iconDirPath stringByAppendingPathComponent:
+ [NSString stringWithFormat:@"%@.icns", self.uuid]];
+ if ([[NSFileManager defaultManager] fileExistsAtPath:fullIconPath])
+ [[NSFileManager defaultManager] removeFileAtPath:fullIconPath handler:nil];
+
+ IconFamily* icon = [[IconFamily alloc] initWithThumbnailsOfImage: image];
+ BOOL writeOK = [icon writeToFile: fullIconPath];
+ if (!writeOK)
+ {
+ MFLogS(self, @"Failed to write to file icon %@", icon);
+ return;
+ }
+
+ // Write Black and White image
+ NSString* fullBWImagePath = [iconDirPath stringByAppendingPathComponent:
+ [NSString stringWithFormat:@"%@.tiff", self.uuid]];
+ if ([[NSFileManager defaultManager] fileExistsAtPath:fullBWImagePath])
+ [[NSFileManager defaultManager] removeFileAtPath: fullBWImagePath handler:nil];
+
+
+ CIFilter* bwFilter = [CIFilter filterWithName:@"CIColorControls"];
+ [bwFilter setDefaults];
+ [bwFilter setValue: [image ciImageRepresentation] forKey: @"inputImage"];
+ [bwFilter setValue: [NSNumber numberWithFloat:0.0] forKey: @"inputSaturation"];
+ CIImage* bwCIImage = [bwFilter valueForKey:@"outputImage"];
+
+ NSData* tiffData = [[bwCIImage nsImageRepresentation] TIFFRepresentation];
+ writeOK = [tiffData writeToFile:fullBWImagePath atomically:YES];
+ if(!writeOK)
+ {
+ MFLogS(self, @"Failed to write BW tiff file at path %@", fullBWImagePath);
+ return;
+ }
+
+ // Set the data and cause updates
+ [self willChangeValueForKey:@"parameters"];
+ [parameters setObject:fullIconPath
+ forKey:kMFFSVolumeIconPathParameter];
+ [parameters setObject:fullBWImagePath
+ forKey:kMFFSVolumeImagePathParameter];
+ [self didChangeValueForKey:@"parameters"];
+}
+
@synthesize displayOrder, clientFSDelegate;
@end
View
5 MFFilesystem.m
@@ -165,6 +165,7 @@ - (NSArray*)parameterList
[parameterList addObject: kMFFSVolumeIconPathParameter ];
[parameterList addObject: kMFFSFilePathParameter ];
[parameterList addObject: kMFFSPersistentParameter ];
+ [parameterList addObject: kMFFSVolumeImagePathParameter ];
return [parameterList copy];
}
@@ -205,11 +206,13 @@ - (NSMutableDictionary*)parametersWithImpliedValues
- (NSString*)iconPath
{
- return [self valueForParameterNamed: kMFFSVolumeIconPathParameter ];
+ NSString* iconPath = [self valueForParameterNamed: kMFFSVolumeIconPathParameter ];
+ return iconPath;
}
- (NSString*)imagePath
{
+ // NSLog(@"Calc imagePath parammeter %@ implied %@", parameters, [self parametersWithImpliedValues]);
return [self valueForParameterNamed: kMFFSVolumeImagePathParameter ];
}
View
1  MFServerFS.m
@@ -275,6 +275,7 @@ - (NSDictionary*)taskEnvironment
- (NSArray*)taskArguments
{
NSArray* delegateArgs;
+ // MFLogS(self, @"Parameters in server are %@, implied are %@", parameters, [self parametersWithImpliedValues]);
if ([delegate respondsToSelector:@selector(taskArgumentsForParameters:)])
{
delegateArgs = [delegate taskArgumentsForParameters: [self parametersWithImpliedValues]];
View
68 MacFusion2.xcodeproj/project.pbxproj
@@ -123,6 +123,14 @@
D4E51FE80CE03AC3009B1A30 /* MFFilesystem.h in Headers */ = {isa = PBXBuildFile; fileRef = D42E14540CDFCF9000C81814 /* MFFilesystem.h */; };
D4E51FEA0CE03ACA009B1A30 /* MFPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = D42E141C0CDFC99A00C81814 /* MFPlugin.m */; };
D4E51FEB0CE03ACA009B1A30 /* MFFilesystem.m in Sources */ = {isa = PBXBuildFile; fileRef = D42E14550CDFCF9000C81814 /* MFFilesystem.m */; };
+ D4E6CCA20D9202AA0022763F /* MFIconSettingImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = D4E6CCA00D9202AA0022763F /* MFIconSettingImageView.h */; };
+ D4E6CCA30D9202AA0022763F /* MFIconSettingImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = D4E6CCA10D9202AA0022763F /* MFIconSettingImageView.m */; };
+ D4E6CEFC0D9223770022763F /* IconFamily.h in Headers */ = {isa = PBXBuildFile; fileRef = D4E6CEF80D9223770022763F /* IconFamily.h */; };
+ D4E6CEFD0D9223770022763F /* IconFamily.m in Sources */ = {isa = PBXBuildFile; fileRef = D4E6CEF90D9223770022763F /* IconFamily.m */; };
+ D4E6CEFE0D9223770022763F /* NSString+CarbonFSRefCreation.m in Sources */ = {isa = PBXBuildFile; fileRef = D4E6CEFA0D9223770022763F /* NSString+CarbonFSRefCreation.m */; };
+ D4E6CEFF0D9223770022763F /* NSString+CarbonFSRefCreation.h in Headers */ = {isa = PBXBuildFile; fileRef = D4E6CEFB0D9223770022763F /* NSString+CarbonFSRefCreation.h */; };
+ D4E6CF3E0D9224DB0022763F /* MFAdvancedViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = D4E6CF3C0D9224DB0022763F /* MFAdvancedViewController.h */; };
+ D4E6CF3F0D9224DB0022763F /* MFAdvancedViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D4E6CF3D0D9224DB0022763F /* MFAdvancedViewController.m */; };
D4E983450D7223CE0058AF73 /* MGNSImage.m in Sources */ = {isa = PBXBuildFile; fileRef = D4E983440D7223CE0058AF73 /* MGNSImage.m */; };
D4E983470D7223D70058AF73 /* MGNSImage.h in Headers */ = {isa = PBXBuildFile; fileRef = D4E983460D7223D70058AF73 /* MGNSImage.h */; };
D4EA61570D8B30ED006D8885 /* MFMainController.m in Sources */ = {isa = PBXBuildFile; fileRef = D42E13E50CDFC69500C81814 /* MFMainController.m */; };
@@ -399,6 +407,14 @@
D4DF34CD0D80FC73005C9402 /* topView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = topView.xib; sourceTree = "<group>"; };
D4DF353A0D812AA7005C9402 /* MGSmoothingImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGSmoothingImageView.h; sourceTree = "<group>"; };
D4DF353B0D812AA7005C9402 /* MGSmoothingImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGSmoothingImageView.m; sourceTree = "<group>"; };
+ D4E6CCA00D9202AA0022763F /* MFIconSettingImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MFIconSettingImageView.h; path = Settings/MFIconSettingImageView.h; sourceTree = "<group>"; };
+ D4E6CCA10D9202AA0022763F /* MFIconSettingImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MFIconSettingImageView.m; path = Settings/MFIconSettingImageView.m; sourceTree = "<group>"; };
+ D4E6CEF80D9223770022763F /* IconFamily.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IconFamily.h; sourceTree = "<group>"; };
+ D4E6CEF90D9223770022763F /* IconFamily.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IconFamily.m; sourceTree = "<group>"; };
+ D4E6CEFA0D9223770022763F /* NSString+CarbonFSRefCreation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+CarbonFSRefCreation.m"; sourceTree = "<group>"; };
+ D4E6CEFB0D9223770022763F /* NSString+CarbonFSRefCreation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+CarbonFSRefCreation.h"; sourceTree = "<group>"; };
+ D4E6CF3C0D9224DB0022763F /* MFAdvancedViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFAdvancedViewController.h; sourceTree = "<group>"; };
+ D4E6CF3D0D9224DB0022763F /* MFAdvancedViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFAdvancedViewController.m; sourceTree = "<group>"; };
D4E983440D7223CE0058AF73 /* MGNSImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGNSImage.m; sourceTree = "<group>"; };
D4E983460D7223D70058AF73 /* MGNSImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGNSImage.h; sourceTree = "<group>"; };
D4EA61500D8B30DA006D8885 /* macfusionAgent.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = macfusionAgent.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -541,12 +557,9 @@
D413146B0D7F224900F55B9B /* Shared */ = {
isa = PBXGroup;
children = (
- D413146D0D7F225E00F55B9B /* MGTransitioningTabView.h */,
- D413146E0D7F225E00F55B9B /* MGTransitioningTabView.m */,
- D4DF353A0D812AA7005C9402 /* MGSmoothingImageView.h */,
- D4DF353B0D812AA7005C9402 /* MGSmoothingImageView.m */,
- D41E24280D897F0B00F46F50 /* MFPreferencesController.h */,
- D41E24290D897F0B00F46F50 /* MFPreferencesController.m */,
+ D4E6CF3B0D9224C70022763F /* Other */,
+ D4E6CF3A0D9224AE0022763F /* Controllers */,
+ D4E6CF380D92249F0022763F /* Views */,
);
name = Shared;
sourceTree = "<group>";
@@ -815,6 +828,41 @@
path = SSHFS;
sourceTree = "<group>";
};
+ D4E6CF380D92249F0022763F /* Views */ = {
+ isa = PBXGroup;
+ children = (
+ D4E6CCA00D9202AA0022763F /* MFIconSettingImageView.h */,
+ D4E6CCA10D9202AA0022763F /* MFIconSettingImageView.m */,
+ D413146D0D7F225E00F55B9B /* MGTransitioningTabView.h */,
+ D413146E0D7F225E00F55B9B /* MGTransitioningTabView.m */,
+ D4DF353A0D812AA7005C9402 /* MGSmoothingImageView.h */,
+ D4DF353B0D812AA7005C9402 /* MGSmoothingImageView.m */,
+ );
+ name = Views;
+ sourceTree = "<group>";
+ };
+ D4E6CF3A0D9224AE0022763F /* Controllers */ = {
+ isa = PBXGroup;
+ children = (
+ D41E24280D897F0B00F46F50 /* MFPreferencesController.h */,
+ D41E24290D897F0B00F46F50 /* MFPreferencesController.m */,
+ D4E6CF3C0D9224DB0022763F /* MFAdvancedViewController.h */,
+ D4E6CF3D0D9224DB0022763F /* MFAdvancedViewController.m */,
+ );
+ name = Controllers;
+ sourceTree = "<group>";
+ };
+ D4E6CF3B0D9224C70022763F /* Other */ = {
+ isa = PBXGroup;
+ children = (
+ D4E6CEF80D9223770022763F /* IconFamily.h */,
+ D4E6CEF90D9223770022763F /* IconFamily.m */,
+ D4E6CEFA0D9223770022763F /* NSString+CarbonFSRefCreation.m */,
+ D4E6CEFB0D9223770022763F /* NSString+CarbonFSRefCreation.h */,
+ );
+ name = Other;
+ sourceTree = "<group>";
+ };
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
@@ -844,6 +892,10 @@
D41E1DA30D87557900F46F50 /* MFCore.h in Headers */,
D41E242A0D897F0C00F46F50 /* MFPreferencesController.h in Headers */,
D4CF0E460D8C75B30065A2C3 /* MFPreferences.h in Headers */,
+ D4E6CCA20D9202AA0022763F /* MFIconSettingImageView.h in Headers */,
+ D4E6CEFC0D9223770022763F /* IconFamily.h in Headers */,
+ D4E6CEFF0D9223770022763F /* NSString+CarbonFSRefCreation.h in Headers */,
+ D4E6CF3E0D9224DB0022763F /* MFAdvancedViewController.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1133,6 +1185,10 @@
D41E1DA40D87557900F46F50 /* MFCore.m in Sources */,
D41E242B0D897F0C00F46F50 /* MFPreferencesController.m in Sources */,
D4CF0E470D8C75B30065A2C3 /* MFPreferences.m in Sources */,
+ D4E6CCA30D9202AA0022763F /* MFIconSettingImageView.m in Sources */,
+ D4E6CEFD0D9223770022763F /* IconFamily.m in Sources */,
+ D4E6CEFE0D9223770022763F /* NSString+CarbonFSRefCreation.m in Sources */,
+ D4E6CF3F0D9224DB0022763F /* MFAdvancedViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
25 NSString+CarbonFSRefCreation.h
@@ -0,0 +1,25 @@
+/*
+ Copyright (c) 2001-2006 Troy N. Stephens
+
+ Use and distribution of this source code is governed by the MIT License, whose terms are as follows.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#import <Foundation/Foundation.h>
+#import <Carbon/Carbon.h>
+
+@interface NSString (CarbonFSRefCreation)
+
+// Fills in the given FSRef struct so it specifies the file whose path is in this string.
+// If the file doesn't exist, and "createFile" is YES, this method will attempt to create
+// an empty file with the specified path. (The caller should insure that the directory
+// the file is to be placed in already exists.)
+
+- (BOOL) getFSRef:(FSRef*)fsRef createFileIfNecessary:(BOOL)createFile;
+
+@end
View
58 NSString+CarbonFSRefCreation.m
@@ -0,0 +1,58 @@
+/*
+ Copyright (c) 2001-2006 Troy N. Stephens
+
+ Use and distribution of this source code is governed by the MIT License, whose terms are as follows.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#import "NSString+CarbonFSRefCreation.h"
+
+@implementation NSString (CarbonFSRefCreation)
+
+- (BOOL) getFSRef:(FSRef*)fsRef createFileIfNecessary:(BOOL)createFile
+{
+ NSFileManager* fileManager = [NSFileManager defaultManager];
+ CFURLRef urlRef;
+ Boolean gotFSRef;
+
+ // Check whether the file exists already. If not, create an empty file if requested.
+ if (![fileManager fileExistsAtPath:self]) {
+ if (createFile) {
+ if (![@"" writeToFile:self atomically:YES]) {
+ return NO;
+ }
+ } else {
+ return NO;
+ }
+ }
+
+ // Create a CFURL with the specified POSIX path.
+ urlRef = CFURLCreateWithFileSystemPath( kCFAllocatorDefault,
+ (CFStringRef) self,
+ kCFURLPOSIXPathStyle,
+ FALSE /* isDirectory */ );
+ if (urlRef == NULL) {
+// printf( "** Couldn't make a CFURLRef for the file.\n" );
+ return NO;
+ }
+
+ // Try to create an FSRef from the URL. (If the specified file doesn't exist, this
+ // function will return false, but if we've reached this code we've already insured
+ // that the file exists.)
+ gotFSRef = CFURLGetFSRef( urlRef, fsRef );
+ CFRelease( urlRef );
+
+ if (!gotFSRef) {
+// printf( "** Couldn't get an FSRef for the file.\n" );
+ return NO;
+ }
+
+ return YES;
+}
+
+@end
View
252 Resources/macfusionAdvancedView.xib
@@ -18,7 +18,7 @@
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomObject" id="1001">
- <string key="NSClassName">NSViewController</string>
+ <string key="NSClassName">MFAdvancedViewController</string>
</object>
<object class="NSCustomObject" id="1003">
<string key="NSClassName">FirstResponder</string>
@@ -92,25 +92,25 @@
<object class="NSTextFieldCell" key="NSCell" id="270109062">
<int key="NSCellFlags">67239488</int>
<int key="NSCellFlags2">71304192</int>
- <string key="NSContents">Icon Path:</string>
+ <string key="NSContents">Icon:</string>
<reference key="NSSupport" ref="935590397"/>
<reference key="NSControlView" ref="276761339"/>
<reference key="NSBackgroundColor" ref="308739193"/>
<reference key="NSTextColor" ref="903214777"/>
</object>
</object>
- <object class="NSTextField" id="423694427">
+ <object class="NSTextField" id="199033250">
<reference key="NSNextResponder" ref="1005"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{123, 50}, {159, 22}}</string>
+ <string key="NSFrame">{{123, 78}, {159, 22}}</string>
<reference key="NSSuperview" ref="1005"/>
<bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="708190014">
+ <object class="NSTextFieldCell" key="NSCell" id="1023661536">
<int key="NSCellFlags">-1804468671</int>
<int key="NSCellFlags2">272630784</int>
<string key="NSContents"/>
<reference key="NSSupport" ref="935590397"/>
- <reference key="NSControlView" ref="423694427"/>
+ <reference key="NSControlView" ref="199033250"/>
<bool key="NSDrawsBackground">YES</bool>
<object class="NSColor" key="NSBackgroundColor" id="609403963">
<int key="NSColorSpace">6</int>
@@ -129,38 +129,88 @@
</object>
</object>
</object>
- <object class="NSTextField" id="199033250">
+ <object class="NSTextField" id="723853799">
<reference key="NSNextResponder" ref="1005"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{123, 78}, {159, 22}}</string>
+ <string key="NSFrame">{{123, 108}, {159, 22}}</string>
<reference key="NSSuperview" ref="1005"/>
<bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="1023661536">
+ <object class="NSTextFieldCell" key="NSCell" id="407684255">
<int key="NSCellFlags">-1804468671</int>
<int key="NSCellFlags2">272630784</int>
<string key="NSContents"/>
<reference key="NSSupport" ref="935590397"/>
- <reference key="NSControlView" ref="199033250"/>
+ <reference key="NSControlView" ref="723853799"/>
<bool key="NSDrawsBackground">YES</bool>
<reference key="NSBackgroundColor" ref="609403963"/>
<reference key="NSTextColor" ref="850791367"/>
</object>
</object>
- <object class="NSTextField" id="723853799">
+ <object class="NSCustomView" id="759955439">
<reference key="NSNextResponder" ref="1005"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{123, 108}, {159, 22}}</string>
+ <string key="NSFrame">{{123, 10}, {60, 60}}</string>
+ <reference key="NSSuperview" ref="1005"/>
+ <string key="NSClassName">MFIconSettingImageView</string>
+ </object>
+ <object class="NSButton" id="806716958">
+ <reference key="NSNextResponder" ref="1005"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{199, 31}, {60, 19}}</string>
<reference key="NSSuperview" ref="1005"/>
<bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="407684255">
- <int key="NSCellFlags">-1804468671</int>
- <int key="NSCellFlags2">272630784</int>
- <string key="NSContents"/>
- <reference key="NSSupport" ref="935590397"/>
- <reference key="NSControlView" ref="723853799"/>
- <bool key="NSDrawsBackground">YES</bool>
- <reference key="NSBackgroundColor" ref="609403963"/>
- <reference key="NSTextColor" ref="850791367"/>
+ <object class="NSButtonCell" key="NSCell" id="238980317">
+ <int key="NSCellFlags">-2080244224</int>
+ <int key="NSCellFlags2">134217728</int>
+ <string key="NSContents">Choose</string>
+ <object class="NSFont" key="NSSupport">
+ <string key="NSName">LucidaGrande</string>
+ <double key="NSSize">1.200000e+01</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ <reference key="NSControlView" ref="806716958"/>
+ <int key="NSButtonFlags">-2038152961</int>
+ <int key="NSButtonFlags2">164</int>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">400</int>
+ <int key="NSPeriodicInterval">75</int>
+ </object>
+ </object>
+ <object class="NSTextField" id="978895456">
+ <reference key="NSNextResponder" ref="1005"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{-18, 35}, {132, 13}}</string>
+ <reference key="NSSuperview" ref="1005"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="790831384">
+ <int key="NSCellFlags">67239488</int>
+ <int key="NSCellFlags2">71304192</int>
+ <string key="NSContents">Drag/Copy To Image </string>
+ <object class="NSFont" key="NSSupport" id="24">
+ <string key="NSName">LucidaGrande</string>
+ <double key="NSSize">1.000000e+01</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ <reference key="NSControlView" ref="978895456"/>
+ <reference key="NSBackgroundColor" ref="308739193"/>
+ <reference key="NSTextColor" ref="903214777"/>
+ </object>
+ </object>
+ <object class="NSTextField" id="771675830">
+ <reference key="NSNextResponder" ref="1005"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{-18, 20}, {132, 13}}</string>
+ <reference key="NSSuperview" ref="1005"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="552265122">
+ <int key="NSCellFlags">67239488</int>
+ <int key="NSCellFlags2">71304192</int>
+ <string key="NSContents">Delete To Clear</string>
+ <reference key="NSSupport" ref="24"/>
+ <reference key="NSControlView" ref="771675830"/>
+ <reference key="NSBackgroundColor" ref="308739193"/>
+ <reference key="NSTextColor" ref="903214777"/>
</object>
</object>
</object>
@@ -175,6 +225,9 @@
<string>parameters.volumeName</string>
<string>parameters.iconPath</string>
<string>parameters.advancedOptions</string>
+ <string>parameters.volumeIconPath</string>
+ <string>parameters.imagePath</string>
+ <string>imagePath</string>
</object>
<bool key="NSEditable">YES</bool>
<object class="_NSManagedProxy" key="_NSManagedProxy"/>
@@ -309,53 +362,20 @@
<int key="connectionID">25</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">value: selection.parameters.iconPath</string>
- <reference key="source" ref="423694427"/>
- <reference key="destination" ref="583518196"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="423694427"/>
- <reference key="NSDestination" ref="583518196"/>
- <string key="NSLabel">value: selection.parameters.iconPath</string>
- <string key="NSBinding">value</string>
- <string key="NSKeyPath">selection.parameters.iconPath</string>
- <object class="NSDictionary" key="NSOptions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>NSAllowsEditingMultipleValuesSelection</string>
- <string>NSAlwaysPresentsApplicationModalAlerts</string>
- <string>NSConditionallySetsEditable</string>
- <string>NSConditionallySetsEnabled</string>
- <string>NSConditionallySetsHidden</string>
- <string>NSContinuouslyUpdatesValue</string>
- <string>NSMultipleValuesPlaceholder</string>
- <string>NSNoSelectionPlaceholder</string>
- <string>NSNotApplicablePlaceholder</string>
- <string>NSNullPlaceholder</string>
- <string>NSRaisesForNotApplicableKeys</string>
- <string>NSValidatesImmediately</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="5"/>
- <reference ref="6"/>
- <reference ref="5"/>
- <reference ref="6"/>
- <reference ref="6"/>
- <reference ref="6"/>
- <string/>
- <string/>
- <string/>
- <string>Default</string>
- <reference ref="5"/>
- <reference ref="6"/>
- </object>
- </object>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">iconView</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="759955439"/>
+ </object>
+ <int key="connectionID">54</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">chooseIcon:</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="806716958"/>
</object>
- <int key="connectionID">31</int>
+ <int key="connectionID">59</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
@@ -395,9 +415,12 @@
<reference ref="979704784"/>
<reference ref="608696671"/>
<reference ref="276761339"/>
- <reference ref="423694427"/>
<reference ref="199033250"/>
<reference ref="723853799"/>
+ <reference ref="759955439"/>
+ <reference ref="806716958"/>
+ <reference ref="978895456"/>
+ <reference ref="771675830"/>
</object>
<reference key="parent" ref="1002"/>
</object>
@@ -482,18 +505,51 @@
<reference key="parent" ref="276761339"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">28</int>
- <reference key="object" ref="423694427"/>
+ <int key="objectID">53</int>
+ <reference key="object" ref="759955439"/>
+ <reference key="parent" ref="1005"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">55</int>
+ <reference key="object" ref="978895456"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="790831384"/>
+ </object>
+ <reference key="parent" ref="1005"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">56</int>
+ <reference key="object" ref="790831384"/>
+ <reference key="parent" ref="978895456"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">57</int>
+ <reference key="object" ref="806716958"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="238980317"/>
+ </object>
+ <reference key="parent" ref="1005"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">58</int>
+ <reference key="object" ref="238980317"/>
+ <reference key="parent" ref="806716958"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">60</int>
+ <reference key="object" ref="771675830"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="708190014"/>
+ <reference ref="552265122"/>
</object>
<reference key="parent" ref="1005"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">29</int>
- <reference key="object" ref="708190014"/>
- <reference key="parent" ref="423694427"/>
+ <int key="objectID">61</int>
+ <reference key="object" ref="552265122"/>
+ <reference key="parent" ref="771675830"/>
</object>
</object>
</object>
@@ -517,11 +573,16 @@
<string>2.IBPluginDependency</string>
<string>26.IBPluginDependency</string>
<string>27.IBPluginDependency</string>
- <string>28.IBPluginDependency</string>
- <string>29.IBPluginDependency</string>
<string>3.IBPluginDependency</string>
<string>4.IBPluginDependency</string>
<string>5.IBPluginDependency</string>
+ <string>53.IBPluginDependency</string>
+ <string>55.IBPluginDependency</string>
+ <string>56.IBPluginDependency</string>
+ <string>57.IBPluginDependency</string>
+ <string>58.IBPluginDependency</string>
+ <string>60.IBPluginDependency</string>
+ <string>61.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -542,7 +603,7 @@
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>{{0, 0}, {300, 150}}</string>
- <string>{{0, 0}, {300, 300}}</string>
+ <string>{{0, 0}, {300, 150}}</string>
</object>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -558,6 +619,11 @@
<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">
@@ -580,9 +646,37 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">37</int>
+ <int key="maxID">61</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <object class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">MFAdvancedViewController</string>
+ <string key="superclassName">NSViewController</string>
+ <object class="NSMutableDictionary" key="actions">
+ <string key="NS.key.0">chooseIcon:</string>
+ <string key="NS.object.0">id</string>
+ </object>
+ <object class="NSMutableDictionary" key="outlets">
+ <string key="NS.key.0">iconView</string>
+ <string key="NS.object.0">MFIconSettingImageView</string>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">MFAdvancedViewController.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">MFIconSettingImageView</string>
+ <string key="superclassName">NSView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Settings/MFIconSettingImageView.h</string>
+ </object>
+ </object>
+ </object>
</object>
- <object class="IBClassDescriber" key="IBDocument.Classes"/>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.LastKnownRelativeProjectPath">../MacFusion2.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
View
6 Resources/topView.xib
@@ -34,7 +34,7 @@
<object class="NSTextField" id="761970304">
<reference key="NSNextResponder" ref="1005"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{20, 20}, {145, 22}}</string>
+ <string key="NSFrame">{{20, 20}, {224, 22}}</string>
<reference key="NSSuperview" ref="1005"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="636741428">
@@ -238,7 +238,7 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilderKit</string>
<string>com.apple.InterfaceBuilderKit</string>
- <string>{{21, 1449}, {320, 62}}</string>
+ <string>{{494, 684}, {320, 62}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{628, 654}</string>
<string>{{797, 991}, {320, 62}}</string>
@@ -298,7 +298,7 @@
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
- <string key="IBDocument.LastKnownRelativeProjectPath">MacFusion2.xcodeproj</string>
+ <string key="IBDocument.LastKnownRelativeProjectPath">../MacFusion2.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
</data>
</archive>
View
1  SSHFS/SSHFSDelegate.m
@@ -52,6 +52,7 @@ - (NSArray*)secretsClientsList;
#pragma mark Mounting
- (NSArray*)taskArgumentsForParameters:(NSDictionary*)parameters
{
+ // MFLogS(self, @"Parameters received %@", parameters);
NSMutableArray* arguments = [NSMutableArray array];
[arguments addObject: [NSString stringWithFormat:@"%@@%@:%@",
[parameters objectForKey: kNetFSUserParameter],
View
20 Settings/MFIconSettingImageView.h
@@ -0,0 +1,20 @@
+//
+// MFIconSettingImageView.h
+// MacFusion2
+//
+// Created by Michael Gorbach on 3/19/08.
+// Copyright 2008 Michael Gorbach. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+@class MFClientFS;
+
+@interface MFIconSettingImageView : NSView {
+ MFClientFS* fs;
+ CIImage* normalImage;
+ CIImage* selectedImage;
+ BOOL dragHighlight;
+}
+
+@property(readwrite, retain) MFClientFS* fs;
+@end
View
226 Settings/MFIconSettingImageView.m
@@ -0,0 +1,226 @@
+//
+// MFIconSettingImageView.m
+// MacFusion2
+//
+// Created by Michael Gorbach on 3/19/08.
+// Copyright 2008 Michael Gorbach. All rights reserved.
+//
+
+#import "MFIconSettingImageView.h"
+#import "MFClientFS.h"
+#import <QuartzCore/QuartzCore.h>
+#import "MGNSImage.h"
+
+@implementation MFIconSettingImageView
++ (void)initialize
+{
+ [self exposeBinding: @"fs"];
+}
+
+- (id)initWithFrame:(NSRect)frame
+{
+ if (self = [super initWithFrame: frame])
+ {
+ // MFLogS(self, @"Registering for types");
+ [self registerForDraggedTypes:
+ [NSArray arrayWithObjects: NSFilenamesPboardType, (NSString*)kUTTypeAppleICNS,
+ nil] ];
+ dragHighlight = NO;
+ }
+
+ return self;
+}
+
+- (void)recalcImages
+{
+ NSRect rect = [self bounds];
+ NSImage* imageToDraw = [fs iconImage];
+ normalImage = [[[imageToDraw ciImageRepresentation] ciImageByScalingToSize:
+ NSMakeSize(rect.size.width, rect.size.height)] flippedImage];
+ CIFilter* bloomFilter = [CIFilter filterWithName:@"CIBloom"];
+ // [bloomFilter setDefaults];
+ [bloomFilter setValue:[NSNumber numberWithFloat:2.5] forKey:@"inputRadius"];
+ [bloomFilter setValue:[NSNumber numberWithFloat:0.7] forKey:@"inputIntensity"];
+ [bloomFilter setValue: normalImage forKey: @"inputImage"];
+ // ciRep = [bloomFilter valueForKey: @"outputImage"];
+ selectedImage = [bloomFilter valueForKey:@"outputImage"];
+ [self setNeedsDisplay: YES];
+}
+
+- (void)awakeFromNib
+{
+ [self addObserver:self
+ forKeyPath:@"fs.imagePath"
+ options:NSKeyValueObservingOptionNew
+ context:self];
+}
+
+- (void)drawRect:(NSRect)rect
+{
+ // MFLogS(self, @"Image is %@", image);
+ [[NSGraphicsContext currentContext] setImageInterpolation: NSImageInterpolationHigh];
+ CIImage* imageToDraw = ([[self window] firstResponder] == self) ? selectedImage : normalImage;
+
+ if (dragHighlight)
+ {
+ [[NSColor darkGrayColor] set];
+ [NSBezierPath setDefaultLineWidth: 3.0];
+ [NSBezierPath strokeRect: rect];
+ }
+
+ [imageToDraw drawInRect:rect
+ fromRect:NSMakeRect(0, 0, rect.size.width, rect.size.height)
+ operation:NSCompositeSourceOver
+ fraction:1.0];
+}
+
+# pragma mark C&P
+- (void)setImageFromPasteboard:(NSPasteboard*)pb
+{
+ // MFLogS(self, @"Pasting pb types %@", [pb types]);
+ NSImage* imageToSet = nil;
+
+ // Try getting filename data first
+ NSArray* fileNameData = [pb propertyListForType: NSFilenamesPboardType];
+ NSString* firstFileName = [fileNameData objectAtIndex: 0];
+ if ([firstFileName isLike:@"*.icns"])
+ {
+ NSImage* iconImage = [[NSImage alloc] initWithContentsOfFile: firstFileName];
+ if (iconImage)
+ imageToSet = iconImage;
+ }
+
+ if(!imageToSet)
+ {
+ NSData* icnsData = [pb dataForType: (NSString*)kUTTypeAppleICNS];
+ NSImage* icnsImage = [[NSImage alloc] initWithData: icnsData];
+ if (icnsImage)
+ imageToSet = icnsImage;
+ }
+
+ if (imageToSet)
+ {
+ [self.fs setIconImage: imageToSet];
+ [self setNeedsDisplay: YES];
+ }
+}
+
+
+
+- (void)paste:(id)paste
+{
+ [self setImageFromPasteboard: [NSPasteboard generalPasteboard]];
+}
+
+# pragma mark NSResponder
+- (BOOL)acceptsFirstResponder
+{
+ return YES;
+}
+
+- (BOOL)becomeFirstResponder
+{
+ [self setNeedsDisplay: YES];
+ return YES;
+}
+
+- (void)resignFirstResponder
+{
+ [self setNeedsDisplay: YES];
+}
+
+- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item
+{
+ // MFLogS(self, @"Validating %@", item);
+ if ([item action] == @selector(paste:))
+ {
+ if ([[NSPasteboard generalPasteboard] dataForType: (NSString*)kUTTypeAppleICNS])
+ return YES;
+
+ NSArray* fileNames = [[NSPasteboard generalPasteboard] propertyListForType: NSFilenamesPboardType];
+ if (fileNames && [[fileNames objectAtIndex: 0] isLike: @"*.icns"])
+ return YES;
+
+ return NO;
+ }
+
+ return NO;
+}
+
+- (void)keyDown:(NSEvent*)event
+{
+ if ([event keyCode] == 117)
+ {
+ [fs setIconImage: nil];
+ [self setNeedsDisplay: YES];
+ }
+ else
+ {
+ [super keyDown: event];
+ }
+}
+
+# pragma mark D&D
+- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
+{
+ NSPasteboard* pb = [sender draggingPasteboard];
+ NSString* type = [pb availableTypeFromArray: [NSArray arrayWithObjects: NSFilenamesPboardType,
+ (NSString*)kUTTypeAppleICNS, nil]];
+ if (type)
+ {
+ dragHighlight = YES;
+ [self setNeedsDisplay: YES];
+ return NSDragOperationCopy;
+ }
+
+ return NSDragOperationNone;
+}
+
+- (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender
+{
+ return NSDragOperationCopy;
+}
+
+- (void)draggingExited:(id <NSDraggingInfo>)sender
+{
+ dragHighlight = NO;
+ [self setNeedsDisplay: YES];
+}
+
+- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal
+{
+ return NSDragOperationCopy;
+}
+
+- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
+{
+ return YES;
+}
+
+- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
+{
+ [self setImageFromPasteboard: [sender draggingPasteboard]];
+ return YES;
+}
+
+- (void)concludeDragOperation:(id <NSDraggingInfo>)sender
+{
+ dragHighlight = NO;
+ [self setNeedsDisplay: YES];
+}
+
+# pragma mark KVO
+- (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object
+ change:(NSDictionary *)change context:(void *)context
+{
+ // MFLogS(self, @"Observe triggered");
+ if (context == self) {
+ [self recalcImages];
+ }
+ else {
+ [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
+ }
+}
+
+@synthesize fs;
+@end

0 comments on commit 240aeb1

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