[Q] inconsistent naming for Core Graphics and Foundation?

2009-03-15 Thread JongAm Park
Hello, all I'm just curious about the naming convention for Core Graphics and Foundation. For example, NSMakeRect and CGRectMake are similar but different about where the Rect is in its method name. What is even worse is NSPointInRect and CGRectContainsPoint. So, if a person is used to the

Re: [Q] inconsistent naming for Core Graphics and Foundation?

2009-03-15 Thread Andy Lee
I noticed the differences too, and my guess was that it makes it easier to find functions related to CGRects, by searching the API for terms that contain CGRect. I actually prefer it this way. --Andy On Mar 15, 2009, at 2:43 AM, JongAm Park wrote: Hello, all I'm just curious about the

definitive guide for model implementation, top level connections?

2009-03-15 Thread Darren Minifie
Hi Everyone I was hoping that somebody could point me in the direction of a source that best explains how to implement the model in the MVC pattern, and how to make top level connections between the model and and controllers. Many of my programs wind up in the scenario where a root controller

Re: [Q] inconsistent naming for Core Graphics and Foundation?

2009-03-15 Thread JongAm Park
Yeah.. I agree with you in the point of view. But if we take a look at it from different angle, NSMakeRect is better, because it is more understandable due to its resemblance to spoken English. NSPointInRect vs. CGRectContainsPoint is more subtle. Is it Rect- related method or Point-related

Re: Messages between Threads

2009-03-15 Thread Paul Sanders
Rather than doing it every 1000 iterations, make it be time-based. Yes, I agree with you there. That's what I myself usually do in fact. I'm not sure what you're referring to when you talk about other techniques, but in general it is forbidden to access the GUI of a Cocoa app from secondary

Re: [Q] inconsistent naming for Core Graphics and Foundation?

2009-03-15 Thread Ken Thomases
On Mar 15, 2009, at 2:39 AM, JongAm Park wrote: On Mar 15, 2009, at 12:04 AM, Andy Lee wrote: On Mar 15, 2009, at 2:43 AM, JongAm Park wrote: I'm just curious about the naming convention for Core Graphics and Foundation. For example, NSMakeRect and CGRectMake are similar but different

Re: Messages between Threads

2009-03-15 Thread Joar Wingfors
On 15 mar 2009, at 01.14, Paul Sanders wrote: I was referring to where the OP said: but would it be safe, given the fact that sum and count are bound to some textFields / progressIndicator And presumably it would not be as the instance variables referred to were being mutated in a

Re: Custom NSManagedObject Class Initializer

2009-03-15 Thread Benjamin Dobson
On 15 Mar 2009, at 04:03:19, Kyle Sluder wrote: if(self = [super initWithEntity:desc insertIntoManagedObjectContext:ctx]) { This line will generate warnings, which is not helpful in this case. This will not, and is the default for built-in subclasses. As such, I prefer it: self =

Representation of the entire window

2009-03-15 Thread Luca Pazzerello
Hi all, How can I catch a screenshot of my entire window - that is to say, the content view, its subviews and the window's theme itself? Is there any way to accomplish this? Currently I'm able to catch the contents of the content view and all its subviews locking focus on them and calling the

NSTimer: Debug vs. Release build

2009-03-15 Thread Stefan Wolfrum
Hello nice people, I wrote a little OS X application that uses a NSTimer. I initialize it like this: repeatingTimer = [NSTimer scheduledTimerWithTimeInterval:4.0 target:self selector:@selector(timerFireMethod) userInfo:nil

Re: NSTimer: Debug vs. Release build

2009-03-15 Thread Paul Sanders
Missing colon after timerFireMethod (within the @selector statement). It catches me out too. Not sure why it works for you in debug builds. I have not observed that behaviour. Rgds - Paul Sanders. - Original Message - From: Stefan Wolfrum To: Cocoa-dev@lists.apple.com Sent: Sunday,

Re: Representation of the entire window

2009-03-15 Thread Keith Duncan
How can I catch a screenshot of my entire window Take a look at the API in CGWindow.h and more specifically CGWindowListCreateImage Keith ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator

Re: How to flash two rectangles in a frame?

2009-03-15 Thread Graham Cox
On 14/03/2009, at 7:42 PM, Philip Kime wrote: I am trying to work out how to flash two rects in a frame. I have it working with one rect using the view cacheImageInRect method but this only works on one rect. I tried putting two such calls in serial but the second one doesn't work for some

Re: Representation of the entire window

2009-03-15 Thread Luca Pazzerello
Keith, thanks very much. This works perfectly. --Luca C. 2009/3/15 Keith Duncan keith_...@mac.com How can I catch a screenshot of my entire window Take a look at the API in CGWindow.h and more specifically CGWindowListCreateImage Keith ___

Re: [Q] inconsistent naming for Core Graphics and Foundation?

2009-03-15 Thread Graham Cox
On 15/03/2009, at 7:21 PM, Ken Thomases wrote: You have to accept things as they are and cope with the fact that there isn't just one rule. And if it bothers you, you could always wrap it in a macro of your own choice. --Graham ___

Re: How to flash two rectangles in a frame?

2009-03-15 Thread Jean-Daniel Dupas
Le 15 mars 09 à 13:00, Graham Cox a écrit : On 14/03/2009, at 7:42 PM, Philip Kime wrote: I am trying to work out how to flash two rects in a frame. I have it working with one rect using the view cacheImageInRect method but this only works on one rect. I tried putting two such calls in

Re: Messages between Threads

2009-03-15 Thread Shawn Erickson
On Sun, Mar 15, 2009 at 1:40 AM, Paul Sanders p.sand...@dsl.pipex.com wrote: I am used to a more robust threading model. I'm curious, what is not robust about the Cocoa threading model, and what are you comparing it to? Well, only being able to draw and process events on the main thread

GUI Calls in Tool Executable seem to be No-Op. Nice, but safe?

2009-03-15 Thread Jerry Krinock
My Cocoa app has an auxiliary executable, a tool which is invoked by launchd agents to do little jobs occasionally. It runs for a few seconds and then quits. The user can command the app to do these same jobs, manually. Now, I understand that a conventional design approach would be to

Re: How to create an NSDecimal?

2009-03-15 Thread Keary Suska
On Mar 14, 2009, at 6:32 PM, Michael Ash wrote: On Sat, Mar 14, 2009 at 6:55 PM, Keary Suska cocoa-...@esoteritech.com wrote: On Mar 14, 2009, at 2:35 PM, Ashley Clark wrote: I don't see NSDecimalFromString() in any of the docs or header files, only NSDecimalString() to create strings.

Re: iPhone UIWebView height?

2009-03-15 Thread glenn andreas
On Sunday, March 15, 2009, at 12:30AM, Jesse Armand mnemonic...@gmail.com wrote: This is also what I'm looking for. I want to create a UIWebView with a frame size that will adjust itself according to the contents of the HTML string, or even more simpler an image. Anybody have any experiences

Re: GUI Calls in Tool Executable seem to be No-Op. Nice, but safe?

2009-03-15 Thread Michael Ash
On Sun, Mar 15, 2009 at 10:36 AM, Jerry Krinock je...@ieee.org wrote: Now, I understand that this design may not look good from the high level -- for example, what if the user really needed to see that alert.  But has anyone ever gotten into trouble by assuming that gui calls just won't work

Re: GUI Calls in Tool Executable seem to be No-Op. Nice, but safe?

2009-03-15 Thread Jean-Daniel Dupas
Le 15 mars 09 à 16:49, Michael Ash a écrit : On Sun, Mar 15, 2009 at 10:36 AM, Jerry Krinock je...@ieee.org wrote: Now, I understand that this design may not look good from the high level -- for example, what if the user really needed to see that alert. But has anyone ever gotten into

Changing a custom field editor's position

2009-03-15 Thread Ulai Beekam
Hi, Let's say I want to have the field editor for a table view appear 2 pixel below where it usually is, i.e. shifted 2 pixels down. How can I do this? Consider the following hypothetical situation: If I subclass NSTextView and override the drawRect method like this, -

Re: EXC_BAD_ACCESS on NSImageView::setImage

2009-03-15 Thread Dev
I just change my NSWindow from NSBackingStoreBuffered to a NonRetain one and my application do not crash anymore. Unfortunatly, as expected, my window is clipping how ever i just realize that the crash might have a relation with the NSWindow double buffer mechanism. So my solution to the

Re: EXC_BAD_ACCESS on NSImageView::setImage

2009-03-15 Thread Dev
For people that might have the same issue : =NEW CODE= NSImage *NewDisplayImage = [ExternalView image]; if (NewDisplayImage == nil) { NSBitmapImageRep *rawPic = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL

Re: [Q] inconsistent naming for Core Graphics and Foundation?

2009-03-15 Thread JongAm Park
Thank you for your reply. So, I understood that the naming convention was changing. And.. yes.. I know I should accept what Apple makes, but I just was just curious. Thank you. On Mar 15, 2009, at 1:21 AM, Ken Thomases wrote: On Mar 15, 2009, at 2:39 AM, JongAm Park wrote: On Mar 15,

Re: How to create an NSDecimal?

2009-03-15 Thread Luca Pazzerello
Probably Apple has removed that function with tiger...I remember having used it some years ago. --Luca C. 2009/3/15 Keary Suska cocoa-...@esoteritech.com Hmm, I can't find it either. Anyway, this was a function in NSDecimal.h that was part of NextStep that is still part of GnuStep, but must

Re: How to create an NSDecimal?

2009-03-15 Thread Jean-Daniel Dupas
Probably superseded by NSNumberFormatter in generatesDecimalNumbers mode. Le 15 mars 09 à 19:12, Luca Pazzerello a écrit : Probably Apple has removed that function with tiger...I remember having used it some years ago. --Luca C. 2009/3/15 Keary Suska cocoa-...@esoteritech.com Hmm, I

Re: How to create an NSDecimal?

2009-03-15 Thread Clark Cox
If it was ever there, it was removed long before Tiger. I just checked Cheetah (a.k.a. 10.0), and it was not there either. On Sun, Mar 15, 2009 at 11:12 AM, Luca Pazzerello luca.pazzere...@gmail.com wrote: Probably Apple has removed that function with tiger...I remember having used it some

Fast dictionary with integer keys?

2009-03-15 Thread Oleg Krupnov
I need to use a dictionary inside a long, time-consuming operation. The keys of the dictionary are integers, the values are NSObjects. I could use NSDictionary, but I don't like the overhead of creating NSNumbers for the keys and then comparing them, where I could use integers directly more

Re: Fast dictionary with integer keys?

2009-03-15 Thread Jean-Daniel Dupas
Le 15 mars 09 à 19:33, Oleg Krupnov a écrit : I need to use a dictionary inside a long, time-consuming operation. The keys of the dictionary are integers, the values are NSObjects. I could use NSDictionary, but I don't like the overhead of creating NSNumbers for the keys and then comparing

Re: Fast dictionary with integer keys?

2009-03-15 Thread Tommy Nordgren
On Mar 15, 2009, at 7:33 PM, Oleg Krupnov wrote: I need to use a dictionary inside a long, time-consuming operation. The keys of the dictionary are integers, the values are NSObjects. I could use NSDictionary, but I don't like the overhead of creating NSNumbers for the keys and then comparing

Re: Fast dictionary with integer keys?

2009-03-15 Thread Jay Reynolds Freeman
The question is: is there this kind of fast int-keyed dictionary in Cocoa or elsewhere? Thanks! There is a common trick that many of us know, forgive me if you already do and it does not apply to your case for some reason not evident from your posting. If the number of objects in the

Re: How to flash two rectangles in a frame?

2009-03-15 Thread Philip Kime
On 15 Mar 2009, at 5:29 AM, Jean-Daniel Dupas wrote: Note that if you want to get a revert effect, you can obtains it drawing white rect with the Quart Difference Blend Mode. http://developer.apple.com/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_images/dq_images.html

Re: How to flash two rectangles in a frame?

2009-03-15 Thread Kyle Sluder
On Sun, Mar 15, 2009 at 4:53 PM, Philip Kime phi...@kime.org.uk wrote: With a minor change, this worked perfectly - many thanks to both people who responded. I am simply unaware of a lot of the API here so hadn't looked at these functions. It's worth noting that you're going about this problem

Re: Performance problem with GC enabled

2009-03-15 Thread Marcel Weiher
On Mar 14, 2009, at 3:29 , Paul Sanders wrote: How about perl instead? (I don't think egrep is a fair test, it doesn't have to 'do anything' with the results, like create a new string from them). This is a rough perl equivalent of my original problem: I guess that's the point I was trying to

Re: [Q] inconsistent naming for Core Graphics and Foundation?

2009-03-15 Thread Scott Anguish
On 15-Mar-09, at 4:21 AM, Ken Thomases wrote: I think the division isn't Core Graphics vs. Foundation (or, more generally, one framework vs. another). I think it's between legacy and new APIs. It seems fairly clear to me that Apple has adopted a convention that new APIs should be

Re: Fast dictionary with integer keys?

2009-03-15 Thread Joseph Kelly
On Mar 15, 2009, at 12:18 PM, Tommy Nordgren wrote: You can write your implementation file in Objective C++ , and use std::mapint,id That was my first case, but I just wanted to make sure: I've run some tests, and std::map outperforms NSMutableDictionary as described, until around n

Re: Fast dictionary with integer keys?

2009-03-15 Thread Peter N Lewis
At 20:33 +0200 15/3/09, Oleg Krupnov wrote: I need to use a dictionary inside a long, time-consuming operation. The keys of the dictionary are integers, the values are NSObjects. I could use NSDictionary, but I don't like the overhead of creating NSNumbers for the keys and then comparing them,

Re: Fast dictionary with integer keys?

2009-03-15 Thread Tommy Nordgren
On Mar 16, 2009, at 1:35 AM, Joseph Kelly wrote: On Mar 15, 2009, at 12:18 PM, Tommy Nordgren wrote: You can write your implementation file in Objective C++ , and use std::mapint,id You can also use std::hashmapint,id . It uses a hash table instead of a balanced binary tree. This

Problem with emulated right click and contextual menu

2009-03-15 Thread Pierre-Henri Jondot
Hi, A user of a framework of mine (a simple graphing framework named PHGraph, to be found at http://www.mpkju.fr/~graphview ) reported a problem with some mouse actions : The view is a custom view, configured so that : - a left click zoom in, alt+right click zoom out - right click (and the

Re: NSTimer: Debug vs. Release build

2009-03-15 Thread Dave Keck
Missing colon after timerFireMethod (within the @selector statement).  It catches me out too.  Not sure why it works for you in debug builds.  I have not observed that behaviour. The method that the timer calls isn't required to take an argument to work. Not sure what the best practices/docs

Re: Performance problem with GC enabled

2009-03-15 Thread Greg Guerin
John Engelhart wrote: Again, thanks for the suggestion. It's pretty clever and elegant, even if it does make swiss cheese of the code with #ifdef statements. Would a #define'd macro (or macros) make it less cheesy? Bracket the macro definitions with #ifdef's, as necessary. -- GG

KVO notification not properly propagated isuse

2009-03-15 Thread Marc Van Olmen
hi, Tracing an issue where a KVO notification wasn't propagated to all objects. I added observation to an array controller [mArrayController addObserver: self forKeyPath:@arrangedObjects.photoTransformationSettings.filmType options:0

Floating NSPanel and runModalForWindow: problems

2009-03-15 Thread Ben Einstein
I have a floating NSPanel that sits on-top of all the other windows in the app like it should, but once runModalForWindow: is called with the floating panel as the argument, the panel no longer stays on top of normal-level windows. This just started happening after upgrading to 10.5.6. Has

Creating a text service

2009-03-15 Thread Jonathan Haddad
I'm interested in creating a text service that would be available to all cocoa applications. Any advice / direction? Thanks in advance. Jon ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator

Help With Threading

2009-03-15 Thread Kenneth Ramey
Hello; I have an application I wrote to read from a very simple GPS device that attaches as a serial device through a USB port. I had some success with it but it was running too slowly, since GPS fixes are normally updated once per second. Attempting to speed the application up, I

Re: Creating a text service

2009-03-15 Thread Andy Lee
On Mar 15, 2009, at 9:10 PM, Jonathan Haddad wrote: I'm interested in creating a text service that would be available to all cocoa applications. Any advice / direction? Thanks in advance. I've never done it myself, but I would start with this:

Re: Fast dictionary with integer keys?

2009-03-15 Thread Clark Cox
On Sun, Mar 15, 2009 at 6:45 PM, Tommy Nordgren tommy.nordg...@comhem.se wrote: On Mar 16, 2009, at 1:35 AM, Joseph Kelly wrote: On Mar 15, 2009, at 12:18 PM, Tommy Nordgren wrote:        You can write your implementation file in Objective C++ , and use std::mapint,id        You can

Bindings and nested checkboxes and enabled

2009-03-15 Thread Adam Gerson
I have two checkboxes in a preferences window which are bound to user defaults. The second checkbox should only be enabled if the first checkbox its true. I have this working great with bindings. The second checkboxe's enabled binding is bound to the value of the first one. However, if the first

Re: Fast dictionary with integer keys?

2009-03-15 Thread Chris Suter
Hi Clark, If your keys are integers, then you've got the best hash function possible: the identity function :) I know what you mean, but that's not strictly speaking true. If your integers were congruent modulo your hash table size, it wouldn't be a very good hash function. Regards, Chris

Bindings and radio buttons and enabled

2009-03-15 Thread Adam Gerson
I have a radiobutton set. If the second radio button (index = 1) is checked I would like a checkbox to become enabled. Is there any way with bindings to conditionally say If radiobuttonset.index = 1 then enable yourself, If radiobuttonset.index=0 (or anything else) unenable and uncheck yourself?

Re: Messages between Threads

2009-03-15 Thread Michael Ash
On Sun, Mar 15, 2009 at 10:34 AM, Shawn Erickson shaw...@gmail.com wrote: On Sun, Mar 15, 2009 at 1:40 AM, Paul Sanders p.sand...@dsl.pipex.com wrote: I am used to a more robust threading model. I'm curious, what is not robust about the Cocoa threading model, and what are you comparing it to?

Re: Bindings and nested checkboxes and enabled

2009-03-15 Thread Andrew Merenbach
On Mar 15, 2009, at 8:41 PM, Adam Gerson wrote: I have two checkboxes in a preferences window which are bound to user defaults. The second checkbox should only be enabled if the first checkbox its true. I have this working great with bindings. The second checkboxe's enabled binding is bound to

Re: KVO notification not properly propagated isuse

2009-03-15 Thread Quincey Morris
On Mar 15, 2009, at 14:02, Marc Van Olmen wrote: And then the above KVO worked. So I'm curious now why I need to add [super observeValueForKeyPath: theKeyPath ofObject:theObject change:t Because the documentation doesn't say anything about that. Is there a documented reason when you have

Re: Creating a text service

2009-03-15 Thread Sandy McGuffog
Getting a simple text service that doesn't pop any kind of a dialog is pretty easy. However, if you need to show any dialogs, it gets a lot more complicated. If you need a (complex) example, this is a password manager that provides text services as part of what it does:

Re: Bindings and nested checkboxes and enabled

2009-03-15 Thread Kyle Sluder
The logical answer is for some object in your application (probably your application delegate) to observe the first property using KVO and update the second property accordingly. After all, don't you want to update the second default anyway when the first changes? You also should be binding your

Re: Messages between Threads

2009-03-15 Thread Gerriet M. Denkmann
On 15 Mar 2009, at 15:43, Joar Wingfors j...@joar.com wrote: On 15 mar 2009, at 01.14, Paul Sanders wrote: I was referring to where the OP said: but would it be safe, given the fact that sum and count are bound to some textFields / progressIndicator And presumably it would not be as the