Commit 46ab781e authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* If the "show advanced" option has been changed and you press the Apply

  button, the preferences window is destroyed and created.
parent 22342e60
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* prefs.h: MacOS X plugin for vlc * prefs.h: MacOS X plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: prefs.h,v 1.2 2003/02/08 22:20:28 massiot Exp $ * $Id: prefs.h,v 1.3 2003/02/21 02:45:21 hartman Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* *
...@@ -48,8 +48,7 @@ ...@@ -48,8 +48,7 @@
- (void)configChanged:(id)o_unknown; - (void)configChanged:(id)o_unknown;
- (void)clickedApply:(id)sender; - (void)clickedApplyCancelOK:(id)sender;
- (void)clickedCancelOK:(id)sender;
@end @end
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* prefs.m: MacOS X plugin for vlc * prefs.m: MacOS X plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: prefs.m,v 1.14 2003/02/20 18:10:16 hartman Exp $ * $Id: prefs.m,v 1.15 2003/02/21 02:45:21 hartman Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* *
...@@ -576,15 +576,15 @@ ...@@ -576,15 +576,15 @@
s_rc.origin.y = s_panel_rc.origin.y + 14; s_rc.origin.y = s_panel_rc.origin.y + 14;
s_rc.size.height = 25; s_rc.size.width = 105; s_rc.size.height = 25; s_rc.size.width = 105;
s_rc.origin.x = s_panel_rc.size.width - s_rc.size.width - 14; s_rc.origin.x = s_panel_rc.size.width - s_rc.size.width - 14;
DEF_PANEL_BUTTON( 0, _NS("OK"), clickedCancelOK: ); DEF_PANEL_BUTTON( 0, _NS("OK"), clickedApplyCancelOK: );
[o_panel setDefaultButtonCell: [o_button cell]]; [o_panel setDefaultButtonCell: [o_button cell]];
s_rc.origin.x -= s_rc.size.width; s_rc.origin.x -= s_rc.size.width;
DEF_PANEL_BUTTON( 1, _NS("Cancel"), clickedCancelOK: ); DEF_PANEL_BUTTON( 1, _NS("Cancel"), clickedApplyCancelOK: );
[o_button setKeyEquivalent: @"\E"]; [o_button setKeyEquivalent: @"\E"];
s_rc.origin.x -= s_rc.size.width; s_rc.origin.x -= s_rc.size.width;
DEF_PANEL_BUTTON( 2, _NS("Apply"), clickedApply: ); DEF_PANEL_BUTTON( 2, _NS("Apply"), clickedApplyCancelOK: );
[o_button setEnabled: NO]; [o_button setEnabled: NO];
#undef DEF_PANEL_BUTTON #undef DEF_PANEL_BUTTON
...@@ -724,11 +724,17 @@ ...@@ -724,11 +724,17 @@
} }
} }
- (void)clickedApply:(id)sender - (void)clickedApplyCancelOK:(id)sender
{ {
id o_vlc_control; id o_vlc_control;
NSEnumerator *o_enum; NSEnumerator *o_enum;
BOOL b_advanced_change = FALSE;
NSWindow *o_pref_panel = [[sender superview] window];
NSString *o_module_name = [[o_pref_panel toolbar] identifier];
if ( ![[sender title] isEqualToString: _NS("Cancel")] )
{
NSView *o_config_view = [sender superview]; NSView *o_config_view = [sender superview];
NSWindow *o_config_panel = [o_config_view window]; NSWindow *o_config_panel = [o_config_view window];
NSButton *o_btn_apply = [o_config_view viewWithTag: 2]; NSButton *o_btn_apply = [o_config_view viewWithTag: 2];
...@@ -764,7 +770,10 @@ ...@@ -764,7 +770,10 @@
case CONFIG_ITEM_BOOL: case CONFIG_ITEM_BOOL:
{ {
int i_value = [o_vlc_control intValue]; int i_value = [o_vlc_control intValue];
if ( !strcmp( psz_name, "advanced" ) && ( config_GetInt( p_intf, "advanced" ) != i_value ) )
{
b_advanced_change = TRUE;
}
config_PutInt( p_intf, psz_name, i_value ); config_PutInt( p_intf, psz_name, i_value );
} }
break; break;
...@@ -784,18 +793,14 @@ ...@@ -784,18 +793,14 @@
[o_prefs removeAllObjects]; [o_prefs removeAllObjects];
config_SaveConfigFile( p_intf, NULL ); config_SaveConfigFile( p_intf, NULL );
} }
- (void)clickedCancelOK:(id)sender
{
NSWindow *o_pref_panel = [[sender superview] window];
NSString *o_module_name = [[o_pref_panel toolbar] identifier];
if( [[sender title] isEqualToString: _NS("OK")] ) if ( [[sender title] isEqualToString: _NS("Apply")] && !b_advanced_change )
{ {
[self clickedApply: sender]; ;
} }
else
{
[o_pref_panel close]; [o_pref_panel close];
if( [self respondsToSelector: @selector(performSelectorOnMainThread: if( [self respondsToSelector: @selector(performSelectorOnMainThread:
...@@ -803,7 +808,11 @@ ...@@ -803,7 +808,11 @@
{ {
[self performSelectorOnMainThread: @selector(destroyPrefPanel:) [self performSelectorOnMainThread: @selector(destroyPrefPanel:)
withObject: o_module_name withObject: o_module_name
waitUntilDone: NO]; waitUntilDone: YES];
if ( [[sender title] isEqualToString: _NS("Apply")] && b_advanced_change )
{
[self createPrefPanel:@"main"];
}
} }
else else
{ {
...@@ -811,6 +820,7 @@ ...@@ -811,6 +820,7 @@
target: self selector: @selector(destroyPrefPanel:) target: self selector: @selector(destroyPrefPanel:)
userInfo: o_module_name repeats: NO]; userInfo: o_module_name repeats: NO];
} }
}
} }
@end @end
......
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