pelicanpic

DrawKit Additions and Changes

The DKDocTest application requires a couple of small changes to the DrawKit framework. I will suggest these changes to Graham to be implemented in the next release version of the framework, but in the mean time (or if he rejects them) these are the changes you need to make to DK to get DKDocTest to work.

First, you need to eliminate the test if there is more than one object provided when you try to create a DKShapeGroup. BLOCKs defined inside of DXF files can contain one or zero objects. BLOCKs are translated into DKShapeGroups so this test needs to be deleted. It is commented out below in the DKShapeGroup.m file.

- (void) setGroupObjects:(NSArray*) objects {

NSArray* groupObjects = [[self class] objectsAvailableForGroupingFromArray:objects];

//** [Allan Daly change Oct 10, 2009] -->

// if([groupObjects count] < 2 )

// return;

//** <-- [Allan Daly change Oct 10, 2009]

... there are no changes in the rest of this method

 

Second, you need to add notifications into the DKToolController object that fire when the "autoReverts" property is changed.

DKToolController.h needs to have this added to it.

extern NSString* kDKDidChangeToolRevertsNotification;

DKToolController.m needs to have this added to it at the top with the other NSString definitions.

NSString* kDKDidChangeToolRevertsNotification = @"kDKDidChangeToolRevertsNotification";

 

DKToolController.m needs to have the "setAutomaticallyRevertsToSelectionTool:" method modified to send the notification when the mAutoRevert property is changed. This code does not send the notification if the property is not changed.

- (void) setAutomaticallyRevertsToSelectionTool:(BOOL) reverts {

//** [Allan Daly addition Oct 10, 2009] -->

// send the kDKDidChangeToolRevertsNotification if the "reverts" state is changing

BOOL sendNotification = NO;

if (mAutoRevert != reverts) sendNotification = YES;

//** <-- [Allan Daly addition Oct 10, 2009]

mAutoRevert = reverts;

 

//** [Allan Daly addition Oct 10, 2009] -->

if (sendNotification) [[NSNotificationCenter defaultCenter] postNotificationName:kDKDidChangeToolRevertsNotification object:self];

//** <-- [Allan Daly addition Oct 10, 2009]

 

LogEvent_( kInfoEvent, @"tool controller setting sticky tools = %d", !mAutoRevert);

}

Copyright © 2009 Allan Daly

brown-bird.net