Re: GC Basic questions

2009-10-20 Thread Quincey Morris
On Oct 19, 2009, at 23:35, Nick Rogers wrote: How do I release everything associated with an ivar (pointer to a class) in AppController? Currently I'm doing it by setting this pointer as nil. Is it ok? Urg, I missed the part where you said "AppController". Since that object is (presumably)

Re: Custom NSURLProtocol crashes when using Garbage Collection

2009-10-20 Thread Keith Duncan
At this point I expect there's a GC bug in the NSURLProtocol machinery, specifically the bridge between NSURLProtocol and CFURLProtocol. We'll look further in 7314551. Thanks for checking for me, I was holding out on hope that there was actually bug in my code so that I could still get it w

how to make cocoa application run as a command line tool?

2009-10-20 Thread XiaoGang Li
Greetings, I have created an document-based cocoa application, now I need to provide a command line interface for my users. for example, users input this into the terminal: ./myApplication.app/Contents/MacOS/myApplication -c --srcFolder "A/B/C" --dstFolder "A/B/D"; I can get the argument in

Re: how to make cocoa application run as a command line tool?

2009-10-20 Thread Kai Brüning
The clean solution for this is to refactor your application into a framework, a Cocoa application and a command line tool. The framework contains all the document logic (the model part of the MVC pattern). Both the Cocoa application and the command line tool use the framework. The tricky

Re: how to make cocoa application run as a command line tool?

2009-10-20 Thread Paul M
On 20/10/2009, at 10:58 PM, XiaoGang Li wrote: Greetings, I have created an document-based cocoa application, now I need to provide a command line interface for my users. for example, users input this into the terminal: ./myApplication.app/Contents/MacOS/myApplication -c --srcFolder "A

Re: Dirty rects getting merged together makes for inefficient drawing

2009-10-20 Thread Uli Kusterer
On 19.10.2009, at 23:58, Ben Haller wrote: On 19-Oct-09, at 5:27 PM, Dave Keck wrote: Would NSView's -getRectsBeingDrawn:count: help? Well, I'm already using it in my own code where appropriate. (Or actually I'm using -needsToDrawRect:). But the problem is that a whole bunch of NSTab

Re: Dirty rects getting merged together makes for inefficient drawing

2009-10-20 Thread Uli Kusterer
On 20.10.2009, at 03:02, Ben Haller wrote: As for NSTableView, it does appear to be doing minimal drawing. So I guess all the string-drawing overhead I see in Sampler is just from the single column that is updating, which is unfortunate since it means I have no room for optimization. I nev

Re: how to make cocoa application run as a command line tool?

2009-10-20 Thread Jeremy Pereira
On 20 Oct 2009, at 11:42, Paul M wrote: On 20/10/2009, at 10:58 PM, XiaoGang Li wrote: Greetings, I have created an document-based cocoa application, now I need to provide a command line interface for my users. for example, users input this into the terminal: ./myApplication.app/Cont

Re: how to make cocoa application run as a command line tool?

2009-10-20 Thread Jeremy Pereira
On 20 Oct 2009, at 12:20, Jeremy Pereira wrote: When I need to do this, I create a switch which puts the app into "command line" mode. static int commandLine(int argc, const char* argv[]); int main(int argc, char *argv[]) { if (argc > 1) { if (strcmp(argv[1], "-com

Re: Dirty rects getting merged together makes for inefficient drawing

2009-10-20 Thread Ben Haller
On 20-Oct-09, at 6:54 AM, Uli Kusterer wrote: On 19.10.2009, at 23:58, Ben Haller wrote: On 19-Oct-09, at 5:27 PM, Dave Keck wrote: Would NSView's -getRectsBeingDrawn:count: help? Well, I'm already using it in my own code where appropriate. (Or actually I'm using -needsToDrawRect:). Bu

Re: Dirty rects getting merged together makes for inefficient drawing

2009-10-20 Thread Graham Cox
On 20/10/2009, at 10:42 PM, Ben Haller wrote: So whether -needsToDrawRect or -getRectsBeingDrawn:count: is a better solution depends mostly upon taste, and a little bit on how many tests you intend to do in your draw method (i.e. efficiency to testing). For my purposes, doing a total of

Re: Dirty rects getting merged together makes for inefficient drawing

2009-10-20 Thread Ben Haller
On 20-Oct-09, at 6:59 AM, Uli Kusterer wrote: On 20.10.2009, at 03:02, Ben Haller wrote: As for NSTableView, it does appear to be doing minimal drawing. So I guess all the string-drawing overhead I see in Sampler is just from the single column that is updating, which is unfortunate since

iPhone: UIDatePicker plus touch events?

2009-10-20 Thread Eric E. Dolecki
I am curious if it's a bad idea to have touch enabled on a view while a UIDatePicker is above in another view. Performance seems to be quite spotty (choppy and slow to respond) in the animations in the UIDatePicker. Is this a known issue? Thanks, Eric ___

Re: Dirty rects getting merged together makes for inefficient drawing

2009-10-20 Thread Graham Cox
On 20/10/2009, at 11:03 PM, Ben Haller wrote: AFAIK even -[NSAttributedString drawWithRect:options:] doesn't let you draw a string centered or right-aligned in the rect, which seems like a big oversight. I've just logged 7318495 on that. That's not the case - NSAttributedString takes its

Re: Dirty rects getting merged together makes for inefficient drawing

2009-10-20 Thread Uli Kusterer
On 20.10.2009, at 13:42, Ben Haller wrote: So whether -needsToDrawRect or -getRectsBeingDrawn:count: is a better solution depends mostly upon taste, and a little bit on how many tests you intend to do in your draw method (i.e. efficiency to testing). For my purposes, doing a total of two te

Re: Dirty rects getting merged together makes for inefficient drawing

2009-10-20 Thread Uli Kusterer
On 20.10.2009, at 14:03, Ben Haller wrote: implying that doing things this way is faster than NSStringDrawing. Is that actually true? Why would that be? NSStringDrawing does more or less exactly this, doesn't it, using cached a cached textstorage/layout/container set? If NSStringDrawing

Re: Dirty rects getting merged together makes for inefficient drawing

2009-10-20 Thread Ben Haller
On 20-Oct-09, at 8:15 AM, Graham Cox wrote: On 20/10/2009, at 11:03 PM, Ben Haller wrote: AFAIK even -[NSAttributedString drawWithRect:options:] doesn't let you draw a string centered or right-aligned in the rect, which seems like a big oversight. I've just logged 7318495 on that. That's

Re: CPU utilization in Snow Leopard

2009-10-20 Thread Joar Wingfors
On 19 okt 2009, at 23.37, Graham Cox wrote: Since there's no autorelease pool inside your do...while loop, of course it isn't going to get autoreleased then. Autorelease isn't magic, someone has to tell it when it can release - that's you. Put your pool inside the loop so it is created and

Re: CPU utilization in Snow Leopard

2009-10-20 Thread Alastair Houghton
On 20 Oct 2009, at 07:41, Graham Cox wrote: If you need to wait for another thread to finish, use a NSConditionLock to do it properly. Either that, or if the run loop is required for some other reason, make a custom run loop source and, add it to the run loop and signal it from the other

I don't understand this leak

2009-10-20 Thread Eric E. Dolecki
Instruments: Malloc 128 Bytes 0x7100780 128 Bytes CoreGraphics open_handle_to_dylib_path Malloc 128 Bytes 0x3d0aa50 128 Bytes CoreGraphics open_handle_to_dylib_path I am not sure what this is... AppDelegate adding subview? Is this a bug in Instruments, or something else? -- http://eri

Child window shows up on top despite specifying NSWindowBelow

2009-10-20 Thread Francisco Tolmasky
The title says it all, I set up a child window as such: [targetWindow addChildWindow:self ordered:NSWindowBelow]; But the child window shows up on top of "targetWindow" until the first click, at which point it immediately reorders itself to the back and behaves correctly from that po

Re: I don't understand this leak

2009-10-20 Thread Karolis Ramanauskas
This may be a false positive. I recently had a similar leak: > Category: Malloc 4.50 KB > Event Type: Malloc > RefCt: 1 > Address: 0x103108000 > Size: 4608 > Responsible Library: ImageIO > Responsible Caller: du_block::set_max_bytes(int, bool) > Ken Ferry on this list explained it was a false pos

Re: Child window shows up on top despite specifying NSWindowBelow

2009-10-20 Thread Jesper Storm Bache
Your analysis (regarding window visibility) sounds plausible as non- visible Cocoa windows have no "z-order". I have logged: "6802899 Please add latent z-order to hidden NSWindows" for this, but in the meantime I am left with having to move "hidden" windows off screen and make then visible (th

Newbie query re checkboxes

2009-10-20 Thread McLaughlin, Michael P.
I have an NSArray (2 x 3) of NSButtonCell in IB. The style is Checkbox. I made the Mode = list so that all might be unchecked. The problem is that my array is behaving like a Radio Group. If I check one any other that is checked turns off. This is not what I want. [No other Mode seems to fix

Re: Newbie query re checkboxes

2009-10-20 Thread Kyle Sluder
On Tue, Oct 20, 2009 at 12:49 PM, McLaughlin, Michael P. wrote: > I have an NSArray (2 x 3) of NSButtonCell in IB.  The style is Checkbox.  I > made the Mode = list so that all might be unchecked. This is incorrect. You want the highlight mode as described in the Matrix Programming Guide for Coc

Odd window drag bug

2009-10-20 Thread Eric Gorr
Here is a simple application which reproduces the problem: http://ericgorr.net/cocoadev/WindowDrag.zip After building the application with Xcode 3.2, press the miniaturize button. This will cause the panel to be window shaded. Now, try to drag the window from the right side of the title

Displaying a view modally

2009-10-20 Thread Mike Manzano
Hi, I'd like to display a busy indicator view (HUD) regardless of whatever view is currently at the top of the view stack. I'd also like this view to display modally so that the user interface beneath it is dead to touch events. This is like Tweetie 2's HUD that appears when you've succes

Re: Child window shows up on top despite specifying NSWindowBelow

2009-10-20 Thread Rob Keniger
On 21/10/2009, at 4:40 AM, Jesper Storm Bache wrote: > Your analysis (regarding window visibility) sounds plausible as non- > visible Cocoa windows have no "z-order". > I have logged: "6802899 Please add latent z-order to hidden NSWindows" > for this, but in the meantime I am left with having

Problems with NSCollectionView

2009-10-20 Thread PCWiz
I'm trying to set up an NSCollectionView (I have done this successfully in the past, but for some reason it fails this time). I have a model class called "TestModel", and it has a NSString property that just returns a string (just for testing purposes right now). I then have an NSMutableA

Questions about Nib Object Retention

2009-10-20 Thread an0
Nib Object Retention Mac OS X - managed memory model Objects in the nib file are initially created with a retain count of 1. As it rebuilds the

Re: Questions about Nib Object Retention

2009-10-20 Thread Graham Cox
On 21/10/2009, at 2:40 PM, an0 wrote: Who owns the unarchived top-level objects' initial positive retain count? Nobody. That's what "no owning object" means. Are they retained for outlet connections? No, because if there is an outlet to them then they are owned. Or are they just not au

Re: Child window shows up on top despite specifying NSWindowBelow

2009-10-20 Thread Francisco Tolmasky
So I've actually narrowed it down to the fact that my windows have a custom level. If the windows have the standard level then NSWIndowBelow works fine. Any known workarounds for this? Thanks, Francisco On Oct 20, 2009, at 11:40 AM, Jesper Storm Bache wrote: Your analysis (regarding windo

Re: Child window shows up on top despite specifying NSWindowBelow

2009-10-20 Thread Rob Keniger
On 21/10/2009, at 2:20 PM, Francisco Tolmasky wrote: > So I've actually narrowed it down to the fact that my windows have a custom > level. If the windows have the standard level then NSWIndowBelow works fine. > Any known workarounds for this? What happens when you call -setWindowLevel: on th

Re: Questions about Nib Object Retention

2009-10-20 Thread Kyle Sluder
On Tue, Oct 20, 2009 at 8:55 PM, Graham Cox wrote: >> Are they retained for outlet connections? > > No, because if there is an outlet to them then they are owned. This is not correct. I have built a sample project and instantiated a custom, do-nothing NSObject subclass in my nib. It experiences

Calling method in brand new view to set a variable?

2009-10-20 Thread Eric E. Dolecki
I am calling up a view from it's nib, and immediately calling a method in that view controller class to set a variable. I can't access the newly set variable in viewDidLoad, so I have a timer of 100ms inside the viewDidLoad that actually uses the variable that is set (it's available by then). Is th

Magic Mouse and NSTouch

2009-10-20 Thread Kyle Sluder
Can anyone confirm that the new Magic Mouse generates NSTouch events, not just gestures? I would like to now before dropping $70 on one. TIA, --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or mod

How to run a panel that customizes a new NSDocument

2009-10-20 Thread Ben Haller
Hi all. I've got an NSDocument-based class that can be based upon a variety of "models". The documents are the same type in any case, but they are configured differently based upon their model. When the user chooses New, or when the app is launched, I want to run a panel for the user t

Re: Questions about Nib Object Retention

2009-10-20 Thread Joar Wingfors
On 20 okt 2009, at 20.40, an0 wrote: Who owns the unarchived top-level objects' initial positive retain count? The "Files Owner" is responsible for the top level objects. It better have outlets to them so that it can manage and dispose of them appropriately. It sounds like you're asking

Re: Calling method in brand new view to set a variable?

2009-10-20 Thread Graham Cox
On 21/10/2009, at 3:39 PM, Eric E. Dolecki wrote: I am calling up a view from it's nib, and immediately calling a method in that view controller class to set a variable. I can't access the newly set variable in viewDidLoad, so I have a timer of 100ms inside the viewDidLoad that actually u

Re: How to run a panel that customizes a new NSDocument

2009-10-20 Thread Graham Cox
On 21/10/2009, at 3:43 PM, Ben Haller wrote: There must be a good, clean way to do this. Anyone? Well, the expected way is to have different types for your documents. You can still map them all to the same class, and discriminate in the - initWithType:error: method to set up the appropr

Re: Questions about Nib Object Retention

2009-10-20 Thread Graham Cox
On 21/10/2009, at 3:50 PM, Joar Wingfors wrote: They're retained regardless of if there are outlets for them or not. Yes, my bad on that one. I've been misinterpreting the docs on what it means by "owner" in this sense for some time, it seems. Luckily, it has no practical consequences f

Re: Child window shows up on top despite specifying NSWindowBelow

2009-10-20 Thread Francisco Tolmasky
I've created a pretty trivial case that makes this happen: NSWindow* ontop = [[NSWindow alloc] initWithContentRect:NSMakeRect(100.0, 100.0, 300.0, 400.0) styleMask:NSTitledWindowMask | NSClosableWindowMask backing:NSBackingStoreBuffered defer:NO]; NSWindow* onback = [[NSWind

Re: Questions about Nib Object Retention

2009-10-20 Thread an0
So, to be a good memory-wise citizen:1. If there is only one outlet to a top-level object from the nib owner, the outlet should have "assign" attribute, and the nib owner is now in fact the "initial 1 retention"(which seems reserved right for this predictable ownership)'s owner so is responsible fo

Re: Questions about Nib Object Retention

2009-10-20 Thread Kyle Sluder
I would tend to use a simpler pattern: make assign outlets on file's owner for each top-level object, and release them in -dealloc. This pattern is based on the tendency for nibs to be "part of" another object. For example, think of NSWindowController or NSViewController. Logically, the object g

Re: Magic Mouse and NSTouch

2009-10-20 Thread Chunk 1978
i would be surprised if it didn't support NSTouch. although you may have to wait for 10.6.2: http://www.macrumors.com/2009/10/20/magic-mouse-user-guide-suggests-mac-os-x-10-6-2-release-in-near-future/ On Wed, Oct 21, 2009 at 12:40 AM, Kyle Sluder wrote: > Can anyone confirm that the new Magic M