Isolate NSTextView from NSColorWell

2010-06-22 Thread Bernard Knaepen
Hi all,

I have a window created in IB containing a NSScrollView embedding a NSTextView. 
In the same window I have a NSColorWell which is supposed to store the color 
preference for a given object not related to the NSTextView.

I would like to be able to change the color of the NSColorWell without 
affecting the NSTextView at all. However, if I start to type in the text field 
and then click on the NSColorWell, I am able to change the color of the well 
but this also affects the color of the character that will be typed later on in 
the text field. In other words, the color panel changes the color of both the 
well and the text which is not what I want.

I spent a lot of time looking in the doc to isolate this NSColorWell from the 
NSTextView without finding a solution.

I would be grateful if someone could help me with this or point me to the 
relevant part of the documentation.

Thanks,

Bernard.


___

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 arch...@mail-archive.com


Re: sqlite store created on OS X won't open on iOS

2010-06-22 Thread Jonathan Fewtrell

On 23 Jun 2010, at 12:41, Jonathan Fewtrell wrote:

> I created an sqlite store using a Core Data OS X application.
> 
> Using the same managed object model, my Core Data iOS app cannot open the 
> store and gives the message: "The model used to open the store is 
> incompatible with the one used to create the store".
> 
> Is there any reason why an iPhone app should not be able to open a store 
> created on Mac if both are using the same model? I simply copied the 
> .xcdatamodeld wrapper from one project to the other.

Sorry. Ignore the question. It works fine. The iPhone app wasn't opening the 
store file I thought it was. Dumb.
___

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 arch...@mail-archive.com


Re: Core Data can't do Distinct Relationships to Same Entity

2010-06-22 Thread Jerry Krinock
I just factored out the Abstract Entity, since this approach better models the 
actual data in my real app.

Thanks in advance to Roland and Glenn.  I say "in advance" because a more 
realistic data model is often not appreciated until version 2.0, but then 
you're very happy you've got it!

___

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 arch...@mail-archive.com


sqlite store created on OS X won't open on iOS

2010-06-22 Thread Jonathan Fewtrell
I created an sqlite store using a Core Data OS X application.

Using the same managed object model, my Core Data iOS app cannot open the store 
and gives the message: "The model used to open the store is incompatible with 
the one used to create the store".

Is there any reason why an iPhone app should not be able to open a store 
created on Mac if both are using the same model? I simply copied the 
.xcdatamodeld wrapper from one project to the other.
___

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 arch...@mail-archive.com


Re: Initiating drag and drop from NSToolbarItem

2010-06-22 Thread Gideon King
Perfect, thanks Peter. I knew there was something like that, and had searched 
for canDrag, but hadn't thought of canMove...

Gideon

On 23/06/2010, at 12:12 PM, Peter Ammon wrote:
> 
> Sounds like you want to override -mouseDownCanMoveWindow to return NO. 
> 

___

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 arch...@mail-archive.com


Auto-hide the window

2010-06-22 Thread Dong Linlan
Hi there, I want to make my window make my window auto-hided and when the
cursor move to the edge of the screen it will show. Just like the effect of
QuickSilver's Shelf plugin. I google and found nothing useful. Should I run
my app as an daemon and detect the global mouse event?
___

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 arch...@mail-archive.com


iOS4: UDP sockets in the background

2010-06-22 Thread Angelica Grace Tanchico

Hello,

Can the new iOS 4 maintain UDP socket connection in the background? Or is it 
only TCP?

Thanks in advance!


Regards,
Angie
  
_
Hotmail: Free, trusted and rich email service.
https://signup.live.com/signup.aspx?id=60969___

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 arch...@mail-archive.com


Re: Core Data can't do Distinct Relationships to Same Entity

2010-06-22 Thread Roland King
Why don't you have a property 'arms' which is a to-many property? If you 
want to find a specific arm from the body you can iterate the arms 
looking for the one you want, or in the generic case use a predicate to 
find it for you. That also scales well when you put Hindu Gods (or 
Venusians) into your model as they potentially have lots and lots of arms.


Nothing stops you hiding the details of this with a -(Arm*)leftArm and 
-(Arm*)rightArm method in your body class which just goes and hunts or 
predicates the arms property to find the one you want.


Jerry Krinock wrote:

Say that I'm modelling a human body.  Each body has two arms, and I model them 
with the same entity; one has, maybe, setFlipped:YES and the other has 
setFlipped:NO.  But they are accessed for different purposes; sometimes I want 
the left arm and sometimes the right arm.  I'd therefore like to set up 
relationships thus:

 Body_EntityArm_Entity
 leftArm <> body
rightArm <> body

But Core Data won't let me do this, because the Arm's 'body' relationship can 
only have one inverse relationship.  Instead, I must do this:

 Body_EntityArm_Entity
 leftArm <> bodyLeft
rightArm <> bodyBody

which looks kind of silly, and also in order to access 'body' from an Arm 
object I need a silly accessor:

- (Body*)body {
Body* body = [self bodyLeft] ;
if (!body) {
body = [self bodyRight] ;
}

return body ;

}

Is there a better way to model such a thing?

___

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/rols%40rols.org

This email sent to r...@rols.org

___

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 arch...@mail-archive.com


Re: Problem with stopModalWithCode on a different thread

2010-06-22 Thread Bill Appleton
>> I don’t understand what this means. What are you asking for?

i am pointing out that there is a giant, giant, giant difference between
plugins that impose themselves on the user and those that are invoked
because the user wants them. all of the security stuff you are talking about
is appropriate for the former. all of this security stuff just makes users
of the latter pissed off. this is absolutely key. we have 10 K companies
that desperately need a simple way to install and use our player. this is
mission critical for them.


thx

bill




On Tue, Jun 22, 2010 at 6:44 PM, Jens Alfke  wrote:

>
> On Jun 22, 2010, at 5:28 PM, Bill Appleton wrote:
>
> > so different vendors whip out "security" for different reasons. on mac,
> it is to prevent browser crashes, thus the separate process. on windows, it
> is all about preventing system corruption, thus protected mode
>
> This isn’t a Windows thing. Chrome runs on Mac and Unix too. I think the
> reason Apple stresses preventing crashes is because it’s all they can say
> now — they haven’t yet implemented any sandboxing of the WebKit engine, so
> they aren’t actually getting any security improvements in Safari yet. (They
> do seem to be working on this in the future, judging by what’s going on in
> the WebKit open source project.)
>
> > which is especially funny, because you are limited in where you can WRITE
> a file but you can READ just about anything you want. so much for security.
>
> Not sure what you mean here. Sandboxed renderers in Chrome can’t access the
> filesystem at all. Nor the network, nor IPC except to the main browser
> process.
>
> > i think browser manufactures should focus on the voluntary aspect of
> plugin usage. our customers want to use dreamfactory to access cloud
> services. make it easy for them. i don't like the way some plugins can be
> used to "bomb" the users machine without notice. like the "dancing mortgage
> guy" on cnn. did you want to see him?
>
> I don’t understand what this means. What are you asking for?
>
> —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 arch...@mail-archive.com


Re: Initiating drag and drop from NSToolbarItem

2010-06-22 Thread Peter Ammon

On Jun 22, 2010, at 6:56 PM, Gideon King wrote:

> Hi, I have a toolbar item that I want to use for having an item that I drag 
> onto my main view. I can initiate the drag from my custom view, but the 
> window gets moved by the mouse down/dragged. I'm sure this will be trivial, 
> but can't think of how to do this...I've overridden mouseDown: and 
> mouseDragged: in my view, but the window still gets dragged.
> 
> How do I stop the window being dragged?

Sounds like you want to override -mouseDownCanMoveWindow to return NO. 

Hope this helps,
-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 arch...@mail-archive.com


Core Data can't do Distinct Relationships to Same Entity

2010-06-22 Thread Jerry Krinock
Say that I'm modelling a human body.  Each body has two arms, and I model them 
with the same entity; one has, maybe, setFlipped:YES and the other has 
setFlipped:NO.  But they are accessed for different purposes; sometimes I want 
the left arm and sometimes the right arm.  I'd therefore like to set up 
relationships thus:

 Body_EntityArm_Entity
 leftArm <> body
rightArm <> body

But Core Data won't let me do this, because the Arm's 'body' relationship can 
only have one inverse relationship.  Instead, I must do this:

 Body_EntityArm_Entity
 leftArm <> bodyLeft
rightArm <> bodyBody

which looks kind of silly, and also in order to access 'body' from an Arm 
object I need a silly accessor:

- (Body*)body {
Body* body = [self bodyLeft] ;
if (!body) {
body = [self bodyRight] ;
}

return body ;
}

Is there a better way to model such a thing?

___

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 arch...@mail-archive.com


Initiating drag and drop from NSToolbarItem

2010-06-22 Thread Gideon King
Hi, I have a toolbar item that I want to use for having an item that I drag 
onto my main view. I can initiate the drag from my custom view, but the window 
gets moved by the mouse down/dragged. I'm sure this will be trivial, but can't 
think of how to do this...I've overridden mouseDown: and mouseDragged: in my 
view, but the window still gets dragged.

How do I stop the window being dragged?


Thanks

Gideon


___

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 arch...@mail-archive.com


Using Field Editor correctly in custom NSCell

2010-06-22 Thread Graham Cox
I have a custom cell that displays a text label, which can be edited. The code 
for this custom cell is something I found on the net already written - I'll 
protect the guilty by not saying whose it is, but the text editing part doesn't 
work correctly, so I need to fix it. What happens is that the editing functions 
to a degree but the text attributes don't match what is drawn by the cell - the 
font is much bigger.

I've read the field editor documentation and I'm pretty OK with the concept, 
but when coding a custom cell it's not that clear exactly what should and 
should not be implemented in the delegate, and what is merely optional.

For example, it seems that the cell should override 
-setUpFieldEditorAttributes: but what should this method actually do? In the 
cell code I have, this method has been commented out, and the field editor "set 
up" is being done in -editWithFrame:inView:editor:delegate:event: (and the same 
set up is repeated in the -selectWithFrame:... method). Clearly this is wrong 
since it doesn't work. However, if I uncomment the -setUpFieldEditorAttributes: 
method, it's no better - at first the text is the right size but reverts to the 
bigger font when I type, and at the end of editing the field editor doesn't go 
away as it should, so the label is just overdrawn with a blank white box.

I'm prepared to just go through and rework the entire text editing/delegate 
methods of the cell as necessary but what I need is a clear indication of what 
has to be overridden and what has to be done in those overrides. Pointers to 
relevant documentation or example code that works properly would be gratefully 
received.

thanks,

--Graham



___

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 arch...@mail-archive.com


Re: Problem with stopModalWithCode on a different thread

2010-06-22 Thread Jens Alfke

On Jun 22, 2010, at 5:28 PM, Bill Appleton wrote:

> so different vendors whip out "security" for different reasons. on mac, it is 
> to prevent browser crashes, thus the separate process. on windows, it is all 
> about preventing system corruption, thus protected mode

This isn’t a Windows thing. Chrome runs on Mac and Unix too. I think the reason 
Apple stresses preventing crashes is because it’s all they can say now — they 
haven’t yet implemented any sandboxing of the WebKit engine, so they aren’t 
actually getting any security improvements in Safari yet. (They do seem to be 
working on this in the future, judging by what’s going on in the WebKit open 
source project.)

> which is especially funny, because you are limited in where you can WRITE a 
> file but you can READ just about anything you want. so much for security.

Not sure what you mean here. Sandboxed renderers in Chrome can’t access the 
filesystem at all. Nor the network, nor IPC except to the main browser process.

> i think browser manufactures should focus on the voluntary aspect of plugin 
> usage. our customers want to use dreamfactory to access cloud services. make 
> it easy for them. i don't like the way some plugins can be used to "bomb" the 
> users machine without notice. like the "dancing mortgage guy" on cnn. did you 
> want to see him?

I don’t understand what this means. What are you asking for?

—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 arch...@mail-archive.com


Re: iOS4: CFReadStream and background operation

2010-06-22 Thread Jens Alfke

On Jun 22, 2010, at 5:21 PM, John Michael Zorko wrote:

> 2. However, CFReadStreams created _while_ the app was in the background often 
> (though not always) _don't_ call their callbacks _until_ the app is brought 
> in the foreground, then all of a sudden the callback happens.

I think foreground/background is a red herring — that has almost no effect on 
the behavior of the app.

What I _have_ seen is bugs in my code that result in incoming activity (like 
network I/O) not waking up the runloop, so the event doesn’t get delivered … 
until some other event comes in and causes the runloop to wake up. This is a 
lot likelier to happen when the app is in the background, because when it’s 
active there are user events (even the mouse entering/exiting views) that keep 
the runloop going pretty often.

Unfortunately I don’t remember the details of what caused this situation. I 
would look very carefully at your CFStream callbacks: what they do and how they 
get registered. Scan the system docs to make sure you’re doing everything 
correctly.

—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 arch...@mail-archive.com


Re: Problem with stopModalWithCode on a different thread

2010-06-22 Thread Bill Appleton
so different vendors whip out "security" for different reasons. on mac, it
is to prevent browser crashes, thus the separate process. on windows, it is
all about preventing system corruption, thus protected mode -- which is
especially funny, because you are limited in where you can WRITE a file but
you can READ just about anything you want. so much for security.

by the way, we DO make very few assumptions about access. we use NSApp for
flushing events & testing for stilldown and running a few select dialogs.
that's about it. we are releasing the DreamFactory Player open source in the
fall, i think that will be an important milestone.

i think browser manufactures should focus on the voluntary aspect of plugin
usage. our customers want to use dreamfactory to access cloud services. make
it easy for them. i don't like the way some plugins can be used to "bomb"
the users machine without notice. like the "dancing mortgage guy" on cnn.
did you want to see him?


best,

bill


On Tue, Jun 22, 2010 at 4:59 PM, Jens Alfke  wrote:

>
> On Jun 22, 2010, at 4:47 PM, Bill Appleton wrote:
>
> > this IS sandboxed --- its in a separate process
>
> That’s not what “sandboxed” means. It refers to a process that’s running
> with reduced privileges, i.e. it only gets to “play in the sandbox” without
> having full access to the computer. For example, maybe it can only access
> part of the filesystem, or can’t create windows, or can’t open network
> sockets, or whatever. (OS X has a pretty complex set of privileges that can
> be individually disabled for sandboxed processes.)
>
> I’m not sure what the eventual solution’s going to be for sandboxing
> plugins, since some of them legitimately need such access. (Flash stores
> cookies in your home directory, and some flash widgets can access webcams,
> for instance.) But it’s probably a good idea to make as few assumptions as
> possible about what environment you’re running in.
>
> The Chrome project is working on a new plugin API to eventually replace the
> NPAPI; have you looked at it?
>
> —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 arch...@mail-archive.com


iOS4: CFReadStream and background operation

2010-06-22 Thread John Michael Zorko

Hello, all ...

I've an app that reads from the network using CFReadStream (it needs to use 
CFReadStream so that it can throttle the connection and specify how many bytes 
to read each time). What i'm finding is that CFReadStream callbacks aren't 
always called when the app is in the background. Specifically, what I _seem_ to 
be seeing is this:

1. CFReadStreams created when the app was in the foreground continue (the 
CFReadStream callback is called) when the app is put in the background.
2. However, CFReadStreams created _while_ the app was in the background often 
(though not always) _don't_ call their callbacks _until_ the app is brought in 
the foreground, then all of a sudden the callback happens.

The app in question is set up for background operation and runs in the 
background when the user presses the home button -- I can put a breakpoint in 
my thread's run loop and see this -- but the CFReadStream callback doesn't 
always get called, which makes this app appear to stop until the user brings it 
in the foreground again.

Thoughts? If anyone could assist and help me understand why this happens (and 
how to fix it), i'd be quite appreciative :-)

Regards,

John

___

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 arch...@mail-archive.com


Re: Problem with stopModalWithCode on a different thread

2010-06-22 Thread Jens Alfke

On Jun 22, 2010, at 4:47 PM, Bill Appleton wrote:

> this IS sandboxed --- its in a separate process

That’s not what “sandboxed” means. It refers to a process that’s running with 
reduced privileges, i.e. it only gets to “play in the sandbox” without having 
full access to the computer. For example, maybe it can only access part of the 
filesystem, or can’t create windows, or can’t open network sockets, or 
whatever. (OS X has a pretty complex set of privileges that can be individually 
disabled for sandboxed processes.)

I’m not sure what the eventual solution’s going to be for sandboxing plugins, 
since some of them legitimately need such access. (Flash stores cookies in your 
home directory, and some flash widgets can access webcams, for instance.) But 
it’s probably a good idea to make as few assumptions as possible about what 
environment you’re running in.

The Chrome project is working on a new plugin API to eventually replace the 
NPAPI; have you looked at it?

—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 arch...@mail-archive.com


Re: Problem with stopModalWithCode on a different thread

2010-06-22 Thread Bill Appleton
then what will you be able to do? nothing? compare what is possible on
windows and mac, they can't get too far out of line. this IS sandboxed ---
its in a separate process



On Tue, Jun 22, 2010 at 4:02 PM, Jens Alfke  wrote:

>
> On Jun 22, 2010, at 2:40 PM, Charles Srstka wrote:
>
> You get a separate process for your plug-in, but there is no guarantee that
> that process will have a full Cocoa environment running. You are recommended
> to use only plug-in APIs as much as possible, and not to spawn new windows.
>
>
> Yup. The only reason you can do AppKit stuff in plugins is that the browser
> vendors haven’t been able to sandbox the plugin environment completely yet
> for compatibility reasons. (It turns out Flash gets unhappy if it doesn’t
> have access to things like the local filesystem.) *This is a bug, not a
> feature.* Securing plugins is very important — most browser exploits
> nowadays go through Flash and Reader, apparently — and doing that will
> require running them in a fully sandboxed process just like Chrome’s WebKit
> renderers. In that environment you will not be able to make arbitrary AppKit
> calls.
>
> —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 arch...@mail-archive.com


Re: programmatically create email using specified account

2010-06-22 Thread Fritz Anderson
On 21 Jun 2010, at 11:44 PM, James Udo Ludtke wrote:

> In addition to the three arguments "mailto:";, "?subject=", and "&body=", is 
> there a 4th argument to set the from account?

The mailto: URL scheme has a specification (RFC 2368): 


In the instructions for respondents to the mailto: scheme, the RFC says from= 
should not be accepted:

> Note that some headers are inherently unsafe to include in a message 
> generated from a URL. For example, headers such as "From:", "Bcc:", and so 
> on, should never be interpreted from a URL. In general, the fewer headers 
> interpreted from the URL, the less likely it is that a sending agent will 
> create an unsafe message.
...
> Programs that interpret mailto URLs should ensure that the SMTP "From" 
> address is set and correct.


— F

___

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 arch...@mail-archive.com


Re: Problem with stopModalWithCode on a different thread

2010-06-22 Thread Jens Alfke

On Jun 22, 2010, at 2:40 PM, Charles Srstka wrote:

> You get a separate process for your plug-in, but there is no guarantee that 
> that process will have a full Cocoa environment running. You are recommended 
> to use only plug-in APIs as much as possible, and not to spawn new windows.

Yup. The only reason you can do AppKit stuff in plugins is that the browser 
vendors haven’t been able to sandbox the plugin environment completely yet for 
compatibility reasons. (It turns out Flash gets unhappy if it doesn’t have 
access to things like the local filesystem.) This is a bug, not a feature. 
Securing plugins is very important — most browser exploits nowadays go through 
Flash and Reader, apparently — and doing that will require running them in a 
fully sandboxed process just like Chrome’s WebKit renderers. In that 
environment you will not be able to make arbitrary AppKit calls.

—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 arch...@mail-archive.com


programmatically create email using specified account

2010-06-22 Thread James Udo Ludtke
I just converted an AppleScript, which I used from within a cocoa application, 
into Objective C, for use in xCode 3.2.2.

I programmatically create the to address, subject, and body based on sample 
code using:
mailto:d...@apple.com""?subject=Hello%20Cruel%20World!""&body=Share%20and%20Enjoy";];

The code works OK, however, my intensive search for programmatically setting 
the "from" address (email account) in Objective C, which I could do in Apple 
Script, has not met with success.

In addition to the three arguments "mailto:";, "?subject=", and "&body=", is 
there a 4th argument to set the from account?

James


___

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 arch...@mail-archive.com


Re: Problem with stopModalWithCode on a different thread

2010-06-22 Thread Charles Srstka
On Jun 22, 2010, at 4:36 PM, Bill Appleton wrote:

> all that stuff in the docs you mention is about interacting with the browser
> 
> now the browser is a whole separate application, its talking to the 
> WebKitPluginHost through ports
> 
> so thats what they are talking about -- if you want a popup menu on the 
> browser screen you have to call their API
> 
> but invoking an open file dialog from a plugin should be fine, its all a 
> separate window ,separate process etc. 
> 
> this is much more solid than the carbon/quickdraw/x manager stuff we used to 
> use

The section of the Apple docs that I linked to was specifically talking about 
out-of-process plug-ins on Mac OS X 10.6 64-bit.

http://developer.apple.com/mac/library/documentation/InternetWeb/Conceptual/WebKit_PluginProgTopic/Tasks/NetscapePlugins.html#//apple_ref/doc/uid/30001250-DontLinkElementID_1

You get a separate process for your plug-in, but there is no guarantee that 
that process will have a full Cocoa environment running. You are recommended to 
use only plug-in APIs as much as possible, and not to spawn new windows.

Charles___

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 arch...@mail-archive.com


Re: Problem with stopModalWithCode on a different thread

2010-06-22 Thread Bill Appleton
all that stuff in the docs you mention is about interacting with the browser

now the browser is a whole separate application, its talking to the
WebKitPluginHost through ports

so thats what they are talking about -- if you want a popup menu on the
browser screen you have to call their API

but invoking an open file dialog from a plugin should be fine, its all a
separate window ,separate process etc.

this is much more solid than the carbon/quickdraw/x manager stuff we used to
use



thx

bill





On Tue, Jun 22, 2010 at 2:19 PM, Charles Srstka wrote:

> On Jun 22, 2010, at 4:14 PM, Bill Appleton wrote:
>
> > Not sure I understand all the issues but this should be good news for
> Cocoa lovers:
> >
> > 1) When Safari runs as 64 bit it loads and runs a 32 bit or 64 bit Cocoa
> NPAPI plugin just fine. The 32 bit version of Safari will only run 32 bit
> NPAPI plugins.
> >
> > 2) The exact same 32 bit plugin for Safari will work great in FireFox 32,
> although you need to ask for the Carbon Event model. That is pretty amazing
> -- FireFox hasn't released a Cocoa version yet!
> >
> > 3) The FireFox 64 bit release candidate (minefield) runs the 64 bit
> version just great. I'm not sure if 64 bit firefox will run a 32 bit plugin,
> I will find out.
> >
> > At runtime there is nothing strange going on anymore since they fixed
> these bugs. You are running on the main thread in your own process. NPApp is
> initialized for you. Actually the "out of process" security thing is really
> cool, it is a more isolated & predictable environment for us to run in.
>
> The problem is that this isn’t a bug that was fixed. It’s undocumented
> behavior that just *happens* to do what you want in *this* particular
> version. It might not in the next version. Apple’s guidelines recommend
> against doing this, so it’s not at all guaranteed that it will work. On
> Firefox, it *certainly* isn’t guaranteed to work.
>
> I maintain that the best option is to fork/exec a background app (with
> LSUIElement set to 1 in its Info.plist) to do your AppKit stuff, which seems
> to be what Apple’s recommending:
>
> >   • Avoid creating windows. The intent is for plug-ins to operate
> within the browser window. Although some plug-ins have historically done so,
> creating windows in your plug-in is not recommended. If you need to maintain
> separate windows, you should consider starting a separate application.
>
>
> Charles
>
___

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 arch...@mail-archive.com


Re: can we have own application logo for ad-hoc release.

2010-06-22 Thread Bryan Henry
A legitimate distribution channel with a max of 100 users per year? That's a 
pretty limited market. Ad hoc exists or beta testing, app reviewer copies 
(along with promo codes), and other such things. Apple had taken steps in the 
past to limit the utility of Ad Hoc as a distribution mechanism that 
circumvents the App Store, for obvious reasons.

- Bryan

Sent from my iPhone

On Jun 22, 2010, at 1:16 PM, Dave Carrigan  wrote:

> 
> On Jun 22, 2010, at 10:05 AM, Matt Neuburg wrote:
> 
>> On Mon, 21 Jun 2010 23:05:37 -0700 (PDT), Kalyanraju M
>>  said:
>>> Hi,when loading the Ad-Hoc release into iTunes, there is a generic icon 
>>> shown
>> in the Apps section. Additionally, the label shows "Unknown genre". Can i 
>> have
>> my own image and my own label at label "Unknown genre".
>> 
>> (1) Since it's just ad hoc, who cares? Only beta testers will see it this
>> way.
> 
> Um, no. Ad hoc is a legitimate distribution channel that just doesn't happen 
> to go through the App Store.


> -- 
> Dave Carrigan
> d...@rudedog.org
> Seattle, WA, USA
> 
> ___
> 
> 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/bryanhenry%40mac.com
> 
> This email sent to bryanhe...@mac.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 arch...@mail-archive.com


Re: Compile Error: undeclared (first use in this function) --> While Init'ing an Object

2010-06-22 Thread Chris Tracewell
On Jun 22, 2010, at 2:11 PM, Kyle Sluder wrote:
> On Tue, Jun 22, 2010 at 2:03 PM, Chris Tracewell  wrote:
>> I have my own custom framework. The framework builds fine but when I link to 
>> it in one of my projects one class is causing a compile error of...
>> 
>> 'MyClass' undeclared (first use in this function)
>> 
>> This occurs when I am trying to init MyClass inside a view controller's .m 
>> file in one of it's methods like so...
>> 
>> MyClass *theClass = [MyClass new];
> 
> Did you remember to #import the header file that declares MyClass's interface?
> 
> --Kyle Sluder
> 

I did - I import one main header for the framework the imports all of the 
framework header files. I checked it in the linking project, it is there in the 
Copy phase of my target and it does import have the #import "MyClass.h" line 
plus I can see MyClass.h is in the Copy phase of the linking projects target as 
well. 

However, your suggestion prompted me to try importing just 
 in the view controller class that is getting the error 
and it couldn't find it. Then I tried the same with other classes in the 
framework and it was fine. It's like it's there, I can see it, but it is not 
finding it. As I stated in the first post I have checked several times to make 
sure MyClass is set to public in the framework.

Thanks

--Chris___

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 arch...@mail-archive.com


Re: Problem with stopModalWithCode on a different thread

2010-06-22 Thread Charles Srstka
On Jun 22, 2010, at 4:14 PM, Bill Appleton wrote:

> Not sure I understand all the issues but this should be good news for Cocoa 
> lovers:
> 
> 1) When Safari runs as 64 bit it loads and runs a 32 bit or 64 bit Cocoa 
> NPAPI plugin just fine. The 32 bit version of Safari will only run 32 bit 
> NPAPI plugins.
> 
> 2) The exact same 32 bit plugin for Safari will work great in FireFox 32, 
> although you need to ask for the Carbon Event model. That is pretty amazing 
> -- FireFox hasn't released a Cocoa version yet!
> 
> 3) The FireFox 64 bit release candidate (minefield) runs the 64 bit version 
> just great. I'm not sure if 64 bit firefox will run a 32 bit plugin, I will 
> find out.
> 
> At runtime there is nothing strange going on anymore since they fixed these 
> bugs. You are running on the main thread in your own process. NPApp is 
> initialized for you. Actually the "out of process" security thing is really 
> cool, it is a more isolated & predictable environment for us to run in.

The problem is that this isn’t a bug that was fixed. It’s undocumented behavior 
that just *happens* to do what you want in *this* particular version. It might 
not in the next version. Apple’s guidelines recommend against doing this, so 
it’s not at all guaranteed that it will work. On Firefox, it *certainly* isn’t 
guaranteed to work.

I maintain that the best option is to fork/exec a background app (with 
LSUIElement set to 1 in its Info.plist) to do your AppKit stuff, which seems to 
be what Apple’s recommending:

>   • Avoid creating windows. The intent is for plug-ins to operate within 
> the browser window. Although some plug-ins have historically done so, 
> creating windows in your plug-in is not recommended. If you need to maintain 
> separate windows, you should consider starting a separate application.


Charles___

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 arch...@mail-archive.com


Re: Problem with stopModalWithCode on a different thread

2010-06-22 Thread Bill Appleton
Hi All,

Not sure I understand all the issues but this should be good news for Cocoa
lovers:

1) When Safari runs as 64 bit it loads and runs a 32 bit or 64 bit Cocoa
NPAPI plugin just fine. The 32 bit version of Safari will only run 32 bit
NPAPI plugins.

2) The exact same 32 bit plugin for Safari will work great in FireFox 32,
although you need to ask for the Carbon Event model. That is pretty amazing
-- FireFox hasn't released a Cocoa version yet!

3) The FireFox 64 bit release candidate (minefield) runs the 64 bit version
just great. I'm not sure if 64 bit firefox will run a 32 bit plugin, I will
find out.

At runtime there is nothing strange going on anymore since they fixed these
bugs. You are running on the main thread in your own process. NPApp is
initialized for you. Actually the "out of process" security thing is really
cool, it is a more isolated & predictable environment for us to run in.


Best,

Bill





On Tue, Jun 22, 2010 at 2:07 PM, Jens Alfke  wrote:

>
> On Jun 22, 2010, at 2:02 PM, Charles Srstka wrote:
>
> > Unless your plug-in is 64-bit only, there’s the chance the 32-bit binary
> could load into a non-Cocoa browser such as Firefox.
>
> I’m not sure Chrome is 64-bit yet, but it probably will be soon. Using
> AppKit in a Chrome plugin will crash and burn since it will be running in a
> sandboxed background process with no real AppKit environment.
>
> —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 arch...@mail-archive.com


Re: Compile Error: undeclared (first use in this function) --> While Init'ing an Object

2010-06-22 Thread Kyle Sluder
On Tue, Jun 22, 2010 at 2:03 PM, Chris Tracewell  wrote:
> I have my own custom framework. The framework builds fine but when I link to 
> it in one of my projects one class is causing a compile error of...
>
> 'MyClass' undeclared (first use in this function)
>
> This occurs when I am trying to init MyClass inside a view controller's .m 
> file in one of it's methods like so...
>
> MyClass *theClass = [MyClass new];

Did you remember to #import the header file that declares MyClass's interface?

--Kyle Sluder
___

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 arch...@mail-archive.com


Re: Problem with stopModalWithCode on a different thread

2010-06-22 Thread Corbin Dunn

On Jun 21, 2010, at 11:09 AM, Bill Appleton wrote:

> Hi All,
> 
> In 64 bit Safari our NPAPI plugin needs to use a few system dialogs for
> opening files, printing, etc.
> 
> These system dialogs call stopModalWithCode to deliver the result of the
> dialog interaction back to the runModalForWindow function
> 
> But the stopModalWithCode function does not work on another thread, as the
> NSApplication documentation makes clear:
> 
> *For example, use abortModal when running in a different thread from the
> Application Kit’s main thread*
> 
> When running on a different thread like this runModalForWindow will always
> return zero no matter what is passed to stopModalWithCode
> 
> We were easily able to fix this problem in our other dialogs by just saving
> the button clicked in a global and calling abortModal
> 
> Can anyone think of a way to fix this for the system dialogs? It seems like
> a trivial problem but I can't think of the best way to fix it
> 
> 1) Can anyone explain in more detail what is going on and why?
> 
> 2) Could we sub class stopModalWithCode and fix it there?
> 
> 3) Can anyone explain how calls to NSApp still work when a child process has
> been created?
> 
> 4) Maybe I should subclass NSOpenPanel etc. and try to fix it there?

I'm not familiar with plugin creation in Safari, but I can tell you that the 
NSSavePanel and NSOpenPanel should not be run on a background thread. You will 
eventually get crashes; they are not threadsafe.

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 arch...@mail-archive.com


Re: Problem with stopModalWithCode on a different thread

2010-06-22 Thread Jens Alfke

On Jun 22, 2010, at 2:02 PM, Charles Srstka wrote:

> Unless your plug-in is 64-bit only, there’s the chance the 32-bit binary 
> could load into a non-Cocoa browser such as Firefox.

I’m not sure Chrome is 64-bit yet, but it probably will be soon. Using AppKit 
in a Chrome plugin will crash and burn since it will be running in a sandboxed 
background process with no real AppKit environment.

—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 arch...@mail-archive.com


Compile Error: undeclared (first use in this function) --> While Init'ing an Object

2010-06-22 Thread Chris Tracewell
I have my own custom framework. The framework builds fine but when I link to it 
in one of my projects one class is causing a compile error of...

'MyClass' undeclared (first use in this function)

This occurs when I am trying to init MyClass inside a view controller's .m file 
in one of it's methods like so...

MyClass *theClass = [MyClass new];

In the framework the header file is set to public and I can see it in the build 
and the linking project colors the code to show it recognizes the class. The 
framework itself uses this class in several places and it does not throw any 
compile errors. I have cleaned and built both the framework and linking project 
a gizillion times hoping to jiggle something - but no luck. 

Any suggestions?

- Chris
XCode 3.2.2 :: GC :: OS X 10.6___

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 arch...@mail-archive.com


Re: Problem with stopModalWithCode on a different thread

2010-06-22 Thread Charles Srstka
On Jun 22, 2010, at 3:58 PM, Bill Appleton wrote:

> Hi Charles,
> 
> Under Safari 64 bit you HAVE to use Cocoa -- there ain't nuthin' else.
> 
> By the way i just found out that this problem is FIXED in the latest version 
> of Safari.
> 
> 
> Thanks all,
> 
> bill

Unless your plug-in is 64-bit only, there’s the chance the 32-bit binary could 
load into a non-Cocoa browser such as Firefox.

And even if it happens to work on the new version of Safari, there’s no 
guarantee it will continue to do so indefinitely, since this is something that 
Apple’s official guidelines recommend against doing. I would probably look into 
a different solution.

Your best bet is probably to spin off a new process which is a background-only 
app. The app launches, displays the modal dialog box, and exits with the 
appropriate result code. Alternatively, if your needs are simple, you could 
fork/exec the osascript tool and use AppleScript to make a simple dialog.

Charles___

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 arch...@mail-archive.com


Re: Problem with stopModalWithCode on a different thread

2010-06-22 Thread Bill Appleton
Hi Charles,

Under Safari 64 bit you HAVE to use Cocoa -- there ain't nuthin' else.

By the way i just found out that this problem is FIXED in the latest version
of Safari.


Thanks all,

bill




On Tue, Jun 22, 2010 at 1:10 PM, Charles Srstka wrote:

> On Jun 22, 2010, at 1:54 PM, Bill Appleton wrote:
>
> > Hi all,
> >
> > Thanks for the tips.
> >
> > i have verified that this code actually IS running on the main thread, i
> was wrong about that in my original message. Here is the situation. WebKit
> launches WebKitPluginHost.app and that is the process that runs my NPAPI
> plugin. The plugin is called on the main thread, and NSApp is already
> initialized. However I can absolutely confirm this bug is happening, I
> logged a webkit bug on it, no telling what will happen with that.
> >
> > i was able to fix this problem in my dialogs (not system dialogs) by just
> saving the clicked button in a global and calling abortModal, then i just
> return the global & it works perfectly. So Charles, your tip about "write
> your own method that wraps stopModalWithCode" is probably the practical way
> to fix this. But I can't subclass NSApp (it is already initialized) & I'm
> having trouble figuring out how to write a method that can just intercept a
> class message in general. Is that possible?
>
> Wait a minute - why are you using NSApp in an NPAPI plug-in? NPAPI plug-ins
> could be loaded into a non-Cocoa browser such as Firefox that will not have
> an NSApp set, so this seems inadvisable (and could possibly be part of what
> is causing the weird behavior you’re seeing).
>
> Apple seems to suggest that this sort of thing should not be done in an
> NPAPI plugin:
>
>
> http://developer.apple.com/mac/library/documentation/InternetWeb/Conceptual/WebKit_PluginProgTopic/Tasks/NetscapePlugins.html#//apple_ref/doc/uid/30001250-DontLinkElementID_1
>
> >   • Use platform APIs sparingly. Wherever possible, you should use
> new plug-in APIs to do what you need. If no such APIs exist, file bugs
> requesting them.
> > The plug-in API provides additional APIs for scheduling timers, opening
> contextual pop-up menus, and so on.
> > Note: Calls to browser scripting functions work normally. WebKit
> transparently handles the interprocess communication for you.
> >   • Avoid creating windows. The intent is for plug-ins to operate
> within the browser window. Although some plug-ins have historically done so,
> creating windows in your plug-in is not recommended. If you need to maintain
> separate windows, you should consider starting a separate application.
>
> Charles
___

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 arch...@mail-archive.com


Re: Flip and Enlarge CALayer at the same time

2010-06-22 Thread Gustavo Pizano
Hello everybody once again.

So I want to update my advances.

IT'S WORKING NOW! lets say about 80% of it.

this is what Im doing:

- (void)enlargeCALayer{
CABasicAnimation * frameAnim =  [CABasicAnimation 
animationWithKeyPath:@"position"];
[frameAnim setFromValue:[NSValue valueWithPoint:self.position]];
NSRect  r = [self superlayer].bounds;
NSPoint p = NSMakePoint((r.origin.x + r.size.width)/2.0f, 
(r.origin.y + r.size.height)/2.0f);
[frameAnim setToValue:[NSValue valueWithPoint:p]];
frameAnim.cumulative= NO;
frameAnim.removedOnCompletion=NO;
frameAnim.autoreverses = NO;
frameAnim.fillMode=kCAFillModeForwards;
frameAnim.delegate = superView;


// Prepare the animation from the old size to the new size
CGRect oldBounds = self.bounds;
CGRect newBounds = oldBounds;
newBounds.size = CGSizeMake(300.0f, 300.0f);
CABasicAnimation *animation = [CABasicAnimation 
animationWithKeyPath:@"bounds"];
animation.fromValue = [NSValue valueWithRect:NSRectFromCGRect(oldBounds)];
animation.toValue = [NSValue valueWithRect:NSRectFromCGRect(newBounds)];

// Update the layer's bounds so the layer doesn't snap back when the 
animation completes.
self.bounds = newBounds;

// Add the animation, overriding the implicit animation.

CAAnimationGroup * g = [CAAnimationGroup animation];
[g setAnimations:[NSArray arrayWithObjects:frameAnim,animation,nil]];
g.delegate = superView;
g.removedOnCompletion=NO;
g.autoreverses = NO;
g.duration = 0.15;
g.fillMode=kCAFillModeForwards;
[self addAnimation:g forKey:@"flipper"];

}


so with this method and the in the previous post (setFaceUp), I see the layer 
appearing and then rotating while changing dimensions and position,

for the other 20% remaining I have these unsolved things.

The content of the front layer, then one that appears after half the rotations 
(or at least thats what the eye does). should I place an image as the content 
of the layer and once the whole animation ends remove the layer and add the the 
view with the contents?, Actually this is what Im doing in the animation's 
delegate, but while the animation ends I see is the black background color of 
the front Layer  while rotating and changing dimensions, so any suggestions :S, 
tricks or tips?

Thanks a lot.


Gustavo

___

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 arch...@mail-archive.com


Re: Problem with stopModalWithCode on a different thread

2010-06-22 Thread Charles Srstka
On Jun 22, 2010, at 1:54 PM, Bill Appleton wrote:

> Hi all,
> 
> Thanks for the tips.
> 
> i have verified that this code actually IS running on the main thread, i was 
> wrong about that in my original message. Here is the situation. WebKit 
> launches WebKitPluginHost.app and that is the process that runs my NPAPI 
> plugin. The plugin is called on the main thread, and NSApp is already 
> initialized. However I can absolutely confirm this bug is happening, I logged 
> a webkit bug on it, no telling what will happen with that.
> 
> i was able to fix this problem in my dialogs (not system dialogs) by just 
> saving the clicked button in a global and calling abortModal, then i just 
> return the global & it works perfectly. So Charles, your tip about "write 
> your own method that wraps stopModalWithCode" is probably the practical way 
> to fix this. But I can't subclass NSApp (it is already initialized) & I'm 
> having trouble figuring out how to write a method that can just intercept a 
> class message in general. Is that possible?

Wait a minute - why are you using NSApp in an NPAPI plug-in? NPAPI plug-ins 
could be loaded into a non-Cocoa browser such as Firefox that will not have an 
NSApp set, so this seems inadvisable (and could possibly be part of what is 
causing the weird behavior you’re seeing). 

Apple seems to suggest that this sort of thing should not be done in an NPAPI 
plugin:

http://developer.apple.com/mac/library/documentation/InternetWeb/Conceptual/WebKit_PluginProgTopic/Tasks/NetscapePlugins.html#//apple_ref/doc/uid/30001250-DontLinkElementID_1

>   • Use platform APIs sparingly. Wherever possible, you should use new 
> plug-in APIs to do what you need. If no such APIs exist, file bugs requesting 
> them.
> The plug-in API provides additional APIs for scheduling timers, opening 
> contextual pop-up menus, and so on.
> Note: Calls to browser scripting functions work normally. WebKit 
> transparently handles the interprocess communication for you.
>   • Avoid creating windows. The intent is for plug-ins to operate within 
> the browser window. Although some plug-ins have historically done so, 
> creating windows in your plug-in is not recommended. If you need to maintain 
> separate windows, you should consider starting a separate application.

Charles___

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 arch...@mail-archive.com


Re: Problem with stopModalWithCode on a different thread

2010-06-22 Thread Bill Appleton
Hi all,

Thanks for the tips.

i have verified that this code actually IS running on the main thread, i was
wrong about that in my original message. Here is the situation. WebKit
launches WebKitPluginHost.app and that is the process that runs my NPAPI
plugin. The plugin is called on the main thread, and NSApp is already
initialized. However I can absolutely confirm this bug is happening, I
logged a webkit bug on it, no telling what will happen with that.

i was able to fix this problem in my dialogs (not system dialogs) by just
saving the clicked button in a global and calling abortModal, then i just
return the global & it works perfectly. So Charles, your tip about "write
your own method that wraps stopModalWithCode" is probably the practical way
to fix this. But I can't subclass NSApp (it is already initialized) & I'm
having trouble figuring out how to write a method that can just intercept a
class message in general. Is that possible?


thanks in advance,

bill appleton






On Mon, Jun 21, 2010 at 7:56 PM, Charles Srstka wrote:

> On Jun 21, 2010, at 7:33 PM, Jens Alfke wrote:
>
> > In general, if you have some kind of background activity that needs to
> call some AppKit method like this, use -performSelectorOnMainThread:.
>
> If you’re requiring 10.6 or greater, you can use one of these methods as
> well:
>
> [[NSOperationQueue mainQueue] addOperationWithBlock:^{
>// do something on the main thread
> }];
>
> or, alternatively:
>
> dispatch_async(dispatch_get_main_queue(), ^{
>// do something on the main thread
> });
>
> This can make things much less of a pain when you need to run a method that
> takes something other than an object for a parameter, such as
> stopModalWithCode: (the other options being to write your own method that
> wraps stopModalWithCode: and run that on the main thread, or use
> NSInvocation).
>
> Charles
___

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 arch...@mail-archive.com


Re: Splitter moves on its own

2010-06-22 Thread koko

I was looking there but ... no success. Thanks for responding!

-koko

On Jun 22, 2010, at 11:12 AM, Jerry Krinock wrote:



On 2010 Jun 22, at 08:45, k...@highrolls.net wrote:

When the program starts if my first action is to move the vertical  
split view splitter one of the horz split view splitters collapses  
to the bottom of the window.


What cause a splitter to move on its own?


I don't know in your case specifically, but when views move on their  
own it's usually due to autoresizing.  For example, autoresizing  
will occur when opening a document window, if it had been resized to  
a size different than the original (Interface Builder) size, and  
this size was stored in User Defaults, as is the standard behavior.





___

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 arch...@mail-archive.com


Re: can we have own application logo for ad-hoc release.

2010-06-22 Thread Dave Carrigan

On Jun 22, 2010, at 10:05 AM, Matt Neuburg wrote:

> On Mon, 21 Jun 2010 23:05:37 -0700 (PDT), Kalyanraju M
>  said:
>> Hi,when loading the Ad-Hoc release into iTunes, there is a generic icon shown
> in the Apps section. Additionally, the label shows "Unknown genre". Can i have
> my own image and my own label at label "Unknown genre".
> 
> (1) Since it's just ad hoc, who cares? Only beta testers will see it this
> way.

Um, no. Ad hoc is a legitimate distribution channel that just doesn't happen to 
go through the App Store.

> (2) The docs do say something about iTunesArtwork, do they not?

Specifically, read http://tinyurl.com/34f9yso (links to apple's site).

You can do it manually by creating a directory tree of the form

  top/
   iTunesArtwork
   Payload/
 yourapp.app/
   .
   .
   .

Zip up everything inside top, then rename the zip file to yourname.ipa.

-- 
Dave Carrigan
d...@rudedog.org
Seattle, WA, USA

___

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 arch...@mail-archive.com


Re: Splitter moves on its own

2010-06-22 Thread Jerry Krinock

On 2010 Jun 22, at 08:45, k...@highrolls.net wrote:

> When the program starts if my first action is to move the vertical split view 
> splitter one of the horz split view splitters collapses to the bottom of the 
> window.
> 
> What cause a splitter to move on its own?

I don't know in your case specifically, but when views move on their own it's 
usually due to autoresizing.  For example, autoresizing will occur when opening 
a document window, if it had been resized to a size different than the original 
(Interface Builder) size, and this size was stored in User Defaults, as is the 
standard behavior.

___

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 arch...@mail-archive.com


Re: can we have own application logo for ad-hoc release.

2010-06-22 Thread Matt Neuburg
On Mon, 21 Jun 2010 23:05:37 -0700 (PDT), Kalyanraju M
 said:
>Hi,when loading the Ad-Hoc release into iTunes, there is a generic icon shown
in the Apps section. Additionally, the label shows "Unknown genre". Can i have
my own image and my own label at label "Unknown genre".

(1) Since it's just ad hoc, who cares? Only beta testers will see it this
way.

(2) The docs do say something about iTunesArtwork, do they not?

m.

-- 
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

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 arch...@mail-archive.com


[ANN] Cocoa Talk Episode 2 -UIGestureRecognizers

2010-06-22 Thread Development
Cocoa Talk Episode 2 has been uploaded and is available via iTunes or 
http://cocoatalk.libsyn.com

This episode covers UIGestureRecognizers, Pinch and Swipe. It also shows how to 
zoom in and out on an item inside a 
UIScrollView.___

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 arch...@mail-archive.com


Re: docs, KVO and NSUserDefaults etc.

2010-06-22 Thread Matt Neuburg
On Mon, 21 Jun 2010 19:40:27 -0400, Scott Anguish  said:
>If it isn't documented as being KVO compliant it is best not to assume it is
guaranteed to be in the future.
>
>
>On Jun 21, 2010, at 1:28 PM, Matt Neuburg wrote:
>
>> But how is the user supposed to know this? Or is the user who discovers this
>> supposed to ignore it?

Thanks, Scott. This is what I was afraid the answer might be. But gosh, this
sort of KVO compliance is awfully useful, esp. on iPhone where there are no
bindings, no user defaults controller, etc. It's really a pity not to be
allowed to use it. If there's time and you could blip the engineering folks
to double-check this it would be very cool (I understand if there isn't
time). Tx again - m.

-- 
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

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 arch...@mail-archive.com


Re: Incomplete rendering returned from glReadPixels

2010-06-22 Thread Michael Ash
On Tue, Jun 22, 2010 at 9:25 AM, Ben Haller
 wrote:
>  It's a little weird because this method gets called sometimes on a view
> that is not yet installed in a window, so I just make a window then and
> there.  (This is run in a headless command-line app, I ought to mention.)
>  And yes, I don't bother cleaning up the window and such; right after this
> image writes out, the task exits, so cleanup doesn't matter.  Note that I am
> sure the rendering is in fact complete; I see the window flash onscreen, and
> it has everything in it.  (I can also run my app in a GUI mode, and all the
> rendering looks right then.)

I don't have an answer to your question, but you might consider
switching to offline rendering for the command-line mode so that you
don't have to mess around with windows and such. You can use
-[NSOpenGLContext setOffScreen:width:height:rowbytes:] to point it
into your own pixel buffer, thus eliminating the need for glReadPixels
completely. Who knows, it might even fix your problem too

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 arch...@mail-archive.com


Splitter moves on its own

2010-06-22 Thread koko
I have a view configuration with two vertical split vies and one  
horizontal split view effectively dividing my views into four quadrants.


When the program starts if my first action is to move the vertical  
split view splitter one of the horz split view splitters collapses to  
the bottom of the window.


What cause a splitter to move on its own?

-koko
___

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 arch...@mail-archive.com


Re: Flip and Enlarge CALayer at the same time

2010-06-22 Thread Gustavo Pizano
HEllo all... I had an advance

:) :) :)
so I did this - (void) setFaceUp: (BOOL)up
{
if( up != _faceUp ) {
// The Card has separate sub-layers for its front and back. At any 
time, one of them
// is hidden, by having a 180 degree rotation about the Y axis.
// To flip the card, both front and back layers are flipped over.
CATransform3D xform;
xform = up ?kFaceUpTransform :kFaceDownTransform;
CABasicAnimation * flipAnim  = [CABasicAnimation 
animationWithKeyPath:@"transform"];

flipAnim.toValue = [NSValue valueWithCATransform3D:xform];
flipAnim.duration = 0.5f;
flipAnim.cumulative = NO;
flipAnim.removedOnCompletion = NO;
flipAnim.autoreverses = NO;
flipAnim.fillMode = kCAFillModeForwards;
//_front.transform = xform;
[_front addAnimation:flipAnim forKey:@"flipAnimFront"]; 
[self performSelector:@selector(enlargeCALayer) withObject:nil 
afterDelay:0.29];
xform = up ?kFaceDownTransform :kFaceUpTransform;
flipAnim.toValue = [NSValue valueWithCATransform3D:xform];  

//_back.transform = xform;  
[_back addAnimation:flipAnim forKey:@"flipAnimBack"];
_faceUp = up;
}
}

- (void)enlargeCALayer{
CABasicAnimation * frameAnim =  [CABasicAnimation 
animationWithKeyPath:@"position"];
[frameAnim setFromValue:[NSValue valueWithPoint:self.position]];
NSRect  r = [self superlayer].bounds;
NSPoint p = NSMakePoint((r.origin.x + r.size.width)/2.0f, 
(r.origin.y + r.size.height)/2.0f);
[frameAnim setToValue:[NSValue valueWithPoint:p]];
frameAnim.cumulative= NO;
frameAnim.removedOnCompletion=NO;
frameAnim.autoreverses = NO;
frameAnim.fillMode=kCAFillModeForwards;

[self addAnimation:frameAnim forKey:nil];
 
}

plaese correct to make it better, I know it can be done better way,  right now 
its not scaling but its repositioning the layer to the middle point of its 
superview :)

so know im missing the scaling while repositioning.

any suggestions?

Gustavo



On Jun 22, 2010, at 3:36 PM, Gustavo Pizano wrote:

> Hello, Im trying to recreate a flip-n-scale of a CALayer, pretty much the 
> same as in iPhoto when you click the info of a event, it will flipt and 
> enlarge a layer, but the back side of the layer its another view.
> So this is what I have so far base on the GameGeek board game example from 
> apple.
> 
> - (void) setFaceUp: (BOOL)up
> {
>if( up != _faceUp ) {
>// The Card has separate sub-layers for its front and back. At any 
> time, one of them
>// is hidden, by having a 180 degree rotation about the Y axis.
>// To flip the card, both front and back layers are flipped over.
>CATransform3D xform;
>xform = up ?kFaceUpTransform :kFaceDownTransform;
>CABasicAnimation * flipAnim  = [CABasicAnimation 
> animationWithKeyPath:@"transform"];
>   
>   flipAnim.toValue = [NSValue valueWithCATransform3D:xform];
>   flipAnim.duration = 0.5f;
>   flipAnim.cumulative = NO;
>   flipAnim.removedOnCompletion = NO;
>   flipAnim.autoreverses = NO;
>   flipAnim.fillMode = kCAFillModeForwards;
>   //_front.transform = xform;
>[_front addAnimation:flipAnim forKey:@"flipAnimFront"];
>xform = up ?kFaceDownTransform :kFaceUpTransform;
>   flipAnim.toValue = [NSValue valueWithCATransform3D:xform];  
> 
>   //_back.transform = xform;  
>   [_back addAnimation:flipAnim forKey:@"flipAnimBack"];
>_faceUp = up;
>}
> }
> 
> when I click my info button the layer its flipped correctly and at the end I 
> end up p whit the front CALayer being shown.
> I was trying then to add the "scaling" animation by adding a CAKeyAnimation 
> with the values and times, then add the flipAnimation and the keyAnimation 
> into a group and add it to the layer...but  unfortunately id doesn't work.  I 
> see it flipped and once flips one face of the layer then it display nothing.
> 
> My guesses..:
> 
> I have this structure:  CALayer with 2 CALayers ivars, (_front and _back), so 
> right now its working the flipping from _front to back,  so I guess this is 
> not working because Im not setting the frame animation to the parent layer,  
> which at the end its the one  it should resize. 
> 
> Im sorry Im kinda confused here, so any help will be gladly appreciate it.
> 
> thx
> 
> Gustavo
> 
> 
> 

___

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

Please do not post admin requests or moderator comments to the list.
Contact the 

Flip and Enlarge CALayer at the same time

2010-06-22 Thread Gustavo Pizano
Hello, Im trying to recreate a flip-n-scale of a CALayer, pretty much the same 
as in iPhoto when you click the info of a event, it will flipt and enlarge a 
layer, but the back side of the layer its another view.
So this is what I have so far base on the GameGeek board game example from 
apple.

- (void) setFaceUp: (BOOL)up
{
if( up != _faceUp ) {
// The Card has separate sub-layers for its front and back. At any 
time, one of them
// is hidden, by having a 180 degree rotation about the Y axis.
// To flip the card, both front and back layers are flipped over.
CATransform3D xform;
xform = up ?kFaceUpTransform :kFaceDownTransform;
CABasicAnimation * flipAnim  = [CABasicAnimation 
animationWithKeyPath:@"transform"];

flipAnim.toValue = [NSValue valueWithCATransform3D:xform];
flipAnim.duration = 0.5f;
flipAnim.cumulative = NO;
flipAnim.removedOnCompletion = NO;
flipAnim.autoreverses = NO;
flipAnim.fillMode = kCAFillModeForwards;
//_front.transform = xform;
[_front addAnimation:flipAnim forKey:@"flipAnimFront"]; 
xform = up ?kFaceDownTransform :kFaceUpTransform;
flipAnim.toValue = [NSValue valueWithCATransform3D:xform];  

//_back.transform = xform;  
[_back addAnimation:flipAnim forKey:@"flipAnimBack"];
_faceUp = up;
}
}

when I click my info button the layer its flipped correctly and at the end I 
end up p whit the front CALayer being shown.
I was trying then to add the "scaling" animation by adding a CAKeyAnimation 
with the values and times, then add the flipAnimation and the keyAnimation into 
a group and add it to the layer...but  unfortunately id doesn't work.  I see it 
flipped and once flips one face of the layer then it display nothing.

My guesses..:

I have this structure:  CALayer with 2 CALayers ivars, (_front and _back), so 
right now its working the flipping from _front to back,  so I guess this is not 
working because Im not setting the frame animation to the parent layer,  which 
at the end its the one  it should resize. 

Im sorry Im kinda confused here, so any help will be gladly appreciate it.

thx

Gustavo



___

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 arch...@mail-archive.com


Incomplete rendering returned from glReadPixels

2010-06-22 Thread Ben Haller
  Hi all.  I'm trying to render some graphics using NSOpenGLView and  
then save the rendered bits as a TIFF image.  I'm having trouble  
getting this working.  I already posted this question to the mac- 
opengl list, and didn't get a solution.  I'm posting here now because  
I'm using NSOpenGLView, and perhaps my difficulties are related to it,  
so maybe it's really a Cocoa issue in that sense.  Anyhow, I'm hoping  
somebody else in the Cocoa world has figured out this problem.
  I'm seeing incomplete rendering in the saved TIFF; it looks like  
the glReadPixels returns the pixels of the framebuffer before all of  
the drawing that I've requested has completed.  Perhaps a picture is  
worth a thousand words.  The way these images ought to look:


http://www.sticksoftware.com/task3_landscape.tiff

 The way they often do look:

http://www.sticksoftware.com/task1_landscape.tiff

  So as you can see, the rendering is perfectly fine except that not  
all the drawing has completed yet.  Note these two images were both  
generated by the same exact code, in the same run of the app; but  
sometimes the rendering gets completed, and sometimes it doesn't.


 Here's my top-level method to write the image; this is a method on a  
subclass of NSOpenGLView:



- (void)writeToFile:(NSString *)filePath
{
if (![self window])
{
		// OpenGL doesn't seem to display unless we're in an onscreen  
window :-<

NSRect popViewFrame = [self frame];
		NSWindow *popViewWindow = [[NSWindow alloc]  
initWithContentRect:popViewFrame styleMask:NSBorderlessWindowMask  
backing:NSBackingStoreBuffered defer:YES];


[popViewWindow setContentView:self];
[popViewWindow orderFront:nil];
[self setNeedsDisplay:YES];
[self display];
}

NSImage *snapImage = [self imageFromView];
NSData *tiffData = [snapImage TIFFRepresentation];

[tiffData writeToFile:filePath atomically:YES];
}


 It's a little weird because this method gets called sometimes on a  
view that is not yet installed in a window, so I just make a window  
then and there.  (This is run in a headless command-line app, I ought  
to mention.)  And yes, I don't bother cleaning up the window and such;  
right after this image writes out, the task exits, so cleanup doesn't  
matter.  Note that I am sure the rendering is in fact complete; I see  
the window flash onscreen, and it has everything in it.  (I can also  
run my app in a GUI mode, and all the rendering looks right then.)


 The -imageFromView method is pretty much straight from the web (in  
fact, I think this code has gone over the list before):



// From http://www.ripplon.com/code/Cocoa/NSOpenGLView-imageFromView.m

@implementation NSOpenGLView (AKImageGeneration)

static void memxor(unsigned char *dst, unsigned char *src, unsigned  
int bytes)

{
while (bytes--) *dst++ ^= *src++;
}

static void memswap(unsigned char *a, unsigned char *b, unsigned int  
bytes)

{
memxor(a, b, bytes);
memxor(b, a, bytes);
memxor(a, b, bytes);
}

- (NSImage *)imageFromView
{
NSRect bounds;
int height, width, row, bytesPerRow;
NSBitmapImageRep *imageRep;
unsigned char *bitmapData;
NSImage *image;

bounds = [self bounds];

height = bounds.size.height;
width = bounds.size.width;

imageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes: NULL

   pixelsWide: width

   pixelsHigh: height

bitsPerSample: 8

  samplesPerPixel: 4

 hasAlpha: YES

 isPlanar: NO

   colorSpaceName: NSCalibratedRGBColorSpace

  bytesPerRow: 0// 
indicates no empty bytes at row end

 bitsPerPixel: 0];

[[self openGLContext] makeCurrentContext];

glFlush();

bitmapData = [imageRep bitmapData];

bytesPerRow = [imageRep bytesPerRow];

	glPixelStorei(GL_PACK_ROW_LENGTH, 8*bytesPe

Re: an oldie but a goodie: observing properties of collected objects

2010-06-22 Thread Benjamin Rister
On Jun 17, 2010, at 10:02 PM, Ken Thomases wrote:

> Also, you could probably abstract it out into a custom class to facilitate 
> array observing, if you really wanted it.  Maybe somebody already has, for 
> all I know.

In fact, I put our implementation of this up on github last year:
http://github.com/bdrister/DSReceptionist

It requires blocks and GC, so not suitable for iOS use as-is, but now that 
blocks have made their way to iOS, somebody could retrofit old-school memory 
management into it if they needed and make it dual mode.

Best,
Benjamin Rister___

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 arch...@mail-archive.com


Re: detect NSPopUpButton changes

2010-06-22 Thread Graham Cox

On 22/06/2010, at 4:05 PM, Angelo Chen wrote:

> however, since that even will be called every time when the drop down is 
> selected, is there a way to check if selected item really change? thanks


Ummm, just compare it with what you have set already?

It's not the job of the control to store state data about your business logic, 
that's the job of your data model. Either the data model or the controller that 
mediates between the control and the data model should, when appropriate, 
discard changes that are not really changes.

--Graham


___

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 arch...@mail-archive.com


NSToolbar setup in conjunction with IB

2010-06-22 Thread Gideon King
Hi, I have a toolbar that has been set up in Interface Builder, and this is 
working just fine, but now I am in a situation where for some users of the 
application I want to remove a couple of items from the toolbar items 
completely. I will know whether I need them or not when the window is first 
created, and I never need to add them back in if they are not required for that 
user.

I looked at toolbarAllowedItemIdentifiers: and toolbarDefaultItemIdentifiers:, 
but even if I do return an array excluding the items I don't want, the IB 
settings override this.

I looked at the toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar: to see 
if I could just return nil for those items, and although I can do that, there 
appears to be no way of accessing the other items that have been instantiated 
in IB to be able to return them for the other items, and besides, the items I 
don't want displayed still appear in the customization window. Also, it appears 
that the configurationDictionary only contains items that are currently on the 
toolbar, so I can't affect the default items from there, and removeItemAtIndex: 
only affects the displayed items, and not the available items in the 
customization palette.

These same issues appear to preclude using the IB settings without the items I 
sometimes want, and adding them at runtime too.

In the documentation, it says "At runtime, you may combine toolbars and toolbar 
items that are unarchived from a nib file and those that are programmatically 
created."

Based on my findings so far, I can't see how you can combine them - it appears 
you have to either work entirely with the items created in IB, or do the whole 
thing programmatically. While it's not a huge thing to create them 
programmatically, I did try to go the combined route because firstly, the 
interface is already set up in IB, and secondly the documentation seems to 
suggest that it should be possible to do what I am wanting to do.

Is it possible to either:
a) Add all the items in IB, and remove the ones I don't want at runtime, or
b) Add all the items I always want in IB, and add the other ones I sometimes 
want at runtime?


Thanks

Gideon







___

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 arch...@mail-archive.com


Re: Threaded DOM operations

2010-06-22 Thread Matej Bukovinski
A single DOM operation may not be slow, but a bunch of them together can be. 
The problem is that sometimes I have to do a lot of DOM operations for several 
pages (walking the DOM three, flagging some DOMNodes, removing and shifting 
nodes around). I'm currently using grand central dispatch to offload as much as 
I can to background threads and doing DOM operations in between on the main 
tread. It would be nice to have the main tread free of such computation in 
order to have a responsive UI. 

I was afraid that NSXMLDocument would not handle HTML as good as WebKit does. 
It might be worth another look though. Thanks for the suggestion. 


On 21.6.2010, at 21:00, Jens Alfke wrote:

> 
> On Jun 21, 2010, at 3:50 AM, Matej Bukovinski wrote:
> 
>> I'm using WebKit to download a bunch of websites. On those sites I need to 
>> perform some basic DOM tree operations (e.g., removing some DOM nodes). 
>> WebKit makes this very straightforward by using elements such as DOMNodes to 
>> represent the document three. The problem is that those operations can be 
>> time intensive
> 
> That sounds weird to me. Those operations should be very fast. What is it 
> you’re doing? Have you made sure you’re not using any techniques that scale 
> poorly (such as bubble-sorts)? Are you sure it’s CPU-bound, or is it the time 
> to load the web page that dominates? (If that’s the problem, you can 
> definitely make WebKit load multiple pages in parallel.
> 
>> Does anyone have a suggestion how one would modify a HTML DOM on a 
>> background thread?
> 
> Not with WebKit.
> 
>> Perhaps some other framework that would allow me to construct a DOM tree 
>> from HTML source code and have basic tree operation support?
> 
> You could try using NSXMLDocument. If you use the tidy flag, it can parse 
> real-world HTML. You might be able to use different instances on multiple 
> threads.
> 
> —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 arch...@mail-archive.com

Re: Async NSURLConnection and blocks (was: Running NSURLConnection from within an NSOperation?)

2010-06-22 Thread Keith Duncan
> I had a chicken and egg problem wrt initializing the handler (with a 
> completion block that needed the connection) and the connection (which needed 
> the handler).

In that circumstance you can decorate the variable that you need to reference 
inside the block as __block, and set it to nil. These variables aren't const 
copied, they are moved to the heap and referenced. When you assign to it in 
future lines, the block will reference the updated value.

Keith

___

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 arch...@mail-archive.com


Re: Async NSURLConnection and blocks (was: Running NSURLConnection from within an NSOperation?)

2010-06-22 Thread Keith Duncan

On 20 Jun 2010, at 21:42, John Heitmann wrote:

> 
> On Feb 9, 2010, at 3:01 PM, Keith Duncan wrote:
> 
>> ...you should create a 'concurrent' NSOperation as described in the 
>> documentation, and schedule your NSURLConnection on +[NSRunLoop 
>> mainRunLoop]. This will allow your NSOperation -start method to exit 
>> immediately and the thread to return to the pool.
> 
> My first question is: doesn't this block the main loop with io?

Nope, it places the file descriptor for your socket into a select/kqueue loop 
somewhere that the system manages.

> With that code I get "attempt to pop an unknown autorelease pool". When I 
> drop the release altogether the error goes away, but that seems like a leak.

Fixed version below:

> I have another version which uses a block to manually pump, but then this 
> ties up an automatic block thread, which are supposed to be short-lived. Is 
> it really a good practice to drive the NSURLConnection from the main loop?
> 
>dispatch_queue_t queue = 
> dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
>dispatch_async(queue, ^ {
> NSAutoreleasePool *outerPool = [[NSAutoreleasePool alloc] init];
> 
>   ResponseHandler *handler = [[ResponseHandler alloc] init];
>[handler initWithDelegate:delegate completionBlock:^ {
>   dispatch_async(queue, ^ {
>   NSAutoreleasePool *innerPool = [[NSAutoreleasePool 
> alloc] init];
>   
>   […]
> 
>   [innerPool release];
>   });
>   }];
>   
>   NSURLConnection *connection = [[NSURLConnection alloc] 
> initWithRequest:urlRequest delegate:handler startImmediately:NO];
>   [connection scheduleInRunLoop:[NSRunLoop mainRunLoop] 
> forMode:NSDefaultRunLoopMode];
>   [connection start];
> 
>   [outerPool release];
>});

Your autorelease pools are in different scopes. Autorelease pools are 
per-thread state and you need to return it to the default state (blank) at the 
end of your blocks. Your blocks are being executed on different threads.

Keith

___

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 arch...@mail-archive.com


Re: Async NSURLConnection and blocks (was: Running NSURLConnection from within an NSOperation?)

2010-06-22 Thread Keith Duncan
> Lastly, you should run the thread's run loop until your delegate method gets 
> called indicating the NSURLConnection is done.

Don't do that. That was discussed in the previous thread (search the archives). 
It irresponsibly consumes a workgroup thread.

Keith

___

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 arch...@mail-archive.com


detect NSPopUpButton changes

2010-06-22 Thread Angelo Chen
Hi,
How to detect if user has change NSPopupButton's selection? Thanks,
Angelo  



___

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 arch...@mail-archive.com


Re: detect NSPopUpButton changes

2010-06-22 Thread Angelo Chen
Hi,
oic, i'm kind of ignorant:(
however, since that even will be called every time when the drop down is 
selected, is there a way to check if selected item really change? thanks

--- 2010年6月22日 星期二,Graham Cox  寫道﹕

寄件人: Graham Cox 
主題: Re: detect NSPopUpButton changes
收件人: "Angelo Chen" 
副本(CC): cocoa-dev@lists.apple.com
日期: 2010年6月22日,星期二,下午1:56


On 22/06/2010, at 3:51 PM, Angelo Chen wrote:

> Hi,
> How to detect if user has change NSPopupButton's selection? Thanks,
> Angelo  


What have you tried?

It's a control like any other - hook it up to a target and an action and you'll 
get called when the user changes the selection.

--Graham






___

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 arch...@mail-archive.com


can we have own application logo for ad-hoc release.

2010-06-22 Thread Kalyanraju M
Hi,when loading the Ad-Hoc release into iTunes, there is a generic icon shown 
in the Apps section. Additionally, the label shows "Unknown genre". Can i have 
my own image and my own label at label "Unknown genre".  



___

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 arch...@mail-archive.com


Re: detect NSPopUpButton changes

2010-06-22 Thread Graham Cox

On 22/06/2010, at 3:51 PM, Angelo Chen wrote:

> Hi,
> How to detect if user has change NSPopupButton's selection? Thanks,
> Angelo  


What have you tried?

It's a control like any other - hook it up to a target and an action and you'll 
get called when the user changes the selection.

--Graham


___

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 arch...@mail-archive.com


Re: Core data and NSTextView: get the attributed string?

2010-06-22 Thread Bernard Knaepen

On 21 Jun 2010, at 21:35, Michael Babin wrote:

> On Jun 20, 2010, at 8:11 AM, Bernard Knaepen wrote:
> 
>> The trouble I have is to access the attributed string within my code to 
>> later draw in a custom view. I am trying something like this:
>> 
>> NSManagedObjectContext *context  = [self managedObjectContext];
>> NSManagedObjectModel   *model= [self managedObjectModel];
>> NSDictionary   *entities = [model entitiesByName];
>> NSEntityDescription*entity   = [entities valueForKey:@"signatures"];
>> 
>> NSFetchRequest * fetch = [[NSFetchRequest alloc] init];
>> [fetch setEntity: entity];
>> 
>> NSArray *results = [context executeFetchRequest:fetch error:nil];
>>  
>> myData = [[results objectAtIndex:0] valueForKey:@"sigText"];
>> 
>> NSAttributedString *signatureView = (NSAttributedString *)[NSUnarchiver 
>> unarchiveObjectWithData:myData];
>> 
>> [mypreview lockFocus];
>> [signatureView drawAtPoint:myPoint];
>> [mypreview unlockFocus];
>> 
>> 
>> Obviously something is wrong since the text is not drawn and the console 
>> outputs:
>> 
>> -[NSConcreteMutableData drawAtPoint:]: unrecognized selector sent to 
>> instance 0x114a3afb0
> 
> From the error message, it would appear signatureView is not an 
> NSAttributedString (NSMutableData, instead). So work backwards. You're making 
> assumptions in your code: valueForKey:@"sigText" returns an NSData object, 
> using NSUnarchiver on it yields an NSAttributedString. Test them (step 
> through in debugger, NSLog(), etc) and see if your assumptions are valid. If 
> they aren't valid, then move back up the chain to where the value is stored 
> and see if you're storing the correct data. If your assumptions are valid, 
> then I would suspect there might be some intervening code and you may be 
> running into object ownership issues (retain/release, zombies).
> 
> 

Problem solved. In the .xib file, I had binded the NSTextView 'Data' to 
sigText. I now use the 'attributed string' value for the binding and everything 
is fine (shame on me for not having seen this option before).

Mike, thanks your tip ;-)


Bernard.

 

___

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 arch...@mail-archive.com


Re: DnD International No symbol

2010-06-22 Thread Graham Cox
Sorry to rehash an old thread, but just trying this as stated doesn't work for 
me.

Once I set the cursor in this fashion it never changes to what it should do 
when a valid drag operation is returned. I should point out that I'm linking 
against the 10.5 SDK though and testing for this method using 
-respondsToSelector: (which therefore only works on 10.6 anyway). Could that 
have anything to do with it?

Otherwise I need to know a way to turn off this cursor when necessary so that 
the drag system can do its thing correctly as normal.

--Graham



On 18/06/2010, at 8:48 AM, Corbin Dunn wrote:

> 
> On Jun 16, 2010, at 7:19 PM, Tony Romano wrote:
> 
>> Hmm...  I'm returning the NSDragOperationNone now, all I get is an image of 
>> what is being dragged no other symbol and the outlineview won't accept the 
>> drop which is correct.  When I have a valid selection, I get the other 
>> symbol for copy(green circle with plus sign), or for Move, the outlineview 
>> highlights the drop point.
> 
> Call:
>  [[NSCursor operationNotAllowedCursor] set];
> before returning NSDragOperationNone.
> 
> 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/graham.cox%40bigpond.com
> 
> This email sent to graham@bigpond.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 arch...@mail-archive.com