Re: @distinctUnionOfArrays problem

2010-02-12 Thread Trygve Inda
Did you try: @distinctUnionOfObjects.Genre since valueForKey:@Genre returns an NSString object, not an array. -aaron Same results more-or-less: I set the secondary NSArrayController to be bound to the master with arrangesObjects and @distinctUnionOfObjects.Genre I wish there were an

Re: @distinctUnionOfArrays problem

2010-02-12 Thread Trygve Inda
It sounds like you are using an NSTreeController as the master not an NSArrayController, so you'll want to do: valueForKeyPath:@childnod...@distinctunionofobjects.genre at least I think so. childNodes will give you an array for all the nodes in your tree. Ok - so I did manage to get it

Re: Large queue of messages for another app

2010-02-10 Thread Trygve Inda
On Feb 9, 2010, at 10:47 PM, Trygve Inda wrote: 1) Apple Events... These are messy but I'd go there if it'd not have lost events. Bingo. This is a really typical use case. The 'odoc' AppleEvent does exactly what you want. Just use NSWorkspace or LaunchServices to tell the other app

NSArray (unique Items matching x)

2010-02-10 Thread Trygve Inda
I have an array of Dicts with two fields in each (for example) Name and City Given a Name, I'd like to find all unique Cities or vis-versa. iTunes seems to do this with the column browser... Eg when you select Classic Rock, it pulls up a list of Artists without duplicates in the list... And

Re: NSArray (unique Items matching x)

2010-02-10 Thread Trygve Inda
You can do this using Key Value Coding, specifically using the collection operators like @distinctUnionOfSets etc. -Steven On Wed, Feb 10, 2010 at 9:11 PM, Jens Alfke j...@mooseyard.com wrote: On Feb 10, 2010, at 1:45 PM, Trygve Inda wrote: iTunes seems to do this with the column

Large queue of messages for another app

2010-02-09 Thread Trygve Inda
I have a main app and a sub-app background process (both Cocoa). The main app needs to send the sub-app a bunch of files to process... Anywhere from one to hundreds. The main app has a list of paths to process in an NSArray. In my testing with NSDistributedNotifcationCenter, it handles up to

Simple NSWindowController (or window in secondary nib)

2010-02-06 Thread Trygve Inda
I have a rather complex NSTableView that is managed by a custom class TableController. This manages the array of data that the table will display I need to be able to put up a very simple modal window with checkboxes for each possible column (to set show/hide state) and OK/Cancel buttons. The

Re: Simple NSWindowController (or window in secondary nib)

2010-02-06 Thread Trygve Inda
On 07/02/2010, at 3:52 PM, Trygve Inda wrote: The checkboxes window is in is own nib [] Any drawback to this? It seems like overkill to create a custom class to manage the checkbox window when all the checkboxes are controlled by bindings and there is only an OK/Cancel button

Re: Simple NSWindowController (or window in secondary nib)

2010-02-06 Thread Trygve Inda
2010/2/6 Trygve Inda cocoa...@xericdesign.com: Any thoughts on a design pattern for this situation? I'd make your table view controller a subclass of NSViewController, and instead of using a modal window I'd use a sheet, which your table view controller would be the delegate of. All your

Re: Simple NSWindowController (or window in secondary nib)

2010-02-06 Thread Trygve Inda
So it's window controller would just be a plain NSWindowController (no subclass) and in my TableController id just do: returnCode = [NSApp runModalForWindow:[theWindController window]]; It might or might not be a plain NSWindowController. Given the situation you described, it seems as

Re: Simple NSWindowController (or window in secondary nib)

2010-02-06 Thread Trygve Inda
On 07/02/2010, at 5:05 PM, Trygve Inda wrote: I think a sheet would work just as well... In either case the columns will not adjust until the use clicks OK. My thought was to bind the checkboxes to BOOLs in a MutableDict within the TableController. Once the sheet is dismissed, I would

SourceView example

2010-02-05 Thread Trygve Inda
Does anyone have a more basic equivalent of Apple's SourceView example? It is a lot of code and is overkill. I am trying to implement a source/outline view like the Finder/iTunes etc, but this example has me digging through piles of useless complexity. Thanks, Trygve

EnumeratorAtPath and duplicate files during drag to open

2010-02-03 Thread Trygve Inda
If a user drags 3 Finder objects to my file processor app... DirectoryA FileA FileB And FileA is in the directory tree below DirectoryA, what is the best way to avoid processing the file twice? When I get the array of paths in my drop handler, when I see the directory, I use EnumeratorAtPath to

Playlists, Smart Lists and Filters

2010-01-23 Thread Trygve Inda
I have an array of data, many records, each with several fields... Like an iTunes library. I need to crate dumb playlists (user selected records from the main library) And smart playlists (criteria-enforced records form the main library) When viewing wither the library, a playlist or smart

Smart folder definition dialog

2010-01-15 Thread Trygve Inda
Is there sample code to do the type of windows used to define smart playlists... With expanding rules +/-. Eg... Name is, contains, begins with --- +/- Clicking + will reveal a new row to add for example Size is, is greater than etc. Thanks, Trygve

Smart Lists

2010-01-15 Thread Trygve Inda
I have seen the CoreRecipes code, but as it is nearly 5 years old... Is there any more current code to do smart lists? I am not sure if I should use a simple NSArray to hold my data (which I think would work) or if Core Data is more appropriate. Thanks, Trygve

Framework soft link (optional install)

2010-01-13 Thread Trygve Inda
I have an app that I'd like to use a Cocoa Framework in (and it'd normally end up in my app package in the Frameworks folder). For licensing reasons, I can't embed it directly, and my all will work without it (though some features will be disabled). I'd like to allow users to download this

Re: Framework soft link (optional install)

2010-01-13 Thread Trygve Inda
I have an app that I'd like to use a Cocoa Framework in (and it'd normally end up in my app package in the Frameworks folder). For licensing reasons, I can't embed it directly, and my all will work without it (though some features will be disabled). I'd like to allow users to download

Detect - Corrupt JPEG data: premature end of data segment

2009-11-13 Thread Trygve Inda
I am downloading an image from the server and sometimes I get an image that is only the first half of the data, either because of a lost connection to the server or the file being replaced on the server while I am downloading. Opening in preview, generates a console message: Corrupt JPEG data:

Callback when OS delivers console msg for my process?

2009-11-13 Thread Trygve Inda
I use: imageWithContentsOfFile:@a.jpg And sometime it generates a console message: Corrupt JPEG data: premature end of data segment How can I use an observer/exception handler or other notification to detect such messages as NSImage accepts this image as valid when it is not. Something deeper

Re: Callback when OS delivers console msg for my process?

2009-11-13 Thread Trygve Inda
You might try checking NSImage's -isValid after loading it. - Joel On Nov 13, 2009, at 11:23 AM, Trygve Inda wrote: isValid returns YES Immediately afterwards calling [image drawInRect:myRect fromRect:imageRect operation:NSCompositeCopy fraction:1.0]; Send this to the console: Error

Re: Callback when OS delivers console msg for my process?

2009-11-13 Thread Trygve Inda
You might try checking NSImage's -isValid after loading it. - Joel On Nov 13, 2009, at 11:23 AM, Trygve Inda wrote: isValid returns YES Immediately afterwards calling [image drawInRect:myRect fromRect:imageRect operation:NSCompositeCopy fraction:1.0]; Send this to the console

Re: Callback when OS delivers console msg for my process?

2009-11-13 Thread Trygve Inda
This has been a known issue and was supposedly fixed in Snow Leopard - are you running 10.5 by any chance? If you are running Snow Leopard, I would recommend filing a radar at http://bugreport.apple.com. - Joel On Nov 13, 2009, at 12:13 PM, Trygve Inda wrote: You might try checking

Re: Callback when OS delivers console msg for my process?

2009-11-13 Thread Trygve Inda
On Nov 13, 2009, at 2:53 PM, Trygve Inda wrote: Also... NSURL* imgURL = [NSURL fileURLWithPath:path]; CGImageSourceRefimgRef; CGImageSourceStatus imgStatus; imgRef = CGImageSourceCreateWithURL (imgURL, nil); CGImageSourceGetStatus (imgRef) returns

iPhone NavController within TabBarController (nested table views)

2009-10-04 Thread Trygve Inda
My root view is a TabBarController with three tabs. Each one gets its view from a different nib and all is well... The tab controller handles the load/unload as the user clicks the tabs. One of these tabs has a tableview in it's view. I would like to add a second table that is accessed by

Re: Intel Mac prefpane error

2009-08-12 Thread Trygve Inda
On Aug 11, 2009, at 4:22 PM, Trygve Inda wrote: My app has never done this for me, but how can the OS say it is not an Intel App when it is a 32/64 universal binary? You keep saying app, but that string you mentioned earlier appears in System Preferences if the preferences

Re: Intel Mac prefpane error

2009-08-12 Thread Trygve Inda
On 08/08/2009, at 7:47 AM, Trygve Inda wrote: Although my app is a universal binary (32/64), and was developed on an Intel Mac, a few people report when trying to install and error: You cannot open (my app) preferences because it doesn't work on an Intel-based Mac. I suspect the error

Re: Intel Mac prefpane error

2009-08-11 Thread Trygve Inda
What OS are those few people running? Kiel :-) If video games affected us as kids, we'd all be running around in darkened rooms, munching on magic pills and listening to repetitive electronic music. On 08/08/2009, at 7:47 AM, Trygve Inda wrote: Although my app is a universal binary

Re: Intel Mac prefpane error

2009-08-08 Thread Trygve Inda
What OS are those few people running? Kiel :-) If video games affected us as kids, we'd all be running around in darkened rooms, munching on magic pills and listening to repetitive electronic music. On 08/08/2009, at 7:47 AM, Trygve Inda wrote: Although my app is a universal binary

Intel Mac prefpane error

2009-08-07 Thread Trygve Inda
Although my app is a universal binary (32/64), and was developed on an Intel Mac, a few people report when trying to install and error: You cannot open (my app) preferences because it doesn't work on an Intel-based Mac. It works on all three of my Intel Macs on 10.5.7, 10.5.8 and 10.6 Dev build.

Crash when using TableView in View managed by TabController

2009-07-19 Thread Trygve Inda
I have a TabBarController that has three tabs, and each view for these is kept in its own nib. One of these views has a UITableView which has its delegate and dataSource attached to the File's Owner. The nib also has TableCell objects which are returned from: - (UITableViewCell

Re: Crash when using TableView in View managed by TabController

2009-07-19 Thread Trygve Inda
I have a TabBarController that has three tabs, and each view for these is kept in its own nib. One of these views has a UITableView which has its delegate and dataSource attached to the File's Owner. The nib also has TableCell objects which are returned from: - (UITableViewCell

View in Tab can't reference parent controller (iPhone)

2009-07-19 Thread Trygve Inda
I have an AppController in my main nib. Also in this nib is a TabBarController and several custom subclasses of UIViewController. The TabBarController manages the custom subclasses of UIViewController. However, these subcalsses need to be able to get back to the AppController . So for each

Re: Iphone Grouped Table View for Settings

2009-07-17 Thread Trygve Inda
Look at the table view programming guide for how to build custom table cells. Just think of each cell as a custom view. They can even be built in IB easily enough. Drag UITableViewCell objects into your nib and lay them out however you like. Luke Sent from my iPhone. So I want a

Re: Iphone Grouped Table View for Settings

2009-07-17 Thread Trygve Inda
On Jul 17, 2009, at 9:39 AM, Trygve Inda wrote: Look at the table view programming guide for how to build custom table cells. Just think of each cell as a custom view. They can even be built in IB easily enough. Drag UITableViewCell objects into your nib and lay them out however you like

Re: Iphone Grouped Table View for Settings

2009-07-17 Thread Trygve Inda
On Jul 17, 2009, at 7:15 AM, Trygve Inda wrote: Can I just drag a connection from the UIViewController in one nib to the view object in another nib No. You cannot make connection between nibs. I recommend reading up on using Interface Builder and nibs to get a better

Iphone Grouped Table View for Settings

2009-07-16 Thread Trygve Inda
I don't want to use the Settings app as I need a clean way for the user to get to the settings from within my app and then return to my app. So I need to build a grouped table view, with each cell containing a single control (and a label) like the settings app does. For example, I need a table

[NSImageView setImage:theImage] Thread safe??

2009-07-01 Thread Trygve Inda
The docs at: http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/Thr eadSafetySummary/ThreadSafetySummary.html State: The NSView class is generally thread-safe, with a few exceptions. You should create, destroy, resize, move, and perform other operations on NSView objects

Re: [NSImageView setImage:theImage] Thread safe??

2009-07-01 Thread Trygve Inda
2009/7/1 Trygve Inda cocoa...@xericdesign.com: So is this legal in a secondary thread? NSImage* theImage = [[NSImage alloc] initWithContentsOfFile:someImagePath]; [imageView setImage:theImage]; [theImage release]; No. I have no idea how this squares with generally thread-safe

NSDateFormatter Breaks on non-English OS

2009-06-30 Thread Trygve Inda
NSString* myDateFormat = @%a %b %e %H:%M:%S %Z %Y; NSDate*myDate = nil; // myDateString is Tue Jun 30 15:53:24 UTC 2009 myFormatter = [[NSDateFormatter alloc] initWithDateFormat:imageDateFormat allowNaturalLanguage:NO]; myDate = [myFormatter dateFromString:myDateString]; This

Re: NSDateFormatter Breaks on non-English OS

2009-06-30 Thread Trygve Inda
NSString* myDateFormat = @%a %b %e %H:%M:%S %Z %Y; NSDate*myDate = nil; // myDateString is Tue Jun 30 15:53:24 UTC 2009 myFormatter = [[NSDateFormatter alloc] initWithDateFormat:imageDateFormat allowNaturalLanguage:NO]; myDate = [myFormatter dateFromString:myDateString];

Re: NSDateFormatter Breaks on non-English OS

2009-06-30 Thread Trygve Inda
On Jun 30, 2009, at 3:29 PM, Trygve Inda wrote: NSString* myDateFormat = @%a %b %e %H:%M:%S %Z %Y; NSDate*myDate = nil; // myDateString is Tue Jun 30 15:53:24 UTC 2009 myFormatter = [[NSDateFormatter alloc] initWithDateFormat:imageDateFormat allowNaturalLanguage:NO

Re: NSDateFormatter Breaks on non-English OS

2009-06-30 Thread Trygve Inda
So, In the International Pane of System prefs, I have set the Region to Germany Then in my app I call: NSString* myDateString = @Tue Jun 30 15:53:24 UTC 2009; NSDateFormatter* theFormat = [[NSDateFormatter alloc] init]; [theFormat setFormatterBehavior:NSDateFormatterBehavior10_4];

Re: NSDateFormatter Breaks on non-English OS

2009-06-30 Thread Trygve Inda
On Jun 30, 2009, at 5:08 PM, Trygve Inda wrote: [theFormat setDateFormat:@EEE MMM dd HH:mm:ss zzz ]; I'm not sure if UTC is recognised; try: [myFormatter setDateFormat:@EEE MMM dd HH:mm:ss 'UTC' ]; mmalc Indeed that does it. So will the date created be assumed

Crash on wake from sleep

2009-06-30 Thread Trygve Inda
My app has a single window with a single view and I call: NSImage*theImage = [[[NSImage alloc] initWithContentsOfFile:mapImagePath] autorelease]; [window orderFront:self]; [imageView setImage:theImage]; [imageView setNeedsDisplay:YES]; The file that this image comes from will be deleted

GraphicsImportComponent and 64bit

2009-06-26 Thread Trygve Inda
#import QuickTime/QuickTime.h GraphicsImportComponentgic; result = GetGraphicsImporterForFile (theFSSpec, gic); Does not compile for 64bit architecture. Is there any fix or 64 bit similar function? Thanks, Trygve ___ Cocoa-dev mailing

Odd crash only when Toast running

2009-06-02 Thread Trygve Inda
I have a user reporting an odd crash that I can't make happen here, nor has anyone else reported this, but the report is consistent and happens only when Toast is running. It seems very deep in the OS and as far as I know, I am not using libRIP.A.dylib. The only thing I can find that may be

Re: Odd crash only when Toast running

2009-06-02 Thread Trygve Inda
And if you do find an unknown library in the list that proves tone problematic, please file a bug describing the issue and including the crash log. b.bum The only non-Apple ones are: +org.andymatuschak.Sparkle 1.5 Beta 6 +com.DivXInc.DivXDecoder 6.4.0 Sparkle is used in my app, but

Re: Odd crash only when Toast running

2009-06-02 Thread Trygve Inda
On Tue, Jun 2, 2009 at 12:12 AM, Graham Cox graham@bigpond.com wrote: On 02/06/2009, at 4:23 PM, Trygve Inda wrote: The only thing I can find that may be related (based on [NSWindow displayIfNeeded] being in the report) is that my app has a single window with a single view and I call

Re: Centering a window ... not in the usual way!

2009-05-13 Thread Trygve Inda
Hi, I'm working on an application that when first started you are presented with a small window showing a number of options. When any of these options are chosen, the window fades out the contentView whilst at the same time replacing it with and fading in the new view. The window also

Re: Centering a window ... not in the usual way!

2009-05-13 Thread Trygve Inda
On Wed, May 13, 2009 at 4:20 AM, Mic Pringle micprin...@gmail.com wrote: Hi, I'm working on an application that when first started you are presented with a small window showing a number of options. When any of these options are chosen, the window fades out the contentView whilst at the

Desktop window eating clicks

2009-05-12 Thread Trygve Inda
imageView = [[NSImageView alloc] initWithFrame:NSMakeRect(0, 0, dispBounds.size.width, dispBounds.size.height)]; [imageView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; window = [[NSWindow alloc] initWithContentRect:dispBounds styleMask:NSBorderlessWindowMask

Re: Desktop window eating clicks

2009-05-12 Thread Trygve Inda
imageView = [[NSImageView alloc] initWithFrame:NSMakeRect(0, 0, dispBounds.size.width, dispBounds.size.height)]; [imageView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; window = [[NSWindow alloc] initWithContentRect:dispBounds styleMask:NSBorderlessWindowMask

Re: Not sleeping - Why?

2009-05-10 Thread Trygve Inda
On May 8, 2009, at 12:48 PM, Trygve Inda wrote: My app is a background app that sends and receives distributed notifications, reads from a few large mmap'd files and crates a new file every few minutes (and deletes the old one). When it is running, the display sleeps, but the system

Not sleeping - Why?

2009-05-08 Thread Trygve Inda
My app is a background app that sends and receives distributed notifications, reads from a few large mmap'd files and crates a new file every few minutes (and deletes the old one). When it is running, the display sleeps, but the system does not. How can I tell the OS that it is ok to sleep. Since

NSWorkspaceDidWakeNotification crash

2009-05-04 Thread Trygve Inda
I call: [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(wakeNotification:) name:NSWorkspaceDidWakeNotification object:nil]; -(void)wakeNotification:(NSNotification*)note { [self wake:nil] } -(void)wakeNotification:(NSNotification*)note { [self

Thread safety

2009-04-28 Thread Trygve Inda
The docs say that: Note that although NSSerializer, NSArchiver, NSCoder, and NSEnumerator objects are themselves thread-safe, they are listed here because it is not safe to change the data objects wrapped by them while they are in use. For example, in the case of an archiver, it is not safe to

Coca equivalent to NMInstall?

2009-04-26 Thread Trygve Inda
Is there an equivalent to NMInstall in Cocoa? I want to be able to post an error message to the OSW and then immediately quit, but still have my message show up to the user. This is from a faceless background application. Thanks, Trygve ___

Nested AutoRelease Pools Crash

2009-04-26 Thread Trygve Inda
- (void)threadMethod:(id)anObject { NSAutoreleasePool* outterPool = [[NSAutoreleasePool alloc] init]; NSDictionary*userDefaults = [NSUserDefaults standardUserDefaults] importantValue = [[userDefaults objectForKey:@myKey] boolValue]; while (1) {

Re: Nested AutoRelease Pools Crash

2009-04-26 Thread Trygve Inda
- (void)threadMethod:(id)anObject { NSAutoreleasePool* outterPool = [[NSAutoreleasePool alloc] init]; NSDictionary*userDefaults = [NSUserDefaults standardUserDefaults] importantValue = [[userDefaults objectForKey:@myKey] boolValue]; while (1) {

Re: Nested AutoRelease Pools Crash

2009-04-26 Thread Trygve Inda
2009/4/26 Trygve Inda cocoa...@xericdesign.com: - (void)threadMethod:(id)anObject {   NSAutoreleasePool* outterPool = [[NSAutoreleasePool alloc] init];   NSDictionary*    userDefaults = [NSUserDefaults standardUserDefaults]   importantValue = [[userDefaults objectForKey:@myKey] boolValue

Re: Nested AutoRelease Pools Crash

2009-04-26 Thread Trygve Inda
- (void)threadMethod:(id)anObject {   NSAutoreleasePool* outterPool = [[NSAutoreleasePool alloc] init];   NSDictionary*    userDefaults = [NSUserDefaults standardUserDefaults]   importantValue = [[userDefaults objectForKey:@myKey] boolValue]; +standardUserDefaults don't return no

Re: Nested AutoRelease Pools Crash

2009-04-26 Thread Trygve Inda
Trygve Inda wrote: Sorry - what I thought were irrelevant parts were partly removed to keep the email line wrap nice. I'll try to narrow it down some more. Instead of narrowing it down only for emailing, you might actually refactor it so the main loop looks more like the paraphrase you

Fill box with repeating text

2009-04-24 Thread Trygve Inda
I have a rect in a graphics context that I wish to fill with repeating text Some Text so that the text repeats enough times to completely fill the rect at the given line spacing, font style etc. How can I determine how much text I need? Is there a better way to build this than just

Re: Fill box with repeating text

2009-04-24 Thread Trygve Inda
There are several ways to accomplish this. (I'll note that you can get the size of an attributed string using its -size method.) Option 1: Create an NSImage with the size returned from the attributed string. Draw the attributed string into the image. Create an NSColor pattern from the

Re: Fill box with repeating text

2009-04-24 Thread Trygve Inda
Makes the text transparent, but I can't seem to make the background of the NSImage transparent. I want to end up with white text on a transparent background, but [[NSImage alloc] initWithSize:[theString size]] seems to set the background to solid white. This is because you're drawing the

Re: Fill box with repeating text

2009-04-24 Thread Trygve Inda
Where does this go as it is drawing the image, not the text? The image is drawn with a RectFill call?? Ah, sorry. I meant to say: NSRectFillUsingOperation(rect, NSCompositeSourceOver); Note that point here is that however the image is finally drawn, you have to make sure you're drawing

Time since Login?

2009-04-21 Thread Trygve Inda
How can I get: (a) elapsed time since login (b) elapsed time since startup ?? My goal is to delay some intense processing until the system is fully up and running as it seems to do a lot of housekeeping at startup. Is there also a way to determine some sort of overall system activity? It may

@selector not working with (id)anObject

2009-04-11 Thread Trygve Inda
[NSThread detachNewThreadSelector:@selector(threadMethod:) toTarget:self withObject:@selector(myMethod)]; -(void)threadMethod:(id)anObject { NSAutoreleasePool*pool = [[NSAutoreleasePool alloc] init]; SEL comp = (SEL)anObject; ... Do stuff ... [self

Re: @selector not working with (id)anObject

2009-04-11 Thread Trygve Inda
On Apr 11, 2009, at 5:20 PM, Trygve Inda wrote: -(void)threadMethod:(id)anObject { NSAutoreleasePool*pool = [[NSAutoreleasePool alloc] init]; SEL comp = (SEL)anObject; ... Do stuff ... [self performSelectorOnMainThread:comp withObject:nil waitUntilDone:NO

Re: @selector not working with (id)anObject

2009-04-11 Thread Trygve Inda
2009/4/11 Trygve Inda cocoa...@xericdesign.com I have a thread. Depending on how it is called, I need to do something different at the end of the main processing so I wanted to pass a selector into the thread so it could call it when it was ready. I could just pass an NSNumber and do

Re: @selector not working with (id)anObject

2009-04-11 Thread Trygve Inda
It does not seem I can invoke this on the main thread. An NSInvocation? Basically I just need to use a function pointer. How does Cocoa do this? I need to pass either someMethod or someOtherMethod and later call it with [self performSelectorOnMainThread:theMethod withObject:nil

KVO or Value Transformer?

2009-04-02 Thread Trygve Inda
I need to enable a view if the value of a popup menu is kSomeValue or kSomeOtherValue, and disable it otherwise. The popup's value is bound to an NSNumber in a NSDictionary. I think I could add an observer for this and manually enable/disable the view when the popup value meets my criteria...

NS - CG Rect Conversion and screen coordinates

2009-03-31 Thread Trygve Inda
Using these two calls: NSRect nsRect = [screen frame]; CGRect cgRect = CGDisplayBounds (displayID); I get for my two screens: NSx=0y=0 w=2560h=1600 // screen A CGx=0y=0 w=2560h=1600 NSx=-1920y=184w=1920h=1200 // screen B CGx=-1920

Custom sort order on NSTableColumn

2009-03-29 Thread Trygve Inda
I have an NSTableView with 4 columns. There is an NSArrayController behind it and two columns use bindings to grab data from the array directly. The other two columns have to calculate their content based on other fields in the array. I need to define a custom sort comparison method for these.

cast to pointer from int of diff size IODisplayCreateInfoDictionary

2009-03-17 Thread Trygve Inda
io_service_tservice; CFDictionaryRef dict; dict = (CFDictionaryRef) IODisplayCreateInfoDictionary (service, kNilOptions); No matter what I do I get: warning: cast to pointer from integer of different size I am compiling 32/64bit and this is defined as: CFDictionaryRef

ProcessInformationCopyDictionary

2009-02-11 Thread Trygve Inda
I call ProcessInformationCopyDictionary (psn, kProcessDictionaryIncludeAllInformationMask); but if the application has moved since it was launched, the result of this call in the CFBundleExecutable and BundlePath keys is wrong. The values contain the original location of the application. So...

Re: A Mac App helper NSStatusItem - how to share preferences

2009-02-11 Thread Trygve Inda
Steve Cronin (steve_cro...@mac.com) on 2008-12-28 8:41 PM said: I have an application which will have an optional helper NSStatusItem. The statusItem is a stand-alone application which can be installed as a LoginItem. I want this status item to be able to read the preferences file from

Re: ProcessInformationCopyDictionary

2009-02-11 Thread Trygve Inda
I think it exists a standard Apple Event to retrieve a process version. (get «vers») But you can also add a custom get version Apple Event handler to your helper and use it to retrieve the version from your pref pane. This works great for future versions, but not existing ones. I'll look

Re: ProcessInformationCopyDictionary

2009-02-11 Thread Trygve Inda
I think it exists a standard Apple Event to retrieve a process version. (get «vers») But you can also add a custom get version Apple Event handler to your helper and use it to retrieve the version from your pref pane. Hmmm... It seems keyAEVersion ('vers') only gets the version info for

System Activity shortly after booting

2009-02-05 Thread Trygve Inda
Immediately after OS X boots and gets logged in, there is quite a lot of disk activity. I'd like to be able to detect this and delay the start of processing for a background app. Basically it needs to wait the 30-60 seconds or so until the OS is doing less and has settled down. Is there a good

New MacBookPro and DisplayID w/two graphics cards

2009-01-06 Thread Trygve Inda
The New MacBook Pros have 2 graphics cards. When I get the DisplayID, the slow card and fast card differ by 2... ie: Fast card DisplayID 1234567 Slow card DisplayID 1234565 (not real numbers) After switching modes in the Energy System Pref Pane, calls to get the DisplayID return the correct

New MacBookPro and DisplayID weirdness w/two graphics cards

2009-01-06 Thread Trygve Inda
The New MacBook Pros have 2 graphics cards. When I get the DisplayID, the slow card and fast card differ by 2... ie: Fast card DisplayID 1234567 Slow card DisplayID 1234565 (not real numbers) After switching modes in the Energy System Pref Pane, calls to get the DisplayID return the correct

Bind button title to Boolean

2008-10-27 Thread Trygve Inda
How can I bind a button title to a Boolean but have a custom title for each state? For example, I have a BOOL isRunning, if YES, my button should read Stop Running else Start Running. I can't really do this with an alternate title since when the button is pushed and temporarily held down, the

Re: Bind button title to Boolean

2008-10-27 Thread Trygve Inda
How can I bind a button title to a Boolean but have a custom title for each state? For example, I have a BOOL isRunning, if YES, my button should read Stop Running else Start Running. I can't really do this with an alternate title since when the button is pushed and temporarily held down,

Notify when file moved

2008-09-04 Thread Trygve Inda
I have a pref pane and a background app tied to it. Sometimes, people try to trash the pref pane while the background process is running which orphans things a bit. Is there a way to have the background process notified when the pref pane is moved (ie moved to the trash). Note the background

Thread deadlock?

2008-08-11 Thread Trygve Inda
I am seeing a deadlock I think... It works in the debugger, but hangs when running alone. The killThread is called as part of the applicationWillTerminate delegate method. My thought is that somehow after blocking to wait for kConditionThreadIdle, my performSelectorOnMainThread is getting called.

NSConditionLock vs MPQueue

2008-08-11 Thread Trygve Inda
I am using NSConditionLock in Cocoa but it seems unable to match the capabilities of MPQueue for my needs. I am using -- from my worker thread, do something on the main thread -- [lock lockWhenCondition:kTaskComplete]; In the Carbon version I used MPWaitOnQueue. The difference is that

Delayed termination to allow release

2008-08-11 Thread Trygve Inda
My main thread creates a few other objects which have NSThreads and/or timers. I have found that when I quit the app, and the threads are ended, something in the OS is retaining my objects for a bit... They end up never being dealloc'd which messes a few things up as some data is written to disk

Re: Thread deadlock?

2008-08-11 Thread Trygve Inda
Key Trygve, This looks similar to the threading code we talked about a while back. Far be it for me to say that my threading code is bugless :), but I haven't run into a deadlock problem, and the code you posted has two changes that would give me pause... [self

Re: Thread deadlock?

2008-08-11 Thread Trygve Inda
Which part is correct? The original code? The original code was what I meant. However I was thinking of traditional conditions locks; NSConditionLock does operate at a higher level, and you are right that there is no need for an unconditional lock. But really, I don't see a need for a

Re: Thread deadlock?

2008-08-11 Thread Trygve Inda
There is a chance that my calls to performSelectorOnMainThread can have waitUntilDone:NO I use [myNSData writeToFile:path atomically:YES] NSFileHandle and NSFileManager are shown as not thread safe, but NSData is... Perhaps it is ok, but I would think NSData uses one or both of the above. One

Re: Thread deadlock?

2008-08-11 Thread Trygve Inda
There is a chance that my calls to performSelectorOnMainThread can have waitUntilDone:NO I use [myNSData writeToFile:path atomically:YES] NSFileHandle and NSFileManager are shown as not thread safe, but NSData is... Perhaps it is ok, but I would think NSData uses one or both of the

Instance vars, local vars and speed

2008-08-04 Thread Trygve Inda
I am transitioning some code from Carbon to Cocoa and redesigning a lot of how things work. I am doing a bit of low-level pixel manipulation and wondering about speed of access to variables declared in a method vs those declared at the object level. Obviously things like x,y loop counters are

Re: Instance vars, local vars and speed

2008-08-04 Thread Trygve Inda
IMHO, this is just premature optimisation. That said, there is no cost to access an ivar using the 32 bits runtime, and I don't think the cost on 64 bits runtime is important enough to bother with it. This is what I was trying to determine. Thanks. Trygve

NSDate to month, year etc.

2008-08-03 Thread Trygve Inda
I am using: [[myNSDate dateWithCalendarFormat:nil timeZone:nil] monthOfYear]; But the docs say: Important: NSCalendarDate is slated for deprecation, and its use is strongly discouraged. So what should I be using to get the month, year etc as ints out of an NSDate? Thanks, Trygve

Re: NSDate to month, year etc.

2008-08-03 Thread Trygve Inda
On Aug 3, 2008, at 1:28 AM, Trygve Inda wrote: Important: NSCalendarDate is slated for deprecation, and its use is strongly discouraged. So what should I be using to get the month, year etc as ints out of an NSDate? Seriously? Important: Use of NSCalendarDate strongly discouraged

KCGDisplaySetMainFlag not firing

2008-07-31 Thread Trygve Inda
I have a MBP17 and a 23 Cinema. The Cinema is the main display. I am using: void DisplayReconfigurationCallBack (CGDirectDisplayID display, CGDisplayChangeSummaryFlags flags, void *userInfo) When I remove the Cinema I get: KCGDisplayRemoveFlag kCGDisplaySetMainFlag // main is now set to the

CGDisplayBounds vs NSSCreen visibleFrame

2008-07-26 Thread Trygve Inda
I have a 23 Cinema as my main display and a 17 PB as my secondary. The Cinema is arranged to the right of the PB. When I call NSScreen -visibleFrame on the secondary screen, I get a y origin of -774 but when calling CGDisplayBounds it is 924. The secondary screen height is 1050 and the height of

Re: CGDisplayBounds vs NSSCreen visibleFrame

2008-07-26 Thread Trygve Inda
The previous code was written in mail. Real code here: Given an CGDirectDisplayID for an auxScreen, get its frame in modern (0,0 is bottom left) coordinates. CGRect auxScreenRect = CGDisplayBounds (displayID); CGRect mainScreenRect = CGDisplayBounds (CGMainDisplayID ());

<    1   2   3   4   5   >