Re: Launch process as root from cocoa app

2010-01-27 Thread Nyxem
It didn't work, I'm gonna try the solution given by Kyle Sluder, with the KeepAlive options of launchd.plist. On Jan 27, 2010, at 4:34 AM, Charles Srstka wrote: > On Jan 25, 2010, at 9:18 PM, Nick Zitzmann wrote: > >> >> On Jan 25, 2010, at 12:57 AM, Nyxem wrote: >> >>> 1 - Using the authoriz

Re: Global in NSApplication

2010-01-27 Thread BareFeet
On 27/01/2010, at 5:02 PM, Graham Cox wrote: > The singleton pattern Jens suggested is simpler. I can't think of any simpler > way: > > + (Debug*)sharedDebug > { >static Debug* s_debug = nil; > >if( s_debug == nil ) >s_debug = [[self alloc] init]; > >return s_de

RE: Hyperlinks in Table Views

2010-01-27 Thread David Doyle
I think I may have got this to work, so here goes: The data cell for the table column displaying the hyperlink is now a custom NSTextFieldCell with the following implementation over-ridden: - (NSUInteger)hitTestForEvent: (NSEvent *)event inRect: (NSRect

PDF View - smooth text?

2010-01-27 Thread Keith Blount
Hello, Not sure if this would be better off on the Quartz list or here, but I'll try here first. :) In Preview app's preferences, under the "PDF" pane, there is a checkbox entitled "Smooth text and line art". Does anyone know what setting this corresponds to in PDFView or the PDFKit (if, indee

Re: What is the equivalent of SetSystemUIMode() in Leopard and above?

2010-01-27 Thread Alastair Houghton
On 27 Jan 2010, at 05:36, Charles Srstka wrote: > Or you could just do something like this: > > if(floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_5) > { > [NSApp setPresentationOptions:whatever]; > } > else > { > SetSystemUIMode(whatever); > } > > You could also use if([NSApp

Re: NSString category name collision?

2010-01-27 Thread jonat...@mugginsoft.com
On 26 Jan 2010, at 23:22, Greg Parker wrote: > On Jan 26, 2010, at 3:19 PM, Sean McBride wrote: >> On 1/26/10 4:08 PM, jonat...@mugginsoft.com said: >>> I added a name space prefix to my method definition and the exception >>> departed. >> >> You can add the following env var to debug these prob

Re: What is the equivalent of SetSystemUIMode() in Leopard and above?

2010-01-27 Thread Jean-Daniel Dupas
Le 27 janv. 2010 à 11:48, Alastair Houghton a écrit : > On 27 Jan 2010, at 05:36, Charles Srstka wrote: > >> Or you could just do something like this: >> >> if(floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_5) >> { >> [NSApp setPresentationOptions:whatever]; >> } >> else >> { >>

Re: NSString category name collision?

2010-01-27 Thread Jean-Daniel Dupas
Le 27 janv. 2010 à 12:00, jonat...@mugginsoft.com a écrit : > > On 26 Jan 2010, at 23:22, Greg Parker wrote: > >> On Jan 26, 2010, at 3:19 PM, Sean McBride wrote: >>> On 1/26/10 4:08 PM, jonat...@mugginsoft.com said: I added a name space prefix to my method definition and the exception >>>

Re: NSString category name collision?

2010-01-27 Thread jonat...@mugginsoft.com
On 27 Jan 2010, at 11:09, Jean-Daniel Dupas wrote: > Wow, there is some people here who don't know the fantastic TN2124 ;-) > > http://developer.apple.com/mac/library/technotes/tn2004/tn2124.html Now my life has meaning! OBJC_PRINT_REPLACED_METHODS generates a lot of references to CoreFounda

Re: How to access iTunes using cocoa

2010-01-27 Thread Paul Sanders
Just to report back: what Jens recommended works like a charm. Thanks again Jens, saved my life. I also appended and album is "..." to reduce the risk of retrieving the wrong track. Paul Sanders - Original Message - From: "Jens Alfke" To: "Paul Sanders" Cc: "Matt Neuburg" ; "Ra

Re: Change background color of UITabBarItem and UITabBar

2010-01-27 Thread Greg Reichow
> > Thanks for this information. It did change the color of the TabBar. > But the other question is still unanswered. Is it possible to change > the TabBarItem's image colors? Instead of default gray (when not selected) > and blue (when selected)? How? > Again, a little bit of a grey area as you

Localization help

2010-01-27 Thread lorenzo7620
I'm not sure if this is an XCode or Cocoa issue, so I'm going to post this question on both lists: I'm adding localization strings to my application. So far, I've added Spanish, French, Italian and English Localizable.strings. When I change languages, everyone one of them works except, Italia

Re: Localization help

2010-01-27 Thread Steve Bird
On Jan 27, 2010, at 8:42 AM, lorenzo7...@gmail.com wrote: I'm not sure if this is an XCode or Cocoa issue, so I'm going to post this question on both lists: I'm adding localization strings to my application. So far, I've added Spanish, French, Italian and English Localizable.strings. When

Re: Re: Localization help

2010-01-27 Thread lorenzo7620
On Jan 27, 2010 7:51am, Steve Bird wrote: On Jan 27, 2010, at 8:42 AM, lorenzo7...@gmail.com wrote: I'm not sure if this is an XCode or Cocoa issue, so I'm going to post this question on both lists: I'm adding localization strings to my application. So far, I've added Spanish, Frenc

Re: CALayer maybe silly question

2010-01-27 Thread vincent habchi
David, Le 25 janv. 2010 à 21:39, David Duncan a écrit : > If you want to draw to a layer on a separate thread, you need to run the > runloop on that thread, as Core Animation is pretty highly dependent on the > run loop operating. If you call -setNeedsDisplay on a thread where you never > run

Re: AppleEvent memory leak

2010-01-27 Thread Sean McBride
On 1/26/10 5:11 PM, Rainer Standke said: >I have an app that sends and receives AppleEvents to and from Final >Cut Pro. The AppleEvent part of my code is closely modeled after the >sample code provided by Apple. Really: I barely modified the code. >When I look at Leaks I am told that for each tran

Re: What is the equivalent of SetSystemUIMode() in Leopard and above?

2010-01-27 Thread Sean McBride
On 1/27/10 12:01 PM, Jean-Daniel Dupas said: >I also prefer this approach but it should be use with care as >sometimes, a framework in a previous OS version "exports" private >function/method with the same name but with a different behavior. > >So, if you test for function existence, it always re

Re: NSString category name collision?

2010-01-27 Thread Sean McBride
On 1/27/10 11:27 AM, jonat...@mugginsoft.com said: >OBJC_PRINT_REPLACED_METHODS generates a lot of references to >CoreFoundation/Quartz/OSA framework category replacements. Yes, for those of us outside Apple such messages are just noise. I encourage you to file a dupe! :) -- ___

Re: Localization help

2010-01-27 Thread Iceberg-Dev
On Jan 27, 2010, at 3:05 PM, lorenzo7...@gmail.com wrote: [...] Of course, sorry. Instead of the localization value, I get the localization key instead, which is an English string. Here's a list of things to check: - Check that there's no missing ';' - Check that you do not have "key" ="

Re: Localization help

2010-01-27 Thread Dave DeLong
I'd also run: plutil -lint Italian.strings That should report any syntax errors with the strings file. It's much easier than visually checking it yourself. Dave Sent from my iPod On Jan 27, 2010, at 8:53 AM, Iceberg-Dev wrote: On Jan 27, 2010, at 3:05 PM, lorenzo7...@gmail.com wrote:

Re: How to access iTunes using cocoa

2010-01-27 Thread Jens Alfke
On Jan 26, 2010, at 11:37 PM, has wrote: > It may be the answer lies somewhere in-between: an explicit network messaging > API with the ability to perform [read-only?] queries, but which mostly uses > safe pointer and one-message-one-object semantics for simplicity, speed and > safety. I agre

Re: AppleEvent memory leak

2010-01-27 Thread Jens Alfke
On 1/26/10 5:11 PM, Rainer Standke said: > When I look at Leaks I am told that for each transaction (sending or > receiving an AE) a little memory is leaked, about 400 bytes each. The > leaks seem to happen fairly deep in the framework, not in my own code. Interpreting leak backtraces can be tri

Re: Global in NSApplication

2010-01-27 Thread Scott Ribe
Well, even simpler, you could just use C without fancy singletons, as in: Debug *gDebug = nil; int main(int argc, char *argv[]) { gDebug = [[Debug alloc] init]; return NSApplicationMain(argc, (const char **) argv); } Then in any file where you want to use it, put "extern Debug *gDebug;"

Re: What is the equivalent of SetSystemUIMode() in Leopard and above?

2010-01-27 Thread Jesper Storm Bache
Sure - my point was to point out the new 10.6 API. For this particular case, I would simply go with SetSystemUIMode on all OS'es. Pro: - You have to use SetSystemUIMode on 10.5 - The code is simpler with using a single API - Your testing effort will not require a reboot between 10.5 & 10.6 when yo

Re: Context menu on NSOutlineView, which row is active/selected?

2010-01-27 Thread Jens Alfke
On Jan 26, 2010, at 9:09 PM, David Melgar wrote: In my view controller, I had been assuming that the row the right click occurred would show up as a selected row. But it does not always. It appears to be a separate state. How should I determine the row that the right click occurred on? Ky

Re: Global in NSApplication

2010-01-27 Thread Jens Alfke
On Jan 27, 2010, at 8:37 AM, Scott Ribe wrote: Well, even simpler, you could just use C without fancy singletons, as in: Debug *gDebug = nil; int main(int argc, char *argv[]) { gDebug = [[Debug alloc] init]; return NSApplicationMain(argc, (const char **) argv); } Depending on what

NSTask and uudecode

2010-01-27 Thread gMail.com
I have to decode a uuencoded NSString in memory so I use NSTask to launch the unix command uudecode. If I set the output to a file, it works. But if I setStandardOutput to a NSFileHandle I cannot later get any availableData. Can you please tell me why? // -p should set the standard output. Eve

Re: Global in NSApplication

2010-01-27 Thread Scott Ribe
> It would be a bad > idea to make any AppKit calls before NSApplicationMain, for example. Not too hard to avoid that in the -init method ;-) > This also makes it difficult to use the Debug class in a framework/ > library. Yes, use from framework/library is the primary motivator for using a sing

Re: Context menu on NSOutlineView, which row is active/selected?

2010-01-27 Thread Corbin Dunn
On Jan 26, 2010, at 9:09 PM, David Melgar wrote: > I have a menu set as the Menu outlet of an NSOutlineView to use as a context > menu (right click) on a row. > > When the menu is chosen on a row, the chosen action on my target (my > OutlineView controller) is invoked as expected. > > In my v

Re: NSTask and uudecode

2010-01-27 Thread Jens Alfke
On Jan 27, 2010, at 9:37 AM, gMail.com wrote: I have to decode a uuencoded NSString in memory so I use NSTask to launch the unix command uudecode. Why not just use a C function to uudecode? A minute's googling turned up http://en.literateprograms.org/UUencode_(C) I cannot later ge

Re: NSTask and uudecode

2010-01-27 Thread Stephen J. Butler
On Wed, Jan 27, 2010 at 11:37 AM, gMail.com wrote: > I have to decode a uuencoded NSString in memory so I use NSTask to launch > the unix command uudecode. If I set the output to a file, it works. But if I > setStandardOutput to a NSFileHandle I cannot later get any availableData. > Can you please

Re: Uncaught exceptions not terminating my app

2010-01-27 Thread Paul Sanders
As I went on something of a voyage of discovery with this, I thought I would write up my findings. Maybe this will save someone the pain I went through. It's rather a long post, sorry about that. My basic tenet is that I want to catch unexpected exceptions and terminate my app in a way that p

Re: Uncaught exceptions not terminating my app

2010-01-27 Thread Jens Alfke
On Jan 27, 2010, at 11:01 AM, Paul Sanders wrote: My basic tenet is that I want to catch unexpected exceptions and terminate my app in a way that produces a crash report containing a proper stack trace. As a developer I understand your desire; but as a user, I would rather have your app

[Moderator] Do not discuss iPad or updated iPhone OS here

2010-01-27 Thread Scott Anguish
A pre-emptive note. Do not discuss the iPad product or any updated version of the iPhone OS here. It is not allowed. If you do, you’ll be moderated. Scott [moderator]___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin

Re: Uncaught exceptions not terminating my app

2010-01-27 Thread Sean McBride
On 1/27/10 11:27 AM, Jens Alfke said: >> My basic tenet is that I want to catch unexpected exceptions and >> terminate my app in a way that produces a crash report containing a >> proper stack trace. > >As a developer I understand your desire; but as a user, I would rather >have your app pop up an

Re: [Moderator] Do not discuss iPad or updated iPhone OS here

2010-01-27 Thread David Rowland
On Jan 27, 2010, at 11:30 AM, Scott Anguish wrote: A pre-emptive note. Do not discuss the iPad product or any updated version of the iPhone OS here. It is not allowed. If you do, you’ll be moderated. Is that like, uuhh, "fixed"? ___ Cocoa-

Re: [Moderator] Do not discuss iPad or updated iPhone OS here

2010-01-27 Thread Scott Anguish
No, that’s not changed and won’t change until such a time as an NDA is lifted on the new SDK. On Jan 27, 2010, at 2:35 PM, David Rowland wrote: On Jan 27, 2010, at 11:30 AM, Scott Anguish wrote: A pre-emptive note. Do not discuss the iPad product or any updated version of the iPhone OS

NSBundle unloading crash

2010-01-27 Thread Jonathan Guy
Hi all This problem has me pretty stumped. I've been trying to figure this out for about a week now with no success. I have an embedded framework which itself has two embedded bundles. The two bundles contain the same code of an open source project but just different versions. The framework is d

Re: PDF View - smooth text?

2010-01-27 Thread John Calhoun
On Jan 27, 2010, at 2:01 AM, Keith Blount wrote: > In Preview app's preferences, under the "PDF" pane, there is a checkbox > entitled "Smooth text and line art". Does anyone know what setting this > corresponds to in PDFView or the PDFKit (if, indeed, any, and it isn't > something specific to Pr

Re: Global in NSApplication

2010-01-27 Thread Graham Cox
On 28/01/2010, at 3:37 AM, Scott Ribe wrote: > Of course this code does not necessarily *prevent* you from making multiple > Debug instances, but neither does the code Graham posted if you try to call > [Debug sharedDebug] from multiple threads. Calling a singleton method from multiple threads

Re: Global in NSApplication

2010-01-27 Thread Scott Ribe
> Calling a singleton method from multiple threads does not make multiple > instances. The code you posted has a race condition, and can create multiple instances when called from different threads. -- Scott Ribe scott_r...@killerbytes.com http://www.killerbytes.com/ (303) 722-0567 voice _

CG Path in CALayer versus NSView

2010-01-27 Thread Richard Somers
Draw in a CALayer and a NSView using the same CG routines with with a user interface scale factor other than 1.0. CALayer will not scale the path but NSView will. Is that right? --Richard ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Ple

Re: Global in NSApplication

2010-01-27 Thread Kyle Sluder
On Wed, Jan 27, 2010 at 1:51 PM, Scott Ribe wrote: > The code you posted has a race condition, and can create multiple instances > when called from different threads. This is true. My favorite way of avoiding it: + (Foo *)sharedFoo { static Foo *instance; static dispatch_once_t once; dispa

Re: Global in NSApplication

2010-01-27 Thread Graham Cox
On 28/01/2010, at 8:51 AM, Scott Ribe wrote: > The code you posted has a race condition, and can create multiple instances > when called from different threads. Ah, that's different. I understood you to mean that it ALWAYS created multiple instances. Any threaded programming requires a lot of

Re: Global in NSApplication

2010-01-27 Thread Scott Ribe
> Ah, that's different. I understood you to mean that it ALWAYS created multiple > instances. No, sorry, I only meant that it did not guarantee a single instance. The point I was (obtusely) attempting to make was: do not complicate things with a stronger-than-necessary guarantee; take into account

Re: NSBundle unloading crash

2010-01-27 Thread Greg Parker
On Jan 27, 2010, at 2:01 AM, Jonathan Guy wrote: > This problem has me pretty stumped. I've been trying to figure this out for > about a week now with no success. I have an embedded framework which itself > has two embedded bundles. The two bundles contain the same code of an open > source proje

Re: Ellipsis + Proper Expansion Frame + HScroll-Edit in 10.6 NSTableView (was "Clipped Tooltip")

2010-01-27 Thread Jerry Krinock
I gave up on trying to find the magic formula of settings which would make my custom subclassed NSTextFieldCell return the correct expansion frame, as the cell which is returned by -[NSTableColumn dataCell] does. Instead, I overrode expansionFrameWithFrame:inView:, replacing the multi-line fram

Re: CALayer maybe silly question

2010-01-27 Thread David Duncan
On Jan 27, 2010, at 7:27 AM, vincent habchi wrote: > Let's say I have a ScrollLayer with 9 underlying tiles (CALayer). Each tile > has a delegate to provide contents via DrawLayer:inContext:. At init time, > these delegates create a linked object that spawns a thread that runs its run > loop (I

Re: Ellipsis + Proper Expansion Frame + HScroll-Edit in 10.6 NSTableView (was "Clipped Tooltip")

2010-01-27 Thread Corbin Dunn
> > > However, I know there is a magic formula somewhere, because when I use the > default cell returned by -[NSTableColumn dataCell], all three requirements > are satisfied. Statically, I see that it sets all three attributes to NO. > But when I try this with a raw NSTextFieldCell, only req

Re: Hyperlinks in Table Views

2010-01-27 Thread Corbin Dunn
> I think I may have got this to work, so here goes: > > The data cell for the table column displaying the hyperlink is now a custom > NSTextFieldCell with the following implementation over-ridden: > > - (NSUInteger)hitTestForEvent: (NSEvent *)event > i

10.6 : Class xxx does not implement the 'NSWindowDelegate' protocol

2010-01-27 Thread Peter C
I try to compile this code (snippet) for 10.6, ends up with error message, "Class SomeWinController does not implement the 'NSWindowDelegate' protocol" @interface SomeWinController : NSWindowController - (void) windowDidLoad { [[self window] setDelegate:self]; } At the moment target is set to

Re: 10.6 : Class xxx does not implement the 'NSWindowDelegate' protocol

2010-01-27 Thread Graham Cox
On 28/01/2010, at 1:20 PM, Peter C wrote: > I try to compile this code (snippet) for 10.6, ends up with error message, > > "Class SomeWinController does not implement the 'NSWindowDelegate' protocol" > > @interface SomeWinController : NSWindowController > > - (void) windowDidLoad > { > [[self

Re: Ellipsis + Proper Expansion Frame + HScroll-Edit in 10.6 NSTableView (was "Clipped Tooltip")

2010-01-27 Thread Jerry Krinock
On 2010 Jan 27, at 15:38, Corbin Dunn wrote: > NSTableColumn's default cell is initialized with... > > NSTextFieldCell > setEditable:YES > setScrollable:YES > setDrawsBackground:NO > setFont:(systemFontSize) > setLineBreak:NSLineBreakByTruncatingTail > setBackgroundColor:[NSColor controlBackgrou

Re: CALayer maybe silly question

2010-01-27 Thread vincent habchi
David, Le 28 janv. 2010 à 00:09, David Duncan a écrit : > Are you calling -drawLayer:inContext: yourself? if you are, don't do that - > just call -setNeedsDisplay on the layer, it will do the right thing. Yes, that exactly what I do: I have set up a custom loop event, that I trigger each time

Size of Core Animation Layer

2010-01-27 Thread K . Darcy Otto
I'm having some difficulties translating between a Core Animation layer size, and the size of that layer in the NSView subclass I'm using. I can identify the layer from a mouseclick without difficulty, using the following code: -(void)mouseDown:(NSEvent *)theEvent { NSPoint translated = [