On 27 Jan 2009, at 12:21 AM, Maxwell, Adam R wrote:

>
>
>
> On 01/26/09 14:03, "Christiaan Hofman" <[email protected]> wrote:
>
>>
>> On 26 Jan 2009, at 9:55 PM, Maxwell, Adam R wrote:
>>
>>>
>>>
>>>
>>> On 01/26/09 12:17, "Christiaan Hofman" <[email protected]> wrote:
>>>
>>>>
>>>> On 26 Jan 2009, at 9:10 PM, Maxwell, Adam R wrote:
>>>>
>>>>> On 01/26/09 11:51, "Christiaan Hofman" <[email protected]> wrote:
>>>>>
>>>>>> Correction, the file icon does not seem to be the one for the
>>>>>> linked file, but
>>>>>> for the .bib document file. This is not as intended, probably  
>>>>>> some
>>>>>> OS update
>>>>>> has changed AppKit's behavior (I seem to recall that it worked  
>>>>>> even
>>>>>> after
>>>>>> Leopard was released).
>>>>>
>>>>> It looks like NSDocument now uses -[NSWindow setRepresentedURL:].
>>>>> Duplicating the current hack for setRepresentedFilename: seems to
>>>>> work.
>>>>
>>>> Yea, I just committed that change.
>>>
>>> How about this:
>>>
>>> - (void)synchronizeWindowTitleWithDocumentName
>>> {
>>>   // use local files since representedURL doesn't work with non-
>>> file URLs
>>>   [[self window] setRepresentedURL:[[[publication localFiles]
>>> firstObject]
>>> URL]];
>>>   [[self window] setTitle:[self windowTitleForDocumentDisplayName:
>>> [[self
>>> document] displayName]]];
>>> }
>>>
>>> (modified as necessary for 10.4), then change all [[self window]
>>> setTitle:]
>>> calls to [self synchronizeWindowTitleWithDocumentName]?  Currently
>>> it gets
>>> out of sync if files are reordered.  This fixes that, and also gets
>>> rid of
>>> the nasty swizzling hacks.
>>>
>>> -- 
>>> Adam
>>
>> One reason for the swizzling was also because we use this in various
>> windows (it really should be possible out-of-the-box to override the
>> default behavior).
>
> I think swizzling is used in a number of places for convenience  
> (I've done
> it myself), but I'm currently of the opinion that category overrides  
> and
> swizzling are too much of a maintenance headache.
>

They are, but there are also lots of places where I wouldn't know an  
alternative.

>> Moreover, it needed to be overridden at this place,
>> because we have zero control over when the proxy icon gets set by
>> AppKit, this can come at any time. So even if we would make this
>> change, AppKit could again change the proxy icon again whenever it
>> likes.
>
> If Apple is changing the window's represented title outside of
> synchronizeWindowTitleWithDocumentName, then they're violating the API
> contract.  Even at the Carbon level, the proxy icon is indirectly  
> set by
> changing the file.

Which contract would that be? I could not find a clear description and  
guarantee on how the proxy icon is updated. Also the method name is  
definitely not suggesting what you say.

Christiaan


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Bibdesk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-users

Reply via email to