Re: Problem parsing file in 64 bit build.

2012-05-07 Thread Quincey Morris
On May 6, 2012, at 22:51 , Graham Cox wrote: Could this be caused by the 64 bit compiler padding out my structures in a different way for 64-bit builds? Yes, I believe in 64-bit builds 8-byte data types are 8-byte aligned, while they're only 4-bit aligned in 32-bit builds -- or something

Re: Problem parsing file in 64 bit build.

2012-05-07 Thread Quincey Morris
On May 6, 2012, at 23:30 , Quincey Morris wrote: while they're only 4-bit aligned Er … 4-byte aligned. Also, be careful when debugging these with lldb. At some versions of lldb get the member offsets and struct size wrong in packed structs, so debugger member display is wrong, and so is

Re: Window snapping to main screen

2012-05-07 Thread Eric Matecki
Hello, nobody has an idea ? On 03/05/12 10:27, Eric Matecki wrote: Hi everybody, I have two screens on my MacPro (10.7.3) When opening a window with the following code : // create a reference rect NSRect contentSize = NSMakeRect( iX, iY, iW, iH ); // allocate window NSUInteger styleMask =

Re: Problem parsing file in 64 bit build.

2012-05-07 Thread Graham Cox
Thanks Quincey, it set me on the right track, I used #pragma pack(4) for these structures (with relevant push and pops so it's isolated to this case only) and it all started working fine. Is using the syntax you suggested considered better form than #pragma,? --Graham On 07/05/2012, at

Re: Problem parsing file in 64 bit build.

2012-05-07 Thread Quincey Morris
On May 7, 2012, at 00:22 , Graham Cox wrote: Is using the syntax you suggested considered better form than #pragma,? I have a vague recollection that #pragma pack was already deprecated in GCC, so __attribute__ ((packed)) might be the more compatible choice, but finding trustworthy,

Re: Window snapping to main screen

2012-05-07 Thread Quincey Morris
On May 7, 2012, at 00:14 , Eric Matecki wrote: mWindow = [[NSWindow alloc] initWithContentRect: contentSize styleMask: styleMask backing: NSBackingStoreBuffered defer: YES]; I would assume that the content rect is here assumed to be relative to the main screen. Have you tried

Re: Window snapping to main screen

2012-05-07 Thread Quincey Morris
On May 7, 2012, at 00:30 , Quincey Morris wrote: On May 7, 2012, at 00:14 , Eric Matecki wrote: mWindow = [[NSWindow alloc] initWithContentRect: contentSize styleMask: styleMask backing: NSBackingStoreBuffered defer: YES]; I would assume that the content rect is here assumed to be

Re: Minimal document-based app

2012-05-07 Thread ecir hana
Thank you all very much, it is much clearer to me now. I'm diving into documentation now... ___ 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

Re: Window snapping to main screen

2012-05-07 Thread Eric Matecki
On 07/05/12 09:39, Quincey Morris wrote: On May 7, 2012, at 00:30 , Quincey Morris wrote: On May 7, 2012, at 00:14 , Eric Matecki wrote: mWindow = [[NSWindow alloc] initWithContentRect: contentSize styleMask: styleMask backing: NSBackingStoreBuffered defer: YES]; I would assume that the

Re: Problem parsing file in 64 bit build.

2012-05-07 Thread Charles Srstka
On May 7, 2012, at 2:28 AM, Quincey Morris wrote: On May 7, 2012, at 00:22 , Graham Cox wrote: Is using the syntax you suggested considered better form than #pragma,? I have a vague recollection that #pragma pack was already deprecated in GCC, so __attribute__ ((packed)) might be the

iOS + and X buttons

2012-05-07 Thread Alex Zavatone
I just added a blue + button to my iOS button graphics. It's almost 100% accurate and should be good enough if anyone wants to reuse it. The edges of the + inside the blue are not as sharp as Apple's, and the + itself is almost pixel perfect, but I'm being a perfectionist here and can fix

Re: Problem parsing file in 64 bit build.

2012-05-07 Thread Stephen J. Butler
On Mon, May 7, 2012 at 8:06 AM, Charles Srstka cocoa...@charlessoft.com wrote: Myself, I like to just spin off a method or function that takes a chunk of data and populates the fields of the struct one by one, instead of writing the data straight onto the struct. A little more code, but you

Re: My app thinks it is a phone. Why?

2012-05-07 Thread David Duncan
On May 5, 2012, at 10:15 PM, Gerriet M. Denkmann wrote: My app (iOS 5.1) has a xib called MainWindow.xib which does NOT contain a window, just two objects, one of this is an UIApplicationDelegate. This UIApplicationDelegate has: - (void)applicationDidFinishLaunching:(UIApplication

Re: NSView + NSScrollView, not scrolling

2012-05-07 Thread qvacua
No, it does not help. I think since I am not scaling the view or sth. like that, the difference between frame and bounds should be irrelevant for this problem. Tae On Sat, May 5, 2012 at 6:12 PM, Andy Lee ag...@mac.com wrote: On May 5, 2012, at 3:31 AM, qvacua wrote: -

Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare

2012-05-07 Thread Martin Wierschin
If I'm right, then sort order and search order are different, and you can't expect to use a binary search here. (Not unless you originally used pair-wise 'localizedCaseInsensitiveCompare' to manually sort the list of strings.) All comparisons, including those used for the original

Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare

2012-05-07 Thread Martin Wierschin
So even if we get the right compare options, 'localizedCaseInsensitiveCompare:' may not be viable for strings *not* in the language of the current locale. That seems extremely unlikely and would be short-sighted of Apple, considering multilingual users and international information

Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare

2012-05-07 Thread Quincey Morris
On May 7, 2012, at 13:35 , Martin Wierschin wrote: As Jens mentioned, that doesn't make any sense. What good is a localized comparison method if not for sorting a list for display? I suppose you could be implying that Cocoa's sorting methods aren't optimized to assume comparisons are

Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare

2012-05-07 Thread Martin Wierschin
As Jens mentioned, that doesn't make any sense. What good is a localized comparison method if not for sorting a list for display? I suppose you could be implying that Cocoa's sorting methods aren't optimized to assume comparisons are transitive (or special cases problematic

Implementing undo in custom model object for lots of properties

2012-05-07 Thread Ben Kennedy
Hi all, I have a custom data model object with a number of properties of various basic types. An array of these is managed by an NSArrayController and bound to an NSTableView (as the reader might recall from my earlier thread). I am not using Core Data. I am now wiring in undo support.

Re: Problem parsing file in 64 bit build.

2012-05-07 Thread Graham Cox
Understood, but in this case I'm not writing anything. I'm reading a file into a NSData, and using these structs to put a frame onto the data in places so I can extract data from the fields. The alternative would be to pull out each data field one by one, which I'm sure is also considered

Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare

2012-05-07 Thread Quincey Morris
On May 7, 2012, at 16:07 , Martin Wierschin wrote: I'm sliding over the details of what you said because they're irrelevant for my purposes. OK, but I'd *really* appreciate it if you'd avoid calling my replies senseless: On May 7, 2012, at 13:35 , Martin Wierschin wrote: As Jens

Re: Implementing undo in custom model object for lots of properties

2012-05-07 Thread Graham Cox
Hi Ben, I think this undo approach should work fine. Another way to 'centralise' undo is to have an object listen for the KVO notifications of changes for properties it's interested in, and use the observation method to record to the undo manager. You'd still use setValue:forKey: at undo

Re: Problem parsing file in 64 bit build.

2012-05-07 Thread Jens Alfke
On May 7, 2012, at 4:35 PM, Graham Cox wrote: The alternative would be to pull out each data field one by one, which I'm sure is also considered acceptable practice, but for this file type, using structs has proved to be a lot easier, not least because of a) the strange mix of big-endian

Re: inconsistent behavior of NSString's localizedCaseInsensitiveCompare

2012-05-07 Thread Martin Wierschin
I'm sliding over the details of what you said because they're irrelevant for my purposes. OK, but I'd *really* appreciate it if you'd avoid calling my replies senseless: I never said your replies are senseless. The sequence was: On 2012.05.05, at 4:51 PM, Kyle Sluder wrote: If I

Re: My app thinks it is a phone. Why?

2012-05-07 Thread Gerriet M. Denkmann
On 8 May 2012, at 01:08, David Duncan wrote: On May 5, 2012, at 10:15 PM, Gerriet M. Denkmann wrote: My app (iOS 5.1) has a xib called MainWindow.xib which does NOT contain a window, just two objects, one of this is an UIApplicationDelegate. This UIApplicationDelegate has: -

monitoring changes in a local property

2012-05-07 Thread Koen van der Drift
One of my viewcontrollers uses the representedObject to bind to the NSArrayController that holds all the data for the application (OS X, ARC on). I declared a local property mySelection (an NSArray) and bind it to the representedObject as follows: [self bind:@mySelection

Re: Implementing undo in custom model object for lots of properties

2012-05-07 Thread Ben Kennedy
On 07 May 2012, at 4:45 pm, Graham Cox wrote: Another way to 'centralise' undo is to have an object listen for the KVO notifications of changes for properties it's interested in, and use the observation method to record to the undo manager. You'd still use setValue:forKey: at undo time, so

Re: monitoring changes in a local property

2012-05-07 Thread Roland King
It's ok, you can do it if you like, monitor your own properties, however if all you really want to do here is, in your own class, do something more when mySelection is changed, you can write your own setter and put it in there yourself directly. -(void)setMySelection:(NSArray*)mySelection {

Re: monitoring changes in a local property

2012-05-07 Thread Koen van der Drift
On May 7, 2012, at 11:28 PM, Roland King wrote: -(void)setMySelection:(NSArray*)newSelection { // set whatever instance variable you have for mySelection, with appropriate memory management if necessary I thought about that too, but how do I do that when using ARC? Can I

Re: monitoring changes in a local property

2012-05-07 Thread Roland King
mySelection = [ newSelection copy ]; is all you need. On May 8, 2012, at 11:38 AM, Koen van der Drift wrote: On May 7, 2012, at 11:28 PM, Roland King wrote: -(void)setMySelection:(NSArray*)newSelection { // set whatever instance variable you have for mySelection, with

Re: monitoring changes in a local property

2012-05-07 Thread Eeyore
Roland's right about ARC, you just need the set and copy. Just for the record, I don't think the pattern you present is safe when newSelection equals mySelection (as you release before you copy), you need something like one of the following: if (mySelection != newSelection) {

Re: monitoring changes in a local property

2012-05-07 Thread Quincey Morris
On May 7, 2012, at 20:16 , Koen van der Drift wrote: One of my viewcontrollers uses the representedObject to bind to the NSArrayController that holds all the data for the application (OS X, ARC on). I declared a local property mySelection (an NSArray) and bind it to the representedObject

Re: Implementing undo in custom model object for lots of properties

2012-05-07 Thread Graham Cox
On 08/05/2012, at 1:17 PM, Ben Kennedy wrote: Well, that would require my controller to -addObserver:... on each of the collected objects, which I had earlier decided to avoid for various reasons. But that's a good technique for me to keep in mind, and is beginning to sound like possibly