Cocoa equivalent to Quartz's CGImageCreateWithImageInRect(image, imageRect);

2009-06-14 Thread Frederick C. Lee
Is there a Cocoa/iPhone equivalent to Quartz's  
CGImageCreateWithImageInRect(image, imageRect)?


I want to be able to display an off-view portion; or pan over a large  
PNG image within

the available UIView.

Ric.
___

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: searching a string in big file

2009-06-14 Thread Arie Pieter Cammeraat
you can use some methods of NSString, but I doubt wether NSString  
performs well with really big string.
I once tried to work with the Unix tool 'grep' for searching  
something in the iTunes Library xml file. That was amazingly fast!  
You can use it in cocoa with NSPipe etc.



Op 13-jun-2009, om 7:55 heeft Angelo Chen het volgende geschreven:


Hi,
I need to open a big file and search for a certain string, if  
found, I need tup do some updates and write back the file, any idea  
what approach I should take? Thanks,

Angelo


  Yahoo!香港提供網上安全攻略,教你如何防範黑客! 請前往 http:// 
hk.promo.yahoo.com/security/ 了解更多!

___

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/cocoa-dev% 
40yaranga.nl


This email sent to cocoa-...@yaranga.nl


___

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: Card Game (like Spider-Solitaire) in Cocoa -- Conceptual ideas needed

2009-06-14 Thread Florian Witteler

Hi Kyril, Nick, Brian and Erik!

I'd really like to thank you all for your comments. You gave me a good  
starting point to move on!
I'll work through these ressources and get back, if I have further  
questions.

Have a nice weekend.

- Florian

P.S.: I'm not familiar with mailing-lists. Do I simply hit 'reply to  
all' when I want to send an answer to that message or how does the  
mailing list know, that I send an answer to that specific message?  
Perhaps there is a beginner-guide -- I didn't find this information is  
the lists' FAQ.

___

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


NSRuntime.loadLibrary(/usr/lib/java/libObjCJava.dylib) error

2009-06-14 Thread Tejas Vora
Hello All,

I am getting the following error message when I try to migrate my Java
application on OS-X from java 5 to java 6.
I have a 64 bit MAC which is a requirement.

I am copy pasting the console over here :

NSRuntime.loadLibrary(/usr/lib/java/libObjCJava.dylib) error.
java.lang.UnsatisfiedLinkError: /usr/lib/java/libObjCJava.A.dylib:
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1822)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1702)
at java.lang.Runtime.load0(Runtime.java:770)
at java.lang.System.load(System.java:1005)
at com.apple.cocoa.foundation.NSRuntime.loadLibrary(NSRuntime.java:127)
at com.apple.cocoa.foundation.NSRuntime.(NSRuntime.java:35)
at com.apple.cocoa.foundation.NSObject.(NSObject.java:27)
at macintalk.Macintalk.voiceLanguageMapping(Macintalk.java:231)
at speechengine.EventHandler.(EventHandler.java:202)
at core.hearsay.Hearsay.(Hearsay.java:526)
at core.hearsay.Hearsay.main(Hearsay.java:641)
Writing the settings to temporary settings file


Please let me know if any one faced the similar problem or any one is aware
about the solution to the above problem

Thanks in advance

Thanks and Regards
Tejas Vora
___

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


really odd sluggish calls to nextEventMatchingMask:untilDate:inMode:dequeue:

2009-06-14 Thread Andrew Wulf
In the cross platform game I support the mac code on, since a few  
months ago people are reporting odd stutters while using the mouse. I  
investigated and found that calling


for(;;)
{
  UnsignedWide time;
  Microseconds(&time);

  NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask  
untilDate:nil inMode:NSDefaultRunLoopMode dequeue:YES];


  UnsignedWide time2;
  Microseconds(&time2);

  unsigned long msecs = (*(unsigned long long*)&time2)-(*(unsigned  
long long*)&time);

  printf("%ld, %d / ", msecs, nnn++);

  if(!event)
  {
printf("\n");
  }
  if(!event) break;

  ... process event
}

(note the debugging code isn't in the live game) takes (on my g5)  
around 0.5ms for no event, but when there is a mouse moved event it  
can take anywhere from 2 to 20 ms just for 1 call. Does anyone have  
any idea why this would be? Oddly enough its not 100% of the time and  
not for everyone but is fairly common. The result is that the frame  
where this call is made sticks. The game is backwards (I didn't write  
it) and each game loop calls the above code to obtain mouse and  
keyboard events to control the avatar in the game. However this exact  
code worked flawlessly for years until just a few months ago, which  
makes 0 sense. The problem occurs in both slow macs and fast macs with  
fps from 8 to 80.


Interesting enough if there are many events pending (like key repeats)  
the first (usually the mouse event) takes a long time, then the  
remaining don't take very long usually.


I tried both with and without mouse coalescing but it didn't help.

This is driving me nuts. If it wasn't such a pain in the butt I would  
use a regular main event loop and run the game on a timer, but it  
might still have this "slow" issue.


Any help is very appreciated!

- andrew
___

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: Cocoa equivalent to Quartz's CGImageCreateWithImageInRect(image, imageRect);

2009-06-14 Thread Kyle Sluder
Are you looking for Cocoa solutions as well, or only Cocoa Touch?  The
typical way to do this on desktop (Cocoa) is to use an NSScrollView
(with NSClipView).  On Cocoa Touch, I hear people often use a
CATiledLayer, but as I'm not an iPhone dev there might be better
solutions available for your specific needs.  Although from what I've
gathered you're often thunking down to Quartz on the phone anyway.

--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: Card Game (like Spider-Solitaire) in Cocoa -- Conceptual ideas needed

2009-06-14 Thread Benjamin Dobson


On 13 Jun 2009, at 11:20:36, Florian Witteler wrote:


Hi Kyril, Nick, Brian and Erik!

I'd really like to thank you all for your comments. You gave me a  
good starting point to move on!
I'll work through these ressources and get back, if I have further  
questions.

Have a nice weekend.

- Florian

P.S.: I'm not familiar with mailing-lists. Do I simply hit 'reply to  
all' when I want to send an answer to that message or how does the  
mailing list know, that I send an answer to that specific message?  
Perhaps there is a beginner-guide -- I didn't find this information  
is the lists' FAQ.


Just press reply and change the To: field to cocoa- 
d...@lists.apple.com. That's all you need to do.

___

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: NSRuntime.loadLibrary(/usr/lib/java/libObjCJava.dylib) error

2009-06-14 Thread Kyle Sluder
On Sat, Jun 13, 2009 at 12:40 PM, Tejas Vora wrote:
> I am getting the following error message when I try to migrate my Java
> application on OS-X from java 5 to java 6.

The Cocoa-Java bridge has been deprecated since 10.4.

--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: NSRuntime.loadLibrary(/usr/lib/java/libObjCJava.dylib) error

2009-06-14 Thread Nick Zitzmann


On Jun 13, 2009, at 1:40 PM, Tejas Vora wrote:


I have a 64 bit MAC which is a requirement.

I am copy pasting the console over here :

NSRuntime.loadLibrary(/usr/lib/java/libObjCJava.dylib) error.
java.lang.UnsatisfiedLinkError: /usr/lib/java/libObjCJava.A.dylib:
   at java.lang.ClassLoader$NativeLibrary.load(Native Method)



You're going to have to re-think your requirements then:

% lipo -info /usr/lib/java/libObjCJava.A.dylib
Architectures in the fat file: /usr/lib/java/libObjCJava.A.dylib are:  
i386 ppc7400


I don't see an "x86_64" in there.

Nick Zitzmann




___

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: Card Game (like Spider-Solitaire) in Cocoa -- Conceptual ideas needed

2009-06-14 Thread Kyle Sluder
On Sat, Jun 13, 2009 at 3:20 AM, Florian
Witteler wrote:
> Hi Kyril, Nick, Brian and Erik!

s/Kyril/Kyle/ plz :)  Although I'd prefer my name to be Kyril.  Too
much paperwork though.  :P

> P.S.: I'm not familiar with mailing-lists. Do I simply hit 'reply to all'
> when I want to send an answer to that message or how does the mailing list
> know, that I send an answer to that specific message? Perhaps there is a
> beginner-guide -- I didn't find this information is the lists' FAQ.

Every mailing list is different -- though all the ones on
lists.apple.com are the same.  On the Apple lists, you have to hit
Reply to All, which will send the message directly to the person
you're replying to, and CC it to the list.  So please to hit Reply to
All on this list.  On other lists, the general reply address is set to
the whole mailing list, so you need not do it there.

--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


Safari-4-like Pulldown List

2009-06-14 Thread Dong Feng
I want to implement a pulldown list like what FireFox does with its
address bar (or its Google search bar). I think it involves to open a
borderless window and draw items through Cocoa drawing APIs.

But when I saw Safari 4, its pulldown list's appearance just like a
context-menu, I began thinking if implement a Safari-4-like pulldown
list can save drawing the whole borderless window by writing code
myself. Does Safari 4 rely on Cocoa API of menu to implement its
pulldown list, or does it still implement a borderless window itself
whose appearance happen to simulate a context menu?
___

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: Coming up with ideas

2009-06-14 Thread WT

Hi Graham,

care to share some of them? I'm sure lots of people like the OP and  
myself, who are not as prolific in coming up with ideas as you are,  
would be happy to take a shot at some of your ideas.


Wagner



Well, most of them reflect two things: a) my interests and b) the  
lack of certain categories of affordable software on the Mac.


So these aren't necessarily original ideas, but I wish there were:

a) really good CAD software that was in a hobbyists price-range but  
was of professional quality and a true OSX app, not a crappy port or  
half-baked shareware effort

b) ditto PCB design software
c) ditto electronic simulation software (both digital and analogue)
d) ditto mechanical/kinematics design and simulation software

In recent years the quality of shareware or low-cost apps in certain  
sectors such as drawing and painting has improved dramatically. I'd  
like to see the same ethos spread to some of these other areas, but  
of course such apps are far from trivial.


On d) if anyone can point me to a decent open-source kinematics  
library I'm all ears...


--Graham


Nice ideas, but I think they're far too challenging for the amount of  
Cocoa programming experience I have, so I won't be taking any shots at  
them any time soon. :) This discussion reminds me, by the way, of an  
idea of my own that I've had nearly 20 years ago, back when I was a  
particle physics grad student.


Back then, I wanted to write an application that would draw all  
Feynman diagrams of a particular kind for a particular interaction  
Lagrangean. You'd specify the interaction vertices, the incoming and  
outgoing lines, and the number of loops, and the application would  
draw all diagrams with those properties. I also wanted the application  
to output (in LaTeX-typeset form) the associated Feynman integral for  
each diagram it generated.


Now, back then I had the math and physics understanding necessary to  
write such an application, but not the programming experience. Today,  
I'm much better prepared on the programming end of it, but I've since  
forgotten some of the math and physics knowledge required. Moreover,  
it's still a daunting task, I think. So, if anyone else wants to give  
it a shot, please do. I'm sure it would be very useful to a lot of  
particle physics students and professionals out there.


Wagner
___

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


advice on background process

2009-06-14 Thread Rick C.
hello,

my project is fairly small and it monitors via notification certain directories 
for changes.  ideally the app would always run so that it would always monitor. 
 but i would like to make it so the icon could be hidden and my understanding 
is that LSUIElement always hides the menubar as well which won't work for me (i 
would at least like the menubar to show along with the main window if the 
finder icon is clicked).  so if the only solution is to make some kind of 
separate background process (daemon or whatever) can someone point me in the 
right direction as to what process might work for me?  again if only i can just 
run the app itself i would but i would like to have this "hidden" mode as a 
feature...

thank you,

rick


  
___

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

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

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

This email sent to arch...@mail-archive.com


NSTask root privileges?

2009-06-14 Thread KK
Hello,
I'm writing a Foundation tool that is only run by root (by launchd).. This
tool is using NSTask to call another program, but it seems like the program
that i'm calling within the NSTask is not given root privileges...

I'm not sure what I'm missing, do I have to use the Security framework?

Keita
___

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: Blur NSImage

2009-06-14 Thread Pierce Freeman
Kyle:

Thanks for your suggestion.  I ended up doing it in Interface Builder, and
it works great!


Thanks!


On 6/13/09 8:37 PM, "Kyle Sluder"  wrote:

> Look into Core Image filters.  You can apply them to any layer-backed
> view.  You can even do it from within Interface Bulder, on the View
> Effects tab of the inspector.
> 
> --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: How can I keep an NSPopUpButton open after the user selects a menu item?

2009-06-14 Thread Michael Ash
On Sat, Jun 13, 2009 at 2:20 PM, Dennis
Hartigan-O'Connor wrote:
> I have an NSPopUpButton providing the NSMenu for a status item with a custom
> view. The popup button displays a list of links. When the user selects a
> link from the list, the link is displayed in the user's browser (in the
> background).
>
> Naturally, the menu closes every time the user selects a link.
>
> I would like to change this: I want the menu to stay open while the user
> clicks on various links, all of which can be opened in the background. The
> menu can then go away when the user clicks elsewhere.
>
> How can this be accomplished? Should I subclass NSMenuItem and intercept the
> mouse clicks somehow? Overlay a transparent NSView on the popped-up menu
> and, again, intercept the clicks somehow? I make these suggestions blithely,
> but I would have trouble implementing either of these...pointers to the
> right methods for override would be appreciated.

This probably can't be done in any reasonable fashion. Subclassing
NSMenu classes won't work, because they're a thin wrapper around
Carbon menus and all the event tracking and such is handled internally
by Carbon. An overlay window could work but would be iffy.

However, I'd suggest that you shouldn't do this in the first place.
Don't break users' expectations. When they see a popup menu, they're
going to expect it to behave the way every other popup menu has
behaved since the dawn of time. Defying that expectation is a good way
to frustrate people and have them dislike your app.

Instead, use a different control. Maybe a custom control, but
something that will indicate to users that this behaves differently,
don't expect it to work like a popup menu. If you want to save space,
you could even pop up a window that holds the meat of your control,
just don't make it look like a popup menu.

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


Re: advice on background process

2009-06-14 Thread Michael Ash
On Sun, Jun 14, 2009 at 7:19 AM, Rick C. wrote:
> hello,
>
> my project is fairly small and it monitors via notification certain 
> directories for changes.  ideally the app would always run so that it would 
> always monitor.  but i would like to make it so the icon could be hidden and 
> my understanding is that LSUIElement always hides the menubar as well which 
> won't work for me (i would at least like the menubar to show along with the 
> main window if the finder icon is clicked).  so if the only solution is to 
> make some kind of separate background process (daemon or whatever) can 
> someone point me in the right direction as to what process might work for me? 
>  again if only i can just run the app itself i would but i would like to have 
> this "hidden" mode as a feature...

While you have a menu bar, you will have a Dock icon. That's just how it works.

As such, I suggest reworking your design to match this restriction.

The most obvious way to do this would be to just have two
applications. One is an LSUIElement which does the monitoring and any
UI type stuff that's done during that, and the other is a regular
application which talks to it.

Another way is to have one application, LSUIElement, and use
TransformProcessType to turn it into a "real" application on demand.
There are some bugs with this on Leopard, search the list archives for
more information, but I believe it can be made to work.

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


Re: NSTask root privileges?

2009-06-14 Thread Greg Guerin

KK wrote:


I'm writing a Foundation tool that is only run by root (by launchd)..


Exactly how is your tool being run by launchd?
Where are you putting the agent/daemon plist?
Post the contents of that plist.

Does your tool ever call setuid() or seteuid() or any similar  
function (there are several)?


Does it ever call daemon()?

Have you read TN2083: Daemons and Agents?

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


This tool is using NSTask to call another program, but it seems  
like the program

that i'm calling within the NSTask is not given root privileges...


What is the other program?
Is it a setuid executable?

Please describe exactly how you know root privileges are absent for  
this other program.  E.g. if a file that should be accessible to root  
isn't, tell us what the file is.  If a system-call isn't accessible  
but should be, exactly which system-call?


Does the other program call setuid() or similar functions?

What OS version is this on?

  -- GG

___

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


Correct MVC code placement

2009-06-14 Thread Chris Tracewell
I have many occasions when a model's property needs to be transformed  
to another type for use in a view. In this case I have a string of  
pipe separated values that need to be transformed into a  
NSMutableArray, manipulated in the interface and then converted back  
to the pipe separated string before saving the model. Should this be  
in the model or in the controller or are there no hard set rules?


FWIW: NSValueTransformer, for some reason, does not perform/call the  
reverse transformation back to a string when an array controller is  
bound to my model's property... it will display the transformed value  
but like others I found it does not reverse the array back to a string.



Thanks
___

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: Correct MVC code placement

2009-06-14 Thread Kyle Sluder
NSDocument is what's known as a "model-controller" object.  Your
actual model is the pipe-separated values; NSDocument allows you to
perform operations on that model.  As such, I'd probably expose an
NSArray property for my list of things, and only do the
pipe-separation when reading from or writing to disk.

--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: Correct MVC code placement

2009-06-14 Thread Chris Tracewell
Thanks Kyle, I should've noted this is a non-document based app. That  
said, I think your suggestion would imply to let the controller to  
expose its own array property of the model's pipe-separated property?


Chris


On Jun 14, 2009, at 11:27 AM, Kyle Sluder wrote:


NSDocument is what's known as a "model-controller" object.  Your
actual model is the pipe-separated values; NSDocument allows you to
perform operations on that model.  As such, I'd probably expose an
NSArray property for my list of things, and only do the
pipe-separation when reading from or writing to disk.

--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: Coming up with ideas

2009-06-14 Thread Uli Kusterer

Am 12.06.2009 um 19:30 schrieb Development:
Hey, how do you guys come up with ideas for new programs? I'm going  
nuts trying to figure out what type of application I should make.


I'm in a similar boat as Graham, in that I'm so busy working on  
existing apps that I actually blogged a few ideas here:


http://www.zathras.de/blog-software-ideas-up-for-grabs.htm


Apart from those, I also see the need to create "a new HyperCard".  
Here, my basic thought is:


- Easy for beginners to learn
- English-like programming language, but more like Inform 7 than the  
classic HyperTalk

- Real-life metaphors
- Powerful enough that beginners can graduate to "pro-level" projects  
w/o having to leave the language


I've blogged about a few interesting articles that can serve as  
inspiration for new features:


http://zathras.de/blog-nice-ideas-for-a-future-hypercard.htm
http://zathras.de/blog-headaches-further-revelations.htm
http://zathras.de/blog-how-xtalk-syntax-should-be.htm


Also, I've done a nice app for doing screencasts that I just can't  
seem to get finished. It is *not* a screen recorder, but more of a  
"snippet monkey" thing that shows you your script. However, it lets  
you pre-record bits and pieces of your script, so you can just run  
through the script and concentrate on what you're doing on the screen,  
while text gets automatically typed into fields, Keynote slides get  
shown and hidden and switched through fairly automatically, and your  
recorded voice does a perfect voice-over.


If any of this interests anyone, let me know.

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





___

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

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

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

This email sent to arch...@mail-archive.com


Archiving undos? NSUndoManager

2009-06-14 Thread Scott Squires
I have an app currently with my own simple undo of a single instance.   
When the app quits I'm able to save and later restore the undo info.
I've now switched to using the NSUndoManager and multiple levels of  
complex undos.


On a desktop system the user quits and normally you just dispose of  
the undos.
This is on the iphone however.  They may have to quit in the middle of  
something (incoming call, text msg, catch a flight, etc)


Is there a simple method to archive the undo structure and restore it?
These are not CoreData items and they could be a wide range of data.

I could fold all the undo info into objects that are used in the  
undomanager methods and then reading those back and archive them

But there seems to be no way to have access to the stacks themselves.

I could keep my own stacks and try to keep sync with the NSUndoManager  
notifications.
But even if I archive these there would seem to be no way to restore  
the redo stack since there's no access to it.


Am I overlooking something here or is there a normal process that  
allows this?

Thanks.




___

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: Positioning of autocomplete popups

2009-06-14 Thread Ross Carter


On Jun 11, 2009, at 11:35 PM, Dave Robertson wrote:

Is there a recommended way to display a menu while still keeping key  
events flowing to the search field?


Not that I know of. In my case, I filter the list to remove things  
like apostrophe-s and display the list only if it contains less than  
30 items, so the user can easily select the desired item without  
typing additional characters.

___

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: Positioning of autocomplete popups

2009-06-14 Thread Uli Kusterer

Am 11.06.2009 um 23:35 schrieb Dave Robertson:
Is there a recommended way to display a menu while still keeping key  
events flowing to the search field?



 Do you need a menu? Have you tried just creating your own cool- 
looking borderless window and stuffing an NSTableView with the  
completions in it?


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





___

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

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

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

This email sent to arch...@mail-archive.com


Re: Coming up with ideas

2009-06-14 Thread Jeffrey Oleander

> On Sat, 2009/06/13, Grant Erickson  wrote:
> From: Grant Erickson 
> Subject: Re: Coming up with ideas
> To: "Graham Cox" 
> Cc: cocoa-dev@lists.apple.com
> Date: Saturday, 2009 June 13, 11:13
>> On 2009/06/12 23:34, Graham Cox wrote:
>>> On 2009/06/13, at 13:27, WT wrote:
 On 2009 Jun 13, at 04:36, Graham Cox wrote:
> On 2009/06/13, at 12:30, Development wrote:
> Hey, how do you guys come up with ideas
> for new programs?...

 I wish I had your problem ;-) I come up with
 ideas for new apps several times a week.
 I'm going nuts trying to figure out how
 I'll ever find time to implement them
 without dozens of developers!

... 
>> Well, most of them reflect two things:
>> a) my interests and
>> b) the lack of certain categories of affordable
>> software on the Mac.
...
>> a) really good CAD software that was in a
>> hobbyists price-range but was of professional
>> quality and a true OSX app, not a crappy port
>> or half-baked shareware effort

> While it is still not as good as Illustrator
> at what it does and still not quite as good
> as Claris CAD at what it did, I found
> IlexSoft's HighDesign...
> VersaCAD, Graphite, AutoCAD, Canvas,
> PowerCADD, ArchiCAD, MacDraft, and
> VectorWorks when considering both value and
> ease-of-use.

I've been longing for a good, inexpensive app
along those lines, too, since working on one
years ago.  We had over 200 developers working
mostly on one CAD/CAM product, but with others
working on integration with others' specialized
packages, e.g. for plastic mold design and the
CAE packages.

The best I've seen have disappeared from the
markets or cost a king's ransom (ours was $100K 
a pop, as I recall, but you could have 64 or
more designers using it).  The ones I've run 
across more recently are mere toys, and 
cumbersome at that.

I've thought about what it would involve, and
turned back each time.  Neither the Quartz
nor OpenGL libraries/frameworks lend themselves
to it.  In some ways it was simpler way back 
when drawing consisted of sending escape
sequences to graphics terminals, and it didn't
require standing on your head to draw something
elsewhere than the view origin; you just said
"draw an ellipse with foci there and there",
or "draw a circle inscribed in the triangle" or
"draw a circle with center there, in that part
of the sky-scraper and with radius of 
2 millimeters and parallel to the current view 
plane".

Others would be to see gimp ported to use Quartz
instead of X11 or whatever, better bidness 
graphing programs, outlining/writing assistants,
reading/writing teaching programs & games, 
poor man's GIS, more graphical report options
for genealogical info, EASY to use encryption/
decryption, bibliographic data-base, games that
did not skimp on physics but ditched the speed
gimmicks, weather-watching app that would let
me watch an imagery loop that lasted 30-120
seconds instead of skimping and showing a jerky
5-second loop, handy integrated program for 
sending out resumes and tracking when which 
version was sent to which e-mail address
(I'm using iCal and AddressBook and MarinerCalc
and TextEdit and lots of copying and pasting,
and file selecting, now; but would much prefer 
to just click on a dozen check-boxes, and then 
a "do it" button, and have it keep track of 
which ones bounced, too ;B-)  and a handy
data-base to keep and share my black-list 
of firms with unethical practices (though I 
suppose a group in AddressBook would suffice).

"The best way to have a good idea is to have
 a lot of ideas." --- Linus Pauling (quoted
 in Martin Edelston & Mary Buhagiar 1992
 _I Power_)


  
___

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: Correct MVC code placement

2009-06-14 Thread Ken Thomases

On Jun 14, 2009, at 2:34 PM, Chris Tracewell wrote:


On Jun 14, 2009, at 11:27 AM, Kyle Sluder wrote:


NSDocument is what's known as a "model-controller" object.  Your
actual model is the pipe-separated values; NSDocument allows you to
perform operations on that model.  As such, I'd probably expose an
NSArray property for my list of things, and only do the
pipe-separation when reading from or writing to disk.



Thanks Kyle, I should've noted this is a non-document based app.  
That said, I think your suggestion would imply to let the controller  
to expose its own array property of the model's pipe-separated  
property?


I think what Kyle meant is that your model is the values between the  
pipe separators.  The pipe-separated string format is part of your  
file format.  I don't know what your model represents, but I doubt  
that the pipe-separated string format is inherent to the thing which  
it represents.  Rather, it seems like the sort of thing which is only  
part of the storage format.


So, I think the model itself should parse the storage format and  
expose its state in the more natural format for Cocoa -- an array  
property.


Cheers,
Ken

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Correct MVC code placement

2009-06-14 Thread Chris Tracewell

Ken,

Okay, that makes perfect sense. You are right, I was storing the pipe- 
separated string of values to avoid needing another DB table for  
single values that would not surpass more than 2 or 3 per record.  
However, your and Kyle's response now make it obvious that the pipe- 
string is not the natural/logical format for cocoa use, and should be  
a part of the model.


Chris



On Jun 14, 2009, at 3:08 PM, Ken Thomases wrote:

I think what Kyle meant is that your model is the values between the  
pipe separators.  The pipe-separated string format is part of your  
file format.  I don't know what your model represents, but I doubt  
that the pipe-separated string format is inherent to the thing which  
it represents.  Rather, it seems like the sort of thing which is  
only part of the storage format.


So, I think the model itself should parse the storage format and  
expose its state in the more natural format for Cocoa -- an array  
property.


Cheers,
Ken


___

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

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

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

This email sent to arch...@mail-archive.com


Re: Cocoa equivalent to Quartz's CGImageCreateWithImageInRect(image, imageRect);

2009-06-14 Thread Rob Keniger


On 13/06/2009, at 4:53 AM, Frederick C. Lee wrote:

Is there a Cocoa/iPhone equivalent to Quartz's  
CGImageCreateWithImageInRect(image, imageRect)?


I want to be able to display an off-view portion; or pan over a  
large PNG image within

the available UIView.



Check out Bill Dudney's TiledLayer example:

http://bill.dudney.net/roller/objc/entry/catiledlayer_example

--
Rob Keniger



___

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

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

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

This email sent to arch...@mail-archive.com


Re: How can I keep an NSPopUpButton open after the user selects a menu item?

2009-06-14 Thread Graham Cox


On 14/06/2009, at 4:20 AM, Dennis Hartigan-O'Connor wrote:

I have an NSPopUpButton providing the NSMenu for a status item with  
a custom view. The popup button displays a list of links. When the  
user selects a link from the list, the link is displayed in the  
user's browser (in the background).


Naturally, the menu closes every time the user selects a link.

I would like to change this: I want the menu to stay open while the  
user clicks on various links, all of which can be opened in the  
background. The menu can then go away when the user clicks elsewhere.


How can this be accomplished? Should I subclass NSMenuItem and  
intercept the mouse clicks somehow? Overlay a transparent NSView on  
the popped-up menu and, again, intercept the clicks somehow? I make  
these suggestions blithely, but I would have trouble implementing  
either of these...pointers to the right methods for override would  
be appreciated.



It doesn't sound like a menu is the right UI widget for this job.

How about a list that you can collapse (hide) or show? Or a list in a  
window that floats. Pop-up behaviour should be strictly for operations  
that represent momentary actions. If you persist with the menu  
approach, users will likely become frustrated that it works  
inconsistently with the rest of the system and keeps trapping them  
into a (probably unwanted) mode.


--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: advice on background process

2009-06-14 Thread Jerry Krinock


On 2009 Jun 14, at 09:48, Michael Ash wrote:


On Sun, Jun 14, 2009 at 7:19 AM, Rick C. wrote:


my project is fairly small and it monitors via notification certain  
directories for changes.


The most obvious way to do this would be to just have two
applications. One is an LSUIElement which does the monitoring and any
UI type stuff that's done during that, and the other is a regular
application which talks to it.


Yes, split it into two as Mike recommends, but if that monitoring  
app's sole function is to watch certain directories for changes and  
you're requiring Mac OS 10.4 or later, you're in luck.   
"Monitoring ... certain directories for changes" can be performed by  
installing a launchd task.  So you only need one app.  Read:


http://developer.apple.com/MacOsX/launchd.html

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Questions on using using modal sheets with Core Data

2009-06-14 Thread Kevin Ross
I'm able to get the dependent values to update correctly if I access  
the deepest path of the relationship before I set the value that will  
cause them to update.


It seems like kind of a kludge, but it might be the best I can do  
right now until I can ferret out a possible missed dependency somewhere.



Thanks for the tips!

Kevin


On Jun 12, 2009, at 12:55 PM, Kevin Ross wrote:


Thanks Dave,
I'm creating a new MOC in the sheet and hooking it up to the same  
persistent store as the document, so when the NSArrayController  
performs it's initial fetch at load (I have it set in IB to  
automatically prepare content).  I'm not actually using this context  
to add or remove any entities, only changing the properties.  Each  
selectable managed object (an instance of FloorPlanMO) in the  
NSArrayController  has a 1-1 relationship with an entity called  
FlyingStarsMO.  This entity has 4 integer attributes that are  
dependent upon values in the FloorPlanMO as well as some of the  
values being inter-dependent amongst themselves.  Here is the code  
for the keyPathsForValuesAffectingKeys: of the FlyingStarMO.  The  
only value that I'm changing in this sheet is located at  
@"floorPlan.house.yearOfLastMajorRenovation".  I'm only changing the  
integer value, not adding or deleting anything.



+ (NSSet *)keyPathsForValuesAffectingMountainStar; {
   return [NSSet setWithObjects:@"floorPlan.sittingDirection",  
@"floorPlan.facingDirection", @"loShuAgeStar", @"floorPlan",  
@"floorPlan.house.yearOfLastMajorRenovation", nil];

}

+ (NSSet *)keyPathsForValuesAffectingWaterStar; {
   return [NSSet setWithObjects:@"floorPlan.sittingDirection",  
@"floorPlan.facingDirection", @"loShuAgeStar", @"floorPlan",  
@"floorPlan.house.yearOfLastMajorRenovation", nil];

}

+ (NSSet *)keyPathsForValuesAffectingLoShuAgeStar; {
   return [NSSet  
setWithObjects:@"floorPlan.house.yearOfLastMajorRenovation", nil];

}

+ (NSSet *)keyPathsForValuesAffectingAnnualStar; {
   return [NSSet  
setWithObjects:@"floorPlan.house.yearOfLastMajorRenovation", nil];

}

+ (NSSet *)keyPathsForValuesAffectingStarChart; {
   return [NSSet setWithObjects:@"mountainStar", @"annualStar",  
@"waterStar", @"loShuAgeStar", nil];

}

The strange thing is that if I select all of the objects in the  
NSArrayController first, and then change the value of  
yearOfLastMajorRenovation, all the values in the StarChartMO get  
updated in each FloorPlanMO like I want.  But only after I've  
selected the objects in the array controller first.   From then on  
all is well and each FloorPlanMO in the NSArrayController gets  
updated when the yearOfLastMajorRenovation changes.


Everything updates fine when the arrayController is bound to the  
document's MOC, but not when bound from the sheet's MOC.  I'm going  
back and checking to make sure I have all my dependencies accounted  
for in keyPathsForValuesAffectingKeys:.  Perhaps something isn't  
being accounted for but was hidden because of the inter-dependencies?


Thanks again for taking the time to read this, and I need to provide  
more information just let me know.


Kevin



On Jun 12, 2009, at 12:03 PM, Dave Fernandes wrote:


Kevin,
You'll have to say a bit more about how you adapted the example. Do  
you create a new MOC and create new objects within it with  
attributes copied from the document MOC? Is there a Core Data  
relationship between these two new objects? What do you mean by  
"dependent on others" and "propogated"? Is there some KVO  
dependence, or have you defined  
keyPathsForValuesAffectingValueForKey: or used the deprecated  
setKeys:triggerChangeNotificationsForDependentKey:?


Dave

On Jun 12, 2009, at 12:59 PM, Kevin Ross wrote:

I adapted the examples in the NSPersistentDocument tutorial, and  
this works great.  The problem I'm having is with some of the  
state management because some of the properties are dependent upon  
others.  I'll try to explain how the relationship works.


Let's say we have 2 objects in the sheet's MOC.  When the sheet is  
first opened, the selected object of the arrayController is fully  
fetched and realized, but the second object hasn't fetched the  
values from the MOC yet, so it's values aren't updated with the  
first object when I change some of the parameters.  If I select  
each object first to fetch the properties from the backing-store,  
then when I change a value it is immediately propagated as it  
should.  Do I have to try and access the values programmatically  
so the objects become fully realized before I display the sheet?   
I have the controller set to automatically prepare content, should  
I turn that off and manually perform the fetches?


Thanks for your time,

Kevin



On Jun 11, 2009, at 8:31 PM, Dave Fernandes wrote:


This is explained in the NSPersistentDocument tutorial in the docs.

On Jun 11, 2009, at 10:03 PM, Kevin Ross wrote:

Hi all, have a Core Data document based application which uses  
modal sheets as a way for t

Re: NSRuntime.loadLibrary(/usr/lib/java/libObjCJava.dylib) error

2009-06-14 Thread Tejas Vora
Thanks a lot for the responses.

Just require some clarifiaction.
So you think the problem is due the 64 bit mac ??I am not clear about your
observation on the exception.

Thanks
Tejas

On Sun, Jun 14, 2009 at 4:13 AM, Nick Zitzmann  wrote:

>
> On Jun 13, 2009, at 1:40 PM, Tejas Vora wrote:
>
>  I have a 64 bit MAC which is a requirement.
>>
>> I am copy pasting the console over here :
>>
>> NSRuntime.loadLibrary(/usr/lib/java/libObjCJava.dylib) error.
>> java.lang.UnsatisfiedLinkError: /usr/lib/java/libObjCJava.A.dylib:
>>   at java.lang.ClassLoader$NativeLibrary.load(Native Method)
>>
>
>
> You're going to have to re-think your requirements then:
>
> % lipo -info /usr/lib/java/libObjCJava.A.dylib
> Architectures in the fat file: /usr/lib/java/libObjCJava.A.dylib are: i386
> ppc7400
>
> I don't see an "x86_64" in there.
>
> Nick Zitzmann
> 
>
>
>
>
___

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: NSView directly drawn on screen?

2009-06-14 Thread Peter N Lewis

On 13/06/2009, at 16:51 , Michael Ash wrote:

You can't. If you want to receive keyboard events then you must have
focus. If you don't want to have focus, then you can't receive
keyboard events. Pick one or the other, because you can't have both.


Well, technically you could use an event tap or some similar  
mechanism.  Almost never the right choice, but only almost never.


On 14/06/2009, at 6:29 , Uli Kusterer wrote:
Not true. Spotlight removes keyboard focus from the front app. Try  
it in Mail: Put the cursor in the "Subject" text field so it gets  
the blue focus border. Pull down the Spotlight menu. The focus  
border goes away and Spotlight's search field gets the insertion mark.


Except, try the same thing in the Finder.  Put the cursor in the  
"Spotlight" search field so it gets the blue focus border. Pull down  
the Spotlight menu.  The focus border on the original Spotlight search  
field remains.  You even get two flashing insertion cursors.  That's  
very weird.


As Andy suggests, I suspect what you need is a floating panel window,  
with canBecomeKeyWindow returning YES and canBecomeMainWindow  
returning NO, a window level set to something appropriate (possibly  
NSFloatingWindowLevel or NSStatusWindowLevel).  You may also want  
to look at:


[self setBecomesKeyOnlyIfNeeded:NO];
[self setFloatingPanel:YES];
[self setWorksWhenModal:YES];

and

- (void)makeKeyAndOrderFront:(id)sender
{
[NSApp activateIgnoringOtherApps:YES];
[super makeKeyAndOrderFront:sender];
[NSApp activateIgnoringOtherApps:NO];
}

And heaven help you if you are running a Carbon run loop and have a  
borderless window.


Enjoy,
   Peter.


--
 Clipboard Switching and Macros with Keyboard Maestro

Keyboard Maestro  Macros for your Mac
   



___

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: is setFrame as optimal as setNeedsDisplayInRect?

2009-06-14 Thread David Duncan
The Core Animation instrument (and a few others) require you to target  
the device rather than the simulator.


On Jun 13, 2009, at 2:46 PM, Chunk 1978 wrote:


how can i add core animation to the performance tools list?  it, and
several others, are deactivated.


--
David Duncan
Apple DTS Animation and Printing

___

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: NSRuntime.loadLibrary(/usr/lib/java/libObjCJava.dylib) error

2009-06-14 Thread Kyle Sluder
On Sun, Jun 14, 2009 at 7:17 PM, Tejas Vora wrote:
> So you think the problem is due the 64 bit mac ??I am not clear about your
> observation on the exception.

Yes.  There is no 64-bit version of the Cocoa-Java bridge.  And
there's no guarantee that the 32-bit version will continue to exist at
all in future releases of Mac OS X.

--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: Cocoa equivalent to Quartz's CGImageCreateWithImageInRect(image, imageRect);

2009-06-14 Thread David Duncan

On Jun 12, 2009, at 11:53 AM, Frederick C. Lee wrote:

Is there a Cocoa/iPhone equivalent to Quartz's  
CGImageCreateWithImageInRect(image, imageRect)?



The equivalent is... CGImageCreateWithImageInRect :). Keep in mind  
that 9 times out of 10 what people want to use it for is not what that  
API is really designed for. If you just want to draw part of an image,  
use clipping & translation (either translate the CTM, or move your  
drawing rect).


If you want to pan across an image (and it isn't too big) you can just  
put the whole thing in a UIImageView contained in a UIScrollView. If  
the image is fairly large, then you may want to use a CATiledLayer  
(but you will have to draw it via Quartz instead of via UIImage's draw  
methods).

--
David Duncan
Apple DTS Animation and Printing

___

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: NSRuntime.loadLibrary(/usr/lib/java/libObjCJava.dylib) error

2009-06-14 Thread Greg Guerin

Tejas Vora wrote:

So you think the problem is due the 64 bit mac ??I am not clear  
about your

observation on the exception.



Yes, the problem is due to the 64-bit mac.  More specifically, it is  
due to Java 6 on Leopard only running under the 64-bit x86_64  
architecture.  Java 6 simply doesn't have a 32-bit version on Leopard.


The library being called for, libObjCJava.dylib, is a required  
library for Cocoa-Java.  That library does not contain a 64-bit  
version, only 32-bit versions (one for i386, one for ppc7400).  The  
fact that it tries to load that library tells me you are, in fact,  
using Cocoa-Java, whether you realize this or not.


There is no code for x86_64 in libObjCJava.dylib, so it is impossible  
to use libObjCJava.dylib with Java 6.  When NSRuntime looks for an  
x86_64 in libObjCJava.dylib, it doesn't find one, so it fails.  There  
is no way around this: you can't mix libraries of different  
architectures in the same process, such as trying to use the i386  
version under x86_64 Java 6.


Your options are:
  1. Don't use Java 6; use Java 5, which has a 32-bit version.
  2. Eliminate all dependencies on Cocoa-Java, which will then  
remove the need for libObjCJava.dylib.


I don't know how practical either of these options are.  If neither  
one is practical, then your program can't run on Leopard.


  -- GG

___

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: NSRuntime.loadLibrary(/usr/lib/java/libObjCJava.dylib) error

2009-06-14 Thread Thomas G. Schaffernoth (Tom)
SOunds good.  Look forward to getting time together when you get here 
in August.  Although, we might be on vacation for some of that time. 


How you handling the challenges?

 --
 Thanks. 
Thomas G. Schaffernoth (Tom)






Quoting Tejas Vora :
Thanks a lot for the responses. 

Just require some clarifiaction. 
So you think the problem is due the 64 bit mac ??I am not clear about your
observation on the exception. 


Thanks
Tejas

On Sun, Jun 14, 2009 at 4:13 AM, Nick Zitzmann  wrote:

>
> On Jun 13, 2009, at 1:40 PM, Tejas Vora wrote:
>
>  I have a 64 bit MAC which is a requirement. 
>>

>> I am copy pasting the console over here :
>>
>> NSRuntime.loadLibrary(/usr/lib/java/libObjCJava.dylib) error. 
>> java.lang.UnsatisfiedLinkError: /usr/lib/java/libObjCJava.A.dylib:

>>   at java.lang.ClassLoader$NativeLibrary.load(Native Method)
>>
>
>
> You're going to have to re-think your requirements then:
>
> % lipo -info /usr/lib/java/libObjCJava.A.dylib
> Architectures in the fat file: /usr/lib/java/libObjCJava.A.dylib are: i386
> ppc7400
>
> I don't see an "x86_64" in there. 
>

> Nick Zitzmann
> 
>
>
>
>
___

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/tom%40schaffcc.com

This email sent to t...@schaffcc.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: Detecting text under mouse

2009-06-14 Thread Mr. George Warner
On Sun, 14 Jun 2009 14:57:21 +1000, Jacob Rhoden  
 wrote:

> That is exactly what I am looking for, a "Dictionary" application is
> essentially assisting you with being able to read information on the
> screen. Unfortunately I cannot find any documentation at all on how  
to

> access a programs accessable information! The only information I can
> find are pages and posts saying there is no documentation!
> Does anyone know where I might find information on how to detect the
> accessability information under the mouse cursor?
> (I continue to search the apple documentation in the mean time)

Go to 
Enter "Accessibility".
Click the "Advanced Search" button.

First hit: "Introduction to Accessibility Overview"
	URL: 


Sample code is worth 1K emails: .


Build and run this to see what this app does (basically logs  
accessibility info for objects under the mouse to a pane).


To understand this code start in  in the "awakeFromNib"  
routine; The first thing it does is check to see if Accessibility is  
enabled (using AXAPIEnabled):


If this is false then the user will have to open the "Universal  
Access" system preference panel and check the "Enable access for  
assistive devices" checkbox. (Before you ask, there is no API to turn  
Accessibility on; it's a user option.)


Next it creates a system wide observer (using the  
AXUIElementCreateSystemWide API):


 _systemWideElement = AXUIElementCreateSystemWide();

Now if you jump down to the "updateCurrentUIElement" method you should  
see:


// Ask Accessibility API for UI Element under the mouse
// And update the display if a different UIElement
if (AXUIElementCopyElementAtPosition( _systemWideElement,  
pointAsCGPoint.x, pointAsCGPoint.y, &newElement ) ==  
kAXErrorSuccess) ...


That's basically it; you have the element under the mouse. The  
"stringDescriptionOfUIElement" method is what creates the string  
that's displayed in the floating utility window. More than likely the  
info you're interested in is the AXValue when AXRole is "AXStaticText"  
or "AXTextField" or "AXPopUpButton"; or the AXTitle when the AXRole is  
"AXButton" or "AXWindow", etc.


Run the app and experiment by moving the mouse around and examining  
the info in the "Accessibility Inspector" pane.


--
Enjoy,
George Warner,
Schizophrenic Optimization Scientist
Apple Developer Technical Support (DTS)

___

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: UTI not identified correctly for some users.

2009-06-14 Thread Mitchell Livingston

Hey Sean,

Thanks for that. I am dealing with .torrent extensions. I have the UTI  
defined as "org.bittorrent.torrent". Both apps are using the same file  
format, so there shouldn't be a problem with a single UTI. It would be  
great if Apple included this in the OS, although is there a chance  
considering their stance on torrent files? It is a legitimate file  
format, regardless.


I'm not sure how to use the rdar links - am I missing something  
obvious? I will file a bug on Apple Bug Reporter.


Cheers,
Mitch

On Jun 12, 2009, at 4:42 PM, Sean McBride wrote:


Mitchell,

Welcome to the wonderful world of file extensions! :)

A file has one and only one UTI.  The system (Launch Services aka LS)
decides on a UTI based on the file's extension and HFS type (and MIME
type?).  So if two apps declare different UTIs that refer to the same
extension, LS will pick one of them.  This is happening to you.

What extension are you dealing with?  Is it actually the same file
format that both apps are using?  If so, confer with the other  
developer

and make sure you both have the same UTI declaration.  Then file a bug
asking Apple to include it in the OS.  If it's a different format but
both have conflicting extensions, you are mostly out of luck.  HFS  
types

won't help either because LS always prioritizes extensions, even when
they conflict.

Do file bug(s); dupes increase priority.  You may reference mine:
 .

Cheers,

Sean


On 6/11/09 7:19 PM, Mitchell Livingston said:


As a followup to this, it appears that the users having problems do
have a different app set for this file type, so it's not recognizing
my UTI name for NSOpenPanel's setRequiredType: and NSWorkspace's
typeOfFile:... Is there a way around this besides specifying the file
extension explicitly? Should this be reported to Apple?

Cheers,
Mitch

On Jun 11, 2009, at 6:46 PM, Mitchell Livingston wrote:


I have created an UTI in my app's Info.plist. For open panels,
adding files, etc. I use this (or check [[[NSWorkspace
sharedWorkspace] typeOfFile: file error: NULL]
isEqualToString: ...]). This works fine for me, but this is failing
for the proper file type for some users. Perhaps the system doesn't
properly register the UTI for these users, or perhaps another app
registers a different UTI name for the same file extension. Is there
something I can do to get around this, besides not using UTI's?

Cheers,
Mitch


___

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/sean%40rogue-research.com

This email sent to s...@rogue-research.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


Get Key Commands in Fullscreen

2009-06-14 Thread Pierce Freeman
Hi Everyone:

I am following the steps described here:
http://www.cocoadevcentral.com/articles/28.php to make a fullscreen
application but am running into a problem when I want to get key input.  For
some reason, it seems that when you convert the Panel to take up the screen,
you also loose the ability for it to get the key down events.  I am
attempting to make a button trigger when the user types "s", which works
fine in a regular panel, but doesn't seem to work when this change is
applied.


Thanks for any help.


___

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: Card Game (like Spider-Solitaire) in Cocoa -- Conceptual

2009-06-14 Thread Mr. George Warner
On Sat, 13 Jun 2009 12:20:36 +0200, Florian Witteler > wrote:
> I'd really like to thank you all for your comments. You gave me a  
good

> starting point to move on!
> I'll work through these ressources and get back, if I have further
> questions.

I missed their replies but in case one of them didn't mention it take  
a look at the GeekGameBoard project at: .


> P.S.: I'm not familiar with mailing-lists. Do I simply hit 'reply to
> all' when I want to send an answer to that message or how does the
> mailing list know, that I send an answer to that specific message?
> Perhaps there is a beginner-guide -- I didn't find this information  
is

> the lists' FAQ.

You can reply to all, reply to sender or reply to both. Unless you're  
recieving mail from the list is a digest in which case you have to  
select the body of the message you wish to reply to and copy & paste  
that into a new message; then move the "From:" and "To:" address out  
of the pasted text to the "To:" field of the new message and copy the  
"Subject:" text out of the pasted text into the "Subject:" field of  
the new email. Now delete all of the pasted text except for any parts  
of the body of the text you want to reply to. That text should be  
quoted (by selecting that text and then the "Format" menu's, "Quote  
Level" -> "Increase" item.


Then type your reply and hit "Send".

The only thing that didn't happen as it should here is that the  
Message-ID didn't get copied to the new email. This is important so  
that messages get properly threaded. Because I don't know of a way to  
do this manually (and because all the above cutting and pasting is a  
PITA) I wrote an Apple Script for Mail to do all the above for me. I  
just have to select the text in the digest (starting with the  
"Message: " line) down to the end of the text I want to quote and run  
my script; it does all the above AND properly sets the message ID. If  
anyone is interested reply to me privately and I'll send it to you… or  
if there's enough demand I'll put it somewhere online and post it's  
URL here.


--
Enjoy,
George Warner,
Schizophrenic Optimization Scientist
Apple Developer Technical Support (DTS)

___

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


Adding actions to undo manager

2009-06-14 Thread Ryan Joseph
Simple question, how is it possible to have changes made  
programatically to NSTextStorage be added to the undo manager? I tried  
enclosing the changes in begin/endEditing calls but this did not work.  
Thanks in advance.


Regards,
Josef

___

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: Adding actions to undo manager

2009-06-14 Thread Kyle Sluder
If you want undo manager support, you need to either perform the undo
machinations yourself, or target your modifications at an entity
higher up in the text system chain.  More information (along with an
incomplete and perhaps misguided implementation) can be found on the
CocoaDev wiki: http://www.cocoadev.com/index.pl?UndoSupportForNSTextStorage

--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


Core Data, to-many relationships, and object graph consistency

2009-06-14 Thread Sebastian Celis
Hello,

I am having difficulty understanding how to work with a fairly simple
Core Data model involving to-many relationships and their inverses.
Imagine the following entities, attributes, and relationships:

* Book
- title (NSString* attribute)
- author (NSString* attribute)
- tags
+ to-many relationship to the BookTag entity
+ inverse is the 'book' relationship
+ delete rule is 'Cascade'

* BookTag
- book
+ to-one relationship to the Book entity
+ inverse is the 'tags' relationship
+ delete rule is 'Nullify'
- tag
+ to-one relationship to the Tag entity
+ inverse is the 'bookTags' relationship
+ delete rule is 'Nullify'

* Tag
- name (NSString* attribute)
- bookTags
+ to-many relationship to the BookTag entity
+ inverse is the 'tag' relationship
+ delete rule is 'Cascade'


It is a simple tagging model. I want to be able to create tags and
assign them to books. It makes sense to break BookTag and Tag into two
separate entities so that I can easily query for all books that
contain a certain tag, as well as all of the tags defined in the
system.

First question: do the details of this model make sense for the data?
Some of the inverse relationships (like Tag.bookTags and BookTag.book)
seem unnecessary, but from what I have read, 99% of the time you
really want to model an inverse for every relationship. And are the
delete rules correct? They all make sense to me but I wanted
confirmation on the delete rules for the BookTag relationships. Does
nullify make sense for both of them?

Now that I have described the model, I would like to get to the heart
of this e-mail. I am having difficulty understanding how consistency
in the object graph is maintained for these entities and
relationships. For example, the following code seems strange to me:


SCBook *book = [NSEntityDescription insertNewObjectForEntityForName:@"Book"

inManagedObjectContext:managedObjectContext];
[book setTitle:@"1984"];
[book setAuthor:@"George Orwell"];

SCTag *tag1 = [NSEntityDescription insertNewObjectForEntityForName:@"Tag"

inManagedObjectContext:managedObjectContext];
[tag1 setName:@"scifi"];

SCBookTag *bookTag1 = [NSEntityDescription
insertNewObjectForEntityForName:@"BookTag"

inManagedObjectContext:managedObjectContext];
[bookTag1 setTag:tag1];
[bookTag1 setBook:book];

SCTag *tag2 = [NSEntityDescription insertNewObjectForEntityForName:@"Tag"

inManagedObjectContext:managedObjectContext];
[tag2 setName:@"dystopian"];

SCBookTag *bookTag2 = [NSEntityDescription
insertNewObjectForEntityForName:@"BookTag"

inManagedObjectContext:managedObjectContext];
[bookTag2 setTag:tag2];
[bookTag2 setBook:book];


>From what I understand, Core Data should automatically maintain
consistency in my object graphs, correct? So then why does [[book
tags] count] equal 1 at this point? Shouldn't both of these BookTag
entities exist in the [book tags] set? Even if I re-fetch this
particular book entity, the count of the tags set is still 1. However,
saving this data and then relaunching the app or calling
[managedObjectContext reset] appears to rectify this, allowing me to
see both SCBookTag objects in the [book tags] set.

On the other hand, if I remove the [bookTag1 setBook:book] and
[bookTag2 setBook:book] lines and instead write:

NSMutableSet *theTags = [book mutableSetValueForKey:@"tags"];
[theTags addObject:bookTag1];
[theTags addObject:bookTag2];

Now, [[book tags] count] equals two! What about this situation am I
not understanding correctly? What is the correct way to do this? It
seems as though forcing me to use mutableSetValueForKey is strange,
especially because I would then have to do this for the Tag.bookTags
relationship as well instead of simply calling [bookTag1 setTag:tag1].

In general, these particular entities and relationships are giving me
a lot of grief. For example, I have test code that can add new Tag and
BookTag objects to an existing book and save them to the persistent
store. I also have test code that can successfully delete existing Tag
and BookTag objects. However, when I run both pieces of test code at
the same time (add a new BookTag and delete an existing BookTag) and
try to save , I get an error stating that there is a dangling
reference to an invalid object (a BookTag object). I have a feeling
that my misunderstandings above and the manner in which I am creating
my objects is causing inconsistencies in my object graph which are
then manifesting in this particular situation.

Does anyone have any advice that would clarify things and put me on
the right track?

Thank you,
Sebastian
___

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 co

Re: NSView directly drawn on screen?

2009-06-14 Thread John Ku
Thank you!! I just tried experimenting with those codes and it somewhat
works. The 'Main' window doesn't switch now and I get two insertion point
'Key' in both my app and the current running application. Its like the
Finder & Spotlight experiment you mentioned. But thank you for giving me
alead. At least now I can eliminate some other non-related problems.
I'll post the solution if I ever find it though.

Cheers!

John

On Sun, Jun 14, 2009 at 7:31 PM, Peter N Lewis wrote:

> On 13/06/2009, at 16:51 , Michael Ash wrote:
>
>> You can't. If you want to receive keyboard events then you must have
>> focus. If you don't want to have focus, then you can't receive
>> keyboard events. Pick one or the other, because you can't have both.
>>
>
> Well, technically you could use an event tap or some similar mechanism.
>  Almost never the right choice, but only almost never.
>
> On 14/06/2009, at 6:29 , Uli Kusterer wrote:
>
>> Not true. Spotlight removes keyboard focus from the front app. Try it in
>> Mail: Put the cursor in the "Subject" text field so it gets the blue focus
>> border. Pull down the Spotlight menu. The focus border goes away and
>> Spotlight's search field gets the insertion mark.
>>
>
> Except, try the same thing in the Finder.  Put the cursor in the
> "Spotlight" search field so it gets the blue focus border. Pull down the
> Spotlight menu.  The focus border on the original Spotlight search field
> remains.  You even get two flashing insertion cursors.  That's very weird.
>
> As Andy suggests, I suspect what you need is a floating panel window, with
> canBecomeKeyWindow returning YES and canBecomeMainWindow returning NO, a
> window level set to something appropriate (possibly NSFloatingWindowLevel or
> NSStatusWindowLevel).  You may also want to look at:
>
>[self setBecomesKeyOnlyIfNeeded:NO];
>[self setFloatingPanel:YES];
>[self setWorksWhenModal:YES];
>
> and
>
> - (void)makeKeyAndOrderFront:(id)sender
> {
>[NSApp activateIgnoringOtherApps:YES];
>[super makeKeyAndOrderFront:sender];
>[NSApp activateIgnoringOtherApps:NO];
> }
>
> And heaven help you if you are running a Carbon run loop and have a
> borderless window.
>
> Enjoy,
>   Peter.
>
>
> --
> Clipboard Switching and Macros with Keyboard Maestro
>
> Keyboard Maestro  Macros for your Mac
>    
>
>
>
>
> ___
>
> 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/john.cmyk%40gmail.com
>
> This email sent to john.c...@gmail.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