[Drawkit] DK Update
Scott Francis
scottfrancis at integraonline.com
Thu Apr 29 20:11:52 PDT 2010
Excellent.
Thanks Graham.
On Apr 29, 2010, at 10:01 PM, Graham Cox wrote:
> Hi All,
>
> I've finally got around to updating the source on the website to the latest (1.0.7). Main changes are in the release notes as below:
> Release 1.0 beta 7
>
> 1. Text on path default string attributes now settable via a class method
>
> 2. Adds DKToolRegistry to handle the collection of tools, a job formerly performed by the DKDrawingTool class itself. The old class methods of DKDrawingTool now call the
> equivalent methods of DKToolregistry, so code is backward compatible. This abstraction makes the different jobs clear and also opens up the possibility of having different
> sets of registered tools, not just one.
>
> 3. DKGuideLayer operations such as add, delete, move and colour guides are all now undoable. This reflects the fact that while guides are a visual aid, they do literally change
> the data content of the model, so should be undoable.
>
> 4. DKLayer selection highlight colour changes now broadcast a notification to this effect.
>
> 5. All changes to a drawable's metadata are now undoable. This is enabled by default but may be disable using a class method. Note that DK does not set an undo action name for
> metadata changes because a) they are quite low level and b) different apps may have their own ideas about what these values actually represent. Higher-level code that is calling
> the metadata methods therefore need to set an action name for these. Another change is that all metadata changing methods now send the will change/did change notifications, and
> the notifications now include a userInfo dictionary that supplies the key that was changed (user info dict key: @"key"). If the change was more general, this entry is nil.
>
> 6. DKDrawableObject supplies a more informative description, and supports a debugging action - logDescription: which writes it to the log.
>
> 7. Bugfix: DKPathDecorator was drawing the uncached motif image using the wrong composition mode, so transparent backgrounds were coming out black. Fixed.
>
> 8. Added a copyImage: action to DKImageShape - allows the internal image to be copied to the pasteboard independently of the image shape itself, which is useful for cutting and
> pasting images between image shapes and rasterizers that accept a pasted image. Copies the raw data (when available), PDF and TIFF formats.
>
> 9. Changing various key settings such as drawing size and margins are now undoable.
>
> 10. Bugfix: Switching tools while they are in use (for example by hitting a key equivealent in the middle of a drag) is now generally safe in that it no longer leaves the
> undo stack or other state information in a bad state. Tools must be designed to anticipate this possibility, for example by factoring the work they do on mouse up into a method
> that can also be invoked from -toolControllerWillUnsetTool: Built-in tools affected by this have been modified accordingly.
>
> 11. DKArrowStroke now assignes a default formatter the first time that one of the dimension line modes is applied. This formatter copies the text attributes from the class
> defaults, but the attributes are maintained separately by the formatter. This permits two things: a) the text attributes can be applied individually and b) the attributes
> are archived as needed. The class adds methods for setting the text attributes properties (and the font as a specific attribute).
>
> 12. DKDrawing now sets up the drawing number and other default metadata slightly differently and more reliably. The revision item is now typed as a number (integer)
> which is probably more useful, and the drawing number itself is maintained as a separate item, also an integer NSNumber. The preformatted number is still available as
> before.
>
> 13. Bugfix: Inserting a path point into a closepath element now works, and the interpolated value of the inserted point on all straight line elements is now correct.
> As a result the Insert Path tool correctly reports the right Undo action string.
>
> 14. Bugfix: Dimension line text is correctly positioned within the path's gap even if one end of the line has a non-dimension arrow head, or none.
>
> 15. Adds a new mode to DKPathInsertDeleteTool to delete an element from a path. Supporting code in DKDrawablePath and NSBezierPath+Editing.
>
> 16. Bugfix: Any removal of an object from its container should now set the container ref to nil. Similary, removal of a layer from a layer group sets the layer's
> groupRef to nil. This may have been the cause of a couple of rare and hard to track down bugs caused by accessing stale pointers. Note that it is a container's
> responsibility to set its object's container ref to nil whenever necessary. This includes at dealloc time because the contained objects *may* be retained elsewhere.
>
> 17: Bugfix: Tool keyboard equivalents now correctly check the modifier flags for a match. This bug wasn't obvious on Tiger because command keys were already filtered,
> but on Leopard+, they are forwarded when no matching menu was found, and this was often selecting a tool in error.
>
> 18: Enhancement: Dragging colours to text objects now sets the text colour, not the fill colour.
>
> 19: DKLayer adds beginDrawing and endDrawing methods which are called at the start and end of drawing of the layer. By default they do nothing but provide a place to
> hook into for special graphics needs. They are called from outside of the drawRect:inView: method so that overrides of that are undisturbed and don't need to be
> modified to call these.
>
> 20: DKLayer adds class methods for setting a list of colours to use when initially assigning selection colours. By default the list is the same is used previously.
>
> 21: Order of operations in newLayerWithSelection: changed so it works. Because back pointers are now nulled when an object is removed from a container,
> operations where an object is being moved from one container to another must be done so that the removal is done before the addition to the new
> one, otherwise the back pointers are left set to NULL which stops the objects working properly.
>
> 22. All layers (DKLayer and subclasses) now support and set a uniqueKey property when they are instantiated. This key is not persistent. DKLayerGroup
> supports a method for finding layers with a given key. DKPasteboardInfo records the source layer's key allowing a paste operation to detect whether
> the target is the same layer as the original or not (where a weak reference to the layer would be unsafe and a strong reference would require
> archiving the entire layer and all its contents). DKDrawing's previous implementation of -uniqueKey is now handled by the layer base class.
>
> 23. User Info support in DKLayer (and hence DKDrawing) brought into line with the API in DKDrawableObject. In addition, items that are specifically
> managed as metadata are now handled using a new schema, where each value is wrapped in a DKMetadataItem. This class handles all the interconversions
> of data types as necessary, and more importantly, preserves the original data type unless it is deliberately changed via setType: This is in
> contrast to Cocoa classes such as NSValue that do not guarantee type preservation and in fact lose it when a value is edited. Using DKMetadataItem
> thus replaces the clunky ad-hoc mechanism that attempted to preserve the data type of metadata. The change is backward compatible - old files
> will have their metadata automatically wrapped when loaded. In addition, metadata for DKLayer uses the same schema. However, drawing info as
> set by DKDrawing is handled orthogonally from metadata now. This data is stored as a user info item in a separate dictionary accessible using
> the -drawingInfo property as before, but is no longer mingled with the metadata. Again older files are automatically updated. Since DK never set
> metadata on DKDrawing or DKLayer formerly, this change will only affect you if you if you have added metadata to DKDrawing that is not part of
> the drawing info. Such data will now be added to the drawing info subdictionary and not the metadata subdictionary.
>
> 24. Rationalised views for printing and screen drawing. DKPrintDrawingView is no longer required - a standard DKDrawingView will handle standard
> printing. DKDrawingView no longer has a -setPageBreakPrintInfo: method, it just has a -setPrintInfo: method which is used for both page break
> drawing and general printing. A separate property -setPageBreaksVisible: handles the toggling of page break overlay. Also, crop marks are
> controlled using the -setPrintCropMarkKind: method, and -setCropMarksVisible: has been removed. These changes allow much simpler control over
> printing options from e.g. a Print panel accessory controller, which is the recommended way to handle print options from 10.5 forward.
>
> 25. A number of special-pupose view classes were eliminated in favour of fewer, more general classes. These are DKLayerPDFView and DKDrawablePDFView.
> The ability to copy data from a layer as PDF has moved to DKLayer so is available to all layers.
>
> 26. Change: The designated initializer for DKDrawableObject has changed to -initWithStyle: This was done for performance reasons, since the notification
> subscription for the default style was causing a big performance hit when loading many many objects at once. By passing the final style desired this
> hit is avoided. However, this change may have an impact on any private subclasses of any drawable you might have made - you'll need to ensure
> that super's -initWithStyle is called when your subclass is initialized. DK itself has been changed to consistently do this.
>
> 27. Change: DKRasterizer no longer calls -removeObserver: on the default notification center in its dealloc method. This is for performance reasons. The
> change means that custom rasterizers must do this for themselves if necessary. Most DK rasterizers don't need to so gain performance, but
> private subclasses may need to. Note that failure to do this can lead to crashes if stale references are left in the notification center.
>
> 28. Change: DKKnob has been substantially rewritten to use an object-oriented approch to customizing individual knob types. DKKnob itself remains
> as the class that manages the collection of different knob classes, now based on a new class, DKHandle. Separate subclasses are used to implement
> each different knob type and state. Many DKKnob methods have been deprecated but the main utility methods remain but now use the new mechanism
> internally. One advantage is that a given knob appearance is now aggressively cached in a CGLayer which dramtically speeds up drawing of the
> handles to screen. It also allows a client to customise particular knob appearances without having to subclass DKKnob itself.
>
> 29. Change: A more efficient and usable mechanism for updating the ruler markers is now in place. DKLayer has methods for setting the ruler
> markers, which are propagated up to the drawing and hence to its views, but conditional on an enable flag. While DKDrawableObject does set the
> markers (but now only in response to an actual geometry change, rather than when updating for drawing refresh) these may not make it to the views
> if a layer has disabled the update. This is done when performing bulk selections, etc so that a torrent of update messages is no longer caused.
> The drawing layer and the selection tool further manipulate these updates so that they show the whole of a multiple selection, not just the last
> object selected. Overall this boosts performance substantially and is more useful for the user.
>
> 30. DK has been run through the Cocoa 64-bit preparation tool, which converts types as necessary and flags suspect code with warnings. Most of these
> warnings have been visited and the code addressed as required. However actual 64-bit compilation has not been attempted.
>
> _______________________________________________
> Drawkit mailing list
> Drawkit at lists.apptree.net
> http://lists.apptree.net/listinfo.cgi/drawkit-apptree.net
>
More information about the Drawkit
mailing list