Re: NSApplication and command line args

2009-05-09 Thread Ken Thomases
On May 8, 2009, at 5:03 PM, Andrew Farmer wrote: A much simpler solution would be to preprocess the arguments which you pass to NSApplicationMain. Run through everything in argv, then create a new array of arguments from that with all arguments your application wants to handle removed and p

WebView PolicyDelegate issue

2009-05-09 Thread Alex Mills
Hey All, I have a WebView that has editing mode turned on and I export and insert html using setInnerHTML etc. To prevent links from sending the webview to the links address I implemented the decidePolicyForNavigation. delegate method. The code in this method opens the linked url in t

Re: Hex to NSString or NSData

2009-05-09 Thread Mr. Gecko
I was able to get done what I wanted with this. int char2hex(unichar c) { switch (c) { case '0' ... '9': return c - '0'; case 'a' ... 'f': return c - 'a' + 10; case 'A' ... 'F': return c - 'A' + 10; default: return -1;

Re: How to solve the "command developer usr bin gcc-4.0 failed with exit code 1" mistake?

2009-05-09 Thread Marcel Weiher
On May 9, 2009, at 20:15 , Chris Hanson wrote: On May 9, 2009, at 7:39 PM, Bright wrote: when I open a Apple's samplecode of cocoa and run it, the mistake of “command developer usr bin gcc-4.0 failed with exit code 1" is occur. How to solve it? Are you just double-clicking the proj

Re: detect option key on startup

2009-05-09 Thread Chris Hanson
On May 9, 2009, at 11:22 AM, Mitchell Livingston wrote: I want to be able to detect if the option key is being held down on launch. I found reference to GetCurrentKeyModifiers(), but that seems to be depreciated/not recommended. Depending on when you're trying to check for the key down, I'd

Re: How to solve the "command developer usr bin gcc-4.0 failed with exit code 1" mistake?

2009-05-09 Thread Chris Hanson
On May 9, 2009, at 7:39 PM, Bright wrote: when I open a Apple's samplecode of cocoa and run it, the mistake of “command developer usr bin gcc-4.0 failed with exit code 1" is occur. How to solve it? Are you just double-clicking the projects in /Developer/Examples and trying to build

Re: Hex to NSString or NSData

2009-05-09 Thread Andrew Farmer
On 09 May 09, at 18:58, Gwynne Raskind wrote: c = hexCharToNibble(i % 255); May want to use the & operator instead of %. IIRC, modulus needs integer division, and may be taking more time than the inlined hexCharToNibble. Yeah, but since that was only done as part of a benchmark, it didn't

How to solve the "command developer usr bin gcc-4.0 failed with exit code 1" mistake?

2009-05-09 Thread Bright
hi when I open a Apple's samplecode of cocoa and run it, the mistake of “command developer usr bin gcc-4.0 failed with exit code 1" is occur. How to solve it? thank you! ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not

Re: Hex to NSString or NSData

2009-05-09 Thread Gwynne Raskind
On May 9, 2009, at 10:20 PM, Greg Guerin wrote: Yeah, but since that was only done as part of a benchmark, it didn't much matter. It may have skewed the numbers upwards unnecessarily, but wouldn't have changed their relation to each other since the same sequence was calculated for all three

Re: Hex to NSString or NSData

2009-05-09 Thread Greg Guerin
Gwynne Raskind wrote: Yeah, but since that was only done as part of a benchmark, it didn't much matter. It may have skewed the numbers upwards unnecessarily, but wouldn't have changed their relation to each other since the same sequence was calculated for all three versions. It changes t

Re: Hex to NSString or NSData

2009-05-09 Thread Gwynne Raskind
On May 9, 2009, at 9:19 PM, Greg Guerin wrote: char hexCharToNibbleL(char nibble) Is safer as: char hexCharToNibbleL(unsigned char nibble) Otherwise consider what happens if 'char' is signed by default and the incoming value is 0xB0. const char lt[255] = Should be: const char lt[256] or:

Re: Hex to NSString or NSData

2009-05-09 Thread Greg Guerin
Gwynne Raskind wrote: char hexCharToNibbleL(char nibble) Is safer as: char hexCharToNibbleL(unsigned char nibble) Otherwise consider what happens if 'char' is signed by default and the incoming value is 0xB0. const char lt[255] = Should be: const char lt[256] or: const char lt

Re: Hex to NSString or NSData

2009-05-09 Thread Clark Cox
On Sat, May 9, 2009 at 4:05 PM, Gwynne Raskind wrote: > On May 9, 2009, at 5:20 PM, Marcel Weiher wrote: >>> >>> int hexDigitToInt(char d) >>> { >>>  int result; >>>  switch (d) { >>>      case '0': result = 0; break; >>>      case '1': result = 1; break; >>> [snip] >>>      case 'E': result = 14;

Re: Subject: detect option key on startup

2009-05-09 Thread Eric Schlegel
On May 9, 2009, at 4:32 PM, Mike Abdullah wrote: That won't work because the event loop is not set up yet. You want to use GetCurrentEventKeyModifiers() Actually you want to use GetCurrentKeyModifiers, not GetCurrentEventKeyModifiers, since GetCurrentEventKeyModifiers returns the state o

Re: Subject: detect option key on startup

2009-05-09 Thread Mike Abdullah
That won't work because the event loop is not set up yet. You want to use GetCurrentEventKeyModifiers() On 9 May 2009, at 23:58, Mitchell Livingston wrote: In what method would that need to be in to get the key on startup? I tried without luck in init and awakeFromNib. On Saturday, May 09,

Re: Hex to NSString or NSData

2009-05-09 Thread Gwynne Raskind
On May 9, 2009, at 5:20 PM, Marcel Weiher wrote: int hexDigitToInt(char d) { int result; switch (d) { case '0': result = 0; break; case '1': result = 1; break; [snip] case 'E': result = 14; break; case 'F': result = 15; break; default: result = 0xFF;

RE: Subject: detect option key on startup

2009-05-09 Thread Mitchell Livingston
In what method would that need to be in to get the key on startup? I tried without luck in init and awakeFromNib. On Saturday, May 09, 2009, at 06:48PM, "Kirk Kerekes" wrote: > >How About: ([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask) > > > > __

RE: Subject: detect option key on startup

2009-05-09 Thread Kirk Kerekes
How About: ([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask) ___ 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 cocoa-dev-admin

Re: Hex to NSString or NSData

2009-05-09 Thread Marcel Weiher
Hi Andreas, that's an interesting way to do the conversion. On May 9, 2009, at 10:50 , Andreas Grosam wrote: int hexDigitToInt(char d) { int result; switch (d) { case '0': result = 0; break; case '1': result = 1; break; [snip] case 'E': result = 14; break; cas

Re: converting a characer to a keycode

2009-05-09 Thread kvic...@pobox.com
At 9:14 PM -0700 5/8/09, glgue...@amug.org wrote: ken wrote: the only way i can think to perform this conversion is to itereate over the virtual key codes 0-127 (with various combinations of shift and option keys) until i find the one that matches the user input character. and while th

Re: [Q] Correct way to identify an application, Launch Services, & Spaces

2009-05-09 Thread Uli Kusterer
On 08.05.2009, at 19:51, Eric Gorr wrote: If I look at the Launch Services database, I see: bundle id:# name: myapp in both cases. I'm just not sure where Spaces is getting the 'myapp 2008' string. The info.plist for myapp 2008 does not contain the string '

Re: Custom NSImageView

2009-05-09 Thread Livio Isaia
Jack Carbaugh ha scritto: try clicking near the TOP of the column of the image cell whose properties you want to modify. On May 8, 2009, at 8:50 AM, Livio Isaia wrote: Corbin Dunn ha scritto: On May 7, 2009, at 8:16 AM, Livio Isaia wrote: I create MyImageView (from NSImageView) which mus

detect option key on startup

2009-05-09 Thread Mitchell Livingston
Hello, I want to be able to detect if the option key is being held down on launch. I found reference to GetCurrentKeyModifiers(), but that seems to be depreciated/not recommended. Thanks, Mitch ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.co

Re: Hex to NSString or NSData

2009-05-09 Thread Andreas Grosam
While there are many ways to skin a cat, I would use this plain C function to do the actual conversion: int hexDigitToInt(char d) { int result; switch (d) { case '0': result = 0; break; case '1': result = 1; break; case '2': result = 2; break; case '3':

Re: Confounding crash, not much to go on except a stack trace

2009-05-09 Thread Harry Jordan
Thank you for your reply. I was using 10.5.5 at the time. I wasn't running any extra threads at the time. But I've fiddled with the build settings and updated to 10.5.6 and since then the problem hasn't recurred. I'm not sure which one did the trick. As far as I know this only affected my app, when

Re: Converting NSString to C++ std::string

2009-05-09 Thread Michael Ash
On Sat, May 9, 2009 at 8:34 AM, Andrew Wood wrote: > Investigated it a bit further.  It works if I declare the string in the > method where Im doing the assignment, but what I was trying to do, and > really need to do, is decalre the std::string in the app controllers header > file, so that its vi

[iPhone] grouped tableview section title seeing double

2009-05-09 Thread James Lin
Hi, I don't know if anyone encountered the same problem. when i try to set the section title for a 1 section grouped tableview using titleForHeaderInSection, for some unknown reason, there are two styles of headers showing at the same time overlaying each other. Anyone ever encounter the

Re: Converting NSString to C++ std::string

2009-05-09 Thread Andrew Wood
Investigated it a bit further. It works if I declare the string in the method where Im doing the assignment, but what I was trying to do, and really need to do, is decalre the std::string in the app controllers header file, so that its visible to all methods in the controller, then do the

Adjusting menu bar transparency

2009-05-09 Thread Mark Woods
I'm making an app to adjust the opacity of the menu bar in Leopard. I am aware of the environment variables you can set within the com.apple.WindowServer.plist file but I do not like this method for two reasons: 1) You must restart the computer 2) If something goes wrong, it can render the

Re: Hex to NSString or NSData

2009-05-09 Thread Gwynne Raskind
On May 8, 2009, at 11:34 PM, Mr. Gecko wrote: And how could that make @"68656c6c6f" into @"hello"? Thinking this will help you understand what I'm trying to do... On May 8, 2009, at 10:23 PM, Jerry Krinock wrote: On 2009 May 08, at 20:16, Mr. Gecko wrote: Hello, I have a string with hex and I