Commit 84d73bcd authored by David's avatar David

macosx: add input changed event and reset shown crop values for new input

parent 32693a7e
......@@ -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];
......
......@@ -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
......
......@@ -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];
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment