]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/sfilters.m
Removes trailing spaces. Removes tabs.
[vlc] / modules / gui / macosx / sfilters.m
index bffa3be406845d19a5663c1924de979572e52992..fbeb961c5ddcef9a1bb50561fef339684b42fcff 100644 (file)
 
 
 /*****************************************************************************
- * Note: 
- * the code used to bind with VLC's core is partially based upon the 
- * RC-interface, written by Antoine Cellerier and Mark F. Moriarty  
- * (members of the VideoLAN team) 
+ * Note:
+ * the code used to bind with VLC's core is partially based upon the
+ * RC-interface, written by Antoine Cellerier and Mark F. Moriarty
+ * (members of the VideoLAN team)
  *****************************************************************************/
 
 #import "sfilters.h"
@@ -98,7 +98,7 @@ static VLCsFilters *_o_sharedInstance = nil;
 - (void)awakeFromNib
 {
     /* colors as implemented at the beginning of marq.c and time.c
-     * feel free to add more colors, but remember to add them to these files 
+     * feel free to add more colors, but remember to add them to these files
      * as well to keep a certain level of consistency across the interfaces */
     NSArray * o_default;
     NSArray * o_black;
@@ -141,79 +141,28 @@ static VLCsFilters *_o_sharedInstance = nil;
     unsigned int x = 0;
     [o_marq_color_pop removeAllItems];
     [o_time_color_pop removeAllItems];
-    
-    /* we are adding tags to the items, so we can easily identify them even if 
+    /* we are adding tags to the items, so we can easily identify them even if
      * the menu was sorted */
     while (x != [o_colors count])
     {
         [o_marq_color_pop addItemWithTitle: [[o_colors objectAtIndex:x]
             objectAtIndex:0]];
         [[o_marq_color_pop lastItem] setTag: x];
-        
         [o_time_color_pop addItemWithTitle: [[o_colors objectAtIndex:x]
             objectAtIndex:0]];
         [[o_time_color_pop lastItem] setTag: x];
-        
         x = (x + 1);
     }
 
     [o_marq_color_pop selectItemAtIndex:0];
     [o_time_color_pop selectItemAtIndex:0];
 
-    /* define the relative positions and copy them to the menues
-     * we can destroy the array afterwards, because we are saving the ints 
-     * as tags to the menu-items */
-    /*NSArray * o_cnt_cnt;
-    NSArray * o_lft_cnt;
-    NSArray * o_rht_cnt;
-    NSArray * o_cnt_top;
-    NSArray * o_lft_top;
-    NSArray * o_rht_top;
-    NSArray * o_cnt_btm;
-    NSArray * o_lft_btm;
-    NSArray * o_rht_btm;
-    NSArray * o_positions;
-    o_cnt_cnt = [NSArray arrayWithObjects: _NS("Center-Center"), @"0", nil];
-    o_lft_cnt = [NSArray arrayWithObjects: _NS("Left-Center"), @"1", nil];
-    o_rht_cnt = [NSArray arrayWithObjects: _NS("Right-Center"), @"2", nil];
-    o_cnt_top = [NSArray arrayWithObjects: _NS("Center-Top"), @"4", nil];
-    o_lft_top = [NSArray arrayWithObjects: _NS("Left-Top"), @"5", nil];
-    o_rht_top = [NSArray arrayWithObjects: _NS("Right-Top"), @"6", nil];
-    o_cnt_btm = [NSArray arrayWithObjects: _NS("Center-Bottom"), @"8", nil];
-    o_lft_btm = [NSArray arrayWithObjects: _NS("Left-Bottom"), @"9", nil];
-    o_rht_btm = [NSArray arrayWithObjects: _NS("Right-Bottom"), @"10", nil];
-    o_positions = [[NSArray alloc] initWithObjects: o_cnt_cnt, o_lft_cnt,
-        o_rht_cnt, o_cnt_top, o_lft_top, o_rht_top, o_cnt_btm, o_lft_btm,
-        o_rht_btm, nil];
-        
-    x = 0;
-    [o_time_pos_rel_pop removeAllItems];
-    [o_marq_pos_rel_pop removeAllItems];
-    [o_logo_pos_rel_pop removeAllItems];
-    
-    * we are adding a tag here, so we can easily select an item later on *
-    while ( x != [o_positions count] )
-    {
-        [o_time_pos_rel_pop addItemWithTitle: [[o_positions objectAtIndex:x]
-            objectAtIndex:0]];
-        [[o_time_pos_rel_pop lastItem] setTag: [[[o_positions objectAtIndex:x]
-            objectAtIndex:1] intValue]];
-        [o_marq_pos_rel_pop addItemWithTitle: [[o_positions objectAtIndex:x]
-            objectAtIndex:0]];
-        [[o_marq_pos_rel_pop lastItem] setTag: [[[o_positions objectAtIndex:x]
-            objectAtIndex:1] intValue]];
-        [o_logo_pos_rel_pop addItemWithTitle: [[o_positions objectAtIndex:x]
-            objectAtIndex:0]];
-        [[o_logo_pos_rel_pop lastItem] setTag: [[[o_positions objectAtIndex:x]
-            objectAtIndex:1] intValue]];
-
-        x = (x + 1);
-    }
-    [o_positions release];*/
-
     NSArray * o_sizes;
     o_sizes = [[NSArray alloc] initWithObjects: @"6", @"8", @"10", @"11", @"12",\
-        @"14", @"13", @"16", @"18", @"24", @"36", @"48", @"64", @"72", @"96",
+        @"13", @"14", @"16", @"18", @"24", @"36", @"48", @"64", @"72", @"96",
         @"144", @"288", nil];
     [o_marq_size_pop removeAllItems];
     [o_marq_size_pop addItemsWithTitles: o_sizes];
@@ -224,7 +173,7 @@ static VLCsFilters *_o_sharedInstance = nil;
 
 - (void)showAsPanel
 {
-       char * psz_temp;
+    char * psz_temp;
 
     /* called from intf.m */
     [o_sfilter_win displayIfNeeded];
@@ -239,7 +188,7 @@ static VLCsFilters *_o_sharedInstance = nil;
         NULL, 0) != tempInt )
     {
         x = (x + 1);
-        
         if( x >= [o_marq_color_pop numberOfItems] )
         {
             x = 0;
@@ -247,22 +196,22 @@ static VLCsFilters *_o_sharedInstance = nil;
         }
     }
     [o_marq_color_pop selectItemAtIndex: x];
-       if( psz_temp = config_GetPsz( p_intf, "time-format" ) )
-               [o_marq_marq_fld setStringValue: [NSString stringWithUTF8String: psz_temp]];
-       else
-               [o_marq_marq_fld setStringValue: _NS(@"Not Available")];
-       
-       [o_marq_opaque_sld setIntValue: config_GetInt( p_intf, "marq-opacity")];
+    if( psz_temp = config_GetPsz( p_intf, "time-format" ) )
+        [o_marq_marq_fld setStringValue: [NSString stringWithUTF8String: psz_temp]];
+    else
+        [o_marq_marq_fld setStringValue: _NS("Not Available")];
+    [o_marq_opaque_sld setIntValue: config_GetInt( p_intf, "marq-opacity")];
     [o_marq_pos_radio selectCellWithTag: config_GetInt( p_intf, "marq-position" )];
     /* FIXME: the following line doesn't work with "-1", which is the default
      * value */
-    [o_marq_size_pop selectItemWithTitle: 
+    [o_marq_size_pop selectItemWithTitle:
         [[NSNumber numberWithInt: config_GetInt( p_intf, "marq-size" )]
             stringValue]];
     [o_marq_size_pop selectItemAtIndex: x];
     [o_marq_tmOut_fld setStringValue: [[NSNumber numberWithInt:
         config_GetInt( p_intf, "marq-timeout" )] stringValue]];
-    
     /* retrieve the time settings */
     x = 0;
     tempInt = config_GetInt( p_intf, "time-color" );
@@ -270,7 +219,7 @@ static VLCsFilters *_o_sharedInstance = nil;
         NULL, 0) != tempInt )
     {
         x = (x + 1);
-        
         if( x >= [o_time_color_pop numberOfItems] )
         {
             x = 0;
@@ -278,18 +227,18 @@ static VLCsFilters *_o_sharedInstance = nil;
         }
     }
     [o_time_color_pop selectItemAtIndex: x];
-       if( psz_temp = config_GetPsz( p_intf, "time-format" ) )
-               [o_time_stamp_fld setStringValue: [NSString stringWithUTF8String: psz_temp]];
-       else
-               [o_time_stamp_fld setStringValue: _NS(@"Not Available")];
+    if( psz_temp = config_GetPsz( p_intf, "time-format" ) )
+        [o_time_stamp_fld setStringValue: [NSString stringWithUTF8String: psz_temp]];
+    else
+        [o_time_stamp_fld setStringValue: _NS("Not Available")];
 
     [o_time_opaque_sld setIntValue: config_GetInt( p_intf, "time-opacity")];
     /* FIXME: the following line doesn't work with "-1", which is the default
      * value */
-    [o_time_size_pop selectItemWithTitle: 
+    [o_time_size_pop selectItemWithTitle:
         [[NSNumber numberWithInt: config_GetInt( p_intf, "time-size" )]
             stringValue]];
-    [o_time_pos_radio selectCellWithTag: config_GetInt( p_intf, "time-position" )];    
+    [o_time_pos_radio selectCellWithTag: config_GetInt( p_intf, "time-position" )];
 
     /* retrieve the logo settings */
     [o_logo_opaque_sld setIntValue: config_GetInt( p_intf, "logo-transparency")];
@@ -299,7 +248,7 @@ static VLCsFilters *_o_sharedInstance = nil;
     else
         [o_logo_image_fld setStringValue: @""];
     [o_logo_pos_radio selectCellWithTag: config_GetInt( p_intf, "logo-position" )];
-    
     /* enable the requested filters */
     char * psz_subfilters;
     psz_subfilters = config_GetPsz( p_intf, "sub-filter" );
@@ -309,12 +258,12 @@ static VLCsFilters *_o_sharedInstance = nil;
             [o_marq_enabled_ckb setState: YES];
         else
             [o_marq_enabled_ckb setState: NO];
-        
         if( strstr( psz_subfilters, "logo") )
             [o_logo_enabled_ckb setState: YES];
         else
             [o_logo_enabled_ckb setState: NO];
-        
         if( strstr( psz_subfilters, "time") )
             [o_time_enabled_ckb setState: YES];
         else
@@ -340,8 +289,8 @@ static VLCsFilters *_o_sharedInstance = nil;
     if (returnCode == NSOKButton)
     {
         [o_logo_image_fld setStringValue: [sheet filename]];
-               /* Make sure we notice that */
-               [self propertyChanged: o_logo_image_fld];
+        /* Make sure we notice that */
+        [self propertyChanged: o_logo_image_fld];
     }
 }
 
@@ -356,7 +305,7 @@ static VLCsFilters *_o_sharedInstance = nil;
     /* general properties */
     if( sender == o_sfilter_saveSettings_ckb)
     {
-        o_save_settings = [o_sfilter_saveSettings_ckb state]; 
+        o_save_settings = [o_sfilter_saveSettings_ckb state];
     }
 
     /* marquee */
@@ -372,64 +321,64 @@ static VLCsFilters *_o_sharedInstance = nil;
         }
 
         if( p_input )
-            var_Set( p_input->p_libvlc_global, "marq-marquee", val );
+            var_Set( p_input->p_libvlc, "marq-marquee", val );
 
         config_PutPsz( p_intf, "marq-marquee", val.psz_string );
     }
-    
+
     else if( sender == o_marq_pos_radio )
     {
         val.i_int = [[o_marq_pos_radio selectedCell] tag];
 
         if( p_input )
-            var_Set( p_input->p_libvlc_global, "marq-position", val );
+            var_Set( p_input->p_libvlc, "marq-position", val );
 
         config_PutInt( p_intf, "marq-position", val.i_int );
     }
-    
+
     else if( sender == o_marq_color_pop )
     {
         val.i_int = strtol( [[[o_colors objectAtIndex: [o_marq_color_pop
             indexOfSelectedItem]] objectAtIndex: 1] UTF8String], NULL, 0 );
 
         if( p_input )
-            var_Set( p_input->p_libvlc_global, "marq-color", val );
+            var_Set( p_input->p_libvlc, "marq-color", val );
 
         config_PutInt( p_intf, "marq-color", val.i_int );
     }
-    
+
     else if( sender == o_marq_opaque_sld )
     {
         val.i_int = [o_marq_opaque_sld intValue];
 
         if( p_input )
-            var_Set( p_input->p_libvlc_global, "marq-opacity", val );
+            var_Set( p_input->p_libvlc, "marq-opacity", val );
 
         config_PutInt( p_intf, "marq-opacity", val.i_int );
     }
-    
+
     else if( sender == o_marq_size_pop )
     {
         val.i_int = [[o_marq_size_pop titleOfSelectedItem] intValue];
 
         if( p_input )
-            var_Set( p_input->p_libvlc_global, "marq-size", val );
+            var_Set( p_input->p_libvlc, "marq-size", val );
 
         config_PutInt( p_intf, "marq-size", val.i_int );
     }
-    
+
     else if( sender == o_marq_tmOut_fld && [[sender stringValue] length] > 0 )
     {
         val.i_int = [o_marq_tmOut_fld intValue];
 
         if( p_input )
-            var_Set( p_input->p_libvlc_global, "marq-timeout", val );
+            var_Set( p_input->p_libvlc, "marq-timeout", val );
 
         config_PutInt( p_intf, "marq-timeout", val.i_int );
     }
-    
     /* time */
-    
     else if( sender == o_time_stamp_fld )
     {
         if( [[o_time_stamp_fld stringValue] length] == 0 )
@@ -442,7 +391,7 @@ static VLCsFilters *_o_sharedInstance = nil;
         }
 
         if( p_input )
-            var_Set( p_input->p_libvlc_global, "time-format", val );
+            var_Set( p_input->p_libvlc, "time-format", val );
 
         config_PutPsz( p_intf, "time-format", val.psz_string );
     }
@@ -452,38 +401,38 @@ static VLCsFilters *_o_sharedInstance = nil;
         val.i_int = [[o_time_pos_radio selectedCell] tag];
 
         if( p_input )
-            var_Set( p_input->p_libvlc_global, "time-position", val );
+            var_Set( p_input->p_libvlc, "time-position", val );
 
         config_PutInt( p_intf, "time-position", val.i_int );
     }
-    
+
     else if( sender == o_time_color_pop )
     {
         val.i_int = strtol( [[[o_colors objectAtIndex: [o_time_color_pop
             indexOfSelectedItem]] objectAtIndex: 1] UTF8String], NULL, 0 );
 
         if( p_input )
-            var_Set( p_input->p_libvlc_global, "time-color", val );
+            var_Set( p_input->p_libvlc, "time-color", val );
 
         config_PutInt( p_intf, "time-color", val.i_int );
     }
-    
+
     else if( sender == o_time_opaque_sld )
     {
         val.i_int = [o_time_opaque_sld intValue];
 
         if( p_input )
-            var_Set( p_input->p_libvlc_global, "time-opacity", val );
+            var_Set( p_input->p_libvlc, "time-opacity", val );
 
         config_PutInt( p_intf, "time-opacity", val.i_int );
     }
-    
+
     else if( sender == o_time_size_pop )
     {
         val.i_int = [[o_time_size_pop titleOfSelectedItem] intValue];
 
         if( p_input )
-            var_Set( p_input->p_libvlc_global, "time-size", val );
+            var_Set( p_input->p_libvlc, "time-size", val );
 
         config_PutInt( p_intf, "time-size", val.i_int );
     }
@@ -494,30 +443,30 @@ static VLCsFilters *_o_sharedInstance = nil;
         val.i_int = [o_logo_opaque_sld intValue];
 
         if( p_input )
-            var_Set( p_input->p_libvlc_global, "logo-transparency", val );
+            var_Set( p_input->p_libvlc, "logo-transparency", val );
 
         config_PutInt( p_intf, "logo-transparency", val.i_int );
     }
-    
+
     else if( sender == o_logo_pos_radio )
     {
         val.i_int = [[o_logo_pos_radio selectedCell] tag];
 
         if( p_input )
-            var_Set( p_input->p_libvlc_global, "logo-position", val );
+            var_Set( p_input->p_libvlc, "logo-position", val );
 
         config_PutInt( p_intf, "logo-position", val.i_int );
     }
     else if ( sender == o_logo_image_fld )
-       {
-        val.psz_string = [[o_logo_image_fld stringValue] cString];
+    {
+        val.psz_string = (char *)[[o_logo_image_fld stringValue] UTF8String];
 
         if( p_input )
-            var_Set( p_input->p_libvlc_global, "logo-file", val );
+            var_Set( p_input->p_libvlc, "logo-file", val );
 
         config_PutPsz( p_intf, "logo-file", val.psz_string );
-       }
-       else
+    }
+    else
     {
         /* just in case */
         msg_Err( p_intf, "couldn't find any action for sender" );
@@ -568,7 +517,7 @@ static VLCsFilters *_o_sharedInstance = nil;
             [self changeFiltersString:(char *)"time" onOrOff:VLC_FALSE];
         }
         [self enableTime];
-    }    
+    }
 }
 
 - (void)enableMarq
@@ -605,10 +554,10 @@ static VLCsFilters *_o_sharedInstance = nil;
      * and slightly modified to suit our needs */
 
     intf_thread_t * p_intf = VLCIntf;
-    
     char *psz_parser, *psz_string;
     psz_string = config_GetPsz( p_intf, "sub-filter" );
-    
     if( !psz_string ) psz_string = strdup("");
 
     psz_parser = strstr( psz_string, psz_name );
@@ -647,9 +596,9 @@ static VLCsFilters *_o_sharedInstance = nil;
              return;
          }
     }
-    
     config_PutPsz( p_intf, "sub-filter", psz_string );
-    
     /* Try to set on the fly */
     /* FIXME: enable this once we support on-the-fly addition of this kind of
      * filters... */