Re: How to create a control just as RGB Sphere and Alpha bar
Hi Graham, Yes. But do you have any other ways to handle this. I want something like this I could be able to pick the color from the spectrum band and could change the Alpha (This I can manage to some extent, Immediately I need to handle the picking colour from the spectrum.) Regards Mustafa On Fri, Sep 25, 2009 at 1:41 PM, Graham Cox graham@bigpond.com wrote: On 25/09/2009, at 1:14 PM, Symadept wrote: Can any help me how to create a view which contains Spectrum Bar (Just as RGB Sphere in NSColorPanel) and an Alpha bar? NSImageView? --Graham ___ 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 create a control just as RGB Sphere and Alpha bar
tsk, tsk - lazy, lazy. http://mattgemmell.com/2008/12/08/what-have-you-tried http://catb.org/~esr/faqs/smart-questions.html C'mon, get real. No-one's going to write your code for you. If you can't find a free class somewhere, subclass NSView yourself. A location -- RGB mapping is pretty easy. --Graham On 25/09/2009, at 4:20 PM, Symadept wrote: Hi Graham, Yes. But do you have any other ways to handle this. I want something like this I could be able to pick the color from the spectrum band and could change the Alpha (This I can manage to some extent, Immediately I need to handle the picking colour from the spectrum.) Regards Mustafa ___ 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 create a control just as RGB Sphere and Alpha bar
Hi Graham, I tried to display the RGB spectrum as an image in the view. How can I pick particular pixel color from that image. Does it make sense? -Mustafa On Fri, Sep 25, 2009 at 2:29 PM, Graham Cox graham@bigpond.com wrote: tsk, tsk - lazy, lazy. http://mattgemmell.com/2008/12/08/what-have-you-tried http://catb.org/~esr/faqs/smart-questions.html C'mon, get real. No-one's going to write your code for you. If you can't find a free class somewhere, subclass NSView yourself. A location -- RGB mapping is pretty easy. --Graham On 25/09/2009, at 4:20 PM, Symadept wrote: Hi Graham, Yes. But do you have any other ways to handle this. I want something like this I could be able to pick the color from the spectrum band and could change the Alpha (This I can manage to some extent, Immediately I need to handle the picking colour from the spectrum.) Regards Mustafa ___ 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: Subview drawn with reverted order
Thanks to all of you. Anyway, I must compile for Tiger, so how can I workaround this trouble? I thought to programmatically move the subviews to the right position. Am I right? Regards -- LL It seems that the Front-Back drawing order of the subviews has been reverted. How to fix this problem? No longer true as of Leopard. ___ 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
CustomComboboxCell not displaying the selected text
Hi, I have designed one combobox with CustomComboBoxCell set from the Interface Builder and trying to Change the Complete rectangle with my own image using drawWithFrame. Once I choose the any item from the DropDownList it is not displaying the text immediately in the Textfield of the ComboBox. But it works fine after clicking once into the Textfield. I have pasted my code for CustomComboBoxCell. Please help me if I am missing anything. @interface CustomComboboxCell(private) - (void)initializations; @end @implementation CustomComboboxCell(private) - (void)initializations { mImage = [NSImage imageNamed:@ComboBox1]; } @end @implementation CustomComboboxCell - (id)init { NSLog(@CustomComboboxCell init); self = [super init]; if (self != nil) { [self initializations]; } return self; } - (id)initWithCoder:(NSCoder *)aDecoder { NSLog(@CustomComboboxCell initWithCoder); self = [super initWithCoder:aDecoder]; [self initializations]; return self; } - (void) dealloc { [mImage release]; [super dealloc]; } - (void)drawWithFrame:(NSRect)bounds inView:(NSView *)controlView { NSLog(@CustomComboboxCell drawWithFrame[%f %f - %f %f], bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height); NSRect imageRect = bounds;//[self drawingRectForBounds:bounds];//[self imageRectForBounds:bounds]; NSLog(@Image rect [%f %f - %f %f], imageRect.origin.x, imageRect.origin.y, imageRect.size.width, imageRect.size.height); if (mImage != nil) { [mImage setFlipped:[controlView isFlipped]]; [mImage drawInRect:imageRect fromRect:NSZeroRect operation: NSCompositeSourceAtop fraction:1.0]; } } Thanks in advance -Mustafa ___ 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
App Crashing on a second AppleScript call
Folks; I have an app that receives AppleScript calls App passes Clang with no warnings; using XC 3.2 w/ 10.6SDK The call is made successfully and performs beautifully -- the first time! Everything works just as intended. The second script call is processed by the app but crashes immediately after it finishes processing. Here's the stack: #0 0x9330692c in objc_msgSend #1 0x00628d30 in ?? #2 0x93ae75bd in _CFAutoreleasePoolPop #3 0x94562e62 in NSPopAutoreleasePool #4 0x94562d8a in -[NSAutoreleasePool drain] #5 0x945aa25e in _NSAppleEventManagerGenericHandler #6 0x943bbde6 in aeDispatchAppleEvent #7 0x943bbce5 in dispatchEventAndSendReply #8 0x943bbbf2 in aeProcessAppleEvent #9 0x920de381 in AEProcessAppleEvent #10 0x911caed2 in _DPSNextEvent #11 0x911ca50a in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] #12 0x9118c69b in -[NSApplication run] #13 0x91184735 in NSApplicationMain Any thoughts on what I am doing wrong? or how to track down what is going on? Thanks for your time and consideration, Steve ___ 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: App Crashing on a second AppleScript call
Crashes involving autorelease pools are symptoms of memory management bugs in your code. Check out NSZombieEnabled. ___ 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: NSTableView Drag Drop as a string
You haven't declared ownership of the pasteboard, so I imagine the system is somewhat confused. Fairly sure you need to do: [pboard declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:self]; [pboard setString:str forType:NSStringPboardType]; On 25 Sep 2009, at 02:58, Todd Heberlein wrote: I have an NSTableView and I have Drag Drop working between table views for my application where I encode the object to an NSData and write it to the NSPasteboard. But now I want to create a string representation of the object, add it to the pasteboard as well, and then when the object is dragged to something like an email, the string representation of the object is written in. The content does seem to be written to the pasteboard, but the drop doesn't seem to happen in an appropriate target (email message, editor, etc.) The same basic code works in -copy: but it doesn't seem to work in - tableView:writeRowsWithIndexes:toPasteboard: The line of code is: [pboard setString:str forType:NSStringPboardType]; Is there something different with the NSPasteboard passed into - tableView:writeRowsWithIndexes:toPasteboard: versus the pasteboard you get from [NSPasteboard generalPasteboard]? Any suggestions on what I am doing wrong? Thanks, Todd ___ 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
Re: Correct way to tell if a path is to a .bundle?
I would read up on UTIs. Get the type of each file and see if it conforms to what you require. I have what I hope is a reasonably informative post here: http://www.mikeabdullah.net/utis_diagram/ Note how there is a com.apple.plugin type. If you're using a custom format for your plug-ins (and you should), make your app declare a com.foo.app.plugin type for them, which conforms to com.apple.plugin. On 25 Sep 2009, at 02:41, Rick Mann wrote: I'm scanning a directory for plugins for my app. Given a path, what's the right way to tell if it's a path to a bundle? TIA -- Rick ___ 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
Re: Subview drawn with reverted order
On 25 Sep 2009, at 08:26, gMail.com wrote: Thanks to all of you. Anyway, I must compile for Tiger, so how can I workaround this trouble? I thought to programmatically move the subviews to the right position. Am I right? No. For Tiger and earlier, overlapping views are not supported. You will get all sorts of strange results. You need to either make one view a subview of the other, or write some custom drawing and event handling code to give the impression of overlapping views. ___ 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 create a control just as RGB Sphere and Alpha bar
http://www.google.com/search?client=safarirls=en-usq=cocoa+get+pixel+rgb+valueie=UTF-8oe=UTF-8 Florian. On 25 Sep 2009, at 09:12, Symadept wrote: Hi Graham, I tried to display the RGB spectrum as an image in the view. How can I pick particular pixel color from that image. Does it make sense? -Mustafa On Fri, Sep 25, 2009 at 2:29 PM, Graham Cox graham@bigpond.com wrote: tsk, tsk - lazy, lazy. http://mattgemmell.com/2008/12/08/what-have-you-tried http://catb.org/~esr/faqs/smart-questions.html C'mon, get real. No-one's going to write your code for you. If you can't find a free class somewhere, subclass NSView yourself. A location -- RGB mapping is pretty easy. --Graham On 25/09/2009, at 4:20 PM, Symadept wrote: Hi Graham, Yes. But do you have any other ways to handle this. I want something like this I could be able to pick the color from the spectrum band and could change the Alpha (This I can manage to some extent, Immediately I need to handle the picking colour from the spectrum.) Regards Mustafa ___ 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/florian.soenens%40nss.be This email sent to florian.soen...@nss.be Looking for Web-to-Print Solutions? Visit our website : http://www.vit2print.com This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information and/or information protected by intellectual property rights. If you are not the intended recipient, please note that any review, dissemination, disclosure, alteration, printing, copying or transmission of this e-mail and/or any file transmitted with it, is strictly prohibited and may be unlawful. If you have received this e-mail by mistake, please immediately notify the sender and permanently delete the original as well as any copy of any e-mail and any printout thereof. We may monitor e-mail to and from our network. NSS nv Tieltstraat 167 8740 Pittem Belgium ___ 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
Advice on debugging a GC related crash
I've just released my first application, and despite the best efforts of me and an admitedly small group of beta testers it seems that a crashers slipped through. So far this one has only effected 1 user out of maybe 500: OS: 10.6.1 Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x182365ed Crashed Thread: 3 Dispatch queue: Garbage Collection Work Queue Thread 3 Crashed: Dispatch queue: Garbage Collection Work Queue 0 com.apple.CoreFoundation 0x95c6c393 __CFTypeCollectionRelease + 83 1 com.apple.CoreFoundation 0x95c68eb8 __CFBasicHashStandardCallback + 296 2 com.apple.CoreFoundation0x95c68b78 __CFBasicHashDrain + 568 3 com.apple.Foundation 0x92a20f64 -[NSCFDictionary finalize] + 45 4 libobjc.A.dylib 0x9724618d finalizeOneObject + 59 5 libauto.dylib 0x9769d612 Auto::foreach_block_do (auto_zone_cursor*, void (*)(void*, void*), void*) + 66 6 libobjc.A.dylib 0x97245e0e batchFinalize + 247 7 libobjc.A.dylib 0x97245e92 batchFinalizeOnTwoThreads + 104 8 libauto.dylib 0x97696cd9 Auto::Zone::invalidate_garbage(unsigned long, unsigned int const*) + 89 9 libauto.dylib 0x97687a65 auto_collect_internal (Auto::Zone*, int) + 645 10 libauto.dylib 0x976882ac auto_collection_work (Auto::Zone*) + 140 11 libSystem.B.dylib 0x967977b8 _dispatch_call_block_and_release + 16 12 libSystem.B.dylib 0x9678a144 _dispatch_queue_drain + 249 13 libSystem.B.dylib 0x96789b77 _dispatch_queue_invoke + 53 14 libSystem.B.dylib 0x9678998a _dispatch_worker_thread2 + 234 15 libSystem.B.dylib 0x96789401 _pthread_wqthread + 390 16 libSystem.B.dylib 0x96789246 start_wqthread + 30 Thread 3 crashed with X86 Thread State (32-bit): eax: 0xa0821ca0 ebx: 0x95c6c354 ecx: 0x182365e8 edx: 0x01798fd0 edi: 0x182365ec esi: 0x182365e8 ebp: 0xb0291a78 esp: 0xb0291a50 ss: 0x001f efl: 0x00010246 eip: 0x95c6c393 cs: 0x0017 ds: 0x001f es: 0x001f fs: 0x001f gs: 0x0037 cr2: 0x182365ed I haven't been able to reproduce this problem on my machine or any of the other machines that I've tested on and I'm a bit lost as to how to go about reproducing it never mind fixing it. Any advice would be most appreciated. Cheers Harry ___ 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
Best way to implement drag and drop for multiple types of nstableview
Hi- I have used mmalc's DNDArrayController class from his Bookmarks example code to implement drag and drop for one of my NSTableViews. Of course it works great. But now I would like to set up a couple other table views with other types of data. I can re-use my DNDArrayController, but then the interface thinks a user can drag between two tables with totally different types of data in them. I can copy the class files and set up the new drag types in the copies, but I feel the urge to resist having multiple nearly identical classes of DNDArrayController lying around. I guess I could subclass DNDArrayController and have a method that returns the data types for that particular subclass. That one doesn't sound too evil. Can anyone provide some guidance on the correct way to set up these multiple NSTableViews with drag and drop? 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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
proper technique for CoreData SQLite fetch with sort descriptors
First off, I'll say that I'm trying to maintain Tiger compatibility in my app, so if anyone tries to duplicate this on Leopard or Snow Leopard, they may not have any luck. I have an NSArrayController bound to a set of objects in an SQLite CoreData store. The NSArrayController by default has several NSSortDescriptors associated with it to properly order the objects (since there are several properties to sub-sort on). One of those, however, causes it to blow up badly - specifically, I have it set on keyPath creator.classRank, where classRank is a method sitting up in my object class that isn't appropriate to stick into my data store. I get an error about an unresolved keyPath for creator.classRank. Some digging around yielded this post: http://lists.apple.com/archives/Cocoa-dev/2005/Aug/msg00797.html Which is basically the same issue that I'm having - in my case, it's the keyPath that doesn't exist in the SQLite store that's causing the fetch to fail. To address it, I overrode fetchWithRequest:merge:error: in my NSArrayController subclass, as such: - (BOOL)fetchWithRequest:(NSFetchRequest *)fetchRequest merge:(BOOL)merge error:(NSError **)error { //Make a copy of the fetchRequest's sortDescriptors NSMutableArray* safeSortDescriptors = [NSMutableArray arrayWithArray:[fetchRequest sortDescriptors]]; //pull out the classRankSortDescriptor (this is a static class variable which is used initially to populate the controller's sortDescriptors during awakeFromNib [safeSortDescriptors removeObject:classRankSortDescriptor]; //reset the sort descriptors to the sanitized version, without the offending descriptor [fetchRequest setSortDescriptors:safeSortDescriptors]; //carry on our merry way return [super fetchWithRequest:fetchRequest merge:merge error:error]; } This works fine, and I'm not seeing any issues. Proper behavior on Tiger, Leopard, and Snow Leopard. The fetch executes just fine, and then the original sort descriptors (with creator.classRank) in my NSArrayController subclass sort my data appropriately. I have two questions - 1) Is this the proper technique to use to address this issue? Or is there a different method I should subclass or technique I should use instead? This feels kinda hackish, so I want to be sure I'm doing it the right way. 2) I didn't seem to have any problems just leaving the new sort descriptor in place on either Leopard or Snow Leopard, this is purely a Tiger issue. Can anyone confirm if this behavior has changed and this hack is no longer necessary on Leopard or higher? I wasn't sure if the behavior had changed to allow this, or if I'd just gotten lucky somehow due to an unrelated changed in the OS. Thanks, -Jim... ___ 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: Advice on debugging a GC related crash
On Sep 25, 2009, at 4:32 AM, Harry Jordan wrote: Thread 3 Crashed: Dispatch queue: Garbage Collection Work Queue 0 com.apple.CoreFoundation 0x95c6c393 __CFTypeCollectionRelease + 83 1 com.apple.CoreFoundation 0x95c68eb8 __CFBasicHashStandardCallback + 296 2 com.apple.CoreFoundation0x95c68b78 __CFBasicHashDrain + 568 3 com.apple.Foundation 0x92a20f64 -[NSCFDictionary finalize] + 45 4 libobjc.A.dylib 0x9724618d finalizeOneObject + 59 5 libauto.dylib 0x9769d612 Auto::foreach_block_do (auto_zone_cursor*, void (*)(void*, void*), void*) + 66 Check the crash log for libraries that you don't recognize that aren't from Apple. It might be that the user has some random bit of driverware that is buggy. That has been the typical source of a crash like this where only 1 of many users see this. In particular, there were a couple of random web cam type things that seemed to have been the source of this kind of failure. The other source has been bundle unloading. Unloading of bundles in Objective-C is incredibly hard to get right. Hard to the point of considering it truly unsupported. If a bundle was unloaded and there was a reference to an NSString constant in that bundle and the string had been put into a dictionary that was later collected after unload, you'll see a crash like this. The best evidence in this case will be a hole in the addresses of the dylibs. If you are really lucky, register %eax (on i386, anyway) will contain an address that points to the hole. In any case, ask the user what kind of software/hardware they have installed that is of the non-app persuasion. b.bum ___ 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
Scrolling a NSTextField
Hi, I have an non-editable/selectable NSTextField which content is set programatically (and the field's layout attribute is set to Scroll). Now when the field is filled, the overflow text is not displayed despite the Scroll attribute. When turning the fied selectable/editable this works fine : as soon as the content is bigger than the field's size, its content is immediately scrolled to the cursor position. Is there a way to perform this behaviour manually ? 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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Correct way to tell if a path is to a .bundle?
On Sep 24, 2009, at 9:51 PM, Rick Mann wrote: Thanks Jens. If I create a custom extension for my plugins (not even sure I can do that), will this still work? Yup, as long as you declare the extension properly in your Info.plist and indicate that it's a bundle. —Jens___ 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: Remove NSTableView Default Selection
On Sep 24, 2009, at 8:12 PM, Jens Alfke wrote: On Sep 24, 2009, at 5:07 PM, John McIntosh wrote: I assumed that I could send the same deselectAll message in either an awakeFromNib function or applicationDidFinishLaunching. However, neither of these clears the selection. Make sure you've checked the table's Empty checkbox (allow empty selection) in the nib. Also, if there's a controller bound to the table, uncheck its Avoid empty selection checkbox. Some additional information to what Jens said: action based methods, like the user selecting a row, -deselectAll: and -selectAll:, respect the allows empty selection setting and will keep an item selected if turned off and if possible. Programmer methods will override that behavior. So, if you call [table selectRowIndexes:[NSIndexSet indexSet] byExtendingSelection:NO], you should still be able to get an empty selection. corbin ___ 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 create a control just as RGB Sphere and Alpha bar
On Sep 25, 2009, at 3:02 AM, Florian Soenens wrote: http://www.google.com/search?client=safarirls=en-usq=cocoa+get+pixel+rgb+valueie=UTF-8oe=UTF-8 In this case it might be better to check http://lmgtfy.com/?q=cocoa+get+pixel+rgb+value first. One of my favorite references in these sorts of cases. —Jens___ 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: [__NSFastEnumerationEnumerator nextObject] unexpectedly not very fast!
Graham Cox mailto:graham@bigpond.com wrote (Thursday, September 24, 2009 6:10 PM +1000): I thought that NSEnumerator was implemented in terms of fast enumeration underneath - the docs seem to imply that, as does the existence of __NSFastEnumerationEnumerator private class. It may be still slower than directly using the fast enumeration syntax, but isn't there some gain to be had? I have hundreds of these enumeration loops and I still need to support 10.4; I thought I was getting *some* benefit automagically from fast enumeration on 10.5+ No one replied to your questiona directly, so I'll throw in my two cents. Fast enumeration is a 10.5+ObjC2.0 feature only and is implemented as an alternate method of enumeration. NSEnumerator in 10.5 is not built on top of fast enumeration or vise versa. The reason is simple: fast enumeration achieves most of its speed improvement by fetching objects in batches. The interface to NSEnumerator fetches one object at a time, so nothing underneath it is going to avoid the overhead of the per-object message that it already incurs. What's mentioned in the documentation is that NSEnumerator implements the fast enumeration protocol *in order to be compatible with* fast enumeration syntax. This means that you can use any NSEnumerator object as the subject of a fast enumeration statement in Objective-C 2.0: NSEnumerator *e = [collection enumerator]; for ( id i in e ) ... But this is not optimized; fast enumeration just calls [e nextObject] once for each object, so it isn't any faster than using the NSEnumerator. The only thing you've saved is typing. In summary, the existence of fast enumeration does nothing for existing enumeration technologies and if you have to support 10.4 (as I do) you simply can't use it unless you fork your code. My solution, in the few cases where performance is paramount, has been to essentially roll my own fast enumeration. For very large arrays (thousands of objects) I'll get blocks of objects in batching using [NSArray getObjects:range:], process those in a tight C loop, and then get another batch. Also, wouldn't methods such as -makeObjectsPerformSelector:withObject: and CFArrayApplyFunction(...) gain some benefit from fast enumeration? I use these a lot too. I'm sure these kinds of functions are optimized internally and probably don't use enumerator objects or fast enumeration. But that's just a guess. The rule is, as always, don't worry about it unless it's a problem, then profile it, find the bottleneck, and work around it. -- James Bucanek ___ 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: Remove NSTableView Default Selection
Perfect, thank you! I have the table bound to a core data source and did not know about the avoid empty selection option in the controller. Unckecking that box took care of it. John On Thu, Sep 24, 2009 at 10:12 PM, Jens Alfke j...@mooseyard.com wrote: On Sep 24, 2009, at 5:07 PM, John McIntosh wrote: I assumed that I could send the same deselectAll message in either an awakeFromNib function or applicationDidFinishLaunching. However, neither of these clears the selection. Make sure you've checked the table's Empty checkbox (allow empty selection) in the nib. Also, if there's a controller bound to the table, uncheck its Avoid empty selection checkbox. —Jens ___ 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
Subclass of NSView not responding to mouseDown event
Hi guys. I am working though the book 'Learning Cocoa with Objective-C 2nd edition and have reached the Dot View example. It is a simple app that should demonstrate responding to mouse events. Apart from having to cope with the difference between the version of X-Code the book was developed with, and the more up to date version I am using, I haven't had any trouble with the book until now. I created a class DotView which is a subclass of NSView. I Added a Custom view to my app and set it's class to be DotView. In the DotView class I have implemented the mouseDown event handler, but I do not seem to be getting the events. I do get some build warnings that the DotView class may not respond to the needsDrawing message, and when typing the code the autocomplete doesn't suggest mouseDown as an option. It seems as though it hasn't really made it a subclass of NSView, any thoughts? Looking through the lists I saw some suggestions to previous questions that suggested adding the acceptsFirstMouse and acceptsFirstResponder methods, so I have added those as well, but still no luck. Sample code below. // // DotView.h // // Created by Paul Buxton on 25/09/2009. // Copyright 2009 __MyCompanyName__. All rights reserved. // #import Cocoa/Cocoa.h @interface DotView : NSView { IBOutlet NSColorWell *colorWell; IBOutlet NSSlider *slider; NSPoint center; NSColor *color; float radius; } - (IBAction)setColor:(id)sender; - (IBAction)setRadius:(id)sender; @end // // DotView.m // // Created by Paul Buxton on 25/09/2009. // Copyright 2009 __MyCompanyName__. All rights reserved. // #import DotView.h @implementation DotView -(id)initWithFrame:(NSRect)frameRect { self = [super initWithFrame:frameRect]; center.x=50.0; center.y=50.0; radius=20; color = [[NSColor redColor] retain]; return self; } -(void)awakeFromNib { [colorWell setColor:color]; [slider setFloatValue:radius]; } -(void)dealloc { [color release]; [super dealloc]; } -(void)drawRect:(NSRect)dirtyRect { NSRect dotRect; [[NSColor whiteColor] set]; NSRectFill([self bounds]); dotRect.origin.x = center.x - radius; dotRect.origin.y = center.y - radius; dotRect.size.width = 2*radius; dotRect.size.height = 2*radius; [color set]; [[NSBezierPath bezierPathWithOvalInRect:dotRect] fill]; } -(BOOL)isOpaque { return YES; } -(void)mouseDown:(NSEvent *)event { NSPoint eventlocation = [event locationInWindow]; center = [self convertPoint:eventlocation fromView:nil]; [self needsDisplay:YES]; } - (IBAction)setColor:(id)sender { NSColor *newColor = [sender color]; [newColor retain]; [color release]; color = newColor; [self needsDisplay:YES]; } - (IBAction)setRadius:(id)sender { radius = [sender floatValue]; [self needsDisplay:YES]; } -(BOOL)acceptsFirstMouse:(NSEvent *)theEvent { return YES; } -(BOOL)acceptsFirstResponder { return YES; } @end Cheers, Paul ___ 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: NSTableView Drag Drop as a string
Solved it! ... But now I want to create a string representation of the object, add it to the pasteboard as well, and then when the object is dragged to something like an email, the string representation of the object is written in. The problem was that I was trying to do a cross-application drag and drop. The solution was to add to my -awakeFromNib method the line: [myTableView setDraggingSourceOperationMask:NSDragOperationEvery forLocal:NO]; This allows drag-and-drop across applications. Todd ___ 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: Correct way to tell if a path is to a .bundle?
On 9/25/09 8:12 AM, Jens Alfke said: Thanks Jens. If I create a custom extension for my plugins (not even sure I can do that), will this still work? Yup, as long as you declare the extension properly in your Info.plist and indicate that it's a bundle. Of course that requires that your Info.plist be present for Launch Services to consult. So while you should absolutely do as Jens says, you should additionally set the bundle bit for packages you create. See 'man SetFile'. SetFile -a B /path/to/package. Many apps fail to do this. Ever noticed that after a fresh OS install the Finder shows .xcodeproj packages as folders? That's why. -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ 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: Subclass of NSView not responding to mouseDown event
On 25 Sep 2009, at 15:03, Paul Buxton wrote: Hi guys. I am working though the book 'Learning Cocoa with Objective- C 2nd edition and have reached the Dot View example. It is a simple app that should demonstrate responding to mouse events. Apart from having to cope with the difference between the version of X-Code the book was developed with, and the more up to date version I am using, I haven't had any trouble with the book until now. I created a class DotView which is a subclass of NSView. I Added a Custom view to my app and set it's class to be DotView. In the DotView class I have implemented the mouseDown event handler, but I do not seem to be getting the events. What makes you say that? Have you tested it in the debugger? I do get some build warnings that the DotView class may not respond to the needsDrawing message, and when typing the code the autocomplete doesn't suggest mouseDown as an option. It seems as though it hasn't really made it a subclass of NSView, any thoughts? That's because there is no -needsDrawing: or -needsDisplay: method. There is however, -setNeedsDisplay: which is almost certainly what you want. Looking through the lists I saw some suggestions to previous questions that suggested adding the acceptsFirstMouse and acceptsFirstResponder methods, so I have added those as well, but still no luck. You generally don't want -acceptsFirstMouse. Read up on what that method does. Either way, neither of these should have an effect on whether your class receives a -mouseDown: event. Sample code below. // // DotView.h // // Created by Paul Buxton on 25/09/2009. // Copyright 2009 __MyCompanyName__. All rights reserved. // #import Cocoa/Cocoa.h @interface DotView : NSView { IBOutlet NSColorWell *colorWell; IBOutlet NSSlider *slider; NSPoint center; NSColor *color; float radius; } - (IBAction)setColor:(id)sender; - (IBAction)setRadius:(id)sender; @end // // DotView.m // // Created by Paul Buxton on 25/09/2009. // Copyright 2009 __MyCompanyName__. All rights reserved. // #import DotView.h @implementation DotView -(id)initWithFrame:(NSRect)frameRect { self = [super initWithFrame:frameRect]; center.x=50.0; center.y=50.0; radius=20; color = [[NSColor redColor] retain]; return self; } -(void)awakeFromNib { [colorWell setColor:color]; [slider setFloatValue:radius]; } -(void)dealloc { [color release]; [super dealloc]; } -(void)drawRect:(NSRect)dirtyRect { NSRect dotRect; [[NSColor whiteColor] set]; NSRectFill([self bounds]); dotRect.origin.x = center.x - radius; dotRect.origin.y = center.y - radius; dotRect.size.width = 2*radius; dotRect.size.height = 2*radius; [color set]; [[NSBezierPath bezierPathWithOvalInRect:dotRect] fill]; } -(BOOL)isOpaque { return YES; } -(void)mouseDown:(NSEvent *)event { NSPoint eventlocation = [event locationInWindow]; center = [self convertPoint:eventlocation fromView:nil]; [self needsDisplay:YES]; } - (IBAction)setColor:(id)sender { NSColor *newColor = [sender color]; [newColor retain]; [color release]; color = newColor; [self needsDisplay:YES]; } - (IBAction)setRadius:(id)sender { radius = [sender floatValue]; [self needsDisplay:YES]; } -(BOOL)acceptsFirstMouse:(NSEvent *)theEvent { return YES; } -(BOOL)acceptsFirstResponder { return YES; } @end Cheers, Paul ___ 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
Quartz 2D or Core Animation?
I am still confused as to whether I should use Core Animation or Quartz 2D. Basically, the task I would like to do is this: - draw two images with alpha blending in a window (actually, a screen saver window) - grow and shrink the images at 30 frames/sec - use as little CPU as possible! Could some kind soul please advise me on which framework would be best suited? I read up all day on Quartz 2D and Core Animation, but I'm still confused. Which one uses the least amount of CPU for the task? Example code would also be highly appreciated! Best regards, Gabriel. smime.p7s Description: S/MIME cryptographic signature ___ 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: Best way to implement drag and drop for multiple types of nstableview
On Sep 25, 2009, at 9:25 AM, Paul Bruneau wrote: I have used mmalc's DNDArrayController class from his Bookmarks example code to implement drag and drop for one of my NSTableViews. Of course it works great. But now I would like to set up a couple other table views with other types of data. I can re-use my DNDArrayController, but then the interface thinks a user can drag between two tables with totally different types of data in them. Paul: Unless I'm missing something, why not add properties to your array controller class that keeps track of the desired types? If you use multiple tables for the same array controller instance, you could get even fancier and keep an association between provided and accepted types for each table. -- I.S. ___ 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: Correct way to tell if a path is to a .bundle?
On Sep 25, 2009, at 08:52:40, Sean McBride wrote: On 9/25/09 8:12 AM, Jens Alfke said: Thanks Jens. If I create a custom extension for my plugins (not even sure I can do that), will this still work? Yup, as long as you declare the extension properly in your Info.plist and indicate that it's a bundle. Of course that requires that your Info.plist be present for Launch Services to consult. So while you should absolutely do as Jens says, you should additionally set the bundle bit for packages you create. See 'man SetFile'. SetFile -a B /path/to/package. Many apps fail to do this. Ever noticed that after a fresh OS install the Finder shows .xcodeproj packages as folders? That's why. Thanks to you both for the details! -- Rick ___ 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
Displaying characters from the 'Unicode Symbols' font ??
Hi, Recently, I installed the 'Unicode Symbols' font. I would like to diplay all characters in this font. The problem is, that I do not know how to handle the characters outside the 16 bits range. For instance the: Mathematical Alfanumerics Symbols in the range 1D400..1D7FF. Any suggestions are welcome. Kind regards, Anders Lassen ___ 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: Displaying characters from the 'Unicode Symbols' font ??
What are you trying to do? Display them in a grid like the Characters palette does? Or typeset them like Font Book does? Or something else? --Kyle Sluder ___ 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: Displaying characters from the 'Unicode Symbols' font ??
On Sep 25, 2009, at 7:18 PM, Kyle Sluder wrote: What are you trying to do? Display them in a grid like the Characters palette does? Or typeset them like Font Book does? Or something else? --Kyle Sluder Hi Kyle, I am trying to display them in a custom NSView that displays math. Of course not all, at the same time, but single characters when needed in a math formula drawing. For unicode characters in the 16 bits range I use the following code: NSGlyph glyph = [font _defaultGlyphForChar:ch]; NSBezierPath* path = [[NSBezierPath alloc] init]; [path moveToPoint:NSMakePoint(rect.origin.x,rect.origin.y)]; [path appendBezierPathWithGlyph:glyph inFont:font]; This works fine for characters in the 16 bits range. Outside this range, I am in trouble since input to _defaultGlyphForChar is 16 bit. Anders Lassen ___ 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: Re: [__NSFastEnumerationEnumerator nextObject] unexpectedly not very fast!
In summary, the existence of fast enumeration does nothing for existing enumeration technologies and if you have to support 10.4 (as I do) you simply can't use it unless you fork your code. My solution, in the few cases where performance is paramount, has been to essentially roll my own fast enumeration. For very large arrays (thousands of objects) I'll get blocks of objects in batching using [NSArray getObjects:range:], process those in a tight C loop, and then get another batch. The for (in) construct is by far the most optimized general purpose way to work with any of the collections in Cocoa on 10.5, 10.6, and iPhone OS. It's also polymorphic, so custom collection subclasses can fine tune the behavior. If you have to hand roll your own, either for 10.4, or some specialized case, your best bet is to use -getObjects: into a local buffer. gcc supports variable length arrays, and that's the fastest way to marshall these batches temporarily. You'll want to be very careful to do length checks to not overrun your stack, and limit the size. If you have somewhere between 256 512 objects, give or take, you'll have to malloc a temporary id* Overflowing the stack is not pretty. - Ben ___ 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: Displaying characters from the 'Unicode Symbols' font ??
On Fri, Sep 25, 2009 at 10:34 AM, Anders Lassen anders.las...@mac.com wrote: I am trying to display them in a custom NSView that displays math. Of course not all, at the same time, but single characters when needed in a math formula drawing. Sounds like you're subverting the Cocoa text system. Not a good idea. Perhaps you should subclass NSLayoutManager to create custom text containers, and NSTypesetter to lay out your math text. For unicode characters in the 16 bits range I use the following code: NSGlyph glyph = [font _defaultGlyphForChar:ch]; I don't see this method documented anywhere. Meanwhile, CTFont has CTFontGetGlyphsForCharacters and CTFontGetGlyphWithName (which is what you're probably going to want). --Kyle Sluder ___ 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 create a control just as RGB Sphere and Alpha bar
Is there some reason why you can't use the color picker to specify a color+alpha value? It would save you a bunch of work in duplicating existing system functionality. On Sep 24, 2009, at 11:20 PM, Symadept wrote: Hi Graham, Yes. But do you have any other ways to handle this. I want something like this I could be able to pick the color from the spectrum band and could change the Alpha (This I can manage to some extent, Immediately I need to handle the picking colour from the spectrum.) Regards Mustafa On Fri, Sep 25, 2009 at 1:41 PM, Graham Cox graham@bigpond.com wrote: On 25/09/2009, at 1:14 PM, Symadept wrote: Can any help me how to create a view which contains Spectrum Bar (Just as RGB Sphere in NSColorPanel) and an Alpha bar? NSImageView? --Graham ___ 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: Displaying characters from the 'Unicode Symbols' font ??
On Sep 25, 2009, at 10:34 AM, Anders Lassen wrote: I am trying to display them in a custom NSView that displays math. Of course not all, at the same time, but single characters when needed in a math formula drawing. For unicode characters in the 16 bits range I use the following code: NSGlyph glyph = [font _defaultGlyphForChar:ch]; NSBezierPath* path = [[NSBezierPath alloc] init]; [path moveToPoint:NSMakePoint(rect.origin.x,rect.origin.y)]; [path appendBezierPathWithGlyph:glyph inFont:font]; This works fine for characters in the 16 bits range. Outside this range, I am in trouble since input to _defaultGlyphForChar is 16 bit. If all you want to do is to display a character in a given font, the string drawing APIs will work just fine for that. If you really need to have a bezier path, don't use the code you show here; we have a sample showing how to get a bezier path from text--look at bezierWithFont: in http://developer.apple.com/mac/library/samplecode/SpeedometerView/listing9.html . Douglas Davidson ___ 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: Displaying characters from the 'Unicode Symbols' font ??
Hi, Thanks this was helpful. Now I can drop _defaultGlyphForChar for a better solution. But still, I can not see, how this solve my problem getting characters outside the unicode 16 bits range into a NSString. Anders Lassen On Sep 25, 2009, at 8:03 PM, Douglas Davidson wrote: On Sep 25, 2009, at 10:34 AM, Anders Lassen wrote: I am trying to display them in a custom NSView that displays math. Of course not all, at the same time, but single characters when needed in a math formula drawing. For unicode characters in the 16 bits range I use the following code: NSGlyph glyph = [font _defaultGlyphForChar:ch]; NSBezierPath* path = [[NSBezierPath alloc] init]; [path moveToPoint:NSMakePoint(rect.origin.x,rect.origin.y)]; [path appendBezierPathWithGlyph:glyph inFont:font]; This works fine for characters in the 16 bits range. Outside this range, I am in trouble since input to _defaultGlyphForChar is 16 bit. If all you want to do is to display a character in a given font, the string drawing APIs will work just fine for that. If you really need to have a bezier path, don't use the code you show here; we have a sample showing how to get a bezier path from text--look at bezierWithFont: in http://developer.apple.com/mac/library/samplecode/SpeedometerView/listing9.html . Douglas Davidson ___ 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
Disappearing NSStatusItem
Hello again, After making headway on my first cocoa app, I have run into an issue. I have created a NSStatusItem in my class called Application.m. When I run, the icon appears in my menubar but then disappears and becomes ineligable to click. I read something somewehere about thr garbage collection taking it away but I have it saved as an instance in my class so Im out of ideas. I also read about the AppDelegate class that is made for me when I make a new project but I don't know how to use that. Fail. Anyway thanks again everyone. -Jake ___ 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: Displaying characters from the 'Unicode Symbols' font ??
On Sep 25, 2009, at 11:18 AM, Anders Lassen wrote: But still, I can not see, how this solve my problem getting characters outside the unicode 16 bits range into a NSString. NSString is conceptually UTF-16, which means that characters outside the BMP are represented using surrogate pairs. However, for purposes of getting them into an NSString, you can (for example) represent them in UTF-32 and use one of the conversion methods. Alternatively, you could put them in a file, maybe a text file or a plist, and let the standard import methods deal with encoding issues. Douglas Davidson ___ 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: Displaying characters from the 'Unicode Symbols' font ??
Hi Kyle, I will try to get the glyph name somewhere on the unicode website. Instead of the methods you suggest I will use: NSGlyph name = [font glyphWithName:@summation]; Thanks. Anders Lassen On Sep 25, 2009, at 7:39 PM, Kyle Sluder wrote: On Fri, Sep 25, 2009 at 10:34 AM, Anders Lassen anders.las...@mac.com wrote: I am trying to display them in a custom NSView that displays math. Of course not all, at the same time, but single characters when needed in a math formula drawing. Sounds like you're subverting the Cocoa text system. Not a good idea. Perhaps you should subclass NSLayoutManager to create custom text containers, and NSTypesetter to lay out your math text. For unicode characters in the 16 bits range I use the following code: NSGlyph glyph = [font _defaultGlyphForChar:ch]; I don't see this method documented anywhere. Meanwhile, CTFont has CTFontGetGlyphsForCharacters and CTFontGetGlyphWithName (which is what you're probably going to want). --Kyle Sluder ___ 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: Displaying characters from the 'Unicode Symbols' font ??
Anders Lassen wrote: But still, I can not see, how this solve my problem getting characters outside the unicode 16 bits range into a NSString. If these are a few specific characters, you can look them up in the Character Viewer window to convert them to UTF-16 pairs. For example, if you look up the character 1D400, under Character Info it shows that this is D835+DC00. -- James W. Walker, Innoventive Software LLC http://www.frameforge3d.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: login items hide box
On 2009 Sep 24, at 06:25, Rick C. wrote: so i do need to update my code. but i'll be on the lookout for potential LSSharedFileList issues. thank you! Just to clarify, unless Apple has silently fixed the bug in 10.6 and you're using 10.6, I expect that you will see the same issue after updating to LSSharedFileList. Also, LSSharedFileList has another bug -- a difficult API with not much documentation. Two other developers have told me that they've found my Cocoa wrapper helpful... http://sheepsystems.com/sourceCode/ssyloginitems.html If you find that Apple has fixed the bug in 10.6, do let us know. ___ 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: Displaying characters from the 'Unicode Symbols' font ??
I have tried this but gave up, because I did not now of surrogate pairs. But I will try again. Anders Lassen On Sep 25, 2009, at 8:27 PM, Douglas Davidson wrote: On Sep 25, 2009, at 11:18 AM, Anders Lassen wrote: But still, I can not see, how this solve my problem getting characters outside the unicode 16 bits range into a NSString. NSString is conceptually UTF-16, which means that characters outside the BMP are represented using surrogate pairs. However, for purposes of getting them into an NSString, you can (for example) represent them in UTF-32 and use one of the conversion methods. Alternatively, you could put them in a file, maybe a text file or a plist, and let the standard import methods deal with encoding issues. Douglas Davidson ___ 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: Displaying characters from the 'Unicode Symbols' font ??
The Unicode values beyond 16bit range are represented with a pair of UTF-16 characters in U+D800 ~ U+DFFF. See relevant items in http://unicode.org/glossary/#S for the definitions. There are several ways to insert UTF-32 values into NSString. Doug mentioned some. The easiest is to use the C99 universal character name. For example, U+1D400 can be represented with @\U0001D400 using compliers shipped with Xcode 3.0 or later. Another approach is to use an array of UTF-32 characters and convert with NSUTF32StringEncoding. UTF32Char character = 0x0001D400; #if __BIG_ENDIAN__ NSStringEncoding encoding = NSUTF32BigEndianStringEncoding; #else NSStringEncoding encoding = NSUTF32LittleEndianStringEncoding; #endif NSString *string = [[NString alloc] initWithBytes:character length:sizeof(character) encoding:encoding]; Or, you could fill a UTF-16 buffer and create from it using new inline functions introduced with SnowLeopard. UniChar characters[2]; NSString *string; CFStringGetSurrogatePairForLongCharacter(0x0001D400, characters); string = [[NSString alloc] initWithCharacters:characters length:2]; Aki On 2009/09/25, at 11:33, Anders Lassen wrote: I have tried this but gave up, because I did not now of surrogate pairs. But I will try again. Anders Lassen On Sep 25, 2009, at 8:27 PM, Douglas Davidson wrote: On Sep 25, 2009, at 11:18 AM, Anders Lassen wrote: But still, I can not see, how this solve my problem getting characters outside the unicode 16 bits range into a NSString. NSString is conceptually UTF-16, which means that characters outside the BMP are represented using surrogate pairs. However, for purposes of getting them into an NSString, you can (for example) represent them in UTF-32 and use one of the conversion methods. Alternatively, you could put them in a file, maybe a text file or a plist, and let the standard import methods deal with encoding issues. Douglas Davidson ___ 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/aki%40apple.com This email sent to a...@apple.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: Quartz 2D or Core Animation?
Gabriel, The quick answer is use both. The two are not mutually exclusive. Also, don't worry about CPU usage until you built v1.0 of your project. Then, go back and the performance tools to optimize. regards, douglas On Sep 25, 2009, at 12:17 PM, Gabriel Zachmann wrote: I am still confused as to whether I should use Core Animation or Quartz 2D. Basically, the task I would like to do is this: - draw two images with alpha blending in a window (actually, a screen saver window) - grow and shrink the images at 30 frames/sec - use as little CPU as possible! Could some kind soul please advise me on which framework would be best suited? I read up all day on Quartz 2D and Core Animation, but I'm still confused. Which one uses the least amount of CPU for the task? Example code would also be highly appreciated! Best regards, Gabriel. ___ 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
Parsing error in NSEvent?
Hi, First: I'm not able to get online in 10.6 just yet and so haven't been able to read the new docs, in case this is something really obvious. Problem: I've got a screen saver that no longer runs on 10.6, System Preferences tells me. So I launched Xcode in order to try and figure out why, but didn't get very far. When trying to build the screen saver for 10.6, the compiler failed with a parsing error in NSEvent.h, complaining about an undefined NX_SUBTYPE_MOUSE_TOUCH (declared in the last block of code): #if MAC_OS_X_VERSION_MAX_ALLOWED = MAC_OS_X_VERSION_10_4 enum {/* event subtypes for mouse events */ NSMouseEventSubtype = NX_SUBTYPE_DEFAULT, NSTabletPointEventSubtype = NX_SUBTYPE_TABLET_POINT, NSTabletProximityEventSubtype = NX_SUBTYPE_TABLET_PROXIMITY, #if MAC_OS_X_VERSION_MAX_ALLOWED = MAC_OS_X_VERSION_10_6 NSTouchEventSubtype = NX_SUBTYPE_MOUSE_TOUCH // FAILS HERE #endif }; #endif What's up with this and is there a way to fix it? 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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Correct way to tell if a path is to a .bundle?
On Sep 25, 2009, at 02:25:30, Mike Abdullah wrote: I would read up on UTIs. Get the type of each file and see if it conforms to what you require. I have what I hope is a reasonably informative post here: http://www.mikeabdullah.net/utis_diagram/ Note how there is a com.apple.plugin type. If you're using a custom format for your plug-ins (and you should), make your app declare a com.foo.app.plugin type for them, which conforms to com.apple.plugin. On Sep 25, 2009, at 08:12:41, Jens Alfke wrote: Yup, as long as you declare the extension properly in your Info.plist and indicate that it's a bundle. I confess, that after reading the docs, I'm not at all sure I'm doing things right. Here's what I've got (for my app called Foo): keyUTExportedTypeDeclarations/key array dict keyUTTypeDescription/key stringFoo PlugIn/string keyUTTypeConformsTo/key array stringcom.apple.plugin/string /array keyUTTypeIdentifier/key stringcom.latencyzero.foo.plugin/string keyUTTypeTagSpecification/key dict keypublic.filename-extension/key stringfooplugin/string /dict /dict /array keyCFBundleDocumentTypes/key array dict keyCFBundleTypeExtensions/key array string.fooplugin/string /array keyCFBundleTypeName/key stringPlugIn/string keyCFBundleTypeRole/key stringEditor/string keyLSItemContentTypes/key array stringcom.latencyzero.foo.plugin/string /array keyLSTypeIsPackage/key false/ keyNSPersistentStoreTypeKey/key stringXML/string /dict The CFBundleDocumentTypes was created using the Target-Properties- Document Types editor. Questions: 1) Do I need to put the UTI in my plugin's Info.plist, or just the app's, or both? 2) Is there a MIME type for my plugin? OSType? Class? 3) If I don't specify an icon, will it get the default plugin icon? 4) How do I indicate that the type is a bundle (Jens)? 5) Do I need to import UTIs anywhere? On Sep 25, 2009, at 08:52:40, Sean McBride wrote: Of course that requires that your Info.plist be present for Launch Services to consult. So while you should absolutely do as Jens says, you should additionally set the bundle bit for packages you create. See 'man SetFile'. SetFile -a B /path/to/package. I guess this would this be part of a script run after the plugin build? Thanks! -- Rick ___ 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
Suggestions for debugging “EXC_BAD_ACCES S”
all, My iPhone app has a UIView subclass that uses a number of CALayer objects. In normal operation the app works fine, but in low memory conditions (either real or simulated) I'm getting a EXC_BAD_ACCESS failure and I suspect it's related to my use (or misuse) of CALayer's. I've been concentrating my efforts on this particular UIView subclass because it's the last object to have its dealloc messagecalled before the crash. As I'm still fairly new developing with Cocoa I'm looking for suggestions on how others debug these kinds of errors. The stack at the point of failure is: #0 0x007d40c0 in CFGetRetainCount #1 0x00963770 in CA::release_root_if_unused #2 0x00963707 in x_hash_table_remove_if #3 0x009634ec in CA::Transaction::commit #4 0x0096b838 in CA::Transaction::observer_callback #5 0x007b8252 in __CFRunLoopDoObservers #6 0x007b765f in CFRunLoopRunSpecific #7 0x007b6c48 in CFRunLoopRunInMode #8 0x000737ad in GSEventRunModal #9 0x00073872 in GSEventRun #10 0x0168a003 in UIApplicationMain #11 0x1ee0 in main at main.m:14 or from the actual crash log: 0 libobjc.A.dylib 0x955b2688 objc_msgSend + 24 1 QuartzCore 0x00963770 CA::release_root_if_unused(_CALayer*, _CALayer*, void*) + 18 2 QuartzCore 0x00963707 x_hash_table_remove_if + 67 3 QuartzCore 0x009634ec CA::Transaction::commit() + 214 4 QuartzCore 0x0096b838 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 84 5 CoreFoundation 0x007b8252 __CFRunLoopDoObservers + 594 6 CoreFoundation 0x007b765f CFRunLoopRunSpecific + 2575 7 CoreFoundation 0x007b6c48 CFRunLoopRunInMode + 88 8 GraphicsServices 0x000707ad GSEventRunModal + 217 9 GraphicsServices 0x00070872 GSEventRun + 115 10 UIKit 0x0168a003 UIApplicationMain + 1157 11 0x1ee0 main + 102 (main.m:14) 12 0x1e4e start + 54 If I'm reading this correctly, not a given by any means, Core Foundation is trying to get the retain count for an object, possibly a CALayer, where the reference pointer is no longer valid, but how do I determine what object? I've tried running with the performance tools, which tells me where objects are allocated, but I haven't found anything that will help identify THE object that's causing the problem. I've tried Shark, but it just seems to hang with Sampling Any and all suggestions welcome. thanks, Bob ___ 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: Displaying characters from the 'Unicode Symbols' font ?? (Solved)
Thanks everyone for helping. This solved my problem on how to handle characters outside the 16 bits range. Anders Lassen On Sep 25, 2009, at 8:57 PM, Aki Inoue wrote: The Unicode values beyond 16bit range are represented with a pair of UTF-16 characters in U+D800 ~ U+DFFF. See relevant items in http://unicode.org/glossary/#S for the definitions. There are several ways to insert UTF-32 values into NSString. Doug mentioned some. The easiest is to use the C99 universal character name. For example, U+1D400 can be represented with @\U0001D400 using compliers shipped with Xcode 3.0 or later. Another approach is to use an array of UTF-32 characters and convert with NSUTF32StringEncoding. UTF32Char character = 0x0001D400; #if __BIG_ENDIAN__ NSStringEncoding encoding = NSUTF32BigEndianStringEncoding; #else NSStringEncoding encoding = NSUTF32LittleEndianStringEncoding; #endif NSString *string = [[NString alloc] initWithBytes:character length:sizeof(character) encoding:encoding]; Or, you could fill a UTF-16 buffer and create from it using new inline functions introduced with SnowLeopard. UniChar characters[2]; NSString *string; CFStringGetSurrogatePairForLongCharacter(0x0001D400, characters); string = [[NSString alloc] initWithCharacters:characters length:2]; Aki On 2009/09/25, at 11:33, Anders Lassen wrote: I have tried this but gave up, because I did not now of surrogate pairs. But I will try again. Anders Lassen On Sep 25, 2009, at 8:27 PM, Douglas Davidson wrote: On Sep 25, 2009, at 11:18 AM, Anders Lassen wrote: But still, I can not see, how this solve my problem getting characters outside the unicode 16 bits range into a NSString. NSString is conceptually UTF-16, which means that characters outside the BMP are represented using surrogate pairs. However, for purposes of getting them into an NSString, you can (for example) represent them in UTF-32 and use one of the conversion methods. Alternatively, you could put them in a file, maybe a text file or a plist, and let the standard import methods deal with encoding issues. Douglas Davidson ___ 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/aki%40apple.com This email sent to a...@apple.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: Suggestions for debugging “EXC_BAD_ ACCESS”
Run with NSZombieEnabled=YES, or just use the Zombies Instruments template (ships with Xcode 3.2). --Kyle Sluder ___ 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: Correct way to tell if a path is to a .bundle?
On Sep 25, 2009, at 12:12 PM, Rick Mann wrote: keyLSTypeIsPackage/key false/ Shouldn't that be true, not false? —Jens___ 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: Correct way to tell if a path is to a .bundle?
On Sep 25, 2009, at 8:52 AM, Sean McBride wrote: So while you should absolutely do as Jens says, you should additionally set the bundle bit for packages you create. See 'man SetFile'. SetFile -a B /path/to/package. Sounds like good advice, but SetFile is a command-line tool, not an API. The actual API to set HFS flags is, I think, somewhere in CarbonCore/Files.h. —Jens___ 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: Parsing error in NSEvent?
On Sep 25, 2009, at 1:00 PM, slasktrattena...@gmail.com wrote: #if MAC_OS_X_VERSION_MAX_ALLOWED = MAC_OS_X_VERSION_10_6 NSTouchEventSubtype = NX_SUBTYPE_MOUSE_TOUCH // FAILS HERE #endif }; #endif What's up with this and is there a way to fix it? NX_SUBTYPE_MOUSE_TOUCH should be defined in the IOLLEvent.h header in the IOKit framework in the Snow Leopard SDK. You might want to make sure that the correct header is being imported by using the preprocess feature. You are using the 10.6 SDK as the base SDK for that architecture, right? Nick Zitzmann http://www.chronosnet.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: Suggestions for debugging “EXC_BAD _ACCESS”
On Sep 25, 2009, at 1:14 PM, Bob Barnes wrote: If I'm reading this correctly, not a given by any means, Core Foundation is trying to get the retain count for an object, possibly a CALayer, where the reference pointer is no longer valid, but how do I determine what object? Use Instruments, use the object alloc instrument with retain/release counting and NSZombie detection turned on, and run your app. When it crashes, you should be told what caused the crash, and you should get a complete log of the retains/releases on the object. Nick Zitzmann http://www.chronosnet.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: Suggestions for debugging “EXC_BAD _ACCESS”
On Sep 25, 2009, at 12:14 PM, Bob Barnes wrote: If I'm reading this correctly, not a given by any means, Core Foundation is trying to get the retain count for an object, possibly a CALayer, where the reference pointer is no longer valid, but how do I determine what object? I've tried running with the performance tools, which tells me where objects are allocated, but I haven't found anything that will help identify THE object that's causing the problem. I've tried Shark, but it just seems to hang with Sampling Any and all suggestions welcome. Try NSZombies first. Guard Malloc catches some errors that NSZombie does not. You can also dig around in the CPU register data: http://sealiesoftware.com/blog/archive/2008/09/22/objc_explain_So_you_crashed_in_objc_msgSend.html -- Greg Parker gpar...@apple.com Runtime Wrangler ___ 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: Parsing error in NSEvent?
On Fri, Sep 25, 2009 at 9:25 PM, Nick Zitzmann n...@chronosnet.com wrote: On Sep 25, 2009, at 1:00 PM, slasktrattena...@gmail.com wrote: #if MAC_OS_X_VERSION_MAX_ALLOWED = MAC_OS_X_VERSION_10_6 NSTouchEventSubtype = NX_SUBTYPE_MOUSE_TOUCH // FAILS HERE #endif }; #endif What's up with this and is there a way to fix it? NX_SUBTYPE_MOUSE_TOUCH should be defined in the IOLLEvent.h header in the IOKit framework in the Snow Leopard SDK. You might want to make sure that the correct header is being imported by using the preprocess feature. You are using the 10.6 SDK as the base SDK for that architecture, right? I'm currently on Leopard so I can't say for sure, but now that you mention it, I believe the base SDK might have been set to 10.5. I'll have a look as soon as I reboot. Thanks for the hint! ___ 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: Correct way to tell if a path is to a .bundle?
On 9/25/09 12:24 PM, Jens Alfke said: So while you should absolutely do as Jens says, you should additionally set the bundle bit for packages you create. See 'man SetFile'. SetFile -a B /path/to/package. Sounds like good advice, but SetFile is a command-line tool, not an API. The actual API to set HFS flags is, I think, somewhere in CarbonCore/Files.h. Yes. You can use the MoreFilesX sample code and do this: FSChangeFinderFlags (theFsRef, true, kHasBundle); -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ 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: Disappearing NSStatusItem
Make sure you're properly -retain'ing it. Just because you have an ivar pointing to it doesn't mean it will stick around after GC/autorelease pool releases stuff. You'll need to explicitly -retain the NSStatusItem since NSStatusBar does not. On Fri, Sep 25, 2009 at 11:21 AM, Jacob Schwartz jakehschwa...@gmail.com wrote: Hello again, After making headway on my first cocoa app, I have run into an issue. I have created a NSStatusItem in my class called Application.m. When I run, the icon appears in my menubar but then disappears and becomes ineligable to click. I read something somewehere about thr garbage collection taking it away but I have it saved as an instance in my class so Im out of ideas. I also read about the AppDelegate class that is made for me when I make a new project but I don't know how to use that. Fail. Anyway thanks again everyone. -Jake ___ 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/bravobug%40gmail.com This email sent to bravo...@gmail.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: Disappearing NSStatusItem
On Sep 25, 2009, at 4:30 PM, BravoBug Software wrote: Make sure you're properly -retain'ing it. Just because you have an ivar pointing to it doesn't mean it will stick around after GC/autorelease pool releases stuff. You'll need to explicitly -retain the NSStatusItem since NSStatusBar does not. Yes-- you need to explicitly retain anything you want to keep around when running under retain/release. Or you need a strong reference to it (or CFRetain it) if running under GC. However, the rest of the answer is very confusing. An objective-c program runs either garbage collected or using retain/release. GC/autorelease doesn't make any sense. b.bum ___ 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: Suggestions for debugging “EXC_BAD _ACCESS” [SOLVED]
Kyle/Nick/Greg, Thank you guys. Took a little digging but the combination of NSZombie instruments object allocation did the job. After years working with Java I find myself tripping over memory management issues much too often. I had allocated a UIButton using buttonWithType: and then later released it without ever having retained it. I'm concluding (perhaps incorrectly) that using buttonWithType: doesn't grant 'object ownership' in the same way that alloc does. Bob On Sep 25, 2009, at 12:36 PM, Greg Parker wrote: On Sep 25, 2009, at 12:14 PM, Bob Barnes wrote: If I'm reading this correctly, not a given by any means, Core Foundation is trying to get the retain count for an object, possibly a CALayer, where the reference pointer is no longer valid, but how do I determine what object? I've tried running with the performance tools, which tells me where objects are allocated, but I haven't found anything that will help identify THE object that's causing the problem. I've tried Shark, but it just seems to hang with Sampling Any and all suggestions welcome. Try NSZombies first. Guard Malloc catches some errors that NSZombie does not. You can also dig around in the CPU register data: http://sealiesoftware.com/blog/archive/2008/09/22/objc_explain_So_you_crashed_in_objc_msgSend.html -- Greg Parker gpar...@apple.com Runtime Wrangler ___ 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: Suggestions for debugging “EXC_BAD_ ACCESS” [SOLVED]
On Fri, Sep 25, 2009 at 4:46 PM, Bob Barnes toadf...@comcast.net wrote: Thank you guys. Took a little digging but the combination of NSZombie instruments object allocation did the job. After years working with Java I find myself tripping over memory management issues much too often. I had allocated a UIButton using buttonWithType: and then later released it without ever having retained it. I'm concluding (perhaps incorrectly) that using buttonWithType: doesn't grant 'object ownership' in the same way that alloc does. You are correct. Re-read the Memory Management Guide and commit the rules to heart: http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/MemoryMgmt/Articles/mmRules.html#//apple_ref/doc/uid/2994-BAJHFBGH Specifically, the first rule applies in this case: You take ownership of an object if you create it using a method whose name begins with “alloc” or “new” or contains “copy” (for example, alloc, newObject, or mutableCopy), or if you send it a retain message. You are responsible for relinquishing ownership of objects you own using release or autorelease. Any other time you receive an object, you must not release it. Since buttonWithType: does not begin with alloc or new, and does not contain copy, you don't own the object it returns. --Kyle Sluder ___ 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: Suggestions for debugging “EXC_BAD _ACCESS” [SOLVED]
On 26/09/2009, at 9:46 AM, Bob Barnes wrote: I'm concluding (perhaps incorrectly) that using buttonWithType: doesn't grant 'object ownership' in the same way that alloc does. I'd say that was true, since 'buttonWithType:' doesn't contain the words 'new', 'alloc', 'create', 'retain' or 'copy'. See here: file:///Developer/Documentation/DocSets/com.apple.adc.documentation.AppleSnowLeopard.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmObjectOwnership.html --Graham ___ 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: Disappearing NSStatusItem
Yeah, I threw in a release statement after and it didn't do anything different. When I read your reply, I thought what Bill said, that garbage collection was different from release/retain statements. -Jake Schwartz On Sep 25, 2009, at 7:33 PM, Bill Bumgarner wrote: On Sep 25, 2009, at 4:30 PM, BravoBug Software wrote: Make sure you're properly -retain'ing it. Just because you have an ivar pointing to it doesn't mean it will stick around after GC/autorelease pool releases stuff. You'll need to explicitly -retain the NSStatusItem since NSStatusBar does not. Yes-- you need to explicitly retain anything you want to keep around when running under retain/release. Or you need a strong reference to it (or CFRetain it) if running under GC. However, the rest of the answer is very confusing. An objective-c program runs either garbage collected or using retain/release. GC/autorelease doesn't make any sense. b.bum ___ 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: Suggestions for debugging “EXC_BAD _ACCESS” [SOLVED]
On Sep 25, 2009, at 5:46 PM, Bob Barnes wrote: Kyle/Nick/Greg, Thank you guys. Took a little digging but the combination of NSZombie instruments object allocation did the job. After years working with Java I find myself tripping over memory management issues much too often. I had allocated a UIButton using buttonWithType: and then later released it without ever having retained it. I'm concluding (perhaps incorrectly) that using buttonWithType: doesn't grant 'object ownership' in the same way that alloc does. Right. Read the memory management guidelines; they outline the (simple) rules pretty well. Basically: You own the object if you receive it via a call that contains new, alloc, or copy, in which case you *must* -release it. An object received via any other call, you do *NOT* own, and must *NOT* -release it unless you first - retain it. ___ 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: Correct way to tell if a path is to a .bundle?
On Sep 24, 2009, at 8:09 PM, Jens Alfke wrote: On Sep 24, 2009, at 6:41 PM, Rick Mann wrote: I'm scanning a directory for plugins for my app. Given a path, what's the right way to tell if it's a path to a bundle? -[NSWorkspace isFilePackageAtPath:]. Actually, bundles are often packages, and vice versa, but you can be either without the other. A file package is a directory that is presented as a single file to the user, while a bundle is a directory with a particular layout. For example, frameworks are bundles, but not packages. If you navigate to a .framework file in Finder, you will see that it looks like a folder. Likewise, you can take any directory and set the package bit, and it becomes a package. The usual way is to just try loading the URL as a bundle, and see if you succeed. You could also define a particular extension for your plugin type, and look for files of that extension, with the assistance of CFBundleCreateBundlesFromDirectory. -Peter ___ 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: [__NSFastEnumerationEnumerator nextObject] unexpectedly not very fast!
On Sep 25, 2009, at 12:38 PM, Ben Trumbull wrote: In summary, the existence of fast enumeration does nothing for existing enumeration technologies and if you have to support 10.4 (as I do) you simply can't use it unless you fork your code. My solution, in the few cases where performance is paramount, has been to essentially roll my own fast enumeration. For very large arrays (thousands of objects) I'll get blocks of objects in batching using [NSArray getObjects:range:], process those in a tight C loop, and then get another batch. The for (in) construct is by far the most optimized general purpose way to work with any of the collections in Cocoa on 10.5, 10.6, and iPhone OS. It's also polymorphic, so custom collection subclasses can fine tune the behavior. If you have to hand roll your own, either for 10.4, or some specialized case, your best bet is to use -getObjects: into a local buffer. gcc supports variable length arrays, and that's the fastest way to marshall these batches temporarily. You'll want to be very careful to do length checks to not overrun your stack, and limit the size. If you have somewhere between 256 512 objects, give or take, you'll have to malloc a temporary id* Overflowing the stack is not pretty. What I did was to create a CSForeach set of macros which take a variable and a collection name, with #ifdefs set up to cause different macros to be used under 32-bit and 64-bit. Under 64-bit, it's pretty safe to assume the user is running Leopard or better, so the macro evaluates to for(var in collection), but in 32-bit, it makes an enumerator and generates a while loop. This way, most people running Leopard on relatively recent hardware will get the faster enumeration, and those running 10.4 will at least have it still work. I also made a conditional version of the macro, which lets me specify a condition to check each time the loop comes around. In 32-bit, it changes the while loop to while((foo = [enumerator nextObject]) bar), whereas in 64-bit it adds a if(!bar) break; at the beginning of the loop. Charles ___ 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: Correct way to tell if a path is to a .bundle?
On Sep 25, 2009, at 17:15:45, Peter Ammon wrote: On Sep 24, 2009, at 8:09 PM, Jens Alfke wrote: On Sep 24, 2009, at 6:41 PM, Rick Mann wrote: I'm scanning a directory for plugins for my app. Given a path, what's the right way to tell if it's a path to a bundle? -[NSWorkspace isFilePackageAtPath:]. Actually, bundles are often packages, and vice versa, but you can be either without the other. A file package is a directory that is presented as a single file to the user, while a bundle is a directory with a particular layout. For example, frameworks are bundles, but not packages. If you navigate to a .framework file in Finder, you will see that it looks like a folder. Likewise, you can take any directory and set the package bit, and it becomes a package. The usual way is to just try loading the URL as a bundle, and see if you succeed. You could also define a particular extension for your plugin type, and look for files of that extension, with the assistance of CFBundleCreateBundlesFromDirectory. Unfortunately, I don't think CFBundleCreateBundlesFromDirectory() will work for me. It creates CFBundleRefs, not NSBundles, and it loads them, which I want to avoid if possible. I think I just have to check the filenames' extensions as I iterate them. ___ 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
Global Hotkeys in 64-bit mode
I sent a longer message yesterday, but it apparently didn¹t get posted. I am looking for a way to implement global hotkeys in 64-bit mode. When I use the method described here: http://unsanity.org/archives/45.php I am having a problem with the EventHotKeyRef that is registered not matching the one that comes through as data1 in the NSEvent. It appears to be a 32-bit to 64-bit conversion issue, and my code works fine when compiled in 32-bit mode. Has anyone made global hotkeys work in 64-bit mode? Thanks Tobias Zimmerman ___ 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
How to implement IB-like Inspector Palette?
What is the control at the top of the IB Inspector panel? Is it just buttons arranged next to each other? I presume it's a tabless NSTabView for the content beneath. inline: Screen shot 2009-09-25 at 18.45.18 .png TIA, Rick___ 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 implement IB-like Inspector Palette?
On 25 sep 2009, at 18.56, Rick Mann wrote: What is the control at the top of the IB Inspector panel? Is it just buttons arranged next to each other? It's probably either a NSSegmentedControl, a NSMatrix with NSButtonCells, or plain NSButtons. The content below the tabs at the top could certainly be housed in a tabless NSTabView. It might also simply be a set of manually managed subviews. j o a r ___ 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 implement IB-like Inspector Palette?
On Friday, September 25, 2009, at 09:56PM, Rick Mann rm...@latencyzero.com wrote: What is the control at the top of the IB Inspector panel? Is it just buttons arranged next to each other? I presume it's a tabless NSTabView for the content beneath. So one would think, but a little poking around with F-Script Anywhere indicates that the row of buttons is a custom view class called IBInspectorModeView, and the main content also uses custom classes without an NSTabView anywhere in the hierarchy. Anyone's guess is as good as mine as to why it was done this way -- maybe it was the easiest path to get the exact custom behavior they wanted. I suspect there are third-party libraries to do what you want -- I'm pretty sure I've seen one or two tutorials somewhere. --Andy ___ 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
Spotlight: obtain active query on app launch
Hello, If a spotlight query finds data in an application specific file, selecting that file will launch the unique application. How can the application determine the query that was in effect when it was launched? As a concrete example where I've seen it done, if spotlight finds a string in an OmniOutliner file, selecting that file opens OmniOutliner and the application brings up a search panel showing all matches within the file. What API did they use to do that? 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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Spotlight: obtain active query on app launch
On Sep 25, 2009, at 7:29 PM, David Melgar wrote: Hello, If a spotlight query finds data in an application specific file, selecting that file will launch the unique application. How can the application determine the query that was in effect when it was launched? As a concrete example where I've seen it done, if spotlight finds a string in an OmniOutliner file, selecting that file opens OmniOutliner and the application brings up a search panel showing all matches within the file. What API did they use to do that? You need to read keyAESearchText from the open documents Apple Event. See http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_handle_AEs/SAppsHandleAEs.html or google for keyAESearchText. smime.p7s Description: S/MIME cryptographic signature ___ 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 implement IB-like Inspector Palette?
On Friday, September 25, 2009, at 10:20PM, Andy Lee ag...@mac.com wrote: I suspect there are third-party libraries to do what you want -- I'm pretty sure I've seen one or two tutorials somewhere. Took me a while to think of good words to Google for. Collapsible and disclosure seem to be good ones. Check out the suggestions on this thread, including links to Apple sample code: http://www.cocoabuilder.com/archive/message/cocoa/2009/4/2/233631 I think the article linked to by I. Savant is one of the ones I saw. The comments in that article refer to something called OmniInspectors, which might also be worth checking out. --Andy ___ 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: Correct way to tell if a path is to a .bundle?
Rick Mann wrote: On Sep 25, 2009, at 17:15:45, Peter Ammon wrote: On Sep 24, 2009, at 8:09 PM, Jens Alfke wrote: On Sep 24, 2009, at 6:41 PM, Rick Mann wrote: I'm scanning a directory for plugins for my app. Given a path, what's the right way to tell if it's a path to a bundle? -[NSWorkspace isFilePackageAtPath:]. Actually, bundles are often packages, and vice versa, but you can be either without the other. ... The usual way is to just try loading the URL as a bundle, and see if you succeed. You could also define a particular extension for your plugin type, and look for files of that extension, with the assistance of CFBundleCreateBundlesFromDirectory. Unfortunately, I don't think CFBundleCreateBundlesFromDirectory() will work for me. It creates CFBundleRefs, not NSBundles, and it loads them, which I want to avoid if possible. I think I just have to check the filenames' extensions as I iterate them. I would think the answer to how do I tell if a path is to a bundle has to be implicit in what it means for something to be a bundle. http://developer.apple.com/mac/library/DOCUMENTATION/CoreFoundation/Conceptual/CFBundles/AboutBundles/AboutBundles.html#//apple_ref/doc/uid/1123i-CH100-SW1 A bundle is a directory with a standardized hierarchical structure that holds executable code and the resources used by that code. ... The exact structure of a bundle depends on whether you are creating an application, framework, or plug-in. It also depends on other factors such as the target platform and the type of plug-in. Further down: Custom plug-ins are plug-ins you define for your own purposes; see 'Anatomy of a Loadable Bundle.' Which links to http://developer.apple.com/mac/library/DOCUMENTATION/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/1123i-CH101-SW32 At the top-level of the bundle is a single Contents directory. Inside this directory are several subdirectories for storing executable code and resources. The Contents directory also contains the bundle’s Info.plist file with information about the bundle’s configuration. So, without testing it, it seems like a first stab would be: It's a directory, and the name includes an extension. The directory contents comprise a single directory named Contents. That subdirectory contains an Info.plist file and a directory named MacOS. The MacOS directory contains a binary identified by the CFBundleExecutable key of the Info.plist. ___ 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: login items hide box
thank jerry i'll look at your project. the only issue i'm having is in leopard so i'll definitely have to do something that works there. i'll post back, rick From: Jerry Krinock je...@ieee.org To: cocoa dev cocoa-dev@lists.apple.com Sent: Saturday, September 26, 2009 2:45:38 AM Subject: Re: login items hide box On 2009 Sep 24, at 06:25, Rick C. wrote: so i do need to update my code. but i'll be on the lookout for potential LSSharedFileList issues. thank you! Just to clarify, unless Apple has silently fixed the bug in 10.6 and you're using 10.6, I expect that you will see the same issue after updating to LSSharedFileList. Also, LSSharedFileList has another bug -- a difficult API with not much documentation. Two other developers have told me that they've found my Cocoa wrapper helpful... http://sheepsystems.com/sourceCode/ssyloginitems.html If you find that Apple has fixed the bug in 10.6, do let us know. ___ 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/jo_phls%40yahoo.com This email sent to jo_p...@yahoo.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: Correct way to tell if a path is to a .bundle?
Rick, You could also use: NSBundle pluginBundle = [NSBundle bundleWithPath: fullPath]; This will return an NSBundle object as your require or nil if fullPath does not identify an accessible bundle directory. So... if ( pluginBundle == nil ) ... then it is not a valid bundle. You will also want to create a protocol that the plugin's Principal class must conform to. So, a little snippet here for you that will load a valid bundle that conforms to MyPluginProtocol. - (id)loadBundleNamed:(NSString*)bundleName { Class exampleClass; id newInstance; NSString *bundlePath = [NSString stringWithFormat:@%@/ %...@.mypluginext,[self pluginDirectory],bundleName]; NSBundle *bundleToLoad = [NSBundle bundleWithPath:bundlePath]; if (exampleClass = [bundleToLoad principalClass]) { if ( [[bundleToLoad principalClass] conformsToProtocol:@protocol (MyPluginProtocol)] ) { newInstance = [[exampleClass alloc] initWithPlugInController: [PluginController sharedManager] bundle:[NSBundle mainBundle]]; // initWithPluginController is a method defined by MyPluginProtocol... so I am safe to use it return [newInstance autorelease]; } } return nil; } Brad Goss brad.g...@gmail.com On 2009-09-24, at 21:41 , Rick Mann wrote: I'm scanning a directory for plugins for my app. Given a path, what's the right way to tell if it's a path to a bundle? TIA -- Rick ___ 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/brad.goss%40gmail.com This email sent to brad.g...@gmail.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: Correct way to tell if a path is to a .bundle?
Rick, You could also use: NSBundle pluginBundle = [NSBundle bundleWithPath: fullPath]; This will return an NSBundle object as your require or nil if fullPath does not identify an accessible bundle directory. So... if ( pluginBundle == nil ) ... then it is not a valid bundle. This isn't actually true. For example, you can create a bundle with the path to a flat executable, and if that executable happens to have an Info.plist embedded inside it, you can access the values in the plist as if it were a full bundle. Likewise, if you point it at a random folder, you may still get a valid object back. I've got some rubycocoa scripts that take advantage of that very fact. Sorry. -BJ ___ 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