Commit 4dcb355c authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* Away with that annoying playlist drawer. We now have a nice resizable

  window, with additional index and author columns.
parent 764f9e8b
...@@ -316,18 +316,26 @@ ...@@ -316,18 +316,26 @@
SUPERCLASS = NSObject; SUPERCLASS = NSObject;
}, },
{ {
ACTIONS = {deleteItems = id; playItem = id; savePlaylist = id; selectAll = id; }; ACTIONS = {
deleteItems = id;
playItem = id;
savePlaylist = id;
selectAll = id;
toggleWindow = id;
};
CLASS = VLCPlaylist; CLASS = VLCPlaylist;
LANGUAGE = ObjC; LANGUAGE = ObjC;
OUTLETS = { OUTLETS = {
"o_btn_add" = id;
"o_btn_remove" = id;
"o_ctx_menu" = id; "o_ctx_menu" = id;
"o_mi_delete" = id; "o_mi_delete" = id;
"o_mi_play" = id; "o_mi_play" = id;
"o_mi_save_playlist" = id; "o_mi_save_playlist" = id;
"o_mi_selectall" = id; "o_mi_selectall" = id;
"o_status_field" = id;
"o_table_view" = id; "o_table_view" = id;
"o_tc_author" = id;
"o_tc_name" = id;
"o_window" = id;
}; };
SUPERCLASS = NSObject; SUPERCLASS = NSObject;
}, },
......
...@@ -10,8 +10,6 @@ ...@@ -10,8 +10,6 @@
<string>691 686 104 149 0 0 1280 1002 </string> <string>691 686 104 149 0 0 1280 1002 </string>
<key>29</key> <key>29</key>
<string>165 930 419 44 0 0 1280 1002 </string> <string>165 930 419 44 0 0 1280 1002 </string>
<key>909</key>
<string>72 297 430 172 0 0 1152 746 </string>
<key>915</key> <key>915</key>
<string>439 657 93 99 0 0 1280 1002 </string> <string>439 657 93 99 0 0 1280 1002 </string>
</dict> </dict>
...@@ -24,8 +22,9 @@ ...@@ -24,8 +22,9 @@
<key>IBOpenObjects</key> <key>IBOpenObjects</key>
<array> <array>
<integer>21</integer> <integer>21</integer>
<integer>1647</integer>
</array> </array>
<key>IBSystem Version</key> <key>IBSystem Version</key>
<string>7B85</string> <string>7C107</string>
</dict> </dict>
</plist> </plist>
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* playlist.h: MacOS X interface plugin * playlist.h: MacOS X interface plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2003 VideoLAN * Copyright (C) 2002-2003 VideoLAN
* $Id: playlist.h,v 1.11 2003/09/22 03:40:05 hartman Exp $ * $Id: playlist.h,v 1.12 2003/11/12 01:22:40 hartman Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Derk-Jan Hartman <thedj@users.sourceforge.net> * Derk-Jan Hartman <thedj@users.sourceforge.net>
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
*****************************************************************************/ *****************************************************************************/
@interface VLCPlaylistView : NSTableView @interface VLCPlaylistView : NSTableView
{ {
NSColor *o_striped_row_color;
} }
@end @end
...@@ -39,21 +38,23 @@ ...@@ -39,21 +38,23 @@
{ {
int i_moveRow; int i_moveRow;
IBOutlet id o_window;
IBOutlet id o_table_view; IBOutlet id o_table_view;
IBOutlet id o_ctx_menu; IBOutlet id o_status_field;
IBOutlet id o_tc_name;
IBOutlet id o_tc_author;
IBOutlet id o_ctx_menu;
IBOutlet id o_mi_save_playlist; IBOutlet id o_mi_save_playlist;
IBOutlet id o_mi_play; IBOutlet id o_mi_play;
IBOutlet id o_mi_delete; IBOutlet id o_mi_delete;
IBOutlet id o_mi_selectall; IBOutlet id o_mi_selectall;
IBOutlet id o_btn_add;
IBOutlet id o_btn_remove;
} }
- (NSMenu *)menuForEvent:(NSEvent *)o_event; - (NSMenu *)menuForEvent:(NSEvent *)o_event;
- (IBAction)toggleWindow:(id)sender;
- (IBAction)savePlaylist:(id)sender; - (IBAction)savePlaylist:(id)sender;
- (IBAction)playItem:(id)sender; - (IBAction)playItem:(id)sender;
- (IBAction)deleteItems:(id)sender; - (IBAction)deleteItems:(id)sender;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* playlist.m: MacOS X interface plugin * playlist.m: MacOS X interface plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2003 VideoLAN * Copyright (C) 2002-2003 VideoLAN
* $Id: playlist.m,v 1.35 2003/11/06 16:28:28 hartman Exp $ * $Id: playlist.m,v 1.36 2003/11/12 01:22:40 hartman Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Derk-Jan Hartman <thedj@users.sourceforge.net> * Derk-Jan Hartman <thedj@users.sourceforge.net>
...@@ -35,22 +35,11 @@ ...@@ -35,22 +35,11 @@
#include "playlist.h" #include "playlist.h"
#include "controls.h" #include "controls.h"
int MacVersion102 = -1;
/***************************************************************************** /*****************************************************************************
* VLCPlaylistView implementation * VLCPlaylistView implementation
*****************************************************************************/ *****************************************************************************/
@implementation VLCPlaylistView @implementation VLCPlaylistView
- (void)dealloc
{
if( o_striped_row_color != nil )
{
[o_striped_row_color release];
}
[super dealloc];
}
- (NSMenu *)menuForEvent:(NSEvent *)o_event - (NSMenu *)menuForEvent:(NSEvent *)o_event
{ {
return( [[self delegate] menuForEvent: o_event] ); return( [[self delegate] menuForEvent: o_event] );
...@@ -114,48 +103,6 @@ int MacVersion102 = -1; ...@@ -114,48 +103,6 @@ int MacVersion102 = -1;
} }
} }
- (void)highlightSelectionInClipRect:(NSRect)o_rect {
NSRect o_new_rect;
float f_height = [self rowHeight] + [self intercellSpacing].height;
float f_origin_y = NSMaxY( o_rect );
int i_row = o_rect.origin.y / f_height;
if ( i_row % 2 == 0 )
{
i_row++;
}
o_new_rect.size.width = o_rect.size.width;
o_new_rect.size.height = f_height;
o_new_rect.origin.x = o_rect.origin.x;
o_new_rect.origin.y = i_row * f_height;
if( ( MacVersion102 < 0 ) && ( floor( NSAppKitVersionNumber ) > NSAppKitVersionNumber10_1 ) )
{
MacVersion102 = 102;
}
if ( MacVersion102 == 102 && o_striped_row_color == nil )
{
o_striped_row_color = [[[NSColor alternateSelectedControlColor]
highlightWithLevel: 0.90] retain];
}
else if ( o_striped_row_color == nil )
{
/* OSX 10.1 and before ain't that smart ;) */
o_striped_row_color = [[NSColor whiteColor] retain];
}
[o_striped_row_color set];
while ( o_new_rect.origin.y < f_origin_y ) {
NSRectFill( o_new_rect );
o_new_rect.origin.y += f_height * 2.0;
}
[super highlightSelectionInClipRect:o_rect];
}
@end @end
/***************************************************************************** /*****************************************************************************
...@@ -184,13 +131,13 @@ int MacVersion102 = -1; ...@@ -184,13 +131,13 @@ int MacVersion102 = -1;
[o_table_view registerForDraggedTypes: [o_table_view registerForDraggedTypes:
[NSArray arrayWithObjects: NSFilenamesPboardType, nil]]; [NSArray arrayWithObjects: NSFilenamesPboardType, nil]];
[o_window setTitle: _NS("Playlist")];
[o_mi_save_playlist setTitle: _NS("Save Playlist...")]; [o_mi_save_playlist setTitle: _NS("Save Playlist...")];
[o_mi_play setTitle: _NS("Play")]; [o_mi_play setTitle: _NS("Play")];
[o_mi_delete setTitle: _NS("Delete")]; [o_mi_delete setTitle: _NS("Delete")];
[o_mi_selectall setTitle: _NS("Select All")]; [o_mi_selectall setTitle: _NS("Select All")];
[[o_tc_name headerCell] setStringValue:_NS("Name")];
[o_btn_add setToolTip: _NS("Add")]; [[o_tc_author headerCell] setStringValue:_NS("Author")];
[o_btn_remove setToolTip: _NS("Delete")];
} }
- (BOOL)tableView:(NSTableView *)o_tv - (BOOL)tableView:(NSTableView *)o_tv
...@@ -219,6 +166,18 @@ int MacVersion102 = -1; ...@@ -219,6 +166,18 @@ int MacVersion102 = -1;
return( o_ctx_menu ); return( o_ctx_menu );
} }
- (IBAction)toggleWindow:(id)sender
{
if( [o_window isVisible] )
{
[o_window orderOut:sender];
}
else
{
[o_window makeKeyAndOrderFront:sender];
}
}
- (IBAction)savePlaylist:(id)sender - (IBAction)savePlaylist:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = [NSApp getIntf];
...@@ -429,7 +388,7 @@ int MacVersion102 = -1; ...@@ -429,7 +388,7 @@ int MacVersion102 = -1;
vlc_mutex_unlock( &p_playlist->object_lock ); vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
} }
[o_status_field setStringValue: [NSString stringWithFormat:_NS("%i items in playlist"), i_count]];
return( i_count ); return( i_count );
} }
...@@ -447,10 +406,24 @@ int MacVersion102 = -1; ...@@ -447,10 +406,24 @@ int MacVersion102 = -1;
return( nil ); return( nil );
} }
if( [[o_tc identifier] isEqualToString:@"0"] )
{
o_value = [NSString stringWithFormat:@"%i", i_row + 1];
}
else if( [[o_tc identifier] isEqualToString:@"1"] )
{
vlc_mutex_lock( &p_playlist->object_lock ); vlc_mutex_lock( &p_playlist->object_lock );
o_value = [[NSString stringWithUTF8String: o_value = [[NSString stringWithUTF8String:
p_playlist->pp_items[i_row]->psz_name] lastPathComponent]; p_playlist->pp_items[i_row]->psz_name] lastPathComponent];
vlc_mutex_unlock( &p_playlist->object_lock ); vlc_mutex_unlock( &p_playlist->object_lock );
}
else if( [[o_tc identifier] isEqualToString:@"2"] )
{
vlc_mutex_lock( &p_playlist->object_lock );
o_value = [NSString stringWithUTF8String:
p_playlist->pp_items[i_row]->psz_author];
vlc_mutex_unlock( &p_playlist->object_lock );
}
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
......
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