Commit 9e42c869 authored by Benjamin Pracht's avatar Benjamin Pracht

Group selection combo box in stream proprieties dialog. Also allows to create new groups.

parent 7ce614bd
......@@ -366,7 +366,12 @@
SUPERCLASS = NSObject;
},
{
ACTIONS = {infoCancel = id; infoOk = id; togglePlaylistInfoPanel = id; };
ACTIONS = {
handleGroup = id;
infoCancel = id;
infoOk = id;
togglePlaylistInfoPanel = id;
};
CLASS = VLCPlaylistInfo;
LANGUAGE = ObjC;
OUTLETS = {
......@@ -374,6 +379,9 @@
"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;
......
......@@ -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>
......
......@@ -38,11 +38,11 @@
{
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;
......@@ -100,6 +100,7 @@
/*For playlist info window*/
- (int)selectedPlaylistItem;
- (NSColor *)getColor:(int)i_group;
@end
......@@ -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 );
}
......
......@@ -39,11 +39,15 @@
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
......
/*****************************************************************************
* 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->
......@@ -82,10 +83,29 @@
[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];
......@@ -115,7 +135,21 @@
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 );
......@@ -124,6 +158,30 @@
[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
......
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