NSDocument autosave doesn't show as edited

2012-05-23 Thread Martin Hewitson
Dear list, I have an NSDocument app that implements autosave and versions on Lion. The NSDocument subclass is essentially a text editor. If I create a new document and type something in the text view then the 'Edited' tag appears. I then save the document to disk. After this, typing in the text

NSMutableData capacity

2012-05-23 Thread Andreas Grosam
Is there an easy way to figure out the capacity of a NSMutableData object - that is the number of bytes that can be written to the data object without causing it to reallocate the internal buffer or invalidating the base pointer to the internal buffer? Example: NSMutableData* data = .. [dat

Re: NSDocument autosave doesn't show as edited

2012-05-23 Thread Kevin Perry
Does "Revert to Last Saved" become available after saving and editing? Which NSDocument methods are you overriding? It is indeed -updateChangeCount: that controls the 'Edited' state. You might try overriding with a call to super and setting a breakpoint or adding a log to make sure it's being c

Re: group row custom drawing nstableview

2012-05-23 Thread Corbin Dunn
Hi Rick, On May 22, 2012, at 9:14 PM, Rick C. wrote: > Hi, > > I'm having some trouble doing a custom drawing for my group row in a > view-based nstableview. First of all I subclassed NSTableRowView is this > correct? Yes, that is correct. > And if so the problem I'm having is to recreate

Re: NSDocument autosave doesn't show as edited

2012-05-23 Thread Martin Hewitson
On May 23, 2012, at 05:30 PM, Kevin Perry wrote: > Does "Revert to Last Saved" become available after saving and editing? Which > NSDocument methods are you overriding? I override: -autosavesInPlace -readFromURL:ofType:error: -writeToURL:ofType:error: -saveDocument: plus some others (like -pr

Re: NSDocument autosave doesn't show as edited

2012-05-23 Thread Kevin Perry
On May 23, 2012, at 9:43 AM, Martin Hewitson wrote: >> It is indeed -updateChangeCount: that controls the 'Edited' state. You might >> try overriding with a call to super and setting a breakpoint or adding a log >> to make sure it's being called as expected (with NSChangeDone). That should >>

Re: NSDocument autosave doesn't show as edited

2012-05-23 Thread Kyle Sluder
On May 23, 2012, at 12:43 PM, Martin Hewitson wrote: > > On May 23, 2012, at 05:30 PM, Kevin Perry wrote: > >> Does "Revert to Last Saved" become available after saving and editing? Which >> NSDocument methods are you overriding? > > I override: > > -autosavesInPlace > -readFromURL:ofType:e

Re: NSMutableData capacity

2012-05-23 Thread Jens Alfke
On May 23, 2012, at 8:26 AM, Andreas Grosam wrote: > Is there an easy way to figure out the capacity of a NSMutableData object - > that is the number of bytes that can be written to the data object without > causing it to reallocate the internal buffer or invalidating the base pointer > to the

Strange behavior with App Sandbox and CoreData Document

2012-05-23 Thread Marco Dall'Antonia
Hi all, I'm making some tests with a new from scratch CoreData Document based application in Mac OS X 10.7.4 with autosave enabled and Sandbox. (I must "sandboxing" an existing application for the AppStore upload). All works fine with binary or xml type but not with SQLite. Step 1 - I can creat

Re: NSMutableData capacity

2012-05-23 Thread Jason Teagle
Is there an easy way to figure out the capacity of a NSMutableData >object - that is the number of bytes that can be written to the data object without causing it to reallocate the internal buffer or >invalidating the base pointer to the internal buffer? Can you not track the capacity yourself

Re: NSMutableData capacity

2012-05-23 Thread Fritz Anderson
On 23 May 2012, at 1:41 PM, Jason Teagle wrote: > Unless I'm missing something, if you use ... > -initWithCapacity:some_capacity > > to guarantee it has the capacity (but not necessarily allocated yet) followed > by > > -initWithLength:some_capacity DO NOT DO THIS. -init... is a

Re: NSMutableData capacity

2012-05-23 Thread Jason Teagle
DO NOT DO THIS. -init... is a one-time operation in Cocoa. The call is privileged to make >destructive initializations to the object, to assume that its initial state >can be ignored, and even to replace the object entirely. Subsequent -init... calls will in turn assume they can make destructi

Re: NSMutableData capacity

2012-05-23 Thread Jens Alfke
On May 23, 2012, at 12:15 PM, Jason Teagle wrote: > Fair point, and well noted. I think it's a shame that objects would be so > cavalier about their existing state (isn't that just sloppy? Makes it far too > easy to leak memory) No, it's part of the contract of object initialization. Initializ

Debugging uiscrollview not responding to user

2012-05-23 Thread Rick Mann
I've got a UIScrollView that's supposed to page horizontally. It works correctly if programmatically scrolled, but user touches to scroll it are getting eaten by something else. Is there any way to debug the touches, and see who's getting them? This used to work, but I've been doing some other

Re: Debugging uiscrollview not responding to user

2012-05-23 Thread Conrad Shultz
On 5/23/12 3:24 PM, Rick Mann wrote: > I've got a UIScrollView that's supposed to page horizontally. It > works correctly if programmatically scrolled, but user touches to > scroll it are getting eaten by something else. > > Is there any way to debug the touches, and see who's getting them? > This

Re: Debugging uiscrollview not responding to user

2012-05-23 Thread Rick Mann
On May 23, 2012, at 15:51 , Conrad Shultz wrote: > On 5/23/12 3:24 PM, Rick Mann wrote: >> I've got a UIScrollView that's supposed to page horizontally. It >> works correctly if programmatically scrolled, but user touches to >> scroll it are getting eaten by something else. >> >> Is there any wa

Re: NSMutableData capacity

2012-05-23 Thread Wade Tregaskis
> Can you not track the capacity yourself? Unless I'm missing something, if you > use > >+dataWithCapacity:some_capacity The docs note that this doesn't necessarily pre-allocate the given capacity. You can test that trivially by asking for a capacity of several gigabytes. In a nutshell, t

Re: PDFThumbnailView Problem (kind of)

2012-05-23 Thread Matthew Weinstein
You can't believe how easy that was to implement in cocoa: [myThumbnailView setThumbnailSize: [myThumbnailView thumbnailSize]]; That's it; works like a charm. On May 22, 2012, at 11:37 PM, Antonio Nunes wrote: > On 23 May 2012, at 03:53, Matthew Weinstein wrote: > >> I have a typical t

Re: NSMutableData capacity

2012-05-23 Thread Jens Alfke
On May 23, 2012, at 7:30 PM, Wade Tregaskis wrote: > If there's a performance concern, using IMP caching. The cost of the > function call to retrieve the bytes pointer is really trivial. Or just manage your own memory block using malloc / realloc / free. It's not that much more work than usin

Re: group row custom drawing nstableview

2012-05-23 Thread Rick C.
Thanks Corbin for the reply. Ok I will continue with NSTableRowView and see if I can get the floating right this time. I'll let you know thanks again! rc On May 24, 2012, at 12:10 AM, Corbin Dunn wrote: > Hi Rick, > On May 22, 2012, at 9:14 PM, Rick C. wrote: > >> Hi, >> >> I'm having so

Re: NSMutableData capacity

2012-05-23 Thread Jason Teagle
+dataWithCapacity:some_capacity The docs note that this doesn't necessarily pre-allocate the given capacity. Which is exactly why I said, in the very same sentence, "to guarantee it has the capacity (but not necessarily allocated yet)". That's why you then call -setLength:, which writes

Re: NSMutableData capacity

2012-05-23 Thread Thomas Davie
On 24 May 2012, at 06:02, Jason Teagle wrote: >>>+dataWithCapacity:some_capacity >> >> The docs note that this doesn't necessarily pre-allocate the given capacity. > > Which is exactly why I said, in the very same sentence, "to guarantee it has > the capacity (but not necessarily allocated

Re: NSMutableData capacity

2012-05-23 Thread Jason Teagle
I'm not sure what you're hoping to achieve from this. NSMutableData's capacity is not a hard and fast upper limit to how much data can be put in there; it's just a hint to the API for roughly how much space should be found for the data. (The point - with setLength: - was to pre-allocate the m