Changeset e6e14e4e3e52ca9a28ff86ea3131cc20b2f5f5dd
- Timestamp:
- 02/11/08 01:02:42 (5 months ago)
- git-parent:
- Files:
-
- projects/macosx/vlc_app/English.lproj/MainMenu.nib/classes.nib (modified) (4 diffs)
- projects/macosx/vlc_app/English.lproj/MainMenu.nib/info.nib (modified) (1 diff)
- projects/macosx/vlc_app/English.lproj/MainMenu.nib/keyedobjects.nib (modified) (previous)
- projects/macosx/vlc_app/Sources/AppleRemote.h (added)
- projects/macosx/vlc_app/Sources/AppleRemote.m (added)
- projects/macosx/vlc_app/Sources/VLCAppAdditions.h (modified) (2 diffs)
- projects/macosx/vlc_app/Sources/VLCAppAdditions.m (modified) (3 diffs)
- projects/macosx/vlc_app/Sources/VLCBrowsableVideoView.h (modified) (4 diffs)
- projects/macosx/vlc_app/Sources/VLCBrowsableVideoView.m (modified) (11 diffs)
- projects/macosx/vlc_app/Sources/VLCController.m (modified) (3 diffs)
- projects/macosx/vlc_app/Sources/VLCExceptionHandler.m (modified) (1 diff)
- projects/macosx/vlc_app/Sources/VLCFullScreenControllerWindow.h (modified) (2 diffs)
- projects/macosx/vlc_app/Sources/VLCFullScreenControllerWindow.m (modified) (3 diffs)
- projects/macosx/vlc_app/Sources/VLCMainWindow.h (modified) (1 diff)
- projects/macosx/vlc_app/Sources/VLCMainWindow.m (modified) (2 diffs)
- projects/macosx/vlc_app/Sources/VLCMainWindowController.h (added)
- projects/macosx/vlc_app/Sources/VLCMainWindowController.m (added)
- projects/macosx/vlc_app/Sources/VLCMediaArrayController.m (modified) (1 diff)
- projects/macosx/vlc_app/Sources/VLCMediaLayer.h (added)
- projects/macosx/vlc_app/Sources/VLCMediaLayer.m (added)
- projects/macosx/vlc_app/Sources/VLCMediaListLayer.h (added)
- projects/macosx/vlc_app/Sources/VLCMediaListLayer.m (added)
- projects/macosx/vlc_app/Sources/VLCValueTransformer.h (modified) (1 diff)
- projects/macosx/vlc_app/Sources/VLCValueTransformer.m (modified) (1 diff)
- projects/macosx/vlc_app/VLC.xcodeproj/project.pbxproj (modified) (20 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
projects/macosx/vlc_app/English.lproj/MainMenu.nib/classes.nib
rb3372f1 re6e14e4 48 48 </dict> 49 49 <dict> 50 <key>ACTIONS</key> 51 <dict> 52 <key>mediaListViewItemDoubleClicked</key> 53 <string>id</string> 54 <key>videoViewItemClicked</key> 55 <string>id</string> 56 </dict> 57 <key>CLASS</key> 58 <string>VLCMainWindowController</string> 59 <key>LANGUAGE</key> 60 <string>ObjC</string> 61 <key>OUTLETS</key> 62 <dict> 63 <key>addPlaylistButton</key> 64 <string>NSButton</string> 65 <key>categoriesListView</key> 66 <string>NSOutlineView</string> 67 <key>categoriesTreeController</key> 68 <string>NSTreeController</string> 69 <key>controller</key> 70 <string>VLCController</string> 71 <key>mainSplitView</key> 72 <string>VLCOneSplitView</string> 73 <key>mediaArrayController</key> 74 <string>VLCMediaArrayController</string> 75 <key>mediaListView</key> 76 <string>NSTableView</string> 77 <key>mediaPlayer</key> 78 <string>VLCMediaPlayer</string> 79 <key>mediaPlayerBackwardPrevButton</key> 80 <string>NSButton</string> 81 <key>mediaPlayerForwardNextButton</key> 82 <string>NSButton</string> 83 <key>mediaPlayerPlayPauseStopButton</key> 84 <string>NSButton</string> 85 <key>removePlaylistButton</key> 86 <string>NSButton</string> 87 <key>toolbarMediaAudioVolume</key> 88 <string>NSView</string> 89 <key>toolbarMediaControl</key> 90 <string>NSView</string> 91 <key>toolbarMediaDescription</key> 92 <string>NSView</string> 93 <key>videoView</key> 94 <string>VLCBrowsableVideoView</string> 95 </dict> 96 <key>SUPERCLASS</key> 97 <string>NSWindowController</string> 98 </dict> 99 <dict> 50 100 <key>CLASS</key> 51 101 <string>FirstResponder</string> … … 54 104 <key>SUPERCLASS</key> 55 105 <string>NSObject</string> 106 </dict> 107 <dict> 108 <key>CLASS</key> 109 <string>VLCOneSplitView</string> 110 <key>LANGUAGE</key> 111 <string>ObjC</string> 112 <key>SUPERCLASS</key> 113 <string>NSSplitView</string> 114 </dict> 115 <dict> 116 <key>CLASS</key> 117 <string>VLCMediaArrayController</string> 118 <key>LANGUAGE</key> 119 <string>ObjC</string> 120 <key>SUPERCLASS</key> 121 <string>NSArrayController</string> 56 122 </dict> 57 123 <dict> … … 69 135 <key>OUTLETS</key> 70 136 <dict> 137 <key>mainWindowController</key> 138 <string>VLCMainWindowController</string> 71 139 <key>selectedObject</key> 72 140 <string>id</string> … … 85 153 <string>NSView</string> 86 154 </dict> 155 <dict> 156 <key>CLASS</key> 157 <string>VLCMediaPlayer</string> 158 <key>LANGUAGE</key> 159 <string>ObjC</string> 160 </dict> 87 161 </array> 88 162 <key>IBVersion</key> projects/macosx/vlc_app/English.lproj/MainMenu.nib/info.nib
rb3372f1 re6e14e4 5 5 <key>IBFramework Version</key> 6 6 <string>629</string> 7 <key>IBLastKnownRelativeProjectPath</key>8 <string>../../VLC.xcodeproj</string>9 7 <key>IBOldestOS</key> 10 8 <integer>5</integer> projects/macosx/vlc_app/Sources/VLCAppAdditions.h
rb3372f1 re6e14e4 56 56 @interface VLCOneSplitView : NSSplitView 57 57 { 58 BOOL fixedCursorDuringResize;59 58 } 60 @property (assign) BOOL fixedCursorDuringResize;61 59 - (float)sliderPosition; 62 60 - (void)setSliderPosition:(float)newPosition; … … 123 121 - (BOOL)mouseDownCanMoveWindow; 124 122 @end 123 124 /***************************************************************************** 125 * NSImage (VLCAppAdditions) 126 * 127 * Make the image view move the window by mouse down by default 128 *****************************************************************************/ 129 130 @interface NSImage (VLCAppAdditions) 131 - (CGImageRef)CGImage; 132 @end projects/macosx/vlc_app/Sources/VLCAppAdditions.m
rb3372f1 re6e14e4 87 87 /* Split view that supports slider animation */ 88 88 @implementation VLCOneSplitView 89 @synthesize fixedCursorDuringResize; 89 - (CGFloat)dividerThickness 90 { 91 return 1.; 92 } 93 - (void)drawDividerInRect:(NSRect)aRect 94 { 95 [self lockFocus]; 96 [[NSColor blackColor] set]; 97 NSRectFill(aRect); 98 [self unlockFocus]; 99 } 90 100 - (float)sliderPosition 91 101 { 92 return [[[self subviews] objectAtIndex:0] frame].size.height; 102 NSSize size = [[[self subviews] objectAtIndex:0] frame].size; 103 return [self isVertical] ? size.width : size.height; 93 104 } 94 105 - (void)setSliderPosition:(float)newPosition … … 103 114 } 104 115 return [super defaultAnimationForKey: key]; 105 }106 - (void)adjustSubviews107 {108 if( !fixedCursorDuringResize )109 {110 [super adjustSubviews];111 return;112 }113 NSRect frame0 = [[[self subviews] objectAtIndex:0] frame];114 NSRect frame1 = [[[self subviews] objectAtIndex:1] frame];115 frame1.size.height = [self bounds].size.height - frame0.size.height - [self dividerThickness];116 if( frame1.size.height < 0. )117 {118 float delta = -frame1.size.height;119 frame1.size.height = 0.;120 frame0.size.height -= delta;121 frame1.origin.y = frame0.size.height + [self dividerThickness];122 [[[self subviews] objectAtIndex:1] setFrame: frame0];123 }124 [[[self subviews] objectAtIndex:1] setFrame: frame1];125 116 } 126 117 @end … … 328 319 @end 329 320 321 /***************************************************************************** 322 * NSImage (VLCAppAdditions) 323 * 324 * Make the image view move the window by mouse down by default 325 *****************************************************************************/ 326 327 @implementation NSImage (VLCAppAdditions) 328 - (CGImageRef)CGImage 329 { 330 return [[NSBitmapImageRep imageRepWithData:[NSBitmapImageRep TIFFRepresentationOfImageRepsInArray: [self representations]]] CGImage]; 331 } 332 @end 333 334 projects/macosx/vlc_app/Sources/VLCBrowsableVideoView.h
rb3372f1 re6e14e4 28 28 #import "VLCAppAdditions.h" 29 29 30 @interface VLCBrowsableVideoView : VLCVideoView { 30 @class VLCMainWindowController; 31 @class VLCMediaListLayer; 32 33 @interface VLCBrowsableVideoView : NSView { 31 34 BOOL menuDisplayed; 32 35 NSArray * itemsTree; … … 51 54 NSViewAnimation * fullScreenAnim2; 52 55 NSView * tempFullScreenView; 56 IBOutlet VLCMainWindowController * mainWindowController; 57 VLCVideoLayer * videoLayer; 58 VLCMediaListLayer * mediaListLayer; 53 59 } 54 60 … … 61 67 62 68 @property (readwrite) BOOL fullScreen; 69 @property (readonly) BOOL hasVideo; 70 71 @property (readonly) VLCVideoLayer * videoLayer; 63 72 64 73 /* Set up a specific action to do, on items that don't have node. … … 71 80 - (void)displayMenu; 72 81 - (void)hideMenu; 82 83 - (IBAction)backToMediaListView:(id)sender; 73 84 @end projects/macosx/vlc_app/Sources/VLCBrowsableVideoView.m
rb3372f1 re6e14e4 29 29 #import "VLCBrowsableVideoView.h" 30 30 #import "VLCAppAdditions.h" 31 #import "VLCMediaListLayer.h" 32 #import "VLCMainWindowController.h" 31 33 32 34 /* TODO: We may want to clean up the private functions a bit... */ … … 61 63 @end 62 64 65 #pragma mark - 63 66 /****************************************************************************** 64 67 * VLCBrowsableVideoView … … 72 75 @synthesize target; 73 76 @synthesize action; 77 @synthesize videoLayer; 74 78 75 79 - (NSArray *)itemsTree { … … 104 108 [self exitFullScreenModeWithOptions:nil]; 105 109 } 110 } 111 112 - (BOOL)hasVideo 113 { 114 return videoLayer.hasVideo; 115 } 116 117 /* Binded to VideoLayer's hasVideo */ 118 - (void)setHasVideo:(BOOL)hasVideo 119 { 120 if( hasVideo ) 121 { 122 [CATransaction begin]; 123 [videoLayer removeFromSuperlayer]; 124 [self.layer addSublayer:videoLayer]; 125 videoLayer.frame = [self layer].bounds; 126 [videoLayer setAutoresizingMask:kCALayerWidthSizable|kCALayerHeightSizable]; 127 [mediaListLayer removeFromSuperlayer]; 128 [CATransaction commit]; 129 } 130 else 131 { 132 [CATransaction begin]; 133 [mediaListLayer removeFromSuperlayer]; 134 [self.layer addSublayer:mediaListLayer]; 135 mediaListLayer.frame = [self layer].bounds; 136 [mediaListLayer setAutoresizingMask:kCALayerWidthSizable|kCALayerHeightSizable]; 137 [videoLayer removeFromSuperlayer]; 138 [CATransaction commit]; 139 140 } 141 [[self layer] setNeedsDisplay]; 142 [self setNeedsDisplay:YES]; 106 143 } 107 144 … … 119 156 tempFullScreenView = [[NSView alloc] init]; 120 157 fullScreen = NO; 121 /* Observe our bindings */ 122 //[self displayMenu]; 123 //[self changeSelectedIndex:0]; 158 159 videoLayer = [[VLCVideoLayer layer] retain]; 160 [videoLayer addObserver:self forKeyPath:@"hasVideo" options:NSKeyValueObservingOptionInitial|NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld context:nil]; 161 162 [videoLayer setDelegate:self]; 163 NSAssert( mainWindowController, @"No mainWindowController" ); 164 [mainWindowController.mediaPlayer setVideoLayer: videoLayer]; 165 mediaListLayer = [[VLCMediaListLayer layerWithMediaArrayController:mainWindowController.mediaArrayController] retain]; 166 [self registerForDraggedTypes:[NSArray arrayWithObjects:NSFilenamesPboardType, NSURLPboardType, @"VLCMediaURLType", nil]]; 167 [mainWindowController.mediaArrayController setSelectsInsertedObjects:YES]; 168 [mainWindowController.mediaArrayController setAvoidsEmptySelection:YES]; 169 [[self layer] addSublayer:mediaListLayer]; 170 mediaListLayer.frame = [self layer].bounds; 171 [mediaListLayer setAutoresizingMask:kCALayerWidthSizable|kCALayerHeightSizable]; 172 173 [[self layer] setNeedsDisplay]; 174 175 } 176 177 - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context 178 { 179 if([keyPath isEqualToString:@"hasVideo"]) 180 { 181 [self setHasVideo:[object hasVideo]]; 182 return; 183 } 184 [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; 124 185 } 125 186 126 187 - (void)dealloc 127 188 { 189 /* Previously registered in */ 190 [videoLayer removeObserver:self forKeyPath:@"hasVideo"]; 191 192 [mediaListLayer release]; 193 [videoLayer release]; 128 194 [tempFullScreenView release]; 129 195 [selectedPath release]; … … 131 197 } 132 198 199 #pragma mark - 200 /* Drag and drop */ 201 202 - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender 203 { 204 NSPasteboard *pboard; 205 206 pboard = [sender draggingPasteboard]; 207 208 if ( [[pboard types] containsObject:NSFilenamesPboardType] && 209 ![mainWindowController.mediaArrayController.contentMediaList isReadOnly] ) 210 { 211 self.layer.borderColor = CGColorCreateGenericGray(0.5, 0.5); 212 self.layer.cornerRadius = 10.f; 213 self.layer.borderWidth = 10.0; 214 return NSDragOperationCopy; 215 } 216 return NSDragOperationNone; 217 } 218 219 - (void)draggingEnded:(id < NSDraggingInfo >)sender 220 { 221 [CATransaction begin]; 222 [CATransaction setValue:[NSNumber numberWithFloat:0.1] forKey:kCATransactionAnimationDuration]; 223 self.layer.borderWidth = 0.; 224 [CATransaction commit]; 225 [CATransaction begin]; 226 [mainWindowController.mediaArrayController setFilterPredicate:nil]; 227 [mainWindowController.mediaArrayController setSelectionIndex:[mainWindowController.mediaArrayController.contentMediaList count] - 1]; 228 [CATransaction commit]; 229 } 230 231 - (void)draggingExited:(id < NSDraggingInfo >)sender 232 { 233 self.layer.borderWidth = 0.; 234 } 235 236 - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender 237 { 238 NSPasteboard *pboard; 239 NSDragOperation sourceDragMask; 240 241 sourceDragMask = [sender draggingSourceOperationMask]; 242 pboard = [sender draggingPasteboard]; 243 244 if ( [[pboard types] containsObject:NSFilenamesPboardType] ) 245 { 246 NSArray *files = [pboard propertyListForType:NSFilenamesPboardType]; 247 VLCMediaList * mediaList = mainWindowController.mediaArrayController.contentMediaList; 248 if( [mediaList isReadOnly] ) 249 return NO; 250 251 [CATransaction begin]; 252 for( NSString * filePath in files ) 253 [mediaList addMedia:[VLCMedia mediaWithPath:filePath]]; 254 [CATransaction commit]; 255 } 256 return YES; 257 } 258 259 - (void)showDrag 260 { 261 262 } 263 264 #pragma mark - 133 265 /* Hiding/Displaying the menu */ 134 266 … … 185 317 } 186 318 319 - (IBAction)backToMediaListView:(id)sender 320 { 321 [mainWindowController.mediaPlayer stop]; 322 [self setHasVideo: NO]; 323 } 324 325 #pragma mark - 326 /* drawRect */ 327 187 328 - (void)drawRect:(NSRect)rect 188 329 { 189 if( [ [[self layer] sublayers] count] )190 { 191 /* Don't draw the empty view if we have a video output on screen */192 [super drawRect:rect];193 return; 194 } 195 NSColor * bottomGradient = [NSColor colorWithCalibratedWhite:0.10alpha:1.0];196 NSColor * topGradient = [NSColor colorWithCalibratedWhite:0.45alpha:1.0];197 NSGradient * gradient = [[NSGradient alloc] initWith StartingColor:bottomGradient endingColor:topGradient];198 [gradient drawInRect:self.bounds angle: 90.0];199 } 200 201 330 if( [self hasVideo] ) 331 { 332 [[NSColor blackColor] set]; 333 NSRectFill(rect); 334 return; 335 } 336 NSColor * topGradient = [NSColor colorWithCalibratedWhite:.0f alpha:1.0]; 337 NSColor * bottomGradient = [NSColor colorWithCalibratedWhite:0.35f alpha:1.0]; 338 NSGradient * gradient = [[NSGradient alloc] initWithColorsAndLocations:bottomGradient, 0.f, topGradient, 0.65f, topGradient, 1.f, nil]; 339 [gradient drawInRect:self.bounds angle:100.0]; 340 } 341 342 #pragma mark - 202 343 /* Event handling */ 203 344 … … 219 360 - (void)mouseDown:(NSEvent *)theEvent 220 361 { 221 if([theEvent clickCount] != 2) 222 return; 223 224 self.fullScreen = !self.fullScreen; 362 if([theEvent clickCount] == 1) 363 { 364 NSRect rect1 = [self bounds]; 365 NSRect rect2 = [self bounds]; 366 rect1.origin.x += [self bounds].size.width * 4./5.; 367 rect1.size.width /= 5.; 368 rect2.size.width /= 5.; 369 if(NSPointInRect([self convertPoint:[theEvent locationInWindow] fromView:nil], rect1)) 370 { 371 [mainWindowController.mediaArrayController selectNext:self]; 372 } 373 else if(NSPointInRect([self convertPoint:[theEvent locationInWindow] fromView:nil], rect2)) 374 { 375 [mainWindowController.mediaArrayController selectPrevious:self]; 376 } 377 return; 378 } 379 if([theEvent clickCount] == 2) 380 { 381 [mainWindowController mediaListViewItemDoubleClicked:self]; 382 return; 383 } 384 if([theEvent clickCount] == 3) 385 { 386 self.fullScreen = !self.fullScreen; 387 } 225 388 } 226 389 … … 238 401 [self hideMenu]; 239 402 } 240 else if(!menuDisplayed )403 else if(!menuDisplayed && [[theEvent charactersIgnoringModifiers] characterAtIndex:0] == NSRightArrowFunctionKey) 241 404 { 242 405 [self displayMenu]; … … 265 428 @end 266 429 430 #pragma mark - 267 431 /****************************************************************************** 268 432 * VLCBrowsableVideoView (Private) 269 433 */ 434 270 435 @implementation VLCBrowsableVideoView (Private) 271 436 + (CAScrollLayer *)menuLayer … … 491 656 @end 492 657 658 #pragma mark - 659 493 660 @implementation VLCBrowsableVideoView (FullScreenTransition) 494 661 projects/macosx/vlc_app/Sources/VLCController.m
rb3372f1 re6e14e4 53 53 urlToRepresentedFileName = [[[VLCURLToRepresentedFileNameTransformer alloc] init] autorelease]; 54 54 [NSValueTransformer setValueTransformer:(id)urlToRepresentedFileName forName:@"URLToRepresentedFileNameTransformer"]; 55 VLCSelectionIndexToDescriptionTransformer *indexToDescription; 56 indexToDescription = [[[VLCSelectionIndexToDescriptionTransformer alloc] init] autorelease]; 57 [NSValueTransformer setValueTransformer:(id)indexToDescription forName:@"SelectionIndexToDescriptionTransformer"]; 55 58 56 59 /*********************************** … … 60 63 [[[VLCMediaDiscoverer alloc] initWithName:@"shoutcasttv"] autorelease], 61 64 [[[VLCMediaDiscoverer alloc] initWithName:@"shoutcast"] autorelease], 62 [[[VLCMediaDiscoverer alloc] initWithName:@"sap"] autorelease], nil]; 63 64 NSArray * playlists = [NSMutableArray arrayWithObjects:[VLCMedia mediaAsNodeWithName:@"Default Playlist"], nil]; 65 66 NSDictionary * playlistsAsDictionary = [NSMutableDictionary dictionaryWithObjectsAndKeys: 67 [@"Playlists" uppercaseString], @"descriptionInCategoriesList", 68 @"Playlists", @"descriptionInVideoView", 69 [NSNumber numberWithBool:NO], @"selectableInCategoriesList", 70 playlists, @"childrenInCategoriesList", 71 playlists, @"childrenInVideoView", 72 nil]; 65 [[[VLCMediaDiscoverer alloc] initWithName:@"sap"] autorelease], 66 [[[VLCMediaDiscoverer alloc] initWithName:@"freebox"] autorelease], nil]; 73 67 74 68 self.categories = [NSArray arrayWithObjects: … … 80 74 mediaDiscoverers, @"childrenInVideoView", 81 75 nil], 82 playlistsAsDictionary,76 [VLCMedia mediaAsNodeWithName:@"Playlist"], 83 77 nil]; 84 78 projects/macosx/vlc_app/Sources/VLCExceptionHandler.m
rb3372f1 re6e14e4 47 47 { 48 48 [self printStackTrace:exception]; 49 NSRunCriticalAlertPanel(@"Exception not handled!", 49 NSLog(@"*** Exception Handled! %@: %@", [exception name], [exception reason]); 50 int ret = NSRunCriticalAlertPanel(@"Exception not handled!", 50 51 [NSString stringWithFormat:@"%@: %@\n\nBack trace has been printed to Console.\n\nWe will now wait for debugger connection...\n", 51 52 [exception name], [exception reason]], 52 @"Wait Debugger", nil, nil); 53 NSLog(@"*** Exception Handled! %@: %@", [exception name], [exception reason]); 53 @"Quit", @"Wait Debugger", nil); 54 if( ret == NSOKButton ) 55 { 56 [NSApp terminate:self]; 57 } 54 58 return YES; 55 59 } projects/macosx/vlc_app/Sources/VLCFullScreenControllerWindow.h
rb3372f1 re6e14e4 27 27 #import <VLCKit/VLCKit.h> 28 28 #import "VLCAppAdditions.h" 29 #import "VLCMainWindow .h"29 #import "VLCMainWindowController.h" 30 30 31 31 … … 50 50 51 51 /* Owner */ 52 IBOutlet VLCMainWindow * mainWindow;52 IBOutlet VLCMainWindowController * mainWindowController; 53 53 54 54 /* Draging the window using its content */ projects/macosx/vlc_app/Sources/VLCFullScreenControllerWindow.m
rb3372f1 re6e14e4 83 83 84 84 /* WindowView setup */ 85 [[mainWindow .videoView window] setAcceptsMouseMovedEvents:YES];86 [[mainWindow .videoView window] makeFirstResponder:mainWindow.videoView];87 [mainWindow .videoView setPostsBoundsChangedNotifications: YES];88 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(videoViewDidChangeBounds:) name:NSViewBoundsDidChangeNotification object:(id)mainWindow .videoView];85 [[mainWindowController.videoView window] setAcceptsMouseMovedEvents:YES]; 86 [[mainWindowController.videoView window] makeFirstResponder:mainWindowController.videoView]; 87 [mainWindowController.videoView setPostsBoundsChangedNotifications: YES]; 88 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(videoViewDidChangeBounds:) name:NSViewBoundsDidChangeNotification object:(id)mainWindowController.videoView]; 89 89 90 90 /* Make sure we can know when the mouse is inside us */ … … 103 103 [mediaPositionSlider setNeedsDisplay:YES]; 104 104 105 [mediaPositionSlider bind:@"enabled" toObject:mainWindow .mediaPlayer withKeyPath:@"media" options: [NSDictionary dictionaryWithObject:@"NonNilAsBoolTransformer" forKey:NSValueTransformerNameBindingOption]];106 [mediaPositionSlider bind:@"enabled2" toObject:mainWindow .mediaPlayer withKeyPath:@"seekable" options: nil];107 108 [mediaPositionSlider bind:@"value" toObject:mainWindow .mediaPlayer withKeyPath:@"position" options:105 [mediaPositionSlider bind:@"enabled" toObject:mainWindowController.mediaPlayer withKeyPath:@"media" options: [NSDictionary dictionaryWithObject:@"NonNilAsBoolTransformer" forKey:NSValueTransformerNameBindingOption]]; 106 [mediaPositionSlider bind:@"enabled2" toObject:mainWindowController.mediaPlayer withKeyPath:@"seekable" options: nil]; 107 108 [mediaPositionSlider bind:@"value" toObject:mainWindowController.mediaPlayer withKeyPath:@"position" options: 109 109 [NSDictionary dictionaryWithObjectsAndKeys:@"Float10000FoldTransformer", NSValueTransformerNameBindingOption, 110 110 [NSNumber numberWithBool:NO], NSConditionallySetsEnabledBindingOption, nil ]]; 111 111 112 112 113 [fillScreenButton bind:@"value" toObject:mainWindow .videoView withKeyPath:@"fillScreen" options: nil];114 [fullScreenButton bind:@"value" toObject:mainWindow .videoView withKeyPath:@"fullScreen" options: nil];115 116 [mediaReadingProgressText bind:@"value" toObject:mainWindow .mediaPlayer withKeyPath:@"time.stringValue" options: nil];117 [mediaDescriptionText bind:@"value" toObject:mainWindow .mediaPlayer withKeyPath:@"description" options: nil];118 119 /* m ediaPlayer */120 [mediaPlayerPlayPauseStopButton bind:@"enabled" toObject:mainWindow .mediaPlayer withKeyPath:@"media" options: [NSDictionary dictionaryWithObject:@"NonNilAsBoolTransformer" forKey:NSValueTransformerNameBindingOption]];121 [mediaPlayerPlayPauseStopButton bind:@"state" toObject:mainWindow .mediaPlayer withKeyPath:@"playing" options: nil];122 [mediaPlayerPlayPauseStopButton bind:@"alternateImage" toObject:mainWindow .mediaPlayer withKeyPath:@"stateAsFullScreenButtonAlternateImage" options: nil];123 [mediaPlayerPlayPauseStopButton bind:@"image" toObject:mainWindow .mediaPlayer withKeyPath:@"stateAsFullScreenButtonImage" options: nil];124 [mediaPlayerBackwardPrevButton bind:@"enabled" toObject:mainWindow .mediaPlayer withKeyPath:@"playing" options: nil];125 [mediaPlayerForwardNextButton bind:@"enabled" toObject:mainWindow .mediaPlayer withKeyPath:@"playing" options: nil];126 [mediaPlayerForwardNextButton setTarget:mainWindow .mediaPlayer];113 [fillScreenButton bind:@"value" toObject:mainWindowController.videoView withKeyPath:@"videoLayer.fillScreen" options: nil]; 114 [fullScreenButton bind:@"value" toObject:mainWindowController.videoView withKeyPath:@"fullScreen" options: nil]; 115 116 [mediaReadingProgressText bind:@"value" toObject:mainWindowController.mediaPlayer withKeyPath:@"time.stringValue" options: nil]; 117 [mediaDescriptionText bind:@"value" toObject:mainWindowController.mediaPlayer withKeyPath:@"description" options: nil]; 118 119 /* mainWindowController.mediaPlayer */ 120 [mediaPlayerPlayPauseStopButton bind:@"enabled" toObject:mainWindowController.mediaPlayer withKeyPath:@"media" options: [NSDictionary dictionaryWithObject:@"NonNilAsBoolTransformer" forKey:NSValueTransformerNameBindingOption]]; 121 [mediaPlayerPlayPauseStopButton bind:@"state" toObject:mainWindowController.mediaPlayer withKeyPath:@"playing" options: nil]; 122 [mediaPlayerPlayPauseStopButton bind:@"alternateImage" toObject:mainWindowController.mediaPlayer withKeyPath:@"stateAsFullScreenButtonAlternateImage" options: nil]; 123 [mediaPlayerPlayPauseStopButton bind:@"image" toObject:mainWindowController.mediaPlayer withKeyPath:@"stateAsFullScreenButtonImage" options: nil]; 124 [mediaPlayerBackwardPrevButton bind:@"enabled" toObject:mainWindowController.mediaPlayer withKeyPath:@"playing" options: nil]; 125 [mediaPlayerForwardNextButton bind:@"enabled" toObject:mainWindowController.mediaPlayer withKeyPath:@"playing" options: nil]; 126 [mediaPlayerForwardNextButton setTarget:mainWindowController.mediaPlayer]; 127 127 [mediaPlayerForwardNextButton setAction:@selector(fastForward)]; 128 [mediaPlayerBackwardPrevButton setTarget:mainWindow .mediaPlayer];128 [mediaPlayerBackwardPrevButton setTarget:mainWindowController.mediaPlayer]; 129 129 [mediaPlayerBackwardPrevButton setAction:@selector(rewind)]; 130 [mediaPlayerPlayPauseStopButton setTarget:mainWindow .mediaPlayer];130 [mediaPlayerPlayPauseStopButton setTarget:mainWindowController.mediaPlayer]; 131 131 [mediaPlayerPlayPauseStopButton setAction:@selector(pause)]; 132 132 133 [self bind:@"fullScreen" toObject:mainWindow .videoView withKeyPath:@"fullScreen" options: nil];133 [self bind:@"fullScreen" toObject:mainWindowController.videoView withKeyPath:@"fullScreen" options: nil]; 134 134 135 135 active = NO; … … 209 209 - (void)updateTrackingRect 210 210 { 211 VLC VideoView * videoView = mainWindow.videoView;211 VLCBrowsableVideoView * videoView = mainWindowController.videoView; 212 212 213 213 if( videoViewTrackingArea ) projects/macosx/vlc_app/Sources/VLCMainWindow.h
rb3372f1 re6e14e4 24 24 25 25 #import <Cocoa/Cocoa.h> 26 #import "VLCController.h"27 #import "VLCMediaArrayController.h"28 #import "VLCAppAdditions.h"29 #import "VLCBrowsableVideoView.h"30 26 31 27 @interface VLCMainWindow : NSWindow { 32 /* IB elements */33 IBOutlet id mediaListItemFetchedStatus;34 IBOutlet id mediaListItemsCount;35 IBOutlet id mediaListSearchField;36 37 IBOutlet NSOutlineView * categoriesListView;38 IBOutlet NSTableView * mediaListView;39 40 IBOutlet VLCBrowsableVideoView * videoView;41 IBOutlet id fillScreenButton;42 IBOutlet id fullScreenButton;43 IBOutlet NSSlider * mediaReadingProgressSlider;44 IBOutlet NSTextField * mediaReadingProgressText;45 IBOutlet NSTextField * mediaDescriptionText;46 47 IBOutlet NSSlider * mediaSoundVolume;48 49 IBOutlet NSButton * mediaPlayerForwardNextButton;50 IBOutlet NSButton * mediaPlayerBackwardPrevButton;51 IBOutlet NSButton * mediaPlayerPlayPauseStopButton;52 53 IBOutlet id navigatorViewToggleButton;54 IBOutlet VLCOneSplitView * mainSplitView;55 IBOutlet NSView * navigatorView;56 IBOutlet NSView * videoPlayerAndControlView;57 IBOutlet NSView * controlView;58 59 IBOutlet NSButton * addPlaylistButton;60 IBOutlet NSButton * removePlaylistButton;61 62 /* Toolbar */63 IBOutlet NSView * toolbarMediaAudioVolume;64 IBOutlet NSView * toolbarMediaDescription;65 IBOutlet NSView * toolbarMediaControl;66 67 IBOutlet VLCMediaPlayer * mediaPlayer;68 69 IBOutlet VLCController * controller; /* This is a VLCController binded to the File's Owner of the nib */70 71 /* Controllers */72 NSTreeController * categoriesTreeController;73 VLCMediaArrayController * mediaArrayController;74 75 /* Window state */76 CGFloat navigatorHeight;77 28 } 78 29 79 @property BOOL navigatorViewVisible;80 @property (readonly) VLCMediaPlayer * mediaPlayer;81 @property (readonly) VLCBrowsableVideoView * videoView;82 30 @end projects/macosx/vlc_app/Sources/VLCMainWindow.m
rb3372f1 re6e14e4 24 24 25 25 #import "VLCMainWindow.h" 26 #import "ImageAndTextCell.h"27 #import "VLCMediaArrayController.h"28 #import "VLCBrowsableVideoView.h"29 #import "VLCAppAdditions.h"30 #import "VLCFullScreenControllerWindow.h"31 26 32 @interface VLCMainWindow (NavigatorViewHidingShowing)33 @property float contentHeight; /* animatable, keep the mainSplitView cursor at the same place, enabling playlist(navigator) togling */34 @end35 36 /******************************************************************************37 * VLCMainWindow (CategoriesListDelegate)38 */39 @implementation VLCMainWindow (CategoriesListDelegate)40 - (BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item41 {42 return [[item representedObject] isKindOfClass:[NSDictionary class]];43 }44 - (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item45 {46 return !([[item representedObject] isKindOfClass:[NSDictionary class]]);47 }48 - (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item49 {50 [cell setRepresentedObject:[item representedObject]];51 }52 @end53 54 /******************************************************************************55 * VLCMainWindow (CategoriesListDataSource)56 */57 @implementation VLCMainWindow (CategoriesListDataSource)58 /* Drag and drop */59 - (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id < NSDraggingInfo >)info item:(id)item childIndex:(NSInteger)index60 {61 int i;62 63 if(![item respondsToSelector:@selector(representedObject)])64 return NO;65 66 NSArray *droppedItems = [[info draggingPasteboard] propertyListForType:@"VLCMediaURLType"];67 if( !droppedItems )68 droppedItems = [[info draggingPasteboard] propertyListForType:NSFilenamesPboardType];69 if( !droppedItems )70 droppedItems = [[info draggingPasteboard] propertyListForType:NSURLPboardType];71 72 NSAssert( droppedItems, @"Dropped an unsupported object type on the outline View" );73 74 VLCMediaList * mediaList = [(VLCMedia *)[item representedObject] subitems];75 76 for (i = 0; i < [droppedItems count]; i++)77 {78 NSString * filename = [droppedItems objectAtIndex:i];79 VLCMedia *media = [VLCMedia mediaWithPath:filename];80 [mediaList lock];81 [mediaList insertMedia:media atIndex:index+1];82 [mediaList unlock];83 }84 return YES;85 }86 87 - (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id < NSDraggingInfo >)info proposedItem:(id)item proposedChildIndex:(NSInteger)index88 {89 NSArray *droppedItems = [[info draggingPasteboard] propertyListForType:@"VLCMediaURLType"];90 if( !droppedItems )91 droppedItems = [[info draggingPasteboard] propertyListForType:NSFilenamesPboardType];92 if( !droppedItems )93 droppedItems = [[info draggingPasteboard] propertyListForType:NSURLPboardType];94 95 if(! droppedItems ||96 ![item respondsToSelector:@selector(representedObject)] ||97 ![[item representedObject] isKindOfClass:[VLCMedia class]] )98 {99 return NSDragOperationNone;100 }101 102 return NSDragOperationMove;103 }104 @end105 27 106 28 /****************************************************************************** … … 109 31 @implementation VLCMainWindow 110 32 111 @synthesize mediaPlayer;112 @synthesize videoView;113 114 - (void)awakeFromNib;115 {116 NSTableColumn * tableColumn;117 118 /* Check ib outlets */119 NSAssert( mainSplitView, @"No split view or wrong split view");120 NSAssert( fullScreenButton, @"No fullscreen button");121 122 /***********************************123 * Init the media player124 */125 [mediaPlayer setVideoView:videoView];126 127 /***********************************128 * CategoriesList OutlineView content129 */130 /* categoriesTreeController */131 categoriesTreeController = [[NSTreeController alloc] init];132 [categoriesTreeController setContent:controller.categories];133 134 [categoriesTreeController setChildrenKeyPath:@"childrenInCategoriesList"];135 //[categoriesTreeController bind:@"contentArray" toObject:controller withKeyPath:@"arrayOfMasters" options:nil];136 137 /* Bind the "name" table column */138 tableColumn = [categoriesListView tableColumnWithIdentifier:@"name"];139 [tableColumn bind:@"value" toObject: categoriesTreeController withKeyPath:@"arrangedObjects.descriptionInCategoriesList" options:nil];140 [tableColumn setEditable:YES];141 /* FIXME: this doesn't work obviously. */142 [tableColumn bind:@"editable" toObject: categoriesTreeController withKeyPath:@"arrangedObjects.editableInCategoriesList" options:nil];143 144 /* Use an ImageAndTextCell in the "name" table column */145 ImageAndTextCell * cell = [[ImageAndTextCell alloc] init];146 [cell setFont:[[tableColumn dataCell] font]];147 [cell setImageKeyPath
