bug in NSGradient?
Just noticed this, not what I was expecting. I'll file a bug unless someone can convincingly explain it's correct behaviour... [NSGradient interpolatedColorAtLocation:value]; If the gradient has stops that run from, say, 0.5 to 1.0, but value is less than 0.5, this method returns nil. I would have expected it to return the extended colour, i.e. the first one in this case. The discussion for this method says: This method does not simply return the color values used to initialize the receiver. Instead, it computes the value that would be drawn at the specified location. For the case above this depends on whether the gradient will be drawn with the colour extending flags set, but since this method doesn't know about those flags, it's not well-defined. I would suggest that the method should assume the flags are set, since that's a useful assumption, whereas the opposite isn't. Also, the discussion says: The start color of the gradient is always located at 0.0 and the end color is always at 1.0. Which is simply untrue. --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 [EMAIL PROTECTED]
Testing components within an application
Is there a way that seasoned cocoa (Obj-C) programers test particular parts of their code without running the whole application? For instance if I have built a particular interface component I would like to interact with it and verify that the model is being changed correctly or simply demonstrate that it works. I think that requires slightly more functionality than the IB simulator gives. I'm not looking for an automated testing framework like JUnit, just a way to way to run a particular part of my program like main( String[] args) in Java. I suppose you could do this by implementing extra build targets but that would mean having several applications in the same project. It sounds a bit heavy. Any ideas? Thanks, Frank ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Testing components within an application
On 23 Nov 2008, at 12:08 am, Frank Wilson wrote: Is there a way that seasoned cocoa (Obj-C) programers test particular parts of their code without running the whole application? For instance if I have built a particular interface component I would like to interact with it and verify that the model is being changed correctly or simply demonstrate that it works. I think that requires slightly more functionality than the IB simulator gives. I'm not looking for an automated testing framework like JUnit, just a way to way to run a particular part of my program like main( String[] args) in Java. I suppose you could do this by implementing extra build targets but that would mean having several applications in the same project. It sounds a bit heavy. Any ideas? http://developer.apple.com/documentation/DeveloperTools/Conceptual/UnitTesting/UnitTesting.html hth, 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 [EMAIL PROTECTED]
Re: NSCollectionView woes
Thanks, that worked! I do try to read the examples and CocoaDev, but I've found that after I've read the examples, the only way I really learn is by trying and sometimes failing. I appreciate the help and the quick response. Thanks, Cem Karan On Nov 21, 2008, at 1:55 PM, Volker in Lists wrote: Hi Cem, the CollectionView needs only to be pointed to the cars ArrayController and uses a rather obfuscated way of binding each of its subviews fields to the appropriate car entries. you will have to bind your prototype view controls to CollectionView.representedObjects.key. The CollectionView is aware of the arrangedObjects - if bound to them - and automagically creates as many views as needed from your view prototype. I recommend to take a look at the available examples provided by Apple or read through Cocoadevs page on NSCollectionView. HTH, Volker Am 21.11.2008 um 19:47 schrieb Cem: I'm slowly working my way through Aaron Hillegass' Cocoa Programming for Mac OS X and just completed the CarLot program (Chapter 11 in the 3rd edition). I decided to challenge myself and try to change the interface to use NSCollectionView instead of the interface in the book. In order to do this, I bound the NSCollectionView itself to my NSArrayController (which is called Cars) with a keypath of arrangedObjects.condition. I then created a new NSObjectController (called 'A car'), set it to entity mode, and set the entity name to Car (the same as what Cars has). I bound its Content Object to Cars.selection. I then bound the GUI elements to the appropriate keys in Car (such as car.selection.makeModel). This, of course, didn't work. Since Car is bound to the Cars.selection, whenever the selection changes, ALL views in my NSCollectionView change at the same time. I then tried a number of variants, none of which worked. What I want is for each subview in my NSCollectionView to see the data relating to a different car, not all reflect the same car. What am I doing wrong? BTW, if anyone wants the current project/code, the whole thing is about 32 KB tarballed, so I can email it anywhere anyone wants it. Thanks, Cem Karan ___ 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/volker_lists%40ecoobs.de This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Responding to view controller memory warnings (was Re: Outlets / IBOutlet declarations)
On 22 Nov 2008, at 00:53, mmalcolm crawford wrote: Context: UIViewController provides a method, didReceiveMemoryWarning, which is invoked on view controllers when the amount of memory available to the application is severely constrained. The goal of the method is to allow view controllers to dispose of resources that are currently not needed and that can be recreated later if required. One such resource is the view controller's view itself. Assuming that it does not have a superview, the view is disposed of ([self setView:nil];). A issue arises in that outlets to elements within the nib file are typically declared as follows: @property (nonatomic, retain) IBOutlet ElementClass *element; Thus even though the main view is disposed of, absent any further action the outlets are still retained. This is not in and of itself a problem -- if and when the main view is reloaded, they will simply be replaced -- but it does mean that the beneficial effect of the didReceiveMemoryWarning is reduced. There are, currently, a couple of possible remedies... Maybe I'm missing something (I stopped following the previous thread), but, presuming that super's -didreceiveMemoryWarning does indeed Release[] the view if it doesn't have a superview, as documented, couldn't these contortions be avoided (in a future-proof way) by doing something like this in -didReceiveMemoryWarning, and not touching - setView:? - (void)didReceiveMemoryWarning { if(self.anOutlet !self.view.superview) { // Will not call loadView if the view is not loaded, because // we can assume that if we get past the check for anOutlet // the view must already be loaded. self.anOutlet = nil; } [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview } Jamie. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Responding to view controller memory warnings (was Re: Outlets / IBOutlet declarations)
On Nov 22, 2008, at 7:58 AM, James Montgomerie wrote: if(self.anOutlet !self.view.superview) { On Nov 19, 2008, at 12:59 AM, mmalcolm crawford wrote: You could invoke 'view': - (void)didReceiveMemoryWarning { if ([self.view superview] == nil) { // set outlets to nil } [super didReceiveMemoryWarning]; } but this has the disadvantages that (a) in some situations it will cause the view to be loaded before it is subsequently unloaded, and (b) it isn't future proof. mmalc ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Responding to view controller memory warnings (was Re: Outlets / IBOutlet declarations)
On Nov 22, 2008, at 8:16 AM, mmalcolm crawford wrote: [...] Sorry, pressed Deliver on the wrong message by mistake. Let me check on this one. mmalc ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Responding to view controller memory warnings (was Re: Outlets / IBOutlet declarations)
But I'm assuming that self.anOutlet will be valid if and only if self.view is already valid (in which case the call to self.view.superview should be safe, no?). Under this assumption, if self.anOutlet is nil, the be short- circuited and self.view never called; if it is valid, it's safe to call self.view. It seems like, for this assumption not to hold, the outlets must not be being set up at the same time as the view (which I guess could be true if the programmer of the subclass we're talking about is doing something strange, but is not what I would expect). Jamie. On 22 Nov 2008, at 16:16, mmalcolm crawford wrote: On Nov 22, 2008, at 7:58 AM, James Montgomerie wrote: if(self.anOutlet !self.view.superview) { On Nov 19, 2008, at 12:59 AM, mmalcolm crawford wrote: You could invoke 'view': - (void)didReceiveMemoryWarning { if ([self.view superview] == nil) { // set outlets to nil } [super didReceiveMemoryWarning]; } but this has the disadvantages that (a) in some situations it will cause the view to be loaded before it is subsequently unloaded, and (b) it isn't future proof. mmalc ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Responding to view controller memory warnings (was Re: Outlets / IBOutlet declarations)
On 22 Nov 2008, at 16:29, mmalcolm crawford wrote: On Nov 22, 2008, at 8:16 AM, mmalcolm crawford wrote: [...] Sorry, pressed Deliver on the wrong message by mistake. Let me check on this one. Oops, sorry, looks like we're mailing around each other now... Jamie. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Fastest way to resize an image?
Hi, On 20.11.2008, at 09:05, Jean-Nicolas Jolivet wrote: I have a bunch of images to resize. anyway, right now I am loading an NSBitmapImageRep with the imageRepFromFile: method... then creating a new, empty NSImage based on the image size that I want to resize to (using initWithSize:) and I draw the BitmapImageRep on this image (while the focus is locked on the NSImage)... I understand that you are not happy with this way, I call this way the old way, which is now outdated but not deprecated, because since Tiger you can draw directly into an NSBitmapImageRep. (The above way first creates --lockfocus does it-- and then draws into an NSCachedImageRep, from which a new NSBitmapImageRep can be made via TIFFRepresentation.) I usually use the following code (or a similar one) which respects the size (resolution) of the sourceImage reliably! (Searching in this forum for graphicsContextWithBitmapImageRep: will give more hints.) // first load the sourceImage NSBitmapImageRep *sourceRep = [[NSBitmapImageRep alloc] initWithData: ..dataFromFile ..]; NSBitmapImageRep *newRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide:[sourceRep pixelsWide] // or a new value pixelsHigh:[sourceRep pixelsHigh] bitsPerSample:8 samplesPerPixel:4 hasAlpha:YES // must have alpha! isPlanar:NO colorSpaceName:NSCalibratedRGBColorSpace bytesPerRow:0 bitsPerPixel:0 ]; [NSGraphicsContext saveGraphicsState]; NSGraphicsContext *context = [NSGraphicsContext graphicsContextWithBitmapImageRep:newRep]; [NSGraphicsContext setCurrentContext:context]; // do not use drawAtPoint: !! it does not respect resolution due to a bug [self drawInRect:NSMakeRect( 0, 0, [sourceRep pixelsWide], [sourceRep pixelsHigh])]; [NSGraphicsContext restoreGraphicsState]; [newRep setSize:[sourceRep size]]; // this sets the resolution of the source [newRep autorelease]; // if needed Instead of [sourceRep pixelsWide] you should set the new number of pixels. This value must be the same in pixelsWide: and in the drawRect. You see: NSImage is not used because we don't need it. If more flexible drawOperations are waanted, I use a new temporary NSImage and remove it as soon as possible. My tests showed a time speedup of at least a factor of 5. BTW: the connection between size, pixelnumbers and resolution is: size.width = 72.0*pixelsWide / resolutionX size.height = 72.0*pixelsHigh / resolutionY (size has the dimension of a length and the unit 1/72 inch; resolution has the dimension dots per length and the unit dots per inch; pixelsWide, pixelsHigh are dimensionless numbers.) good luck Heinrich -- Heinrich Giesen [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Responding to view controller memory warnings (was Re: Outlets / IBOutlet declarations)
Am 22.11.2008 um 01:53 schrieb mmalcolm crawford: - (void)dealloc { // release outlets and set variables to nil [anOutlet release], anOutlet = nil; [super release]; } [super dealloc] ? ;) atze ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Fastest way to resize an image?
Thanks a lot for that! I'm implementing it right now and I'll do some benchmarking ! :) Just one thing, when you write: [self drawInRect:NSMakeRect( 0, 0, [sourceRep pixelsWide], [sourceRep pixelsHigh])]; Do you mean [[sourceRep drawInRect:NSMakeRect( 0, 0, [sourceRep pixelsWide], [sourceRep pixelsHigh])]; Just wondering because obviously my custom image class (which is basically just a class holding paths and utility functions) has no draw method... Other than that, I like what I'm seeing! Thanks again! :) Jean-Nicolas Jolivet On 22-Nov-08, at 11:59 AM, Heinrich Giesen wrote: Hi, On 20.11.2008, at 09:05, Jean-Nicolas Jolivet wrote: I have a bunch of images to resize. anyway, right now I am loading an NSBitmapImageRep with the imageRepFromFile: method... then creating a new, empty NSImage based on the image size that I want to resize to (using initWithSize:) and I draw the BitmapImageRep on this image (while the focus is locked on the NSImage)... I understand that you are not happy with this way, I call this way the old way, which is now outdated but not deprecated, because since Tiger you can draw directly into an NSBitmapImageRep. (The above way first creates --lockfocus does it-- and then draws into an NSCachedImageRep, from which a new NSBitmapImageRep can be made via TIFFRepresentation.) I usually use the following code (or a similar one) which respects the size (resolution) of the sourceImage reliably! (Searching in this forum for graphicsContextWithBitmapImageRep: will give more hints.) // first load the sourceImage NSBitmapImageRep *sourceRep = [[NSBitmapImageRep alloc] initWithData: ..dataFromFile ..]; NSBitmapImageRep *newRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide:[sourceRep pixelsWide] // or a new value pixelsHigh:[sourceRep pixelsHigh] bitsPerSample:8 samplesPerPixel:4 hasAlpha:YES // must have alpha! isPlanar:NO colorSpaceName:NSCalibratedRGBColorSpace bytesPerRow:0 bitsPerPixel:0 ]; [NSGraphicsContext saveGraphicsState]; NSGraphicsContext *context = [NSGraphicsContext graphicsContextWithBitmapImageRep:newRep]; [NSGraphicsContext setCurrentContext:context]; // do not use drawAtPoint: !! it does not respect resolution due to a bug [self drawInRect:NSMakeRect( 0, 0, [sourceRep pixelsWide], [sourceRep pixelsHigh])]; [NSGraphicsContext restoreGraphicsState]; [newRep setSize:[sourceRep size]]; // this sets the resolution of the source [newRep autorelease];// if needed Instead of [sourceRep pixelsWide] you should set the new number of pixels. This value must be the same in pixelsWide: and in the drawRect. You see: NSImage is not used because we don't need it. If more flexible drawOperations are waanted, I use a new temporary NSImage and remove it as soon as possible. My tests showed a time speedup of at least a factor of 5. BTW: the connection between size, pixelnumbers and resolution is: size.width = 72.0*pixelsWide / resolutionX size.height = 72.0*pixelsHigh / resolutionY (size has the dimension of a length and the unit 1/72 inch; resolution has the dimension dots per length and the unit dots per inch; pixelsWide, pixelsHigh are dimensionless numbers.) good luck Heinrich -- Heinrich Giesen [EMAIL PROTECTED] Jean-Nicolas Jolivet [EMAIL PROTECTED] http://www.silverscripting.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
CocoaHeads Cork, Ireland
hi folks, I have set up a chapter of CocoaHeads in Cork, Ireland. If anyone in the vicinity is interested in participating (meting up) please drop me a line. cheers rgds Dave __ David Murphy Department of Computer Science University College Cork Ireland p: 00353 (0)21 4903579 f: 00353 (0)21 4274390 e: [EMAIL PROTECTED] w: http://multimedia.ucc.ie w: http://www.imclab.ucc.ie w: http://www.cs.ucc.ie/staff/dmurphy.html ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Fastest way to resize an image?
While we're on the subject, I was wondering... does NSBitmapImageRep has an equivalent to NSImage's drawInRect: fromRect: operation: fraction: Problem is... the ImageRep technique works well when I'm just scaling an image..it's quite fast too, however I am also cropping (in some cases)... and unfortunately, without the fromRect parameter, it's pretty much impossible to crop... right now I'm drawing my ImageRep in an intermediate NSImage so that i can use drawInRect: fromRect: when cropping but it takes tons of time (like 2-3x the time it takes by using just an ImageRep...) being able to use drawInRect: fromRect on an ImageRep would save me ton of time and headaches... Jean-Nicolas Jolivet On 22-Nov-08, at 11:59 AM, Heinrich Giesen wrote: Hi, On 20.11.2008, at 09:05, Jean-Nicolas Jolivet wrote: I have a bunch of images to resize. anyway, right now I am loading an NSBitmapImageRep with the imageRepFromFile: method... then creating a new, empty NSImage based on the image size that I want to resize to (using initWithSize:) and I draw the BitmapImageRep on this image (while the focus is locked on the NSImage)... I understand that you are not happy with this way, I call this way the old way, which is now outdated but not deprecated, because since Tiger you can draw directly into an NSBitmapImageRep. (The above way first creates --lockfocus does it-- and then draws into an NSCachedImageRep, from which a new NSBitmapImageRep can be made via TIFFRepresentation.) I usually use the following code (or a similar one) which respects the size (resolution) of the sourceImage reliably! (Searching in this forum for graphicsContextWithBitmapImageRep: will give more hints.) // first load the sourceImage NSBitmapImageRep *sourceRep = [[NSBitmapImageRep alloc] initWithData: ..dataFromFile ..]; NSBitmapImageRep *newRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide:[sourceRep pixelsWide] // or a new value pixelsHigh:[sourceRep pixelsHigh] bitsPerSample:8 samplesPerPixel:4 hasAlpha:YES // must have alpha! isPlanar:NO colorSpaceName:NSCalibratedRGBColorSpace bytesPerRow:0 bitsPerPixel:0 ]; [NSGraphicsContext saveGraphicsState]; NSGraphicsContext *context = [NSGraphicsContext graphicsContextWithBitmapImageRep:newRep]; [NSGraphicsContext setCurrentContext:context]; // do not use drawAtPoint: !! it does not respect resolution due to a bug [self drawInRect:NSMakeRect( 0, 0, [sourceRep pixelsWide], [sourceRep pixelsHigh])]; [NSGraphicsContext restoreGraphicsState]; [newRep setSize:[sourceRep size]]; // this sets the resolution of the source [newRep autorelease];// if needed Instead of [sourceRep pixelsWide] you should set the new number of pixels. This value must be the same in pixelsWide: and in the drawRect. You see: NSImage is not used because we don't need it. If more flexible drawOperations are waanted, I use a new temporary NSImage and remove it as soon as possible. My tests showed a time speedup of at least a factor of 5. BTW: the connection between size, pixelnumbers and resolution is: size.width = 72.0*pixelsWide / resolutionX size.height = 72.0*pixelsHigh / resolutionY (size has the dimension of a length and the unit 1/72 inch; resolution has the dimension dots per length and the unit dots per inch; pixelsWide, pixelsHigh are dimensionless numbers.) good luck Heinrich -- Heinrich Giesen [EMAIL PROTECTED] Jean-Nicolas Jolivet [EMAIL PROTECTED] http://www.silverscripting.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Fastest way to resize an image?
Well, by digging a bit on cocoabuilder, I found about this cropping method which is really fast (enough for my needs anyway!) (imageRep is my BitmapImageRep, fromRect is the rectangle I want to crop to) CGImageRef cgImg = CGImageCreateWithImageInRect([imageRep CGImage], NSRectToCGRect(fromRect)); NSBitmapImageRep *resultRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImg]; CGImageRelease(cgImg); Hopefully this can help someone with the same problem in the future! Thanks to everyone for the help! :) J-N Jolivet On 20-Nov-08, at 1:30 AM, Jean-Nicolas Jolivet wrote: I have a bunch of images to resize... they are located on the HD so they can be loaded in an NSImage or a BitmapImageRep or pretty much any way I'd like (CIImage, CGImage are possibilities I guess), however I found out that just using the setSize: method of NSImage was unreliable (since basically NSImage is just a container for NSImageReps and such... I was getting unreliable results with certain images)... anyway, right now I am loading an NSBitmapImageRep with the imageRepFromFile: method... then creating a new, empty NSImage based on the image size that I want to resize to (using initWithSize:) and I draw the BitmapImageRep on this image (while the focus is locked on the NSImage)... This works well and yields reliable results, however the process is quite slow with bigger images... if I have say 20-30 images to resize it can take almost a minute... I was wondering if there was a faster way to achieve the same result (while still getting reliable results... ). One thing that I have to consider is that I am adding a border to the images so I might have no other choice but to actually draw them somewhere in the process... but is there something faster than NSImage/NSImageRep to work with? Any help/pointers would be appreciated... basically I can already do what I want to do, just looking for the fastest way to do it... Jean-Nicolas Jolivet [EMAIL PROTECTED] http://www.silverscripting.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/silvertab%40videotron.ca This email sent to [EMAIL PROTECTED] Jean-Nicolas Jolivet [EMAIL PROTECTED] http://www.silverscripting.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: bug in NSGradient?
Graham Cox wrote: Just noticed this, not what I was expecting. I'll file a bug unless someone can convincingly explain it's correct behaviour... [NSGradient interpolatedColorAtLocation:value]; If the gradient has stops that run from, say, 0.5 to 1.0, but value is less than 0.5, this method returns nil. I would have expected it to return the extended colour, i.e. the first one in this case. The discussion for this method says: This method does not simply return the color values used to initialize the receiver. Instead, it computes the value that would be drawn at the specified location. For the case above this depends on whether the gradient will be drawn with the colour extending flags set, but since this method doesn't know about those flags, it's not well-defined. I would suggest that the method should assume the flags are set, since that's a useful assumption, whereas the opposite isn't. I'll agree that the documentation should be clarified, but I'm not sure what the rationale is for claiming that it's not useful for the method to indicate that the gradient doesn't draw at all at a certain location. G ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: bug in NSGradient?
On Sat, Nov 22, 2008 at 4:12 AM, Graham Cox [EMAIL PROTECTED] wrote: Just noticed this, not what I was expecting. I'll file a bug unless someone can convincingly explain it's correct behaviour... [NSGradient interpolatedColorAtLocation:value]; [snip] For the case above this depends on whether the gradient will be drawn with the colour extending flags set, but since this method doesn't know about those flags, it's not well-defined. I would suggest that the method should assume the flags are set, since that's a useful assumption, whereas the opposite isn't. Well, from a terminology point of view, nil is the right answer. You can't interpolate beyond the end points. That's extrapolation. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Testing components within an application
Hi Frank, I used to do this back in my Java days: put a main function in the class and just run it. That was a quick way to test a class, but I don't think you can do that as easily in Cocoa. I maybe wrong though, still a noob here :-). Andre Masse On Nov 22, 2008, at 08:08, Frank Wilson wrote: Is there a way that seasoned cocoa (Obj-C) programers test particular parts of their code without running the whole application? For instance if I have built a particular interface component I would like to interact with it and verify that the model is being changed correctly or simply demonstrate that it works. I think that requires slightly more functionality than the IB simulator gives. I'm not looking for an automated testing framework like JUnit, just a way to way to run a particular part of my program like main( String[] args) in Java. I suppose you could do this by implementing extra build targets but that would mean having several applications in the same project. It sounds a bit heavy. Any ideas? Thanks, Frank ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Fastest way to resize an image?
On Sat, Nov 22, 2008 at 1:36 PM, Jean-Nicolas Jolivet [EMAIL PROTECTED] wrote: While we're on the subject, I was wondering... does NSBitmapImageRep has an equivalent to NSImage's drawInRect: fromRect: operation: fraction: Problem is... the ImageRep technique works well when I'm just scaling an image..it's quite fast too, however I am also cropping (in some cases)... and unfortunately, without the fromRect parameter, it's pretty much impossible to crop... right now I'm drawing my ImageRep in an intermediate NSImage so that i can use drawInRect: fromRect: when cropping but it takes tons of time (like 2-3x the time it takes by using just an ImageRep...) being able to use drawInRect: fromRect on an ImageRep would save me ton of time and headaches... You can crop any drawing you wish by using the -[NSBezierPath addClip] method. That NSImage allows you to do it inline is really just a convenience. Mike ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Core Animation: How to swicth off all implicit animations?
Hello, Background: the application I am trying to build consists mainly of a WebView. And I need to perform some custom drawing in front of that WebView. First, I simply placed (in IB) a custom view in front of the WebView. Unfortunately, my drawing always took place behind the WebView. A little search in the documentation and on Google revealed that this is normal behavior. The only way to draw in front of such a complex thing as a WebView seems to be using Core Animation layer- backed views. OK. I set the wantsLayer property to YES for the NSView that contains both the WebView and my custom view. Then I set the zPosition of my custom view to 0.1 (arbitrary, greater than zero). It works great, I finally see my drawing. However, now I have another problem: Both, my custom view and the WebView are configured to resize with their superview. Before activating wantsLayer, this resizing was a smooth process. Now, however, some animations take place, fading my WebView in and out constantly during the resize. I suspect that these are some implicit transactions or whatever which come with Core Animation (I am totally new to Core Animation). Question: is there a (simple) way to switch all these implicit behaviors off (while keeping the possibility to stack the two views in layers)? Any suggestions would be very appreciated... Wolf ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Fastest way to resize an image?
Hi, On 22.11.2008, at 19:36, Jean-Nicolas Jolivet wrote: Problem is... the ImageRep technique works well when I'm just scaling an image..it's quite fast too, however I am also cropping (in some cases)... and unfortunately, without the fromRect parameter, it's pretty much impossible to crop... for a more comfortable drawing method you need an extra NSImage, but the overhead is very small. Replace [self drawInRect:NSMakeRect( 0, 0, [sourceRep pixelsWide], [sourceRep pixelsHigh])]; (as you already noticed there is a typo: self is wrong, it should have been sourceRep, sorry ) with: (written in mail) NSImage *tmpImg = [[NSImage alloc] initWithSize:NSZeroSize]; [tmpImg addRepresentation: sourceRep]; [tmpImg drawInRect:NSMakeRect( 0, 0, [sourceRep pixelsWide], [sourceRep pixelsHigh]) fromRect:cropRect // or NSZeroRect when using the whole image operation:NSCompositeSourceOver fraction:1.0]; If the newRep shall have the same resolution as the source, we can do it with: float dpiX = 72.0*[sourceRep pixelsWide]/[sourceRep size].width; // source x resolution NSSize size = [newRep size]; size.width = 72.0*[newRep pixelsWide] / dpiX; [newRep setSize:size]; (similar setting the y resolution) Heinrich -- Heinrich Giesen [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
what does FAILED TO GET ASN FROM CORESERVICES mean?
[I originally sent this, erroneously, to darwin-development. It's failing in NSApplication.init(), so it belongs here. -- wcj] What's an ASN? How does a system daemon ever get one? I'm running a daemon, started by SystemStarter at boot time, and running as me (an admin account), which periodically invokes OpenOffice's soffice binary to convert MS Office docs to PDF. Works most of the time, even though daemons supposedly don't have access to the window server, but sometimes OpenOffice crashes with this error message: FAILED TO GET ASN FROM CORESERVICES so aborting. Here's the stack of the crashing thread: $ cat /Library/Logs/CrashReporter/soffice.bin_2008-11-20-173308_suntzu.crash Process: soffice.bin [46197] Path: /Library/GoodStuff/1.0/OpenOffice.org.app/Contents/MacOS/soffice.bin Identifier: soffice.bin Version: ??? (???) Code Type: X86 (Native) Parent Process: soffice [46196] Date/Time: 2008-11-20 17:33:08.237 -0800 OS Version: Mac OS X 10.5.5 (9F33) Report Version: 6 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x, 0x Crashed Thread: 0 Thread 0 Crashed: 0 libSystem.B.dylib 0x0054bb9e __kill + 10 1 libSystem.B.dylib 0x005c2ec2 raise + 26 2 libSystem.B.dylib 0x005d247f abort + 73 3 com.apple.HIServices0x02db5614 _RegisterApplication + 2447 4 com.apple.HIServices0x02db4c5a GetCurrentProcess + 50 5 com.apple.HIToolbox 0x00b2f2f8 GetSystemUIMode + 44 6 com.apple.HIToolbox 0x00b2f2a7 IsMenuBarVisible + 41 7 com.apple.AppKit0x07241155 _NSInitializeAppContext + 59 8 com.apple.AppKit0x07240ade -[NSApplication init] + 819 9 com.apple.AppKit0x072404ef +[NSApplication sharedApplication] + 177 10 libvclmxi.dylib 0x05b9ca9b component_getFactory + 138227 11 libvclmxi.dylib 0x05b9cd79 component_getFactory + 138961 12 libvclmxi.dylib 0x05969cd7 SVMain() + 17 13 libsofficeapp.dylib 0x004a567c soffice_main + 160 14 soffice.bin 0x2bba main + 30 15 soffice.bin 0x252a start + 258 16 soffice.bin 0x2451 start + 41 Can anyone explain what's going on when this happens? Thanks. Bill ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Special Characters... menu item
Hi, Is there a way to keep Special Characters... from being added to the end of the Edit menu? thanks Jeff ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Core Animation: How to swicth off all implicit animations?
Have you tried : [CATransaction begin]; [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions]; // Your code here [CATransaction commit]; See also: http://developer.apple.com/documentation/Cocoa/Conceptual/CoreAnimation_guide/Articles/Transactions.html http://www.cocoabuilder.com/archive/message/cocoa/2008/6/25/211097 -Matt On Nov 22, 2008, at 12:41 PM, Wolf Hauser wrote: Hello, Background: the application I am trying to build consists mainly of a WebView. And I need to perform some custom drawing in front of that WebView. First, I simply placed (in IB) a custom view in front of the WebView. Unfortunately, my drawing always took place behind the WebView. A little search in the documentation and on Google revealed that this is normal behavior. The only way to draw in front of such a complex thing as a WebView seems to be using Core Animation layer-backed views. OK. I set the wantsLayer property to YES for the NSView that contains both the WebView and my custom view. Then I set the zPosition of my custom view to 0.1 (arbitrary, greater than zero). It works great, I finally see my drawing. However, now I have another problem: Both, my custom view and the WebView are configured to resize with their superview. Before activating wantsLayer, this resizing was a smooth process. Now, however, some animations take place, fading my WebView in and out constantly during the resize. I suspect that these are some implicit transactions or whatever which come with Core Animation (I am totally new to Core Animation). Question: is there a (simple) way to switch all these implicit behaviors off (while keeping the possibility to stack the two views in layers)? Any suggestions would be very appreciated... Wolf ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Cocoa canvas view ?
On Nov 21, 2008, at 17:20 , Kyle Sluder wrote: On Fri, Nov 21, 2008 at 9:50 AM, Guillaume Laurent [EMAIL PROTECTED] wrote: Indeed I could :-). This is a very impressive work, thank you for it. Can you tell me more about its scalability ? What I'm planning to write is a music classical notation editor, so I'll typically need to handle a number of objects in the 10k order of magnitude, in a very large view. In your position I would hesitate to actually model your graphical elements as objects. Rather, I would just have my view figure out what portion of the score needs to be drawn, and then just draw to the view. Perhaps I would use a cell class like NoteCell to do the dirty work. My view would know how to convert bounds-oriented coordinates into sections of staffs, and then would draw the staves, followed by iterating through each note in each staff, calling -setObjectValue: on the view's cell and then drawing the cell at the appropriate place. That's another option I'm also considering, but then you also need to re-invent all the collision detection mechanism, so you can tell what note the user has clicked on, or which ones he's selected. You also have to re-invent a tools mechanism just like the one DrawKit has, for the various editing operations. This is conceptually similar to how NSTableView works. It doesn't really care about objects; the OO illusion is not necessary at the level it's dealing with, and the complexity of dealing with it will probably make your head spin, your app slow, or both. For the record we've already done this (a Linux sequencer called Rosegarden), and there aren't really any performance nor complexity problems. Quite the contrary, when at one point I rewrote one of the editing view (not dealing with notation but with tracks, i.e. showing rectangles on a grid - pretty simple) from a canvas-based view to a custom view as you suggest, the end result was way more complicated code-wise. The only gain we had was getting rid of the limitations of the original canvas view we were based on. -- Guillaume http://telegraph-road.org ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Core Animation: How to swicth off all implicit animations?
Hi Matt, thank you for your help. [CATransaction begin]; [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions]; // Your code here [CATransaction commit]; I had tried to use this, however I was not sure where to put it. My problem is with the Your code here. In the whole resize procedure, no code is involved. The views are resized automatically when the user resizes the window in which they reside. What I tried now was to overwrite the setFrame: method of the view that contains the background layer. For Your code here, I call [super setFrame:frame]. Unfortunately, this does not prevent the WebView from fading in and out. See also: http://developer.apple.com/documentation/Cocoa/Conceptual/CoreAnimation_guide/Articles/Transactions.html http://www.cocoabuilder.com/archive/message/cocoa/2008/6/25/211097 This thread talks exactly about my problem; thank you for pointing me at it. Nevertheless, there is no real solution provided, or is it? They suggest to 'simply' overwrite +(id)defaultAnimationForKey: (NSString*)key and to return nil. But in which class do I have to overwrite it? I have overwritten it in (a) my subclass of NSView, which is supposed to do the custom drawing, (b) in the NSView that contains this view and the WebView and (c) finally I even subclassed the WebView to overwrite it there -- but the fading effects are still there... What I was hoping to find is a possibility to switch the effects off completely. Not only for specific classes, where I have no influence on subviews, not only for one specific transaction, where I do not exactly know when it is triggered, but entirely, completely, off. For all objects and forever :-) Wolf ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
How do I get a CGContextRef?
The Overview section of CGContext Reference says You can obtain a graphics context by using Quartz graphics context creation functions But it doesn't say where to find these functions. They don't appear to be listed in CGContext Reference itself, as far as I can see. I know there are Cocoa methods for this; but where are the Quartz functions? I've been trying to find them for ages: very frustrating. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How do I get a CGContextRef?
Hi DKJ, Take a look here: http://developer.apple.com/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_context/chapter_3_section_1.html. -Ken On Sat, Nov 22, 2008 at 5:31 PM, DKJ [EMAIL PROTECTED] wrote: The Overview section of CGContext Reference says You can obtain a graphics context by using Quartz graphics context creation functions But it doesn't say where to find these functions. They don't appear to be listed in CGContext Reference itself, as far as I can see. I know there are Cocoa methods for this; but where are the Quartz functions? I've been trying to find them for ages: very frustrating. ___ 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/kenferry%40gmail.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How do I get a CGContextRef?
On 22-Nov-08, at 17:40 , Ken Ferry wrote: Take a look here: Thanks for the reference, but I'm doing this for iPhone, and the procedure seems to be different. The compiler doesn't recognise the NSGraphicsContext class. I tried using the UIGraphicsGetCurrentContext function, but that doesn't work either: I get an invalid context error when I use it in CGContextStrokeRect. dkj ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: what does FAILED TO GET ASN FROM CORESERVICES mean?
On Sat, Nov 22, 2008 at 4:20 PM, Bill Janssen [EMAIL PROTECTED] wrote: [I originally sent this, erroneously, to darwin-development. It's failing in NSApplication.init(), so it belongs here. -- wcj] What's an ASN? How does a system daemon ever get one? I'm running a daemon, started by SystemStarter at boot time, and running as me (an admin account), which periodically invokes OpenOffice's soffice binary to convert MS Office docs to PDF. Works most of the time, even though daemons supposedly don't have access to the window server, but sometimes OpenOffice crashes with this error message: FAILED TO GET ASN FROM CORESERVICES so aborting. I don't know what the message means exactly, and pardon my obviousness, but couldn't this just be the window server connection problem that you mention above? The stack trace certainly looks like it. The call to _RegisterApplication is going to talk to the window server, and it's probably calling abort() when it can't. Mike ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Core Animation: How to swicth off all implicit animations?
On Sat, Nov 22, 2008 at 2:41 PM, Wolf Hauser [EMAIL PROTECTED] wrote: Hello, Background: the application I am trying to build consists mainly of a WebView. And I need to perform some custom drawing in front of that WebView. First, I simply placed (in IB) a custom view in front of the WebView. Unfortunately, my drawing always took place behind the WebView. A little search in the documentation and on Google revealed that this is normal behavior. The only way to draw in front of such a complex thing as a WebView seems to be using Core Animation layer-backed views. OK. I set the wantsLayer property to YES for the NSView that contains both the WebView and my custom view. Then I set the zPosition of my custom view to 0.1 (arbitrary, greater than zero). It works great, I finally see my drawing. However, now I have another problem: Both, my custom view and the WebView are configured to resize with their superview. Before activating wantsLayer, this resizing was a smooth process. Now, however, some animations take place, fading my WebView in and out constantly during the resize. I suspect that these are some implicit transactions or whatever which come with Core Animation (I am totally new to Core Animation). Question: is there a (simple) way to switch all these implicit behaviors off (while keeping the possibility to stack the two views in layers)? Any suggestions would be very appreciated... I don't believe your approach is viable. WebViews aren't supported in layer-backed mode. This is poorly documented, and the only place I could find it mentioned was in the AppKit release notes: http://developer.apple.com/releasenotes/Cocoa/AppKit.html It states: Most of the standard views and controls that AppKit and Mac OS X's other Cocoa frameworks provide are able to function in layer-backed mode in Leopard, with the exception of certain specialized views such as WebKit WebViews and Quartz Composer QCViews, whose use in layer-backed mode is not presently supported. So you're out of luck there. However, for what you're doing you shouldn't need CoreAnimation at all, and certainly shouldn't need it for the WebView. Here are a few different things you could do: 1) Ditch the layers, and simply place your view in front of the WebView. Ignore the stuff you've been reading which says that overlapping views aren't supported; this is no longer true in Leopard. The reason it's not working for you is *probably* simply due to an Interface Builder bug where the actions of Bring to Front and Send to Back can become reversed. Try setting the order in code, or simply reversing the order of your views in IB. (Note that layering in this way can still fail in some ways, particularly if your WebView displays certain types of content, such as QuickTime movies, which end up being rendered in a special way that will display above your content.) 2) Use layer-backed mode only for your view, not the WebView. Layer-backed views draw above non-layer-backed views. 3) Use an overlay window. This is just a borderless window positioned in the correct place and added as a child window to your main window. Put the window in front, put whatever you want in the window. You'll have to manually manage resizing and such to work correctly, but this will give you the layering you seek without using CoreAnimation at all. Mike ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
NSPopupUpButton not showing checked menu items
In IB I created a NSPopUpButton configured as pulldown with a static menu. I bound its selectedTag binding to a method on my window controller. (I also tried binding selectedIndex with the same results.) When I run my code and select various of the items in the button's menu, none of the items are shown as checked. Or if one of the menu items was left selected in IB from when items were added to the menu, that item is permanently checked. I added NSLog calls in the controller's getter and setter methods bound to the popup and they're correctly tracking the changes to the selected item. When I dumped out each NSMenuItems's -state, all returned NSOffState. This is very strange since I've done this sort of thing before with NSPopUpButtons configured as popup (vs pulldown) with no problems. Any ideas what I might be doing wrong? BTW, this is on 10.4.11. 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 [EMAIL PROTECTED]
Facile Core Data Question
How to I cause a managed object to perform a certain action upon deletion? If I were working with Ruby On Rails or some other ORMs, I'd be able to define an on_delete method or action that would automatically be invoked. In core data, it seems that the best thing to do is to have a godlike object listening for the NSManagedObjectContextObjectsDidChangeNotification and doing the action upon the object's removal. I don't think I'm doing this exactly the right way, and I'd like to know if anyone else does this differently? Jamie Hardt The Sound Department http://www.soundepartment.com/ http://www.imdb.com/name/nm0362504/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSPopupUpButton not showing checked menu items
On Sat, Nov 22, 2008 at 9:20 PM, Steve Christensen [EMAIL PROTECTED] wrote: In IB I created a NSPopUpButton configured as pulldown with a static menu. I bound its selectedTag binding to a method on my window controller. (I also tried binding selectedIndex with the same results.) When I run my code and select various of the items in the button's menu, none of the items are shown as checked. Or if one of the menu items was left selected in IB from when items were added to the menu, that item is permanently checked. You bound selectedTag to a method? Bindings are done to keypaths. Of course, they key can be implemented using KVO-compliant accessor and mutator methods -- is this how you have done it? --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 [EMAIL PROTECTED]
Re: How do I get a CGContextRef?
well where are you calling it? That's the correct function, but only works when there is a graphics context set, and that's only inside drawRect: in a UIView. I wandered through the documentation a little and got reasonably lost, it does talk about NSGraphicsContext in there, but remember a lot of the documentation was dragged over from OS X and some of the stuff in there doesn't exist on iPhone, NSGraphicsContext is one of them. I don't see any way to create one for the iPhone window, you can create bitmap ones I suspect, I think you need to be in drawRect:, but then again, if you're not, why do you want one? I'm going to have to dive into the whole quartz and drawing code one day as I suspect there is a lot of great stuff down there .. but it's daunting. On Nov 23, 2008, at 9:48 AM, DKJ wrote: On 22-Nov-08, at 17:40 , Ken Ferry wrote: Take a look here: Thanks for the reference, but I'm doing this for iPhone, and the procedure seems to be different. The compiler doesn't recognise the NSGraphicsContext class. I tried using the UIGraphicsGetCurrentContext function, but that doesn't work either: I get an invalid context error when I use it in CGContextStrokeRect. dkj ___ 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/rols%40rols.org This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Facile Core Data Question
On Sat, Nov 22, 2008 at 9:37 PM, Jamie Hardt [EMAIL PROTECTED] wrote: How to I cause a managed object to perform a certain action upon deletion? If I were working with Ruby On Rails or some other ORMs, I'd be able to define an on_delete method or action that would automatically be invoked. In core data, it seems that the best thing to do is to have a godlike object listening for the NSManagedObjectContextObjectsDidChangeNotification and doing the action upon the object's removal. I don't see why this requires a god object; why can't your model-controller (NSPersistentDocument subclass) register for this notification? Or, for that matter, whatever object needs to perform the action? --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 [EMAIL PROTECTED]
Re: How do I get a CGContextRef?
On Nov 22, 2008, at 5:48 PM, DKJ wrote: On 22-Nov-08, at 17:40 , Ken Ferry wrote: Take a look here: Thanks for the reference, but I'm doing this for iPhone, and the procedure seems to be different. The compiler doesn't recognise the NSGraphicsContext class. I tried using the UIGraphicsGetCurrentContext function, but that doesn't work either: I get an invalid context error when I use it in CGContextStrokeRect. Are you saying that this doesn't work: CGContextRef context = UIGraphicsGetCurrentContext(); If so there must be something else going on.That's the standard way to obtain the current context within drawRect Cheers, . . . . . . . .Henry ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Facile Core Data Question
Maybe a poor choice of words on my part. s/God Object/Any old model object/ Just with the understanding that this object not be a controller. On Nov 22, 2008, at 7:07 PM, Kyle Sluder wrote: I don't see why this requires a god object; why can't your model-controller (NSPersistentDocument subclass) register for this notification? Or, for that matter, whatever object needs to perform the action? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How do I get a CGContextRef?
On 22-Nov-08, at 19:07 , Henry McGilton (Developer) wrote: That's the standard way to obtain the current context within drawRect OK, I wasn't doing it within drawRect... silly me. I'll give it a try and see what happens. dkj ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSPopupUpButton not showing checked menu items
On Nov 22, 2008, at 6:38 PM, Kyle Sluder wrote: On Sat, Nov 22, 2008 at 9:20 PM, Steve Christensen [EMAIL PROTECTED] wrote: In IB I created a NSPopUpButton configured as pulldown with a static menu. I bound its selectedTag binding to a method on my window controller. (I also tried binding selectedIndex with the same results.) When I run my code and select various of the items in the button's menu, none of the items are shown as checked. Or if one of the menu items was left selected in IB from when items were added to the menu, that item is permanently checked. You bound selectedTag to a method? Bindings are done to keypaths. Of course, they key can be implemented using KVO-compliant accessor and mutator methods -- is this how you have done it? Sorry, I was inaccurate. Yes, I specified that the NSPopupButton's selectedTag binding will get/set its value based on a key path associated with my window controller class (also nib file owner). In my particular case, the binding is to a getter/setter pair of methods since I have to do a little more than simply getting or setting an instance variable. When I click on the popup and change the selection, the result I'm seeing is that my controller's setter method is being called, that the popup's selected item index is being changed correctly (at least NSLog says so), but that the currently selected menu item isn't checked. 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 [EMAIL PROTECTED]
Re: Core Animation: How to swicth off all implicit animations?
Ok. This is interesting. I wrote a little code to see what might be going on. Whatever was true when the AppKit release notes were published has either changed or the term supported has a loose definition. Thanks for pointing that out, Mike, but I don't think it's accurate or I've misunderstood what you've quoted. I have tried to use QCViews in layer- backed mode before and it doesn't seem to work there. However, I've added layers of several different types (CALayer, CATextLayer, QTMovieLayer) as sublayers to the WebView's root layer and they all seem to work as expected. Here are things I've observed: - When I add a layer, that layer's contents always displays in front of the web view content no matter the zPosition - When I mouse over the links in the web view, the cursor changes to a hand cursor and I can still click them and go to a new page no matter whether they are obscured by the fronting layer or not. - I added a QTMovieLayer and played back the movie it contains having set the layer's opacity to 0.25 and I can surf using the web view while the movie plays at 25% opacity in real time. It's kind of weird (but cool at the same time ;-). The issue that Wolf is having, though, has to do with the fact that there is a default action associated with the layer contents. Here are some additional observations: - The page content doesn't display until it is loaded at which point it fades in. - When scrolling the page, you can see the fade effect when the content view changes--suggesting that it is the contents field of the layer that is doing the rendering - It isn't obvious which layer the web content is in. I have tried to call [[webView] layer] setDelegate:self] and then implement - (idCAAction)actionForLayer:(CALayer *)layer forKey :(NSString *)key; I get the following output using NSLog(@%@: %@, layer, key); in actionForLayer : 2008-11-22 22:15:19.557 LayerBackedWebView[14958:10b] _NSViewBackingLayer(0x154cf90) p={0, 0} b=(0,0,648,534) superlayer=0x0: actions 2008-11-22 22:15:20.267 LayerBackedWebView[14958:10b] _NSViewBackingLayer(0x154cf90) p={0, 0} b=(0,0,648,534) superlayer=0x0: position 2008-11-22 22:15:20.277 LayerBackedWebView[14958:10b] _NSViewBackingLayer(0x154cf90) p={324, 267} b=(0,0,648,534) superlayer=0x0: onOrderIn I've tried to override the action for the three items that show up there--actions, position, and onOrderIn, however, there is still a fade. Here is the code I used to try to override: [[webView layer] addSublayer:layer]; [[webView layer] setDelegate:self]; NSMutableDictionary *actions = [NSMutableDictionary dictionaryWithDictionary:[[webView layer] actions]]; [actions setObject:[NSNull null] forKey:@actions]; [actions setObject:[NSNull null] forKey:@position]; [actions setObject:[NSNull null] forKey:@onOrderIn]; [[webView layer] setActions:actions]; Still no dice. Finally, the WebView implements the NSAnimatablePropertyContainer protocol which means you should be able to set the animations with a dictionary on the web view itself like this: [webView setAnimations:actions]; This also does not work. Ok. This message is getting too long. Sorry about that. It's very interesting problem, but I'm still uncertain what the answer may be. Mike's other suggestions sound like good ideas worth trying. -Matt On Nov 22, 2008, at 7:11 PM, Michael Ash wrote: I don't believe your approach is viable. WebViews aren't supported in layer-backed mode. This is poorly documented, and the only place I could find it mentioned was in the AppKit release notes: http://developer.apple.com/releasenotes/Cocoa/AppKit.html It states: Most of the standard views and controls that AppKit and Mac OS X's other Cocoa frameworks provide are able to function in layer-backed mode in Leopard, with the exception of certain specialized views such as WebKit WebViews and Quartz Composer QCViews, whose use in layer-backed mode is not presently supported. So you're out of luck there... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]