Re: multitouch trackpad on macbook pro
hey thanks, will check it out. Memo. On 30 Jun 2009, at 16:18, mmalc Crawford wrote: On Jun 30, 2009, at 3:33 AM, Memo Akten wrote: i was wondering if it is at all possible to receive the multi-touch data on the trackpads of the recent macbook pros? Now that the WWDC videos are available, it may be worth watching <http://developer.apple.com/wwdc/attendee/sessions/session.php?id=117 > (note the related resources). <http://developer.apple.com/adconitunes/> 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/memo%40memo.tv This email sent to m...@memo.tv ___ 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
multitouch trackpad on macbook pro
Hi All, i was wondering if it is at all possible to receive the multi- touch data on the trackpads of the recent macbook pros? Cheers, Memo. ___ 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 skin a QTMovie Player
Hi Douglas, that looks interesting, using that system can you customize the seek bar and seek handle? play/pause buttons? and also load any quicktime movie and play through that skin? Or is it just an overlay embedded in a movie? On 10 Apr 2009, at 18:06, douglas welton wrote: Memo, Is there a problem with building a normal skin for your movie (via: http://www.apple.com/quicktime/tutorials/mediaskins.html) and then playing it back in a controller-less QTMovieView? curiously, douglas On Apr 10, 2009, at 7:11 AM, Memo Akten wrote: Hi All, I would like to create a custom QTMoviePlayer. I've read the QTKit programming guide and looked at the sample, and understand the basics of using QTMovie and QTMovieView. I want a custom skin (play/pause button, seekable controller etc.) I could do this just by using a QTMovieView without displaying the controller, and then building a controller from scratch using normal NSControl's, but I was wondering if there was a simpler way and the QTMovieView controller was skinnable? Cheers ___ 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 skin a QTMovie Player
Hi All, I would like to create a custom QTMoviePlayer. I've read the QTKit programming guide and looked at the sample, and understand the basics of using QTMovie and QTMovieView. I want a custom skin (play/ pause button, seekable controller etc.) I could do this just by using a QTMovieView without displaying the controller, and then building a controller from scratch using normal NSControl's, but I was wondering if there was a simpler way and the QTMovieView controller was skinnable? Cheers, ___ 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: PDFView in layer backed view appears white
Thanks John, the second approach seems like it makes the most sense for my needs. cheers. On 6 Apr 2009, at 19:10, John Calhoun wrote: On Apr 6, 2009, at 6:31 AM, Memo Akten wrote: Hi, I would like to add a PDFView to another view. But if my root view is layer backed I see nothing (just white). The PDFView contains a subview. You can get to it via: -[PDFView documentView]. Perhaps retain this subview, remove from super, and add the subview to a layer backed view. I can think of a number of ways this may fail though (haven't tried it), so don't get your hopes up. If you simply want to display a single page though, just create your own NSView subclass and call PDFPage's draw method in your views drawRect method. You can set the needed scale on the current graphics context to have the PDFPage draw at the correct size. Also, don't forget to erase to white before calling PDFPage's draw. John Calhoun—___ 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/memo%40memo.tv This email sent to m...@memo.tv ___ 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
PDFView in layer backed view appears white
Hi, I would like to add a PDFView to another view. But if my root view is layer backed I see nothing (just white). If I disable layer backing, pdf appears fine. My code is: NSString *path = [[NSBundle mainBundle] pathForResource:fileName ofType:nil inDirectory:folder]; PDFDocument* pdf = [[[PDFDocument alloc] initWithURL:[NSURL fileURLWithPath:path]] autorelease]; PDFView *pdfView = [[[PDFView alloc] initWithFrame:[[pdf pageAtIndex: 0] boundsForBox:kPDFDisplayBoxCropBox]] autorelease]; [pdfView setDocument:pdf]; [pdfView goToFirstPage:self]; [pdfView setDisplayMode:kPDFDisplaySinglePage]; [uiView addSubview:pdfView]; [uiView setWantsLayer:YES]; Is this normal behaviour? Is there anyway to display PDF's in a layer backed view? I only want to display a single PDF page, no need to select text, navigate pages, scroll etc. Just static display. I was using the following code to draw the PDF into an image and display that, but then when the view is scaled it doesn't display very sharp (not vector anymore). PDFPage* page = [pdf pageAtIndex:0]; NSData* rawData = [page dataRepresentation]; NSImage* image = [[[NSImage alloc] initWithData:rawData] autorelease]; Cheers, Memo. ___ 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: NSString* kMyKey = @"aKey" vs #define MYKEY @"aKey"
Thanks for the replies guys. I do prefer the #define method simply because it's less maintenance (only add to one header, instead of header + .m) Cheers, Memo. On 3 Apr 2009, at 23:44, Quincey Morris wrote: On Apr 3, 2009, at 15:15, Nate Weaver wrote: IIRC they're optimized to point to the same memory location (I wasn't sure, so I tested and confirmed). I usually do: NSString * const kConstantNameHere = @"foo"; That's what I've seen in Apple headers (with an extern at the beginning and no assignment in said headers, of course). Except that the reason for *that* is to have the names of the strings in the public API but to keep the content of the strings out of it, which is presumably not a consideration for the OP. I'd choose the #define version, and give the compiler elbow room to do its job of optimizing away duplicate literals -- and whatever else it can do, such as possibly putting string literals in read- only address space. But the difference (if any) between the two approaches is so minimal that personal preference is a fine criterion for deciding. :) ___ 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/memo%40memo.tv This email sent to m...@memo.tv ___ 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
NSString* kMyKey = @"aKey" vs #define MYKEY @"aKey"
I was wondering if there is much difference between: NSString* kMyKey = @"aKey"; // and then throughout the application: [myDictionary setObject:xxx forKey:kMyKey]; [myDictionary objectForKey: kMyKey]; vs #define MYKEY @"aKey" // and then throughout the application: [myDictionary setObject:xxx forKey: MYKEY]; [myDictionary objectForKey: MYKEY]; The docs say the strings created with the @ construct are created at compile time. Does that mean potentially if we use the define 50 times, there are 50 NSStrings with identical content created at compile time? Or does the compiler optimize that as well? ___ 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: user access privileges to plist in /library/preferences
On 1 Apr 2009, at 21:55, Greg Guerin wrote: Do you understand the Posix permissions and ownership concepts, as applied to files and dirs? If not, you need to learn those. Do you understand the Posix 'umask' concept and its default value? Again, you should learn that. Finally, you will need to provide non-nil attributes to createDirectoryAtPath: that specifies all-read, all-write, and all- search permissions on the created dir. If you don't, then the directory will not be writable to anyone except its owner (the user account that creates it), due to how the default umask value affects the created dirs initial permissions. Thanks, I'll look into it. Whenever you write the log-file, you may also need to specify all- write permissions. It may depend on how you write the file. I'm using -[NSDictionary writeToFile:atomically:] so I guess this isn't an option. But seeing as this file will not exist unless it was created by my app, and neither will the containing folder which I will create with full permissions, any file created in this folder will inherit the parents permissions? Cheers, Memo. ___ 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 practice for dealing with saving/loading preferences.
I have an iphone app that runs at 60fps. I have all of my settings (about 10-15) stored in an NSMutableDictionary. When changes are made from the UI, the relevant NSNumber in the dictionary is updated. My update loop (which runs at 60fps) reads the settings directly from the dictionary (once per frame). I now want to save/load these settings as well. I know how to use NSUserDefaults so my question isn't a syntax question but more which is the preferred mefthod. I see a number of options: - dont even use NSUserDefaults but just save the NSMutableDictionary directly with writeToFile:atomically: when the application exits (And read at startup) - write the dictionary to NSUserDefaults as a single entity [[NSUserDefaults standardUserDefaults] setObject:settingsDict forKey:"@MySettings"] when application exits (and create mutable copy at startup) - scrap my dictionary, and just use NSUserDefaults. When a setting is changed in the UI, immediately [[NSUserDefaults standardUserDefaults] setFloat:forKey:], and in the update loop read settings [[NSUserDefaults standardUserDefaults] floatForKey:@"setting1"]; Is there any one of these that is particularly recommended or advised against? Cheers, Memo. ___ 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: user access privileges to plist in /library/preferences
Hi Greg, actually /Users/Shared didn't work either. If I am logged in as admin it works, but if I am logged in as a normal user it doesn't. My code is: #define LOG_PATH_FOLDER @"/Users/Shared/Library/Preferences/" #define LOG_FILENAME@"MyLog.plist" #define LOG_PATH [LOG_PATH_FOLDER stringByAppendingPathComponent:LOG_FILENAME] NSFileManager *fileManager = [NSFileManager defaultManager]; if([fileManager fileExistsAtPath: LOG_PATH_FOLDER] == NO) { NSLog(@"creating folder %@", LOG_PATH_FOLDER); [fileManager createDirectoryAtPath: LOG_PATH_FOLDER attributes: nil]; } logInfo= [[NSMutableDictionary alloc] initWithContentsOfFile: LOG_PATH]; if(logInfo == nil) logInfo = [[NSMutableDictionary alloc] init]; On 30 Mar 2009, at 01:14, Memo Akten wrote: Hi Greg, /Users/Shared may work, I'll give that a shot thanks. On 27 Mar 2009, at 18:26, Greg Guerin wrote: I'd like the file to be user independent, so it should always read/ write to the same file whoever logs in (it actually collects stats of usage). Is there a better place to store the file? (has to be outside of / users) How can I overcome the privileges issue? If it's just collecting stats of usage, then why don't you use a public-readable file in each user's private-writable Library dir. Or store private-writable public-readable per-user plists in a public-writable dir like /Users/Shared. Or if /Users/Shared is unacceptable, then use another dir created for your app, or explain why /Users/Shared is unacceptable. If you can avoid having to use AEWP and elevated privileges, it will greatly simplify things and enhance security. Just because you *can* do something with AEWP doesn't mean you *should*. -- GG ___ 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/memo%40memo.tv This email sent to m...@memo.tv ___ 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/memo%40memo.tv This email sent to m...@memo.tv ___ 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: user access privileges to plist in /library/preferences
Hi Greg, /Users/Shared may work, I'll give that a shot thanks. On 27 Mar 2009, at 18:26, Greg Guerin wrote: I'd like the file to be user independent, so it should always read/ write to the same file whoever logs in (it actually collects stats of usage). Is there a better place to store the file? (has to be outside of / users) How can I overcome the privileges issue? If it's just collecting stats of usage, then why don't you use a public-readable file in each user's private-writable Library dir. Or store private-writable public-readable per-user plists in a public-writable dir like /Users/Shared. Or if /Users/Shared is unacceptable, then use another dir created for your app, or explain why /Users/Shared is unacceptable. If you can avoid having to use AEWP and elevated privileges, it will greatly simplify things and enhance security. Just because you *can* do something with AEWP doesn't mean you *should*. -- GG ___ 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/memo%40memo.tv This email sent to m...@memo.tv ___ 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: user access privileges to plist in /library/preferences
Thanks Jerry, thats perfect thanks. On Fri, 27 Mar 2009 10:58:10 -0700, Jerry Krinock wrote: > On 2009 Mar 27, at 10:44, wrote: > >> Hi, I'd like to load/save some global preferences of my app. I have >> it all >> as an NSMutableDictionary and I load/save it as a plist in >> /library/preferences. >> >> If the user logged in does not have admin rights obviously the file >> does >> not save. How can I overcome this problem programatically from my app? > > This is a fairly frequently-asked question which unfortunately has an > answer that will keep you busy for awhile... > > http://www.cocoabuilder.com/archive/message/cocoa/2009/2/14/230239 > > > ___ > > 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/memo%40memo.tv > > This email sent to m...@memo.tv ___ 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: user access privileges to plist in /library/preferences
Hi Sjors, thanks for the swift reply. I'd like the file to be user independent, so it should always read/write to the same file whoever logs in (it actually collects stats of usage). Is there a better place to store the file? (has to be outside of /users) How can I overcome the privileges issue? Cheers, Memo. On Fri, 27 Mar 2009 18:50:01 +0100, Sjors van Berkel wrote: > Hi, > > if you save the file in ~/library/preferences/ the user will have > access to the files because it is in the local user directory. > > Hope that helps, > > Sjors > > Op 27 mrt 2009, om 18:44 heeft het > volgende geschreven: > >> >> >> Hi, I'd like to load/save some global preferences of my app. I have >> it all >> as an NSMutableDictionary and I load/save it as a plist in >> /library/preferences. >> >> If the user logged in does not have admin rights obviously the file >> does >> not save. How can I overcome this problem programatically from my app? >> ___ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> Please do not post admin requests or moderator comments to the list. >> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >> >> Help/Unsubscribe/Update your Subscription: >> http://lists.apple.com/mailman/options/cocoa-dev/mailinglists%40sjorsvanberkel.nl >> >> This email sent to mailingli...@sjorsvanberkel.nl ___ 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
user access privileges to plist in /library/preferences
Hi, I'd like to load/save some global preferences of my app. I have it all as an NSMutableDictionary and I load/save it as a plist in /library/preferences. If the user logged in does not have admin rights obviously the file does not save. How can I overcome this problem programatically from my app? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Animation slow down
Resending this because my browser messed up the formatting, apologies Hi all. I had some previous questions about Core Animation, this is not related to that at all (so don't take the previously mentioned code and methods into consideration). I have a transparent window, in which I create a view, and a root layer, and from then on just create and manage sublayers directly (code for that below). My problem is when I first run the app, it's very smooth (looking like 60fps). But when I leave it running for a while (sometimes after a couple of minutes, sometimes after half an hour) it slows down, really really down (e.g. roughly 1fps). My setup is very simple: I am setting up a timer: [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(animateFired:) userInfo:nil repeats:YES]; animateFired does nothing other than applies simple random implicit animation to a couple of layers (rotation, position, scale etc). My CALayers are are drawn via delegates which load (in the delegate init) and display PDF content (in the drawLayer - code below). I can see from the console that the drawLayer is only being called once (during app init) as expected. I have no other code running and have no leaks (nothing is allocated after init methods, the only code that runs is the timer callback which simply sets layer properties). I cannot understand why this slow down is, and why sometimes it's after a couple minutes, and sometimes comes in a lot later. Also this does not happen on my dev machine, but 3 other machines I've tested on (which all have similar but slightly lower spec). I am about to install xcode on the other machines as well, but was wondering if I am missing anything (e.g. about window/view creation, other deep system issues I need to care about. )? Creating window and view: - (void)applicationDidFinishLaunching:(NSNotification*)aNotification { NSLog(@"applicationDidFinishLaunching"); [[TransparentWindow alloc] initWithContentRect:[[NSScreen mainScreen] visibleFrame]]; } -(id) initWithContentRect:(NSRect)windowRect { NSLog(@"TransparentWindow::initWithContentRect"); if(self = [super initWithContentRect:windowRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]) { [self setOpaque:NO]; [self setBackgroundColor:[NSColor clearColor]]; [self setMovableByWindowBackground:NO]; [self makeKeyAndOrderFront:nil]; [self setAcceptsMouseMovedEvents:YES]; [self setContentView:[[[NSView alloc] initWithFrame:NSMakeRect(0, 0, windowRect.size.width, windowRect.size.height)] autorelease]]; } NSLog(@"/TransparentWindow::initWithContentRect"); return self; } Creating root layer: NSSize windowSize = [[NSApplication sharedApplication] keyWindow].frame.size; rootView= [[[NSApplication sharedApplication] keyWindow] contentView]; rootView.wantsLayer = YES; CATransform3D sublayerTransform = CATransform3DMakeTranslation(windowSize.width/2, windowSize.height/2, 0); // offset (0, 0) to center of layer sublayerTransform.m34 = -.0003; // perspective. bigger is more rootView.layer.sublayerTransform= sublayerTransform; CALayer Delegate drawRect: -(void)drawLayer:(CALayer *)layer inContext:(CGContextRef)context { NSLog(@"PDFLayerDelegate::drawLayer %@", filename); CGAffineTransform m = CGPDFPageGetDrawingTransform(page, kCGPDFArtBox, CGContextGetClipBoundingBox(context), 0, NO); CGContextSaveGState(context); CGContextConcatCTM(context, m); CGContextClipToRect(context, CGPDFPageGetBoxRect(page, kCGPDFArtBox));// 4 CGContextDrawPDFPage(context, page); CGContextRestoreGState(context); } ___ 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
Core Animation slow down
Hi all. I had some previous questions about Core Animation, this is not related to that at all (so don't take the previously mentioned code and methods into consideration). I have a transparent window, in which I create a view, and a root layer, and from then on just create and manage sublayers directly (code for that below). My problem is when I first run the app, it's very smooth (looking like 60fps). But when I leave it running for a while (sometimes after a couple of minutes, sometimes after half an hour) it slows down, really really down (e.g. roughly 1fps). My setup is very simple: I am setting up a timer: [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(animateFired:) userInfo:nil repeats:YES]; animateFired does nothing other than applies simple random implicit animation to a couple of layers (rotation, position, scale etc).My CALayers are are drawn via delegates which load (in the delegate init) and display PDF content (in the drawLayer - code below).I can see from the console that the drawLayer is only being called once (during app init) as expected.I have no other code running and have no leaks (nothing is allocated after init methods, the only code that runs is the timer callback which simply sets layer properties). I cannot understand why this slow down is, and why sometimes it's after a couple minutes, and sometimes comes in a lot later. Also this does not happen on my dev machine, but 3 other machines I've tested on (which all have similar but slightly lower spec).I am about to install xcode on the other machines as well, but was wondering if I am missing anything (e.g. about window/view creation, other deep system issues I need to care about. )? window & view creation:- (void)applicationDidFinishLaunching:(NSNotification*)aNotification { NSLog(@"applicationDidFinishLaunching"); [[TransparentWindow alloc] initWithContentRect:[[NSScreen mainScreen] visibleFrame]];} -(id) initWithContentRect:(NSRect)windowRect { NSLog(@"TransparentWindow::initWithContentRect"); if(self = [super initWithContentRect:windowRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]) { [self setOpaque:NO]; [self setBackgroundColor:[NSColor clearColor]]; [self setMovableByWindowBackground:NO]; [self makeKeyAndOrderFront:nil]; [self setAcceptsMouseMovedEvents:YES]; [self setContentView:[[[NSView alloc] initWithFrame:NSMakeRect(0, 0, windowRect.size.width, windowRect.size.height)] autorelease]];} NSLog(@"/TransparentWindow::initWithContentRect"); return self;} Creating root layer:NSSize windowSize = [[NSApplication sharedApplication] keyWindow].frame.size;rootView= [[[NSApplication sharedApplication] keyWindow] contentView];rootView.wantsLayer = YES; CATransform3D sublayerTransform = CATransform3DMakeTranslation(windowSize.width/2, windowSize.height/2, 0); // offset (0, 0) to center of layersublayerTransform.m34 = -.0003;// perspective. bigger is morerootView.layer.sublayerTransform= sublayerTransform; CALayer Delegate drawRect: -(void)drawLayer:(CALayer *)layer inContext:(CGContextRef)context { NSLog(@"PDFLayerDelegate::drawLayer %@", filename); CGAffineTransform m = CGPDFPageGetDrawingTransform(page, kCGPDFArtBox, CGContextGetClipBoundingBox(context), 0, NO); CGContextSaveGState(context); CGContextConcatCTM(context, m); CGContextClipToRect(context, CGPDFPageGetBoxRect(page, kCGPDFArtBox));// 4 CGContextDrawPDFPage(context, page); CGContextRestoreGState(context);} ___ 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: problems with CAAnimation - SOLVED (kinda)
lol, thank you very much! you couldn't help with the problem directly, but at least you put a smile on my face :) On 19 Mar 2009, at 23:39, mm w wrote: your design simply sucks, you don't understand the library I cannot help you on this, I am not Jesus and I cannot save all people who are pretending to program, once again I did complex design with CA related API, and I have never been stuck in this kind of issue, so I let you think, nobody can solve your issue you took the wrong way Cheers! On Thu, Mar 19, 2009 at 4:05 PM, Memo Akten wrote: Hi, I've used jQuery, but I don't understand the relevance or what you mean? On 19 Mar 2009, at 22:30, mm w wrote: you should really create a html page and play for instance with jQuery to understand how those mechanisms/API have been designed, and when you will understand what you are doing you will welcome to come again Cheers! On Thu, Mar 19, 2009 at 3:26 PM, Memo Akten wrote: Hi Matt, thanks for lengthy reply. At this point, I"ve only tried the first part, and I cannot get it to use the time I'm supplying in the animation, basically its just doing an implicit animation not explicit. It doesn't matter whether I setValue before or after the addAnimation. Actually I ended up writing the generic code below. If I apply the CAAnimationGroup as a group (i.e. bApplyIndividually = NO), then it doesn't work at all for some reason, the values from the layer.presentationLayer do not represent what I am seeing so a lot of snapping going on if I apply animations before the previous one is finished. If I only use the CAAnimationGroup as a glorified array and apply all animations individually then all my animations are applied correctly. So I think this is my solution. I do find it strange that I had to resort to this (writing my own AnimationGroup!), and this behavior is not built in. Thanks for all the tips and help. (P.S. this assumes that all the animations in the CAAnimationGroup are CABasicAnimations). void applyBasicAnimation(CALayer *layer, CABasicAnimation *animation, BOOL bApply) { animation.fromValue = [layer.presentationLayer valueForKeyPath:animation.keyPath]; animation.removedOnCompletion = NO; animation.fillMode = kCAFillModeBoth; NSLog(@"applyBasicAnimation forLayer:%@ key:%@ currentValue: %@", layer.name, animation.keyPath, animation.fromValue); if(bApply) [layer addAnimation:animation forKey:animation.keyPath]; } void applyAnimationGroup(CALayer *layer, CAAnimationGroup *animationGroup, NSString* key, BOOL bApplyIndividually) { animationGroup.removedOnCompletion = NO; animationGroup.fillMode = kCAFillModeBoth; for(id animation in animationGroup.animations) applyBasicAnimation(layer, animation, bApplyIndividually); if(!bApplyIndividually) [layer addAnimation:animationGroup forKey:key]; } On 19 Mar 2009, at 18:07, Matt Long wrote: I'll address the issue with the animation ignoring your duration first. Try placing your addAnimation call before the setValue:forKeyPath. Let me know if that works. Also, you will *need* to specify a fromValue in your animation. If you want the current value (in the case where an animation is already running), get it from the presentationLayer, e.g. [[layer presentationLayer] valueForKeyPath@"transform.scale"]; This is the "in-flight" value. Now let me try to clarify what I mean with the derived layer. Say you've declared a layer called RolloverLayer that inherits from CALayer. Calling animationForKey will return the default animation for the keyPath you specify in the key. If you override it, *you* determine what animation to use. It would look something like this: - (CAAnimation *)animationForKey:(NSString *)key { if ([key isEqualToString:@"transform.scale"] ) { CABasicAnimation *growAnimation = [[CABasicAnimation animationWithKeyPath:@"transform.scale"] retain]; growAnimation.duration = 5; // very slow // Need from value here growAnimation.fromValue = [[self presentationLayer] valueForKeyPath:@"transform.scale"]; growAnimation.toValue = [[[CardManager instance] config] objectForKey:@"cardHoverScale"]; growAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; return growAnimation; } else if ([key isEqualToString:@"position"]) { CABasicAnimation *postiionAnimation = [CABasicAnimation animationWithKeyPath:@"position"]; positionAnimation.fromValue = [[self presentationLayer] position]; positionAnimation.toValue = // etc... } // . else { return [super animationForKey:key]; } } Now, when yo
Re: problems with CAAnimation - SOLVED (kinda)
Hi, I've used jQuery, but I don't understand the relevance or what you mean? On 19 Mar 2009, at 22:30, mm w wrote: you should really create a html page and play for instance with jQuery to understand how those mechanisms/API have been designed, and when you will understand what you are doing you will welcome to come again Cheers! On Thu, Mar 19, 2009 at 3:26 PM, Memo Akten wrote: Hi Matt, thanks for lengthy reply. At this point, I"ve only tried the first part, and I cannot get it to use the time I'm supplying in the animation, basically its just doing an implicit animation not explicit. It doesn't matter whether I setValue before or after the addAnimation. Actually I ended up writing the generic code below. If I apply the CAAnimationGroup as a group (i.e. bApplyIndividually = NO), then it doesn't work at all for some reason, the values from the layer.presentationLayer do not represent what I am seeing so a lot of snapping going on if I apply animations before the previous one is finished. If I only use the CAAnimationGroup as a glorified array and apply all animations individually then all my animations are applied correctly. So I think this is my solution. I do find it strange that I had to resort to this (writing my own AnimationGroup!), and this behavior is not built in. Thanks for all the tips and help. (P.S. this assumes that all the animations in the CAAnimationGroup are CABasicAnimations). void applyBasicAnimation(CALayer *layer, CABasicAnimation *animation, BOOL bApply) { animation.fromValue = [layer.presentationLayer valueForKeyPath:animation.keyPath]; animation.removedOnCompletion = NO; animation.fillMode = kCAFillModeBoth; NSLog(@"applyBasicAnimation forLayer:%@ key:%@ currentValue: %@", layer.name, animation.keyPath, animation.fromValue); if(bApply) [layer addAnimation:animation forKey:animation.keyPath]; } void applyAnimationGroup(CALayer *layer, CAAnimationGroup *animationGroup, NSString* key, BOOL bApplyIndividually) { animationGroup.removedOnCompletion = NO; animationGroup.fillMode = kCAFillModeBoth; for(id animation in animationGroup.animations) applyBasicAnimation(layer, animation, bApplyIndividually); if(!bApplyIndividually) [layer addAnimation:animationGroup forKey:key]; } On 19 Mar 2009, at 18:07, Matt Long wrote: I'll address the issue with the animation ignoring your duration first. Try placing your addAnimation call before the setValue:forKeyPath. Let me know if that works. Also, you will *need* to specify a fromValue in your animation. If you want the current value (in the case where an animation is already running), get it from the presentationLayer, e.g. [[layer presentationLayer] valueForKeyPath@"transform.scale"]; This is the "in-flight" value. Now let me try to clarify what I mean with the derived layer. Say you've declared a layer called RolloverLayer that inherits from CALayer. Calling animationForKey will return the default animation for the keyPath you specify in the key. If you override it, *you* determine what animation to use. It would look something like this: - (CAAnimation *)animationForKey:(NSString *)key { if ([key isEqualToString:@"transform.scale"] ) { CABasicAnimation *growAnimation = [[CABasicAnimation animationWithKeyPath:@"transform.scale"] retain]; growAnimation.duration = 5; // very slow // Need from value here growAnimation.fromValue = [[self presentationLayer] valueForKeyPath:@"transform.scale"]; growAnimation.toValue = [[[CardManager instance] config] objectForKey:@"cardHoverScale"]; growAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; return growAnimation; } else if ([key isEqualToString:@"position"]) { CABasicAnimation *postiionAnimation = [CABasicAnimation animationWithKeyPath:@"position"]; positionAnimation.fromValue = [[self presentationLayer] position]; positionAnimation.toValue = // etc... } // . else { return [super animationForKey:key]; } } Now, when you have one of your derived layers in use, you can do this: // Assuming it's tied to a button or something - (IBAction)animate:(id)sender { // rolloverLayer is a RolloverLayer ivar [rolloverLayer setValue:[[[CardManager instance] config] objectForKey:@"cardHoverScale"] forKeyPath:@"transform.scale"]; [rolloverLayer setPosition:CGPointMake(x,y)]; // etc. } Your overridden animationForKey will get called to get the proper animation. HTH, -Matt p.s. if you want to know when an animation has completed, set
Re: problems with CAAnimation - SOLVED (kinda)
Hi Matt, thanks for lengthy reply. At this point, I"ve only tried the first part, and I cannot get it to use the time I'm supplying in the animation, basically its just doing an implicit animation not explicit. It doesn't matter whether I setValue before or after the addAnimation. Actually I ended up writing the generic code below. If I apply the CAAnimationGroup as a group (i.e. bApplyIndividually = NO), then it doesn't work at all for some reason, the values from the layer.presentationLayer do not represent what I am seeing so a lot of snapping going on if I apply animations before the previous one is finished. If I only use the CAAnimationGroup as a glorified array and apply all animations individually then all my animations are applied correctly. So I think this is my solution. I do find it strange that I had to resort to this (writing my own AnimationGroup!), and this behavior is not built in. Thanks for all the tips and help. (P.S. this assumes that all the animations in the CAAnimationGroup are CABasicAnimations). void applyBasicAnimation(CALayer *layer, CABasicAnimation *animation, BOOL bApply) { animation.fromValue = [layer.presentationLayer valueForKeyPath:animation.keyPath]; animation.removedOnCompletion = NO; animation.fillMode = kCAFillModeBoth; NSLog(@"applyBasicAnimation forLayer:%@ key:%@ currentValue:%@", layer.name, animation.keyPath, animation.fromValue); if(bApply) [layer addAnimation:animation forKey:animation.keyPath]; } void applyAnimationGroup(CALayer *layer, CAAnimationGroup *animationGroup, NSString* key, BOOL bApplyIndividually) { animationGroup.removedOnCompletion = NO; animationGroup.fillMode = kCAFillModeBoth; for(id animation in animationGroup.animations) applyBasicAnimation(layer, animation, bApplyIndividually); if(!bApplyIndividually) [layer addAnimation:animationGroup forKey:key]; } On 19 Mar 2009, at 18:07, Matt Long wrote: I'll address the issue with the animation ignoring your duration first. Try placing your addAnimation call before the setValue:forKeyPath. Let me know if that works. Also, you will *need* to specify a fromValue in your animation. If you want the current value (in the case where an animation is already running), get it from the presentationLayer, e.g. [[layer presentationLayer] valueForKeyPath@"transform.scale"]; This is the "in-flight" value. Now let me try to clarify what I mean with the derived layer. Say you've declared a layer called RolloverLayer that inherits from CALayer. Calling animationForKey will return the default animation for the keyPath you specify in the key. If you override it, *you* determine what animation to use. It would look something like this: - (CAAnimation *)animationForKey:(NSString *)key { if ([key isEqualToString:@"transform.scale"] ) { CABasicAnimation *growAnimation = [[CABasicAnimation animationWithKeyPath:@"transform.scale"] retain]; growAnimation.duration = 5; // very slow // Need from value here growAnimation.fromValue = [[self presentationLayer] valueForKeyPath:@"transform.scale"]; growAnimation.toValue = [[[CardManager instance] config] objectForKey:@"cardHoverScale"]; growAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; return growAnimation; } else if ([key isEqualToString:@"position"]) { CABasicAnimation *postiionAnimation = [CABasicAnimation animationWithKeyPath:@"position"]; positionAnimation.fromValue = [[self presentationLayer] position]; positionAnimation.toValue = // etc... } // . else { return [super animationForKey:key]; } } Now, when you have one of your derived layers in use, you can do this: // Assuming it's tied to a button or something - (IBAction)animate:(id)sender { // rolloverLayer is a RolloverLayer ivar [rolloverLayer setValue:[[[CardManager instance] config] objectForKey:@"cardHoverScale"] forKeyPath:@"transform.scale"]; [rolloverLayer setPosition:CGPointMake(x,y)]; // etc. } Your overridden animationForKey will get called to get the proper animation. HTH, -Matt p.s. if you want to know when an animation has completed, set the layer's delegate to your app delegate and then implement - (void)animationDidStop:(CAAnimation *)theAnimation finished: (BOOL)flag . The flag field tells you whether or not it stopped by interruption or by run completion. YES means it completed its run, NO means it was interrupted. On Mar 19, 2009, at 11:09 AM, Memo Akten wrote: Hi Matt, yea it is a bit complex, but it seems t
Re: problems with CAAnimation
Hi Matt, yea it is a bit complex, but it seems to me that what I am trying to do is actually quite simple: - when I rollover a layer, it animates position, scale, rotation and alpha. - when I rollout, it animates back. - if I rollover, then midanimation, rollout again, it should animate back to original position *from where it was at the moment I rolled out*, NOT snapping to the hover position (which is why I can't use FromValues). I also would like the animation to be EaseInEaseOut and know when the animation is complete - which is why I'm using CAAnimation, so I can use delegate - instead of using implicit animation. Going back to what you were saying, I'm afraid I don't full understand. So I extend CALayer? How would I use animationForKey? Does that not only return the animation for a given arbitrary key? Also I tried the code below, and unfortunately the animation happened very quickly, not 5 seconds at all... growAnimation = [[CABasicAnimation animationWithKeyPath:@"transform.scale"] retain]; growAnimation.duration = 5; // very slow growAnimation.toValue = [[[CardManager instance] config] objectForKey:@"cardHoverScale"]; growAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; [rootLayer setValue:[[[CardManager instance] config] objectForKey:@"cardHoverScale"] forKeyPath:@"transform.scale"]; [rootLayer addAnimation:growAnimation forKey:@"transform.scale"]; On 19 Mar 2009, at 17:01, Matt Long wrote: Ok. You've just raised the bar! ;-) Seems that you would have to specify the key path you're wanting for each animation which leads me to think you won't be able to use grouping as you envision as setAnimations on the CAAnimationGroup only takes an array rather than a dictionary in which you could specify keypaths. In all likelihood you'll have to use - (CAAnimation *)animationForKey:(NSString *)key in a derived layer. Then you can specify the animation you want for all keys you're interested in. In answer to your last question, yes you will need to set the values of all of the properties you're looking to animate, but if you create a derived layer as I suggested and override animationForKey, whenever those keypaths are changed, it will use the animation you've specified so all you'll have to do is call setValue:forKeyPath on the derived layer and it will use the correct animation. Does that make sense? -Matt On Mar 19, 2009, at 9:47 AM, Memo Akten wrote: Hi Matt, thanks for the answer and yes you are right on both fronts: - if I use fillMode and removeOnCompletion then it is visibly sticky, BUT when I apply another animation (e.g. shrinkAnimation which scales To:1, without setting a From value) then it snaps straight back to 1, probably because internally the scale is still 1. If I set the From value for my shrinkAnimation, then it works, BUT if I quickly trigger grow followed by shrink, it first snaps upto the full hover scale, and then animates down - which makes sense given the code, but is not the desired behaviour. Ideally both my grow and shrink animations should not have a From value, as I want them to simply animate To a specific target from where it was at the time of animation being triggered - Manually setting rootLayer setValue: forKeyPeth:@"transform.scale" does work perfectly. However this was a simplified example, and actually I have quite a few CAAnimationGroups, each with about 4-5 CABasicAnimations (scale, position, rotation, alpha etc.). So do I really have to set the To Value for every property manually before adding an animation group? And what key should I give the animation group when adding? Cheers, Memo. ___ 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: problems with CAAnimation
Hi Matt, thanks for the answer and yes you are right on both fronts: - if I use fillMode and removeOnCompletion then it is visibly sticky, BUT when I apply another animation (e.g. shrinkAnimation which scales To:1, without setting a From value) then it snaps straight back to 1, probably because internally the scale is still 1. If I set the From value for my shrinkAnimation, then it works, BUT if I quickly trigger grow followed by shrink, it first snaps upto the full hover scale, and then animates down - which makes sense given the code, but is not the desired behaviour. Ideally both my grow and shrink animations should not have a From value, as I want them to simply animate To a specific target from where it was at the time of animation being triggered - Manually setting rootLayer setValue: forKeyPeth:@"transform.scale" does work perfectly. However this was a simplified example, and actually I have quite a few CAAnimationGroups, each with about 4-5 CABasicAnimations (scale, position, rotation, alpha etc.). So do I really have to set the To Value for every property manually before adding an animation group? And what key should I give the animation group when adding? Cheers, Memo. On 19 Mar 2009, at 15:31, Matt Long wrote: Your layer's transform.scale knows nothing of the toValue in the animation. You have to explicitly set it in the layer in addition to animating it. This also means that you need to add the animation using the correct keypath otherwise it will use the default animation instead of yours. Change your code to do this: [rootLayer setValue:[[[CardManager instance] config] objectForKey:@"cardHoverScale"] forKeyPath:@"transform.scale"]; [rootLayer addAnimation:growAnimation forKey:@"transform.scale"]; Notice I've specified a keypath in the addAnimation: call. I haven't actually tested this, by the way, but the basic idea is that you have to set the value in the layer in order for it to stick. And you have to specify the correct keypath or it won't use your animation when it runs. There is another way to make it sticky without actually changing the layer's value. You explicitly set these two fields on the animation: [growAnimation setFillMode:kCAFillModeForwards]; [growAnimation setRemovedOnCompletion:NO]; This will not cause the value in the layer to change, however, it will give you the visible stickiness you seek. Best Regards. -Matt On Mar 19, 2009, at 9:13 AM, Memo Akten wrote: Hi, I posted this on the quartz list yesterday but received no response, it seems like such a simple thing... When I add an animation to my layer, it animates, but then snaps back to its previous position. Is this normal? growAnimation = [[CABasicAnimation animationWithKeyPath:@"transform.scale"] retain]; growAnimation.duration = 0.25; growAnimation.fromValue = [NSNumber numberWithFloat:1.0f]; growAnimation.toValue = [[[CardManager instance] config] objectForKey:@"cardHoverScale"]; growAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; [rootLayer addAnimation:growAnimation forKey:nil]; ___ 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
problems with CAAnimation
Hi, I posted this on the quartz list yesterday but received no response, it seems like such a simple thing... When I add an animation to my layer, it animates, but then snaps back to its previous position. Is this normal? growAnimation = [[CABasicAnimation animationWithKeyPath:@"transform.scale"] retain]; growAnimation.duration = 0.25; growAnimation.fromValue = [NSNumber numberWithFloat:1.0f]; growAnimation.toValue = [[[CardManager instance] config] objectForKey:@"cardHoverScale"]; growAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; [rootLayer addAnimation:growAnimation forKey:nil]; ___ 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
Distribute font with app bundle
Hi All, I'd like to distribute a font with my app bundle, but not install it. Just load it straight from my bundle for NSTextField and CATextLayer. My googling led to only this http://www.cocoabuilder.com/archive/message/cocoa/2005/1/16/125883 but that is 4 years old, I was wondering if there is a new suggested way? or anything I should look out for? Cheers, Memo. ___ 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: why can't I see my layer?
for others reading this on the archives, I found the problem, I need to set the bounds (or frame) for titleLayer. On 13 Mar 2009, at 12:09, Memo Akten wrote: I have a simple setup below, but I can't see my text layer, what am I missing? (also are all of the commented lines nessecary?) view= [[[NSApplication sharedApplication] keyWindow] contentView]; rootLayer = [CALayer layer]; [rootLayer setBounds: NSRectToCGRect(view.bounds)]; // is this necessary? [rootLayer setMasksToBounds:NO]; // or could I omit the line above and just do this? [rootLayer setPosition:CGPointMake(0, 0)]; // i guess this is not needed? CATextLayer *titleLayer = [CATextLayer layer]; titleLayer.string = @"testing this"; titleLayer.font = [NSFont fontWithName:@"Myriad Set" size:20]; titleLayer.foregroundColor = CGColorCreateGenericRGB(.2, .3, .9, 1.0); [rootLayer addSublayer:titleLayer]; [view setLayer:rootLayer]; [view setWantsLayer:YES]; [view setNeedsDisplay:YES]; // is this necessary? [rootLayer setNeedsDisplay]; // is this necessary? instead of adding titleLayer to rootLayer, if I directly do view.layer = titleLayer I can see it (so nothing wrong with titleLayer), but obviously then I can't add more stuff, I need to add stuff to the root... Cheers, Memo. ___ 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/memo%40memo.tv This email sent to m...@memo.tv ___ 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
why can't I see my layer?
I have a simple setup below, but I can't see my text layer, what am I missing? (also are all of the commented lines nessecary?) view= [[[NSApplication sharedApplication] keyWindow] contentView]; rootLayer = [CALayer layer]; [rootLayer setBounds: NSRectToCGRect(view.bounds)]; // is this necessary? [rootLayer setMasksToBounds:NO]; // or could I omit the line above and just do this? [rootLayer setPosition:CGPointMake(0, 0)]; // i guess this is not needed? CATextLayer *titleLayer = [CATextLayer layer]; titleLayer.string = @"testing this"; titleLayer.font = [NSFont fontWithName:@"Myriad Set" size:20]; titleLayer.foregroundColor = CGColorCreateGenericRGB(.2, .3, .9, 1.0); [rootLayer addSublayer:titleLayer]; [view setLayer:rootLayer]; [view setWantsLayer:YES]; [view setNeedsDisplay:YES]; // is this necessary? [rootLayer setNeedsDisplay]; // is this necessary? instead of adding titleLayer to rootLayer, if I directly do view.layer = titleLayer I can see it (so nothing wrong with titleLayer), but obviously then I can't add more stuff, I need to add stuff to the root... Cheers, Memo. ___ 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: problems with NSTextField destroying background
that solved it thanks! On 11 Mar 2009, at 19:25, Joel Norvell wrote: Hi Memo, Try doing setDrawsBackground:NO when you initialize your NSTextFields. HTH, Joel ___ 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
problems with NSTextField destroying background
Hi All, I am creating everything programatically: one custom NSWindow -> one NSView (my root view), that has multiple custom NSViews attached, in each one is an NSBox and NSTextField. My problem is, I want the NSTextField to be transparent (and show the NSBox behind), but instead it's making a hole in the NSBox to show the desktop, what am I missing? window and root view code: -(id) initWithContentRect:(NSRect)windowRect { NSLog(@"TransparentWindow::initWithContentRect"); if(self = [super initWithContentRect:windowRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]) { [self setOpaque:NO]; [self setBackgroundColor:[NSColor clearColor]]; [self setMovableByWindowBackground:NO]; [self makeKeyAndOrderFront:nil]; NSView *rootView = [[NSView alloc] initWithFrame:windowRect]; [self setContentView:rootView]; [rootView release]; controller = [[Controller alloc] initWithView:rootView]; } NSLog(@"/TransparentWindow::initWithContentRect"); return self; } Controller is just a custom NSObject which managers my data, and it creates a bunch of CustomViews: - (id)initWithFrame:(NSRect)frame andData:(Data*)c { NSLog(@"CustomView::initWithFrame"); self = [super initWithFrame:frame]; if (self) { data = c; NSRect myRect = NSMakeRect(0.0, 0.0, frame.size.width, frame.size.height); NSBox *bgView = [[[NSBox alloc] initWithFrame:myRect] autorelease]; [bgView setBoxType:NSBoxCustom]; [bgView setBorderType:NSLineBorder]; [bgView setTitlePosition:NSNoTitle]; [bgView setFillColor:[NSColor grayColor]]; [self addSubview:bgView]; NSTextField *label = [[[NSTextField alloc] initWithFrame:NSMakeRect(0.0, frame.size.height/2, frame.size.width, TITLE_SIZE * 2)] autorelease]; [label setEnabled:NO]; [label setSelectable:NO]; [label setBackgroundColor:[NSColor clearColor]]; [label setTextColor:[NSColor colorWithDeviceRed:TITLE_COLOR green:TITLE_COLOR blue:TITLE_COLOR alpha:1]]; [label setTitleWithMnemonic:@"testing"]; [label setAlignment:NSCenterTextAlignment]; [label setFont:[NSFont fontWithName:@"Myriad Set" size:TITLE_SIZE]]; [label setBordered:NO]; [self addSubview:label]; } NSLog(@"/CustomView::initWithFrame"); return self; } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: do i need to create autorelease pool?
Hi Guys, thanks for the detailed responses :) Peter, thanks for that example, I should have thought of doing a similar test myself, but I didn't, so thanks for doing that, always the best way to be sure ;) Michael, so does this mean that CFRunLoopTimer and NSTimer don't behave the same way? I always assumed 'toll-free bridged' meant that you could use them interchangeably, the NSxxx were just Cocoa wrappers for the CF stuff, but it seems behavior is not the same... And just to re-iterate, I do not need to create an autorelease pool around my timerFired callback, it will get drained at the end of every run... Cheers, Memo. On 26 Feb 2009, at 04:50, Michael Ash wrote: On Wed, Feb 25, 2009 at 8:45 PM, Peter N Lewis wrote: OK, I will certainly defer to Michael's deeper knowledge on this stuff, Oh no, don't do that but I thought Leopard plugged most of the normal case holes for requiring an auto release pool, so I wrote up this test case: #import "AppDelegate.h" @interface BogusObject : NSObject { } @end @implementation BogusObject - (id) init; { self = [super init]; if (self != nil) { NSLog( @"BogusObject init" ); } return self; } - (void) dealloc; { NSLog( @"BogusObject dealloc" ); [super dealloc]; } @end @implementation AppDelegate - (void) timerFired:(NSTimer*)theTimer; { NSLog( @"timerFired" ); [[[BogusObject alloc] init] autorelease]; } - (void) applicationDidFinishLaunching:(NSNotification *)aNotification; { NSLog( @"applicationDidFinishLaunching" ); [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timerFired:) userInfo:nil repeats:YES]; } @end With the app sitting in the background doing nothing, I get the same results whether timerFired uses "release" or "autorelease", ie every second all three messages are printed: 2009-02-26 10:38:43.440 CheckTimer[82997:10b] timerFired 2009-02-26 10:38:43.441 CheckTimer[82997:10b] BogusObject init 2009-02-26 10:38:43.441 CheckTimer[82997:10b] BogusObject dealloc For good measure, I tried this on Tiger, and got the same results, so now I'm just left wondering where my confusion lies. Well, obviously NSTimers *don't* suffer from this problem, and didn't on Tiger either, and perhaps not ever. Clearly I was mistaken there! You can reproduce the behavior I described if you use a CFRunLoopTimer instead of an NSTimer. Replace your AppDelegate code with this: static void Callback(CFRunLoopTimerRef timer, void *info) { NSLog( @"test fired" ); [[[BogusObject alloc] init] autorelease]; } - (void) applicationDidFinishLaunching:(NSNotification *)aNotification; { NSLog( @"applicationDidFinishLaunching" ); CFRunLoopTimerRef timer = CFRunLoopTimerCreate(NULL, 0, 1, 0, 0, Callback, NULL); CFRunLoopAddTimer(CFRunLoopGetCurrent(), timer, kCFRunLoopCommonModes); CFRelease(timer); } As long as the app sits idle, you'll see only allocation. Once you push an event to it, for example by clicking the mouse, all the queued up objects get destroyed. So it can indeed happen relatively easily as I described, but clearly I was confused as to where it can happen, and the OP will have absolutely no trouble with his code and doesn't need to make his own pools. 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/memo%40memo.tv This email sent to m...@memo.tv ___ 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: do i need to create autorelease pool?
Ah ok, thats what I wasn't sure about, whether or not the pool would be released after every timer update. So if no events come in for a few seconds, I"ll have my runloops autorelease pool swelling up - which is not desired. My solution of creating my own autorelease pool before all app update+draw works, but is there a convention for the handling of this situation? Create my own autorelease pool vs. posting a fake event? For readability sake I guess creating a second pool makes more sense? On 25 Feb 2009, at 16:44, Michael Ash wrote: On Wed, Feb 25, 2009 at 12:00 AM, Peter N Lewis > wrote: The Application Kit creates an autorelease pool on the main thread at the beginning of every cycle of the event loop, and drains it at the end, thereby releasing any autoreleased objects generated while processing an event. This is assuming iPhone or Leopard, I believe the NSAutoreleasePool creation was required for older versions of Mac OS X. The semantics haven't changed on Leopard as far as I know. The above has been the case forever: pools are created and destroyed on *events*, but not timers. If you simply run a timer forever and never process events, your memory usage will grow without limit. A pool exists, so you don't explicitly leak, but the pool is only drained when an event arrives. If you're going to be running something in timers or other non-event sources, you'll want to post a fake event to the main event loop from time to time (or just after every action you take) to force the pool to drain. I have *no* idea how much of that, if any, applies to the iPhone. In any case if you're processing events on a regular basis as well then you don't have to worry about anything. 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/memo%40memo.tv This email sent to m...@memo.tv ___ 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
do i need to create autorelease pool?
I know what autorelease pools are and how they work so my question isn't about that. In my iPhone app I create a NSTimer to run at 60fps, in it I update a bunch of stuff and draw opengl. Currently I have: -(void) timerLoop { // create autorelease pool in case anything needs it NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; // release pool [pool release]; } Do I need this autorelease pool here or does UIApplicationMain manage that for every call of timerLoop? ___ 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: performance of UIControls
Yea that is exactly how I have it currently as I described in my mail. But to maintain that has unnecessarily extra steps. My Controller extends my own custom controller class (which extends UIViewController) which adds the common functionality I require to the types of apps I'm building. But there is no way my view (which contains x amount of sliders, labels, and switches specific to the application laid out manually the way I want them to look) and model (parameters very specific to this application) are reusable. Which is why my question was about the performance of reading from the controls directly. On 20 Feb 2009, at 03:30, Michael Ash wrote: Your model should not be talking directly to your view. Instead, your controller should set properties on the model when the UI changes, and then the model can use its own properties directly. ___ 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
performance of UIControls
Hi All, I have a UI with a lot of UISliders and UISwitches. For every single one I have an IBAction which updates an internal variable, I also have a pointer to every control in my controller so if a variable is updated programmatically it's updated in the UI. In my game's update loop I check those variables and act accordingly. I'm wondering if this is the best way to do this? I thought I could have one IBAction to handle all UIControls and just give them all different tags and have my parameters in an array etc, but still its a bit of a pain. There is a lot of variables, and every time I want to add a new parameter I need to: - add a pointer to the control in the controller - add an IBAction callback and set my internal variable - add the control to a updateUI function which simply writes all variables to the controls to update the UI - add the control to a readUI function which simply calls the callback for all of the controls to update the vars. but I was wondering if I could just directly use the controls in my update loop? I would only use them once per update loop (for loops etc. I would cache the value first if need be). E.g. if (mySwitch.on) or velocity = velSlider.value? Or will this be slow? Is there a preferred method for these situations? Memo (Mehmet S. Akten) www.memo.tv www.twitter.com/memotv www.vimeo.com/memotv ___ 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: iphone landscape problems
I've identified the problem for the first scenario (view appearing portrait then rotating). I have a function [MyViewController show] and [MyViewController hide] which transition the view in and out: [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:ANIMATION_TIME]; [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:window cache:YES]; [UIView setAnimationCurve: ANIMATION_CURVE]; [self viewWillAppear:YES]; [window addSubview:self.view]; [self viewDidAppear:YES]; [UIView commitAnimations]; I wasn't adding the view directly but was doing a transition. So instead of appearing with a transition directly in landscape it was transitioning in portrait, then rotating into landscape. After that when i trigger the show / hide it transitions in correctly in landscape. I guess this is a bug? I found two workarounds, I can either not transition it in when it first appears. Or create another viewcontroller with an empty view, add that to the window, and then add the animated view controller to that. It seems a bit unnessecary as there is an empty view on top of the window which contains my main view. Memo (Mehmet S. Akten) www.memo.tv www.twitter.com/memotv www.vimeo.com/memotv On 18 Feb 2009, at 19:46, Memo Akten wrote: Hi Thanks for the response. I was building for 2.2. I am now trying for 2.2.1 and getting the exact same behavior. Regarding the 2nd point, if I use UIActionSheet it works correctly, but UIAlertView does not orient. A bit of info about my setup. - I create window manually in applicationDidFinishLaunching - I create a EAGLView (based on the apple sample) and attach that directly to window - I have a rootViewController and a bunch of other controllers and views which get attached to the rootViewController. And I attach the rootViewController.view to window - the rootViewController returns YES for only landscape orientations - so there are 2 views in my window. glView, and rootViewController on top. The latter is only visible when menu is activated. Could this be why I'm having the problem? Should I set it up differently ? Memo (Mehmet S. Akten) www.memo.tv www.twitter.com/memotv www.vimeo.com/memotv On 18 Feb 2009, at 19:25, Robert Marini wrote: In my applicationDidFinishLaunching I have: [[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeRight animated:NO]; Out of curiosity, what version of iPhone OS are you building for? If you're using 2.1 and later, it should just work. If not, you'll need to do something like this as well (I typed this in Mail so there may be blood...err...typos). CGAffineTransform transform = self.view.transform CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame]; CGRect bounds = CGRectMake(0, 0, statusBarFrame.size.height, statusBarFrame.origin.x); CGPoint centerPoint = CGPointMake(bounds.size.height / 2.0, bounds.size.width / 2.0); self.view.center = centerPoint; transform = CGAffineTransformRotate (transform, (M_PI / 2.0)); self.view.transform = transform. and then... [window makeKeyAndVisible]; (otherwise the window will show and then rotate in a rather harsh fasion that the user would see) 2. when i create and show a UIAlertView it appears in portrait, even if I am holding my iphone in landscape and the views are in landscape. Is there no way to fix this? If you've set your status bar orientation in applicationDidFinishLaunching and your view controllers are properly set up (overriding shouldAutorotateToInterfaceOrientation, etc) this should behave normally. If you could build for 2.2.1 and have verified that this is the case, please file a bug report. In the meantime one possible workaround is to rotate the view after it's been displayed in didPresentAlertView (though I've not heard of this since the 2.0 betas so I would double check my view controller related code). -rob. ___ 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/memo%40memo.tv This email sent to m...@memo.tv ___ 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/memo%40memo.tv This email sent to m...@memo.tv ___ 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 c
Re: iphone landscape problems
Hi Thanks for the response. I was building for 2.2. I am now trying for 2.2.1 and getting the exact same behavior. Regarding the 2nd point, if I use UIActionSheet it works correctly, but UIAlertView does not orient. A bit of info about my setup. - I create window manually in applicationDidFinishLaunching - I create a EAGLView (based on the apple sample) and attach that directly to window - I have a rootViewController and a bunch of other controllers and views which get attached to the rootViewController. And I attach the rootViewController.view to window - the rootViewController returns YES for only landscape orientations - so there are 2 views in my window. glView, and rootViewController on top. The latter is only visible when menu is activated. Could this be why I'm having the problem? Should I set it up differently ? Memo (Mehmet S. Akten) www.memo.tv www.twitter.com/memotv www.vimeo.com/memotv On 18 Feb 2009, at 19:25, Robert Marini wrote: In my applicationDidFinishLaunching I have: [[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeRight animated:NO]; Out of curiosity, what version of iPhone OS are you building for? If you're using 2.1 and later, it should just work. If not, you'll need to do something like this as well (I typed this in Mail so there may be blood...err...typos). CGAffineTransform transform = self.view.transform CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame]; CGRect bounds = CGRectMake(0, 0, statusBarFrame.size.height, statusBarFrame.origin.x); CGPoint centerPoint = CGPointMake(bounds.size.height / 2.0, bounds.size.width / 2.0); self.view.center = centerPoint; transform = CGAffineTransformRotate (transform, (M_PI / 2.0)); self.view.transform = transform. and then... [window makeKeyAndVisible]; (otherwise the window will show and then rotate in a rather harsh fasion that the user would see) 2. when i create and show a UIAlertView it appears in portrait, even if I am holding my iphone in landscape and the views are in landscape. Is there no way to fix this? If you've set your status bar orientation in applicationDidFinishLaunching and your view controllers are properly set up (overriding shouldAutorotateToInterfaceOrientation, etc) this should behave normally. If you could build for 2.2.1 and have verified that this is the case, please file a bug report. In the meantime one possible workaround is to rotate the view after it's been displayed in didPresentAlertView (though I've not heard of this since the 2.0 betas so I would double check my view controller related code). -rob. ___ 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/memo%40memo.tv This email sent to m...@memo.tv ___ 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
iphone landscape problems
Hi All, i have two problems regarding running my app in landscape mode: 1. I would like my app to to start in landscape mode. In my root viewcontroller I have: - (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight); } In my info.plist I have: UIInterfaceOrientation UIInterfaceOrientationLandscapeRight In my applicationDidFinishLaunching I have: [[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeRight animated:NO]; In IB my view is laid out in landscape. but still when I launch my app it starts in portrait and slides to landscape! Why does it not start directly in landscape? 2. when i create and show a UIAlertView it appears in portrait, even if I am holding my iphone in landscape and the views are in landscape. Is there no way to fix this? cheers, Memo (Mehmet S. Akten) www.memo.tv www.twitter.com/memotv www.vimeo.com/memotv ___ 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 do precise timing on iphone?
Thanks, I just couldn't find the framework for AbsoluteToNanoseconds(), but found the code below which seems to work fine. http://shiftedbits.org/2008/10/01/mach_absolute_time-on-the-iphone/ thx bout the devforums btw... On 5 Feb 2009, at 12:14, Phil wrote: On Fri, Feb 6, 2009 at 1:06 AM, Memo Akten wrote: Hi ALl, i'm aware that on desktop using mach_absolute_time() is the way to go for precise timing of code (http://developer.apple.com/qa/qa2004/qa1398.html) but I was wondering what is the alternative for iphone? not sure if this is the right place to post, but I"d gladly repost if someone could point me to the right place. I'm guessing NSDate isn't going to be that accurate for this kind of stuff... You can use mach_absolute_time() on the iPhone. Future questions about iPhone development should be directed to the developer forums though: <https://devforums.apple.com/> Phil ___ 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 do precise timing on iphone?
Hi ALl, i'm aware that on desktop using mach_absolute_time() is the way to go for precise timing of code (http://developer.apple.com/qa/qa2004/qa1398.html ) but I was wondering what is the alternative for iphone? not sure if this is the right place to post, but I"d gladly repost if someone could point me to the right place. I'm guessing NSDate isn't going to be that accurate for this kind of stuff... ___ 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: problems resetting timer interval.
Hi Ron, thanks for the reply. Turns out I had an error somewhere else, my code works fine now :P Cheers, Memo. Re: problems resetting timer interval. Ron Fleckner Thu, 29 Jan 2009 16:02:14 -0800 I basically do the same and it works for me, but there are some slight differences. Translating my setup into your terminology, I have an ivar float frameRate; It has accessors - (float)frameRate and - (void)setFrameRate:(float)newRate; Then in my IBAction method which the user calls via the GUI, I set the new frameRate and call a -stopTimer method which invalidates the timer, then still in the IBAction method call a startTimer method which simply does what your "timer = [NSTimer scheduledTimer... ] method does. Perhaps breaking out the parts like that helps? I don't know. HTH, Ron On 29 Jan 2009, at 22:07, Memo Akten wrote: Hi All, I'd like a function that sets up a timer, and can also change the frequency, but I just can't get it to work. If I call it more than once it just stops calling the timerLoop function altogether. I've tried so many things including not actually scheduling the timer in the setFrameRate function, but just saving the desired frameRate and setting a flag to notify that its changed, and in the next frame changing the time. I"ve tried not using the conveniance method but manually allocing the timer and adding to the current runloop, and releasing the old one before allocing the new one. But always same problem. First call to the function works, second and more calls don't. What am I doing wrong? The function in its simplest form is below. How can I achieve what I want? -(void) setFrameRate:(float)frameRate { [timer invalidate]; timer = [NSTimer scheduledTimerWithTimeInterval:(1.0f / frameRate) target:self selector:@selector(timerLoop) userInfo:nil repeats:YES]; } Cheers, Memo (Mehmet S. Akten) www.memo.tv www.twitter.com/memotv www.vimeo.com/memotv ___ 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
problems resetting timer interval.
Hi All, I'd like a function that sets up a timer, and can also change the frequency, but I just can't get it to work. If I call it more than once it just stops calling the timerLoop function altogether. I've tried so many things including not actually scheduling the timer in the setFrameRate function, but just saving the desired frameRate and setting a flag to notify that its changed, and in the next frame changing the time. I"ve tried not using the conveniance method but manually allocing the timer and adding to the current runloop, and releasing the old one before allocing the new one. But always same problem. First call to the function works, second and more calls don't. What am I doing wrong? The function in its simplest form is below. How can I achieve what I want? -(void) setFrameRate:(float)frameRate { [timer invalidate]; timer = [NSTimer scheduledTimerWithTimeInterval:(1.0f / frameRate) target:self selector:@selector(timerLoop) userInfo:nil repeats:YES]; } Cheers, Memo (Mehmet S. Akten) www.memo.tv www.twitter.com/memotv www.vimeo.com/memotv ___ 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: save screengrab on iphone
Hi, sorry I should have stated that its an opengl view. Searching the web, I think I have to manually use glReadPixels, which is fine. After getting the buffer I tried creating a UIImage using: [UIImage imageWithData:[NSData dataWithBytesNoCopy:...] But it doesn't work, I guess imageWithData is expecting image data (i.e. file format), not pixel data. How can I create a UIImage from pixel data? do I need to go into coregraphics? (e.g. CGCreateImage)? On 15 Jan 2009, at 16:45, Robert Marini wrote: Take a look at UIGraphicsGetImageFromCurrentImageContext() (or something like that, don't have the docs handy). -rob. On Jan 15, 2009, at 11:18 AM, Memo Akten wrote: wow i did not know that, brilliant thanks! is there a way to do it programmatically? i could not find it in the docs... On 15 Jan 2009, at 16:17, danton chin wrote: Memo, While in your iPhone app hold down the power off button then hit the home button. A picture of the current screen will be added to your photo album. On Thu, Jan 15, 2009 at 11:08 AM, Memo Akten wrote: Not sure if this is the right place for this, but is it possible for my app to screengrab what its done and save it to the photo app? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/roadwarriorone%40gmail.com This email sent to roadwarrior...@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/rob%40pinchmedia.com This email sent to r...@pinchmedia.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/memo%40memo.tv This email sent to m...@memo.tv ___ 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
detecting touches not from a view/window on iphone
Hi, what I'd like to be able to do in my iphone app, is detect touches on the window (or a view), from an object which is not a UIResponder. Ideally if touches sent notifications which could be registered via the notification center it would be ideal. I know I could add touchesBegan, touchesMoved etc. to all views or the window, and call the relevant functions in my object, but I'd prefer to set it without adding any code to the window or views, and observing purely from outside. Is this possible? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: save screengrab on iphone
wow i did not know that, brilliant thanks! is there a way to do it programmatically? i could not find it in the docs... On 15 Jan 2009, at 16:17, danton chin wrote: Memo, While in your iPhone app hold down the power off button then hit the home button. A picture of the current screen will be added to your photo album. On Thu, Jan 15, 2009 at 11:08 AM, Memo Akten wrote: Not sure if this is the right place for this, but is it possible for my app to screengrab what its done and save it to the photo app? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/roadwarriorone%40gmail.com This email sent to roadwarrior...@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
save screengrab on iphone
Not sure if this is the right place for this, but is it possible for my app to screengrab what its done and save it to the photo app? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: fullscreen quicktime across multiple monitors
I ended up writing a little app that plays a movie across all displays. If anyone else needs it (or has some advice to make it better) its here http://www.memo.tv/msa_qt_player_fullscreen_quicktime_player_across_multiple_video_outs --- Memo (Mehmet S. Akten) www.memo.tv [EMAIL PROTECTED] mob: +44 (0) 7958 783 832 landline: +44 (0) 20 8123 9986 29 Ironworks Dace Rd London E3 2NX, UK On 22 Sep 2008, at 11:52, Memo Akten wrote: ah thanks, will try it out. On 21 Sep 2008, at 23:19, Jean-Daniel Dupas wrote: You are free to setup a window yourself , add a QTMovieView in it, and display it as you need. NSRect contents = [aScreen frame]; contents.origin = NSZeroPoint; NSWindow *window = [super initWithContentRect:contents styleMask:NSBorderlessWindowMask backing: NSBackingStoreRetained defer:NO screen:aScreen]; [window setContentView:myMovieView]; SetSystemUIMode(kUIModeAllSuppressed, kUIOptionAutoShowMenuBar); [window makeKeyAndOrderFront]; Le 21 sept. 08 à 23:58, Memo Akten a écrit : hmm, yea does seem a bit problematic. so is it not possible to play quicktime across multiple monitors then? those threads seem to have not come to a solution... On 19 Sep 2008, at 17:48, Sean McBride wrote: It does, doesn't it. However, it has lots of little problems, and is only really useful for the simplest of cases. Search the list archives for "enterFullScreenMode". On 9/19/08 9:42 AM, Memo Akten said: wow that looks perfect thanks.. On 19 Sep 2008, at 05:10, John C. Randolph wrote: On Sep 17, 2008, at 12:03 PM, Memo Akten wrote: Hi All, I'd like to create a little app the runs a quicktime movie (prores) fullscreen across multiple monitors. I think I can figure out the QTKit stuff, but couldn't find upto date documentation on going fullscreen. I've found some code snippets to do it, but they are all pre-leopard and I have a feeling that its a bit more straightforward on leopard (i'm hoping). Can anyone point me in the right direction? (or has this already been done?) Its for personal use and not distribution so min specs 10.5.5 etc. is fine. Leopard introduced a new API for this. See NSView's enterFullScreenMode:withOptions: method. -- Sean McBride, B. Eng [EMAIL PROTECTED] 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/devlists%40shadowlab.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/memo%40memo.tv 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: apple remote
cool thanks... On 6 Oct 2008, at 07:31, Simone Tellini wrote: Il giorno 06/ott/08, alle ore 05:38, Memo Akten ha scritto: Hi All, I was wondering how straightforward it is to write an app that responds to Apple Remote events. would I get them in - (void) sendEvent:(NSEvent*)event ? I use Kahr's wrapper, too. I suggest you file a bug with Apple asking for an official Apple Remote API though. Let's hope they get enough requests to actually provide one. -- Simone Tellini http://tellini.info ___ 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/memo%40memo.tv 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]
apple remote
Hi All, I was wondering how straightforward it is to write an app that responds to Apple Remote events. would I get them in - (void) sendEvent:(NSEvent*)event ? or what would I need to do? If anyone can point me in the right direction i'd appreciate it... cheers. ___ 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: [Math] sin(), cos() not working? What special magic must I use to summon their powers?
I'm guessing cornerSize is an int? so i/cornerSize will always return 0, so asin(i/cornerSize) will always return 0 so cos(asin(i/cornerSize)) will always return 1 so (1- cos(asin(i/cornerSize))) will always return 0 you want to do i/(float) cornerSize --- Memo (Mehmet S. Akten) www.memo.tv On 30 Sep 2008, at 12:29, Michael Robinson wrote: Hello, I am trying to convert the following from Javascript to Cocoa ObjC: var retVal = Math.round(cornerSize*(1-Math.cos(Math.asin(i/ cornerSize; return retVal; Now retVal _must_ be an int, because the value is used as a margin attribute ("rounding" corners of divs). This is what I've got: Variables i, cornerSize are passed to the function from a for loop. i being the counter for the loop, cornerSize being the size of corner desired by the user. float retVal; retVal = cornerSize*(1-cos(asin(i/cornerSize))); return (int)retVal; Obviously, I'm no whiz at ObjC, and the fact that this keeps return '0' has got me stumped. At first I thought it was some stupid mistake I made translating the formula, but I tested a few things and now I'm not so sure. sin(90); returns 0 as well. When I use Apple's Calculator and ask it to tell me the result of sin(90), it gives me 1. What what what? Do I need to import something for this to work? Am I not tilting my head in the correct direction while typing my code? I'm pretty stuck here, and would appreciate any help. Thanks Mike - - - Errors have occurred. We won't tell you where or why. Lazy programmers. - - - Charlie Gibbs ___ 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/memo%40memo.tv 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 to tell if my app is visible.
Hi John, thanks for the reply. My problem is not so much with detecting when the application is active or not, but detecting whether the mouse is over the application while the application is not active, but does not have another window over it. is this even possible? On 22 Sep 2008, at 13:31, John Clayton wrote: Try looking into using the NSApplication delegate methods that inform you when your app becomes active/hidden, e.g. - (void)applicationDidBecomeActive:(NSNotification *)aNotification Thanks -- John Clayton On 22/09/2008, at 1:07 PM, Memo Akten wrote: Hi All, i have an app which is running on the desktop : windowRect = [[NSScreen mainScreen] visibleFrame]; window = [[NSWindow alloc] initWithContentRect:windowRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]; [window setFrame:windowRect display:NO]; [window setOpaque:NO]; [window setBackgroundColor:[NSColor clearColor]]; [window setMovableByWindowBackground:NO]; [window setLevel:kCGDesktopIconWindowLevel]; [window setAcceptsMouseMovedEvents:YES]; The app is running a quartz composition, which has custom QCPlugin in it. My first problem was, that even where there are other app windows (e.g. finder) on top of my app, the app (the quartz composition) responds to mouse events whilst its in the background (e.g. I want animations to trigger if the mouse is over something, but not if its obscured by finder or safari etc.). So I did a check to see if my app was active or not ([[NSApplication sharedApplication] isActive]) before responding to mouse position and events. That works to some degree, but if I have a window to the side and my app is fully visible, it doesn't respond to mouse position and events - because its not active. But is there a solution to this? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/john_clayton%40mac.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]
how to tell if my app is visible.
Hi All, i have an app which is running on the desktop : windowRect = [[NSScreen mainScreen] visibleFrame]; window = [[NSWindow alloc] initWithContentRect:windowRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]; [window setFrame:windowRect display:NO]; [window setOpaque:NO]; [window setBackgroundColor:[NSColor clearColor]]; [window setMovableByWindowBackground:NO]; [window setLevel:kCGDesktopIconWindowLevel]; [window setAcceptsMouseMovedEvents:YES]; The app is running a quartz composition, which has custom QCPlugin in it. My first problem was, that even where there are other app windows (e.g. finder) on top of my app, the app (the quartz composition) responds to mouse events whilst its in the background (e.g. I want animations to trigger if the mouse is over something, but not if its obscured by finder or safari etc.). So I did a check to see if my app was active or not ([[NSApplication sharedApplication] isActive]) before responding to mouse position and events. That works to some degree, but if I have a window to the side and my app is fully visible, it doesn't respond to mouse position and events - because its not active. But is there a solution to this? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: fullscreen quicktime across multiple monitors
ah thanks, will try it out. On 21 Sep 2008, at 23:19, Jean-Daniel Dupas wrote: You are free to setup a window yourself , add a QTMovieView in it, and display it as you need. NSRect contents = [aScreen frame]; contents.origin = NSZeroPoint; NSWindow *window = [super initWithContentRect:contents styleMask:NSBorderlessWindowMask backing: NSBackingStoreRetained defer:NO screen:aScreen]; [window setContentView:myMovieView]; SetSystemUIMode(kUIModeAllSuppressed, kUIOptionAutoShowMenuBar); [window makeKeyAndOrderFront]; Le 21 sept. 08 à 23:58, Memo Akten a écrit : hmm, yea does seem a bit problematic. so is it not possible to play quicktime across multiple monitors then? those threads seem to have not come to a solution... On 19 Sep 2008, at 17:48, Sean McBride wrote: It does, doesn't it. However, it has lots of little problems, and is only really useful for the simplest of cases. Search the list archives for "enterFullScreenMode". On 9/19/08 9:42 AM, Memo Akten said: wow that looks perfect thanks.. On 19 Sep 2008, at 05:10, John C. Randolph wrote: On Sep 17, 2008, at 12:03 PM, Memo Akten wrote: Hi All, I'd like to create a little app the runs a quicktime movie (prores) fullscreen across multiple monitors. I think I can figure out the QTKit stuff, but couldn't find upto date documentation on going fullscreen. I've found some code snippets to do it, but they are all pre-leopard and I have a feeling that its a bit more straightforward on leopard (i'm hoping). Can anyone point me in the right direction? (or has this already been done?) Its for personal use and not distribution so min specs 10.5.5 etc. is fine. Leopard introduced a new API for this. See NSView's enterFullScreenMode:withOptions: method. -- Sean McBride, B. Eng [EMAIL PROTECTED] 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/devlists%40shadowlab.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: fullscreen quicktime across multiple monitors
hmm, yea does seem a bit problematic. so is it not possible to play quicktime across multiple monitors then? those threads seem to have not come to a solution... On 19 Sep 2008, at 17:48, Sean McBride wrote: It does, doesn't it. However, it has lots of little problems, and is only really useful for the simplest of cases. Search the list archives for "enterFullScreenMode". On 9/19/08 9:42 AM, Memo Akten said: wow that looks perfect thanks.. On 19 Sep 2008, at 05:10, John C. Randolph wrote: On Sep 17, 2008, at 12:03 PM, Memo Akten wrote: Hi All, I'd like to create a little app the runs a quicktime movie (prores) fullscreen across multiple monitors. I think I can figure out the QTKit stuff, but couldn't find upto date documentation on going fullscreen. I've found some code snippets to do it, but they are all pre-leopard and I have a feeling that its a bit more straightforward on leopard (i'm hoping). Can anyone point me in the right direction? (or has this already been done?) Its for personal use and not distribution so min specs 10.5.5 etc. is fine. Leopard introduced a new API for this. See NSView's enterFullScreenMode:withOptions: method. -- Sean McBride, B. Eng [EMAIL PROTECTED] 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 [EMAIL PROTECTED]
Re: UIElement app doesn't come to front
thanks, that did it... On 19 Sep 2008, at 15:18, Fabian wrote: Try [NSApp activateIgnoringOtherApps:YES]; HTH. On Fri, Sep 19, 2008 at 12:28 PM, Memo Akten <[EMAIL PROTECTED]> wrote: I want to create a very simple little app that launches a window at startup, and then runs in the background with no dock and menu. I've created the app as a standard cocoa app, extending NSApplication overriding init (set delegate to self) and applicationDidFinishLaunching to setup a timer (and applicationWillTerminate to cleanup) - I've also set 'Application is agent' to true in Info.plist. When I start the app from Xcode, my window opens, when I close it the window dissappears and my app carries on running in the background as expected. But when i run the app from finder, my window appears at the very back of all other windows so isn't visible, how can I fix this? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/slasktrattenator%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]
UIElement app doesn't come to front
I want to create a very simple little app that launches a window at startup, and then runs in the background with no dock and menu. I've created the app as a standard cocoa app, extending NSApplication overriding init (set delegate to self) and applicationDidFinishLaunching to setup a timer (and applicationWillTerminate to cleanup) - I've also set 'Application is agent' to true in Info.plist. When I start the app from Xcode, my window opens, when I close it the window dissappears and my app carries on running in the background as expected. But when i run the app from finder, my window appears at the very back of all other windows so isn't visible, how can I fix this? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: determining system idle time in leopard
Thanks for the replies guys, I think all fingers point to the same method which is a few years old - but thats cool. I was wondering if it had been simplified in Leopard but seems not (I just didn't want to write out-of-date code) Cheers, Memo. On 18 Sep 2008, at 12:03, Memo Akten wrote: In my app I'd like to check for system idle time, and perform an action after a set amount of time. I've found this code to check for system idle time http://www.cocoabuilder.com/archive/message/cocoa/2004/10/27/120354 is this still the best way to do it on leopard? cheers, memo. ___ 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/memo%40memo.tv 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: fullscreen quicktime across multiple monitors
THanks, i'll look in to all that.. though I think for now NSView enterFullScreenMode:withOptions: may be quite good On 19 Sep 2008, at 05:13, Michael Ash wrote: On Wed, Sep 17, 2008 at 3:03 PM, Memo Akten <[EMAIL PROTECTED]> wrote: Hi All, I'd like to create a little app the runs a quicktime movie (prores) fullscreen across multiple monitors. I think I can figure out the QTKit stuff, but couldn't find upto date documentation on going fullscreen. I've found some code snippets to do it, but they are all pre-leopard and I have a feeling that its a bit more straightforward on leopard (i'm hoping). Can anyone point me in the right direction? (or has this already been done?) Its for personal use and not distribution so min specs 10.5.5 etc. is fine. "Fullscreen" just means that you cover the entire screen with your window. In this case, covering all screens. There's no need for a special API (although special APIs are available), just make a standard NSWindow, set its frame to cover all the screens, make sure that it contains what you want, and you're good. For more specific guidance, NSScreen can be used to find out where all the screens are, NSBorderlessWindowMask will give you a window with no title bar or other distracting decorations, and NSApplicationDidChangeScreenParametersNotification will tell you if the configuration of the screens changed so you can re-position your window. 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/memo%40memo.tv 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: fullscreen quicktime across multiple monitors
wow that looks perfect thanks.. On 19 Sep 2008, at 05:10, John C. Randolph wrote: On Sep 17, 2008, at 12:03 PM, Memo Akten wrote: Hi All, I'd like to create a little app the runs a quicktime movie (prores) fullscreen across multiple monitors. I think I can figure out the QTKit stuff, but couldn't find upto date documentation on going fullscreen. I've found some code snippets to do it, but they are all pre-leopard and I have a feeling that its a bit more straightforward on leopard (i'm hoping). Can anyone point me in the right direction? (or has this already been done?) Its for personal use and not distribution so min specs 10.5.5 etc. is fine. Leopard introduced a new API for this. See NSView's enterFullScreenMode:withOptions: method. -jcr ___ 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]
determining system idle time in leopard
In my app I'd like to check for system idle time, and perform an action after a set amount of time. I've found this code to check for system idle time http://www.cocoabuilder.com/archive/message/cocoa/2004/10/27/120354 is this still the best way to do it on leopard? cheers, memo. ___ 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]
fullscreen quicktime across multiple monitors
Hi All, I'd like to create a little app the runs a quicktime movie (prores) fullscreen across multiple monitors. I think I can figure out the QTKit stuff, but couldn't find upto date documentation on going fullscreen. I've found some code snippets to do it, but they are all pre-leopard and I have a feeling that its a bit more straightforward on leopard (i'm hoping). Can anyone point me in the right direction? (or has this already been done?) Its for personal use and not distribution so min specs 10.5.5 etc. is fine. cheers, memo. ___ 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: NSMutableDictionary, NSNumber and more memory management
Thanks Joshua, that clears up the memory stuff... i think i finally get it now: unless you explicitly alloc or retain, you never need to release... cheers, memo. On 28 Aug 2008, at 13:12, Joshua Pennington wrote: On Aug 28, 2008, at 6:46 AM, Memo Akten <[EMAIL PROTECTED]> wrote: q1: Is this all correct? When you setObject, the docs say that the object receives a retain, so that means its safe (and correct) for me to do the above? Do I need to release the NSNumbers in dealloc? or does the NSMutableDictionary release them? I think its the latter but just wanted to double check. numberWithUnsignedInteger: returns an object which you do not have ownership over and as a result, you are not responsible for releasing it. NSDictionary will retain it when setValue:forKey: is messaged. q2: this is my updating code: - (void) updateValue:(NSString*)key { id oldValue = [myDict objectForKey:key]; id newValue = [NSNumber numberWithUnsignedInteger:([oldValue unsignedIntegerValue] + 1)]; [myDict setObject:newValue forKey:key]; [oldValue release];// do I need to release this? objectForKey: returns an object over which you do not have ownership and as a result you do not have to release it after. When you call setValue:forKey: it retains newValue and releases it's reference to the original key. Cheers, Joshua Sent from my iPhone ___ 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]
NSMutableDictionary, NSNumber and more memory management
Hi All, I have a few questions regarding using NSMutableDictionary, NSNumbers, and more memory management. I have a mutable dictionary, which I would like to store a bunch of values, which my app will modify and save and load as a plist. This is inside a QCPlugIn and it seems the autorelease pool is released after every frame (i had an earlier post regarding this) so can't rely on using convenience methods across frames unless I retain them this is my init/dealloc code: INIT: myDict = [[NSMutableDictionary alloc] init]; [myDict setObject:[NSNumber numberWithUnsignedInteger:0] forKey:KEY1]; [myDict setObject:[NSNumber numberWithUnsignedInteger:0] forKey:KEY2]; [myDict setObject:[NSNumber numberWithUnsignedInteger:0] forKey:KEY3]; [myDict setObject:[NSNumber numberWithUnsignedInteger:0] forKey:KEY4]; [myDict setObject:[NSNumber numberWithUnsignedInteger:0] forKey:KEY5]; DEALLOC: [myDict release]; q1: Is this all correct? When you setObject, the docs say that the object receives a retain, so that means its safe (and correct) for me to do the above? Do I need to release the NSNumbers in dealloc? or does the NSMutableDictionary release them? I think its the latter but just wanted to double check. q2: this is my updating code: - (void) updateValue:(NSString*)key { id oldValue = [myDict objectForKey:key]; id newValue = [NSNumber numberWithUnsignedInteger:([oldValue unsignedIntegerValue] + 1)]; [myDict setObject:newValue forKey:key]; [oldValue release]; // do I need to release this? } I 'm not very experienced with ObjC, but I"m loving it so far... but this seems a bit overkill - destroy and recreate a new NSNumber and re- add it to the dictionary - but I couldn't get it to work any other way. Performance isn't really an issue as this will be called at most a couple times a second, usually a lot more infrequently - but is this the best way to do it? I thought of having a bunch of int variables, and update them, and reconstruct the NSDictionary every time one of them changes, but that seemed a bit overkill too.. cheers, ___ 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: confused about allocating and releasing objects
Thanks guys, its starting to become a bit clearer now. I'll use the alloc / init / release route for now until I"ve read through the memory management doc Cheers, Memo. On 27 Aug 2008, at 12:22, Jonathan del Strother wrote: On Wed, Aug 27, 2008 at 12:13 PM, Memo Akten <[EMAIL PROTECTED]> wrote: ok thanks, I"ve added that link to my ever growing Cocoa bookmarks!! I'm just writing a Quartz Composer plugin using the QCPlugIn API and ran into a problem regarding this, my question isn't related to the QCPlugIn API so I'm posting here first. At the start of the plugin (in enableExecution) I use the code: - (void) loadCardXMLData { NSString *dataPath = @"/data.plist"; cardsLoadedData = [NSDictionary dictionaryWithContentsOfFile: dataPath]; // cardsLoadedData = [[NSDictionary alloc] initWithContentsOfFile: dataPath]; if(cardsLoadedData) { NSLog(@"*** SUCCESSFULLY LOADED %@", dataPath); } else { NSLog(@"*** COULD NOT LOAD %@", dataPath); } } If I use the convenience route (with no release in disableExecution) I get a freeze (I need to force quit QC) as soon as I enable the plugin. If I use the alloc route (and release in disableExecution) everything works fine. Is this normal behaviour? or could it be QC related? P.S. cardsLoadedData is a property of my QCPlugIn class, and I don't use it at all except at the end of execute I just send it out to QC with self.outputXMLData = cardsLoadedData; Cheers, Memo. You're assigning an autoreleased object to your cardsLoadedData ivar. Next time the autorelease pool pops, your dictionary is going to get released. Either retain the dictionary, or use alloc+init, or (preferably) use self.cardsLoadedData= instead of just cardsLoadedData=, which will assign via the property method, which will retain for you (assuming you've set up the property correctly). ___ 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: confused about allocating and releasing objects
ok thanks, I"ve added that link to my ever growing Cocoa bookmarks!! I'm just writing a Quartz Composer plugin using the QCPlugIn API and ran into a problem regarding this, my question isn't related to the QCPlugIn API so I'm posting here first. At the start of the plugin (in enableExecution) I use the code: - (void) loadCardXMLData { NSString *dataPath = @"/data.plist"; cardsLoadedData = [NSDictionary dictionaryWithContentsOfFile: dataPath]; // cardsLoadedData = [[NSDictionary alloc] initWithContentsOfFile: dataPath]; if(cardsLoadedData) { NSLog(@"*** SUCCESSFULLY LOADED %@", dataPath); } else { NSLog(@"*** COULD NOT LOAD %@", dataPath); } } If I use the convenience route (with no release in disableExecution) I get a freeze (I need to force quit QC) as soon as I enable the plugin. If I use the alloc route (and release in disableExecution) everything works fine. Is this normal behaviour? or could it be QC related? P.S. cardsLoadedData is a property of my QCPlugIn class, and I don't use it at all except at the end of execute I just send it out to QC with self.outputXMLData = cardsLoadedData; Cheers, Memo. On 27 Aug 2008, at 11:57, Jonathan del Strother wrote: On Wed, Aug 27, 2008 at 11:45 AM, Memo Akten <[EMAIL PROTECTED]> wrote: HI All, i'm a bit confused about the 2 scenarios: NSDictionary *myData1 = [NSDictionary dictionaryWithContentsOfFile:@"mydata.plist"]; // this one I don't need to release when I'm done? NSDictionary *myData2 = [[NSDictionary alloc] initWithContentsOfFile:@"mydata.plist"];// this one I do need to relase when I'm done? There seems to be a lot of situations in Cocoa where this happens so I guess this is a generic question for all cases when an object is created via means of a static method vs using alloc:initWith... (e.g. NSArray, NSString, NSNumber etc. are just a few I've seen). Whats the difference between the two methods? (I know the second one creates a blank dictionary first, and then loads the file - but I mean which one is better for what purpose? - why would I choose one over the other). Use whichever is easiest. Generally if I'm looking for a temporary object, I'll use the autoreleased method if present. If I'm going to keep the object around, I'll use the alloc/init method. But either of these can be transformed to the other with a retain or autorelease message, so there's no huge difference. And am I correct in assuming if I use the first method i do not need to release the variable when I'm done? but do need to release the variable in the second instance? Correct. Review http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/MemoryMgmt.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/memo%40memo.tv 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]
confused about allocating and releasing objects
HI All, i'm a bit confused about the 2 scenarios: NSDictionary *myData1 = [NSDictionary dictionaryWithContentsOfFile:@"mydata.plist"]; // this one I don't need to release when I'm done? NSDictionary *myData2 = [[NSDictionary alloc] initWithContentsOfFile:@"mydata.plist"]; // this one I do need to relase when I'm done? There seems to be a lot of situations in Cocoa where this happens so I guess this is a generic question for all cases when an object is created via means of a static method vs using alloc:initWith... (e.g. NSArray, NSString, NSNumber etc. are just a few I've seen). Whats the difference between the two methods? (I know the second one creates a blank dictionary first, and then loads the file - but I mean which one is better for what purpose? - why would I choose one over the other). And am I correct in assuming if I use the first method i do not need to release the variable when I'm done? but do need to release the variable in the second instance? Cheers, Memo. ___ 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: launching finder with optionschi
"t may work, but it is unnecessarily complicated. Since AppleScript is just a user-friendly representation of Apple Events, you can use either raw Apple Events (AEDesc and friends) or the Scripting Bridge (Leopard only) to do the exact same thing without the overhead of launching another application." "It'd be faster and more lightweight to add the compiled script to your app as a resource, and then use NSAppleScript to load and run it. Right now you've got the extra overhead of launching and quitting a GUI app, and I'll bet there's a momentary bounce in the Dock too." Thanks guys, yea there is a momentary bounce in the dock. I did it this way because my app loads an XML and there are a number of apps that it can launch depending on what you choose and the app name in the XML. I just wanted to keep it generic. So I guess I would need to add the functionality to add an appname or compiled scriptname to the XML? I will look into the APIs mentioned... Cheers, Memo (Mehmet S. Akten) www.memo.tv [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: launching finder with optionschi
Hi thanks, I ended up creating an AppleScript like you mention (below) and then just creating an app out of it, and launching that app instead of finder... works quite well... cheers, Memo. tell application "Finder" activate if not (exists Finder window 1) then make new Finder window to startup disk end if select Finder window 1 set target of Finder window 1 to folder "documents" of home set current view of Finder window 1 to flow view end tell On Mon, 16 Jun 2008 08:40:41 -0700, Jens Alfke <[EMAIL PROTECTED]> wrote: > > On 16 Jun '08, at 6:09 AM, Memo Akten wrote: > >> I'd like to launch one of the apps - >> Finder - in a specific folder in Cover Flow (app is leopard only). >> I've been searching how to do this but cannot find any info. > > You can tell an app to open a specific file (which in the case of > Finder can include a folder) using other NSWorkspace methods. But it > won't be able to tell Finder what view to use. To do that you'll need > to use the scripting bridge to send AppleEvents to Finder. > > The best way to approach something like that is to open Script Editor, > use its Open Dictionary command to open the Finder scripting > dictionary browser, and then construct a short script that does what > you want. From there you should be able to use AppKit's scripting > bridge support to construct calls that do the same thing. > > —Jens -- Mehmet S. Akten [EMAIL PROTECTED] www.memo.tv ___ 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]
launching finder with optionschi
Hi all, i'm not sure if this is relevant to this list but not sure where else to post it. >From my cocoa app (a QC PlugIn), I'm launching apps with the command: [[NSWorkspace sharedWorkspace] launchApplication:currentAppToLaunch]; which is working fine, but I'd like to launch one of the apps - Finder - in a specific folder in Cover Flow (app is leopard only). I've been searching how to do this but cannot find any info. If anyone can point me in the right direction I would appreciate it, cheers, Mehmet S. [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: launching standard apps with NSTask
Ok Thanks, will check it out... Memo (Mehmet S. Akten) www.memo.tv [EMAIL PROTECTED] On 11 Jun 2008, at 01:20, Adam Leonard wrote: LaunchServices or NSWorkspace (which uses LS) is still probably your best option, as NSTask is not really designed to deal with GUI apps. To terminate the app, you can send a quit apple event or use applescript. This has come up recently, so search the list archives. To detect when the user terminates the application, you can also use NSWorkspace. See the documentation for NSWorkspaceDidTerminateApplicationNotification Adam Leonard On Jun 10, 2008, at 4:22 PM, Memo Akten wrote: Hi, that looks great thanks, I've just been looking through the documentation, but I don't think it allows control over terminating the app, or detecting when its closed. I would like to have that level of control (just terminate, and detect if user close it) - which is why I was opting for NSTask - but actually I'm not having any luck with that either! (if I put the path to the .app I get a permission error, if I put the path to the file in contents/macos it doesn't work!). is there anything else I can do? Memo (Mehmet S. Akten) www.memo.tv [EMAIL PROTECTED] On 11 Jun 2008, at 00:02, Michael Vannorsdel wrote: [[NSWorkspace sharedWorkspace] launchApplication:@"Safari"]; On Jun 10, 2008, at 4:55 PM, Memo Akten wrote: Hi all, i'm writing an app that launches some default apps like safari, itunes, iphoto etc using NSTask. I was wondering if there is a way of writing the launch url not fully hardcoded but using some system variables / methods etc.? Memo (Mehmet S. Akten) ___ 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/memo%40memo.tv 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/adam%40caffeinatedcocoa.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/memo%40memo.tv 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: launching standard apps with NSTask
Hi, that looks great thanks, I've just been looking through the documentation, but I don't think it allows control over terminating the app, or detecting when its closed. I would like to have that level of control (just terminate, and detect if user close it) - which is why I was opting for NSTask - but actually I'm not having any luck with that either! (if I put the path to the .app I get a permission error, if I put the path to the file in contents/macos it doesn't work!). is there anything else I can do? Memo (Mehmet S. Akten) www.memo.tv [EMAIL PROTECTED] On 11 Jun 2008, at 00:02, Michael Vannorsdel wrote: [[NSWorkspace sharedWorkspace] launchApplication:@"Safari"]; On Jun 10, 2008, at 4:55 PM, Memo Akten wrote: Hi all, i'm writing an app that launches some default apps like safari, itunes, iphoto etc using NSTask. I was wondering if there is a way of writing the launch url not fully hardcoded but using some system variables / methods etc.? Memo (Mehmet S. Akten) ___ 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/memo%40memo.tv 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]
launching standard apps with NSTask
Hi all, i'm writing an app that launches some default apps like safari, itunes, iphoto etc using NSTask. I was wondering if there is a way of writing the launch url not fully hardcoded but using some system variables / methods etc.? Memo (Mehmet S. Akten) www.memo.tv [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: Filling screen under menu bar and above dock
thanks! works great! On Mon, 9 Jun 2008 07:27:01 -0400, "douglas a. welton" <[EMAIL PROTECTED]> wrote: > Check out NSScreen documentation for the -(NSRect)visibleFrame method. > > On Jun 9, 2008, at 6:49 AM, Memo Akten wrote: > >> <[EMAIL PROTECTED]> > <[EMAIL PROTECTED] >> > >> Message-ID: <[EMAIL PROTECTED]> >> X-Sender: [EMAIL PROTECTED] >> Received: from 82-68-202-222.dsl.in-addr.zen.co.uk [82.68.202.222] >> with >> HTTP/1.1 (POST); Mon, 09 Jun 2008 04:49:35 -0600 >> User-Agent: RoundCube Webmail/0.1-rc2 >> Content-Type: text/plain; charset="UTF-8" >> Content-Transfer-Encoding: 8bit >> >> >> Hi All, i would like to create an NSWindow that fills the space >> above >> the dock and below the menubar and I couldn't find exactly how to do >> it.I tried:> style="white-space: pre">windowRect = NSMakeRect(0, >> > style="color: #1c00cf">0, 100> span>, >> 100);> style="color: >> #00">mainWindow> span>> style="color: #00"> = [[NSWindow > span>alloc> style="color: #00">] initWithContentRect:windowRect> style="color: #00"> styleMask:NSBorderlessWindowMask >> backing:NSBackingStoreBuffered >> defer:NO];> class="Apple-style-span" style="color: #3f6e74; font-family: Monaco; >> font-size: 10px; white-space: normal">> class="Apple-tab-span" style="white-space: >> pre">windowRect.> span>> style="color: #5c2699">size = >> [mainWindow > style="color: >> #2e0d6e">maxSize];; But that didn't work >> (maxSize is not initiallized)I also tried initting the >> window >> with windowRect = NSMakeRect(0, 0, >> CGDisplayPixelsWide(kCGDirectMainDisplay), >> CGDisplayPixelsHigh(kCGDirectMainDisplay));but that seems >> to be >> the full screen height ... where do I find the numbers that I >> need? Cheers,Memo. >> >> ___ >> >> 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/douglas_welton%40earthlink.net >> >> This email sent to [EMAIL PROTECTED] -- Mehmet S. Akten [EMAIL PROTECTED] www.memo.tv +44 7958 783 832 +44 20 8123 9986 29 Ironworks Dace Rd. London E3 2NX UK ___ 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]
Filling screen under menu bar and above dock
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]> Message-ID: <[EMAIL PROTECTED]> X-Sender: [EMAIL PROTECTED] Received: from 82-68-202-222.dsl.in-addr.zen.co.uk [82.68.202.222] with HTTP/1.1 (POST); Mon, 09 Jun 2008 04:49:35 -0600 User-Agent: RoundCube Webmail/0.1-rc2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Hi All, i would like to create an NSWindow that fills the space above the dock and below the menubar and I couldn't find exactly how to do it.I tried: windowRect = NSMakeRect(0, 0, 100, 100); mainWindow = [[NSWindow alloc] initWithContentRect:windowRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]; windowRect.size = [mainWindow maxSize];; But that didn't work (maxSize is not initiallized)I also tried initting the window with windowRect = NSMakeRect(0, 0, CGDisplayPixelsWide(kCGDirectMainDisplay), CGDisplayPixelsHigh(kCGDirectMainDisplay));but that seems to be the full screen height ... where do I find the numbers that I need? Cheers,Memo. ___ 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: invoking quicklook via code
Thanks for the tips guys, qlmanage -p seems to do the trick for now - though I guess I won't have any control over it? or can detect when its finished? (or can that be done with AppleScript or something)... and now lets see if it works from within a QCPlugIn :P Memo (Mehmet S. Akten) www.memo.tv [EMAIL PROTECTED] +44 (0) 7958 783 832 +44 (0) 20 8123 9986 29 Ironworks Dace Rd London E3 2NX, UK On 4 Jun 2008, at 23:29, Charles Steinman wrote: --- Memo Akten <[EMAIL PROTECTED]> wrote: Is it possible to somehow just launch the quicklook window for a quicktime file? The publicly available way to activate Quick Look is to call the qlmanage command line tool. Why they didn't make the QuickLookUI framework public is beyond me (I spent hours looking for a public API before I realized it just wasn't there), but you can do something similar with qlmanage -p. http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/qlmanage.1.html Cheers, Chuck ___ 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: invoking quicklook via code
Thanks for the replies guys. What I would like to do, may be a lot simpler than what i may have explained. I just want my app to launch the quicktime movie, in what looks like exactly like the finder quicklook window - in fact if its possible to even somehow do it with an applescript or something - i.e. just tell finder to launch it! Is that possible? Memo (Mehmet S. Akten) www.memo.tv [EMAIL PROTECTED] On 4 Jun 2008, at 23:18, Nick Zitzmann wrote: On Jun 4, 2008, at 3:48 PM, Jonathan Dann wrote: The quicklook framework is private and therefore should cannot be reliably used in an app. There are a few site out there that give example code that calls it though. Since when was this? QuickLook is not a private framework, and it is possible for third-party apps to use it as a client without using any private APIs. What third-party apps can't do is get a QuickLook QuickTime preview, which is what the Finder does when looking at QuickTime files. And I suspect the Finder is not using QuickLook on QuickTime files, but is instead using QuickTime directly. 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/memo%40memo.tv 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]
invoking quicklook via code
Hi All, I"m building a little cocoa app, its mainly a quartz composer composition + custom plugin, which I'm embedding and controlling via QCRenderer. I'm writing a Quartz Composer plugin which creates a few buttons and when you click one I would like to launch a quicktime file, but I would like it to look just like the quicklook QT view. Is it possible to somehow just launch the quicklook window for a quicktime file? I'm quite new to Cocoa / ObjC so some basic things are a bit complicated for me. Cheers, Mehmet S. [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]