]> git.sesse.net Git - vlc/commitdiff
* intf.m: -make sure that objects like o_open, o_wizard, etc. get released in any...
authorFelix Paul Kühne <fkuehne@videolan.org>
Thu, 6 Oct 2005 16:00:01 +0000 (16:00 +0000)
committerFelix Paul Kühne <fkuehne@videolan.org>
Thu, 6 Oct 2005 16:00:01 +0000 (16:00 +0000)
    -trigger the extended-panel to collapse completely before saving its position
    -save the prefs, if the extended-panel changed them previously (refs #382)
* extended.m: minor cleanups to make the stuff above possible (more cleanup needed, will follow later on)
* extended.nib & #.m: don't let the normvol-slider become zero, but use floats from 0.1 to 10.0 only

extras/MacOSX/Resources/English.lproj/Extended.nib/info.nib
extras/MacOSX/Resources/English.lproj/Extended.nib/keyedobjects.nib
modules/gui/macosx/extended.h
modules/gui/macosx/extended.m
modules/gui/macosx/intf.m

index 6bc91190bde50b7ca992047e527c86016e847828..ceb2178a2b96f7ac4b8be9e1bfeb86d404a21c63 100644 (file)
@@ -7,7 +7,7 @@
        <key>IBEditorPositions</key>
        <dict>
                <key>13</key>
-               <string>506 668 390 138 0 0 1440 878 </string>
+               <string>525 535 390 138 0 0 1440 878 </string>
                <key>32</key>
                <string>525 487 390 233 0 0 1440 878 </string>
                <key>5</key>
@@ -23,6 +23,7 @@
        <array>
                <integer>18</integer>
                <integer>32</integer>
+               <integer>13</integer>
        </array>
        <key>IBSystem Version</key>
        <string>8C46</string>
index 40154ec3a423e34ce174307847e5657ae9175723..9b779b814baa425548912a39704e18ee5ccdac84 100644 (file)
Binary files a/extras/MacOSX/Resources/English.lproj/Extended.nib/keyedobjects.nib and b/extras/MacOSX/Resources/English.lproj/Extended.nib/keyedobjects.nib differ
index b8ba09daf2f0ca0470259a7cb0c13e4ec5b33663..8b9e850c30e0cf57351a7738295d3630a432871c 100644 (file)
@@ -86,6 +86,8 @@
     BOOL o_adjImg_expanded;
     BOOL o_audFlts_expanded;
     BOOL o_vidFlts_expanded;
+    
+    BOOL o_config_changed;
 }
 
 - (IBAction)adjImg_Enbl:(id)sender;
 - (IBAction)vidFlts_mrInfo:(id)sender;
 
 + (VLCExtended *)sharedInstance;
+- (BOOL)getConfigChanged;
+- (void)collapsAll;
 
 - (void)showPanel;
 - (void)initStrings;
index f502328c64c3a9f8ae5bdcd6ff5aa4305334a337..32af2b9e6716a35c49a92fee738aa5a29ddd5658 100644 (file)
@@ -166,6 +166,28 @@ static VLCExtended *_o_sharedInstance = nil;
     }
 }
 
+- (void)collapsAll
+{
+    /* collaps all views so Cocoa saves the window position correctly */
+    if( o_adjImg_expanded )
+    {
+        [self extWin_exp_adjImg: nil];
+    }
+    if( o_audFlts_expanded )
+    {
+        [self extWin_exp_audFlts: nil];
+    }
+    if( o_vidFlts_expanded )
+    {
+        [self extWin_exp_vidFlts: nil];
+    }
+}
+
+- (BOOL)getConfigChanged
+{
+    return o_config_changed;
+}
+
 - (void)showPanel
 {
     /* get the correct slider values from the prefs, in case they were changed
@@ -204,8 +226,11 @@ static VLCExtended *_o_sharedInstance = nil;
         [o_sld_gamma setIntValue: (int)(10 * f_value) ];
     }
 
-    [o_sld_maxLevel setFloatValue: (config_GetFloat(p_intf, "norm-max-level") \
-        * 10)];
+    f_value = config_GetFloat( p_intf, "norm-max-level" );
+    if( f_value > 0 && f_value < 10 )
+    {
+        [o_sld_maxLevel setFloatValue: f_value ];
+    }
 
     [o_sld_opaque setFloatValue: (config_GetFloat( p_intf, \
         "macosx-opaqueness") * 100)];
@@ -316,6 +341,8 @@ static VLCExtended *_o_sharedInstance = nil;
         }
         vlc_object_release( p_vout );
     }
+
+    o_config_changed = YES;
 }
 
 /* change the opaqueness of the vouts */
@@ -359,6 +386,8 @@ static VLCExtended *_o_sharedInstance = nil;
     config_PutFloat( p_playlist , "macosx-opaqueness" , val.f_float );
     
     vlc_object_release( p_playlist );
+
+    o_config_changed = YES;
 }
 
 - (IBAction)audFtls_hdphnVirt:(id)sender
@@ -380,13 +409,12 @@ static VLCExtended *_o_sharedInstance = nil;
                                  VLC_OBJECT_AOUT, FIND_ANYWHERE);
     if( p_aout != NULL )
     {
-        var_SetFloat( p_aout, "norm-max-level", [o_sld_maxLevel floatValue] / 10 );
+        var_SetFloat( p_aout, "norm-max-level", [o_sld_maxLevel floatValue] );
         vlc_object_release( p_aout );
     }
-    else
-    {
-        config_PutFloat( p_intf, "norm-max-level", [o_sld_maxLevel floatValue] /10 );
-    }
+    config_PutFloat( p_intf, "norm-max-level", [o_sld_maxLevel floatValue] );
+
+    o_config_changed = YES;
 }
 
 - (IBAction)audFtls_vlmeNorm:(id)sender
@@ -652,11 +680,16 @@ static VLCExtended *_o_sharedInstance = nil;
     }
 
     free( psz_string );
+
+    o_config_changed = YES;
 }
 
 
 - (void)changeAFiltersString: (char *)psz_name onOrOff: (vlc_bool_t )b_add;
 {
+    /* copied from ../wxwidgets/extrapanel.cpp
+     * renamed to conform with Cocoa's rules */
+
     char *psz_parser, *psz_string;
     intf_thread_t * p_intf = VLCIntf;
     aout_instance_t * p_aout= (aout_instance_t *)vlc_object_find(p_intf,
@@ -725,6 +758,8 @@ static VLCExtended *_o_sharedInstance = nil;
         vlc_object_release( p_aout );
     }
     free( psz_string );
+
+    o_config_changed = YES;
 }
 
 - (void)savePrefs
@@ -735,6 +770,9 @@ static VLCExtended *_o_sharedInstance = nil;
         FIND_ANYWHERE );
     int returnedValue;
     
+    /* FIXME: we should only save the settings actually changed in this panel
+     * and no other. This would make the termination much quicker and is better
+     * for people who are using cmd-line-options (trac #382) -- FK (10/6/05) */
     returnedValue = config_SaveConfigFile( p_playlist, NULL);
     if (returnedValue == 0)
     {
@@ -745,31 +783,4 @@ static VLCExtended *_o_sharedInstance = nil;
     }
     vlc_object_release( p_playlist );
 }
-
-
-/*****************************************************************************
- * delegate method
- *****************************************************************************/
-
-- (BOOL)applicationShouldTerminate:(NSWindow *)sender
-{
-    /* collaps all views so Cocoa saves the window position correctly */
-    if( o_adjImg_expanded )
-    {
-        [self extWin_exp_adjImg: nil];
-    }
-    if( o_audFlts_expanded )
-    {
-        [self extWin_exp_audFlts: nil];
-    }
-    if( o_vidFlts_expanded )
-    {
-        [self extWin_exp_vidFlts: nil];
-    }
-
-    /* save the prefs before shutting down */
-    [self savePrefs];
-    
-    return YES;
-}
 @end
index 650437603cbd44dc78371151d69c6de646114c74..da34feb90d613d880f7467f0e0d9a6e8882a95a6 100644 (file)
@@ -432,17 +432,6 @@ static VLCMain *_o_sharedMainInstance = nil;
     nib_main_loaded = TRUE;
 }
 
-- (void)dealloc
-{
-    [o_about release];
-    [o_prefs release];
-    [o_open release];
-    [o_extended release];
-    [o_bookmarks release];
-    
-    [super dealloc];
-}
-
 - (void)initStrings
 {
     [o_window setTitle: _NS("VLC - Controller")];
@@ -1413,6 +1402,35 @@ static VLCMain *_o_sharedMainInstance = nil;
         o_msg_lock = nil;
     }
 
+    /* save the prefs if they were changed in the extended panel */
+    if (o_extended && [o_extended getConfigChanged])
+    {
+        [o_extended savePrefs];
+    }
+
+    /* release some other objects here, because it isn't sure whether dealloc
+     * will be called later on -- FK (10/6/05) */
+    if ( o_about )
+        [o_about release];
+    
+    if ( o_prefs )
+        [o_prefs release];
+    
+    if ( o_open )
+        [o_open release];
+    
+    if ( o_extended )
+    {
+        [o_extended collapsAll];
+        [o_extended release];
+    }
+    
+    if ( o_bookmarks )
+        [o_bookmarks release];
+
+    if ( o_wizard )
+        [o_wizard release];
+
     /* write cached user defaults to disk */
     [[NSUserDefaults standardUserDefaults] synchronize];