Commit 8ca4334d authored by Jon Lech Johansen's avatar Jon Lech Johansen

MacOS X port:

  * replaced playlist panel with drawer.
  * implemented context menu for playlist tableview.
parent 7bcedb58
......@@ -171,9 +171,16 @@
SUPERCLASS = NSObject;
},
{
ACTIONS = {deleteItems = id; playItem = id; selectAll = id; };
CLASS = VLCPlaylist;
LANGUAGE = ObjC;
OUTLETS = {"o_btn_close" = id; "o_panel" = id; "o_table_view" = id; };
OUTLETS = {
"o_ctx_menu" = id;
"o_mi_delete" = id;
"o_mi_play" = id;
"o_mi_selectall" = id;
"o_table_view" = id;
};
SUPERCLASS = NSObject;
},
{CLASS = VLCPlaylistView; LANGUAGE = ObjC; SUPERCLASS = NSTableView; }
......
......@@ -3,22 +3,20 @@
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>61 306 428 434 0 0 1152 746 </string>
<string>95 526 428 434 0 0 1600 1178 </string>
<key>IBEditorPositions</key>
<dict>
<key>29</key>
<string>266 466 308 44 0 0 1152 746 </string>
<string>407 753 308 44 0 0 1600 1178 </string>
<key>303</key>
<string>93 566 72 114 0 0 1600 1178 </string>
<key>909</key>
<string>761 663 440 172 0 0 1600 1178 </string>
<key>915</key>
<string>594 532 93 96 0 0 1600 1178 </string>
</dict>
<key>IBFramework Version</key>
<string>291.0</string>
<key>IBOpenObjects</key>
<array>
<integer>21</integer>
<integer>29</integer>
<integer>636</integer>
</array>
<key>IBSystem Version</key>
<string>6G30</string>
</dict>
......
......@@ -2,7 +2,7 @@
* playlist.h: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: playlist.h,v 1.1 2002/08/04 17:23:43 sam Exp $
* $Id: playlist.h,v 1.2 2003/01/05 03:21:50 jlj Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
*
......@@ -36,12 +36,22 @@
*****************************************************************************/
@interface VLCPlaylist : NSObject
{
IBOutlet id o_panel;
IBOutlet id o_btn_close;
IBOutlet id o_table_view;
IBOutlet id o_ctx_menu;
IBOutlet id o_mi_play;
IBOutlet id o_mi_delete;
IBOutlet id o_mi_selectall;
}
- (NSMenu *)menuForEvent:(NSEvent *)o_event;
- (IBAction)playItem:(id)sender;
- (IBAction)deleteItems:(id)sender;
- (IBAction)selectAll:(id)sender;
- (void)appendArray:(NSArray*)o_array atPos:(int)i_pos;
- (void)playlistUpdated;
@end
......@@ -2,7 +2,7 @@
* playlist.m: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: playlist.m,v 1.2 2002/09/23 23:05:58 massiot Exp $
* $Id: playlist.m,v 1.3 2003/01/05 03:21:50 jlj Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
*
......@@ -43,9 +43,7 @@
- (NSMenu *)menuForEvent:(NSEvent *)o_event
{
/* TODO */
return( nil );
return( [[self delegate] menuForEvent: o_event] );
}
@end
......@@ -61,13 +59,14 @@
[o_table_view setDelegate: self];
[o_table_view setDataSource: self];
[o_table_view setDoubleAction: @selector(doubleClick:)];
[o_table_view setDoubleAction: @selector(playItem:)];
[o_table_view registerForDraggedTypes:
[NSArray arrayWithObjects: NSFilenamesPboardType, nil]];
[o_panel setTitle: _NS("Playlist")];
[o_btn_close setTitle: _NS("Close")];
[o_mi_play setTitle: _NS("Play")];
[o_mi_delete setTitle: _NS("Delete")];
[o_mi_selectall setTitle: _NS("Select All")];
}
- (BOOL)tableView:(NSTableView *)o_tv
......@@ -101,11 +100,6 @@
[self appendArray: o_values atPos: i_row];
if( i_row != -1 )
{
[o_table_view reloadData];
}
return( YES );
}
......@@ -115,25 +109,44 @@
- (void)tableView:(NSTableView *)o_tv willDisplayCell:(id)o_cell
forTableColumn:(NSTableColumn *)o_tc row:(int)i_row
{
NSColor * o_color;
[o_cell setDrawsBackground: YES];
if( i_row % 2 )
{
[o_cell setBackgroundColor:
[NSColor colorWithDeviceRed: 0.937255
green: 0.968627
blue: 1.0
alpha: 1.0]];
o_color = [[NSColor alternateSelectedControlColor]
highlightWithLevel: 0.90];
}
else
{
[o_cell setBackgroundColor: [NSColor whiteColor]];
o_color = [o_tv backgroundColor];
}
[o_cell setBackgroundColor: o_color];
}
- (IBAction)doubleClick:(id)sender
- (NSMenu *)menuForEvent:(NSEvent *)o_event
{
NSPoint pt;
vlc_bool_t b_rows;
vlc_bool_t b_item_sel;
pt = [o_table_view convertPoint: [o_event locationInWindow]
fromView: nil];
b_item_sel = ( [o_table_view rowAtPoint: pt] != -1 &&
[o_table_view selectedRow] != -1 );
b_rows = [o_table_view numberOfRows] != 0;
[o_mi_play setEnabled: b_item_sel];
[o_mi_delete setEnabled: b_item_sel];
[o_mi_selectall setEnabled: b_rows];
return( o_ctx_menu );
}
- (IBAction)playItem:(id)sender
{
NSTableView * o_tv = sender;
intf_thread_t * p_intf = [NSApp getIntf];
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
......@@ -143,11 +156,46 @@
return;
}
playlist_Goto( p_playlist, [o_tv clickedRow] );
playlist_Goto( p_playlist, [o_table_view selectedRow] );
vlc_object_release( p_playlist );
}
- (IBAction)deleteItems:(id)sender
{
int i_row;
intf_thread_t * p_intf = [NSApp getIntf];
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
while( ( i_row = [o_table_view selectedRow] ) != -1 )
{
if( p_playlist->i_index == i_row && p_playlist->i_status )
{
playlist_Stop( p_playlist );
}
playlist_Delete( p_playlist, i_row );
[o_table_view deselectRow: i_row];
}
vlc_object_release( p_playlist );
[self playlistUpdated];
}
- (IBAction)selectAll:(id)sender
{
[o_table_view selectAll: nil];
}
- (void)appendArray:(NSArray*)o_array atPos:(int)i_pos
{
int i_items;
......@@ -196,6 +244,13 @@
}
vlc_object_release( p_playlist );
[self playlistUpdated];
}
- (void)playlistUpdated
{
[o_table_view reloadData];
}
@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