Permalink
Browse files

Initial check-in.

git-svn-id: svn://witness.is-a-geek.org/svn@1 378c4bed-2673-4746-83ae-d22ddc8c5b7c
  • Loading branch information...
0 parents commit a516cc8bbcaaab373916a74dbc19598f1529e56b uli committed Jul 4, 2009
Showing with 5,728 additions and 0 deletions.
  1. BIN English.lproj/InfoPlist.strings
  2. +61 −0 English.lproj/MainMenu.nib/classes.nib
  3. +23 −0 English.lproj/MainMenu.nib/info.nib
  4. BIN English.lproj/MainMenu.nib/objects.nib
  5. +24 −0 Info-UKPaintView__Upgraded_.plist
  6. +18 −0 NSCursor+Box.h
  7. +47 −0 NSCursor+Box.m
  8. +18 −0 NSCursor+CrossHair.h
  9. +59 −0 NSCursor+CrossHair.m
  10. +7 −0 TODO.txt
  11. +30 −0 UKColorListView.h
  12. +227 −0 UKColorListView.m
  13. +32 −0 UKLineSizeView.h
  14. +217 −0 UKLineSizeView.m
  15. +18 −0 UKPaintEraseRectTool.h
  16. +71 −0 UKPaintEraseRectTool.m
  17. BIN UKPaintEraseRectTool.tiff
  18. +18 −0 UKPaintEraserTool.h
  19. +68 −0 UKPaintEraserTool.m
  20. BIN UKPaintEraserTool.tiff
  21. +20 −0 UKPaintLassoTool.h
  22. +129 −0 UKPaintLassoTool.m
  23. BIN UKPaintLassoTool.tiff
  24. +18 −0 UKPaintLineTool.h
  25. +43 −0 UKPaintLineTool.m
  26. BIN UKPaintLineTool.tiff
  27. +18 −0 UKPaintOvalTool.h
  28. +46 −0 UKPaintOvalTool.m
  29. BIN UKPaintOvalTool.tiff
  30. +22 −0 UKPaintPathTool.h
  31. +72 −0 UKPaintPathTool.m
  32. BIN UKPaintPathTool.tiff
  33. +18 −0 UKPaintRectTool.h
  34. +43 −0 UKPaintRectTool.m
  35. BIN UKPaintRectTool.tiff
  36. +18 −0 UKPaintRoundrectTool.h
  37. +44 −0 UKPaintRoundrectTool.m
  38. BIN UKPaintRoundrectTool.tiff
  39. +18 −0 UKPaintSelectTool.h
  40. +136 −0 UKPaintSelectTool.m
  41. BIN UKPaintSelectTool.tiff
  42. +18 −0 UKPaintTempArrowTool.h
  43. +90 −0 UKPaintTempArrowTool.m
  44. BIN UKPaintTempArrowTool.tiff
  45. +18 −0 UKPaintTempLineTool.h
  46. +65 −0 UKPaintTempLineTool.m
  47. BIN UKPaintTempLineTool.tiff
  48. +18 −0 UKPaintTempOvalTool.h
  49. +69 −0 UKPaintTempOvalTool.m
  50. BIN UKPaintTempOvalTool.tiff
  51. +18 −0 UKPaintTempRectTool.h
  52. +66 −0 UKPaintTempRectTool.m
  53. BIN UKPaintTempRectTool.tiff
  54. +18 −0 UKPaintTempRoundrectTool.h
  55. +66 −0 UKPaintTempRoundrectTool.m
  56. BIN UKPaintTempRoundrectTool.tiff
  57. +20 −0 UKPaintTextTool.h
  58. +131 −0 UKPaintTextTool.m
  59. BIN UKPaintTextTool.tiff
  60. +92 −0 UKPaintTool.h
  61. +210 −0 UKPaintTool.m
  62. +110 −0 UKPaintView.h
  63. +785 −0 UKPaintView.m
  64. +600 −0 UKPaintView.xcodeproj/project.pbxproj
  65. +1,464 −0 UKPaintView.xcodeproj/witness.mode2
  66. +7 −0 UKPaintView_Prefix.h
  67. +18 −0 UKPaintbrushTool.h
  68. +50 −0 UKPaintbrushTool.m
  69. BIN UKPaintbrushTool.tiff
  70. +126 −0 UlisBresenham.c
  71. +72 −0 UlisBresenham.h
  72. +14 −0 main.m
Binary file not shown.
@@ -0,0 +1,61 @@
+{
+ IBClasses = (
+ {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
+ {
+ ACTIONS = {
+ paintViewImageChanged = id;
+ paintViewToolDidChange = id;
+ paintViewToolWillChange = id;
+ };
+ CLASS = NSObject;
+ LANGUAGE = ObjC;
+ },
+ {CLASS = UKFloatingWindow; LANGUAGE = ObjC; SUPERCLASS = NSPanel; },
+ {
+ ACTIONS = {setTarget = id; };
+ CLASS = UKLineSizeView;
+ LANGUAGE = ObjC;
+ OUTLETS = {target = id; };
+ SUPERCLASS = NSView;
+ },
+ {CLASS = UKPaintEraseRectTool; LANGUAGE = ObjC; SUPERCLASS = UKPaintTool; },
+ {CLASS = UKPaintEraserTool; LANGUAGE = ObjC; SUPERCLASS = UKPaintTool; },
+ {CLASS = UKPaintLassoTool; LANGUAGE = ObjC; SUPERCLASS = UKPaintPathTool; },
+ {CLASS = UKPaintLineTool; LANGUAGE = ObjC; SUPERCLASS = UKPaintTool; },
+ {CLASS = UKPaintOvalTool; LANGUAGE = ObjC; SUPERCLASS = UKPaintTool; },
+ {CLASS = UKPaintPathTool; LANGUAGE = ObjC; SUPERCLASS = UKPaintTool; },
+ {CLASS = UKPaintRectTool; LANGUAGE = ObjC; SUPERCLASS = UKPaintTool; },
+ {CLASS = UKPaintRoundrectTool; LANGUAGE = ObjC; SUPERCLASS = UKPaintTool; },
+ {CLASS = UKPaintSelectTool; LANGUAGE = ObjC; SUPERCLASS = UKPaintTool; },
+ {CLASS = UKPaintTextTool; LANGUAGE = ObjC; SUPERCLASS = UKPaintTool; },
+ {
+ ACTIONS = {chooseTool = id; };
+ CLASS = UKPaintTool;
+ LANGUAGE = ObjC;
+ OUTLETS = {owner = UKPaintView; toolButton = NSButton; };
+ SUPERCLASS = NSObject;
+ },
+ {
+ ACTIONS = {
+ clear = id;
+ clearMarkersBuffer = id;
+ clearSelectionBuffer = id;
+ copy = id;
+ cut = id;
+ delete = id;
+ drawSelectionBuffer = id;
+ paintToolDidChange = id;
+ paintToolWillChange = id;
+ paste = id;
+ takeLineSizeFromObject = id;
+ takeToolFromObject = id;
+ };
+ CLASS = UKPaintView;
+ LANGUAGE = ObjC;
+ OUTLETS = {currentTool = UKPaintTool; delegate = id; selectionTool = UKPaintTool; };
+ SUPERCLASS = NSView;
+ },
+ {CLASS = UKPaintbrushTool; LANGUAGE = ObjC; SUPERCLASS = UKPaintTool; }
+ );
+ IBVersion = 1;
+}
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IBDocumentLocation</key>
+ <string>60 273 356 240 0 0 1280 1002 </string>
+ <key>IBEditorPositions</key>
+ <dict>
+ <key>29</key>
+ <string>95 344 338 44 0 0 1280 1002 </string>
+ </dict>
+ <key>IBFramework Version</key>
+ <string>446.1</string>
+ <key>IBOpenObjects</key>
+ <array>
+ <integer>29</integer>
+ <integer>279</integer>
+ <integer>21</integer>
+ </array>
+ <key>IBSystem Version</key>
+ <string>8L2127</string>
+</dict>
+</plist>
Binary file not shown.
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>UKPaintView</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>0.1</string>
+ <key>NSMainNibFile</key>
+ <string>MainMenu</string>
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+</dict>
+</plist>
@@ -0,0 +1,18 @@
+//
+// NSCursor+Box.h
+// UKPaintView
+//
+// Created by Uli Kusterer on Mon Nov 03 2003.
+// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+
+@interface NSCursor (UKBox)
+
++(id) boxCursor;
++(id) boxCursorOfSize: (NSSize)size;
++(id) boxCursorOfSize: (NSSize)size color: (NSColor*)lineColor;
+
+@end
@@ -0,0 +1,47 @@
+//
+// NSCursor+Box.m
+// UKPaintView
+//
+// Created by Uli Kusterer on Mon Nov 03 2003.
+// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
+//
+
+#import "NSCursor+Box.h"
+
+
+@implementation NSCursor (UKBox)
+
++(id) boxCursor
+{
+ return [self boxCursorOfSize: NSMakeSize(1,1)];
+}
+
+
++(id) boxCursorOfSize: (NSSize)size
+{
+ return [self boxCursorOfSize: size color: [NSColor blackColor]];
+}
+
+
++(id) boxCursorOfSize: (NSSize)size color: (NSColor*)lineColor
+{
+ NSImage* cursorImage = [[[NSImage alloc] initWithSize: NSMakeSize(16,16)] autorelease];
+ NSRect box;
+
+ if( size.width < 1 ) size.width = 1;
+ if( size.height < 1 ) size.height = 1;
+ box.size.width = ( size.width > 16 ) ? 16 : size.width;
+ box.size.height = ( size.height > 16 ) ? 16 : size.height;
+ box.origin = NSMakePoint( truncf(box.size.width /2), truncf(box.size.height /2) );
+ //box.origin.x += 0.5; box.origin.y += 0.5;
+
+ [cursorImage lockFocus];
+ [lineColor set];
+ [NSBezierPath setDefaultLineWidth: 1];
+ [NSBezierPath strokeRect: box];
+ [cursorImage unlockFocus];
+
+ return [[[NSCursor alloc] initWithImage: cursorImage hotSpot: NSMakePoint(8,8)] autorelease];
+}
+
+@end
@@ -0,0 +1,18 @@
+//
+// NSCursor+CrossHair.h
+// UKPaintView
+//
+// Created by Uli Kusterer on Mon Nov 03 2003.
+// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+
+@interface NSCursor (UKCrossHair)
+
++(id) crossHairCursor;
++(id) crossHairCursorWithLineSize: (NSSize)size;
++(id) crossHairCursorWithLineSize: (NSSize)size color: (NSColor*)lineColor;
+
+@end
@@ -0,0 +1,59 @@
+//
+// NSCursor+CrossHair.m
+// UKPaintView
+//
+// Created by Uli Kusterer on Mon Nov 03 2003.
+// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
+//
+
+#import "NSCursor+CrossHair.h"
+
+
+@implementation NSCursor (UKCrossHair)
+
++(id) crossHairCursor
+{
+ return [self crossHairCursorWithLineSize: NSMakeSize(1,1)];
+}
+
+
++(id) crossHairCursorWithLineSize: (NSSize)size
+{
+ return [self crossHairCursorWithLineSize: size color: [NSColor blackColor]];
+}
+
+
++(id) crossHairCursorWithLineSize: (NSSize)size color: (NSColor*)lineColor
+{
+ float desiredSize = ((size.width > size.height)? size.width : size.height) * 5;
+ if( desiredSize < 16 ) desiredSize = 16;
+ NSImage* cursorImage = [[[NSImage alloc] initWithSize: NSMakeSize(desiredSize,desiredSize)] autorelease];
+ NSPoint left = { 0, 0.5 }, right = { 1, 0.5 },
+ bottom = { 0.5, 0 }, top = { 0.5, 1 };
+
+ left.x = truncf(left.x * desiredSize) + 0.5;
+ left.y = truncf(left.y * desiredSize) + 0.5;
+ right.x = truncf(right.x * desiredSize) + 0.5;
+ right.y = truncf(right.y * desiredSize) + 0.5;
+ bottom.x = truncf(bottom.x * desiredSize) + 0.5;
+ bottom.y = truncf(bottom.y * desiredSize) + 0.5;
+ top.x = truncf(top.x * desiredSize) + 0.5;
+ top.y = truncf(top.y * desiredSize) + 0.5;
+
+ if( size.width < 1 ) size.width = 1;
+ if( size.height < 1 ) size.height = 1;
+// size.width = ( size.width >= 16 ) ? 15 : size.width;
+// size.height = ( size.height >= 16 ) ? 15 : size.height;
+
+ [cursorImage lockFocus];
+ [lineColor set];
+ [NSBezierPath setDefaultLineWidth: size.height];
+ [NSBezierPath strokeLineFromPoint: left toPoint: right];
+ [NSBezierPath setDefaultLineWidth: size.width];
+ [NSBezierPath strokeLineFromPoint: top toPoint: bottom];
+ [cursorImage unlockFocus];
+
+ return [[[NSCursor alloc] initWithImage: cursorImage hotSpot: NSMakePoint(bottom.x, left.y)] autorelease];
+}
+
+@end
@@ -0,0 +1,7 @@
+ � Why does lasso cut out a thin line gap every time?
+-> Move selection removal and change code into UKPaintView.
+-> Make select tool not revert lasso selections to rectangular when dragging them.
+-> Select tool should also show right-to-left selections during tracking.
+-> Better selection outline that doesn't pulse but instead uses two colors.
+-> Make filled variants of shape tools.
+-> Make text tool auto-resize its bounding box while typing.
@@ -0,0 +1,30 @@
+//
+// UKColorListView.h
+// UKPaintView
+//
+// Created by Uli Kusterer on Mon Nov 03 2003.
+// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
+//
+
+#import <AppKit/AppKit.h>
+
+
+#define MIN_SWATCH_WIDTH 18
+#define SWATCH_DISTANCE 4
+#define SWATCH_BORDER (SWATCH_DISTANCE /2)
+#define SWATCH_WIDTH_HEIGHT_RATIO 0.75
+
+
+@interface UKColorListView : NSView
+{
+ NSColorList* colorList;
+}
+
+@end
+
+
+@interface NSColorList (UKFindNameForColor)
+
+-(NSString*) nameForColor: (NSColor*) col;
+
+@end
Oops, something went wrong.

0 comments on commit a516cc8

Please sign in to comment.