| 1 |
masaki |
281 |
// |
| 2 |
|
|
// XspfMCoverFlowViewController.m |
| 3 |
|
|
// XspfManager |
| 4 |
|
|
// |
| 5 |
|
|
// Created by Hori,Masaki on 10/01/21. |
| 6 |
|
|
// Copyright 2010 masakih. All rights reserved. |
| 7 |
|
|
// |
| 8 |
|
|
|
| 9 |
|
|
#import "XspfMCoverFlowViewController.h" |
| 10 |
|
|
|
| 11 |
|
|
#import "MBCoverFlowView.h" |
| 12 |
|
|
#import "XspfMListViewController.h" |
| 13 |
|
|
#import "XspfMCoverFlowAccessoryViewController.h" |
| 14 |
|
|
|
| 15 |
|
|
#import "XspfMDragControl.h" |
| 16 |
|
|
|
| 17 |
|
|
|
| 18 |
|
|
@implementation XspfMCoverFlowViewController |
| 19 |
|
|
|
| 20 |
|
|
- (id)init |
| 21 |
|
|
{ |
| 22 |
|
|
self = [super initWithNibName:@"XspfMCoverFlowView" bundle:nil]; |
| 23 |
|
|
|
| 24 |
|
|
return self; |
| 25 |
|
|
} |
| 26 |
|
|
|
| 27 |
|
|
- (void)awakeFromNib |
| 28 |
|
|
{ |
| 29 |
|
|
NSArrayController *rep = [self representedObject]; |
| 30 |
|
|
|
| 31 |
|
|
coverFlow.imageKeyPath = @"thumbnail"; |
| 32 |
|
|
coverFlow.showsScrollbar = YES; |
| 33 |
masaki |
287 |
coverFlow.itemSize = NSMakeSize(200, 150); |
| 34 |
masaki |
281 |
|
| 35 |
|
|
[dragControl setDrawsBackground:NO]; |
| 36 |
|
|
[dragControl setDragPosition:NSImageAlignCenter]; |
| 37 |
|
|
[dragControl setVertical:NO]; |
| 38 |
|
|
|
| 39 |
|
|
listViewController = [[XspfMListViewController alloc] init]; |
| 40 |
|
|
[listViewController view]; |
| 41 |
|
|
[listViewController setRepresentedObject:rep]; |
| 42 |
|
|
[listViewController recalculateKeyViewLoop]; |
| 43 |
|
|
[listPlaceHolder addSubview:[listViewController view]]; |
| 44 |
|
|
[[listViewController view] setFrame:[listPlaceHolder bounds]]; |
| 45 |
|
|
[self recalculateKeyViewLoop]; |
| 46 |
|
|
|
| 47 |
|
|
accessoryController = [[XspfMCoverFlowAccessoryViewController alloc] init]; |
| 48 |
|
|
[accessoryController setXspfMDragControlDelegate:self]; |
| 49 |
|
|
coverFlow.dragControl = [accessoryController dragControl]; |
| 50 |
|
|
coverFlow.accessoryController = accessoryController; |
| 51 |
masaki |
290 |
|
| 52 |
|
|
coverFlow.action = @selector(openXspf:); |
| 53 |
masaki |
281 |
} |
| 54 |
|
|
|
| 55 |
|
|
- (void)setRepresentedObject:(id)representedObject |
| 56 |
|
|
{ |
| 57 |
|
|
[super setRepresentedObject:representedObject]; |
| 58 |
masaki |
283 |
[listViewController setRepresentedObject:representedObject]; |
| 59 |
masaki |
281 |
|
| 60 |
|
|
if(representedObject) { |
| 61 |
|
|
[coverFlow bind:@"content" toObject:representedObject withKeyPath:@"arrangedObjects" options:nil]; |
| 62 |
|
|
[coverFlow bind:@"selectionIndex" toObject:representedObject withKeyPath:@"selectionIndex" options:nil]; |
| 63 |
masaki |
283 |
} else { |
| 64 |
|
|
[coverFlow unbind:@"content"]; |
| 65 |
|
|
[coverFlow unbind:@"selectionIndex"]; |
| 66 |
masaki |
281 |
} |
| 67 |
|
|
} |
| 68 |
|
|
|
| 69 |
|
|
- (void)dragControl:(XspfMDragControl *)control dragDelta:(NSSize)delta |
| 70 |
|
|
{ |
| 71 |
|
|
HMLog(HMLogLevelDebug, @"Enter %@", NSStringFromSelector(_cmd)); |
| 72 |
|
|
|
| 73 |
|
|
CGFloat libWidth = [coverFlow frame].size.height; |
| 74 |
|
|
[splitView setPosition:libWidth - delta.height ofDividerAtIndex:0]; |
| 75 |
|
|
} |
| 76 |
|
|
|
| 77 |
|
|
|
| 78 |
|
|
@end |