From ebc8e55d33f011d9c44a5c76f463c99950f0e973 Mon Sep 17 00:00:00 2001 From: "SND\\MaddTheSane_cp" Date: Wed, 2 Apr 2014 18:01:28 +0000 Subject: OS X: Stop the memory card images from animating when the preferences window closes. Other changes and improvements. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@89782 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- macosx/PcsxrMemCardController.m | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'macosx/PcsxrMemCardController.m') diff --git a/macosx/PcsxrMemCardController.m b/macosx/PcsxrMemCardController.m index 0620fbf4..7fb139ea 100755 --- a/macosx/PcsxrMemCardController.m +++ b/macosx/PcsxrMemCardController.m @@ -25,6 +25,20 @@ @synthesize memCard1Array; @synthesize memCard2Array; +- (void)stopMemoryAnimation +{ + [self.imageAnimateTimer invalidate]; + self.imageAnimateTimer = nil; +} + +- (void)beginMemoryAnimation +{ + if (!_imageAnimateTimer) { + self.imageAnimateTimer = [[NSTimer alloc] initWithFireDate:[NSDate date] interval:0.30 target:self selector:@selector(animateMemCards:) userInfo:nil repeats:YES]; + [[NSRunLoop mainRunLoop] addTimer:self.imageAnimateTimer forMode:NSRunLoopCommonModes]; + } +} + - (void)setupValues:(int)theCards { NSParameterAssert(theCards < 4 && theCards > 0); @@ -84,8 +98,7 @@ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(memoryCardDidChangeNotification:) name:memChangeNotifier object:nil]; - self.imageAnimateTimer = [[NSTimer alloc] initWithFireDate:[NSDate date] interval:3.0/10.0 target:self selector:@selector(animateMemCards:) userInfo:nil repeats:YES]; - [[NSRunLoop mainRunLoop] addTimer:self.imageAnimateTimer forMode:NSRunLoopCommonModes]; + [self beginMemoryAnimation]; } - (void)animateMemCards:(NSTimer*)theTimer @@ -216,16 +229,6 @@ } } -- (IBAction)changeMemCard:(id)sender -{ - [ConfigurationController mcdChangeClicked:sender]; -} - -- (IBAction)newMemCard:(id)sender -{ - [ConfigurationController mcdNewClicked:sender]; -} - - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; -- cgit v1.2.3