]> git.sesse.net Git - vlc/commitdiff
Group selection combo box in stream proprieties dialog. Also allows to create new...
authorBenjamin Pracht <bigben@videolan.org>
Sat, 3 Apr 2004 20:58:32 +0000 (20:58 +0000)
committerBenjamin Pracht <bigben@videolan.org>
Sat, 3 Apr 2004 20:58:32 +0000 (20:58 +0000)
extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib
extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib
extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib
modules/gui/macosx/playlist.h
modules/gui/macosx/playlist.m
modules/gui/macosx/playlistinfo.h
modules/gui/macosx/playlistinfo.m

index accd75311383d65790d50b46e3edbe97cffc2060..c313ed8b24e14cb89f6952e1fa5f22faee733786 100644 (file)
             SUPERCLASS = NSObject; 
         }, 
         {
-            ACTIONS = {infoCancel = id; infoOk = id; togglePlaylistInfoPanel = id; }; 
+            ACTIONS = {
+                handleGroup = id; 
+                infoCancel = id; 
+                infoOk = id; 
+                togglePlaylistInfoPanel = id; 
+            }; 
             CLASS = VLCPlaylistInfo; 
             LANGUAGE = ObjC; 
             OUTLETS = {
                 "o_author_txt" = id; 
                 "o_btn_cancel" = id; 
                 "o_btn_ok" = id; 
+                "o_group_cbx" = id; 
+                "o_group_color" = id; 
+                "o_group_lbl" = id; 
                 "o_info_window" = id; 
                 "o_outline_view" = id; 
                 "o_title_lbl" = id; 
index b5e0e9248775dbb5d47be28d89be030cc8c46d1b..4983e5c058c37bc0be73aebc4f730a8928153d9e 100644 (file)
@@ -3,7 +3,7 @@
 <plist version="1.0">
 <dict>
        <key>IBDocumentLocation</key>
-       <string>486 129 505 517 0 0 1024 746 </string>
+       <string>492 225 505 517 0 0 1024 746 </string>
        <key>IBEditorPositions</key>
        <dict>
                <key>1617</key>
@@ -19,8 +19,8 @@
        <array/>
        <key>IBOpenObjects</key>
        <array>
-               <integer>1789</integer>
                <integer>21</integer>
+               <integer>1789</integer>
        </array>
        <key>IBSystem Version</key>
        <string>7F44</string>
index 66ba9a6fa2f17fd15ba1c613ef973c1b175e558e..0e781eac51136495945cc4602e810ab4bc474f8c 100644 (file)
Binary files a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib and b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib differ
index a4b911cd3effbe5eb75f5db3492b42ee7b57c5ed..f2008dd5c5ee456b65e386ee300034bdf86c7509 100644 (file)
 {
     int i_moveRow;
     bool b_isSortDescending;
-    
+
     IBOutlet id o_window;
     IBOutlet id o_btn_playlist;
     IBOutlet id o_table_view;
-    
+
     IBOutlet id o_status_field;
     IBOutlet id o_tc_id;
     IBOutlet id o_tc_name;
@@ -70,9 +70,9 @@
     IBOutlet id o_uri_lbl;
     IBOutlet id o_title_lbl;
     IBOutlet id o_author_lbl;
-    IBOutlet id o_uri_txt; 
-    IBOutlet id o_title_txt; 
-    IBOutlet id o_author_txt; 
+    IBOutlet id o_uri_txt;
+    IBOutlet id o_title_txt;
+    IBOutlet id o_author_txt;
     IBOutlet id o_btn_info_ok;
     IBOutlet id o_btn_info_cancel;
     IBOutlet id o_tbv_info;
 /*For playlist info window*/
 
 - (int)selectedPlaylistItem;
+- (NSColor *)getColor:(int)i_group;
 
 @end
 
index e9f26f27ee33a494f0c80c850fb89b6937ec6d8b..bca93c08b73dedf8e7d5515ee7f2927f5a24c689 100644 (file)
@@ -621,6 +621,53 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
     return [o_table_view selectedRow];
 }
 
+- (NSColor *)getColor:(int)i_group
+{
+    switch ( i_group % 8 )
+    {
+        case 1:
+            /*white*/
+            return [NSColor colorWithDeviceRed:1.0 green:1.0 blue:1.0 alpha:1.0];
+        break;
+
+        case 2:
+            /*red*/
+           return [NSColor colorWithDeviceRed:1.0 green:0.76471 blue:0.76471 alpha:1.0];
+        break;
+
+           case 3:
+              /*dark blue*/
+                  return [NSColor colorWithDeviceRed:0.76471 green:0.76471 blue:1.0 alpha:1.0];
+        break; 
+
+        case 4:
+               /*orange*/
+           return [NSColor colorWithDeviceRed:1.0 green:0.89804 blue:0.76471 alpha:1.0];
+        break;
+
+        case 5:
+               /*purple*/
+           return [NSColor colorWithDeviceRed:1.0 green:0.76471 blue:1.0 alpha:1.0];
+        break;
+        case 6:
+              /*green*/
+           return [NSColor colorWithDeviceRed:0.76471 green:1.0 blue:0.76471 alpha:1.0];
+        break; 
+
+        case 7:
+              /*light blue*/
+           return [NSColor colorWithDeviceRed:0.76471 green:1.0 blue:1.0 alpha:1.0];
+        break;
+
+        case 0:
+              /*yellow*/
+           return [NSColor colorWithDeviceRed:1.0 green:1.0 blue:0.76471 alpha:1.0];
+        break;
+       }
+}
+
+
 @end
 
 @implementation VLCPlaylist (NSTableDataSource)
@@ -712,49 +759,10 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
     if ((p_playlist->i_groups) > 1 )
     {
        [o_cell setDrawsBackground: VLC_TRUE];
-       switch ( p_playlist->pp_items[o_rows]->i_group % 8 )
-       {
-            case 1:
-              /*white*/
-              [o_cell setBackgroundColor: [NSColor colorWithDeviceRed:1.0 green:1.0 blue:1.0 alpha:1.0]];
-              break;
-
-            case 2:
-              /*red*/
-             [o_cell setBackgroundColor: [NSColor colorWithDeviceRed:1.0 green:0.76471 blue:0.76471 alpha:1.0]];
-           break;
+       [o_cell setBackgroundColor:
+                [self getColor:p_playlist->pp_items[o_rows]->i_group]];
 
-           case 3:
-              /*dark blue*/
-                  [o_cell setBackgroundColor: [NSColor colorWithDeviceRed:0.76471 green:0.76471 blue:1.0 alpha:1.0]];
-            break; 
-
-            case 4:
-               /*orange*/
-                   [o_cell setBackgroundColor: [NSColor colorWithDeviceRed:1.0 green:0.89804 blue:0.76471 alpha:1.0]];
-            break;
-
-            case 5:
-                /*purple*/
-                   [o_cell setBackgroundColor: [NSColor colorWithDeviceRed:1.0 green:0.76471 blue:1.0 alpha:1.0]];
-            break;
-            case 6:
-                /*green*/
-                   [o_cell setBackgroundColor: [NSColor colorWithDeviceRed:0.76471 green:1.0 blue:0.76471 alpha:1.0]];
-            break; 
-
-            case 7:
-               /*light blue*/
-                   [o_cell setBackgroundColor: [NSColor colorWithDeviceRed:0.76471 green:1.0 blue:1.0 alpha:1.0]];
-            break;
-
-            case 0:
-               /*yellow*/
-                   [o_cell setBackgroundColor: [NSColor colorWithDeviceRed:1.0 green:1.0 blue:0.76471 alpha:1.0]];
-            break;
-       }
-     
+    
     }
 vlc_object_release( p_playlist );
 }
index 120436daa5b6d701b7d030c5c80e78a3b8e2ed1a..cb05022dc3809c51531ac469db6f75e1e5ff1b1c 100644 (file)
     IBOutlet id o_btn_info_cancel;
     IBOutlet id o_outline_view;
     IBOutlet id o_vlc_playlist;
+    IBOutlet id o_group_lbl;
+    IBOutlet id o_group_cbx;
+    IBOutlet id o_group_color;
 }
 
 - (IBAction)togglePlaylistInfoPanel:(id)sender;
 - (IBAction)infoCancel:(id)sender;
 - (IBAction)infoOk:(id)sender;
+- (IBAction)handleGroup:(id)sender;
 
 @end
 
index a83f1985ef9fa5cdc749bfe60b517192a4710c44..749a8178850b4e191c7a0fe59a56995c2bc611b5 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
* playlistinfo.m: MacOS X interface module
r playlistinfo.m: MacOS X interface module
  *****************************************************************************
  * Copyright (C) 2002-2004 VideoLAN
  * $Id: playlistinfo.m 7015 2004-03-08 15:22:58Z bigben $
@@ -37,7 +37,6 @@
 
 - (void)awakeFromNib
 {
-
     [o_info_window setExcludedFromWindowsMenu: TRUE];
 
     [o_info_window setTitle: _NS("Properties")];
@@ -46,6 +45,7 @@
     [o_author_lbl setStringValue: _NS("Author")];
     [o_btn_info_ok setTitle: _NS("OK")];
     [o_btn_info_cancel setTitle: _NS("Cancel")];
+    [o_group_lbl setStringValue: _NS("Group")];
 }
 
 - (IBAction)togglePlaylistInfoPanel:(id)sender
@@ -65,6 +65,7 @@
         if (p_playlist)
         {
             /*fill uri / title / author info */
+            int i;
             int i_item = [o_vlc_playlist selectedPlaylistItem];
             [o_uri_txt setStringValue:
                 ([NSString stringWithUTF8String:p_playlist->
                 [NSString stringWithUTF8String:p_playlist->
                     pp_items[i_item]->input.psz_name]];
 
-            [o_author_txt setStringValue:[NSString stringWithUTF8String: playlist_GetInfo(p_playlist, i_item ,_("General"),_("Author") )]];
+            [o_author_txt setStringValue:
+                [NSString stringWithUTF8String:playlist_GetInfo
+                (p_playlist, i_item ,_("General"),_("Author") )]];
 
             [[VLCInfoTreeItem rootItem] refresh];
             [o_outline_view reloadData];
+
+            [o_group_cbx removeAllItems];
+
+            for (i = 0; i < p_playlist->i_groups ; i++)
+            {
+                [o_group_cbx addItemWithObjectValue: 
+                    [NSString stringWithUTF8String:
+                    p_playlist->pp_groups[i]->psz_name]];
+                if (p_playlist->pp_items[i_item]->i_group == p_playlist
+                    ->pp_groups[i]->i_id)
+                {
+                    [o_group_cbx selectItemAtIndex:i];
+                }
+            }
+
+            [self handleGroup:self];
+
             vlc_object_release( p_playlist );
         }
         [o_info_window makeKeyAndOrderFront: sender];
         p_playlist->pp_items[i_item]->input.psz_name =
             strdup([[o_title_txt stringValue] cString]);
         playlist_ItemAddInfo(p_playlist->pp_items[i_item],_("General"),_("Author"), [[o_author_txt stringValue] cString]);
+
+        if ([[o_group_cbx stringValue] isEqual:
+                    [o_group_cbx objectValueOfSelectedItem]])
+        {
+            p_playlist->pp_items[i_item]->i_group = p_playlist->
+                    pp_groups[[o_group_cbx indexOfSelectedItem]]->i_id; 
+        }
+        else
+        {
+            playlist_group_t * p_group = playlist_CreateGroup( p_playlist, 
+                strdup([[o_group_cbx stringValue] cString]));
+            p_playlist->pp_items[i_item]->i_group = p_group->i_id;
+        }
+
+
         vlc_mutex_unlock(&p_playlist->pp_items[i_item]->input.lock);
         val.b_bool = VLC_TRUE;
         var_Set( p_playlist,"intf-change",val );
     [self togglePlaylistInfoPanel:self];
 }
 
+- (IBAction)handleGroup:(id)sender
+{
+    intf_thread_t * p_intf = [NSApp getIntf];
+    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+                                          FIND_ANYWHERE );
+
+    if (p_playlist)
+    {
+        if ([[o_group_cbx stringValue] isEqual: 
+                    [o_group_cbx objectValueOfSelectedItem]])
+        {
+            [o_group_color setBackgroundColor:[o_vlc_playlist 
+                getColor: p_playlist->pp_groups[
+                [o_group_cbx indexOfSelectedItem]]->i_id]];
+        }
+        else
+        {
+            [o_group_color setBackgroundColor:[o_vlc_playlist 
+                getColor:p_playlist->pp_groups[
+                [o_group_cbx numberOfItems] - 1]->i_id + 1]];
+        }
+    vlc_object_release(p_playlist);
+    }
+}
 
 @end