ImageKit: what format does memory mode on 10.7 use?
When I use memory transfer mode on 10.8 , ImageKit calls my scannerDevice:didScanToURL:data: with an NSData object containing TIFF data that can be used with +[NSBitmapImageRep initWithData:]. When I try the same thing on 10.7, the NSData isn't TIFF, it looks like this: $ hexdump -C -n 256 ~/Desktop/Canon-MG4220mystery 70 00 00 00 01 00 00 00 f0 09 00 00 e7 0c 00 00 |p...| 0010 d0 1d 00 00 01 00 00 00 08 00 00 00 18 00 00 00 || 0020 01 00 00 00 00 00 00 00 01 00 00 00 2c 01 00 00 |,...| 0030 73 63 61 6e 6e 65 72 2e 72 65 66 6c 65 63 74 69 |scanner.reflecti| 0040 76 65 2e 52 47 42 2e 70 6f 73 69 74 69 76 65 00 |ve.RGB.positive.| 0050 ee ee ed f0 ee ed ed ef ee ef ee ee f0 ed ed ef || 0060 ed ea e9 f0 ed ed ee ee ef ef ed ee ec eb f0 eb || 0070 21 20 22 21 20 22 20 1f 22 23 23 22 22 20 22 23 |! ! .## #| 0080 24 23 24 25 23 27 2a 2b 53 53 4d a6 9e 9d dc dd |$#$%#'*+SSM.| 0090 df ea e7 e7 ea ea e9 ea eb eb eb eb ef ea ed eb || 00a0 ed eb ea eb eb e9 ea ea ea eb ea ec ec ed ec ed || 00b0 ea ec ec ec ec ed ea eb ee eb eb e9 ea eb ed ed || 00c0 ec ef eb eb ed ed ed ec ea ed eb eb eb eb ed ec || 00d0 ee e9 ea e6 e4 eb ed ea ec ec eb ed ee ea ec ef || 00e0 eb ec ed eb ea ec ea ed eb e9 eb ec eb ed ed ee || 00f0 ee ef ed ec ee ec ec ef eb ed ee ec ed ee ea ea || What format is this? Or better, How can I tell ImageKit that I want TIFF data? Thanks in advance! ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: ImageKit: what format does memory mode on 10.7 use?
This is reported as rdar://13966809 On May 22, 2013, at 3:24 PM, Eric Slosser eric.slos...@v-fx.com wrote: When I use memory transfer mode on 10.8 , ImageKit calls my scannerDevice:didScanToURL:data: with an NSData object containing TIFF data that can be used with +[NSBitmapImageRep initWithData:]. When I try the same thing on 10.7, the NSData isn't TIFF, it looks like this: $ hexdump -C -n 256 ~/Desktop/Canon-MG4220mystery 70 00 00 00 01 00 00 00 f0 09 00 00 e7 0c 00 00 |p...| 0010 d0 1d 00 00 01 00 00 00 08 00 00 00 18 00 00 00 || 0020 01 00 00 00 00 00 00 00 01 00 00 00 2c 01 00 00 |,...| 0030 73 63 61 6e 6e 65 72 2e 72 65 66 6c 65 63 74 69 |scanner.reflecti| 0040 76 65 2e 52 47 42 2e 70 6f 73 69 74 69 76 65 00 |ve.RGB.positive.| 0050 ee ee ed f0 ee ed ed ef ee ef ee ee f0 ed ed ef || 0060 ed ea e9 f0 ed ed ee ee ef ef ed ee ec eb f0 eb || 0070 21 20 22 21 20 22 20 1f 22 23 23 22 22 20 22 23 |! ! .## #| 0080 24 23 24 25 23 27 2a 2b 53 53 4d a6 9e 9d dc dd |$#$%#'*+SSM.| 0090 df ea e7 e7 ea ea e9 ea eb eb eb eb ef ea ed eb || 00a0 ed eb ea eb eb e9 ea ea ea eb ea ec ec ed ec ed || 00b0 ea ec ec ec ec ed ea eb ee eb eb e9 ea eb ed ed || 00c0 ec ef eb eb ed ed ed ec ea ed eb eb eb eb ed ec || 00d0 ee e9 ea e6 e4 eb ed ea ec ec eb ed ee ea ec ef || 00e0 eb ec ed eb ea ec ea ed eb e9 eb ec eb ed ed ee || 00f0 ee ef ed ec ee ec ec ef eb ed ee ec ed ee ea ea || What format is this? Or better, How can I tell ImageKit that I want TIFF data? ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
ImageKit questions
My question(s): Is there a better way to do any of the following? 1) If you want to tell an IKScannerDeviceView what values to use when it first appears, you might find the keys revealed by the following command helpful: defaults read com.apple.Image_Capture | grep IK_ These are undocumented, so YMMV. I logged rdar://13878930 to ask that they be documented, or that a supported method be created. 2) If you want to know when a scan is starting or finished, you'll can listening for these two notifications coming from the ICScannerDevice: IKScannerDeviceViewScanStarted, IKScannerDeviceViewScanDone. 3) If you want to know what resolution (aka DPI) was used for a scan that was just delivered to your delegate's -scannerDeviceView:didScanToURL:fileData:error:', you can examine [[deviceView selectedDevice] selectedFunctionalUnit]. ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Can I determine who is calling a delegate
Is your object also a NSComboBoxDataSource? The message you're getting is a member of that protocol. On Apr 26, 2013, at 8:18 PM, livinginlosange...@mac.com wrote: I have an object that is an NSComboBox delegate. ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
IKCameraDeviceView ignores 'memory' mode.
I'd like my IKCameraDeviceView to report downloaded images in memory-mode, but despite the fact that I have told it to use IKCameraDeviceViewTransferModeMemoryBased and it agrees that it heard me: (gdb)p (int) [cameraDeviceView mode] $1 = 1 ... it still passes the image as a URL to its delegate's cameraDeviceView:didDownloadFile:location:fileData:error: method, after downloading it to ~/Pictures. That's bad, because the user may have that folder open, and I don't want her to see a tmp file flash in and out of existence. Because I'm asking for memory mode, I deliberately don't display the file UI (aka 'Displays download location' in Interface Builder). I tried to workaround it by doing the following, but it ignores that too. cameraView.downloadsDirectory = [NSURL fileURLWithPath:NSTemporaryDirectory()]; Anyone have pearl she'd like to cast? ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
IKCameraDeviceView ignores 'memory' mode.
I'd like my IKCameraDeviceView to report downloaded images in memory-mode, but despite the fact that I have told it to use IKCameraDeviceViewTransferModeMemoryBased and it agrees that it heard me: (gdb)p (int) [cameraDeviceView mode] $1 = 1 ... it still passes the image as a URL to its delegate's cameraDeviceView:didDownloadFile:location:fileData:error: method, after downloading it to ~/Pictures. That's bad, because the user may have that folder open, and I don't want her to see a tmp file flash in and out of existence. Because I'm asking for memory mode, I deliberately don't display the file UI (aka 'Displays download location' in Interface Builder). I tried to workaround it by doing the following, but it ignores that too. cameraView.downloadsDirectory = [NSURL fileURLWithPath:NSTemporaryDirectory()]; Anyone have pearl she'd like to cast? ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSTextFinder: endless loops asking for string at index that doesn't exist.
I'm using the NSTextFinder API with the stringAtIndex:len:effectiveRange: style of exposing the text. I have a test case which has 4 strings in it, foo1 .. foo4. I show the findbar, type 'foo', and click the 'find next' control. Here are the calls that my client receives and the results being passed back. firstSelectedRange = {0, 0} (char) stringLength:16 firstSelectedRange = {0, 0} (char) stringAtIndex:0 len:4 effRange:{0, 4} 'foo1' stringAtIndex:4 len:4 effRange:{4, 4} 'foo2' stringAtIndex:8 len:4 effRange:{8, 4} 'foo3' stringAtIndex:12 len:4 effRange:{12, 4} 'foo4' setFirstSelectedRange = {0, 3} KESIImageView+Finding scrollRangeToVisible: = {0,3} So far, so good. But when I check the replace checkbox, then click the replace control, I see the following: --- replace foo with BA stringLength:16 firstSelectedRange = {0, 3} (char) replaceCharactersInRange: {0, 3} withString:'BA' setFirstSelectedRange = {0, 2} firstSelectedRange = {0, 2} (char) stringAtIndex:2 len:3 effRange:{0, 3} 'BA1' stringAtIndex:3 len:4 effRange:{3, 4} 'foo2' stringAtIndex:7 len:4 effRange:{7, 4} 'foo3' stringAtIndex:11 len:4 effRange:{11, 4} 'foo4' stringAtIndex:15 len:0 effRange:{15, 0} '(null)' stringAtIndex:15 len:0 effRange:{15, 0} '(null)' stringAtIndex:15 len:0 effRange:{15, 0} '(null)' … endless loop NSTextFinder keeps asking about the string that starts at index 15, but because of the replacement, the only flattened string is only 15 chars long. My 'stringLength' is only called before the replace, not after. Incremental searching is not enabled, so it's not that I'm forgetting to call -(void)noteClientStringWithChange. Am I doing something wrong? How can I get NSTF to understand that the client doesn't have anything at index 15? ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSTextFinder - don't use an NSView subclass for the client
Don't use a subclass of NSView for the object that you pass as 'client'. The NSTextFinderClient protocol's -(BOOL)isEditable method will be called from -[NSView inputContext] as your view's window is being dealloc'd, and you may crash. ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
can't get NSTextFinder to show the find panel
I'm trying to use the NSTextFinder object on Lion, from an app whose base SDK is Tiger. I've created an instance of NSTextFinder, called its -setClient: method, my client implements all methods of the NSTextFinderClient (using -string). My client does _not_ do the NSTextFinderBarContainer protocol, I want to use the panel. I expect that calling [m_textFinder performAction:NSTextFinderActionShowFindInterface] would make the find panel appear, but it doesn't. It's not the app or how it's built, because in another window, I have an NSTextView, and it is able to show the panel. I've traced its calls and see it's using NSTextFinder. What am I doing wrong? TIA! ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: can't get NSTextFinder to show the find panel
On Mar 23, 2012, at 11:05 AM, Fritz Anderson wrote: You're trying to use the NSTextFinder object on Lion, from an app whose base SDK is Tiger. Xcode is sensitive to what the base SDK is. I don't think that's the issue because NSTextView, when called from within my app, uses instances of NSTextFinder to perform the find/replace actions. * Symbols exclusive to a later SDK than then base shouldn't be compilable or linkable at all. I'm unsure how you got past this barrier. This leads me to believe that either you've instituted a gigantic hack, or your description of your situation is inaccurate. Care to elaborate? To compile, I created a subset of the NSTextFinder header with methods pulled from 10.7 SDK version. There's no issue with linking because dyld finds NSTextFinder at load time, and the methods dispatched dynamically, not through a static offset from 'self'. * To preserve backward compatibility, when OS version N detects that an application has been linked against SDK version (M N), it does not provide bug-fixes or other changes that were instituted after version M. I'm aware of that issue, but for the reason I stated above, I don't believe it's part of the problem. Even if you managed somehow to add NSTextFinder to your headers and libraries, Cocoa would not provide behavior that NSTextFinder may rely on. The instances of NSTextView I use seem to be getting everything they need. They show the find panel when asked. Have you used NSTextFinder with a client other than NSTextView and NSScrollerView? ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
play time
I have a QTMovieView, I'd like to find out when the user clicks the play control. So I subclass it, and override 'play:'. My 'play:' is never called. I couldn't find a notification or delegate method corresponding to 'movie did start playing'. I tried QTMovieStatusStringPostedNotification, but am not getting any of those. I could implement 'movieShouldTask:', and derive 'did start playing' by watching [movie time], but that's polling, and I'm hoping to avoid it. Any pearls? ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: play time
The secret sauce is watching QTMovieRateDidChangeNotification. On Feb 29, 2012, at 6:06 AM, Eric Slosser wrote: I have a QTMovieView, I'd like to find out when the user clicks the play control. So I subclass it, and override 'play:'. My 'play:' is never called. I couldn't find a notification or delegate method corresponding to 'movie did start playing'. I tried QTMovieStatusStringPostedNotification, but am not getting any of those. I could implement 'movieShouldTask:', and derive 'did start playing' by watching [movie time], but that's polling, and I'm hoping to avoid it. Any pearls? ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
getting 'page visit notification' from HelpViewer.app
I want to know when a user visits a page in my app's help book. Is there a supported way? Since the pages are HTML, I'm thinking that perhaps I could put magic URLs on each page, like img src=foo:/pagename/, then use Info.plist to tell the system that my app supports the foo protocol. Is there a better way? The app supports 10.4-10.current, so it would be nice to be able to do it on all of those. Thanks in advance, Eric ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Lion's 'restore windows' vs. app with initial 'login'
On Feb 7, 2012, at 2:09 PM, Quincey Morris wrote: On Feb 7, 2012, at 09:27 , Eric Slosser wrote: I've got an app that has a login step at the beginning. Until the user has logged on, it's inappropriate to display the documents that were open when the last user quit. Lion's 'restore windows' feature happens while my login dialog is still open. I've looked at the slides for the WWDC 2011 session Resume and Automatic Termination in Lion and they don't address the concept of an app with a startup gateway like a login dialog. Through experimentation, I found that 'resume' is happening through calls to -[MyDocController openDocumentWithContentsOfURL:display:error]. I plan to put a check for login there. If the user hasn't logged in, I'll save the URLs, return NULL, and process them later. When I process them, I can also filter out URLs that 'belong' to someone other than the current logged in user. 'openDocumentWithContentsOfURL:display:error:' is deprecated in Lion, so it's surprising that it's being called instead of 'openDocumentWithContentsOfURL:display:completionHandler:', and maybe you can't rely on it being called in future updates. An alternative approach might be to override 'restoreDocumentWindowWithIdentifier:state:completionHandler:' Thanks for the thought. I looked at that routine (and header), but the app in question still supports Tiger and PowerPC, so it was easier to subclass openDocumentWithContentsOfURL:display:error:. ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Lion's 'restore windows' vs. app with initial 'login'
I'm looking for a design review here. I've got an app that has a login step at the beginning. Until the user has logged on, it's inappropriate to display the documents that were open when the last user quit. Lion's 'restore windows' feature happens while my login dialog is still open. I've looked at the slides for the WWDC 2011 session Resume and Automatic Termination in Lion and they don't address the concept of an app with a startup gateway like a login dialog. Through experimentation, I found that 'resume' is happening through calls to -[MyDocController openDocumentWithContentsOfURL:display:error]. I plan to put a check for login there. If the user hasn't logged in, I'll save the URLs, return NULL, and process them later. When I process them, I can also filter out URLs that 'belong' to someone other than the current logged in user. Is there a better way? ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: bindings duplicates object returned
Thanks for the pointers, Quincy. However, I implemented the following accessors, checked I wasn't directly touching m_contents except in my init, and the problem persists. - (void) setContents:(id)newValue - (NSUInteger)countOfContents - (id)objectInContentsAtIndex:(NSUInteger)idx - (void)insertObject:(id)obj inContentsAtIndex:(NSUInteger)idx - (void)removeObjectFromContentsAtIndex:(NSUInteger)idx I implemented -(BOOL)[Foo respondsToSelector:] to see what else I might be missing, but Foo is only asked about '_finishedMakingConnections' and '_autounbinder'. If I'm still missing an accessor, it must be determined without using respondsToSelector:. On Dec 8, 2011, at 12:34 AM, Quincey Morris wrote: On Dec 7, 2011, at 20:05 , Eric Slosser wrote: I have an NSTreeController whose 'content array' is bound to another object's 'content' key. It appears that the binding mechanism duplicates the array that was returned by [foo content]. This is bad, because changes that 'foo' makes later to its m_content never show up in the window. It's also bad because [NSTreeController selectedObject] doesn't correspond to anything in the tree under [foo content]. I can work around this by NOT using bindings to establish the controller's content, instead using [NSTreeController setContent:]. 1. Where in the docs is this binding duplication described? 2. Is there a way to use bindings and avoid having [foo content] duplicated? Based on this information, the problem is that your Foo class isn't KVO compliant for the content property. Conceptually, it's a mistake to think of content as an array property (that is, as a property that has an array as its value). Conceptually, you should think of it as an indexed to-many relationship. The correct approach is to properly implement the KVC indexed collection accessors in your Foo class**. See: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/KeyValueCoding/Articles/AccessorConventions.html#//apple_ref/doc/uid/20002174-BAJEAIEE Normally, you need to write only the 'insert' and 'remove' accessors. You can let all of the others default. Then, when changing the value of the property, you should never change m_content directly***. Instead, use the collection accessors, or use the mutable array proxy. For example, to add an object to the array, use either of these: [foo insertObject: newObject inContentAtIndex: newIndex]; // or … [[foo mutableArrayValueForKey: @content] insertObject: newObject atIndex]; Both of these are KVO compliant, and functionally equivalent. Once you have this machinery set up, your binding to Foo's content should work properly. ** Of course, in practice, the Foo instance has to return *some* object that looks like an array as the value of the content getter, since properties have types. But think about what object ought to be returned. You don't want to return your 'm_content' array, because you're exposing an implementation detail to clients of your Foo class. You don't want to return a copy of your 'm_content' array, because that of course won't change after being created. Catch-22, isn't it? Ideally, the Foo instance would return [self immutableArrayValueForKey: @content] but unfortunately there's no such method. The simplest choice is probably to return the ivar, but to write no code that uses the @property value. *** When using an array ivar to back an indexed collection property like this, it's safe to modify the ivar directly in the init method only (because there aren't any observers at this point). Apart from that method, you should always use the KVO compliant accessors. ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: bindings duplicates object returned
I found the solution, and it's all my fault. The object 'foo' was meant to be a singleton instance of class 'Foo'. I always access it through [foo instance], which enforces that. After 'foo' is created, the nib is loaded in which the binding was expressed. In the process (see stack below**), -[Foo init] is called. My override of -[Foo init] didn't have singleton smarts, so I happily handed a different m_contents to the controller. So I thought that bindings had duplicated the result of -(id)[foo contents], but actually, I had two different 'foo's. Truly a foo-lish mistake. ** le stack -[Foo init] -[NSCustomObject nibInstantiate] -[NSIBObjectData instantiateObject:] -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] loadNib On Dec 13, 2011, at 12:11 PM, Eric Slosser wrote: Thanks for the pointers, Quincy. However, I implemented the following accessors, checked I wasn't directly touching m_contents except in my init, and the problem persists. - (void) setContents:(id)newValue - (NSUInteger)countOfContents - (id)objectInContentsAtIndex:(NSUInteger)idx - (void)insertObject:(id)obj inContentsAtIndex:(NSUInteger)idx - (void)removeObjectFromContentsAtIndex:(NSUInteger)idx I implemented -(BOOL)[Foo respondsToSelector:] to see what else I might be missing, but Foo is only asked about '_finishedMakingConnections' and '_autounbinder'. If I'm still missing an accessor, it must be determined without using respondsToSelector:. On Dec 8, 2011, at 12:34 AM, Quincey Morris wrote: On Dec 7, 2011, at 20:05 , Eric Slosser wrote: I have an NSTreeController whose 'content array' is bound to another object's 'content' key. It appears that the binding mechanism duplicates the array that was returned by [foo content]. This is bad, because changes that 'foo' makes later to its m_content never show up in the window. It's also bad because [NSTreeController selectedObject] doesn't correspond to anything in the tree under [foo content]. I can work around this by NOT using bindings to establish the controller's content, instead using [NSTreeController setContent:]. 1. Where in the docs is this binding duplication described? 2. Is there a way to use bindings and avoid having [foo content] duplicated? Based on this information, the problem is that your Foo class isn't KVO compliant for the content property. Conceptually, it's a mistake to think of content as an array property (that is, as a property that has an array as its value). Conceptually, you should think of it as an indexed to-many relationship. The correct approach is to properly implement the KVC indexed collection accessors in your Foo class**. See: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/KeyValueCoding/Articles/AccessorConventions.html#//apple_ref/doc/uid/20002174-BAJEAIEE Normally, you need to write only the 'insert' and 'remove' accessors. You can let all of the others default. Then, when changing the value of the property, you should never change m_content directly***. Instead, use the collection accessors, or use the mutable array proxy. For example, to add an object to the array, use either of these: [foo insertObject: newObject inContentAtIndex: newIndex]; // or … [[foo mutableArrayValueForKey: @content] insertObject: newObject atIndex]; Both of these are KVO compliant, and functionally equivalent. Once you have this machinery set up, your binding to Foo's content should work properly. ** Of course, in practice, the Foo instance has to return *some* object that looks like an array as the value of the content getter, since properties have types. But think about what object ought to be returned. You don't want to return your 'm_content' array, because you're exposing an implementation detail to clients of your Foo class. You don't want to return a copy of your 'm_content' array, because that of course won't change after being created. Catch-22, isn't it? Ideally, the Foo instance would return [self immutableArrayValueForKey: @content] but unfortunately there's no such method. The simplest choice is probably to return the ivar, but to write no code that uses the @property value. *** When using an array ivar to back an indexed collection property like this, it's safe to modify the ivar directly in the init method only (because there aren't any observers at this point). Apart from that method, you should always use the KVO compliant accessors. ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/eric.slosser%40v-fx.com This email sent
Re: bindings duplicates object returned
On Dec 13, 2011, at 1:47 PM, Kyle Sluder wrote: Don't be tempted to add singleton smarts to -[Foo init]. ARC will not like them. Instead, add a property to File's Owner that just returns the shared Foo instance. Really? Do you have a reference for that claim? I looked through http://clang.llvm.org/docs/AutomaticReferenceCounting.html and saw nothing about singletons. So much has been written about how -init is allowed to return a value other than what 'self' was at entry, I can't believe ARC can't handle it. FWIW, here's the body of my singleton-smart -init. if ( gSingleton!=NULL ) { [self release]; self = gSingleton; } else if ((self=[super init])!=NULL) { … } return self; ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSTreeController won't initWithCoder on Leopard (solved)
Greg, for this project I'm using Xcode 3.2.6, the xib was set to 'default - 10.4'. There were two issues, both my fault. 1) I had left a stub @implementation of NSTreeNode in the link list. I had created the header so I could use that class even though it wasn't public in Tiger. I found it because Leopard (sporadically) reports the error at launch in the log. Fixing #1 got me to the next issue. 2) My subclass of NSWindowController was calling [super awakeFromNib], without first checking that 'super' handled it. Didn't cause a problem with 10.4, 10.6, or 10.7, but 10.5 threw an 'unrecognized selector' exception. On Nov 3, 2011, at 12:09 AM, Quincey Morris wrote: On Nov 2, 2011, at 18:42 , Eric Slosser wrote: I've created a modal dialog that uses an NSTreeController as part of a master-detail style interface to a hierarchical storage model. Using bindings (not delegate methods) to supply the data. Using 10.4 as the base SDK. XIB attached. Works fine on Lion and Snow Leopard. It's a little odd on Tiger (throws exceptions but eventually presents the info). But on Leopard (10.5.8), I get the following exception and stack when I try to bring up the modal. Why would NSTreeController be asking a NSTreeControllerTreeNode (which it created, not me) to do an unrecognized selector? I'd think that family of objects would be self-consistent on a given install. I'm stumped, and so is my google-fu. Does anyone have a pearl they can cast? 2011-11-02 16:46:52.890 Kurzweil 3000[343:813] *** -[NSTreeControllerTreeNode initWithRepresentedObject:]: unrecognized selector sent to instance 0x541990 #0 0x94e674c0 in objc_exception_throw () #1 0x92d58eb8 in -[NSObject doesNotRecognizeSelector:] () #2 0x92d574b4 in ___forwarding___ () #3 0x92d57748 in __forwarding_prep_0___ () #4 0x9377449c in -[NSTreeControllerTreeNode initWithRepresentedObject:treeController:] () #5 0x936de370 in -[NSTreeController createChildNodeForRepresentedObject:] () #6 0x936dcda0 in -[NSTreeController _prepareControllerTree] () #7 0x936dd2e4 in -[NSTreeController _init] () #8 0x93331148 in -[NSController initWithCoder:] () #9 0x93330ee8 in -[NSObjectController initWithCoder:] () #10 0x936dd4a8 in -[NSTreeController initWithCoder:] () This is a little odd. Possibly, the problem is simply that you forgot to set the correct deployment version for the XIB file. (It's set on a per-file basis, independent of the base SDK.) I'm wondering, though, how it's come to create nodes during the NSTreeController unarchive. I'd expect the tree controller to have no content until its content binding is established, which would of course happen after the initWithCoder is finished. (It could be creating just a default root node, I guess.) Another possibility is that there's a binary incompatibility across such a large range of deployment versions. My memory of the history is hazy, but I think NSTreeController went through a couple of major implementation revamps since 10.4, so something might have come unstuck. BTW, what Xcode version are you using for this? ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSTreeController won't initWithCoder on Leopard
I've created a modal dialog that uses an NSTreeController as part of a master-detail style interface to a hierarchical storage model. Using bindings (not delegate methods) to supply the data. Using 10.4 as the base SDK. XIB attached. Works fine on Lion and Snow Leopard. It's a little odd on Tiger (throws exceptions but eventually presents the info). But on Leopard (10.5.8), I get the following exception and stack when I try to bring up the modal. Why would NSTreeController be asking a NSTreeControllerTreeNode (which it created, not me) to do an unrecognized selector? I'd think that family of objects would be self-consistent on a given install. I'm stumped, and so is my google-fu. Does anyone have a pearl they can cast? 2011-11-02 16:46:52.890 Kurzweil 3000[343:813] *** -[NSTreeControllerTreeNode initWithRepresentedObject:]: unrecognized selector sent to instance 0x541990 #0 0x94e674c0 in objc_exception_throw () #1 0x92d58eb8 in -[NSObject doesNotRecognizeSelector:] () #2 0x92d574b4 in ___forwarding___ () #3 0x92d57748 in __forwarding_prep_0___ () #4 0x9377449c in -[NSTreeControllerTreeNode initWithRepresentedObject:treeController:] () #5 0x936de370 in -[NSTreeController createChildNodeForRepresentedObject:] () #6 0x936dcda0 in -[NSTreeController _prepareControllerTree] () #7 0x936dd2e4 in -[NSTreeController _init] () #8 0x93331148 in -[NSController initWithCoder:] () #9 0x93330ee8 in -[NSObjectController initWithCoder:] () #10 0x936dd4a8 in -[NSTreeController initWithCoder:] () #11 0x9298f834 in _decodeObjectBinary () #12 0x9298ee24 in _decodeObject () #13 0x9312c600 in -[NSNibConnector initWithCoder:] () #14 0x93324aac in -[NSNibBindingConnector initWithCoder:] () #15 0x9298f834 in _decodeObjectBinary () #16 0x92990794 in -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] () #17 0x92990d58 in -[NSArray(NSArray) initWithCoder:] () #18 0x9298f834 in _decodeObjectBinary () #19 0x9298ee24 in _decodeObject () #20 0x9312b704 in -[NSIBObjectData initWithCoder:] () #21 0x9298f834 in _decodeObjectBinary () #22 0x9298ee24 in _decodeObject () #23 0x9312af70 in loadNib () #24 0x9312a96c in +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] () #25 0x93165f60 in -[NSWindowController loadWindow] () #26 0x93165d1c in -[NSWindowController window] () #27 0x00236a80 in -[UniLibWindowController runModal] () ftp://v-fx.com/public/UniLib.xib ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
custom view for 'page setup' dialog
I'm running a page setup dialog with an accessory view. The view uses an NSPrintInfo object that I get from -[NSDocument printInfo]. I would think that -[NSDocument printInfo] would return the same NSPrintInfo* as the NSDocument uses internally, (with retain-autolease) but the code is acting like I'm getting a copy of it. In particular, inside -[MyNSDocument preparePageLayout:], I have to call [self setPrintInfo:[self printInfo]] or the changes I make to [[self printInfo] dictionary] get thrown away in between the time that I dismiss the panel with OK and the time that -[MyNSDocument documentDidRunModalPageLayout:accepted:contextInfo:] is called. Can someone shed some light on what's going on? Is the NSPrintInfo I get from -[NSDocument printInfo] the same one that the default panel of the 'page setup' dialog touches? If not, how can my custom panel get/set the 'orientation' (portrait/landscape) setting on the 'page attributes' panel? ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
altering width of NSComboBox's popup
I'd like to display a NSComboBox that is narrower than the widest of strings in the list of items, but have the popup list be wide enough so the whole string can be read. But I haven't found a way to have the 'non-tracking' width to be different from the tracking width. I've tried altering the width in a delegate's comboBoxWillPopUp:, calling [obj setFrame:], but that affects the width of the unclicked area, the scrolling list is still narrow. I've tried subclassing NSComboBox, and doing the same width switching by overriding and wrapping -[NSComboBox mouseDown:], but that seems to cancel the display of the popup altogether. I imagine I could try getting the NSComboBox's menu, and calling -[NSMenu setMinimumWidth:] on it, but that call isn't available until 10.6, and I'm supporting 10.4.11. I don't see how I'd play with NSComboBoxCell, but maybe that's part of the solution. FWIW, I'm using setButtonBordered:NO. Would someone please cast me a pearl? ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Fixing logged error that doesn't throw exception
On Jun 25, 2009, at 5:34 AM, Tristan Celder wrote: I'm extremely new to Cocoa programming but have come across a problem where I am getting a [NSConcreteAttributedString initWithString:] called with nil string argument. pop up in my console. I have had it once before and managed to track it down to a NumberFormatter with no symbols set for nil/null values. This problem was the cause of a far more serious problem which was a very bizarre error which breaks my core data bindings for any table view displaying exactly one row of an attribute fetched via a relationship when a document is reopened after save. Unfortunately the console warnings have begun popping up again, and this time I have absolutely no idea where/who/what could be causing them in my interface. (It's only when I do a clean build that they show up in the first place). So... what I would really like to know is how I can find the source of these messages. A previous post I dug up, simply mentions that one can test the location on the stack which holds the parameter. which can be done using the syntax * (id*)($ebp + 16). If the message is popping up in the console, but no exception is being thrown, maybe you can find it by setting a conditional breakpoint on that routine, for whenever nil is passed it. To do that in Xcode, double click on the words Double-Click for Symbol in the breakpoint column of the breakpoints window, and type -[NSConcreteAttributedString initWithString:] That sets a breakpoint on the method that I suspect is logging the message to console. To check if the 3rd argument is nil (see Architecture Considerations and Objective-C in http://developer.apple.com/technotes/tn2004/tn2124.html , and understand that gdb will set the BP after the preamble) type the following in the condition column: *(int*)($ebp+16)==0 I've tried this, and it works. - - - You could also follow Jesper's advice and set a breakpoint on asl_send. That'll be triggered for every NSLog (and more), so you may have to continue a lot before you see the stack trace you care about. So you can set a condition on the asl_send breakpoint, looking only for the text you care about. That text can be retrieved by (char*) ask_get( *(int*)($ebp+12), Message ) I don't have time to work out the gdb conditional, but you get the idea. Maybe a call to strstr(). ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: extending NSSavePanel, how to disable save button?
I have a static text string passwords must match that I show whenever they don't. (to see the keystrokes, I made a delegate for the password fields that overrides controlTextDidChange:, and to hide/ show the NSTextView, I call NSView's setHidden:). If the person clicks Save anyway, I cause it to be ignored (a delegate to NSSavePanel that overrides -(NSString*) panel:userEnteredFilename:confirmed, and returns nil), AND I kick off an animation loop that makes the text fade in and out every half second. (NSViewAnimation) On Jun 25, 2009, at 12:42 PM, Mike Abdullah wrote: I'm pretty certain there is no proper API for disabling the Save button. But the delegate methods will allow you to stop the button from taking effect (weird I know). I suggest you do an NSBeep() at the same time to at least give some feedback as to why the panel couldn't close. Mike. On 24 Jun 2009, at 18:52, Steve Christensen wrote: I haven't tried myself, but just checking the headers it looks like the closest thing would be to make your controlling class the delegate and then implement either - (BOOL)panel:(id)sender isValidFilename:(NSString *)filename; or - (NSString *)panel:(id)sender userEnteredFilename:(NSString *) filename confirmed:(BOOL)okFlag; since they control whether to allow the selection process to complete. The docs for these methods have more details that might help you decide which would be better. steve On Jun 24, 2009, at 10:42 AM, Eric Slosser wrote: I'm extending NSSavePanel by using an accessory view. The view contains two NSSecureTextFields, to contain the user-typed password and confirmation. I know how to detect when the two password fields don't have identical content, to display a warning string on the dialog, and to prevent the user from exiting the dialog. But I'd also like to disable the Save button. Is it possible? ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net This email sent to cocoa...@mikeabdullah.net ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
extending NSSavePanel, how to disable save button?
I'm extending NSSavePanel by using an accessory view. The view contains two NSSecureTextFields, to contain the user-typed password and confirmation. I know how to detect when the two password fields don't have identical content, to display a warning string on the dialog, and to prevent the user from exiting the dialog. But I'd also like to disable the Save button. Is it possible? ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: XIB and AppleGlot
On Jun 4, 2009, at 8:46 PM, Jonathan Hess wrote: On Jun 4, 2009, at 6:28 AM, Eric Slosser wrote: (Sorry if this is OT, I couldn't find a better apple-hosted list...) How does one use AppleGlot and XIBs? I have an app, My.app, that was previously localized. I'm working on version 2.0. My app is starting to use XIB files. These get compiled into NIBs in My.app. The AppleGlot docs seem to say I should put My.app 2.0 into _NewBase, and My.app 1.0 into _OldLoc. When I do that, the nibs that came from xibs are ignored (my.app.wg doesn't contain any of the strings from those nibs). If I put NewDialog.xib into my.app, I see its strings in the .wg. It seems like I be putting the source code form of the language.lproj folders into _OldBase, but none of the docs say that. Can someone point me at a discussion of how to use AppleGlot in the presence of XIB files? And (if it's not covered by default): What to do when the previous shipped app had a non-compiled Foo.nib, and the about-to-ship app has Foo.xib in the souces, and thus a compiled Foo.nib in the built app. Hey Eric - I believe the file names in _OldBase, _NewBase, and _OldLoc need to match. It sounds like your files in _OldBase and _OldLoc are probably .nib files, but you're files in _NewBase are .xib files. You can upgrade the files in _OldBase and _OldLoc to .xib files with something like this: cd _OldLoc find . -name *.nib -type d -exec ibtool --upgrade {} \; cd _OldBase find . -name *.nib -type d -exec ibtool --upgrade {} \; Thanks for the suggestion, Jon. All the places have .nib files, but the ones in _Newbase are compiled .nibs. But as yours is the best suggestion I got, I'll try upgrading the nibs in _OldBase and _OldLoc to .xibs and copying .xibs into the built product in _Newbase. ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: XIB and AppleGlot
On Jun 5, 2009, at 1:25 PM, Jonathan Hess wrote: On Jun 5, 2009, at 3:38 AM, Eric Slosser wrote: On Jun 4, 2009, at 8:46 PM, Jonathan Hess wrote: On Jun 4, 2009, at 6:28 AM, Eric Slosser wrote: How does one use AppleGlot and XIBs? I have an app, My.app, that was previously localized. I'm working on version 2.0. My app is starting to use XIB files. These get compiled into NIBs in My.app. The AppleGlot docs seem to say I should put My.app 2.0 into _NewBase, and My.app 1.0 into _OldLoc. When I do that, the nibs that came from xibs are ignored (my.app.wg doesn't contain any of the strings from those nibs). If I put NewDialog.xib into my.app, I see its strings in the .wg. It seems like I be putting the source code form of the language.lproj folders into _OldBase, but none of the docs say that. Can someone point me at a discussion of how to use AppleGlot in the presence of XIB files? And (if it's not covered by default): What to do when the previous shipped app had a non-compiled Foo.nib, and the about-to- ship app has Foo.xib in the souces, and thus a compiled Foo.nib in the built app. I believe the file names in _OldBase, _NewBase, and _OldLoc need to match. It sounds like your files in _OldBase and _OldLoc are probably .nib files, but you're files in _NewBase are .xib files. You can upgrade the files in _OldBase and _OldLoc to .xib files with something like this: cd _OldLoc find . -name *.nib -type d -exec ibtool --upgrade {} \; cd _OldBase find . -name *.nib -type d -exec ibtool --upgrade {} \; Thanks for the suggestion, Jon. All the places have .nib files, but the ones in _Newbase are compiled .nibs. But as yours is the best suggestion I got, I'll try upgrading the nibs in _OldBase and _OldLoc to .xibs and copying .xibs into the built product in _Newbase. It sounds like you are localizing the built product, rather than the source. If that's the case, you can enable IBC_FLATTEN_NIBS = YES in your build settings. The build settings UI presents IBC_FLATTEN_NIBS as Flatten Compiled XIB Files in the Interface Builder XIB Compiler section. Turning that option on will cause the built NIB files to still be editable by IB and ibtool, which will allow AppleGlot to process them. You should not ship NIB files built this way. If you do, they will work, but they're also much larger than the completely stripped NIB files that you get when this build setting is turned on. Yes, I've been using the built product. Isn't that the way it's always been done? I've come to the conclusion that I'm supposed to use the source versions of xibs and nibs. So after copying built versions of the app into _OldBase, _OldLoc, and _NewBase, I'll replace any nib or xib in xx.lproj/ with the contents from my source tree. Sound right? If so, any other resources that need to be in source form? BTW, I tried the IBC_FLATTEN_NIBS setting and found it's a little different than you describe: 1) it's YES (on) by default (and was on for me) 2) for shipping, on is right. the nibs are flat, small, and not editible. 3) for localizing, off is right. the nibs are bundles, bigger, and editable. I played with ibtool --upgrade today and found that it fails to convert built nibs if the nib has a plugin dependency. No amount of --plugin helps. That was what makes me think source form of nibs and xibs are the way to go. ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
XIB and AppleGlot
(Sorry if this is OT, I couldn't find a better apple-hosted list...) How does one use AppleGlot and XIBs? I have an app, My.app, that was previously localized. I'm working on version 2.0. My app is starting to use XIB files. These get compiled into NIBs in My.app. The AppleGlot docs seem to say I should put My.app 2.0 into _NewBase, and My.app 1.0 into _OldLoc. When I do that, the nibs that came from xibs are ignored (my.app.wg doesn't contain any of the strings from those nibs). If I put NewDialog.xib into my.app, I see its strings in the .wg. It seems like I be putting the source code form of the language.lproj folders into _OldBase, but none of the docs say that. Can someone point me at a discussion of how to use AppleGlot in the presence of XIB files? And (if it's not covered by default): What to do when the previous shipped app had a non-compiled Foo.nib, and the about-to-ship app has Foo.xib in the souces, and thus a compiled Foo.nib in the built app. ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
stripping question
I use 'strip -i -s savedSyms.txt my.app/Contents/MacOS/my' to remove symbols that aren't necessary. savedSyms.txt used to only contain typeinfo symbols (start with __ZTI) that are necessary for cross-library exception catching to work. But today, I discovered the need to preserve .objc_class_name_CalController, or the stripped app would crash at launch with an attempt to read from $0x0. The crash is inside some anonymous code, called by ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const). Only the release build crashes, I can strip that symbol from the debug build and it doesn't care. The crash is on 10.5.6 or 10.5.7, I haven't checked other versions. I'm building with Xcode 3.1.1. MyController is referred to by some XIBs, so I thought maybe there's something going on at NIB loading time, but removing the XIBs from the project and rebuilding/restripping the .app doesn't remove the crash. AFAIK, there's no static variable that attempts to construct a CalController. Why is this symbol required to launch? ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: stripping question
On May 27, 2009, at 6:39 PM, Kyle Sluder wrote: On Wed, May 27, 2009 at 1:35 PM, Eric Slosser eric.slos...@v- fx.com wrote: Why is this symbol required to launch? Does MyController have an +initialize method, No. or does any other class's +initialize method possibly create an instance of or call a class method of MyController? Not that I can see. The only way I see a MyController being instantiated at launch is through the XIB files, but removing those didn't affect the crash. ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
typeFromFileExtension in Leopard SDK
When I switched my SDKROOT from 10.4 to 10.5, my calls to - [NSDocumentController typeFromFileExtension:] started returning nil. - with Xcode 3.1.1 on Leopard 10.5.6 - make a new Cocoa NSDocument app - in the target info window, properties pane, assign a document type, giving it name: my doc UTI: com.comp.app.doc1 extensions: doc1 - in MyDocument.m, windowControllerDidLoadNib, throw in: NSString* t = [[NSDocumentController sharedDocumentController] typeFromFileExtension:@doc1]; NSLog(@filetype = %@, t); - build-n-run, note that fileType = (null) - quit app, go to target info window, build pane, set Base SDK to 10.4 - build-n-run, note that fileType = my doc I see in the release notes for Leopard that -[NSDocumentController typeFromFileExtension:] is deprecated, but that doesn't mean stops working, does it? Am I doing something wrong? ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: typeFromFileExtension in Leopard SDK
On Apr 13, 2009, at 5:29 PM, Kyle Sluder wrote: Did you declare your com.comp.app.doc1 UTI as an exported type in your Info.plist? Nope. Since you seemed to be suggesting that was the problem, I added the following to Info.plist. But it didn't help. Am I missing something? keyUTExportedTypeDeclarations/key array dict keyUTTypeConformsTo/key array stringpublic.plain-text/string /array keyUTTypeDescription/key stringsome description/string keyUTTypeIdentifier/key stringcom.comp.app.doc1/string keyUTTypeTagSpecification/key dict keypublic.filename-extension/key array stringdoc1/string /array /dict /dict /array keyUTImportedTypeDeclarations/key array dict keyUTTypeConformsTo/key array stringpublic.plain-text/string /array keyUTTypeDescription/key stringsome description/string keyUTTypeIdentifier/key stringcom.comp.app.doc1/string keyUTTypeTagSpecification/key dict keypublic.filename-extension/key array stringdoc1/string /array /dict /dict /array ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: underlining
On Feb 6, 2009, at 1:08 PM, Eric Slosser wrote: I figured out (thanks to Jeff Lynch) that it's not horribly wrong, it's just that the baseline of the underline is too high. The break in the underline is there because NSLayoutManager doesn't draw on top of the descender of the 'p'. So why is the baseline wrong? Does NSLayoutManager's drawGlyphsForGlyphRange:atPoint need me to setup the NSView's graphics context differently? Douglas Davidson supplied the clue. I needed to add the following line to MyView.mm: - (BOOL) isFlipped { return YES; } Now the underline in my simple test app is right. I'm sure the answer to my real problem is going to be don't use NSLayoutManager in a non- NSView environment. ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: underlining
On Feb 5, 2009, at 6:31 PM, Graham Cox wrote: On 6 Feb 2009, at 10:00 am, Eric Slosser wrote: I'm trying to draw underlined strings, but they come out wrong In what way? I couldn't really describe it, so I attached a picture to my original post. The picture got stripped off for some people. If you don't see it above, I've placed it here: ftp://v-fx.com/public/underline/underline1.png The sample project that makes it is there too: ftp://v-fx.com/public/underline/boldunderline.dmg I figured out (thanks to Jeff Lynch) that it's not horribly wrong, it's just that the baseline of the underline is too high. The break in the underline is there because NSLayoutManager doesn't draw on top of the descender of the 'p'. So why is the baseline wrong? Does NSLayoutManager's drawGlyphsForGlyphRange:atPoint need me to setup the NSView's graphics context differently? ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: underlining
The problem I'm really trying to solve occurs in a 'real' app. I'm drawing to a printer port with 300 dpi, and I found that with Arial 10 bold, point size 39, the underline gets fat enough so its top edge intersects many of the letters, so all those intersections are skipped (not underlined). The net effect is that the underline looks very jagged, discontinuous, serrated, bad. See ftp://v-fx.com/public/underline/underline_bad.pdf . If I override NSLayoutManager, provide my own [drawUnderlineForGlyphRange:...], and implement it by adding 50 to the baselineOffset before calling [super drawUnderlineForGlyphRange:...], I get the result in ftp://v-fx.com/public/underline/underline_ok.pdf. So, I have a workaround, just bump the baseline down. But why is that necessary? Is it a symptom of a problem elsewhere? I'd rather treat the disease than the symptom. Is it time to stop using NSAttributedString / NSTextStorage and go closer to the metal? ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
underlining
I'm trying to draw underlined strings, but they come out wrong when the font is bold. So I made a sample app from the Cocoa template, and added a custom view to the main window. The code is below. But the output doesn't underline correctly. What am I doing wrong? NSTextStorage* getTextStorage() { if( !s_textStorage ){ s_textStorage = [[NSTextStorage alloc] init]; NSLayoutManager *layoutManager = [[NSLayoutManager alloc] init]; NSTextContainer *textContainer = [[NSTextContainer alloc] init]; [layoutManager addTextContainer:textContainer]; [textContainer release]; [s_textStorage addLayoutManager:layoutManager]; [layoutManager release]; } return s_textStorage; } - (void)drawRect:(NSRect)rect { int fontSize = 41; NSFontManager* fontManager = [NSFontManager sharedFontManager]; NSFont* boldFont = [fontManager fontWithFamily:@Arial traits:0 weight:5 size:fontSize]; //boldFont = [fontManager convertFont:font toHaveTrait:NSBoldFontMask]; NSMutableDictionary* attr = [NSMutableDictionary dictionaryWithObject:font forKey:NSFontAttributeName]; [attr setObject:[NSNumber numberWithInt:NSSingleUnderlineStyle] forKey:NSUnderlineStyleAttributeName]; NSAttributedString* attrString = [[NSAttributedString alloc] initWithString:@Sample Text attributes:attr]; NSTextStorage* textStorage = getTextStorage(); [textStorage setAttributedString:attrString]; NSLayoutManager *layoutManager = (NSLayoutManager *)[[textStorage layoutManagers] objectAtIndex:0]; NSTextContainer *textContainer = (NSTextContainer *) [[layoutManager textContainers] objectAtIndex:0]; NSPoint point = NSMakePoint( 10, 10); NSRange glyphRange = [layoutManager glyphRangeForTextContainer:textContainer]; [[textContainer layoutManager] drawGlyphsForGlyphRange: glyphRange atPoint:point ]; } ___ 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-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com