Commit f57d978c authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

MacOSX/VLC_app: Remove unused files.

parent f631d60b
/*****************************************************************************
* VLCCategoryCell.h: VLC.app custom cell
* Most of the code here from Colloquy (GPL v2)
*****************************************************************************
* Copyright (C) 2007 Pierre d'Herbemont
* Copyright (C) 2007 the VideoLAN team
* $Id$
*
* Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import <Cocoa/Cocoa.h>
@interface VLCCategoryCell : NSImageCell {
@private
NSImage *_statusImage;
NSImage *_altImage;
NSString *_mainText;
NSString *_infoText;
NSLineBreakMode _lineBreakMode;
unsigned _statusNumber;
unsigned _importantStatusNumber;
BOOL _boldAndWhiteOnHighlight;
BOOL _selectable;
}
- (void) setStatusImage:(NSImage *) image;
- (NSImage *) statusImage;
- (void) setHighlightedImage:(NSImage *) image;
- (NSImage *) highlightedImage;
- (void) setMainText:(NSString *) text;
- (NSString *) mainText;
- (void) setInformationText:(NSString *) text;
- (NSString *) informationText;
- (void) setLineBreakMode:(NSLineBreakMode) mode;
- (NSLineBreakMode) lineBreakMode;
- (void) setBoldAndWhiteOnHighlight:(BOOL) boldAndWhite;
- (BOOL) boldAndWhiteOnHighlight;
- (void) setStatusNumber:(unsigned) number;
- (unsigned) statusNumber;
- (void) setImportantStatusNumber:(unsigned) number;
- (unsigned) importantStatusNumber;
@end
This diff is collapsed.
/*****************************************************************************
* VLCCategoryListDataSource.h: VLC.app custom outline view
*****************************************************************************
* Copyright (C) 2007 Pierre d'Herbemont
* Copyright (C) 2007 the VideoLAN team
* $Id$
*
* Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import <Cocoa/Cocoa.h>
@interface VLCCategoryListDataSource : NSObject
{
NSArray * mainCategories;
}
@end
/*****************************************************************************
* VLCCategoryListDataSource.h: VLC.app custom outline view
*****************************************************************************
* Copyright (C) 2007 Pierre d'Herbemont
* Copyright (C) 2007 the VideoLAN team
* $Id$
*
* Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import <VLC/VLC.h>
#import "VLCCategoryListDataSource.h"
@implementation VLCCategoryListDataSource
- (id)init
{
if( self = [super init] )
{
/* No need to release, cause we keep it around forever */
mainCategories = [[NSArray arrayWithObjects: [VLCMediaLibrary sharedMediaLibrary],
@"Services Discovery",
@"Playlists", nil] retain];
}
return self;
}
- (id)outlineView:(NSOutlineView *)aOutlineView child:(int)index ofItem:(id)item
{
if( !item )
{
return [mainCategories objectAtIndex: index];
}
if ([item isKindOfClass: [NSString class]])
{
if([item isEqualToString: @"Services Discovery"])
return [[[VLCServicesDiscoverer sharedDiscoverer] services] objectAtIndex: index];
if([item isEqualToString: @"Playlists"])
return [[[[VLCMediaLibrary sharedMediaLibrary] playlists] objectAtIndex: index] retain]; /* XXX: this is a leak, but this code needs rework */
}
if ([item isKindOfClass: [VLCMediaLibrary class]])
return nil;
#if 0
if ([item isKindOfClass: [VLCMediaDiscoverer class]])
{
return nil;
}
#endif
if ([item isKindOfClass: [VLCPlaylist class]])
{
return [[[item sublists] objectAtIndex: index] retain]; /* XXX: this is a leak, but this code needs rework */
}
return nil;
}
- (BOOL)outlineView:(NSOutlineView *)aOutlineView isItemExpandable:(id)item
{
if (!item)
return YES;
if ([item isKindOfClass: [NSString class]])
{
if([item isEqualToString: @"Services Discovery"])
return YES;
if([item isEqualToString: @"Playlists"])
return YES;
}
if ([item isKindOfClass: [VLCMediaLibrary class]])
return NO;
if ([item isKindOfClass: [VLCPlaylist class]])
{
return [[item sublists] count] > 0;
}
return NO;
}
- (int)outlineView:(NSOutlineView *)aOutlineView numberOfChildrenOfItem:(id)item
{
if (!item)
return [mainCategories count];
if ([item isKindOfClass: [NSString class]])
{
if([item isEqualToString: @"Playlists"])
return [[[VLCMediaLibrary sharedMediaLibrary] playlists] count];
if([item isEqualToString: @"Services Discovery"])
return [[[VLCServicesDiscoverer sharedDiscoverer] services] count];
}
if ([item isKindOfClass: [VLCPlaylist class]])
return [[item playlists] count];
return 0;
}
- (id)outlineView:(NSOutlineView *)aOutlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item
{
if (!item)
return nil;
if( [[tableColumn identifier] isEqualToString:@"name"] )
{
if ( [item isKindOfClass: [NSString class]] )
return item;
if ( [item isKindOfClass: [VLCPlaylist class]])
return [[[item providerMedia] metaInformation] objectForKey:VLCMetaInformationTitle];
if ( [item isKindOfClass: [VLCMediaDiscoverer class]])
return [item localizedName];
if ( [item isKindOfClass: [VLCMediaLibrary class]])
return @"Library";
}
else if ( [item isKindOfClass: [NSString class]] && [[tableColumn identifier] isEqualToString:@"icon"])
return nil;
return nil;
}
@end
@implementation VLCCategoryListDataSource (OutlineViewDelegating)
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item
{
if ([item isKindOfClass: [NSString class]])
{
if([item isEqualToString: @"Library"])
return YES;
if([item isEqualToString: @"Services Discovery"])
return NO;
if([item isEqualToString: @"Playlists"])
return NO;
}
return YES;
}
- (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item
{
if ([item isKindOfClass: [VLCMediaDiscoverer class]])
[cell setImage: [NSImage imageNamed:@"vlc_stream_16px"]];
else
[cell setImage: nil];
}
@end
/*****************************************************************************
* VLCCategoryOutlineView.h: VLC.app custom outline view
*****************************************************************************
* Copyright (C) 2007 Pierre d'Herbemont
* Copyright (C) 2007 the VideoLAN team
* $Id$
*
* Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import <Cocoa/Cocoa.h>
@interface VLCCategoryOutlineView : NSOutlineView
{
BOOL enableAnimation;
NSMutableDictionary *allAnimatingItemsDict;
int animations;
NSSize animationHedgeFactor;
BOOL disableExpansionAnimation;
}
@end
/*****************************************************************************
* VLCCategoryOutlineView.h: VLC.app custom outline view
* Most of the code here from Colloquy (GPL v2)
*****************************************************************************
* Copyright (C) 2007 Colloquy team (no copyright on original file)
* Copyright (C) 2007 the VideoLAN team
* $Id$
*
* Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import "VLCCategoryOutlineView.h"
/* Taken from colloquy (GPL v2) */
static void gradientInterpolate( void *info, float const *inData, float *outData )
{
static float light[4] = { 0.67843137, 0.73333333, 0.81568627, 1. };
static float dark[4] = { 0.59607843, 0.66666667, 0.76862745, 1. };
float a = inData[0];
int i = 0;
for( i = 0; i < 4; i++ )
outData[i] = ( 1. - a ) * dark[i] + a * light[i];
}
@implementation VLCCategoryOutlineView
- (NSColor *) _highlightColorForCell:(NSCell *)aCell
{
/* return nil to prevent normal selection drawing*/
return nil;
}
- (void) _highlightRow:(int) row clipRect:(NSRect) clipRect
{
NSRect highlight = [self rectOfRow:row];
struct CGFunctionCallbacks callbacks = { 0, gradientInterpolate, NULL };
CGFunctionRef function = CGFunctionCreate( NULL, 1, NULL, 4, NULL, &callbacks );
CGColorSpaceRef cspace = CGColorSpaceCreateDeviceRGB();
CGShadingRef shading = CGShadingCreateAxial( cspace, CGPointMake( NSMinX( highlight ), NSMaxY( highlight ) ), CGPointMake( NSMinX( highlight ), NSMinY( highlight ) ), function, false, false );
CGContextDrawShading( [[NSGraphicsContext currentContext] graphicsPort], shading );
CGShadingRelease( shading );
CGColorSpaceRelease( cspace );
CGFunctionRelease( function );
static NSColor *rowBottomLine = nil;
if( ! rowBottomLine )
rowBottomLine = [[NSColor colorWithCalibratedRed:( 140. / 255. ) green:( 152. / 255. ) blue:( 176. / 255. ) alpha:1.] retain];
[rowBottomLine set];
NSRect bottomLine = NSMakeRect( NSMinX( highlight ), NSMaxY( highlight ) - 1., NSWidth( highlight ), 1. );
NSRectFill( bottomLine );
}
@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