I wouldn't return an index, but rather the pub itself. The index
could always be derived in AS. Note that this would not work for
external items.
Christiaan
On 20 May 2007, at 1:08 AM, Adam R. Maxwell wrote:
>
> On May 19, 2007, at 15:06, Christiaan Hofman wrote:
>
>> Moreover the title of the item is often not the same as the title of
>> the window, because the latter is cleaned. The windows don't have a
>> publication property. I wouldn't know how to do that, because there
>> are all kinds of windows.
>
> This problem has come up before, so it might be worth addressing. How
> about this:
>
> <property name="publicationIndex" code="pubi" type="integer"
> description="The document index of the publication
> associated with this window.">
> <cocoa key="publicationIndex"/>
> </property>
>
> and in the NSWindow category
>
> - (int)publicationIndex {
>
> id document = [self respondsToSelector:@selector(document)] ?
> [self document] : [[self delegate] document];
> int index = -1;
> if (document && [document
> respondsToSelector:@selector(publications)]) {
> id pub = [[self delegate]
> respondsToSelector:@selector(publication)] ? [[self delegate]
> publication] : nil;
> if (pub) {
> unsigned idx = [[document publications]
> indexOfObject:pub];
> if (NSNotFound != idx)
> index = idx;
> }
> }
> return index;
> }
>
> More bulletproofing in the implementation would be good, but it seems
> to work, although the index is off by one (does AS expect a 1-based
> publications index or zero-based?).
>
> --
> Adam
>
> ----------------------------------------------------------------------
> ---
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Bibdesk-develop mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bibdesk-develop
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bibdesk-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-develop