Re: cpp class keywotd
On Apr 28, 2011, at 11:48 PM, koko wrote: Well, apparently, compiling for iOS app versus iOS static lib treats the processing of the .pch diifferently. Moving some things out of .pch in the app build which are in the .pch of the lib build solved my problem. I would like to know more about this if anyone can shed some light. If you put it in the .pch, it will get compiled for each of the languages used in your project, including obj-c (which does not understand class'). The lib probably does not have any .m files, whereas the app does. That's my guess. You can put preprocessor conditionals around the C++ code so that it only gets precompiled for the languages that support C++. For example: #ifdef __cplusplus // code that requires C++ or obj-c++ #endif Best regards, B.J. Buchalter Metric Halo http://www.mhlabs.com ___ 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: How to Post Code to This List
What's the best way to post code to this list so that the formatting is retained? send it plain text. Best regards, B.J. Buchalter Metric Halo http://www.mhlabs.com ___ 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: Adding an image to a project
On Jul 15, 2010, at 6:17 PM, Vincenzo Morgante wrote: Since the plugin still does not work on my system, I'll try to create a new project following again the wizard for the development of plug-in for OsiriX. After all, it works on another system... If you are creating a plugin (rather than an application), you need to be careful to use the right NSBundle calls to refer to your plug-in's bundle and not the bundle of the Application that loads your plugin. That may be the source of the problem for you. In particular, if your resource is in your plug-in's bundle and your plugin is loaded by a hosting application, the [NSBundle mainBundle] call refers to the bundle of the hosting application, and not your plugin's bundle. You want to use [NSBundle bundleForClass: one of your plugin's classes] or [NSBundle bundleWithIdentifier:@your.plugins.bundle.id] Hope that helps. Best regards, B.J. Buchalter Metric Halo http://www.mhlabs.com ___ 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: Forcing NSImage to cache images at certain sizes
On May 21, 2010, at 10:10 PM, Ken Ferry wrote: Hi BJ, On Fri, May 21, 2010 at 2:44 PM, B.J. Buchalter b...@mhlabs.com wrote: I read the NSImage and Cocoa drawing guide docs, which tends to indicate that calling drawInRect:fromRect:operation:fraction: on an NSImage will cause it to create a cached image rep that matches the scaled image so that the next time it is drawn it does not need to be scaled again. The docs haven't fully integrated new info from 10.6, when NSImage changed a bunch. Take a look at the AppKit release notes. Oh -- sorry; I am testing on 10.5 -- I should have mentioned that. That is not what I am seeing here, and the scaling is definitely taking a nontrivial amount of time when redrawing my views. I have played around with setting the caching and scaling on the NSImage, but it doesn't appear to be having any impact (the internal image rep for the image never changes). Could you attach a test app please? There's more than one thing that could be the issue. I'll try to reduce my code to something very simple. Basically what I am seeing is that when I call drawInRect:fromRect:operation:fraction:, no mater what I pass in the for drawInRect (which causes the image to draw scaled), if I NSLog(@%@, theImage) after doing the drawing I get: Drawing Image with width: 49.00 and height: 49.00 NSImage 0x13e770 Size={64, 64} Reps=( NSBitmapImageRep 0x13c4f0 Size={64, 64} ColorSpace=NSCalibratedRGBColorSpace BPS=8 BPP=32 Pixels=64x64 Alpha=YES Planar=NO Format=2 CGImage=0x16007270 ) Note that the image has not cached a reduced NSBitmapImageRep or NSCachedImageRep with Size={49, 49} Best regards, B.J. Buchalter Metric Halo http://www.mhlabs.com ___ 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
Forcing NSImage to cache images at certain sizes
I read the NSImage and Cocoa drawing guide docs, which tends to indicate that calling drawInRect:fromRect:operation:fraction: on an NSImage will cause it to create a cached image rep that matches the scaled image so that the next time it is drawn it does not need to be scaled again. That is not what I am seeing here, and the scaling is definitely taking a nontrivial amount of time when redrawing my views. I have played around with setting the caching and scaling on the NSImage, but it doesn't appear to be having any impact (the internal image rep for the image never changes). What is the proper way to ensure that the NSImage is cached to match the required drawing size? Do I need to build my own cache? Thanks! B.J. Buchalter Metric Halo http://www.mhlabs.com ___ 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
Cracks in image using NSDrawThreePartImage
Hi Folks, I have followed the suggestion in the documentation to use NSDrawThreePartImage to draw an extensible image. The way that I am using it, the image is extensible in the horizontal dimension, and may be resized in the vertical dimension, so the individual component images are rescaled proportionally. That is as I expect and what I am looking for. Unfortunately, when the vertical scale factor is not 1.0, there are (subtle) 1 pixel visual artifacts between the startCap and centerFill images or the centerFill and endCap images. I was under the impression that this API was specifically designed to handle this properly. Is there anything in specific I need to do, or is there a bug in the API's implementation. The code that I am using in my view subclass is as follows: - (void)drawRect:(NSRect)rect { NSRect bnds = [self bounds]; NSDrawThreePartImage(bnds, left, middle, right, NO, NSCompositeSourceOver, 1, NO); } TIA, B.J. Buchalter Metric Halo http://www.mhlabs.com ___ 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: Cracks in image using NSDrawThreePartImage
Hi Ken, File a bug with a test case that shows the problem. Ok -- I filed rdar://8005118 This includes a default configuration that shows the crack clearly. The crack comes and goes as you rescale the window. I would expect there to be seams due to rounding error if you look in pixie, but I have never seen a case where it was visible to the eye at actual scale. This is pretty visible. BTW, this is tested on 10.5.8; even if the problem is fixed on 10.6.x I still need to support older systems, so I am still looking for any suggestions as to how to make this better. Thanks! B.J. Buchalter Metric Halo http://www.mhlabs.com ___ 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
semi modal view
Hey Folks, I would like to implement something that I would describe as popup text entry. Effectively I have a view that displays some textual information. I would like to make it so that if the user clicks on the view it becomes a text entry box. I have worked out how to insert a NSTextField into the view hierarchy and make it the first responder. That works well. What I would like to do is make it so that if the user hits tab or enter, the popup text entry is removed and the text that was entered is commited. I think I understand how to do that. I also need for the popup text entry to be removed when the user clicks outside of the NSTextField. In my Carbon version of this, I made a modal window that I stuck the text edit field into, and I could detect if there was a click outside that window. With Cocoa, Ideally, I would rather just let the event loop run normally, but I can't work out how to detect if the user has clicked outside of the NSTextField. Is there any way to do this easily, or do I need to run a local eventloop, or do I need to go back to the way I did it in Carbon and stick the entire text entry into its own window? Any guidance (or pointers to the relevant docs would be greatly appreciated!! Thanks! B.J. Buchalter Metric Halo http://www.mhlabs.com ___ 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: Hot to define a connection from source code?
On Jan 29, 2010, at 12:17 AM, Jonathan Chacón wrote: Hello Roland, Could you tell me any example project where I examine the source code? The Apple Sample BubbleLevel is almost entirely configured in code; there is just one main window nib that gets the whole thing running, and I suspect that you could just re-use the MainWindow.xib file from that project on any project you create (or if you create a new project from a template, Apple provides a pre-wired xib that you could use as the basis for implementing the same techniques as are in BubbleLevel). Hope that helps. B.J. Buchalter Metric Halo http://www.mhlabs.com ___ 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: Hot to define a connection from source code?
On Jan 29, 2010, at 1:05 PM, mmalc Crawford wrote: On Jan 28, 2010, at 9:17 pm, Jonathan Chacón wrote: Could you tell me any example project where I examine the source code? If you want to do iPhone development, I suspect the most useful for you will be UICatalog: http://developer.apple.com/iphone/library/samplecode/UICatalog/index.html From the description: This sample is a catalog exhibiting many views and controls in the UIKit framework, along with their various properties and styles. If you need code to create specific UI controls or views, refer to this sample and it should give you a good head start in building your user interface. In most cases you can simply copy and paste the code snippets you need. When images or custom views are used, accessibility code has been added. Using the iPhone Accessibility API enhances the user experience of VoiceOver users. I was looking at that one too and was going to suggest it, but there are a lot of xib files in that project, and I thought that it might be a lot more complicated to parse out... B.J. Buchalter Metric Halo http://www.mhlabs.com ___ 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: Event loop in a secondary thread? Nibless Cocoa?
On May 3, 2008, at 9:55 PM, John C. Randolph wrote: On May 3, 2008, at 4:35 PM, Bruce Sherwood wrote: We very much want a native-mode version of Visual. If you want a native app, then don't fight the framework. Rolling your own event system, and doing away with nib files is not a project for someone new to the platform, and once you have experience with Cocoa, you'll know better than to reinvent the wheel. That's not really a helpful response to his question. He is not trying to fight the framwork, but his code is something that is loaded by python -- he is not the shell app. So his requirements are a bit different that a standard app. Not that I have any answers for him... B.J. Buchalter Metric Halo http://www.mhlabs.com ___ 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 [EMAIL PROTECTED]
Re: NSString format parameter order
You can use the POSIX standard library (sprintf) rather than NSStrings for this... On Apr 8, 2008, at 5:48 AM, Jere Gmail wrote: On Apr 8, 2008, at 3:33 AM, Jere Gmail wrote: I'm looking for a way to switch parameters order in order to use the same parameters for different languages. something like NSString string1=@you NSString string1=@hello NSString str=[NSString stringWithFormat:@%2 %1, string1,string2]; will make str value hello you. I have been working with CString over in windows and it is possible but i don't find any alternatives ___ 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/zon7mail%40gmail.com This email sent to [EMAIL PROTECTED] -- http://zon7blog.wordpress.com/ And again we fall. ___ 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/bj%40mhlabs.com This email sent to [EMAIL PROTECTED] B.J. Buchalter Metric Halo http://www.mhlabs.com ___ 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 [EMAIL PROTECTED]
Re: Nested Enum Error
Obj-C Classes do not form a namespace like they do in C++. Both enum Error are in the global scope. That is the source of your problem... Best regards, B.J Buchalter On Mar 20, 2008, at 11:31 PM, K. Darcy Otto wrote: I've been trying to add some human-readable error codes to my classes using enum, but have been running into some difficulties when I add a different enum of the same name to a different class. Here is what I have so far in my DeductionLine class (and I think it will suffice just to show the interface: @interface DeductionLine : NSObject { Dependency *dependency; LineNumber *lineNumber; Formula *formula; Justification *justification; BOOL wfdl; // well-formed deduction line enum Error { noError = 0, // everything ok dependencyExistError = 1, // dependency does not exist lineNumberExistError = 2, // line number does not exist formulaFormError = 3, // formula is not a wff justificationFormError = 4, // justification is not a wfj justificationReferenceError = 5, // justification references lines greater or equal to lineNumber justificationMatchError = 6 // justification is $I, but main connective of formula does not correspond to $ } errorCode; } Now, I know the =0, =1 is redundant, but I want it there for ease of reading, just in case the programmer wants to output errorCode to a log (which will result in an integer, which can then be looked up in the interface). This works fine in this class: I can write: errorCode = noError; or whatever, and everything is happy. But when I try to do something similar in the DeductionLineSequent class, there is no end to compiler complaining: @interface DeductionLineSequent : NSObject { NSArray *sequent; NSArray *additionalFormulae; BOOL valid; enum Error { noError = 0, // everything ok dependencyError = 1, // dependency sequent invalid lineNumberError = 2, // line number sequent invalid formulaError = 3, // formula sequent invalid } errorCode; } I get nested redefinition of 'enum Error', (ii) redeclaration of 'enum Error' and (iii) redeclaration of enumerator 'noError'. So, I have two questions: is it possible to get each enum local to the class in which it is defined (so it does not seem to be nested)? Second, is there a better strategy for defining human-readable error codes? Thanks. ___ 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/bj%40mhlabs.com This email sent to [EMAIL PROTECTED] B.J. Buchalter Metric Halo http://www.mhlabs.com ___ 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 [EMAIL PROTECTED]