From: Benjamin Pracht Date: Wed, 14 Jan 2004 18:45:45 +0000 (+0000) Subject: * playlist sort. X-Git-Tag: 0.7.1~512 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=27eb375e242b5f4766595315475b1aa3f86db808;hp=40a94d33f6770825d8d8d2e164ba62210460a427;p=vlc * playlist sort. Had to delete lastPathComponent when displaying the MRL of a file in the playlist, since sort cannot be exact with this option. --- diff --git a/modules/gui/macosx/playlist.h b/modules/gui/macosx/playlist.h index 0eaff37709..c9ec56ea0a 100644 --- a/modules/gui/macosx/playlist.h +++ b/modules/gui/macosx/playlist.h @@ -2,7 +2,7 @@ * playlist.h: MacOS X interface plugin ***************************************************************************** * Copyright (C) 2002-2004 VideoLAN - * $Id: playlist.h,v 1.17 2004/01/09 22:11:04 hartman Exp $ + * $Id: playlist.h,v 1.18 2004/01/14 18:45:45 bigben Exp $ * * Authors: Jon Lech Johansen * Derk-Jan Hartman @@ -37,6 +37,7 @@ @interface VLCPlaylist : NSObject { int i_moveRow; + int b_isSortDescending; IBOutlet id o_window; IBOutlet id o_btn_playlist; @@ -46,6 +47,7 @@ IBOutlet id o_tc_name; IBOutlet id o_tc_author; IBOutlet id o_tc_duration; + IBOutlet id o_tc_sortColumn; IBOutlet id o_ctx_menu; IBOutlet id o_mi_save_playlist; @@ -60,6 +62,9 @@ IBOutlet id o_search_keyword; IBOutlet id o_search_button; + NSImage *o_descendingSortingImage; + NSImage *o_ascendingSortingImage; + } - (void)initStrings; diff --git a/modules/gui/macosx/playlist.m b/modules/gui/macosx/playlist.m index 58101e57c5..9bbc03bd88 100644 --- a/modules/gui/macosx/playlist.m +++ b/modules/gui/macosx/playlist.m @@ -2,7 +2,7 @@ * playlist.m: MacOS X interface plugin ***************************************************************************** * Copyright (C) 2002-2004 VideoLAN - * $Id: playlist.m,v 1.52 2004/01/12 21:22:22 hartman Exp $ + * $Id: playlist.m,v 1.53 2004/01/14 18:45:45 bigben Exp $ * * Authors: Jon Lech Johansen * Derk-Jan Hartman @@ -104,6 +104,7 @@ } } + @end /***************************************************************************** @@ -133,6 +134,28 @@ [NSArray arrayWithObjects: NSFilenamesPboardType, nil]]; [o_window setExcludedFromWindowsMenu: TRUE]; + +/* We need to check whether _defaultTableHeaderSortImage exists, since it +belongs to an Apple hidden private API, and then can "disapear" at any time*/ + + if ([[NSTableView class] respondsToSelector:@selector(_defaultTableHeaderSortImage)]) + { + o_ascendingSortingImage = [[NSTableView class] _defaultTableHeaderSortImage]; + } + else + { + o_ascendingSortingImage = nil; + } + + if ([[NSTableView class] respondsToSelector:@selector(_defaultTableHeaderReverseSortImage)]) + { + o_descendingSortingImage = [[NSTableView class] _defaultTableHeaderReverseSortImage]; + } + else + { + o_descendingSortingImage = nil; + } + [self initStrings]; } @@ -153,6 +176,62 @@ [o_btn_playlist setToolTip: _NS("Playlist")]; } +- (void) tableView:(NSTableView*)o_tv + didClickTableColumn:(NSTableColumn *)o_tc +{ + intf_thread_t * p_intf = [NSApp getIntf]; + playlist_t *p_playlist = + (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, + FIND_ANYWHERE ); + + int max = [[o_table_view tableColumns] count]; + int i; + + if( p_playlist == NULL ) + { + return; + } + + if (o_tc_sortColumn == o_tc ) + { + b_isSortDescending = !b_isSortDescending; + } + else if (o_tc == o_tc_name || o_tc == o_tc_author) + { + b_isSortDescending = VLC_FALSE; + [o_table_view setHighlightedTableColumn:o_tc]; + o_tc_sortColumn = o_tc; + for (i=0;iobject_lock ); - o_value = [[NSString stringWithUTF8String: - p_playlist->pp_items[i_row]->psz_name] lastPathComponent]; + o_value = [NSString stringWithUTF8String: + p_playlist->pp_items[i_row]->psz_name]; vlc_mutex_unlock( &p_playlist->object_lock ); } else if( [[o_tc identifier] isEqualToString:@"2"] )