Re: First Responder

2012-05-12 Thread Motti Shneor
On 11 במאי 2012, at 03:11, koko wrote: > I have a menu item connected to an action in First Responder; > The action exists in an NSView subclass. > The subclass implements acceptsFirstResonder and return YES. > The subclass implements validateMenuItem and return YES; > When the menu displays the me

Re: mutableBytes Creates Autoreleased Objects

2012-05-12 Thread Ken Thomases
On May 12, 2012, at 2:31 PM, Quincey Morris wrote: > On May 12, 2012, at 10:17 , Ken Thomases wrote: > >> That's not necessarily so. And/or requesting the mutableBytes may do the >> equivalent of retain+autorelease on the NSMutableData. >> >> Consider an inexact analog. The -[NSString UTF8Str

Re: multi-window document best practices?

2012-05-12 Thread mlist0...@gmail.com
On May 12, 2012, at 5:55 PM, Kyle Sluder wrote: > You are correct that nothing in the docs prohibits passing the document as > the file's owner argument for window controllers you construct yourself. And > in the case of a single window controller, it might work—though this is not > guaranteed

Re: multi-window document best practices?

2012-05-12 Thread Kyle Sluder
On May 12, 2012, at 5:42 PM, "mlist0...@gmail.com" wrote: > On May 12, 2012, at 4:45 PM, Kyle Sluder wrote: > >> Document-as-File's-Owner only makes sense if you aren't overriding >> -makeWindowControllers. > > I don't think that's the case. Certainly nothing in the docs suggest it. You are

Re: multi-window document best practices?

2012-05-12 Thread mlist0...@gmail.com
On May 12, 2012, at 4:45 PM, Kyle Sluder wrote: > Document-as-File's-Owner only makes sense if you aren't overriding > -makeWindowControllers. I don't think that's the case. Certainly nothing in the docs suggest it. Went for a drive and reflected on this a bit. I think the fact that there's a

Re: multi-window document best practices?

2012-05-12 Thread Kyle Sluder
On May 12, 2012, at 3:39 PM, "mlist0...@gmail.com" wrote: > I've have come across some surprising behavior when trying to implement a > document with two windows, each loaded from its own nib. > > In my NSDocument subclass, I have > > - (void) makeWindowControllers > { >NSWindowControlle

multi-window document best practices?

2012-05-12 Thread mlist0...@gmail.com
I've have come across some surprising behavior when trying to implement a document with two windows, each loaded from its own nib. In my NSDocument subclass, I have - (void) makeWindowControllers { NSWindowController* wc1 = [[[NSWindowController alloc] initWithWindowNibName:@"MNKDocument"

Re: AwakeFromNib called twice for sheet

2012-05-12 Thread Koen van der Drift
On May 12, 2012, at 3:53 PM, Kyle Sluder wrote: > t would be good for you to understand why this is happening. > > When building a view-based table in IB, the NSTableCellView instances you see > are actually contained within embedded nibs. This makes sense, because nibs > are the standard mech

Re: mutableBytes Creates Autoreleased Objects

2012-05-12 Thread Quincey Morris
On May 12, 2012, at 13:55 , Dave Fernandes wrote: > So when a method is declared __attribute__ ((objc_returns_inner_pointer)), > then LLVM tracks regular pointers like it would NSObject pointers to see when > the owning object can be dealloced? Just want to make sure I understand. … to see when

Re: mutableBytes Creates Autoreleased Objects

2012-05-12 Thread Dave Fernandes
Cool! That would eliminate some of the gymnastics I have been going through to make sure I reference the NSData object some time after I use the internal bytes. On 2012-05-12, at 5:05 PM, Quincey Morris wrote: > On May 12, 2012, at 13:55 , Dave Fernandes wrote: > >> So when a method is declare

Re: mutableBytes Creates Autoreleased Objects

2012-05-12 Thread Dave Fernandes
On 2012-05-12, at 12:37 PM, Quincey Morris wrote: > P.S. I think there's also another, better solution, but it involves adding a > method to NSData/NSMutableData via a category: > > - (void*) interiorBytes __attribute__ ((objc_returns_inner_pointer)) { > return self.bytes; >

Re: mutableBytes Creates Autoreleased Objects

2012-05-12 Thread Quincey Morris
On May 12, 2012, at 12:56 , Jens Alfke wrote: > No; -[NSString UTF8String] returns a char*, not an object. I meant "object" in the more general sense of a block of allocated memory whose lifetime is managed by a memory model. That includes (at least): 1. Obj-C objects. 2. CF…Ref objects. 3. A

Re: Accessibility issues with NSPopover

2012-05-12 Thread Motti Shneor
Thanks Curt, of course I tried that. it is hard to tell when exactly nspopover creates and manipulates its opaque window. The real problem is, this call can only (hopefully) set the first responder of the popover. It can't make the whole popover active. For that you'd need something like make

Re: mutableBytes Creates Autoreleased Objects

2012-05-12 Thread Charles Srstka
On May 12, 2012, at 2:31 PM, Quincey Morris wrote: > On May 12, 2012, at 10:18 , Charles Srstka wrote: > >> Ugh, so you’re saying that ARC isn’t actually as deterministic as we’ve been >> led to believe? > > Indeterminism isn't the problem. Unmarked interior pointers *are*. But if the behavior

Re: mutableBytes Creates Autoreleased Objects

2012-05-12 Thread Jens Alfke
On May 12, 2012, at 12:31 PM, Quincey Morris wrote: > I think the difference is that for UTF8String, there is an API contract that > promises the result will be an object (and it has the lifetime behavior of > any returned object that is returned with +0 retain semantics, as the > documentatio

Re: AwakeFromNib called twice for sheet

2012-05-12 Thread Kyle Sluder
On May 12, 2012, at 6:26 AM, Koen van der Drift wrote: > I solved it by using windowDidLoad instead of awakeFromNib. It would be good for you to understand why this is happening. When building a view-based table in IB, the NSTableCellView instances you see are actually contained within embedd

Re: AwakeFromNib called twice for sheet

2012-05-12 Thread Jens Alfke
On May 12, 2012, at 5:01 AM, Koen van der Drift wrote: > But after the search when the table is displayed, awakeFromNib is called > again for the sheet, and all my data is gone. -awakeFromNib is called for each object in a loaded nib … including the nib 'owner' object. That means it's possible

Re: mutableBytes Creates Autoreleased Objects

2012-05-12 Thread Quincey Morris
On May 12, 2012, at 10:17 , Ken Thomases wrote: > That's not necessarily so. And/or requesting the mutableBytes may do the > equivalent of retain+autorelease on the NSMutableData. > > Consider an inexact analog. The -[NSString UTF8String] method seems to > create an autoreleased NSData (or si

Re: mutableBytes Creates Autoreleased Objects

2012-05-12 Thread Charles Srstka
On May 12, 2012, at 12:17 PM, Ken Thomases wrote: > That's not necessarily so. And/or requesting the mutableBytes may do the > equivalent of retain+autorelease on the NSMutableData. > > Consider an inexact analog. The -[NSString UTF8String] method seems to > create an autoreleased NSData (or

Re: mutableBytes Creates Autoreleased Objects

2012-05-12 Thread Charles Srstka
On May 12, 2012, at 11:37 AM, Quincey Morris wrote: > No, the pointer returned by 'mutableBytes' is an interior pointer. It *isn't* > an object pointer. (Well, as an implementation detail, it may happen to point > to an object's memory, but it often doesn't.) > > As soon as the NSMutableData's

Re: mutableBytes Creates Autoreleased Objects

2012-05-12 Thread Ken Thomases
On May 12, 2012, at 11:37 AM, Quincey Morris wrote: > No, the pointer returned by 'mutableBytes' is an interior pointer. It *isn't* > an object pointer. (Well, as an implementation detail, it may happen to point > to an object's memory, but it often doesn't.) > > As soon as the NSMutableData's

Re: mutableBytes Creates Autoreleased Objects

2012-05-12 Thread Quincey Morris
On May 12, 2012, at 08:27 , Andreas Grosam wrote: > It seems, sending mutableBytes creates autoreleased objects (currently, > tested with ARC only). > Anybody experienced this, too? > > In code as below this may severely impact performance and tie up lots of > memory, which are apparently depen

mutableBytes Creates Autoreleased Objects

2012-05-12 Thread Andreas Grosam
It seems, sending mutableBytes creates autoreleased objects (currently, tested with ARC only). Anybody experienced this, too? In code as below this may severely impact performance and tie up lots of memory, which are apparently dependent on the size of the mutable data: for (int i = 0; i < BigV

Re: Accelerate framework

2012-05-12 Thread Roland King
Grr .. again with the moderation for size .. can you not use rich text or something, it just makes a 6k message into a 50k one and this list has a really small max message size. Sending the mail yet again .. original mail follows with the rich text turned into plain -- I said CGImage

Re: AwakeFromNib called twice for sheet

2012-05-12 Thread Koen van der Drift
I solved it by using windowDidLoad instead of awakeFromNib. - Koen. On May 12, 2012, at 8:01 AM, Koen van der Drift wrote: > Hi, > > My app (OSX) has a sheet to obtain data from a server and display them in an > NSTableView. So far I was using a Cell based table and it worked fine. > Yesterd

Re: Accelerate framework

2012-05-12 Thread Roland King
.. got moderated for size .. so I'll send again .. I think perhaps the formatted code in your mail was on the ragged edge for the list ... Scott feel free to axe the original version of this message if you see it when doing the moderation queue ... original message --` I'm guessing f

Re: Accelerate framework

2012-05-12 Thread Roland King
Never used the framework but my first thought would be to create a CGImageRef which can take directly formatted data (I'm assuming that vImages are just a byte buffer) and then make a UIImage from there. What did you do to get a vImage from your UIImage in the first place? On May 12, 2012, at

Re: Accelerate framework

2012-05-12 Thread Luca Ciciriello
Now my problem is: How can I rebuild an UIImage from the output of the vImageConvolve_ARGB elaboration? I can't find any code sample on this. L. On May 12, 2012, at 11:16 AM, Luca Ciciriello wrote: > Yes You are right. It was a my stupid syntax error. > > L. > > On May 12, 2012, at 10:34 A

AwakeFromNib called twice for sheet

2012-05-12 Thread Koen van der Drift
Hi, My app (OSX) has a sheet to obtain data from a server and display them in an NSTableView. So far I was using a Cell based table and it worked fine. Yesterday I decided to make the table view based, following the instruction by Apple

ARC and static functions, free functions and C++ member functions

2012-05-12 Thread Andreas Grosam
I would like to define a static function which returns a newly created object, for example: static Foo* makeFoo(const char* arg) { return [[Foo alloc] initWithArg:arg]; } Do I need to use __attribute__((ns_returns_retained)), or is the above definition already correct as it is? Furthermor

Re: Accelerate framework

2012-05-12 Thread Luca Ciciriello
Yes You are right. It was a my stupid syntax error. L. On May 12, 2012, at 10:34 AM, Ken Thomases wrote: > On May 12, 2012, at 3:25 AM, Luca Ciciriello wrote: > >> Using the accelerate framework in iOS 5.1 I've imported the header >> Accelerate/Accelerate.h and in my code I'm using the line: >

Re: Accelerate framework

2012-05-12 Thread Ken Thomases
On May 12, 2012, at 3:25 AM, Luca Ciciriello wrote: > Using the accelerate framework in iOS 5.1 I've imported the header > Accelerate/Accelerate.h and in my code I'm using the line: > > uint_8 kernel = {-2, -2, 0, -2, 6, 0, 0, 0, 0}; > > My problem is that I've got the error: > > "Use of undec

Re: Accelerate framework

2012-05-12 Thread Roland King
uint_8? Do you mean uint8_t? On May 12, 2012, at 4:25 PM, Luca Ciciriello wrote: > Hi All. A simple question. > Using the accelerate framework in iOS 5.1 I've imported the header > Accelerate/Accelerate.h and in my code I'm using the line: > > uint_8 kernel = {-2, -2, 0, -2, 6, 0, 0, 0, 0};

Accelerate framework

2012-05-12 Thread Luca Ciciriello
Hi All. A simple question. Using the accelerate framework in iOS 5.1 I've imported the header Accelerate/Accelerate.h and in my code I'm using the line: uint_8 kernel = {-2, -2, 0, -2, 6, 0, 0, 0, 0}; My problem is that I've got the error: "Use of undeclared identifier uint_8". Which is the he