[Drawkit] permanent objects

James Maxwell jbmaxwell at rubato-music.com
Wed Jun 4 19:01:09 PDT 2008


Hey Graham,

Yes, it's just a DKDrawableShape, so I could most certainly lock it!  
Can't believe I didn't think of that! :-\
Mind you, will this prevent its initial instantiation from being  
undone? It all gets a bit weird, because I will want to be able to  
undo creation of later instances of these objects... I may have to  
think this through a bit more, I suppose.

Basically, I'm creating something similar to a timeline with barlines  
for this app (music app), but they're only barlines in the most basic  
formal sense - they demarcate a border between two metric formalisms -  
which in this app means they split the timeline. They're not barlines  
in a traditional sense. So, each time I create one of these quasi- 
barlines, I will be "splitting" the existing timeline object;  
shortening the existing one to end at the barline, and creating a new  
one, which starts at the barline. I'm not sure how I'll make this  
undoable yet, but I'm just experimenting with ideas, at this point...

cheers,

J.


On 4-Jun-08, at 6:17 PM, Graham Cox wrote:

> Hi James,
>
> What is your object based on? If you base it on a DKDrawableObject,  
> you can simply lock it [shape setLocked:YES] which will prevent it  
> being moved, edited or deleted. It can still be selected but you can  
> override the -drawContentInSelectedState: to ignore the flag for  
> selected which will stop it showing the selection highlight.
>
> If you are just drawing it yourself in a custom layer (an equally  
> valid approach), then it's entirely private to you and won't be  
> deleteable or editable unless you make it so.
>
> I do use NSRulerView in its standard configuration for a drawing  
> view, but as far as I know these probably wouldn't be all that  
> suitable for deploying within a drawing or in a way different from  
> their intended use. However you might want to set up a grid/ruler  
> combo that makes sense with respect to your timeline though of  
> course this would apply over the entire area of the drawing, which  
> might not be applicable in your case (not sure).
>
> cheers, Graham
>
>
>
> On 5 Jun 2008, at 7:44 am, James Maxwell wrote:
>
>> Thanks, Uli.
>>
>> Well, yes, t is basically a ruler, but looking into NSRulerView, it  
>> seems like it might be a bit complicated to do what I'm planning on  
>> doing. I want multiple horizontal rulers in my new, and I'm going  
>> to be creating these dynamically, as well - basically, whenever a  
>> new guide is added, a new "ruler" will be added, starting again  
>> from zero (well, one actually). I'll dig around to see if Graham  
>> used something other than the NSRulerView (i.e.,  a subclass), but  
>> I think it will behave in basically the same way. The other thing  
>> is that I'm going to allow the user to change the division on each  
>> ruler, independently of the others (it's a musical time thing). I  
>> kind of feel like NSRulerViews will become cumbersome doing this  
>> kind of thing... But I'll look more thoroughly into NSRulerView, or  
>> whatever Graham is using, before I rule it out (pun honestly not  
>> intended!).
>>
>> cheers,
>>
>> J.
>>
>>
>> On 4-Jun-08, at 12:03 PM, Uli Kusterer wrote:
>>
>>> Am 04.06.2008 um 18:52 schrieb James Maxwell:
>>>> I'm just wondering if anyone knows how to create an object that  
>>>> can't be deleted?
>>>> I have a timeline-like object at the top of my window which I  
>>>> build during my -awakeFromNib, and I don't want it to be possible  
>>>> to delete it, or to undo its creation. And actually, while I'm on  
>>>> the topic, I also don't want it to invoke drag and drop...  
>>>> Basically, I'm trying to create an object which really can't be  
>>>> edited, in any way, but I do need to detect mouseDowns on its  
>>>> surface (I'm using it to create DKGuides).
>>>
>>>
>>> It sounds like you're trying to do a ruler view. I think DrawKit  
>>> does rulers, so I'd be surprised if that wasn't what Graham is  
>>> using. Can't you just subclass whatever ruler Graham uses and add  
>>> your stuff? Or, come to think of it, I think you can actually have  
>>> several rulers on a view, so you could probably create your own  
>>> based on Graham's code.
>>>
>>> Cheers,
>>> -- Uli Kusterer
>>> "The Witnesses of TeachText are everywhere..."
>>> http://www.zathras.de
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Drawkit mailing list
>>> Drawkit at lists.apptree.net
>>> http://lists.apptree.net/listinfo.cgi/drawkit-apptree.net
>>
>> _______________________________________________
>> Drawkit mailing list
>> Drawkit at lists.apptree.net
>> http://lists.apptree.net/listinfo.cgi/drawkit-apptree.net
>
> _______________________________________________
> Drawkit mailing list
> Drawkit at lists.apptree.net
> http://lists.apptree.net/listinfo.cgi/drawkit-apptree.net



More information about the Drawkit mailing list