DrawKit
Vector and illustration framework for Mac OS X
|
This tool implements the standard selection and edit tool behaviour (multi-purpose tool) which allows objects to be selected, moved by dragging and to be edited by having their knobs dragged. More...
Instance Methods | |
(BOOL) | - allowsDirectDragCopying |
(void) | - changeSelectionWithTarget:inLayer:event: |
Implement selection changes for the current event (mouse down, typically) More... | |
(void) | - dragObjectsAsGroup:inLayer:toPoint:event:dragPhase: |
(BOOL) | - dragsAllObjectsInSelection |
(BOOL) | - dragsAllObjectsInSelectionWhenDraggingKnob |
Returns whether a hit on a knob in a multiple selection drags the objects or drags the knob. More... | |
(void) | - drawMarqueeInView: |
Draws the marquee (selection rect) More... | |
(NSRect) | - marqueeRect |
Returns the current marquee (selection rect) More... | |
(DKStyle *) | - marqueeStyle |
Set the drawing style for the marquee (selection rect) More... | |
(DKEditToolOperation) | - operationMode |
Returns the tool's current operation mode. More... | |
(NSImage *) | - prepareDragImage:inLayer: |
Prepare the proxy drag image for the given objects. More... | |
(NSUInteger) | - proxyDragThreshold |
The number of selected objects at which a proxy drag is used rather than a live drag. More... | |
(BOOL) | - selectionShouldHideDuringDrag |
Should the selection highlight of objects should be supressed during a drag? More... | |
(void) | - setAllowsDirectDragCopying: |
(void) | - setDragsAllObjectsInSelection: |
(void) | - setDragsAllObjectsInSelectionWhenDraggingKnob: |
Sets whether a hit on a knob in a multiple selection drags the objects or drags the knob. More... | |
(void) | - setMarqueeRect:inLayer: |
Sets the current marquee (selection rect) More... | |
(void) | - setMarqueeStyle: |
Set the drawing style for the marquee (selection rect) More... | |
(void) | - setOperationMode: |
Sets the tool's operation mode. More... | |
(void) | - setProxyDragThreshold: |
Sets the number of selected objects at which a proxy drag is used rather than a live drag. More... | |
(void) | - setSelectionShouldHideDuringDrag: |
Set whether the selection highlight of objects should be supressed during a drag. More... | |
(void) | - setUndoAction: |
Instance Methods inherited from DKDrawingTool | |
(void) | - drawRect:inView: |
(void) | - flagsChanged:inLayer: |
(BOOL) | - isSelectionTool |
Return whether the tool is some sort of object selection tool. More... | |
(BOOL) | - isValidTargetLayer: |
(NSString *) | - keyboardEquivalent |
(NSUInteger) | - keyboardModifierFlags |
(void) | - mouseMoved:inView: |
(NSData *) | - persistentData |
(NSString *) | - registeredName |
Return the registry name for this tool. More... | |
(void) | - set |
Sets the tool as the current tool for the key view in the main window, if possible. More... | |
(void) | - setCursorForPoint:targetObject:inLayer:event: |
(void) | - setKeyboardEquivalent:modifierFlags: |
(void) | - shouldLoadPersistentData: |
(void) | - toolControllerDidSetTool: |
Called when this tool is set by a tool controller. More... | |
(void) | - toolControllerDidUnsetTool: |
Called when this tool is unset by a tool controller. More... | |
(void) | - toolControllerWillUnsetTool: |
Called when this tool is about to be unset by a tool controller. More... | |
Instance Methods inherited from NSObject | |
(NSString *) | - address |
(DKStyleRegistry *) | - applicationWillReturnStyleRegistry |
(BOOL) | - canBeUsedWithSelectionTool |
(id) | - categoryManager:shouldReplaceObject:withObject: |
(Class) | - classForCoder |
(NSColor *) | - colorValue |
(NSColor *) | - colourValue |
(id) | - copy |
(void) | - dealloc |
(id) | - deepCopy |
(NSDictionary *) | - dimensionValuesForArrowStroke: |
(CGFloat) | - drawing:convertDistanceToExternalCoordinates: |
(NSPoint) | - drawing:convertLocationToExternalCoordinates: |
(void) | - drawing:didDrawRect:inView: |
(void) | - drawing:willDrawRect:inView: |
(NSString *) | - drawing:willReturnAbbreviationForUnit: |
(NSString *) | - drawing:willReturnFormattedCoordinateForDistance: |
(CGFloat) | - drawingWillReturnUnitToPointsConversonFactor: |
(void) | - finalize |
(NSString *) | - hexString |
(void) | - hotspot:didEndTrackingWithEvent:inView: |
(void) | - hotspot:isTrackingWithEvent:inView: |
(void) | - hotspot:willBeginTrackingWithEvent:inView: |
(NSData *) | - imageData |
(NSImage *) | - imageResourceNamed: |
(id) | - init |
(id) | - initWithExpression: |
(id) | - instantiateObjectWithShortName:parameters: |
(BOOL) | - isLiteralValue |
(void) | - layoutManager:willPlaceGlyphAtIndex:atLocation:pathAngle:yOffset: |
(void) | - menuItem:wasAddedForObject:inCategory: |
(BOOL) | - moveObjectTo:position:slope:userInfo: |
(id) | - mutableCopy |
(void) | - oneShotComplete |
(void) | - oneShotHasReached: |
(void) | - oneShotWillBegin |
(void) | - path:elementIndex:type:points:subPathIndex:subPathClosed:contextInfo: |
(id) | - placeLinkFromPoint:toPoint:onPath:linkNumber:userInfo: |
(id) | - placeObjectAtPoint:onPath:position:slope:userInfo: |
(NSPoint) | - point |
(NSPoint) | - pointForTextLayout |
(DKStyle *) | - registry:shouldReplaceStyle:withStyle: |
(NSBezierPath *) | - renderer:willRenderPath: |
(void) | - routeFinder:progressHasReached: |
(void) | - setValue:forNumericParameter: |
(NSString *) | - stringValue |
(CGFloat) | - taperFactorAtDistance:onPath:ofLength: |
(void) | - toolDidPerformUndoableAction: |
(void) | - toolWillPerformUndoableAction: |
(NSURL *) | - url |
Instance Methods inherited from <NSObject> | |
(NSString *) | - description |
(NSUInteger) | - hash |
(BOOL) | - isEqual: |
Instance Methods inherited from <NSKeyValueBindingCreation> | |
(void) | - bind:toObject:withKeyPath:options: |
(NSArray *) | - exposedBindings |
(NSDictionary *) | - infoForBinding: |
(NSArray *) | - optionDescriptionsForBinding: |
(void) | - unbind: |
(Class) | - valueClassForBinding: |
Instance Methods inherited from <DKDrawingTool> | |
(NSString *) | - actionName |
(NSCursor *) | - cursor |
(NSInteger) | - mouseDownAtPoint:targetObject:layer:event:delegate: |
(void) | - mouseDraggedToPoint:partCode:layer:event:delegate: |
(BOOL) | - mouseUpAtPoint:partCode:layer:event:delegate: |
Instance Methods inherited from <DKRenderable> | |
(CGFloat) | - angle |
(NSRect) | - bounds |
(NSAffineTransform *) | - containerTransform |
(NSSize) | - extraSpaceNeeded |
(NSUInteger) | - geometryChecksum |
(NSPoint) | - location |
(NSMutableDictionary *) | - renderingCache |
(NSBezierPath *) | - renderingPath |
(NSSize) | - size |
(BOOL) | - useLowQualityDrawing |
Class Methods | |
(DKStyle *) | + defaultMarqueeStyle |
Returns the default style to use for drawing the selection marquee. More... | |
Class Methods inherited from DKDrawingTool | |
(DKDrawingTool *) | + drawingToolWithKeyboardEquivalent: |
Retrieve a tool from the registry matching the key equivalent indicated by the key event passed. More... | |
(DKDrawingTool *) | + drawingToolWithName: |
Retrieve a tool from the registry with the given name. More... | |
(id) | + firstResponderAbleToSetTool |
(void) | + loadDefaults |
Load tool defaults from the user defaults. More... | |
(void) | + registerDrawingTool:withName: |
Register a tool in th eregistry with the given name. More... | |
(void) | + registerStandardTools |
Set a "standard" set of tools in the registry. More... | |
(void) | + saveDefaults |
Save tool defaults to the user defaults. More... | |
(NSDictionary *) | + sharedToolRegistry |
Return the shared instance of the tool registry. More... | |
(NSArray *) | + toolNames |
Return a list of registered tools' names, sorted alphabetically. More... | |
(BOOL) | + toolPerformsUndoableAction |
Does the tool ever implement undoable actions? More... | |
Class Methods inherited from NSObject | |
(id) | + alloc |
(Class) | + class |
(void) | + initialize |
(void) | + load |
(id) | + new |
Class Methods inherited from <NSKeyValueBindingCreation> | |
(void) | + exposeBinding: |
This tool implements the standard selection and edit tool behaviour (multi-purpose tool) which allows objects to be selected, moved by dragging and to be edited by having their knobs dragged.
For editing, objects mostly handle this themselves, but this provides the initial translation of mouse events into edit operations.
Note that the tool can only be used in layers which are DKObjectDrawingLayers - if the layer is not of this kind then the tool mode is set to invalid and nothing is done.
The 'marquee' (selection rect) is drawn using a style, giving great flexibility as to its appearance. In general a style that has a very low opacity should be used - the default style takes the system's highlight colour and makes a low opacity version of it.
- (BOOL) allowsDirectDragCopying |
- (void) changeSelectionWithTarget: | (DKDrawableObject *) | targ | |
inLayer: | (DKObjectDrawingLayer *) | layer | |
event: | (NSEvent *) | event | |
Implement selection changes for the current event (mouse down, typically)
This method implements the 'standard' selection conventions for modifier keys as follows:
targ | the object that is being selected or deselected |
layer | the layer in which the object exists |
event | the event |
+ (DKStyle*) defaultMarqueeStyle |
Returns the default style to use for drawing the selection marquee.
Marquee styles should have a lot of transparency as they are drawn on top of all objects when selecting them. The default style uses the system highlight colour as a starting point and makes a low opacity version of it.
- (void) dragObjectsAsGroup: | (NSArray *) | objects | |
inLayer: | (DKObjectDrawingLayer *) | layer | |
toPoint: | (NSPoint) | p | |
event: | (NSEvent *) | event | |
dragPhase: | (DKEditToolDragPhase) | ph | |
- (BOOL) dragsAllObjectsInSelection |
- (BOOL) dragsAllObjectsInSelectionWhenDraggingKnob |
Returns whether a hit on a knob in a multiple selection drags the objects or drags the knob.
The default is NO
- (void) drawMarqueeInView: | (DKDrawingView *) | aView |
Draws the marquee (selection rect)
This is called only if the mode is kDKEditToolSelectionMode. The actual drawing is performed by the style
aView | the view being drawn in |
- (NSRect) marqueeRect |
Returns the current marquee (selection rect)
- (DKStyle*) marqueeStyle |
Set the drawing style for the marquee (selection rect)
If you replace the default style, take care that the style is generally fairly transparent, otherwise it will be hard to see what you are selecting!
aStyle | a style object |
- (DKEditToolOperation) operationMode |
Returns the tool's current operation mode.
- (NSImage*) prepareDragImage: | (NSArray *) | objectsToDrag | |
inLayer: | (DKObjectDrawingLayer *) | layer | |
Prepare the proxy drag image for the given objects.
The default method creates the image by asking the layer to make one using its standard imaging methods. You can override this for different approaches. Typically the drag image has the bounds of the selected objects - the caller will position the image based on that assumption. This is only invoked if the proxy drag threshold was exceeded and not zero.
objectsToDrag | the list of objects that will be dragged |
layer | the layer they are owned by |
- (NSUInteger) proxyDragThreshold |
The number of selected objects at which a proxy drag is used rather than a live drag.
Dragging large numbers of objects can be unacceptably slow due to the very high numbers of view updates it entails. By setting a threshold, this tool can use a much faster (but less realistic) drag using a temporary image of the objects being dragged. A value of 0 will disable proxy dragging.
- (BOOL) selectionShouldHideDuringDrag |
Should the selection highlight of objects should be supressed during a drag?
The default is YES. Hiding the selection can make positioning objects by eye more precise.
- (void) setAllowsDirectDragCopying: | (BOOL) | dragCopy |
- (void) setDragsAllObjectsInSelection: | (BOOL) | multi |
- (void) setDragsAllObjectsInSelectionWhenDraggingKnob: | (BOOL) | dragWithKnob |
Sets whether a hit on a knob in a multiple selection drags the objects or drags the knob.
The default is NO
dragWithKnob | YES to drag the selection, NO to change the selection and drag the knob |
Sets the current marquee (selection rect)
This updates the area that is different between the current marquee and the new one being set, which results in much faster interactive selection of objects because far less drawing is going on.
marqueeRect | a rect |
alayer | the current layer (used to mark the update for the marquee rect) |
- (void) setMarqueeStyle: | (DKStyle *) | aStyle |
Set the drawing style for the marquee (selection rect)
If you replace the default style, take care that the style is generally fairly transparent, otherwise it will be hard to see what you are selecting!
aStyle | a style object |
- (void) setOperationMode: | (DKEditToolOperation) | op |
Sets the tool's operation mode.
This is typically called automatically by the mouseDown method according to the context of the initial click.
op | the mode to enter |
- (void) setProxyDragThreshold: | (NSUInteger) | numberOfObjects |
Sets the number of selected objects at which a proxy drag is used rather than a live drag.
Dragging large numbers of objects can be unacceptably slow due to the very high numbers of view updates it entails. By setting a threshold, this tool can use a much faster (but less realistic) drag using a temporary image of the objects being dragged. A value of 0 will disable proxy dragging. Note that this gives a hugh performance gain for large numbers of objects - in fact it makes dragging of a lot of objects actually feasible. The default threshold is 50 objects. Setting this to 1 effectively makes proxy dragging operate at all times.
numberOfObjects | the number above which a proxy drag is used |
- (void) setSelectionShouldHideDuringDrag: | (BOOL) | hideSel |
Set whether the selection highlight of objects should be supressed during a drag.
The default is YES. Hiding the selection can make positioning objects by eye more precise.
hideSel | YES to hide selections during a drag, NO to leave them visible |
- (void) setUndoAction: | (NSString *) | action |