Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

IKImageView subclass to prevent the default ikimageview dragging beha…

…vior
  • Loading branch information...
commit d129c5a90a7ddfbceb5114715b31b5ff12af134e 1 parent 826af1c
@jfahrenkrug authored
View
16 English.lproj/VertexDocument.xib
@@ -21,7 +21,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="100022"/>
+ <integer value="100024"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1241,6 +1241,7 @@
<string>100021.IBViewBoundsToFrameTransform</string>
<string>100022.IBPluginDependency</string>
<string>100023.IBPluginDependency</string>
+ <string>100024.CustomClassName</string>
<string>100024.IBPluginDependency</string>
<string>100027.IBPluginDependency</string>
<string>100028.IBPluginDependency</string>
@@ -1302,6 +1303,7 @@
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>SWImageView</string>
<string>com.apple.imagekit.ibplugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -1377,6 +1379,14 @@
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
+ <string key="className">SWImageView</string>
+ <string key="superclassName">IKImageView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">SWImageView.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">VertexDocument</string>
<string key="superclassName">NSDocument</string>
<object class="NSMutableDictionary" key="actions">
@@ -1454,7 +1464,7 @@
<string>NSButton</string>
<string>NSTextField</string>
<string>NSButton</string>
- <string>IKImageView</string>
+ <string>SWImageView</string>
<string>NSTextView</string>
<string>NSTextField</string>
<string>NSSplitView</string>
@@ -1498,7 +1508,7 @@
</object>
<object class="IBToOneOutletInfo">
<string key="name">imageView</string>
- <string key="candidateClassName">IKImageView</string>
+ <string key="candidateClassName">SWImageView</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">resultTextView</string>
View
17 SWImageView.h
@@ -0,0 +1,17 @@
+//
+// SWImageView.h
+// VertexHelper
+//
+// Created by Johannes Fahrenkrug on 21.12.10.
+// Copyright 2010 Springenwerk. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <Quartz/Quartz.h>
+
+
+@interface SWImageView : IKImageView {
+
+}
+
+@end
View
25 SWImageView.m
@@ -0,0 +1,25 @@
+//
+// SWImageView.m
+// VertexHelper
+//
+// Created by Johannes Fahrenkrug on 21.12.10.
+// Copyright 2010 Springenwerk. All rights reserved.
+//
+
+#import "SWImageView.h"
+
+
+@implementation SWImageView
+
+
+// this is a hack. We don't want to see the red annotation circles
+// when we drag in annotation mode. So we swallow drag events
+// unless we're in move mode.
+- (void)mouseDragged:(NSEvent *)theEvent {
+ if (self.currentToolMode == IKToolModeMove) {
+ [super mouseDragged:theEvent];
+ }
+}
+
+
+@end
View
4 VertexDocument.h
@@ -8,7 +8,7 @@
#import <Cocoa/Cocoa.h>
-#import <Quartz/Quartz.h>
+#import "SWImageView.h"
#import "ImageViewGridLayer.h"
@class PrioritySplitViewDelegate;
@@ -18,7 +18,7 @@
IBOutlet NSTextField *rowsTextField;
IBOutlet NSTextField *colsTextField;
IBOutlet NSTextView *resultTextView;
- IBOutlet IKImageView *imageView;
+ IBOutlet SWImageView *imageView;
IBOutlet NSButton *zoomInButton;
IBOutlet NSButton *zoomOutButton;
View
1  VertexDocument.m
@@ -132,6 +132,7 @@ - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
[imageView setImageWithURL:[NSURL fileURLWithPath:filePath]];
imageLoaded = YES;
[self enableUI:YES];
+ [self updateGrid:self];
}
}
return YES;
View
6 VertexHelper.xcodeproj/project.pbxproj
@@ -20,6 +20,7 @@
8F7B77921136C35800DE53AE /* drop_sprite.png in Resources */ = {isa = PBXBuildFile; fileRef = 8F7B77911136C35800DE53AE /* drop_sprite.png */; };
8F7B77F51136F58400DE53AE /* icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 8F7B77F41136F58400DE53AE /* icon.icns */; };
8FF6A23712C08E0D005EF244 /* PrioritySplitViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FF6A23612C08E0D005EF244 /* PrioritySplitViewDelegate.m */; };
+ 8FF6A31112C0ADA6005EF244 /* SWImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FF6A31012C0ADA6005EF244 /* SWImageView.m */; };
E0E6CFE411CF660000DED378 /* VertexScanner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E0E6CFE311CF660000DED378 /* VertexScanner.cpp */; };
E0E6D04A11CFB95100DED378 /* VertexScanner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E0E6CFE311CF660000DED378 /* VertexScanner.cpp */; };
E0E6D04F11CFB99A00DED378 /* VertexScannerMain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E0E6D04D11CFB98800DED378 /* VertexScannerMain.cpp */; };
@@ -51,6 +52,8 @@
8F7B77F41136F58400DE53AE /* icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = icon.icns; sourceTree = "<group>"; };
8FF6A23512C08E0D005EF244 /* PrioritySplitViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrioritySplitViewDelegate.h; sourceTree = "<group>"; };
8FF6A23612C08E0D005EF244 /* PrioritySplitViewDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PrioritySplitViewDelegate.m; sourceTree = "<group>"; };
+ 8FF6A30F12C0ADA6005EF244 /* SWImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWImageView.h; sourceTree = "<group>"; };
+ 8FF6A31012C0ADA6005EF244 /* SWImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWImageView.m; sourceTree = "<group>"; };
E0E6CFE211CF660000DED378 /* VertexScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VertexScanner.h; sourceTree = "<group>"; };
E0E6CFE311CF660000DED378 /* VertexScanner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VertexScanner.cpp; sourceTree = "<group>"; };
E0E6D03F11CFB7E400DED378 /* VertexScanner */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = VertexScanner; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -135,6 +138,8 @@
2A37F4ACFDCFA73011CA2CEA /* VertexDocument.m */,
8FF6A23512C08E0D005EF244 /* PrioritySplitViewDelegate.h */,
8FF6A23612C08E0D005EF244 /* PrioritySplitViewDelegate.m */,
+ 8FF6A30F12C0ADA6005EF244 /* SWImageView.h */,
+ 8FF6A31012C0ADA6005EF244 /* SWImageView.m */,
);
name = Classes;
sourceTree = "<group>";
@@ -270,6 +275,7 @@
8F29AD51112F509600459CEB /* ImageViewGridLayer.m in Sources */,
E0E6CFE411CF660000DED378 /* VertexScanner.cpp in Sources */,
8FF6A23712C08E0D005EF244 /* PrioritySplitViewDelegate.m in Sources */,
+ 8FF6A31112C0ADA6005EF244 /* SWImageView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Please sign in to comment.
Something went wrong with that request. Please try again.