Re: text highlighting with CALayer and NSTextVew

2012-08-23 Thread Kyle Sluder
On Aug 23, 2012, at 6:53 PM, Koen van der Drift wrote: > > On Aug 23, 2012, at 9:45 PM, Koen van der Drift > wrote: > >> convertRectToBase > > > That should be convertRectToLayer. Sadly, -convertRect:toLayer: and -convertRect:toBacking: are both broken on 10.7.4 and 10.7.5 for views that

Re: text highlighting with CALayer and NSTextVew

2012-08-23 Thread Koen van der Drift
On Aug 23, 2012, at 9:45 PM, Koen van der Drift wrote: > convertRectToBase That should be convertRectToLayer. - Koen. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Cont

Re: text highlighting with CALayer and NSTextVew

2012-08-23 Thread Koen van der Drift
I think I figured it out. I had to add a call to convertRectToBase to make the CALayers show up in the right place in the NSView. Here's my current code, which is called whenever a particular area in my text needs to be highlighted through a notification. NSUInteger rectCount;

Re: Sandboxing die.die.die

2012-08-23 Thread Graham Cox
On 24/08/2012, at 10:47 AM, Kyle Sluder wrote: > You're using it correctly, but I'm suggesting that the better approach would > not use it at all. Rather than constructing a URL string and creating an > NSURL out of it, it's better to create a file path and create an NSURL with > +fileURLWith

Re: Sandboxing die.die.die

2012-08-23 Thread Kyle Sluder
On Aug 23, 2012, at 5:41 PM, Graham Cox wrote: > > Hang on, given the above string (which as far as I can tell is a 'proper' URL > and not just a path), +URLWithString works fine and > +fileURLWithPath:isDirectory makes a complete hash of it. Well, I was operating under the assumption that yo

Re: Sandboxing die.die.die

2012-08-23 Thread Graham Cox
On 24/08/2012, at 10:11 AM, Kyle Sluder wrote: > Just FYI, this is not a valid URL. The space in "iPhoto Library" needs > to be percent-encoded. It is, in fact. I retyped it in Mail. >> So I think I'm correct to be using [NSURL URLWithString:] here (tell me >> if that's not right!) and that do

Re: Sandboxing die.die.die

2012-08-23 Thread Kyle Sluder
On Thu, Aug 23, 2012, at 04:33 PM, Graham Cox wrote: > In fact the string doesn't contain a tilde. I think in summarising my > issue I glossed over the exact situation, which is that I have a string > which is "file://localhost/Users//Pictures/iPhoto Library/Album.xml". Just FYI, this is not a val

Re: Sandboxing die.die.die

2012-08-23 Thread Graham Cox
On 24/08/2012, at 3:11 AM, Greg Parker wrote: > On Aug 22, 2012, at 7:14 PM, Graham Cox wrote: >> Turns out the problem I was having with this is because of the behaviour of >> [NSURL fileURLWithPath:isDirectory:]. >> >> When I passed the path to the iPhoto database file (~/Pictures/iPhoto >

Re: Modal window and app Quit

2012-08-23 Thread Andy Lee
Maybe you needed to send the window orderOut: and/or close? --Andy On Aug 23, 2012, at 3:56 PM, tridiak wrote: > > On 24/08/2012, at 7:44 AM, Jens Alfke wrote: > >> >> On Aug 23, 2012, at 12:06 PM, tridiak wrote: >> >>> I dismiss the panel using [NSApp stopModal]. It consists of a single O

Re: How to sandbox an included framework

2012-08-23 Thread Sean McBride
On Thu, 16 Aug 2012 08:04:22 +0100, Antonio Nunes said: >>> Can anyone point me to documentation or a tutorial on how to sandbox >my third party framework. (I do have access to its source code, if >necessary, but I did not see any obvious option to sandbox the framework >when I opened and examined

Re: Modal window and app Quit

2012-08-23 Thread tridiak
On 24/08/2012, at 7:44 AM, Jens Alfke wrote: > > On Aug 23, 2012, at 12:06 PM, tridiak wrote: > >> I dismiss the panel using [NSApp stopModal]. It consists of a single OK >> button and an editable textfield (with a number formatter). >> Would the edit field being screwing things up? > > No,

Re: Modal window and app Quit

2012-08-23 Thread Jens Alfke
On Aug 23, 2012, at 12:06 PM, tridiak wrote: > I dismiss the panel using [NSApp stopModal]. It consists of a single OK > button and an editable textfield (with a number formatter). > Would the edit field being screwing things up? No, that all sounds reasonable. And it also sounds as though pr

Re: Modal window and app Quit

2012-08-23 Thread tridiak
On 24/08/2012, at 6:34 AM, Jens Alfke wrote: > > On Aug 23, 2012, at 10:52 AM, tridiak wrote: > >> I have a simple document app-wide modal window shown using [NSApp >> showModal:]. >> It works all fine and dandy. >> Problem is, if Cmd-Q is initiated, it does a highlight of the Application >>

Re: Modal window and app Quit

2012-08-23 Thread Jens Alfke
On Aug 23, 2012, at 10:52 AM, tridiak wrote: > I have a simple document app-wide modal window shown using [NSApp showModal:]. > It works all fine and dandy. > Problem is, if Cmd-Q is initiated, it does a highlight of the Application > menu, makes a beep That's correct behavior; modal windows a

Re: DisplayReconfigurationCallBack with nil cgDisplayID

2012-08-23 Thread Michael Babin
On Aug 23, 2012, at 8:55 AM, Trygve Inda wrote: > Very occasionally when my MyDisplayReconfigurationCallBack is called: > > void DisplayReconfigurationCallBack (CGDirectDisplayID cgDisplayID, > CGDisplayChangeSummaryFlags flags, void *userInfo) > > The system sends me a nil value for cgDisplayI

Re: Sandboxing die.die.die

2012-08-23 Thread Mike Abdullah
On 23 Aug 2012, at 18:11, Greg Parker wrote: > On Aug 22, 2012, at 7:14 PM, Graham Cox wrote: >> Turns out the problem I was having with this is because of the behaviour of >> [NSURL fileURLWithPath:isDirectory:]. >> >> When I passed the path to the iPhoto database file (~/Pictures/iPhoto >>

Modal window and app Quit

2012-08-23 Thread tridiak
I have a simple document app-wide modal window shown using [NSApp showModal:]. It works all fine and dandy. Problem is, if Cmd-Q is initiated, it does a highlight of the Application menu, makes a beep and the Quit menu item becomes permanently disabled after the modal window has been dismissed.

Re: Sandboxing die.die.die

2012-08-23 Thread Greg Parker
On Aug 22, 2012, at 7:14 PM, Graham Cox wrote: > Turns out the problem I was having with this is because of the behaviour of > [NSURL fileURLWithPath:isDirectory:]. > > When I passed the path to the iPhoto database file (~/Pictures/iPhoto > Library/Album.xml) the resulting URL was bizarrely alt

Re: text highlighting with CALayer and NSTextVew

2012-08-23 Thread Koen van der Drift
On Thu, Aug 23, 2012 at 11:23 AM, Kyle Sluder wrote: > On Aug 22, 2012, at 5:21 PM, Koen van der Drift > wrote: > >> I'd like to add some custom text highlighting to my NSTextView, so I added >> the following code to the NSTextView init method: >> >>CALayer *aLayer = [CALayer layer]; >>

Re: text highlighting with CALayer and NSTextVew

2012-08-23 Thread Kyle Sluder
On Aug 22, 2012, at 5:21 PM, Koen van der Drift wrote: > I'd like to add some custom text highlighting to my NSTextView, so I added > the following code to the NSTextView init method: > >CALayer *aLayer = [CALayer layer]; >[self setWantsLayer: YES]; >[self setLayer: aLayer]; This

Re: text highlighting with CALayer and NSTextVew

2012-08-23 Thread Koen van der Drift
On Thu, Aug 23, 2012 at 8:09 AM, Graham Cox wrote: > > On 23/08/2012, at 9:16 PM, Koen van der Drift > wrote: > >> Another update, I guess I love to talk to myself. >> >> I got the drawing part done as follows: >> >> >> CALayer *aLayer = [CALayer layer]; >> NSRect r = [self.layo

DisplayReconfigurationCallBack with nil cgDisplayID

2012-08-23 Thread Trygve Inda
Very occasionally when my MyDisplayReconfigurationCallBack is called: void DisplayReconfigurationCallBack (CGDirectDisplayID cgDisplayID, CGDisplayChangeSummaryFlags flags, void *userInfo) The system sends me a nil value for cgDisplayID When I try to cycle through the array of NSScreen to find t

NSDocument package saving invalidates wrapper? Options?

2012-08-23 Thread Markus Spoettl
I have an NSDocument based app that has uses packages do to store a complex structure. When I open a document, I keep the wrapper around handed to the document in -readFromFileWrapper:ofType:error: in order to lazy-load parts of the package when my app needs them. Similarly, I keep the wrappe

Re: Sandboxing die.die.die

2012-08-23 Thread Mike Abdullah
On 23 Aug 2012, at 11:52, Graham Cox wrote: > > On 23/08/2012, at 6:48 PM, Mike Abdullah wrote: > >> Your description here sounds unlikely. The URL APIs are extremely >> well-tested and robust; I would be surprised if you really have found a bug >> like this. >> >> What is the path you were

Re: text highlighting with CALayer and NSTextVew

2012-08-23 Thread Graham Cox
On 23/08/2012, at 9:16 PM, Koen van der Drift wrote: > boundingRectForGlyphRange Also, just so you're aware, glyphs != characters. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator com

Re: text highlighting with CALayer and NSTextVew

2012-08-23 Thread Graham Cox
On 23/08/2012, at 9:16 PM, Koen van der Drift wrote: > Another update, I guess I love to talk to myself. > > I got the drawing part done as follows: > > > CALayer *aLayer = [CALayer layer]; > NSRect r = [self.layoutManager boundingRectForGlyphRange: aRange > inTextContainer:

Re: text highlighting with CALayer and NSTextVew

2012-08-23 Thread Koen van der Drift
Another update, I guess I love to talk to myself. I got the drawing part done as follows: CALayer *aLayer = [CALayer layer]; NSRect r = [self.layoutManager boundingRectForGlyphRange: aRange inTextContainer: self.textContainer]; aLayer.backgroundColor = CGColorCreate

Re: Sandboxing die.die.die

2012-08-23 Thread Graham Cox
On 23/08/2012, at 6:48 PM, Mike Abdullah wrote: > Your description here sounds unlikely. The URL APIs are extremely well-tested > and robust; I would be surprised if you really have found a bug like this. > > What is the path you were sending into +fileURLWith… ? Your description > suggests i

Re: text highlighting with CALayer and NSTextVew

2012-08-23 Thread Koen van der Drift
On Aug 22, 2012, at 8:21 PM, Koen van der Drift wrote: > > CALayer *aLayer = [CALayer layer]; > [self setWantsLayer: YES]; > [self setLayer: aLayer]; Turning on CA in IB seems to work instead of adding this code to my view's code. - Koen. __

Re: Sandboxing die.die.die

2012-08-23 Thread Mike Abdullah
On 23 Aug 2012, at 03:14, Graham Cox wrote: > > On 23/08/2012, at 9:37 AM, Graham Cox wrote: > >> Trying to work around this is proving impossible with the current sandbox >> implementation - there are too many opaque hacks in the system that mean you >> cannot trust the URLs you get from an