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

extra/MacOSX/VLC_app: Initial import of a wanna-be VLC.app application that...

extra/MacOSX/VLC_app: Initial import of a wanna-be VLC.app application that use the framework. Not really valuable for now.
parent b5763548
B/* Localized versions of Info.plist keys */
{
IBClasses = (
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
{CLASS = NSSegmentedControl; LANGUAGE = ObjC; SUPERCLASS = NSControl; },
{CLASS = VLCCategoryListDataSource; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
{CLASS = VLCCategoryOutlineView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; },
{
CLASS = VLCController;
LANGUAGE = ObjC;
OUTLETS = {categoryList = id; detailList = id; detailSearchField = id; videoView = id; };
SUPERCLASS = NSObject;
},
{CLASS = VLCVideoView; LANGUAGE = ObjC; SUPERCLASS = NSView; }
);
IBVersion = 1;
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>269 541 530 314 0 0 1680 1028 </string>
<key>IBEditorPositions</key>
<dict>
<key>29</key>
<string>141 525 338 44 0 0 1680 1028 </string>
</dict>
<key>IBFramework Version</key>
<string>446.1</string>
<key>IBOpenObjects</key>
<array>
<integer>21</integer>
<integer>29</integer>
</array>
<key>IBSystem Version</key>
<string>8R218</string>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.yourcompany.VLC</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 42;
objects = {
/* Begin PBXBuildFile section */
635FDAEF0C8080B900CE5E69 /* VLCCategoryOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = 635FDAED0C8080B900CE5E69 /* VLCCategoryOutlineView.m */; };
635FDAF00C8080B900CE5E69 /* VLCCategoryOutlineView.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 635FDAEE0C8080B900CE5E69 /* VLCCategoryOutlineView.h */; };
635FDB3D0C8083BC00CE5E69 /* VLCCategoryCell.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 635FDB3B0C8083BC00CE5E69 /* VLCCategoryCell.h */; };
635FDB3E0C8083BC00CE5E69 /* VLCCategoryCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 635FDB3C0C8083BC00CE5E69 /* VLCCategoryCell.m */; };
63C551690C7F62EC00B202D3 /* VLC.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63C551680C7F62EC00B202D3 /* VLC.framework */; };
63C551830C7F639600B202D3 /* VLC.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 63C551680C7F62EC00B202D3 /* VLC.framework */; };
63C5518C0C7F663500B202D3 /* VLCController.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 63C5518A0C7F663500B202D3 /* VLCController.h */; };
63C5518D0C7F663500B202D3 /* VLCController.m in Sources */ = {isa = PBXBuildFile; fileRef = 63C5518B0C7F663500B202D3 /* VLCController.m */; };
63C551900C7F6A2000B202D3 /* VLCCategoryListDataSource.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 63C5518E0C7F6A2000B202D3 /* VLCCategoryListDataSource.h */; };
63C551910C7F6A2000B202D3 /* VLCCategoryListDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 63C5518F0C7F6A2000B202D3 /* VLCCategoryListDataSource.m */; };
8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; };
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
63C551810C7F638000B202D3 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
63C551830C7F639600B202D3 /* VLC.framework in CopyFiles */,
63C5518C0C7F663500B202D3 /* VLCController.h in CopyFiles */,
63C551900C7F6A2000B202D3 /* VLCCategoryListDataSource.h in CopyFiles */,
635FDAF00C8080B900CE5E69 /* VLCCategoryOutlineView.h in CopyFiles */,
635FDB3D0C8083BC00CE5E69 /* VLCCategoryCell.h in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
29B97319FDCFA39411CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = "<group>"; };
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
32CA4F630368D1EE00C91783 /* VLC_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLC_Prefix.pch; sourceTree = "<group>"; };
635FDAED0C8080B900CE5E69 /* VLCCategoryOutlineView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = VLCCategoryOutlineView.m; sourceTree = "<group>"; };
635FDAEE0C8080B900CE5E69 /* VLCCategoryOutlineView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = VLCCategoryOutlineView.h; sourceTree = "<group>"; };
635FDB3B0C8083BC00CE5E69 /* VLCCategoryCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCCategoryCell.h; sourceTree = "<group>"; };
635FDB3C0C8083BC00CE5E69 /* VLCCategoryCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCCategoryCell.m; sourceTree = "<group>"; };
63C551680C7F62EC00B202D3 /* VLC.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = VLC.framework; path = ../../VLC.framework; sourceTree = SOURCE_ROOT; };
63C5518A0C7F663500B202D3 /* VLCController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = VLCController.h; sourceTree = "<group>"; };
63C5518B0C7F663500B202D3 /* VLCController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = VLCController.m; sourceTree = "<group>"; };
63C5518E0C7F6A2000B202D3 /* VLCCategoryListDataSource.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = VLCCategoryListDataSource.h; sourceTree = "<group>"; };
63C5518F0C7F6A2000B202D3 /* VLCCategoryListDataSource.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = VLCCategoryListDataSource.m; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8D1107320486CEB800E47090 /* VLC.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = VLC.app; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
8D11072E0486CEB800E47090 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
63C551690C7F62EC00B202D3 /* VLC.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
080E96DDFE201D6D7F000001 /* Classes */ = {
isa = PBXGroup;
children = (
63C5518A0C7F663500B202D3 /* VLCController.h */,
63C5518B0C7F663500B202D3 /* VLCController.m */,
63C5518E0C7F6A2000B202D3 /* VLCCategoryListDataSource.h */,
63C5518F0C7F6A2000B202D3 /* VLCCategoryListDataSource.m */,
635FDAEE0C8080B900CE5E69 /* VLCCategoryOutlineView.h */,
635FDAED0C8080B900CE5E69 /* VLCCategoryOutlineView.m */,
635FDB3B0C8083BC00CE5E69 /* VLCCategoryCell.h */,
635FDB3C0C8083BC00CE5E69 /* VLCCategoryCell.m */,
);
name = Classes;
sourceTree = "<group>";
};
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
63C551680C7F62EC00B202D3 /* VLC.framework */,
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
);
name = "Linked Frameworks";
sourceTree = "<group>";
};
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = {
isa = PBXGroup;
children = (
29B97324FDCFA39411CA2CEA /* AppKit.framework */,
13E42FB307B3F0F600E4EEF1 /* CoreData.framework */,
29B97325FDCFA39411CA2CEA /* Foundation.framework */,
);
name = "Other Frameworks";
sourceTree = "<group>";
};
19C28FACFE9D520D11CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
8D1107320486CEB800E47090 /* VLC.app */,
);
name = Products;
sourceTree = "<group>";
};
29B97314FDCFA39411CA2CEA /* VLC */ = {
isa = PBXGroup;
children = (
080E96DDFE201D6D7F000001 /* Classes */,
29B97315FDCFA39411CA2CEA /* Other Sources */,
29B97317FDCFA39411CA2CEA /* Resources */,
29B97323FDCFA39411CA2CEA /* Frameworks */,
19C28FACFE9D520D11CA2CBB /* Products */,
);
name = VLC;
sourceTree = "<group>";
};
29B97315FDCFA39411CA2CEA /* Other Sources */ = {
isa = PBXGroup;
children = (
32CA4F630368D1EE00C91783 /* VLC_Prefix.pch */,
29B97316FDCFA39411CA2CEA /* main.m */,
);
name = "Other Sources";
sourceTree = "<group>";
};
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
63C551960C7F6AD100B202D3 /* Images */,
8D1107310486CEB800E47090 /* Info.plist */,
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
29B97318FDCFA39411CA2CEA /* MainMenu.nib */,
);
name = Resources;
sourceTree = "<group>";
};
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
);
name = Frameworks;
sourceTree = "<group>";
};
63C551960C7F6AD100B202D3 /* Images */ = {
isa = PBXGroup;
children = (
);
name = Images;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
8D1107260486CEB800E47090 /* VLC */ = {
isa = PBXNativeTarget;
buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "VLC" */;
buildPhases = (
63C551810C7F638000B202D3 /* CopyFiles */,
8D1107290486CEB800E47090 /* Resources */,
8D11072C0486CEB800E47090 /* Sources */,
8D11072E0486CEB800E47090 /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = VLC;
productInstallPath = "$(HOME)/Applications";
productName = VLC;
productReference = 8D1107320486CEB800E47090 /* VLC.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "VLC" */;
hasScannedForEncodings = 1;
mainGroup = 29B97314FDCFA39411CA2CEA /* VLC */;
projectDirPath = "";
targets = (
8D1107260486CEB800E47090 /* VLC */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
8D1107290486CEB800E47090 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */,
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
8D11072C0486CEB800E47090 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8D11072D0486CEB800E47090 /* main.m in Sources */,
63C5518D0C7F663500B202D3 /* VLCController.m in Sources */,
63C551910C7F6A2000B202D3 /* VLCCategoryListDataSource.m in Sources */,
635FDAEF0C8080B900CE5E69 /* VLCCategoryOutlineView.m in Sources */,
635FDB3E0C8083BC00CE5E69 /* VLCCategoryCell.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
089C165DFE840E0CC02AAC07 /* English */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
29B97318FDCFA39411CA2CEA /* MainMenu.nib */ = {
isa = PBXVariantGroup;
children = (
29B97319FDCFA39411CA2CEA /* English */,
);
name = MainMenu.nib;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
C01FCF4B08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
);
FRAMEWORK_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/../..\"";
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_NAME = VLC;
WRAPPER_EXTENSION = app;
ZERO_LINK = YES;
};
name = Debug;
};
C01FCF4C08A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(NATIVE_ARCH)";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
);
FRAMEWORK_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/../..\"";
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_MODEL_TUNING = G5;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_NAME = VLC;
WRAPPER_EXTENSION = app;
};
name = Release;
};
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
};
name = Debug;
};
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "VLC" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C01FCF4B08A954540054247B /* Debug */,
C01FCF4C08A954540054247B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C01FCF4E08A954540054247B /* Build configuration list for PBXProject "VLC" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C01FCF4F08A954540054247B /* Debug */,
C01FCF5008A954540054247B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
}
/*****************************************************************************
* 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
/*****************************************************************************
* 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 "VLCCategoryCell.h"
@implementation VLCCategoryCell
- (id) init {
if( ( self = [super init] ) ) {
_altImage = nil;
_statusImage = nil;
_mainText = nil;
_infoText = nil;
_boldAndWhiteOnHighlight = YES;
_selectable = YES;
[self setImageAlignment:NSImageAlignLeft];
[self setImageScaling:NSScaleProportionally];
[self setImageFrameStyle:NSImageFrameNone];
[self setLineBreakMode:NSLineBreakByTruncatingTail];
}
return self;
}
- (id) copyWithZone:(NSZone *) zone {
VLCCategoryCell *cell = (VLCCategoryCell *)[super copyWithZone:zone];
cell -> _statusImage = [_statusImage retain];
cell -> _altImage = [_altImage retain];
cell -> _mainText = [_mainText copyWithZone:zone];
cell -> _infoText = [_infoText copyWithZone:zone];
cell -> _lineBreakMode = _lineBreakMode;
return cell;
}
- (void) dealloc {
[_altImage release];
[_statusImage release];
[_mainText release];
[_infoText release];
_altImage = nil;
_statusImage = nil;
_mainText = nil;
_infoText = nil;
[super dealloc];
}
#pragma mark -
- (void) setStatusImage:(NSImage *) image {
[_statusImage autorelease];
_statusImage = [image retain];
}
- (NSImage *) statusImage {
return _statusImage;
}
#pragma mark -
- (void) setStatusNumber:(unsigned) number {
_statusNumber = number;
}
- (unsigned) statusNumber {
return _statusNumber;
}
#pragma mark -
- (void) setImportantStatusNumber:(unsigned) number {
_importantStatusNumber = number;
}
- (unsigned) importantStatusNumber {
return _importantStatusNumber;
}
#pragma mark -
- (void) setHighlightedImage:(NSImage *) image {
[_altImage autorelease];
_altImage = [image retain];
}
- (NSImage *) highlightedImage {
return _altImage;
}
#pragma mark -
- (void) setSelectable:(BOOL) selectable {
_selectable = selectable;
}
- (BOOL) selectable {
return _selectable;
}
#pragma mark -
- (void) setMainText:(NSString *) text {
[_mainText autorelease];
_mainText = [text copy];
}
- (NSString *) mainText {
return _mainText;
}
#pragma mark -
- (void) setInformationText:(NSString *) text {
[_infoText autorelease];
_infoText = [text copy];
}
- (NSString *) informationText {
return _infoText;
}
#pragma mark -
- (void) setBoldAndWhiteOnHighlight:(BOOL) boldAndWhite {
_boldAndWhiteOnHighlight = boldAndWhite;
}
- (BOOL) boldAndWhiteOnHighlight {
return _boldAndWhiteOnHighlight;
}
#pragma mark -
- (void) drawWithFrame:(NSRect) cellFrame inView:(NSView *) controlView {
float imageWidth = 0.;
BOOL highlighted = ( [self isHighlighted] && [[controlView window] firstResponder] == controlView && [[controlView window] isKeyWindow] && [[NSApplication sharedApplication] isActive] );
NSMutableParagraphStyle *paraStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
[paraStyle setLineBreakMode:_lineBreakMode];
[paraStyle setAlignment:[self alignment]];
NSMutableDictionary *attributes = [NSMutableDictionary dictionaryWithObjectsAndKeys:[self font], NSFontAttributeName, paraStyle, NSParagraphStyleAttributeName, ( [self isEnabled] ? ( highlighted ? [NSColor alternateSelectedControlTextColor] : [NSColor controlTextColor] ) : ( highlighted ? [NSColor alternateSelectedControlTextColor] : [[NSColor controlTextColor] colorWithAlphaComponent:0.50] ) ), NSForegroundColorAttributeName, nil];
NSMutableDictionary *subAttributes = [NSMutableDictionary dictionaryWithObjectsAndKeys:[NSFont toolTipsFontOfSize:9.], NSFontAttributeName, paraStyle, NSParagraphStyleAttributeName, ( [self isEnabled] ? ( highlighted ? [NSColor alternateSelectedControlTextColor] : [[NSColor controlTextColor] colorWithAlphaComponent:0.75] ) : ( highlighted ? [NSColor alternateSelectedControlTextColor] : [[NSColor controlTextColor] colorWithAlphaComponent:0.40] ) ), NSForegroundColorAttributeName, nil];
NSImage *mainImage = nil, *curImage = nil;
NSSize mainStringSize = [_mainText sizeWithAttributes:attributes];
NSSize subStringSize = [_infoText sizeWithAttributes:subAttributes];
if( _boldAndWhiteOnHighlight && [self isHighlighted] ) {
NSFont *boldFont = [[NSFontManager sharedFontManager] fontWithFamily:@"Lucida Grande" traits:0 weight:15 size:11.];
NSShadow *shadow = [[NSShadow allocWithZone:nil] init];
NSColor *whiteColor = [NSColor whiteColor];
if( ! [self isEnabled] ) whiteColor = [whiteColor colorWithAlphaComponent:0.5];
[shadow setShadowOffset:NSMakeSize( 0, -1 )];
[shadow setShadowBlurRadius:0.1];
[shadow setShadowColor:[[NSColor shadowColor] colorWithAlphaComponent:0.2]];
[attributes setObject:boldFont forKey:NSFontAttributeName];
[attributes setObject:whiteColor forKey:NSForegroundColorAttributeName];
[attributes setObject:shadow forKey:NSShadowAttributeName];
boldFont = [[NSFontManager sharedFontManager] fontWithFamily:@"Lucida Grande" traits:0 weight:15 size:9.];
[subAttributes setObject:boldFont forKey:NSFontAttributeName];
[subAttributes setObject:whiteColor forKey:NSForegroundColorAttributeName];
[subAttributes setObject:shadow forKey:NSShadowAttributeName];
[shadow release];
}
else /*if( [self selectable] )
{
[self setMainText: [_mainText uppercaseString]];
[attributes setObject:[NSColor grayColor] forKey:NSForegroundColorAttributeName];
}
else*/
{
NSFont *font = [[NSFontManager sharedFontManager] fontWithFamily:@"Lucida Grande" traits:0 weight:1 size:11.];
[attributes setObject:font forKey:NSFontAttributeName];
}
if( highlighted && _altImage ) {
mainImage = [[self image] retain];
[self setImage:_altImage];
}
if( ! [self isEnabled] && [self image] ) {
NSImage *fadedImage = [[[NSImage alloc] initWithSize:[[self image] size]] autorelease];
[fadedImage lockFocus];
[[self image] dissolveToPoint:NSMakePoint( 0., 0. ) fraction:0.5];
[fadedImage unlockFocus];
curImage = [[self image] retain];
[self setImage:fadedImage];
}
cellFrame = NSMakeRect( cellFrame.origin.x + 1., cellFrame.origin.y, cellFrame.size.width - 1., cellFrame.size.height );
[super drawWithFrame:cellFrame inView:controlView];
if( ! [self isEnabled] ) {
[self setImage:curImage];
[curImage autorelease];
}
if( highlighted && mainImage ) {
[self setImage:mainImage];
[mainImage autorelease];
}
if( [self image] ) {
switch( [self imageScaling] ) {
case NSScaleProportionally:
if( NSHeight( cellFrame ) < [[self image] size].height )
imageWidth = ( NSHeight( cellFrame ) / [[self image] size].height ) * [[self image] size].width;
else imageWidth = [[self image] size].width;
break;
default:
case NSScaleNone:
imageWidth = [[self image] size].width;
break;
case NSScaleToFit:
imageWidth = [[self image] size].width;
break;
}
}
#define JVDetailCellLabelPadding 3.
#define JVDetailCellImageLabelPadding 5.
#define JVDetailCellTextLeading 3.
#define JVDetailCellStatusImageLeftPadding 2.
#define JVDetailCellStatusImageRightPadding JVDetailCellStatusImageLeftPadding
float statusWidth = ( _statusImage ? [_statusImage size].width + JVDetailCellStatusImageRightPadding : 0. );
if( ! _statusImage && ( _statusNumber || _importantStatusNumber ) ) {
NSColor *textColor = [NSColor whiteColor];
NSColor *backgroundColor = [NSColor colorWithCalibratedRed:0.6 green:0.6705882352941176 blue:0.7725490196078431 alpha:1.];
NSColor *importantColor = [NSColor colorWithCalibratedRed:0.831372549019608 green:0.572549019607843 blue:0.541176470588235 alpha:1.];
if( ! _statusNumber && _importantStatusNumber )
backgroundColor = importantColor;
if( [self isHighlighted] ) {
textColor = [backgroundColor shadowWithLevel:0.2];
backgroundColor = [backgroundColor highlightWithLevel:0.7];
}
NSFont *font = [[NSFontManager sharedFontManager] fontWithFamily:@"Lucida Grande" traits:NSBoldFontMask weight:9 size:11.];
NSMutableParagraphStyle *numberParaStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
[numberParaStyle setAlignment:NSCenterTextAlignment];
NSDictionary *statusNumberAttributes = [NSDictionary dictionaryWithObjectsAndKeys:font, NSFontAttributeName, numberParaStyle, NSParagraphStyleAttributeName, textColor, NSForegroundColorAttributeName, [NSNumber numberWithFloat:1.0], NSKernAttributeName, nil];
NSString *statusText = [NSString stringWithFormat:@"%d", ( _statusNumber ? _statusNumber : _importantStatusNumber )];
NSSize numberSize = [statusText sizeWithAttributes:statusNumberAttributes];
statusWidth = numberSize.width + 12.;
if( imageWidth + ( imageWidth ? JVDetailCellImageLabelPadding : JVDetailCellLabelPadding ) + statusWidth < NSWidth( cellFrame ) ) {
float radius = ( _importantStatusNumber ? 8. : 7. );
NSRect mainRect = NSMakeRect( NSMinX( cellFrame ) + NSWidth( cellFrame ) - statusWidth - 2., NSMinY( cellFrame ) + ( ( NSHeight( cellFrame ) / 2 ) - radius ), statusWidth, radius * 2 );
NSRect pathRect = NSInsetRect( mainRect, radius, radius );
NSBezierPath *mainPath = [NSBezierPath bezierPath];
[mainPath appendBezierPathWithArcWithCenter:NSMakePoint( NSMinX( pathRect ), NSMinY( pathRect ) ) radius:radius startAngle:180. endAngle:270.];
[mainPath appendBezierPathWithArcWithCenter:NSMakePoint( NSMaxX( pathRect ), NSMinY( pathRect ) ) radius:radius startAngle:270. endAngle:360.];
[mainPath appendBezierPathWithArcWithCenter:NSMakePoint( NSMaxX( pathRect ), NSMaxY( pathRect ) ) radius:radius startAngle:0. endAngle:90.];
[mainPath appendBezierPathWithArcWithCenter:NSMakePoint( NSMinX( pathRect ), NSMaxY( pathRect ) ) radius:radius startAngle:90. endAngle:180.];
[mainPath closePath];
if( _importantStatusNumber ) {
NSString *importantStatusText = [NSString stringWithFormat:@"%d", _importantStatusNumber];
numberSize = [importantStatusText sizeWithAttributes:statusNumberAttributes];
float mainStatusWidth = statusWidth;
statusWidth += numberSize.width + 10.;
radius = 7.;
NSRect rect = NSMakeRect( NSMinX( cellFrame ) + NSWidth( cellFrame ) - statusWidth - 2., NSMinY( cellFrame ) + ( ( NSHeight( cellFrame ) / 2 ) - radius ), statusWidth - mainStatusWidth + 10., radius * 2 );
pathRect = NSInsetRect( rect, radius, radius );
NSBezierPath *path = [NSBezierPath bezierPath];
[path appendBezierPathWithArcWithCenter:NSMakePoint( NSMinX( pathRect ), NSMinY( pathRect ) ) radius:radius startAngle:180. endAngle:270.];
[path appendBezierPathWithArcWithCenter:NSMakePoint( NSMaxX( pathRect ), NSMinY( pathRect ) ) radius:radius startAngle:270. endAngle:360.];
[path appendBezierPathWithArcWithCenter:NSMakePoint( NSMaxX( pathRect ), NSMaxY( pathRect ) ) radius:radius startAngle:0. endAngle:90.];
[path appendBezierPathWithArcWithCenter:NSMakePoint( NSMinX( pathRect ), NSMaxY( pathRect ) ) radius:radius startAngle:90. endAngle:180.];
[path closePath];
if( [self isHighlighted] ) [[NSColor whiteColor] set];
else [[NSColor colorWithCalibratedRed:0.92156862745098 green:0.231372549019608 blue:0.243137254901961 alpha:0.85] set];
[path fill];
rect.origin.x -= 3.;
[importantStatusText drawInRect:rect withAttributes:statusNumberAttributes];
}
[backgroundColor set];
[mainPath fill];
if( _importantStatusNumber ) {
if( [self isHighlighted] ) [[NSColor colorWithCalibratedRed:0.5803921568627451 green:0.6705882352941176 blue:0.7882352941176471 alpha:1.] set];
else [[NSColor whiteColor] set];
[mainPath setLineWidth:1.25];
[mainPath stroke];
}
if( _importantStatusNumber ) mainRect.origin.y += 1.;
[statusText drawInRect:mainRect withAttributes:statusNumberAttributes];
statusWidth += JVDetailCellStatusImageRightPadding + 3.;
} else statusWidth = 0.;
}
if( ( ! [_infoText length] && [_mainText length] ) || ( ( subStringSize.height + mainStringSize.height ) >= NSHeight( cellFrame ) - 2. ) ) {
float mainYLocation = 0.;
if( NSHeight( cellFrame ) >= mainStringSize.height ) {
mainYLocation = NSMinY( cellFrame ) + ( NSHeight( cellFrame ) / 2 ) - ( mainStringSize.height / 2 );
[_mainText drawInRect:NSMakeRect( NSMinX( cellFrame ) + imageWidth + ( imageWidth ? JVDetailCellImageLabelPadding : JVDetailCellLabelPadding ), mainYLocation, NSWidth( cellFrame ) - imageWidth - ( JVDetailCellImageLabelPadding * 1. ) - statusWidth, [_mainText sizeWithAttributes:attributes].height ) withAttributes:attributes];
}
} else if( [_infoText length] && [_mainText length] ) {
float mainYLocation = 0., subYLocation = 0.;
if( NSHeight( cellFrame ) >= mainStringSize.height ) {
mainYLocation = NSMinY( cellFrame ) + ( NSHeight( cellFrame ) / 2 ) - mainStringSize.height + ( JVDetailCellTextLeading / 2. );
[_mainText drawInRect:NSMakeRect( cellFrame.origin.x + imageWidth + ( imageWidth ? JVDetailCellImageLabelPadding : JVDetailCellLabelPadding ), mainYLocation, NSWidth( cellFrame ) - imageWidth - ( JVDetailCellImageLabelPadding * 1. ) - statusWidth, [_mainText sizeWithAttributes:attributes].height ) withAttributes:attributes];
subYLocation = NSMinY( cellFrame ) + ( NSHeight( cellFrame ) / 2 ) + subStringSize.height - mainStringSize.height + ( JVDetailCellTextLeading / 2. );
[_infoText drawInRect:NSMakeRect( NSMinX( cellFrame ) + imageWidth + ( imageWidth ? JVDetailCellImageLabelPadding : JVDetailCellLabelPadding ), subYLocation, NSWidth( cellFrame ) - imageWidth - ( JVDetailCellImageLabelPadding * 1. ) - statusWidth, [_infoText sizeWithAttributes:subAttributes].height ) withAttributes:subAttributes];
}
}
if( _statusImage && NSHeight( cellFrame ) >= [_statusImage size].height ) {
[_statusImage compositeToPoint:NSMakePoint( NSMinX( cellFrame ) + NSWidth( cellFrame ) - statusWidth, NSMaxY( cellFrame ) - ( ( NSHeight( cellFrame ) / 2 ) - ( [_statusImage size].height / 2 ) ) ) operation:NSCompositeSourceAtop fraction:( [self isEnabled] ? 1. : 0.5)];
}
}
#pragma mark -
- (void) setImageScaling:(NSImageScaling) newScaling {
[super setImageScaling:( newScaling == NSScaleProportionally || newScaling == NSScaleNone ? newScaling : NSScaleProportionally )];
}
- (void) setImageAlignment:(NSImageAlignment) newAlign {
[super setImageAlignment:NSImageAlignLeft];
}
- (void) setLineBreakMode:(NSLineBreakMode) mode {
_lineBreakMode = mode;
}
- (NSLineBreakMode) lineBreakMode {
return _lineBreakMode;
}
- (void) setStringValue:(NSString *) string {
[self setMainText:string];
}
- (void) setObjectValue:(id <NSCopying>) obj {
if( ! obj || [(NSObject *)obj isKindOfClass:[NSImage class]] ) {
[super setObjectValue:obj];
} else if( [(NSObject *)obj isKindOfClass:[NSString class]] ) {
[self setMainText:(NSString *)obj];
}
}
- (NSString *) stringValue {
return _mainText;
}
@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 <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
/*****************************************************************************
* VLCController.h: VLC.app main controller
*****************************************************************************
* 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>
#define VLCPanic( ex ) __VLCPanic( ex, __FUNCTION__, __FILE__, __LINE__ )
static inline void __VLCPanic( const char * str, const char * function, const char * file, int line_number )
{
NSRunCriticalAlertPanel( @"Error", [NSString stringWithFormat:@"The following error was encountered: %s (%s:%d %s)", str, file, line_number, function], @"Quit", nil, nil );
exit( -1 );
}
@interface VLCController : NSObject
{
IBOutlet id categoryList;
IBOutlet id detailList;
IBOutlet id videoView;
IBOutlet id detailSearchField;
}
@end
/*****************************************************************************
* VLCController.h: VLC.app main controller
*****************************************************************************
* 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.
*****************************************************************************/
/* this code needs rework, but it does nice thing */
#import <VLC/VLC.h>
#import "VLCController.h"
#import "VLCCategoryCell.h"
NSArrayController * treeController;
VLCPlaylist * currentPlaylist;
@implementation VLCController
- (void)awakeFromNib
{
[NSApp setDelegate:self];
[detailList setTarget:self];
[detailList setDoubleAction:@selector(detailListItemDoubleClicked:)];
[detailList setDataSource: [[VLCPlaylistDataSource alloc] initWithPlaylist:nil videoView:videoView]];
[detailList registerForDraggedTypes: [NSArray arrayWithObjects:NSFilenamesPboardType, NSURLPboardType, nil]];
[categoryList setTarget:self];
[categoryList setAction:@selector(categoryListItemClicked:)];
[[[categoryList tableColumns] objectAtIndex:0] setDataCell:[[[VLCCategoryCell alloc] init] autorelease]];
}
- (void)detailListItemDoubleClicked:(id)sender
{
if( [sender isKindOfClass:[NSTableView class]] && [sender selectedRow] >= 0)
{
[videoView setPlaylist: currentPlaylist];
[videoView playMedia: [[treeController selectedObjects] objectAtIndex: 0]];
}
}
- (void)categoryListItemClicked:(id)sender
{
VLCPlaylist * aPlaylist;
id selectedItem = [sender itemAtRow:[sender selectedRow]];
if([selectedItem isKindOfClass:[VLCMediaLibrary class]])
aPlaylist = [selectedItem allMedia];
else if([selectedItem isKindOfClass:[VLCMediaDiscoverer class]])
aPlaylist = [selectedItem playlist];
else if([selectedItem isKindOfClass:[VLCPlaylist class]])
aPlaylist = [selectedItem flatPlaylist];
else
{
return;
}
currentPlaylist= aPlaylist;
treeController = [[NSArrayController alloc] init]; /* XXX: We leak */
//[treeController setAutomaticallyPreparesContent: YES];
[[detailList dataSource] release];
NSLog(@"currentPlaylist %@", currentPlaylist);
[detailList setDataSource: [[VLCPlaylistDataSource alloc] initWithPlaylist:aPlaylist videoView:videoView]];
//[treeController setContent: [[VLCMediaLibrary sharedMediaLibrary] allMedia]];
[treeController bind:@"contentArray" toObject: aPlaylist
withKeyPath:@"items" options:nil];
NSTableColumn *tableColumn;
NSMutableDictionary *bindingOptions = [NSMutableDictionary dictionary];
[bindingOptions setObject:@"metaInformation.title contains[c] $value" forKey:NSPredicateFormatBindingOption];
[bindingOptions setObject:@"No Title" forKey:NSDisplayNameBindingOption];
[detailSearchField bind:@"predicate" toObject: treeController
withKeyPath:@"filterPredicate" options:bindingOptions];
//[treeController setChildrenKeyPath:@"subitems.items"];
[bindingOptions removeAllObjects];
[bindingOptions setObject:@"Search" forKey:@"NSNullPlaceholder"];
/* binding for "title" column */
tableColumn = [detailList tableColumnWithIdentifier:@"title"];
[tableColumn bind:@"value" toObject: treeController
withKeyPath:@"arrangedObjects.metaInformation.title" options:bindingOptions];
}
@end
@implementation VLCController (NSAppDelegating)
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
[self categoryListItemClicked: categoryList];
}
@end
//
// Prefix header for all source files of the 'VLC' target in the 'VLC' project
//
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif
//
// main.m
// VLC
//
// Created by Pierre d'Herbemont on 11/08/07.
// Copyright __MyCompanyName__ 2007. All rights reserved.
//
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[])
{
return NSApplicationMain(argc, (const char **) argv);
}
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