Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Jens Alfke


On 22 Apr '08, at 10:21 PM, Daniel DeCovnick wrote:

Through a lot of thought experiments, I've come to the conclusion  
that the best place to save this sort of thing would be in the  
resource fork of the file being opened, but I could be totally off  
the mark there, and it's certainly an unorthodox thing to do.


It would have been the right thing to do ten years ago. But these days  
resource forks are definitely a legacy feature and it would be a bad  
idea to write new software that relies on them.


Have you looked at Extended Attributes? They're kind of the moral  
equivalent of resources, but they're newer, lighter-weight and better  
integrated into the filesystem. I don't know if there's any in-depth  
documentation, but you can start by reading the man pages for  
getxattr, setxattr, et al.


Option 3. Add my own Metadata key and put an XML or similarly  
textual version of my graphical rep as the string. I have no idea  
whether or not this is possible. It seems like a bad abuse of the  
metadata system in any case.


This seems reasonable. It's the same way that the Finder stores  
comments, which is analogous to what you're doing.


Option 4. Wrap the file anyway and put an alias where it used to be.  
Seems like a bad idea. Yes, the target user base for this app would  
know what was going on, but it just seems wrong to hide people's  
stuff like that.


Way too much software doesn't understand/resolve alias files, so this  
could cause trouble.
A symlink would be more transparent, but I agree with you that messing  
with the location of people's files is a bad idea.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Targeting nil in Interface Builder menu item

2008-04-23 Thread Rick Mann
I have an Import command in my File menu that can apply to both the  
current document, and the app as a whole. I want it to send the - 
import action to the main window's document first, and if that doesn't  
exist, send it to the app. This seems like an application of an action  
sent to a nil responder, but I can't figure out how to set that up in  
IB.


Suggestions?

TIA,
--
Rick

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Targeting nil in Interface Builder menu item

2008-04-23 Thread Graham Cox
Just ctrl-drag the link between the item and the first responder  
object in the nib main window. First responder stands for nil.


hth,

G.


On 23 Apr 2008, at 4:08 pm, Rick Mann wrote:
I have an Import command in my File menu that can apply to both the  
current document, and the app as a whole. I want it to send the - 
import action to the main window's document first, and if that  
doesn't exist, send it to the app. This seems like an application of  
an action sent to a nil responder, but I can't figure out how to set  
that up in IB.


Suggestions?

TIA,
--
Rick

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/graham.cox%40bigpond.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Safe frameworks for privileged tools?

2008-04-23 Thread Michael Watson

That's a good table to know/have handy. Thanks.

Okay, so LaunchServices is out as well. Is there *any* reliable way to  
know if a directory is a bundle or package without using NSWorkspace  
or LaunchServices? (I'm also going to have to omit Spotlight, since I  
can't be guaranteed it's enabled on a given machine.)



--
m-s

On 23 Apr, 2008, at 00:17, stephen joseph butler wrote:
On Tue, Apr 22, 2008 at 10:52 PM, Michael Watson mikey- 
[EMAIL PROTECTED]

wrote:

I would like to use LaunchServices for this, but wasn't sure if it  
was
kosher to link to ApplicationServices.framework from a privileged  
tool. Are
there guidelines as to which frameworks should and shouldn't be  
used in
privileged tools? I know nothing can ever be safe, but some are  
surely

more dangerous than others, and I'd love some guidance.



This is the definitive list of safe frameworks:

http://developer.apple.com/technotes/tn2005/tn2083.html#SECFRAMEWORKCROSSREFERENCE

Unfortunately, ApplicationServices is a no. However, this blog posts
suggests some instances where it might be safe:

http://unixjunkie.blogspot.com/2006/10/launchservices-from-root-daemon.html
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/mikey-san 
%40bungie.org


This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Targeting nil in Interface Builder menu item

2008-04-23 Thread Rick Mann


On Apr 22, 2008, at 11:13 PM, Graham Cox wrote:

Just ctrl-drag the link between the item and the first responder  
object in the nib main window. First responder stands for nil.



Well, now, that was obvious. For some reason, I was fixated on File's  
Owner, and I knew that wasn't right. I *knew* there was a First  
Responder object in there, but it just wasn't registering.


I even figured out how to add the action to it.

So, thank you for that.

--
Rick

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Safe frameworks for privileged tools?

2008-04-23 Thread Kevin Grant

Does the target directory require privilege to see, or does
it just happen to be used by a privileged tool?

If the latter, you could always rely on a 2nd executable
(without privilege) to examine the directory and return its
results to your privileged program.

Kevin G.




That's a good table to know/have handy. Thanks.

Okay, so LaunchServices is out as well. Is there *any* reliable way  
to know if a directory is a bundle or package without using  
NSWorkspace or LaunchServices? (I'm also going to have to omit  
Spotlight, since I can't be guaranteed it's enabled on a given  
machine.)



--
m-s

On 23 Apr, 2008, at 00:17, stephen joseph butler wrote:
On Tue, Apr 22, 2008 at 10:52 PM, Michael Watson [EMAIL PROTECTED] 


wrote:

I would like to use LaunchServices for this, but wasn't sure if it  
was
kosher to link to ApplicationServices.framework from a privileged  
tool. Are
there guidelines as to which frameworks should and shouldn't be  
used in
privileged tools? I know nothing can ever be safe, but some are  
surely

more dangerous than others, and I'd love some guidance.



This is the definitive list of safe frameworks:

http://developer.apple.com/technotes/tn2005/tn2083.html#SECFRAMEWORKCROSSREFERENCE

Unfortunately, ApplicationServices is a no. However, this blog  
posts

suggests some instances where it might be safe:

http://unixjunkie.blogspot.com/2006/10/launchservices-from-root-daemon.html

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Safe frameworks for privileged tools?

2008-04-23 Thread Michael Watson

That's the hang-up. The target directory may require privilege to see.


--
m-s

On 23 Apr, 2008, at 02:42, Kevin Grant wrote:

Does the target directory require privilege to see, or does
it just happen to be used by a privileged tool?

If the latter, you could always rely on a 2nd executable
(without privilege) to examine the directory and return its
results to your privileged program.

Kevin G.




That's a good table to know/have handy. Thanks.

Okay, so LaunchServices is out as well. Is there *any* reliable way  
to know if a directory is a bundle or package without using  
NSWorkspace or LaunchServices? (I'm also going to have to omit  
Spotlight, since I can't be guaranteed it's enabled on a given  
machine.)



--
m-s

On 23 Apr, 2008, at 00:17, stephen joseph butler wrote:
On Tue, Apr 22, 2008 at 10:52 PM, Michael Watson [EMAIL PROTECTED] 


wrote:

I would like to use LaunchServices for this, but wasn't sure if  
it was
kosher to link to ApplicationServices.framework from a privileged  
tool. Are
there guidelines as to which frameworks should and shouldn't be  
used in
privileged tools? I know nothing can ever be safe, but some are  
surely

more dangerous than others, and I'd love some guidance.



This is the definitive list of safe frameworks:

http://developer.apple.com/technotes/tn2005/tn2083.html#SECFRAMEWORKCROSSREFERENCE

Unfortunately, ApplicationServices is a no. However, this blog  
posts

suggests some instances where it might be safe:

http://unixjunkie.blogspot.com/2006/10/launchservices-from-root-daemon.html


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Targeting nil in Interface Builder menu item

2008-04-23 Thread Graham Cox


On 23 Apr 2008, at 4:36 pm, Rick Mann wrote:
Well, now, that was obvious. For some reason, I was fixated on  
File's Owner, and I knew that wasn't right. I *knew* there was a  
First Responder object in there, but it just wasn't registering.


Round these parts they call that a brainfart. Happens to me all the  
time ;-)



So, thank you for that.



You're welcome.

G.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Setting NSImage with overlay blend to NSImageView

2008-04-23 Thread Ross Oliver

Hey,

I haven't used core graphics before and I'm looking to create an  
overlay blend mode effect with two images.


I have a NSImageView with the image set to an NSImage. What are the  
general steps I would need to take to draw another image on top of it  
and set it as an overlay?


The documentation Apple has is long and confusing - I can't seem to  
figure out how to even get a CGContextRef for the NSImageView.


Thanks for your time
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Safe frameworks for privileged tools?

2008-04-23 Thread Ken Thomases

On Apr 23, 2008, at 1:18 AM, Michael Watson wrote:
Okay, so LaunchServices is out as well. Is there *any* reliable way  
to know if a directory is a bundle or package without using  
NSWorkspace or LaunchServices?


Here's some info:

http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFBundles/Concepts/BundlesAndFinder.html

Unfortunately, there's still a lot of voodoo left in that.

-Ken

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: How to create shortcuts after installing the my package

2008-04-23 Thread Jean-Daniel Dupas


Le 23 avr. 08 à 06:53, JanakiRam a écrit :


Hi All,

   I'm porting a windows based application to Mac OS X. My  
application in
windows will create desktop shortcut once we install. I really don't  
whether
its mac standard to create desktop shortcut and dock icon once i  
install my

cocoa application.

 Can any one suggest me whether its a standard procedure.or provide  
the

necessary links/pointers.

JanakiRam.


A standard way to lets the user choose is to reveal the installed app  
in the Finder after the installation. So the user will be able to drop  
it in the Dock if needed.

There is an option in Package Maker to do this.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Inserting my own Responder before App?

2008-04-23 Thread Ken Thomases

On Apr 23, 2008, at 1:44 AM, Rick Mann wrote:
I've got a subclass of NSWindowController (a singleton in my app)  
inserted after the NSApplication in the responder chain, but is  
there any way for it to be the last responder before the app, such  
that Cocoa automatically makes things point first to my responder  
and then I can pass things on to the app?


See this:

http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/chapter_2_section_6.html

and also -[NSResponder setNextResponder:].

However, NSWindowController automatically uses that method to add  
itself as the next responder after the window it manages.  That's  
illustrated in the above link.  So, I don't think you need to do  
anything special.


Cheers,
Ken
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Daniel DeCovnick


On Apr 23, 2008, at 2:07 AM, Jens Alfke wrote:



On 22 Apr '08, at 10:21 PM, Daniel DeCovnick wrote:

Through a lot of thought experiments, I've come to the conclusion  
that the best place to save this sort of thing would be in the  
resource fork of the file being opened, but I could be totally off  
the mark there, and it's certainly an unorthodox thing to do.


It would have been the right thing to do ten years ago. But these  
days resource forks are definitely a legacy feature and it would be  
a bad idea to write new software that relies on them.


Have you looked at Extended Attributes? They're kind of the moral  
equivalent of resources, but they're newer, lighter-weight and  
better integrated into the filesystem. I don't know if there's any  
in-depth documentation, but you can start by reading the man pages  
for getxattr, setxattr, et al.




Thanks for the suggestion. I've just looked through them now, as well  
as at the OSXBook (Mac OS X Internals: A Systems Approach by Amit  
Singh) info on that. In theory it looks good, but it's somewhat  
confusing. It looks like, at least in 10.4, except for the resource  
fork which is mapped as a fake xattr, you can only have inline  
attributes, with a length limit of 3802 bytes, and it would be quite  
common for my data to be significantly larger than that. Does anyone  
know if that's changed for 10.5?


Option 3. Add my own Metadata key and put an XML or similarly  
textual version of my graphical rep as the string. I have no idea  
whether or not this is possible. It seems like a bad abuse of the  
metadata system in any case.


This seems reasonable. It's the same way that the Finder stores  
comments, which is analogous to what you're doing.




I dunno... it just seems that there's nowhere that the metadata system  
isn't integrated with Spotlight, and here, it wouldn't be. Seems to  
violate the spirit a bit. Still, it probably meets all the requirements.


Thanks for the suggestions,
Dan

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Inserting my own Responder before App?

2008-04-23 Thread Rick Mann


On Apr 23, 2008, at 12:37 AM, Ken Thomases wrote:


See this:

http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/chapter_2_section_6.html

and also -[NSResponder setNextResponder:].

However, NSWindowController automatically uses that method to add  
itself as the next responder after the window it manages.  That's  
illustrated in the above link.  So, I don't think you need to do  
anything special.



I did all that; that's not really what I want.

My NSWindowController subclass is not automatically hooked up (I  
tried). I am able to use the setNextResponder et al. to put it *after*  
the app, but I can't figure out how to set it up so it'll be *before*  
the app.


What I have works, but kinda bugs me, because the app is more final  
than my controller.


--
Rick

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: [ANN] TransactionKit, Lockless Multi-Reader, Multi-Writer Transaction Capable Hash Tables

2008-04-23 Thread Daniel DeCovnick


On Apr 22, 2008, at 7:48 PM, John Engelhart wrote:


snip



*applause*
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Inserting my own Responder before App?

2008-04-23 Thread j o a r


On Apr 23, 2008, at 12:46 AM, Rick Mann wrote:

My NSWindowController subclass is not automatically hooked up (I  
tried). I am able to use the setNextResponder et al. to put it  
*after* the app, but I can't figure out how to set it up so it'll be  
*before* the app.



Did you hook it up to be the delegate of the window? That's how it  
ends up in the responder chain. In this way it would appear *before*  
the app, which typically is what you want. If you want to add  
something *after* the app, don't use a window controller, use an  
application delegate.


j o a r


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Inserting my own Responder before App?

2008-04-23 Thread Manfred Schwind
I've got a subclass of NSWindowController (a singleton in my app)  
inserted after the NSApplication in the responder chain, but is  
there any way for it to be the last responder before the app, such  
that Cocoa automatically makes things point first to my responder  
and then I can pass things on to the app?


I don't know you actual goal, but maybe subclassing NSApplication is a  
solution?


Mani
--
http://www.mani.de
iVolume - Loudness adjustment for iTunes.
LittleSecrets - The encrypted notepad.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Inserting my own Responder before App?

2008-04-23 Thread Cathy Shive
Does your window know about the window controller and vice-versa?   
It's not clear how you're setting this up from your post, but you  
might need to tell the window about your window controller subclass:


[window setWindowController:windowController];

Or the other way around?

[windowController setWindow:window];

Or using brute force, the window controller can add itself to the  
responder chain after the window like this:


[window setNextResponder:self];

If they know about each other, it shouldn't be necessary to  
explicitly set the window's next responder, though.


Best,
Cathy


On Apr 23, 2008, at 9:46 AM, Rick Mann wrote:



On Apr 23, 2008, at 12:37 AM, Ken Thomases wrote:


See this:

http://developer.apple.com/documentation/Cocoa/Conceptual/ 
EventOverview/EventArchitecture/chapter_2_section_6.html


and also -[NSResponder setNextResponder:].

However, NSWindowController automatically uses that method to add  
itself as the next responder after the window it manages.  That's  
illustrated in the above link.  So, I don't think you need to do  
anything special.



I did all that; that's not really what I want.

My NSWindowController subclass is not automatically hooked up (I  
tried). I am able to use the setNextResponder et al. to put it  
*after* the app, but I can't figure out how to set it up so it'll  
be *before* the app.


What I have works, but kinda bugs me, because the app is more  
final than my controller.


--
Rick

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/catshive%40gmail.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Uneditable NSTableView

2008-04-23 Thread Ewan Delanoy

Hello all,

  I'm trying to construct a Cocoa app that mimicks the Mail application,
with the difference
that it's not especially intended for mails : one the upper part a list of
titles, and on the lower
part exactly one titletext is shown. Double-clicking on a title in the
upper part makes the corresponding text displayed in the lower part.

 I implement the upper part as a NSTableView subclass (which I call
UneditableTableView), with one column and all rows uneditable (by setting
the tableView:shouldEditTableColumn:row:
method to always return NO in the delegate). That main app controller
a signature of signature -(void)updateLowerPartAfterSelectionInUpperPart
that makes the lower part display
the text associated to the title just selected. Finally, in some place in
my code
I have the line

   [uneditableTableView
setDoubleAction:@selector(updateLowerPartAfterSelectionInUpperPart:)];


  Unfortunately, this doesn't work : although the rows are indeed
uneditable and I can select
any one of them, the updateLowerPartAfterSelectionInUpperPart method is
never called
when I double-click on a title. Does anyone have any idea of what I should
do to fix this?


 TIA,


Ewan


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Uneditable NSTableView

2008-04-23 Thread Ian Jackson
Perhaps you have a good reason, but from your description, and being  
used to using Mail, I'd expect the lower part to display the content  
with a single click.
Have you used setTarget: and setAction: to coordinate this double  
click event?


Ian.

On 23/04/2008, at 8:33 PM, Ewan Delanoy wrote:



   Hello all,

 I'm trying to construct a Cocoa app that mimicks the Mail  
application,

with the difference
that it's not especially intended for mails : one the upper part a  
list of

titles, and on the lower
part exactly one titletext is shown. Double-clicking on a title in  
the

upper part makes the corresponding text displayed in the lower part.

I implement the upper part as a NSTableView subclass (which I call
UneditableTableView), with one column and all rows uneditable (by  
setting

the tableView:shouldEditTableColumn:row:
method to always return NO in the delegate). That main app controller
a signature of signature - 
(void)updateLowerPartAfterSelectionInUpperPart

that makes the lower part display
the text associated to the title just selected. Finally, in some  
place in

my code
I have the line

  [uneditableTableView
setDoubleAction:@selector(updateLowerPartAfterSelectionInUpperPart:)];


 Unfortunately, this doesn't work : although the rows are indeed
uneditable and I can select
any one of them, the updateLowerPartAfterSelectionInUpperPart  
method is

never called
when I double-click on a title. Does anyone have any idea of what I  
should

do to fix this?

TIA 
,



   Ewan


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bianface%40gmail.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSCollectionView and CoreData question

2008-04-23 Thread Matthew Delves


On 23/04/2008, at 12:08 AM, I. Savant wrote:

Having set the 'content' binding to the arrangedObjects key in IB  
didn't
produce a result though doing it programmatically has. Not sure why  
this

would be.


It depends. Since you have provided neither the exact bindings
settings you're using nor the code you used to establish the binding
manually, it's impossible to say.

Further, with the NSView, is there a way of knowing which of the  
objects
that are contained in the NSCollectionView is being  drawn and  
further being

able to get the data for that specific object?


Not to sound like a broken record, but, have you *read* the
documentation? Sure, the NSCollectionView / NSCollectionViewItem
mechanism is a bit more challenging than your standard button or
table, but not by much and it is fairly well-documented. See
NSCollectionViewItem's documentation, paying particular attention to
the phrase represented object.


What I've been using as far as trying to get the represented object is  
first having the following as part of awakeFromNib in my controller  
object.


[theView setDelegate:self];
[collectionView bind:@content
toObject:self
 withKeyPath:@arrangedObjects
 options:nil];
[collectionView setItemPrototype:collectionViewItem];
	repObject = [[NSManagedObject alloc] initWithEntity: 
[NSEntityDescription entityForName:@PodcastEpisodeTimestamp


   
inManagedObjectContext:[selfmanagedObjectContext]]

insertIntoManagedObjectContext:[self managedObjectContext]];

[collectionViewItem setRepresentedObject:repObject];


Though when I try to do something with what is returned by the  
represented object such as


[[collectionViewItem representedObject] valueForKey:@length]

This unfortunately returns nil.

Is anyone aware of what I'm doing wrong with this?

Thanks,
Matthew Delves
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Setting NSImage with overlay blend to NSImageView

2008-04-23 Thread Michael Vannorsdel
Each view draw's into the window's graphic context.  When focus is  
locked on a view the window's context is clipped and translated to the  
view so that drawing is limited to just the view's bounds.  Basically  
all views in a window generally use the window's context (OpenGL views  
and whatnot have their own context).  To get the context for the  
window use NSGraphicsContext's graphicsContextWithWindow: or  
NSWindow's graphicsContext to get the Cocoa context, then use the  
graphicsPort method to get a CGContextRef from it (docs say it returns  
a void*, but it is a CGContextRef).


Also, I believe a window has a different graphics context for each  
thread that draws to it, so try and draw from the thread you got the  
CGContextRef from.  Probably just keep drawing within the main thread  
to be safe.


You might also look into CoreImage (CIImage, CIContext) if you need to  
support 10.4; many of the new CGContext blend modes are 10.5 only.



On Apr 23, 2008, at 1:13 AM, Ross Oliver wrote:

I haven't used core graphics before and I'm looking to create an  
overlay blend mode effect with two images.


I have a NSImageView with the image set to an NSImage. What are the  
general steps I would need to take to draw another image on top of  
it and set it as an overlay?


The documentation Apple has is long and confusing - I can't seem to  
figure out how to even get a CGContextRef for the NSImageView.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSScanner question

2008-04-23 Thread Michael Vannorsdel
At first glance I'd say it's crashing because you're not checking if  
scanUpToCharactersFromSet:intoString: was successful and trying to add  
what may be an invalid object (foundStrings) to an array.



On Apr 23, 2008, at 3:46 AM, Jason Wiggins wrote:

I've been playing with NSScanner to cut a string eg:   this is a  
test  So is thistest
from a search field into its components. ie. extract the quoted text  
to be placed into an array as well as the other components, pre and  
post quoted text. The other components will eventually be split with  
componentsSeparatedByString.


My issue is that if I paste the above text into the search field,  
all is OK. But if I type in- test
as a test case, it locks up and fails with The Debugger has exited  
due to signal 11 (SIGSEGV).The Debugger has exited due to signal 11  
(SIGSEGV).


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: How to retain Previous content view in cocoa

2008-04-23 Thread Michael Vannorsdel
Not sure what you're really asking given there's no info other than  
the subject.  If you're asking how to retain a previous window's  
content view, just call retain on it until you need it again.  If  
you're talking about drawn areas in a view or window you can cache the  
area with NSWindow's cacheImageInRect: and restore the area with  
restoreCachedImage.  If neither of these apply, I'd need a more  
specific question to offer better advice.



On Apr 22, 2008, at 11:06 PM, KATHERASALA KALPANA wrote:


(Nothing)

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Carriage returns and NSXMLParser

2008-04-23 Thread Ian Jackson
Whitespace is preserved, not ignored. But in your example, the new  
line is in the attribute value, so I don't suppose XML cares too much  
what's between the quotation marks.
So if you can obtain the value of the data attribute, and print the  
value to the console, does it come out with a space instead of the \n?


Ian.

On 23/04/2008, at 12:16 AM, Brad Peterson wrote:


Hi,

Have there been any recent changes to NSXMLParser with
respect to carriage returns?

I haven't noticed it previously, but I'm suddenly
seeing a lot of cases where carriage returns embedded
in data are returned as spaces by the parser.

That is:
record  id=429 data=A sample\nrecord /

Is read in as if it were:
record  id=429 data=A sample record /

I know that whitespace is technically ignored in XML,
but I didn't think it was necessarily discarded
either.

Is that the way it's supposed to be? Is there an
option I can set to change that?

Thanks!!


  


Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bianface%40gmail.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Uneditable NSTableView

2008-04-23 Thread Andy Lee

On Apr 23, 2008, at 4:33 AM, Ewan Delanoy wrote:

I have the line

  [uneditableTableView
setDoubleAction:@selector(updateLowerPartAfterSelectionInUpperPart:)];


 Unfortunately, this doesn't work : although the rows are indeed
uneditable and I can select
any one of them, the updateLowerPartAfterSelectionInUpperPart  
method is

never called
when I double-click on a title.


Is your method really called  
updateLowerPartAfterSelectionInUpperPart?  It should be  
updateLowerPartAfterSelectionInUpperPart:.  I notice it was correct in  
the @selector(), but I thought I'd check anyway.


--Andy

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Uneditable NSTableView

2008-04-23 Thread Andy Lee
Good question -- if you want the double action to be called, you have  
to set the app controller to be the table view's target, not just its  
delegate.  You can, of course, make the connection in IB; you don't  
have to use setTarget:.


--Andy

On Apr 23, 2008, at 5:22 AM, Ian Jackson wrote:
Perhaps you have a good reason, but from your description, and being  
used to using Mail, I'd expect the lower part to display the content  
with a single click.
Have you used setTarget: and setAction: to coordinate this double  
click event?


Ian.

On 23/04/2008, at 8:33 PM, Ewan Delanoy wrote:



  Hello all,

I'm trying to construct a Cocoa app that mimicks the Mail  
application,

with the difference
that it's not especially intended for mails : one the upper part a  
list of

titles, and on the lower
part exactly one titletext is shown. Double-clicking on a title in  
the

upper part makes the corresponding text displayed in the lower part.

I implement the upper part as a NSTableView subclass (which I call
UneditableTableView), with one column and all rows uneditable (by  
setting

the tableView:shouldEditTableColumn:row:
method to always return NO in the delegate). That main app controller
a signature of signature - 
(void)updateLowerPartAfterSelectionInUpperPart

that makes the lower part display
the text associated to the title just selected. Finally, in some  
place in

my code
I have the line

 [uneditableTableView
setDoubleAction 
:@selector(updateLowerPartAfterSelectionInUpperPart:)];



Unfortunately, this doesn't work : although the rows are indeed
uneditable and I can select
any one of them, the updateLowerPartAfterSelectionInUpperPart  
method is

never called
when I double-click on a title. Does anyone have any idea of what I  
should

do to fix this?

   TIA 
,



  Ewan


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bianface%40gmail.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/aglee%40mac.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Rob Keniger


On 23/04/2008, at 5:41 PM, Daniel DeCovnick wrote:

Thanks for the suggestion. I've just looked through them now, as  
well as at the OSXBook (Mac OS X Internals: A Systems Approach by  
Amit Singh) info on that. In theory it looks good, but it's somewhat  
confusing. It looks like, at least in 10.4, except for the resource  
fork which is mapped as a fake xattr, you can only have inline  
attributes, with a length limit of 3802 bytes, and it would be quite  
common for my data to be significantly larger than that. Does anyone  
know if that's changed for 10.5?



As an alternative to storing the information with the file itself,  
could your application store an alias record to the file along with  
your custom data in a data store managed by your application? That way  
you don't need to modify the original files in any way.


You can use BDAlias or one of the other Obj-C wrappers for the alias  
management code.


--
Rob Keniger



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: [Ann] DMG Canvas

2008-04-23 Thread Raphael Sebbe
seems fine, cannot try it though:bzip2: (stdin): trailing garbage after EOF
ignored

the dmg won't mount. Is it me ?

Raphael

On Tue, Apr 22, 2008 at 11:58 PM, Ricky Sharp [EMAIL PROTECTED] wrote:


 On Apr 22, 2008, at 2:00 AM, Seth Willits wrote:

  Off topic, I admit, but y'all being fellow Cocoa developers, and having
  specifically written the app for us, I thought it fitting to post here.
  http://www.araelium.com/dmgcanvas/
 


 Where was this a few months ago? :)

 I'll have to check this out as it looks very good.  I recently chucked
 FileStorm (also due to numerous bugs).

 I currently use shell scripts (around hdiutil) and call them from
 Automator to create my DMGs.

 ___
 Ricky A. Sharp mailto:[EMAIL PROTECTED]
 Instant Interactive(tm)   http://www.instantinteractive.com


 ___

 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com

 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/raphael.sebbe%40gmail.com

 This email sent to [EMAIL PROTECTED]

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Ken Thomases

On 23/04/2008, at 5:41 PM, Daniel DeCovnick wrote:

Thanks for the suggestion. I've just looked through them now, as  
well as at the OSXBook (Mac OS X Internals: A Systems Approach by  
Amit Singh) info on that. In theory it looks good, but it's somewhat  
confusing. It looks like, at least in 10.4, except for the resource  
fork which is mapped as a fake xattr, you can only have inline  
attributes, with a length limit of 3802 bytes, and it would be quite  
common for my data to be significantly larger than that. Does anyone  
know if that's changed for 10.5?


I say, if using the resource fork works for you, go for it.  Whatever  
disadvantages there might be are 1) theoretical, and 2) no worse than  
extended attributes.


No sense bending over backward to try to get some supposedly superior  
solution to work not quite as well as the resource fork would.


That's my two cents, anyway.

Cheers,
Ken
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Matt Gough
I'd second that. The OS (well, Finder) also adds things to the  
resource fork of files (custom icons, info about which app to open a  
file with when you changed it from the default etc). Just as long as  
you respect the existing contents this is exactly where you should put  
your data.



On 23 Apr 2008, at 14:29, Ken Thomases wrote:


On 23/04/2008, at 5:41 PM, Daniel DeCovnick wrote:

Thanks for the suggestion. I've just looked through them now, as  
well as at the OSXBook (Mac OS X Internals: A Systems Approach by  
Amit Singh) info on that. In theory it looks good, but it's  
somewhat confusing. It looks like, at least in 10.4, except for the  
resource fork which is mapped as a fake xattr, you can only have  
inline attributes, with a length limit of 3802 bytes, and it would  
be quite common for my data to be significantly larger than that.  
Does anyone know if that's changed for 10.5?


I say, if using the resource fork works for you, go for it.   
Whatever disadvantages there might be are 1) theoretical, and 2) no  
worse than extended attributes.


No sense bending over backward to try to get some supposedly  
superior solution to work not quite as well as the resource fork  
would.


That's my two cents, anyway.

Cheers,
Ken
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/matt.gough%40agfa.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Complex data for webservices

2008-04-23 Thread Niklas Saers

Hi Jeff, and thanks for answering :-)

On Apr 21, 2008, at 3:30 PM, Jeff LaMarche wrote:
I'm no expert on Web Services on Objective-C, but I've been playing  
around with them a bit.  One thing that I have discovered is that  
CFTypeRef is not _always_ a dictionary. In some cases, it wants a  
string.


Thanks for the tip! :-)

Without knowing what your web service looks like I don't think I can  
be any more helpful than that. Have you used the debugger to step  
through the setParameters: method while it's running? You might be  
able to tell what it's looking for by doing that. That was how I  
figured out to pass in a space delimited list as an NSString rather  
than a dictionary.


I've made a dummy webservice that looks pretty much like the one I  
use: http://78.157.102.46:2234/DummyWS/Service1.asmx?WSDL
So to generate my stubs I do: WSMakeStubs -x ObjC -name DummyStubs  - 
url http://78.157.102.46:2234/DummyWS/Service1.asmx?WSDL


First of all, it generates the functions twice, so I need to delete  
half of them. :-I It also gives me five warnings saying warning:  
initialization discards qualifiers from pointer target type, but at  
least now I'm good to go.


Then I make my method:

NSString *testStr = (NSString*) [myService testString:[[NSDictionary  
alloc] init]];

NSLog(@testStr: %@, testStr);
NSDictionary *testDict = (NSDictionary*) [myService testString: 
[[NSDictionary alloc] init]];

NSLog(@testDict count: %d, [testDict count]);

When the method is called, there's a bit network activity, but the log  
sais:


Apr 23 14:38:59 MBP SampleApp[1742]: testStr: (null)
Apr 23 14:38:59 MBP SampleApp[1742]: testDict count: 0

Cheers

Nik
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Adam R. Maxwell


On Apr 23, 2008, at 12:41 AM, Daniel DeCovnick wrote:



On Apr 23, 2008, at 2:07 AM, Jens Alfke wrote:



On 22 Apr '08, at 10:21 PM, Daniel DeCovnick wrote:

Through a lot of thought experiments, I've come to the conclusion  
that the best place to save this sort of thing would be in the  
resource fork of the file being opened, but I could be totally off  
the mark there, and it's certainly an unorthodox thing to do.


It would have been the right thing to do ten years ago. But these  
days resource forks are definitely a legacy feature and it would be  
a bad idea to write new software that relies on them.


Have you looked at Extended Attributes? They're kind of the moral  
equivalent of resources, but they're newer, lighter-weight and  
better integrated into the filesystem. I don't know if there's any  
in-depth documentation, but you can start by reading the man pages  
for getxattr, setxattr, et al.




Thanks for the suggestion. I've just looked through them now, as  
well as at the OSXBook (Mac OS X Internals: A Systems Approach by  
Amit Singh) info on that. In theory it looks good, but it's somewhat  
confusing. It looks like, at least in 10.4, except for the resource  
fork which is mapped as a fake xattr, you can only have inline  
attributes, with a length limit of 3802 bytes, and it would be quite  
common for my data to be significantly larger than that. Does anyone  
know if that's changed for 10.5?


The limits aren't very well documented (or implemented), but you can  
avoid the limit by splitting it into multiple attributes.


We save notes as extended attributes in Skim; this link is to a BSD  
licensed NSFileManager category for writing arbitrarily sized NSData  
as extended attributes by compressing it and then splitting it up if  
needed.


http://skim-app.svn.sourceforge.net/viewvc/*checkout*/skim-app/trunk/NSFileManager_ExtendedAttributes.m

It works great on HFS+, but there are some caveats:

- creating a zip archive in Finder will destroy EA
- creating a disk image of a file with hdiutil will destroy EA under  
some conditions
- asr may lose EA (we had at least one report of install+migration  
failing)
- various filesystems (e.g. AFP) have different size limits than HFS+  
and IIRC the return value of the setxattr function won't tell you it  
failed in this case


Lack of filesystem support will bite you with resource forks as well,  
but the first two are fixed in 10.5.  It's still cleaner than messing  
with resource fork code, IMO, and for the common case it works very  
well.


--
adam
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Removing subviews that are layer backed problem.

2008-04-23 Thread Mathieu Coursolle

Hi Cocoa developers,

I have a custom view (let's call this one the main view) which shows  
some UI controls and another custom subview which is layer backed  
(wantsLayer = YES). I created my own CAOpenGLLayer subclass to perform  
specific OpenGL drawing in it.


The main view needs to change its content view according to some  
state. When I remove
a content view which has a layer-backed subview, the layer does not  
disappear right away.

Its stays there for 1 second and then disappear.

Should it disappear as I remove its view?

Thanks!

MAthieu

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Sean McBride
On 4/23/08 1:21 AM, Daniel DeCovnick said:

I'm writing an application that opens particular kinds of files,
parses them, displays an editable graphical representation of the
contents of a file, and saves the results of the changes to the file.
However, some graphical changes don't result in changes to the
original file, yet those changes need to be saved - a little bit
analogous to the Finder saving the positions of icons in a window, but
not changing the files themselves. This seems like a perfect use of
package documents (a la .rtfd), except for one problem: the files I'm
opening aren't mine, and should remain openable in other applications,
so I can't wrap them up. I'd also really like to avoid making changes
to the files themselves, at least the portions that their normal
programs read.

The Resource fork has been used for a long time for exactly that
purpose.  As others have said, extended attributes are another
possibility.  Both risk being clobbered by poorly written tools.
Personally, I think a resource is a better idea.  They're actually less
likely to get clobbered as they have been around longer (you could even
copy them to a Classic system, or 10.0, etc.).  The Resource Manager is
not deprecated and is even available in 64 bit (unlike other parts of
Carbon).  NDResourceFork provides a nice Cocoa wrapper over the C APIs.  See:
http://homepage.mac.com/nathan_day/pages/source.xml

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Carriage returns and NSXMLParser

2008-04-23 Thread Daniel Staal
--As of April 23, 2008 9:04:21 PM +1200, Ian Jackson is alleged to have 
said:



Whitespace is preserved, not ignored. But in your example, the new line
is in the attribute value, so I don't suppose XML cares too much what's
between the quotation marks.
So if you can obtain the value of the data attribute, and print the value
to the console, does it come out with a space instead of the \n?


--As for the rest, it is mine.

To be more specific: XML considers whitespace significant inside element 
_content,_ but not within the elements themselves.  NSXML* deal with this 
very close to the spec, as far as I can tell.


So the behavior seen by the parent is normal, and could well happen with 
any compliant XML parser.


Daniel T. Staal

---
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Complex data for webservices

2008-04-23 Thread Jeff LaMarche

When I try to access your WSDL, I get:

Server Error in '/DummyWS' Application.

Generally, though, I don't believe the response from a web service is  
a dictionary - I believe it's usually a string and I'm wondering why  
you are sending an empty dictionary - it would seem like nil would be  
a better choice if you want to send without any data. Also, you are  
leaking memory there since your code will never release the dictionary  
you allocated in the first line of your method. You need to either  
release or autorelease when you are done with the dictionary - the  
stubs will retain it if they need to.


Let's see, what else...

You say there is some network activity, so why don't you try using  
tcpdump to see what is being passed back and forth. It would be  
something like this in a terminal window:


sudo tcpdump -s 0 -v -A -i en1 port 80

Changing en1 to the adaptor you're using.  Then run your script and  
you should see what communication with the web service. It's a good  
idea to close all your Safari windows so that no extraneous AJAX  
requests get sent by Safari during your run, or you can use Ethereal ( http://www.ethereal.com/ 
 ), which lets you filter by application.


It should become pretty obvious from the communication what your stubs  
are doing with the argument you give it, and what the response is.


HTH
Jeff
On Apr 23, 2008, at 8:41 AM, Niklas Saers wrote:


Hi Jeff, and thanks for answering :-)

On Apr 21, 2008, at 3:30 PM, Jeff LaMarche wrote:
I'm no expert on Web Services on Objective-C, but I've been playing  
around with them a bit.  One thing that I have discovered is that  
CFTypeRef is not _always_ a dictionary. In some cases, it wants a  
string.


Thanks for the tip! :-)

Without knowing what your web service looks like I don't think I  
can be any more helpful than that. Have you used the debugger to  
step through the setParameters: method while it's running? You  
might be able to tell what it's looking for by doing that. That was  
how I figured out to pass in a space delimited list as an NSString  
rather than a dictionary.


I've made a dummy webservice that looks pretty much like the one I  
use: http://78.157.102.46:2234/DummyWS/Service1.asmx?WSDL
So to generate my stubs I do: WSMakeStubs -x ObjC -name DummyStubs  - 
url http://78.157.102.46:2234/DummyWS/Service1.asmx?WSDL


First of all, it generates the functions twice, so I need to delete  
half of them. :-I It also gives me five warnings saying warning:  
initialization discards qualifiers from pointer target type, but at  
least now I'm good to go.


Then I make my method:

NSString *testStr = (NSString*) [myService testString:[[NSDictionary  
alloc] init]];

NSLog(@testStr: %@, testStr);
NSDictionary *testDict = (NSDictionary*) [myService testString: 
[[NSDictionary alloc] init]];

NSLog(@testDict count: %d, [testDict count]);

When the method is called, there's a bit network activity, but the  
log sais:


Apr 23 14:38:59 MBP SampleApp[1742]: testStr: (null)
Apr 23 14:38:59 MBP SampleApp[1742]: testDict count: 0

Cheers

Nik


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Uneditable NSTableView

2008-04-23 Thread Ewan Delanoy
Perhaps you have a good reason, but from your description, and being
used to using Mail, I'd expect the lower part to display the content
with a single click.


  The reason is, I know how to produce easily the double-click behaviour
with Cocoa but not the (better) click behaviour


Good question -- if you want the double action to be called, you have
to set the app controller to be the table view's target, not just its
delegate. You can, of course, make the connection in IB; you don't
have to use setTarget:.

   I'm not quite sure what you mean by target here, so I'll be
more specific about how I make my connections :

 -since my Cocoa project is relatively simple the app controller's job,
instead of being treated by a separate class, is done directly by a
NSDocument subclass called MyDocument.

 -The MyDocument instance acts as a data source for the
UneditableTableView, (I tell that to IB as you say by making
the data source connection with the mouse. I can see that
this has been done correctly at runtime anyway because the
table view's contents are what they should be). Also,
MyDocument implements

- (int)numberOfRowsInTableView:(NSTableView *)aTableView;
- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex;
it does not implement
- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject
forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndexnotnot
because it does need to : the rows are uneditable.


  Lastly, as in this case the UneditableTableView's delegate does very
little (I only need
to write the - (BOOL)tableView:(NSTableView *)aTableView
shouldEditTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
method) I indulged in making a new
class called UneditableTableViewDelegate, (which I also instantiate in IB
and I make the
delegate connection in IB also) just for the pleasure of having a very
short
UneditableTableViewDelegate.m file (I was told that it is a better
programming philosophy
to make many short code files that few long ones, but perhaps Cocoa
experts will tell me it is not a good thing to do in this case?)


  
Ewan


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Jens Alfke
Another possibility is to write a short unique string (like a UUID)  
into an extended attribute, and then use that as a key into your own  
external data store, like a database or plist you put in some central  
place.


A nice feature of this approach is that you only have to modify the  
file once, not every time your data changes.
A drawback is that if the file is sent to somebody else, the  
information doesn't go with it. (Which, depending on what the info is,  
could be considered a benefit: people have gotten in trouble for  
forgetting about the metadata Word attaches to their documents.)


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Re: Uneditable NSTableView

2008-04-23 Thread Keary Suska
on 4/23/08 8:41 AM, [EMAIL PROTECTED] purportedly said:

 Good question -- if you want the double action to be called, you have
 to set the app controller to be the table view's target, not just its
 delegate. You can, of course, make the connection in IB; you don't
 have to use setTarget:.
 
I'm not quite sure what you mean by target here, so I'll be
 more specific about how I make my connections :

The target is the object that your selector message will be sent to. How
will your TableView know which object responds to the selector you give it?
It's not magic...

HTH, 

Keary Suska
Esoteritech, Inc.
Demystifying technology for your home or business


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Special handling of keystrokes in a window controller

2008-04-23 Thread Duncan Champney
My app has a number of input fields that are used to change light  
settings, camera x/y/z position, etc for a 3D view window. ALL these  
fields are numeric, and don't need to handle non number characters  
(they need to handle 0-9, +, -, ., and possibly E for  
scientific notation, although I'm not sure I need it.)


I have added the method control:textView:doCommandBySelector: to my  
window controller, so I can intercept the up/down arrow keys when a  
text field is the key field, and increment/decrement the field value.


My 3D view also has certain keystrokes that it handles. If the 3D view  
is the current first responder, the user can click + / -  (with or  
without the shift key) to zoom in or out of the 3D view.


i would really like to have keystrokes that will zoom in or out of the  
3D view regardless of what field on my window is the current first  
responder. I couldn't use the plus or minus keys for this, because  
some of my input values can be negative, and the user needs to be able  
to type in a sign value in those fields.


Right now, if one of the input fields is the first responder, the plus  
and minus keys go to that input field, changing the value of that  
field. It's confusing for the user.


I could easily change my zoom in/zoom out keystrokes to be the bracket  
keys ([  ] with or without shift), or some other set of keys that  
are only used by the 3D view, but I need a way to intercept them. Is  
there a clean way for me to catch certain keystrokes globally for the  
window, and pass them to my 3D view, while letting others go to the  
current firstResponder?



Duncan C
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: A cursor bug in DragItemAround example

2008-04-23 Thread an0
  Chances are, calling '[[self enclosingScrollView]
 setDocumentCursor:[NSCursor closedHandCursor]]' in 'mouseDown:' will fix the
 problem you're seeing. NSScrollView/NSClipView's way of changing the cursor
 conflicts with autoscrolling or drag-scrolling, but AFAIK there's no way of
 preventing that interference directly.
This partially works. However, if you move the item off the visible
part of scroll view and then move back, you'll find a arrowCursor
instead of openHandCursor when cursor hovers on the item. It seems
cursor problems pervade Cocoa applications and Apple just ignores
them:(
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Failure on unarchiving a NSBezierPath

2008-04-23 Thread an0
I was building a very simple drawing application, but met problems
when reading the file saved by my application.

The two functions as to archiving/unarchiving are as follows:
- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError
{
return [NSKeyedArchiver archivedDataWithRootObject:view.drawing];
}

- (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName
error:(NSError **)outError
{
NSBezierPath *drawing = [NSKeyedUnarchiver
unarchiveObjectWithData:data]; //*** returns nil
if (drawing == nil) {
return NO;
} else {
view.drawing = drawing;
return YES;
}
}

Nothing appeared when I opened a saved file, and log said:
2008-04-23 23:33:44.127 EasyDraw[631:10b] *** -[NSDocumentController
localizedFailureReason]: unrecognized selector sent to instance
0x11b210
2008-04-23 23:33:44.128 EasyDraw[631:10b] *** -[NSDocumentController
localizedFailureReason]: unrecognized selector sent to instance
0x11b210

I don't know what the log means.

Besides, I found the value returned by [NSKeyedUnarchiver
unarchiveObjectWithData:data] was nil, but I didn't understand why,
since it was normal when I saved the file using [NSKeyedArchiver
archivedDataWithRootObject:view.drawing].
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Special handling of keystrokes in a window controller

2008-04-23 Thread Michael Vannorsdel
You can subclass NSWindow for your window and override keyDown:.  The  
ones you want to pass down the chain you send by calling the  
superclass's keyDown.



On Apr 23, 2008, at 9:36 AM, Duncan Champney wrote:

I could easily change my zoom in/zoom out keystrokes to be the  
bracket keys ([  ] with or without shift), or some other set of  
keys that are only used by the 3D view, but I need a way to  
intercept them. Is there a clean way for me to catch certain  
keystrokes globally for the window, and pass them to my 3D view,  
while letting others go to the current firstResponder?


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Daniel DeCovnick
That's pretty much option 1, albeit implemented slightly more robustly  
than I was thinking of. But my data's not sensitive, so there's no  
advantage in losing it on sending it to someone else, and in fact I'd  
much prefer it was retained if possible.


-Dan


On Apr 23, 2008, at 11:10 AM, Jens Alfke wrote:

Another possibility is to write a short unique string (like a UUID)  
into an extended attribute, and then use that as a key into your own  
external data store, like a database or plist you put in some  
central place.


A nice feature of this approach is that you only have to modify the  
file once, not every time your data changes.
A drawback is that if the file is sent to somebody else, the  
information doesn't go with it. (Which, depending on what the info  
is, could be considered a benefit: people have gotten in trouble for  
forgetting about the metadata Word attaches to their documents.)


—Jens


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


QTMovie grabing while playback

2008-04-23 Thread Nikolai Hellwig

Hi,

I've done some image analysing software for QTKit Capture. It works  
fine. Now i need to use this for a quicktime movie.
I can playback the quicktime movie, but i can't find any delegate  
which tells my application, that a new frame is rendered. If i can get  
this information i could grab this frame in order to analyse it.


can anyone tell me how to do it? I don't want the user to click  
grabFrame or something like that.


regards
Nikolai Hellwig

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Uneditable NSTableView (SOLVED)

2008-04-23 Thread Ewan Delanoy
I'm not quite sure what you mean by target here
The target is the object that your selector message will be sent to.
How will your TableView know which object responds to the selector you
give it? It's not magic...
HTH

  It did help indeed, and even solved my problem! (it now works with a
single click by the way, just as in Mail). I was confused because
although I already knew how an action in an object could be the target
of a button or a single cell in a table view,  I hadn't yet understood
that it could be the target of a table view as a whole, with the
action triggered by any of the cells in it. Many thanks!


Ewan



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread John Stiles

Thirded.

Matt Gough wrote:
I'd second that. The OS (well, Finder) also adds things to the 
resource fork of files (custom icons, info about which app to open a 
file with when you changed it from the default etc). Just as long as 
you respect the existing contents this is exactly where you should put 
your data.



On 23 Apr 2008, at 14:29, Ken Thomases wrote:


On 23/04/2008, at 5:41 PM, Daniel DeCovnick wrote:

Thanks for the suggestion. I've just looked through them now, as 
well as at the OSXBook (Mac OS X Internals: A Systems Approach by 
Amit Singh) info on that. In theory it looks good, but it's somewhat 
confusing. It looks like, at least in 10.4, except for the resource 
fork which is mapped as a fake xattr, you can only have inline 
attributes, with a length limit of 3802 bytes, and it would be quite 
common for my data to be significantly larger than that. Does anyone 
know if that's changed for 10.5?


I say, if using the resource fork works for you, go for it.  Whatever 
disadvantages there might be are 1) theoretical, and 2) no worse than 
extended attributes.


No sense bending over backward to try to get some supposedly superior 
solution to work not quite as well as the resource fork would.


That's my two cents, anyway.

Cheers,
Ken
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/matt.gough%40agfa.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jstiles%40blizzard.com

This email sent to [EMAIL PROTECTED]

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


NSImage and NSImageView issues (not drawing correctly)

2008-04-23 Thread Nick Rogers

Hi,
1. I'm using:
NSImage *image = [[NSImage alloc] initWithData:data];
NSImageRep *imageRep = [image bestRepresentationForDevice:nil];
NSImage *imageToBeDrawn = [[NSImage alloc] init];
[imageToBeDrawn addRepresentation:imageRep];
if ([imageToBeDrawn isValid] == YES)
[previewImage setImage:imageToBeDrawn];
else
[previewImage setImage:nil];
[data release];

// where previewImage is of (NSImageView *) type.

But certain images (even the small size like 100KB) are not  
completely drawn, and the display shows garbled image.
certain PNG image shows only a black rectangle. only some small  
images are drawn in good quality.


2. Can I show text in NSImageView. Certain same category software are  
showing text in the same place as their NSIMageView. So I was  
wondering, how thats possible. (I have checked their nib files, and  
the text show at the same place as thier NSImageView).




Any help would be greatly appreciated.
Wishes,
Nick

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSImage and NSImageView issues (not drawing correctly)

2008-04-23 Thread Michael Vannorsdel
You might need to specify a size for some formats for your  
imageToBeDrawn object.




On Apr 23, 2008, at 10:27 AM, Nick Rogers wrote:


Hi,
1. I'm using:
NSImage *image = [[NSImage alloc] initWithData:data];
NSImageRep *imageRep = [image bestRepresentationForDevice:nil];
NSImage *imageToBeDrawn = [[NSImage alloc] init];
[imageToBeDrawn addRepresentation:imageRep];
if ([imageToBeDrawn isValid] == YES)
[previewImage setImage:imageToBeDrawn];
else
[previewImage setImage:nil];
[data release];

// where previewImage is of (NSImageView *) type.

But certain images (even the small size like 100KB) are not  
completely drawn, and the display shows garbled image.
certain PNG image shows only a black rectangle. only some small  
images are drawn in good quality.


2. Can I show text in NSImageView. Certain same category software  
are showing text in the same place as their NSIMageView. So I was  
wondering, how thats possible. (I have checked their nib files, and  
the text show at the same place as thier NSImageView).


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Daniel DeCovnick
That the Resource Manager is still around in 64-bit definitely  
alleviates one of my concerns - will whatever I use still be around  
in the future?


Thanks much,
Dan
On Apr 23, 2008, at 10:12 AM, Sean McBride wrote:


On 4/23/08 1:21 AM, Daniel DeCovnick said:


I'm writing an application that opens particular kinds of files,
parses them, displays an editable graphical representation of the
contents of a file, and saves the results of the changes to the file.
However, some graphical changes don't result in changes to the
original file, yet those changes need to be saved - a little bit
analogous to the Finder saving the positions of icons in a window,  
but

not changing the files themselves. This seems like a perfect use of
package documents (a la .rtfd), except for one problem: the files I'm
opening aren't mine, and should remain openable in other  
applications,

so I can't wrap them up. I'd also really like to avoid making changes
to the files themselves, at least the portions that their normal
programs read.


The Resource fork has been used for a long time for exactly that
purpose.  As others have said, extended attributes are another
possibility.  Both risk being clobbered by poorly written tools.
Personally, I think a resource is a better idea.  They're actually  
less
likely to get clobbered as they have been around longer (you could  
even
copy them to a Classic system, or 10.0, etc.).  The Resource Manager  
is

not deprecated and is even available in 64 bit (unlike other parts of
Carbon).  NDResourceFork provides a nice Cocoa wrapper over the C  
APIs.  See:

http://homepage.mac.com/nathan_day/pages/source.xml

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Gerd Knops
Coincidentally I just went through that same song and dance. With  
Spotlight becoming more and more important in OSX, it is surprising  
Apple has not provided a clean method to store arbitrary metadata with  
any kind of file. Maybe time for us all to file an enhancement request.


As others have mentioned, all currently available methods have  
drawbacks:


- resource fork: Antiquated, entire data has to be read and stored  
back to even change a flag, creeping feeling they might be dropped at  
some point, care has to be taken which tools are used to process the  
files so resource fork is not lost.


- xattrs: limited storage per attribute, tools may loose them.

- Other approaches like db, links, hidden files etc: Separation of  
file and metadata, no support by standard tools, synching is tricky.



Adobe attempted to solve the dilemma for graphic files by introducing  
XMP (http://www.adobe.com/products/xmp/), but it suffers from serious  
drawbacks:


- Not a generic solution
- Entire files have to be rewritten to modify metadata
- Adding the metadata in some file formats seems like a hack, and has  
limitations that are dependent on the file format

- Overly complicated and limiting storage schema
- SDK seems overly complicated (mildly speaking) and still lacking  
core functionality


Of course there are advantages to:

- Platform independent
- Metadata stays with files, no special knowledge required by file- 
handling tools, file systems or OS



But overall no clear winner. Only option is to analyse one's design  
goals, and pick the lesser of the evils.


In my opinion the best hypothetical solution would be if each file  
comes with a related directory that allows for storage of arbitrary  
metadata. However the hurdles of introducing something like that are  
enormous: All tools (simple tools like cp, complexer tools like tar,  
zip, rsync) would need to add support, and ways to make storage on  
alien file systems and efficient use through network file systems  
would have to be found.


With metadata becoming more and more important in daily use it would  
be great if a platform independent way of storing metadata would be  
devised. But I am not holding my breath. In the mean time we all  
muddle along with our individual solutions...


Another, though related, issue is that spotlight importers still can  
not be cascaded. Even just adding a few simple fields of metadata to  
an existing file format means one has to re-implement the importer for  
that format from scratch, no way of 'sub-classing' existing importers.


Gerd (filing an enhancement request next)

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Daniel DeCovnick
Actually it is possible, at least according to the OSXBook, to add  
arbitrary key-value paired metadata to a file (IIRC, all MDItem keys  
share a flat namespace). It theoretically works without Spotlight, but  
nothing uses metadata that doesn't use Spotlight currently, AFAIK, and  
my data isn't anything that would be meaningful to anything or anyone  
outside of my app. It really is data rather than metadata.


On Apr 23, 2008, at 12:41 PM, Gerd Knops wrote:

Coincidentally I just went through that same song and dance. With  
Spotlight becoming more and more important in OSX, it is surprising  
Apple has not provided a clean method to store arbitrary metadata  
with any kind of file. Maybe time for us all to file an enhancement  
request.


With metadata becoming more and more important in daily use it would  
be great if a platform independent way of storing metadata would be  
devised. But I am not holding my breath. In the mean time we all  
muddle along with our individual solutions...


Another, though related, issue is that spotlight importers still can  
not be cascaded. Even just adding a few simple fields of metadata to  
an existing file format means one has to re-implement the importer  
for that format from scratch, no way of 'sub-classing' existing  
importers.



Off-topic, but amen!

-Dan
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Safe frameworks for privileged tools?

2008-04-23 Thread stephen joseph butler
On Wed, Apr 23, 2008 at 11:42 AM, Dave Camp [EMAIL PROTECTED] wrote:

 Unless I'm reading the OP wrong, he's writing a privileged helper tool,
 not a daemon. Given that, I don't think the above documents are applicable.


None of what I know is official, but just gathered and extrapolated from
years of reading information about this. So I might be wrong... who knows.

The unsafe frameworks make connections to the default window server. As a
program launched from Finder/Dock/et al, this will always work as expected.
Launched from ssh or root, there are some caveats.

For ssh, they will work fine as long as the same user is logged onto the
GUI. As soon as the user logs out, your program loses its connection and
might crash.

For root, they will work as long as the console user stays the same. If
someone uses fast user switching, or logs out, then the program's connection
changes and it might crash.

In any event, none of the unsafe frameworks are documented as working in any
conditions other than the normal ones. People may get them to work 90% of
the time under other conditions, but that's unsupported and may change.

So unless DTS tells you otherwise, I'd stay away. But that's me... maybe 90%
is good enough for you.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: QTMovie grabing while playback

2008-04-23 Thread douglas a. welton

Nikolai,

QTMovieView has a delegate method

	- (CIImage*) view: (QTMovieView *)Target_View willDisplayImage:  
(CIImage *)New_Image


This method gives you a CIImage to play with before it is displayed in  
the Target_View.  Check the header file for QTMovieView.h (near the  
bottom).  I think the the MyMovieFilter sample code uses this method.


Note:  Depending on what type of analysis you are doing you may need  
to convert the CIImage into a pixel-based format.  If that is too slow  
you may want to get friendly with QTVisualContextIsNewImageAvailable()  
and the Display Link...  check out the CIVideoDemoGL sample code.


regards,

douglas


On Apr 23, 2008, at 12:19 PM, Nikolai Hellwig wrote:


Hi,

I've done some image analysing software for QTKit Capture. It works  
fine. Now i need to use this for a quicktime movie.
I can playback the quicktime movie, but i can't find any delegate  
which tells my application, that a new frame is rendered. If i can  
get this information i could grab this frame in order to analyse it.


can anyone tell me how to do it? I don't want the user to click  
grabFrame or something like that.


regards
Nikolai Hellwig


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: QTMovie grabing while playback

2008-04-23 Thread Jean-Daniel Dupas


Le 23 avr. 08 à 19:30, Bob Smith a écrit :


On Apr 23, 2008, at 10:05 AM, douglas a. welton wrote:


Nikolai,

QTMovieView has a delegate method

	- (CIImage*) view: (QTMovieView *)Target_View willDisplayImage:  
(CIImage *)New_Image


This method gives you a CIImage to play with before it is displayed  
in the Target_View.  Check the header file for QTMovieView.h (near  
the bottom).  I think the the MyMovieFilter sample code uses this  
method.



I cannot find this method in the documentation, where is it  
described?  Is it in the public interface?  This is the perfect  
solution to a similar problem I'm having with a Cocoa app using  
QuickTime, but I don't want to use undocumented private APIs.



Yes, it's a public method even if the documentation is missing.  
Undocumented does not mean private. You may considere that everything  
that is declared in public headers is public (except if there is a  
comment that say it's not, but it's unusual).


This method is not documented because this is a method introduce with  
QTKit 7.2 and the documentation was not updated to reflect the change.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: QTMovie grabing while playback

2008-04-23 Thread Randall Meadows

On Apr 23, 2008, at 11:30 AM, Bob Smith wrote:

On Apr 23, 2008, at 10:05 AM, douglas a. welton wrote:


QTMovieView has a delegate method

	- (CIImage*) view: (QTMovieView *)Target_View willDisplayImage:  
(CIImage *)New_Image


This method gives you a CIImage to play with before it is displayed  
in the Target_View.  Check the header file for QTMovieView.h (near  
the bottom).  I think the the MyMovieFilter sample code uses this  
method.


I cannot find this method in the documentation, where is it  
described?  Is it in the public interface?  This is the perfect  
solution to a similar problem I'm having with a Cocoa app using  
QuickTime, but I don't want to use undocumented private APIs.


I think he means QTCaptureView.  It's not undocumented; you'll find it  
in the QTCaptureView class reference material (available in QT 7.2.1  
and later).


Whether it's relevant for you or not depends on how you're displaying  
the movie.  I *think* (but am not 100% sure) that this delegate method  
is only valid for this particular type of view (which displays a video  
preview of a capture session).

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Uneditable NSTableView (SOLVED)

2008-04-23 Thread Corbin Dunn


On Apr 23, 2008, at 9:21 AM, Ewan Delanoy wrote:

  I'm not quite sure what you mean by target here
The target is the object that your selector message will be sent  
to.
How will your TableView know which object responds to the selector  
you

give it? It's not magic...
HTH


 It did help indeed, and even solved my problem! (it now works with a
single click by the way, just as in Mail). I was confused because
although I already knew how an action in an object could be the target
of a button or a single cell in a table view,  I hadn't yet understood
that it could be the target of a table view as a whole, with the
action triggered by any of the cells in it. Many thanks!


Based on your description of the problem, you probably want to update  
your lower pane via:


- (void)tableViewSelectionDidChange:(NSNotification *)notification;

.corbin
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Uli Kusterer

Am 23.04.2008 um 09:41 schrieb Daniel DeCovnick:
Thanks for the suggestion. I've just looked through them now, as  
well as at the OSXBook (Mac OS X Internals: A Systems Approach by  
Amit Singh) info on that. In theory it looks good, but it's somewhat  
confusing. It looks like, at least in 10.4, except for the resource  
fork which is mapped as a fake xattr, you can only have inline  
attributes, with a length limit of 3802 bytes, and it would be quite  
common for my data to be significantly larger than that. Does anyone  
know if that's changed for 10.5?



 You may want to look at the size limits on resource forks, though. I  
thought I'd blogged about that ages ago, but can't find the posting  
right now. The resource fork format is documented, though, so it  
shouldn't be too hard to figure out. There's for example a 2727  
resources limit on each file, and some offsets are 16-bit quantities.  
So, it's not really a good idea to have resources of several megabytes  
in size.


Cheers,
-- Uli Kusterer
The Witnesses of TeachText are everywhere...
http://www.zathras.de





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: QTMovie grabing while playback

2008-04-23 Thread Jean-Daniel Dupas


Le 23 avr. 08 à 19:58, Randall Meadows a écrit :


On Apr 23, 2008, at 11:30 AM, Bob Smith wrote:

On Apr 23, 2008, at 10:05 AM, douglas a. welton wrote:


QTMovieView has a delegate method

	- (CIImage*) view: (QTMovieView *)Target_View willDisplayImage:  
(CIImage *)New_Image


This method gives you a CIImage to play with before it is  
displayed in the Target_View.  Check the header file for  
QTMovieView.h (near the bottom).  I think the the MyMovieFilter  
sample code uses this method.


I cannot find this method in the documentation, where is it  
described?  Is it in the public interface?  This is the perfect  
solution to a similar problem I'm having with a Cocoa app using  
QuickTime, but I don't want to use undocumented private APIs.


I think he means QTCaptureView.  It's not undocumented; you'll find  
it in the QTCaptureView class reference material (available in QT  
7.2.1 and later).


Whether it's relevant for you or not depends on how you're  
displaying the movie.  I *think* (but am not 100% sure) that this  
delegate method is only valid for this particular type of view  
(which displays a video preview of a capture session).


This delegate method was also added to QTMovieView. It's really  
helpfull for example if you want to apply some effect or if you want  
to insert text in your movie.



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Inserting my own Responder before App?

2008-04-23 Thread Rick Mann


On Apr 23, 2008, at 1:01 AM, j o a r wrote:

Did you hook it up to be the delegate of the window? That's how it  
ends up in the responder chain. In this way it would appear *before*  
the app, which typically is what you want. If you want to add  
something *after* the app, don't use a window controller, use an  
application delegate.



I don't know which window to hook it to. From what I understand in the  
docs, Cocoa manages the responder chain dynamically, generally ending  
with the App, App's delegate, and the NSDocumentController. As the  
user activates various windows, the responder chain changes to reflect  
the currently-main document, but it's always topped by the app.


To be frank, I hadn't noticed that the document controller was last in  
the chain. Had I designed it, the document controller would be last,  
but just before the App. I suspect this is because there's no  
mechanism for saying this object is the 'top', and then having that  
object point to the NSApp.


My code currently inserts my controller between the app and whatever  
the app is pointing to. (I don't know what happens if an app delegate  
is installed after that.)


I really need for my controller to be created at launch, but not its  
window. I don't know if that's happening yet. But even though its  
window may never be shown, it still needs to be there to support other  
app operations, and to respond to the import action.


On Apr 23, 2008, at 1:06 AM, Cathy Shive wrote:

Does your window know about the window controller and vice-versa?   
It's not clear how you're setting this up from your post, but you  
might need to tell the window about your window controller subclass:


Good question. I sort of assumed that, because they are wired together  
in IB, that they know about each other. However, as mentioned above,  
the window may never actually be shown, but the controller needs to be  
there anyway.



[window setWindowController:windowController];

Or the other way around?

[windowController setWindow:window];

Or using brute force, the window controller can add itself to the  
responder chain after the window like this:


[window setNextResponder:self];

If they know about each other, it shouldn't be necessary to  
explicitly set the window's next responder, though.


Like I said, the window might not be showing, so I can't really depend  
on that mechanism to put my controller in the chain.


I'm sure most people deal with this situation by having NSApp respond  
to the import command, and forwarding that on to the appropriate  
object. That seems like a bit of a kludge in an environment where  
something like the responder chain exists.


I'm sure this is mostly moot (at least in this case); it's probably  
sufficient for my controller to live after the App, it's just less  
elegant.


Thanks,

--
Rick

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: QTMovie grabing while playback

2008-04-23 Thread Randall Meadows

On Apr 23, 2008, at 12:15 PM, Jean-Daniel Dupas wrote:

This delegate method was also added to QTMovieView. It's really  
helpfull for example if you want to apply some effect or if you want  
to insert text in your movie.


Nice.  I use the QTCaptureView version in my app to rotate a live  
video preview coming from a digital camera.  I use CIImage's - 
imagebyApplyingTransform: to rotate it 90° to match the orientation of  
the camera, but I can only get about 3 1/3 frames per second out of  
it.  MY client has requested a better frame rate than that, but I've  
been stymied so far.  Any suggestions on how to do better?___


Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Uli Kusterer

Am 23.04.2008 um 17:10 schrieb Jens Alfke:
Another possibility is to write a short unique string (like a UUID)  
into an extended attribute, and then use that as a key into your own  
external data store, like a database or plist you put in some  
central place.



 Not a good idea. The user could duplicate the file, and then both  
files would be associated with the same store entry...


Cheers,
-- Uli Kusterer
The Witnesses of TeachText are everywhere...
http://www.zathras.de





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


awakeFromInsert rules: ok to fetch and create other managed objects?

2008-04-23 Thread Sean McBride
Hi all,

I've been reading the archives for hours, trying to figure out the
'rules' for what can and cannot be done in awakeFromInsert.

1) Is it ok to execute a fetch from awakeFromInsert?  One might want to
do this to set a default property value that depends on other objects'
state.  It seems the answer is no.

2) Is it ok to create other managed objects in awakeFromInsert?  One
might want to do this to set initial relationships.  It seems the answer
is yes.

I'm hoping someone can confirm/deny these.

Thanks,

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Using OSMemoryBarrier() with KVO

2008-04-23 Thread Paul Thomas


On 23 Apr 2008, at 03:41, Ken Thomases wrote:


On Apr 22, 2008, at 6:37 AM, Paul Thomas wrote:


Is this enough? Or will I need to use a full blown lock?


What is it that you fear going wrong, such that you think even  
OSMemoryBarrier is necessary?


I think the barrier is needed to ensure that when other threads see  
done == YES, they can be certain that the other members are set and  
will not be changed.


What I didn't show in the code, but is implied, is the threads trying  
to access the result by checking done.


  if( [promise isDone] )
return [promise result];
  else
[promise observeValue... etc.

Anyway, I missed a hole. It requires an atomic 'observeIfNotDone'  
which means I need a lock. Premature optimisation and all that...


Thanks for you help (both),
pt.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Safe frameworks for privileged tools?

2008-04-23 Thread Michael Watson
Yes, it's a helper tool. It runs for a couple of seconds (under normal  
conditions) and exits immediately. It interacts with the file system  
by reading information about some directories, so its launched  
duration is, of course, bound to the responsiveness of the hard drive  
on which it's operating. As such, a couple of seconds might be five  
or ten seconds on machines where the drive is spinning up, otherwise  
busy, etc. It's certainly possible that someone might invoke fast user  
switching right in the middle of the tool running, but it's /probably/  
not an issue. I'm still not quite convinced it isn't, just yet. I need  
to do more thinking about it. The discussion so far has been very  
helpful.


As far as connecting to the window server goes, Apple states:

http://developer.apple.com/technotes/tn2005/tn2083.html#SECWINDOWSERVER

Apple plans to disable the global window server service in a future  
release of Mac OS X. Do not write any new code that uses the global  
window server service.


So when you say default window server, are you speaking of the  
global window server, or the default window server associated with the  
current console session?



--
m-s


On 23 Apr, 2008, at 13:04, stephen joseph butler wrote:
On Wed, Apr 23, 2008 at 11:42 AM, Dave Camp [EMAIL PROTECTED]  
wrote:


Unless I'm reading the OP wrong, he's writing a privileged helper  
tool,
not a daemon. Given that, I don't think the above documents are  
applicable.



None of what I know is official, but just gathered and extrapolated  
from
years of reading information about this. So I might be wrong... who  
knows.


The unsafe frameworks make connections to the default window server.  
As a
program launched from Finder/Dock/et al, this will always work as  
expected.

Launched from ssh or root, there are some caveats.

For ssh, they will work fine as long as the same user is logged onto  
the
GUI. As soon as the user logs out, your program loses its connection  
and

might crash.

For root, they will work as long as the console user stays the  
same. If
someone uses fast user switching, or logs out, then the program's  
connection

changes and it might crash.

In any event, none of the unsafe frameworks are documented as  
working in any
conditions other than the normal ones. People may get them to work  
90% of
the time under other conditions, but that's unsupported and may  
change.


So unless DTS tells you otherwise, I'd stay away. But that's me...  
maybe 90%

is good enough for you.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/mikey-san 
%40bungie.org


This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: QTMovie grabing while playback

2008-04-23 Thread Bob Smith

On Wed, 23 Apr 2008 20:15:39 +0200
 Jean-Daniel Dupas [EMAIL PROTECTED] wrote:


Le 23 avr. 08 à 19:58, Randall Meadows a écrit :


On Apr 23, 2008, at 11:30 AM, Bob Smith wrote:

On Apr 23, 2008, at 10:05 AM, douglas a. welton wrote:


QTMovieView has a delegate method

	- (CIImage*) view: (QTMovieView *)Target_View 
willDisplayImage:  
(CIImage *)New_Image


This method gives you a CIImage to play with before it 
is  
displayed in the Target_View.  Check the header file for 

QTMovieView.h (near the bottom).  I think the the 
MyMovieFilter  
sample code uses this method.


I cannot find this method in the documentation, where is 
it  
described?  Is it in the public interface?  This is the 
perfect  
solution to a similar problem I'm having with a Cocoa 
app using  
QuickTime, but I don't want to use undocumented private 
APIs.


I think he means QTCaptureView.  It's not undocumented; 
you'll find  
it in the QTCaptureView class reference material 
(available in QT  
7.2.1 and later).


Whether it's relevant for you or not depends on how 
you're  
displaying the movie.  I *think* (but am not 100% sure) 
that this  
delegate method is only valid for this particular type 
of view  
(which displays a video preview of a capture session).


This delegate method was also added to QTMovieView. It's 
really  helpfull for example if you want to apply some 
effect or if you want  to insert text in your movie.


Exactly what I'm trying to do, add text overlay to any 
movie being played.  I have been using the Core Video 
display link which is fine most of the time, except for 
unknown reasons it doesn't work with a streaming video 
source.  QTMovieView plays streams just fine, so if I can 
hook in to it's Core Image processing chain to add my 
overlays, problem solved.


One question, is it correct to assume the delegate method 
might be called on a secondary thread?


Thanks!

Bob
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSButton reveals keyboard shortuct [SOLVED]

2008-04-23 Thread Pierre Bernard
Answering part 1 of my own question: revealing the keyboard shortcut  
once the command key is pressed. C.f. below for the code


What remains is the second part: how does NSButton implement keyboard  
shortcuts. How would I implement and additional shortcut for a button  
which already has one.


Best,
Pierre Bernard
Houdah Software s.à r.l.



extern NSUInteger carbonToCocoaModifierFlags(UInt32  
carbonModifierFlags);
extern NSString *stringForCocoaModifierFlagsAndKeyCode(NSUInteger  
flags, NSString *keyEquivalent);



@implementation HHShortcutButton

@synthesize baseTitle;

- (id)initWithCoder:(NSCoder*)coder
{
if ((self = [super initWithCoder:coder]) != nil) {
[self setBaseTitle:[self title]];
}

return self;
}

- (void)viewDidMoveToWindow
{
[super viewDidMoveToWindow];

NSWindow *window = [self window];

if (window != nil) {
		[[NSNotificationCenter defaultCenter] addObserver:self  
selector:@selector(windowDidUpdate:)  
name:NSWindowDidUpdateNotification object:window];

}
}

- (void)setTitle:(NSString*)aTitle
{
[super setTitle:aTitle];

[self setBaseTitle:[self title]];
}

- (void)windowDidUpdate:(NSNotification*)notification
{
if (GetCurrentEventKeyModifiers()  cmdKey) {
NSString *keyEquivalent = [self keyEquivalent];
		NSUInteger keyEquivalentModifierMask = [self  
keyEquivalentModifierMask];


		[super  
setTitle:stringForCocoaModifierFlagsAndKeyCode 
(keyEquivalentModifierMask, keyEquivalent)];

}
else {
[super setTitle:[self baseTitle]];
}
}

@end

extern NSUInteger carbonToCocoaModifierFlags(UInt32 carbonModifierFlags)
{
NSUInteger cocoaModifierFlags = 0;

if (carbonModifierFlags  shiftKey) {
cocoaModifierFlags |= NSShiftKeyMask;
}

if (carbonModifierFlags  cmdKey) {
cocoaModifierFlags |= NSCommandKeyMask;
}

if (carbonModifierFlags  optionKey) {
cocoaModifierFlags |= NSAlternateKeyMask;
}

if (carbonModifierFlags  controlKey) {
cocoaModifierFlags |= NSControlKeyMask;
}

return cocoaModifierFlags;
}

extern NSString *stringForCocoaModifierFlagsAndKeyCode(NSUInteger  
flags, NSString *keyEquivalent)

{
return [NSString stringWithFormat:@[EMAIL PROTECTED]@[EMAIL PROTECTED]@%@,
			(flags  NSCommandKeyMask ? [NSString stringWithFormat:@%C + ,  
kCommandUnicode] : @),
			(flags  NSAlternateKeyMask ? [NSString stringWithFormat:@%C + ,  
kOptionUnicode] : @),
			(flags  NSControlKeyMask ? [NSString stringWithFormat:@%C + ,  
kControlUnicode] : @),
			(flags  NSShiftKeyMask ? [NSString stringWithFormat:@%C + ,  
kShiftUnicode] : @),

[keyEquivalent uppercaseString]];
}



On 22 Apr 2008, at 17:48, Pierre Bernard wrote:


Hi!

I love how the buttons in some save before closing sheets reveal  
themselves by being added to the button name when the command key is  
held for a while.
The one example I can think of is AppleWorks 6. Wish all apps /  
buttons had that.


Is this a Carbon thing?

How would I go about to implement this?
Seeing that the button in question is not in the responder chain, I  
guess the implementation ought to be moved to the window or window  
controller. This doesn't strike me as the best place. I'd rather  
have a reusable NSButton subclass.


Such buttons also may have multiple shortcuts. E.g. the default save  
button is triggered by both Enter and cmd-S. This does not seem to  
be possible with NSButton. Again I wonder if I should override  
keyDown: in my window controller.


BTW, how are keyboard shortcuts on NSButtons implemented? Do they  
somehow register with the window for events or does the window walk  
the subcomponents to find one which may respond?


Best,
Pierre

---
Pierre Bernard
http://www.bernard-web.com/pierre
http://www.houdah.com



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/i_love_my%40mac.com

This email sent to [EMAIL PROTECTED]


---
Pierre Bernard
http://www.bernard-web.com/pierre
http://www.houdah.com





smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Re: NSScanner question

2008-04-23 Thread Jason Wiggins
Thanks Michael for your reply. I guess I should be doing more validity  
checks. I'll play some more. Thanks for the suggestion.

Regards,
Jason

On 23/04/2008, at 7:57 PM, Michael Vannorsdel wrote:

At first glance I'd say it's crashing because you're not checking if  
scanUpToCharactersFromSet:intoString: was successful and trying to  
add what may be an invalid object (foundStrings) to an array.



On Apr 23, 2008, at 3:46 AM, Jason Wiggins wrote:

I've been playing with NSScanner to cut a string eg:   this is  
a test  So is thistest
from a search field into its components. ie. extract the quoted  
text to be placed into an array as well as the other components,  
pre and post quoted text. The other components will eventually be  
split with componentsSeparatedByString.


My issue is that if I paste the above text into the search field,  
all is OK. But if I type in- test
as a test case, it locks up and fails with The Debugger has exited  
due to signal 11 (SIGSEGV).The Debugger has exited due to signal 11  
(SIGSEGV).


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jwiggins%40optusnet.com.au

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Uneditable NSTableView (SOLVED)

2008-04-23 Thread Ewan Delanoy
 Corbinn Dunn wrote
   I'm not quite sure what you mean by target here
 The target is the object that your selector message will be sent
 to.
 How will your TableView know which object responds to the selector
 you
 give it? It's not magic...
 HTH

  It did help indeed, and even solved my problem! (it now works with a
 single click by the way, just as in Mail). I was confused because
 although I already knew how an action in an object could be the target
 of a button or a single cell in a table view,  I hadn't yet understood
 that it could be the target of a table view as a whole, with the
 action triggered by any of the cells in it. Many thanks!

 Based on your description of the problem, you probably want to update
 your lower pane via:

 - (void)tableViewSelectionDidChange:(NSNotification *)notification;

 .corbin


  That wouldn't be very useful for what I do because I also want
the Mail-like feature of multiple selection (and possible erasing of
the selected items). Generally, I think using delegate methods like
this becomes awkward when there are many ways for the selection to change.

   Ewan





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Inserting my own Responder before App?

2008-04-23 Thread Ken Thomases

On Apr 23, 2008, at 1:20 PM, Rick Mann wrote:
My code currently inserts my controller between the app and whatever  
the app is pointing to. (I don't know what happens if an app  
delegate is installed after that.)


I really need for my controller to be created at launch, but not its  
window. I don't know if that's happening yet. But even though its  
window may never be shown, it still needs to be there to support  
other app operations, and to respond to the import action.


It seems like you're combining the role which might be called the  
application controller and a window controller.  If you are dealing  
with a window controller which has no window to control, then that  
smells like you're fighting the framework.


The app controller is usually just an instance of a custom class  
(subclassing from NSObject or whatever).  It is also usually set up as  
the application delegate.  You can even instantiate it in the main nib  
and hook up the File's Owner's delegate outlet to point to it.


Although the delegate comes after the application object in the  
responder chain, you don't typically care.  The application  
_delegates_ almost everything to its delegate.  :)  Well, everything  
which isn't completely generic.


This is the normal way for implementing custom application-global  
actions.  Implement them on the application delegate.


Cheers,
Ken
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Chris Williams
But the resource fork idea has the same issue if someone uses/sends/writes
to the file from the other 90% of the computers on the planet... (windows).
Doesn't it?

I think you're best tracking the info in your own data source, doing your
best to track and keep up with the user changing it outside your world, and
leaving the original file alone.  But like all the other suggestions here,
that's just one opinion :)

 From: Daniel DeCovnick [EMAIL PROTECTED]
 Subject: Re: Resource Fork - is this a good use/the right thing to do?
 
 That's pretty much option 1, albeit implemented slightly more robustly
 than I was thinking of. But my data's not sensitive, so there's no
 advantage in losing it on sending it to someone else, and in fact I'd
 much prefer it was retained if possible.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Uneditable NSTableView (SOLVED)

2008-04-23 Thread Nate Weaver
If that's the case, you can simply check [yourTableView  
numberOfSelectedRows] in -tableViewSelectionDidChange: and update the  
bottom view based on the result.


On Apr 23, 2008, at 2:05 PM, Ewan Delanoy wrote:

Corbinn Dunn wrote

 I'm not quite sure what you mean by target here

The target is the object that your selector message will be sent
to.
How will your TableView know which object responds to the selector
you
give it? It's not magic...
HTH


It did help indeed, and even solved my problem! (it now works with a
single click by the way, just as in Mail). I was confused because
although I already knew how an action in an object could be the  
target
of a button or a single cell in a table view,  I hadn't yet  
understood

that it could be the target of a table view as a whole, with the
action triggered by any of the cells in it. Many thanks!


Based on your description of the problem, you probably want to update
your lower pane via:

- (void)tableViewSelectionDidChange:(NSNotification *)notification;

.corbin



 That wouldn't be very useful for what I do because I also want
the Mail-like feature of multiple selection (and possible erasing of
the selected items). Generally, I think using delegate methods like
this becomes awkward when there are many ways for the selection to  
change.


  Ewan


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: QTMovie grabing while playback

2008-04-23 Thread douglas a. welton

Bob  Randall,

If all you want to do is slap some arbitrary text over a movie, I  
would suggest that you take a look at using  QTMovieLayer and  
CATextLayer as the mechanism for doing this.  I don't have any code  
that I can share with you on this, but a previous client project used  
these two Core Animation objects with excellent results.


regards,

douglas

On Apr 23, 2008, at 2:39 PM, Bob Smith wrote:


On Wed, 23 Apr 2008 20:15:39 +0200
Jean-Daniel Dupas [EMAIL PROTECTED] wrote:

Le 23 avr. 08 à 19:58, Randall Meadows a écrit :

On Apr 23, 2008, at 11:30 AM, Bob Smith wrote:

On Apr 23, 2008, at 10:05 AM, douglas a. welton wrote:


QTMovieView has a delegate method

	- (CIImage*) view: (QTMovieView *)Target_View  
willDisplayImage:  (CIImage *)New_Image


This method gives you a CIImage to play with before it is   
displayed in the Target_View.  Check the header file for  
QTMovieView.h (near the bottom).  I think the the MyMovieFilter   
sample code uses this method.


I cannot find this method in the documentation, where is it   
described?  Is it in the public interface?  This is the perfect   
solution to a similar problem I'm having with a Cocoa app using   
QuickTime, but I don't want to use undocumented private APIs.


I think he means QTCaptureView.  It's not undocumented; you'll  
find  it in the QTCaptureView class reference material (available  
in QT  7.2.1 and later).


Whether it's relevant for you or not depends on how you're   
displaying the movie.  I *think* (but am not 100% sure) that this   
delegate method is only valid for this particular type of view   
(which displays a video preview of a capture session).
This delegate method was also added to QTMovieView. It's really   
helpfull for example if you want to apply some effect or if you  
want  to insert text in your movie.


Exactly what I'm trying to do, add text overlay to any movie being  
played.  I have been using the Core Video display link which is fine  
most of the time, except for unknown reasons it doesn't work with a  
streaming video source.  QTMovieView plays streams just fine, so if  
I can hook in to it's Core Image processing chain to add my  
overlays, problem solved.


One question, is it correct to assume the delegate method might be  
called on a secondary thread?


Thanks!

Bob
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/douglas_welton%40earthlink.net

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


A Cocoa means to detect SysPref 'Enable access for assistive devices

2008-04-23 Thread Steve Cronin

Folks;

Is there a straight Cocoa means to detect the System Preferences/ 
Universal Access setting for 'Enable access for assistive devices'?


I've found plenty of references on using Applescript to detect this  
setting.
The Cocoa Assistive API seems pretty extensive but I can't glean a way  
to just determine this setting using Cocoa...


I understand the potential 'admin' aspects of the setting.
All I want is a means to know what the current setting is.

Any links or code snippets appreciated!
Steve
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: A Cocoa means to detect SysPref 'Enable access for assistive devices

2008-04-23 Thread Peter Maurer
Is there a straight Cocoa means to detect the System Preferences/ 
Universal Access setting for 'Enable access for assistive devices'?


I don't think this counts as Cocoa, but it's better than AppleScript:  
AXAPIEnabled()


Peter.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: A Cocoa means to detect SysPref 'Enable access for assistive devices

2008-04-23 Thread Bill Cheeseman
on 2008-04-23 4:37 PM, Peter Maurer at [EMAIL PROTECTED] wrote:

 Is there a straight Cocoa means to detect the System Preferences/
 Universal Access setting for 'Enable access for assistive devices'?
 
 I don't think this counts as Cocoa, but it's better than AppleScript:
 AXAPIEnabled()

You can also make your app trusted using the AX API, in Leopard, so that
the Universal Access preference need not be set at all. But it requires
authentication so you have to jump through a lot of hoops to implement it.

You can also set the Universal Access preference using AppleScript, in Tiger
and Leopard, without jumping through any hoops at all (because System
Preferences takes care of the authentication dialog for you). Thus, you
could use NSAppleScript or OSAKit to run a script that will set the
Universal Access setting, if you find that it is not already set.

--

Bill Cheeseman - [EMAIL PROTECTED]
Quechee Software, Quechee, Vermont, USA
www.quecheesoftware.com

PreFab Software - www.prefabsoftware.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Caching a local file using NSURLCache

2008-04-23 Thread Stephan Burlot

Hi,

I want to cache local files (images) so I cache a NSData using  
[NSURLCache storeCachedResponse]
If I try to fetch it, the cachedResponseForRequest:request is always  
nil under 10.5


This works under 10.4.

I tried to create my own sharedURLCache, but it still doesn't work.

I use

  NSString *path = [NSString stringWithString:@/Library/Desktop  
Pictures/Nature/Clown Fish.jpg];

  NSImage*  diskImage;

  diskImage = [[NSImage alloc] initWithContentsOfFile:path];

  NSData*data = [diskImage TIFFRepresentation];

  NSURL *cacheURL = [NSURL fileURLWithPath:aPath];

  NSURLResponse *response = [[[NSURLResponse alloc]
  initWithURL:cacheURL
  MIMEType:@application/octet-stream
  expectedContentLength:[data length]
  textEncodingName:nil] autorelease];
  NSCachedURLResponse *cachedResponse = [[[NSCachedURLResponse alloc]  
initWithResponse:response

  data:data
userInfo:[NSDictionary  
dictionary]

storagePolicy:NSURLCacheStorageAllowed] autorelease];

  NSURLRequest *request = [NSURLRequest requestWithURL:cacheURL];
  [self storeCachedResponse:cachedResponse forRequest:request];

  cachedResponse = [self cachedResponseForRequest:request];
  if (cachedResponse) {
NSLog(@cached data for %@ is %d, [[cachedResponse response]  
URL], [[cachedResponse data] length]);

  } else {
NSLog(@Cached response is NULL);
  }

What is the correct way to use NSURLCache with NSData on 10.5?

I have a test project available http://coriolis.ch/dl/cache.zip if  
anyone wants to have a look,


Thanks,
Stephan

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Safe frameworks for privileged tools?

2008-04-23 Thread Chris Suter


On 24/04/2008, at 4:35 AM, Michael Watson wrote:

Yes, it's a helper tool. It runs for a couple of seconds (under  
normal conditions) and exits immediately. It interacts with the file  
system by reading information about some directories, so its  
launched duration is, of course, bound to the responsiveness of the  
hard drive on which it's operating. As such, a couple of seconds  
might be five or ten seconds on machines where the drive is  
spinning up, otherwise busy, etc. It's certainly possible that  
someone might invoke fast user switching right in the middle of the  
tool running, but it's /probably/ not an issue. I'm still not quite  
convinced it isn't, just yet. I need to do more thinking about it.  
The discussion so far has been very helpful.


As far as connecting to the window server goes, Apple states:

http://developer.apple.com/technotes/tn2005/ 
tn2083.html#SECWINDOWSERVER


Apple plans to disable the global window server service in a future  
release of Mac OS X. Do not write any new code that uses the global  
window server service.


So when you say default window server, are you speaking of the  
global window server, or the default window server associated with  
the current console session?


The document you are looking at is talking about unsafe frameworks for  
daemons. You're writing a helper tool, not a daemon, so it's not  
applicable.


A helper tool (that's run as a helper to a GUI application) will run  
fine linked to any frameworks. If the helper tool is spawned by a GUI  
process, it will inherit its session and so there's no issue with it  
using the global window server service. The only issue is what  
security hazards linking to other frameworks introduce. The idea is  
that you should link to as little as possible so as to minimise the  
risk and you should probably avoid using Objective-C (although I don't  
actually know if there are any security risks from using Objective-C— 
non privileged Input Managers are surely not loaded). I would have  
thought that any security risks that exist from linking to other  
frameworks are considered bugs which means that there won't be a list  
of “safe” frameworks anywhere and if you find any issues, they need to  
be reported to Apple.


Kind regards,

Chris



smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Re: IB3 can't find my class

2008-04-23 Thread John Stiles

Nick Zitzmann wrote:


On Apr 23, 2008, at 4:04 PM, John Stiles wrote:

I have a class declared in code which, until recently, didn't have 
any IBActions in it.
Recently I added some, and went to IB3, but it didn't notice that I 
had added the actions. I had to manually add them via the + button.
Is there any way I can give IB3 a hint so it can find the class' 
@interface declaration? In case it matters, it's in a .mm file, not a 
header... does IB3 only look at headers?


Was it in a framework? IB 3 tends to ignore frameworks other than the 
AppKit framework.

Nope, no frameworks.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


NSTextView text coloring problem

2008-04-23 Thread tyler durden
Hi Everybody,
I am reposting this since I haven't got any answers, yet. 
Hope somebody helps this time around.

I am writing an easy chat application. I have an object of NSTextview on my UI 
form. I want to change the text color in a specified range from default color 
black to red. I used the method setTextColor:range: but it did not work. 
Following is my declaration of the object and the corresponding code. 

More specifically, the code below is supposed to change color of a certain 
range of characters (in the following case, between 1st and the 6th chars) but 
it doesn't really work. it either changes the color of the whole text to red 
when I start from zero or it doesn't make any changes if I start from 1.


Any suggestions ? 

IBOutlet NSTextView* _view;

[(_view) setTextColor:[NSColor redColor] range: NSMakeRange(1,5)];



  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSTextView text coloring problem

2008-04-23 Thread Jean-Daniel Dupas

Look like you text view does not allow rich text.

Make sure the Allow Rich Text check box is checked in your TextView  
config in IB or set it programaticaly using -[NSTextView setRichText:]


- (void)setRichText:(BOOL)flag
	“Controls whether the text views sharing the receiver’s layout  
manager allow the user to apply attributes to specific ranges of text.”



Le 24 avr. 08 à 00:19, tyler durden a écrit :


Hi Everybody,
I am reposting this since I haven't got any answers, yet.
Hope somebody helps this time around.

I am writing an easy chat application. I have an object of  
NSTextview on my UI form. I want to change the text color in a  
specified range from default color black to red. I used the method  
setTextColor:range: but it did not work. Following is my  
declaration of the object and the corresponding code.


More specifically, the code below is supposed to change color of a  
certain range of characters (in the following case, between 1st and  
the 6th chars) but it doesn't really work. it either changes the  
color of the whole text to red when I start from zero or it doesn't  
make any changes if I start from 1.



Any suggestions ?

IBOutlet NSTextView* _view;

[(_view) setTextColor:[NSColor redColor] range: NSMakeRange(1,5)];



  


Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org

This email sent to [EMAIL PROTECTED]



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSTextView text coloring problem

2008-04-23 Thread Graham Cox


On 24 Apr 2008, at 8:19 am, tyler durden wrote:

Any suggestions ?

IBOutlet NSTextView* _view;

[(_view) setTextColor:[NSColor redColor] range: NSMakeRange(1,5)];




You can just set the fore-colour attribute on the text itself:


(typed into Mail)

[[_view textStorage] addAttribute:NSForegroundColorAttributeName value: 
[NColor redColor] range:NSMakeRange( 1, 5 )];



Aside: your ivars shouldn't start with an underscore - Apple reserves  
such names for its own classes.



hth,


G.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: A cursor bug in DragItemAround example

2008-04-23 Thread Quincey Morris


On Apr 23, 2008, at 08:10, an0 wrote:


Chances are, calling '[[self enclosingScrollView]
setDocumentCursor:[NSCursor closedHandCursor]]' in 'mouseDown:'  
will fix the
problem you're seeing. NSScrollView/NSClipView's way of changing  
the cursor
conflicts with autoscrolling or drag-scrolling, but AFAIK there's  
no way of

preventing that interference directly.

This partially works. However, if you move the item off the visible
part of scroll view and then move back, you'll find a arrowCursor
instead of openHandCursor when cursor hovers on the item. It seems
cursor problems pervade Cocoa applications and Apple just ignores
them:(


Does this sample application still use cursorRects/NSTrackingRects?  
Leopard introduced a new mechanism -- NSTrackingArea and cursorUpdate  
events -- which doesn't have some of the problems that the old  
mechanism supposedly had.


With NSTrackingArea and cursorUpdate you should be able to get  
complete, consistent control of the cursor inside the visible portion  
of your view (even when returning from the outside), and it's fairly  
easy to use. [NSScrollView setDocumentCursor:] will still be necessary  
to control the part of the scroll view outside the visible portion of  
your view, and control entirely outside the scroll view (or window)  
will be harder to enforce, because other views (and other windows) may  
have their own ideas.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Library-Object in NSPersistentDocument but not in XML-file

2008-04-23 Thread Mike Donovan
Hello everybody!
In my document-based core data application I have a outline view which
displays a list of departments like this (similar to iTunes):

COMPANY [Item]
-- All Employees [SmartItem : Item]
-- Department A [Department : Item]
-- Department B [Department : Item]

That works very well! Items have many children and one parent and the
NSTreeController handles it without any problems. However: I don't want any
Items (COMPANY) or SmartItems (All Employees) to be saved in the
document because they are only temporary objects so to say. This is done in
CoreRecipes using two different stores: NSXMLStoreType and
NSInMemoryStoreType. When I tried to add this to my app, the saved document
is empty. It looks like all objects are assigned to the in-memory store. In
fact, the in-memory store is the only one in the context until the document
gets saved.

Can you help me?

Mike
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Mike Fischer

Am 23.04.2008 um 09:43 schrieb Daniel DeCovnick [EMAIL PROTECTED]:


On Apr 23, 2008, at 2:07 AM, Jens Alfke wrote:



On 22 Apr '08, at 10:21 PM, Daniel DeCovnick wrote:


Through a lot of thought experiments, I've come to the conclusion
that the best place to save this sort of thing would be in the
resource fork of the file being opened, but I could be totally off
the mark there, and it's certainly an unorthodox thing to do.


It would have been the right thing to do ten years ago. But these
days resource forks are definitely a legacy feature and it would be
a bad idea to write new software that relies on them.

Have you looked at Extended Attributes? They're kind of the moral
equivalent of resources, but they're newer, lighter-weight and
better integrated into the filesystem. I don't know if there's any
in-depth documentation, but you can start by reading the man pages
for getxattr, setxattr, et al.



Thanks for the suggestion. I've just looked through them now, as well
as at the OSXBook (Mac OS X Internals: A Systems Approach by Amit
Singh) info on that. In theory it looks good, but it's somewhat
confusing. It looks like, at least in 10.4, except for the resource
fork which is mapped as a fake xattr, you can only have inline
attributes, with a length limit of 3802 bytes, and it would be quite
common for my data to be significantly larger than that. Does anyone
know if that's changed for 10.5?


Depending on your semantics you could always just save a UUID in an  
extended attribute and then associate that with your own storage  
mechanism. That should always fit the size limitations.


To be more safe/compatible you could actually save the UUID as an  
extended attribute as well in a resource. When reading use either and  
reconsruct the missing one if necessary and possible.



HTH
Mike
--
Mike Fischer Softwareentwicklung, EDV-Beratung
Schulung, Vertrieb
Note: I read this list in digest mode!
  Send me a private copy for faster responses.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Application Launch (or doesn't Launch as such)

2008-04-23 Thread David Wilson

Hi everyone...

I'm perplexed...

I'm running Xcode 3.1 (actually iPhone SDK Beta 3) on Mac OS 10.5.2


My application doesn't launch when I click the run button in Xcode  
(note it is NOT an iPhone app). It's an application to control USB  
devices.
XCode tells me that the application has launched, yet it does not  
appear in the doc.


HOWEVER

I have now discovered if I run the application (from xcode) by  
choosing Run:Debug, it launches and runs (i.e. the main windows  
appears).



I have done a clean and build several times, that doesn't change things.
I the past during development, I've always tested the program by  
clicking the build and go or go buttons on the screen. But not any  
more (for this app).




Interesting enough, I have another application (more recently  
developed - and also controls a USB device) that works just fine in  
the same xcode release by clicking go or build and go.



any ideas?


- David


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Daniel DeCovnick




You may want to look at the size limits on resource forks, though. I  
thought I'd blogged about that ages ago, but can't find the posting  
right now. The resource fork format is documented, though, so it  
shouldn't be too hard to figure out. There's for example a 2727  
resources limit on each file, and some offsets are 16-bit  
quantities. So, it's not really a good idea to have resources of  
several megabytes in size.





I'm pretty sure the resource fork size limits are rather large... EV  
Nova's data files, in which everything is stored in the resource fork,  
go up to 13.8 MB. Also, it's a definite advantage that the resource  
fork is well-documented. That's more than one can say for xattrs,  
which are best documented in the OSXBook over a grand total of 3 pages.


But the resource fork idea has the same issue if someone uses/sends/ 
writes
to the file from the other 90% of the computers on the planet...  
(windows).

Doesn't it?


I don't think it does... doesn't NTFS have support for arbitrary named  
forks as well? At least to the point that it doesn't overwrite other  
forks when the data fork is written to? I mean, Windows can't read or  
write to them, AFAIK, but the low-level read/write routines should  
preserve it. I may be completely off base here, as I think I'm quoting  
a blog post, which may or may not have been a wishlist for Windows  
behavior. :-p


To be more safe/compatible you could actually save the UUID as an  
extended attribute as well in a resource. When reading use either  
and reconsruct the missing one if necessary and possible.



Unfortunately, as Uli pointed out, it's no longer unique if the file  
is duplicated. So I think that approach is out.


-Dan
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Application Launch (or doesn't Launch as such)

2008-04-23 Thread Kevin Grant

Are you using features like ZeroLink, that won't
work in a normal release build?

Kevin G.



Hi everyone...

I'm perplexed...

I'm running Xcode 3.1 (actually iPhone SDK Beta 3) on Mac OS 10.5.2


My application doesn't launch when I click the run button in Xcode  
(note it is NOT an iPhone app). It's an application to control USB  
devices.
XCode tells me that the application has launched, yet it does not  
appear in the doc.


HOWEVER

I have now discovered if I run the application (from xcode) by  
choosing Run:Debug, it launches and runs (i.e. the main windows  
appears).



I have done a clean and build several times, that doesn't change  
things.
I the past during development, I've always tested the program by  
clicking the build and go or go buttons on the screen. But not any  
more (for this app).




Interesting enough, I have another application (more recently  
developed - and also controls a USB device) that works just fine in  
the same xcode release by clicking go or build and go.



any ideas?


- David

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Application Launch (or doesn't Launch as such)

2008-04-23 Thread David Wilson
Interestingly enough I thought that Zero_Link was off (so that I  
could send copies of the app to others). And this had been done long  
ago 10.4.x days...


Looking now, I see a User Defined Attribute called Zero_Link and  
it's set to NO.
I've deleted it and recompiled (from clean). This appears not to have  
made any difference.




- David


On 24/04/2008, at 2:03 PM, Kevin Grant wrote:


Are you using features like ZeroLink, that won't
work in a normal release build?

Kevin G.



Hi everyone...

I'm perplexed...

I'm running Xcode 3.1 (actually iPhone SDK Beta 3) on Mac OS 10.5.2


My application doesn't launch when I click the run button in Xcode  
(note it is NOT an iPhone app). It's an application to control USB  
devices.
XCode tells me that the application has launched, yet it does not  
appear in the doc.


HOWEVER

I have now discovered if I run the application (from xcode) by  
choosing Run:Debug, it launches and runs (i.e. the main windows  
appears).



I have done a clean and build several times, that doesn't change  
things.
I the past during development, I've always tested the program by  
clicking the build and go or go buttons on the screen. But not any  
more (for this app).




Interesting enough, I have another application (more recently  
developed - and also controls a USB device) that works just fine in  
the same xcode release by clicking go or build and go.



any ideas?


- David


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Chris Suter


On 24/04/2008, at 11:53 AM, Daniel DeCovnick wrote:

I'm pretty sure the resource fork size limits are rather large... EV  
Nova's data files, in which everything is stored in the resource  
fork, go up to 13.8 MB. Also, it's a definite advantage that the  
resource fork is well-documented. That's more than one can say for  
xattrs, which are best documented in the OSXBook over a grand total  
of 3 pages.


The limits for resource forks are the same as for data forks. On HFS+  
file-systems, they're stored in the same way as data forks are,  
whereas extended attributes are stored in the attributes file. You can  
still access the resource forks as if they were extended attributes.


I don't think it does... doesn't NTFS have support for arbitrary  
named forks as well?
At least to the point that it doesn't overwrite other forks when the  
data fork is written to? I mean, Windows can't read or write to  
them, AFAIK, but the low-level read/write routines should preserve  
it. I may be completely off base here, as I think I'm quoting a blog  
post, which may or may not have been a wishlist for Windows  
behavior. :-p


NTFS does have support fro arbitrary named forks, but whether or not  
they're used depends on the implementation used to write them to an  
NTFS system. When OS X copies files with resource forks to file- 
systems that don't have support for resource-forks, I believe it  
creates an additional hidden file to store the data. The problem with  
these hidden files is that only OS X knows about them and so they'll  
not follow the file if you copy them using any other system. I don't  
know whether the SMB or read/write NTFS implementations used on OS X  
have proper support for resource forks (I doubt it). It doesn't look  
like the read-only NTFS implementation on OS X does. Sending files via  
e-mails doesn't work. FAT file-systems obviously don't.


Unfortunately, as Uli pointed out, it's no longer unique if the file  
is duplicated. So I think that approach is out.


Furthermore, it doesn't follow the file which was the original design  
goal.


Going back to the original question, I personally think that the best  
thing to do is to just create another file and educate the user.  
Extended attributes and resource forks are all very nice but most  
users don't understand what they are and they just don't interoperate  
nicely with other systems.


You can probably improve the user experience on OS X by storing the  
Catalog ID (as well as other details) of the file so that if the two  
files get separated you can easily find where it's moved to (assuming  
it's on the same file-system).


- Chris



smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Jason Stephenson

Chris Suter wrote:



Furthermore, it doesn't follow the file which was the original design goal.

Going back to the original question, I personally think that the best 
thing to do is to just create another file and educate the user. 
Extended attributes and resource forks are all very nice but most users 
don't understand what they are and they just don't interoperate nicely 
with other systems.


My first thought on reading this thread is that it would be easiest just 
to store the data in a zip-type archive file. You could then have all 
the metadata/resource files included in an archive subdirectory, and 
everything would transfer nicely across operating systems. 
OpenOffice.org does this. All of the components of a document are stored 
in a zipped archive that just happens to have the .odt or .od-whatever 
extension.


Using an archive file format solves the issue of user education, since 
it appears to be a single file to the user, gives the programmer the 
option of including whatever arbitrary resources are needed for this 
particular file, and also solves the issue of operating system 
portability, since just about any OS in current use can handle copying a 
binary file around.


Just my 2d

Cheers,
Jason
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Daniel DeCovnick
The problem with that is, as I wrote in my first message, the real  
data files aren't mine, and won't be opened by my app exclusively. The  
data that I need to save ought to be invisible to the file's owner.


Imagine, for example, that when working on a file in HexEdit, it  
allowed you to highlight in different colors and annotate locations in  
a file. Where would HexEdit save those annotations and locations and  
colors of highlighted areas?


-Dan

On Apr 23, 2008, at 11:33 PM, Jason Stephenson wrote:


Chris Suter wrote:
Furthermore, it doesn't follow the file which was the original  
design goal.
Going back to the original question, I personally think that the  
best thing to do is to just create another file and educate the  
user. Extended attributes and resource forks are all very nice but  
most users don't understand what they are and they just don't  
interoperate nicely with other systems.


My first thought on reading this thread is that it would be easiest  
just to store the data in a zip-type archive file. You could then  
have all the metadata/resource files included in an archive  
subdirectory, and everything would transfer nicely across operating  
systems. OpenOffice.org does this. All of the components of a  
document are stored in a zipped archive that just happens to have  
the .odt or .od-whatever extension.


Using an archive file format solves the issue of user education,  
since it appears to be a single file to the user, gives the  
programmer the option of including whatever arbitrary resources are  
needed for this particular file, and also solves the issue of  
operating system portability, since just about any OS in current use  
can handle copying a binary file around.


Just my 2d

Cheers,
Jason
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/danhd123%40mac.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Dmitry Markman

I'm not sure what is all about
all resources can be stored in the data fork
resource manager perfectly understands it
there is no reason whatsoever to use resource fork.

you can easiliy convert old resource file (with resources in the  
resource fork)

to resource file with resources in the data fork

Resorcerer, for example does it
you can write small application that will do that too

look, for example at the following code, that copies data fork of the  
file specFile (resFork = false)

or copies resource fork of the file specFile (resFork = true)
to the normal data fork file.
copied resource fork will be perfectly usable in Xcode
Resorcerer will open it as well


OSErr CopyFork(FSRefPtr specFile, bool resFork) {
OSErr err = noErr;
HFSUniStr255dataForkName;
err = FSGetDataForkName(dataForkName);
if(err != noErr) return err;
HFSUniStr255resForkName;
err = FSGetResourceForkName(resForkName);
if(err != noErr) return err;

SInt16  fileFork = -1;

HFSUniStr255fileName;
FSRef   parentRef;
err = FSGetCatalogInfo(specFile, kFSCatInfoNone, NULL, fileName,  
NULL, parentRef);

if(err != noErr)  return err;

CFStringRef newFileName = NULL;
CFStringRef cfFileName =  
CFStringCreateWithCharacters(kCFAllocatorDefault, fileName.unicode,  
fileName.length);//CFString.h

if(cfFileName != NULL) {
CFMutableArrayRef tempArr =  
CFArrayCreateMutable(kCFAllocatorDefault, 2, kCFTypeArrayCallBacks);

CFArrayAppendValue(tempArr, cfFileName);
CFArrayAppendValue(tempArr, (resFork) ? CFSTR(rsrc) :  
CFSTR(data));
newFileName =  
CFStringCreateByCombiningStrings(kCFAllocatorDefault, tempArr,  
CFSTR(.));

CFRelease(tempArr);
CFRelease(cfFileName);
}

if(newFileName == NULL) return coreFoundationUnknownErr;

err = FSOpenFork(specFile,
 (resFork) ? resForkName.length :  
dataForkName.length,
 (resFork) ? resForkName.unicode :  
dataForkName.unicode,

 fsRdPerm, fileFork);

if(err == noErr) {
SInt16  outFile = -1;
FSRef   newFSRef;
CFIndex length = CFStringGetLength(newFileName);
UniChar *buffer = new UniChar [length];
CFStringGetCharacters(newFileName, CFRangeMake(0, length),  
buffer);

err = FSCreateFileUnicode(parentRef, length, buffer,
  kFSCatInfoNone, NULL,  
newFSRef,NULL);

if(err == dupFNErr) {
err = FSMakeFSRefUnicode(parentRef, length, buffer,  
kTextEncodingUnknown, newFSRef);

}
delete [] buffer;
err = FSOpenFork(newFSRef, dataForkName.length,  
dataForkName.unicode, fsWrPerm, outFile);

if(err == noErr) {
ByteCount actualCount = 0;
SInt64 positionOffset = 0;
ByteCount requestCount = 1024;
Byte *fileBuffer = new Byte [requestCount];
while(err == noErr){
err = FSReadFork(fileFork,fsFromStart,  
positionOffset, requestCount, fileBuffer, actualCount);

if(actualCount  1) break;
positionOffset += actualCount;
OSErr writeErr = FSWriteFork(outFile,fsAtMark,0,  
actualCount, fileBuffer, NULL);

if(writeErr != noErr) err = writeErr;
}
delete [] fileBuffer;
FSCloseFork(outFile);
}
FSCloseFork(fileFork);
}

CFRelease(newFileName);

return err;
}




On Apr 23, 2008, at 11:55 PM, Daniel DeCovnick wrote:

The problem with that is, as I wrote in my first message, the real  
data files aren't mine, and won't be opened by my app exclusively.  
The data that I need to save ought to be invisible to the file's  
owner.


Imagine, for example, that when working on a file in HexEdit, it  
allowed you to highlight in different colors and annotate locations  
in a file. Where would HexEdit save those annotations and locations  
and colors of highlighted areas?


-Dan

On Apr 23, 2008, at 11:33 PM, Jason Stephenson wrote:


Chris Suter wrote:
Furthermore, it doesn't follow the file which was the original  
design goal.
Going back to the original question, I personally think that the  
best thing to do is to just create another file and educate the  
user. Extended attributes and resource forks are all very nice but  
most users don't understand what they are and they just don't  
interoperate nicely with other systems.


My first thought on reading this thread is that it would be easiest  
just to store the data in a zip-type archive file. You could then  
have all the metadata/resource files included in an archive  
subdirectory, and everything would transfer nicely across operating  
systems. OpenOffice.org does this. All of the components of a  
document are stored in a zipped archive that just happens to have  
the .odt or .od-whatever extension.


Using an archive file format solves the issue 

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Graham Cox


On 24 Apr 2008, at 12:59 pm, Chris Suter wrote:

The limits for resource forks are the same as for data forks



Not true - the ResourceMap contains some 24-bit pointers, or at least  
it used to, as well as some 16-bit length fields as well. Unless these  
have been changed (possible I guess, I don't know) these will bite you  
before the file fork limitations do.


G.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Chris Suter


On 24/04/2008, at 2:28 PM, Graham Cox wrote:



On 24 Apr 2008, at 12:59 pm, Chris Suter wrote:

The limits for resource forks are the same as for data forks


Not true - the ResourceMap contains some 24-bit pointers, or at  
least it used to, as well as some 16-bit length fields as well.  
Unless these have been changed (possible I guess, I don't know)  
these will bite you before the file fork limitations do.


I'm sorry, but it is true. We're not talking about ResourceMaps, we're  
talking about resource forks. ResourceMaps are just one thing that you  
might store in a resource fork but I don't know of any reason why you  
can't store anything you like in them and the limits for a resource  
fork are the same as those for a data fork.


- Chris



smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread Graham Cox


On 24 Apr 2008, at 2:46 pm, Chris Suter wrote:


On 24/04/2008, at 2:28 PM, Graham Cox wrote:



On 24 Apr 2008, at 12:59 pm, Chris Suter wrote:

The limits for resource forks are the same as for data forks


Not true - the ResourceMap contains some 24-bit pointers, or at  
least it used to, as well as some 16-bit length fields as well.  
Unless these have been changed (possible I guess, I don't know)  
these will bite you before the file fork limitations do.


I'm sorry, but it is true. We're not talking about ResourceMaps,  
we're talking about resource forks. ResourceMaps are just one thing  
that you might store in a resource fork but I don't know of any  
reason why you can't store anything you like in them and the limits  
for a resource fork are the same as those for a data fork.


- Chris




Sure, the fork limitations are the same.

But the OP was talking about storing data in the Resource Fork as a  
resource (correct me if I'm wrong, I've only been following the thread  
peripherally) so ResourceMaps do come into it.


G.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


NSCollectionView like control for Tiger?

2008-04-23 Thread Ferhat Ayaz

Hi,

I have to write an application which should also run with Tiger. Does  
someone know a third party NSCollectionView like control for Tiger?


Thanks,
Ferhat





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: A cursor bug in DragItemAround example

2008-04-23 Thread Scott Anguish


On Apr 23, 2008, at 6:44 PM, Quincey Morris wrote:



On Apr 23, 2008, at 08:10, an0 wrote:


Chances are, calling '[[self enclosingScrollView]
setDocumentCursor:[NSCursor closedHandCursor]]' in 'mouseDown:'  
will fix the
problem you're seeing. NSScrollView/NSClipView's way of changing  
the cursor
conflicts with autoscrolling or drag-scrolling, but AFAIK there's  
no way of

preventing that interference directly.

This partially works. However, if you move the item off the visible
part of scroll view and then move back, you'll find a arrowCursor
instead of openHandCursor when cursor hovers on the item. It seems
cursor problems pervade Cocoa applications and Apple just ignores
them:(


Does this sample application still use cursorRects/NSTrackingRects?  
Leopard introduced a new mechanism -- NSTrackingArea and  
cursorUpdate events -- which doesn't have some of the problems that  
the old mechanism supposedly had.


Yes it does. It should be updated to use the new API, but hasn't been  
as yet.


File enhancement bugs as you feel appropriate.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]