[vlc-commits] macosx: add input changed event and reset shown crop values for new input
David Fuhrmann
git at videolan.org
Wed Jul 30 12:31:00 CEST 2014
vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Wed Jul 30 12:10:45 2014 +0200| [84d73bcd127eaf259f358a2b823802c93732ac55] | committer: David Fuhrmann
macosx: add input changed event and reset shown crop values for new input
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=84d73bcd127eaf259f358a2b823802c93732ac55
---
modules/gui/macosx/VideoEffects.m | 23 +++++++++++++++++++++++
modules/gui/macosx/intf.h | 1 +
modules/gui/macosx/intf.m | 6 ++++++
3 files changed, 30 insertions(+)
diff --git a/modules/gui/macosx/VideoEffects.m b/modules/gui/macosx/VideoEffects.m
index 896018c..55e7f9d 100644
--- a/modules/gui/macosx/VideoEffects.m
+++ b/modules/gui/macosx/VideoEffects.m
@@ -206,9 +206,22 @@ static VLCVideoEffects *_o_sharedInstance = nil;
[o_tableView selectFirstTabViewItem:self];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(inputChangedEvent:)
+ name:VLCInputChangedNotification
+ object:nil];
+
+
[self resetValues];
}
+- (void)dealloc
+{
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+
+ [super dealloc];
+}
+
- (void)updateCocoaWindowLevel:(NSInteger)i_level
{
if (o_window && [o_window isVisible] && [o_window level] != i_level)
@@ -217,6 +230,16 @@ static VLCVideoEffects *_o_sharedInstance = nil;
#pragma mark -
#pragma mark internal functions
+
+-(void)inputChangedEvent:(NSNotification *)o_notification
+{
+ // reset crop values when input changed
+ [self setCropBottomValue:0];
+ [self setCropTopValue:0];
+ [self setCropLeftValue:0];
+ [self setCropRightValue:0];
+}
+
- (void)resetProfileSelector
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
diff --git a/modules/gui/macosx/intf.h b/modules/gui/macosx/intf.h
index c51094e..8afc5bb 100644
--- a/modules/gui/macosx/intf.h
+++ b/modules/gui/macosx/intf.h
@@ -57,6 +57,7 @@ vout_thread_t *getVout(void);
vout_thread_t *getVoutForActiveWindow(void);
audio_output_t *getAout(void);
+static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
/*****************************************************************************
* VLCMain interface
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index 880219b..d35be88 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -1274,6 +1274,9 @@ static bool f_appExit = false;
p_current_input = NULL;
[o_mainmenu setRateControlsEnabled: NO];
+
+ [[NSNotificationCenter defaultCenter] postNotificationName:VLCInputChangedNotification
+ object:nil];
}
else if (!p_current_input) {
// object is hold here and released then it is dead
@@ -1290,6 +1293,9 @@ static bool f_appExit = false;
p_input_changed = vlc_object_hold(p_current_input);
[[self playlist] continuePlaybackWhereYouLeftOff:p_current_input];
+
+ [[NSNotificationCenter defaultCenter] postNotificationName:VLCInputChangedNotification
+ object:nil];
}
}
More information about the vlc-commits
mailing list