Re: NSWorkspace issue

2014-05-06 Thread Ken Thomases
On May 7, 2014, at 12:02 AM, Varun Chandramohan wrote: >NSURL *fileURL = [NSURL URLWithString:@"/Users/usr/Desktop/libd.dylib"]; This is not correct. +[NSURL URLWithString:] expects a valid URL string. What you're providing is a file path string, which is not a URL string. A URL string m

NSWorkspace issue

2014-05-06 Thread Varun Chandramohan
Hi All, I wanted to open a Finder window from my app with a file pre-selected. The user could perform any Finder operations needed. I looked around the internet and it turns out the best way to do this is using NSWorkspace. - (void)applicationDidFinishLaunching:(NSNotification *)aNotification

Re: How to convert a UTF-8 byte offset into an NSString character offset?

2014-05-06 Thread Ken Thomases
On May 5, 2014, at 2:06 PM, Jens Alfke wrote: > How can I map a byte offset in a UTF-8 string back to the corresponding > character offset in the NSString it came from? I don't think there's a great way. You can do the reverse, map a character (really a UTF-16 code unit) offset to a UTF-8 offs

Re: Auto layout and re-sizing subviews.

2014-05-06 Thread Lorenzo Thurman
On May 6, 2014, at 5:31 PM, Daniel Höpfl wrote: > Hi, > > On 06.05.2014 23:32, lorenzo wrote: >> I posted this on SO, but got no answers, so I'm trying here and mabe I >> can get some help.: >> >> I have a window into which I horizontally add two subviews. Into each >> subview, I place a varia

Re: Document being reopened on launch during modal dialog

2014-05-06 Thread Graham Cox
On 7 May 2014, at 5:41 am, Quincey Morris wrote: > On May 6, 2014, at 12:28 , Lee Ann Rucker wrote: > >> This may be obvious, but did you try moving it all to >> applicationDidFinishLaunching: instead? > > IIUC, Steve’s point was that it won’t help in this case, because state > restoration

Re: How to convert a UTF-8 byte offset into an NSString character offset?

2014-05-06 Thread Jens Alfke
On May 6, 2014, at 11:12 AM, Quincey Morris wrote: > I’ve been thinking about this since your original question, and it seems to > me that this is a subtler problem than it seems: No offense, but I think you’re overanalyzing it. Remember I said that the UTF-8 data was generated from an NSStr

Re: Auto layout and re-sizing subviews.

2014-05-06 Thread Daniel Höpfl
Hi, On 06.05.2014 23:32, lorenzo wrote: > I posted this on SO, but got no answers, so I'm trying here and mabe I > can get some help.: > > I have a window into which I horizontally add two subviews. Into each > subview, I place a variable number of subviews made up of a vertical > slider, a text

Auto layout and re-sizing subviews.

2014-05-06 Thread lorenzo
I posted this on SO, but got no answers, so I'm trying here and mabe I can get some help.: I have a window into which I horizontally add two subviews. Into each subview, I place a variable number of subviews made up of a vertical slider, a text field rotated 90 degrees and placed to the left o

Re: Document being reopened on launch during modal dialog

2014-05-06 Thread Quincey Morris
On May 6, 2014, at 12:28 , Lee Ann Rucker wrote: > This may be obvious, but did you try moving it all to > applicationDidFinishLaunching: instead? IIUC, Steve’s point was that it won’t help in this case, because state restoration is initiated before applicationDidFinishLaunching:, and he’s ac

Re: Document being reopened on launch during modal dialog

2014-05-06 Thread Lee Ann Rucker
This may be obvious, but did you try moving it all to applicationDidFinishLaunching: instead? We used to have alerts in willFinish too, but now we have comments saying not to do that instead :) On May 6, 2014, at 11:23 AM, Mills, Steve wrote: > I'm looking at a crash log for our app that shows

Re: Document being reopened on launch during modal dialog

2014-05-06 Thread Quincey Morris
On May 6, 2014, at 11:55 , Mills, Steve wrote: > We're in [FinaleAppDelegate applicationWillFinishLaunching:] (like you > mentioned later), which is where we call our cross-platform InitApp function > to load things up, set up audio, etc. The audio engine has discovered a > sample rate mismatc

Re: Document being reopened on launch during modal dialog

2014-05-06 Thread Jerry Krinock
On 2014 May 06, at 11:23, Mills, Steve wrote: > How can we prevent this poor design choice from happening? How about: Subclass NSDocumentController and override -[NSDocumentController reopenDocumentForURL:withContentsOfURL:display:completionHandler:]. I think that, to get your subclass to to

Re: Document being reopened on launch during modal dialog

2014-05-06 Thread Kyle Sluder
On Tue, May 6, 2014, at 11:55 AM, Mills, Steve wrote: > > No. What I mean is that finishLaunching is still being executed. We're in > [FinaleAppDelegate applicationWillFinishLaunching:] (like you mentioned > later), which is where we call our cross-platform InitApp function to > load things up, se

Re: Document being reopened on launch during modal dialog

2014-05-06 Thread Mills, Steve
On May 6, 2014, at 13:44:42, Quincey Morris wrote: > On May 6, 2014, at 11:23 , Mills, Steve wrote: > >> I'm looking at a crash log for our app that shows our app is initting. >> During init ([NSApplication finishLaunching]) we discover a problem and put >> up a modal dialog using [NSApplica

Re: Document being reopened on launch during modal dialog

2014-05-06 Thread Quincey Morris
On May 6, 2014, at 11:23 , Mills, Steve wrote: > I'm looking at a crash log for our app that shows our app is initting. During > init ([NSApplication finishLaunching]) we discover a problem and put up a > modal dialog using [NSApplication runModalForWindow:]. During this modal run > loop, some

Document being reopened on launch during modal dialog

2014-05-06 Thread Mills, Steve
I'm looking at a crash log for our app that shows our app is initting. During init ([NSApplication finishLaunching]) we discover a problem and put up a modal dialog using [NSApplication runModalForWindow:]. During this modal run loop, something has decided that it would be a great time to handle

Re: How to convert a UTF-8 byte offset into an NSString character offset?

2014-05-06 Thread Quincey Morris
On May 5, 2014, at 12:06 , Jens Alfke wrote: > How can I map a byte offset in a UTF-8 string back to the corresponding > character offset in the NSString it came from? I’ve been thinking about this since your original question, and it seems to me that this is a subtler problem than it seems:

Re: How to convert a UTF-8 byte offset into an NSString character offset?

2014-05-06 Thread Mark Munz
> No, it would probably be to highlight that range of the string in a text view, which does require knowing the character range. Maybe you could take each of the ranges returned and create a string from the UTF8 byte stream; search for it in the original string; the results giving you the range fo

Re: Creating selector for nonexistent method

2014-05-06 Thread Fritz Anderson
On 29 Apr 2014, at 9:29 PM, Charles Srstka wrote: > int main (__unused int argc, __unused const char **argv) { >@autoreleasepool { >NSArray *array = [NSArray new]; #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wselector" > array = [array sortedArrayUsingSelect

Re: How to convert a UTF-8 byte offset into an NSString character offset?

2014-05-06 Thread Jens Alfke
On May 5, 2014, at 10:19 PM, Stephen J. Butler wrote: > What's your next step after doing the UTF8 to UTF16 range conversion? If it's > just going to be -[NSString substringWithRange:] then I'd strongly suggest > just doing -[NSString initWithBytes:length:encoding:] on the UTF8 string. No, i