Reading image from system clipboard

2009-08-03 Thread Deepa
Hi, I am developing an desktop app for which I want to implement a behavior which is similar to 'New from clipboard' of Preview application. I tried using NSPasteboard: // To get file copied to clipboard from Finder NSArray *files = [[NSPasteboard generalPasteboard] propertyListForType:

Re: Design pattern for per-document settings

2009-08-03 Thread Negm-Awad Amin
Am Mo,03.08.2009 um 02:18 schrieb Graham Cox: Hi all, I'm just thinking through a couple of problems and wondered if anyone had anything to say about it... In my app I have several things that apply on a per document level, for example, the mapping from Quartz co-ordinate values to

text control for keyboard shortcut input?

2009-08-03 Thread aaron smith
Does anyone know of any prebuilt views for something like this: http://tinyurl.com/mggdtd - I've been snooping around google for a while but can't seem to get the right keywords to bring anything up. Any ideas? Thanks much! ___ Cocoa-dev mailing list

Re: Design Paterns: +/- Initializers and Subclassing (Solved)

2009-08-03 Thread Christopher J Kemsley
Oh yeah - I thought I did that once and it didn't work... Though, now that I think about it, I think I did it the other way in the past (used self in a +method to refer to a newly created object) So, in all reality, the +method could be boiled down to: [self.new autorelease] ; since

Re: Design Paterns: +/- Initializers and Subclassing (Solved)

2009-08-03 Thread Kyle Sluder
On Aug 3, 2009, at 1:13 AM, Christopher J Kemsley kd7...@gmail.com wrote: So, in all reality, the +method could be boiled down to: [self.new autorelease] ; This is improper use of the dot syntax. new is not a property, so it should not be accessed using the dot syntax. --Kyle Sluder

Re: From NSTextView to address an NSTextField

2009-08-03 Thread Alastair Houghton
On 2 Aug 2009, at 21:48, Steve Cronin wrote: Folks; NSTextView - NSText - NSView - NSReponder - NSObject NSTextField - NSView - NSReponder - NSObject At runtime if I have access to an instance of NSTextView how can I address the NSTextField? I know I should know this but I

[IB] - can't assign keyboard shortcut to a menu item

2009-08-03 Thread Alexander Bokovikov
Hi, All, It's my first attempt to assign a popup menu to a view, so perhaps my question is stupid, but I can't find an explanation in the Apple's docs... The Key Equiv. field is grayed, and don't see any obvious solution to activate it. I've created a menu, associated it with a view,

Re: Reading image from system clipboard

2009-08-03 Thread Graham Cox
On 03/08/2009, at 4:07 PM, Deepa wrote: I am developing an desktop app for which I want to implement a behavior which is similar to 'New from clipboard' of Preview application. I tried using NSPasteboard: // To get file copied to clipboard from Finder NSArray *files = [[NSPasteboard

Re: text control for keyboard shortcut input?

2009-08-03 Thread I. Savant
On Aug 3, 2009, at 4:07 AM, aaron smith wrote: Does anyone know of any prebuilt views for something like this: http://tinyurl.com/mggdtd - I've been snooping around google for a while but can't seem to get the right keywords to bring anything up. Any ideas? Thanks much! I believe this is

Re: [IB] - can't assign keyboard shortcut to a menu item

2009-08-03 Thread Graham Cox
On 03/08/2009, at 9:38 PM, Alexander Bokovikov wrote: OK, nothing to do here, but notice, that Dad Bill (unlike to Dad Steve) :) uses another approach - a view, having keyboard focus, automatically activates its popup menu shortcuts, so it's easy to work with a view as by mouse, as by

Re: [IB] - can't assign keyboard shortcut to a menu item

2009-08-03 Thread Alexander Bokovikov
On 03.08.2009, at 17:45, Graham Cox wrote: the view may have many objects any of which could be the menu's target - only the click location can tell you which one, Can't agree. If we setup a control, as capable to have keyboard focus, then, activating this control, we activate all

NSPathControl - popup panel doesn't work

2009-08-03 Thread Alexander Bokovikov
Hi, All, I can't understand why, but target path is not changed when I click on NSPathControl's popup panel. The control shows the same path, as was chosen earlier. I can click Choose... item and NSOpenPanel will appear, where I can choose a new directory, and these changes will be

Re: [IB] - can't assign keyboard shortcut to a menu item

2009-08-03 Thread Graham Cox
On 03/08/2009, at 10:47 PM, Alexander Bokovikov wrote: Can't agree. If we setup a control, as capable to have keyboard focus, then, activating this control, we activate all hierarchy of its parents, and we definitely can apply the lowest level parent's popup menu (if any) with its

Adding more and more key/value observers is much too slow - workaround needed.

2009-08-03 Thread Andreas Känner
Hi, If you add more and more key/value observers with addObserver:forKeyPath:options:context: this call takes longer and longer in a non-linear way. I posted a bug report today (ID: 7112953) but maybe someone already has a workaround. Here is my sample code: #include

Re: [IB] - can't assign keyboard shortcut to a menu item

2009-08-03 Thread Alastair Houghton
On 3 Aug 2009, at 12:45, Graham Cox wrote: The reason it's not supported by default is that a view might not be the final target for a contextual menu - the view may have many objects any of which could be the menu's target I think the reason (that it isn't supported) is much simpler than

Re: [IB] - can't assign keyboard shortcut to a menu item

2009-08-03 Thread Alexander Bokovikov
On 03.08.2009, at 19:00, Graham Cox wrote: There's much more to life than controls. Completely agree. But I don't like to say that _every_ popup menu _must_ have keyboard shortcuts. I'd just like to say, that it would be good to give such possibility to the coder. But back to your

Non-blocking custom event loop?

2009-08-03 Thread Daniel Furrer
I have my own event-loop where I call nextEventMatchingMask: repeatedly. Many examples I found just pass a untilDate of [NSDate distantPast] to get this behaviour as stated in the documentation but this doesn't seem to work for me - even in a very simple setting. Can anyone see what's wrong? int

Re: Table view data source methods order?

2009-08-03 Thread Chase Meadors
No, both delegate and data source are connected, and they are all getting called. This is why I believe the order is the problem. On Aug 3, 2009, at 12:16 AM, Quincey Morris wrote: On Aug 2, 2009, at 22:04, Chase Meadors wrote: I'm having a bit of trouble here with table view data source

Re: Table view data source methods order?

2009-08-03 Thread Andy Lee
On Aug 3, 2009, at 1:04 AM, Chase Meadors wrote: I'm having a bit of trouble here with table view data source methods. I have implemented. I have these three: 1) - (NSCell *)tableView:(NSTableView *)sender dataCellForTableColumn:(NSTableColumn *)tableColumn row: (NSInteger)row; 2) -

Re: [IB] - can't assign keyboard shortcut to a menu item

2009-08-03 Thread Alexander Bokovikov
On 03.08.2009, at 20:58, Alastair Houghton wrote: If the options in question are useful enough to merit a keyboard shortcut, then they're useful enough to appear in the application's main menu hierarchy. If not, then they aren't. I'm sorry, but as I can see now, main menu shortcuts are

Re: Table view data source methods order?

2009-08-03 Thread Quincey Morris
On Aug 3, 2009, at 1:04 AM, Chase Meadors wrote: I'm having a bit of trouble here with table view data source methods. I have implemented. I have these three: 1) - (NSCell *)tableView:(NSTableView *)sender dataCellForTableColumn:(NSTableColumn *)tableColumn row: (NSInteger)row; 2) -

NSSound play often fails

2009-08-03 Thread James Walker
I'm having trouble getting sounds to play reliably. When it happens, -[NSSound play] returns YES, but I hear nothing, and the sound:didFinishPlaying: delegate method is not called. The sound in question is an AIFF file with a duration of about half a second. It seems like whether it fails

addSubview: and positioning at the bottom of a NSWindow

2009-08-03 Thread Stefano Pigozzi
Hello, I'm trying to do something simple, I have a NSWindow containing a NSTableView that resizes with the with the window. When I click on one element I want to display additional information in a subView that I'm adding with [[theWindow contentView] addSubview:infoView]; The problem is

Re: Table view data source methods order?

2009-08-03 Thread Chase Meadors
From: Chase Meadors c.ed.m...@gmail.com Date: August 3, 2009 1:27:26 PM CDT To: Andy Lee ag...@mac.com Subject: Re: Table view data source methods order? This is beginning to frustrate me. I tried assigning the menu in the -dataCellFor... method and eliminating -willDisplay... altogether.

Fwd: Table view data source methods order?

2009-08-03 Thread Chase Meadors
From: Chase Meadors c.ed.m...@gmail.com Date: August 3, 2009 2:01:57 PM CDT To: Quincey Morris quinceymor...@earthlink.net Subject: Re: Table view data source methods order? Actually, and I forgot to mention this, I need number 1 because my second column contains a mix of text cells and

Re: addSubview: and positioning at the bottom of a NSWindow

2009-08-03 Thread Chase Meadors
Consider using NSDrawer. It can contain a content view (i.e. your info view) and can be attached to any side of a parent window, and be shown or hidden. If you don't want to use this, however, just grab the content view's frame, NSRect r = [[window contentView] frame] and then call:

Extending Undo Group with delay creates invalid state -- Why?

2009-08-03 Thread Jerry Krinock
In my Core Data document-based app, I'm trying to group undo registrations so that the user does not have to hit Undo more than once to undo a single action. Some of this is caused by the logic in my setters. For example, changing the 'name' attribute of an object in a collection posts a

Screen savers on Snow Leopard

2009-08-03 Thread Jim O'Connor
The sample screen saver doesn't work on Leopard. Are there new requirements for Snow Leopard and screen savers which must be met? Thanks, Jim O'Connor ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or

Re: Screen savers on Snow Leopard

2009-08-03 Thread I. Savant
On Aug 3, 2009, at 4:09 PM, Jim O'Connor wrote: Are there new requirements for Snow Leopard and screen savers which must be met? Snow Leopard is still under non-disclosure agreement and cannot be discussed on this list. Use the developer forums at the Apple Developer Connection site.

Memory efficient way to get image metadata?

2009-08-03 Thread kentozier
Hi I wrote an image catalog application that scans files on a Windows server, extracts certain image file info (like mod date, name, width, height and color mode) and writes this info to a database. During testing, in a real environment, the app started crashing and I narrowed the problem

Re: Memory efficient way to get image metadata?

2009-08-03 Thread John Calhoun
On Aug 3, 2009, at 1:23 PM, kentoz...@comcast.net wrote: Is there some way (other than rolling my own image readers) to just get the metadata from a file rather than having to load the entire thing? A third party class that would be something like NSImageInfo (if Apple had written such a

Re: NSSound play often fails

2009-08-03 Thread Jerry Krinock
On 2009 Aug 03, at 11:28, James Walker wrote: I'm having trouble getting sounds to play reliably. When it happens, -[NSSound play] returns YES, but I hear nothing, and the sound:didFinishPlaying: delegate method is not called. The sound in question is an AIFF file with a duration of

Re: Screen savers on Snow Leopard

2009-08-03 Thread Kyle Sluder
Snow Leopard is under NDA. You can't talk about it here, but you can at http://devforums.apple.com. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact

Re: Table view data source methods order?

2009-08-03 Thread Quincey Morris
On Aug 3, 2009, at 13:24, Chase Meadors wrote: Maybe I'm missing what you mean here, but if I do that, then what should I do in the objectValueFor... method? On Aug 3, 2009, at 2:13 PM, Quincey Morris wrote: Yes, but according to that message you *didn't* set the correct selection index

Re: NSSound play often fails

2009-08-03 Thread James Walker
Jerry Krinock wrote: On 2009 Aug 03, at 11:28, James Walker wrote: I'm having trouble getting sounds to play reliably. When it happens, -[NSSound play] returns YES, but I hear nothing, and the sound:didFinishPlaying: delegate method is not called. The sound in question is an AIFF file

unlockFocus called too many time console message

2009-08-03 Thread James Walker
When a modeless Cocoa window is closed by clicking the close widget, I see a console message saying unlockFocus called too many time. (sic). It doesn't happen if the window is closed using the File:Close menu item. I set a breakpoint on NSLog, and saw a stack starting like this: NSLog

Re: Memory efficient way to get image metadata?

2009-08-03 Thread kentozier
Thanks John. I looked at the documentation but there doesn't seem to be any obvious way to get the info. The only  CGImageSourceCreateWithURL  creation constants are: CFStringRef kCGImageSourceTypeIdentifierHint ; CFStringRef kCGImageSourceShouldAllowFloat ; CFStringRef

Re: Memory efficient way to get image metadata?

2009-08-03 Thread Dave Keck
P.S. I very rarely use the C interfaces, do I have to also run CFRelease on the result of the CGImageSourceCopyProperties call? Yes, you should. See 'The Create Rule':

NSUndoManager vs @synthesize

2009-08-03 Thread Houdah - ML Pierre Bernard
Hi! Do I still need to write my own accessors in order to perform NSUndoManager registration? Could my model objects observe themselves and register undoable changes in observeValueForKeyPath:ofObject:change:context: ? How does CoreData go about registering changes with the undo

Re: Table view data source methods order?

2009-08-03 Thread Chase Meadors
I think this isn't working either. Let me post the relevant code and see if you notice anything off the bat. - (NSCell *)tableView:(NSTableView *)sender dataCellForTableColumn: (NSTableColumn *)tableColumn row:(NSInteger)row { //cut: judge column and row...

Re: Table view data source methods order?

2009-08-03 Thread Quincey Morris
On Aug 3, 2009, at 15:16, Chase Meadors wrote: NSPopUpButtonCell *cell = [[NSPopUpButtonCell alloc] initTextCell:@ pullsDown:YES]; You want a popup menu, not a pull-down menu. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do

Re: Table view data source methods order?

2009-08-03 Thread Chase Meadors
...What the...?? That fixed it!... I thought that was just a preference... come to think of it, why in the world DOES that make difference?? On Aug 3, 2009, at 5:49 PM, Quincey Morris wrote: On Aug 3, 2009, at 15:16, Chase Meadors wrote: NSPopUpButtonCell *cell = [[NSPopUpButtonCell

Re: Table view data source methods order?

2009-08-03 Thread Nick Zitzmann
On Aug 3, 2009, at 4:54 PM, Chase Meadors wrote: I thought that was just a preference... come to think of it, why in the world DOES that make difference?? In a pop-up menu, the selected item is the displayed item. In a pull- down menu, the displayed item is always the very first item, but

Avoiding KVO in dealloc?

2009-08-03 Thread Todd Heberlein
While working through Beginning iPhone 3 Development I've seen the following a lot, and it seems like a general Cocoa issue. In -viewDidUnload methods the code has the form: self.foo = nil; Whereas in -dealloc methods the code has the form: [foo release]; Both methods seem to

Re: Avoiding KVO in dealloc?

2009-08-03 Thread Kyle Sluder
On Mon, Aug 3, 2009 at 4:35 PM, Todd Heberleintodd_heberl...@mac.com wrote: Both methods seem to me to do the same thing (releasing foo), but I presume the first one would trigger any KVO observers where as the second wouldn't. Is that why the simple release is used instead of a setter in the

Re: Avoiding KVO in dealloc?

2009-08-03 Thread Kiel Gillard
On 04/08/2009, at 9:46 AM, Kyle Sluder wrote: On Mon, Aug 3, 2009 at 4:35 PM, Todd Heberleintodd_heberl...@mac.com wrote: Both methods seem to me to do the same thing (releasing foo), but I presume the first one would trigger any KVO observers where as the second wouldn't. Is that why the

Re: Avoiding KVO in dealloc?

2009-08-03 Thread Kyle Sluder
On Aug 3, 2009, at 5:03 PM, Kiel Gillard kiel.gill...@gmail.com wrote: Unless, of course, you have code in your setter method that handles changes to and from nil. For example, you may add or remove self as an observer for keypaths of an different object value. This would save repeating the

Re: Avoiding KVO in dealloc?

2009-08-03 Thread Kiel Gillard
On 04/08/2009, at 10:26 AM, Kyle Sluder wrote: On Aug 3, 2009, at 5:03 PM, Kiel Gillard kiel.gill...@gmail.com wrote: Unless, of course, you have code in your setter method that handles changes to and from nil. For example, you may add or remove self as an observer for keypaths of an

Re: [IB] - can't assign keyboard shortcut to a menu item

2009-08-03 Thread Graham Cox
On 04/08/2009, at 3:52 AM, Alexander Bokovikov wrote: I'm sorry, but as I can see now, main menu shortcuts are also gray... I can delete them but I can't assign them. Why? I've created controller actions and have connected actions of menu items with the controller. Just the keyboard

Re: Avoiding KVO in dealloc?

2009-08-03 Thread Kyle Sluder
On Mon, Aug 3, 2009 at 5:47 PM, Kiel Gillardkiel.gill...@gmail.com wrote: Do you have a documentation reference for that? I would have expected the isa swizzling to be an implementation detail of the runtime that is handled before my subclass inits. Of course, what I expect and what happens in

Re: Avoiding KVO in dealloc?

2009-08-03 Thread Kiel Gillard
On 04/08/2009, at 10:59 AM, Kyle Sluder wrote: On Mon, Aug 3, 2009 at 5:47 PM, Kiel Gillardkiel.gill...@gmail.com wrote: Do you have a documentation reference for that? I would have expected the isa swizzling to be an implementation detail of the runtime that is handled before my subclass

Re: Avoiding KVO in dealloc?

2009-08-03 Thread Kyle Sluder
On Mon, Aug 3, 2009 at 6:32 PM, Kiel Gillardkiel.gill...@gmail.com wrote: When if I observe some property of Foo *bar at some point in time, KVO swizzles the isa to KVONotifying_Foo. Then, if I observe a different property of the same object at some other point in time, are you suggesting KVO

Re: text control for keyboard shortcut input?

2009-08-03 Thread aaron smith
Thanks! Quick question. I've got the source, I'm getting problems building it. The problem I see is that I don't have the InterfaceBuilder.framework. What's strange is that I can't seem to find that framework. The default xcode project for shortcut recorder is trying to reference the framework in

Re: Avoiding KVO in dealloc?

2009-08-03 Thread Dave Camp
On Aug 3, 2009, at 6:32 PM, Kiel Gillard wrote: On 04/08/2009, at 10:59 AM, Kyle Sluder wrote: On Mon, Aug 3, 2009 at 5:47 PM, Kiel Gillardkiel.gill...@gmail.com wrote: Do you have a documentation reference for that? I would have expected the isa swizzling to be an implementation detail of

Re: NSString and regular expressions

2009-08-03 Thread BareFeet
Hi All, RegexKitLite looks promising. It claims to only require you to add the .h and .m file to your project and link to the libicucore.dylib library. I managed to incorporate RegexKitLite fairly easily once I found in the documentation the steps to link to the libicucore.dylib library.

AGRegex (was: NSString and regular expressions)

2009-08-03 Thread BareFeet
Hi all, Has anyone got procedure for getting AGRegex to work in their project? Thanks, Tom BareFeet From: BareFeet list.develo...@tandb.com.au Date: 31 July 2009 9:03:20 AM AEST To: Cocoa Dev Cocoa-dev@lists.apple.com Subject: Re: NSString and regular expressions Hi Rob, I personally

Strange result from Address Book

2009-08-03 Thread Graham Cox
I'm using the following code from Uli's UKCrashReporter: ABMultiValue* emailAddresses = [[[ABAddressBook sharedAddressBook] me] valueForProperty: kABEmailProperty]; NSString* emailAddr = NSLocalizedStringFromTable (@MISSING_EMAIL_ADDRESS,@UKCrashReporter,@); if(

Re: AGRegex (was: NSString and regular expressions)

2009-08-03 Thread Rick Mann
I gave up on AGRegex and used RegexKit, which was very easy to get to work. On Aug 3, 2009, at 20:15:18, BareFeet wrote: Hi all, Has anyone got procedure for getting AGRegex to work in their project? Thanks, Tom BareFeet From: BareFeet list.develo...@tandb.com.au Date: 31 July 2009

Re: Strange result from Address Book

2009-08-03 Thread Graham Cox
On 04/08/2009, at 1:17 PM, Graham Cox wrote: I'm using the following code from Uli's UKCrashReporter: ABMultiValue* emailAddresses = [[[ABAddressBook sharedAddressBook] me] valueForProperty: kABEmailProperty]; NSString* emailAddr = NSLocalizedStringFromTable

Re: AGRegex (was: NSString and regular expressions)

2009-08-03 Thread Adam R. Maxwell
On Aug 3, 2009, at 8:15 PM, BareFeet wrote: Has anyone got procedure for getting AGRegex to work in their project? I've used AGRegex.framework in a number of projects, but it's been so long that I've no idea what steps I went through to set it up. The copy here

Re: Code Signing for development

2009-08-03 Thread Kyle Sluder
This question is probably better-suited to Xcode-users or the iPhone dev forums at devforums.apple.com. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list.