vlc/vlc-2.2 | branch: master | David Fuhrmann <dfuhrm...@videolan.org> | Wed Jul 30 12:10:45 2014 +0200| [5048ad23b9827f4a5c0416eb2e81a77094f896a9] | committer: Jean-Baptiste Kempf
macosx: add input changed event and reset shown crop values for new input (cherry picked from commit 84d73bcd127eaf259f358a2b823802c93732ac55) Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org> > http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=5048ad23b9827f4a5c0416eb2e81a77094f896a9 --- 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 0090a95..6a78478 100644 --- a/modules/gui/macosx/VideoEffects.m +++ b/modules/gui/macosx/VideoEffects.m @@ -208,9 +208,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) @@ -219,6 +232,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]; } } _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits