Created
January 11, 2011 20:26
-
-
Save purem/775060 to your computer and use it in GitHub Desktop.
View setup code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//In init | |
fileViewController = [[JTFileViewController alloc] initWithFrame:CGRectMakeZero()]; | |
searchMatrixViewController = [[JTSearchMatrixViewController alloc] initWithFrame:CGRectMakeZero()]; | |
documentViewController = [[JTDocumentViewController alloc] initWithFrame:CGRectMakeZero()]; | |
metaViewController = [[JTMetaViewController alloc] initWithFrame:CGRectMakeZero()]; | |
- (void)setViewMode:(int)newViewMode animated:(BOOL)animated | |
{ | |
[[CPNotificationCenter defaultCenter] postNotificationName:"JTApplicationBusy" object:nil]; | |
firstSplitView = nil; | |
var currentFileViewWidth = 0; | |
if (fileViewController) | |
{ | |
currentFileViewWidth = [[fileViewController view] frame].size.width; | |
} | |
var currentMetaViewWidth = 0; | |
if (metaViewController) | |
{ | |
currentMetaViewWidth = [[metaViewController view] frame].size.width; | |
} | |
var windowFrame = [[[CPApplication sharedApplication] mainWindow] frame]; | |
var width = windowFrame.size.width; | |
var height = windowFrame.size.height; | |
if (newViewMode == ViewModeIdentifierTraditional) | |
{ | |
firstSplitView = [[CPSplitView alloc] initWithFrame:windowFrame]; | |
[firstSplitView setVertical:YES]; | |
[firstSplitView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; | |
[firstSplitView setIsPaneSplitter:NO]; | |
[self setView:firstSplitView]; | |
var tableViewPosition = [[searchMatrixViewController tableView] selectedRow]; | |
[[fileViewController view] setFrame:CGRectMake(0, 0, currentFileViewWidth, height)]; | |
[firstSplitView addSubview:[fileViewController view]]; | |
secondSplitViewContainer = [[CPView alloc] initWithFrame:CGRectMake(currentFileViewWidth, 0, CGRectGetWidth([firstSplitView frame]) - currentFileViewWidth, CGRectGetHeight([firstSplitView frame]))]; | |
[secondSplitViewContainer setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; | |
[firstSplitView addSubview:secondSplitViewContainer]; | |
secondSplitView = [[CPSplitView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth([secondSplitViewContainer bounds]), CGRectGetHeight([secondSplitViewContainer bounds]))]; | |
[secondSplitView setVertical:NO]; | |
[secondSplitView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; | |
[secondSplitViewContainer addSubview:secondSplitView]; | |
thirdSplitViewContainer = [[CPView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth([secondSplitViewContainer bounds]), CGRectGetHeight([secondSplitViewContainer bounds]) - searchMatrixHeight)]; | |
[thirdSplitViewContainer setAutoresizingMask:CPViewHeightSizable | CPViewWidthSizable]; | |
[secondSplitView addSubview:thirdSplitViewContainer]; | |
[[searchMatrixViewController view] setFrame:CGRectMake(0, 0, CGRectGetWidth([secondSplitViewContainer bounds]), searchMatrixHeight)]; | |
[secondSplitView addSubview:[searchMatrixViewController view]]; | |
//Add the secondary vertical split and its views (documentView and metaView) | |
thirdSplitView = [[CPSplitView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth([thirdSplitViewContainer bounds]), CGRectGetHeight([thirdSplitViewContainer bounds]))]; | |
[thirdSplitView setVertical:YES]; | |
[thirdSplitView setIsPaneSplitter:NO]; | |
[thirdSplitView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; | |
[thirdSplitViewContainer addSubview:thirdSplitView]; | |
[[documentViewController view] setFrame:CGRectMake(0, 0, CGRectGetWidth([thirdSplitView bounds]) - currentMetaViewWidth, CGRectGetHeight([thirdSplitView bounds]))]; | |
[thirdSplitView addSubview:[documentViewController view]]; | |
[[metaViewController view] setFrame:CGRectMake(0, 0, currentMetaViewWidth, CGRectGetHeight([thirdSplitView bounds]))]; | |
[thirdSplitView addSubview:[metaViewController view]]; | |
} | |
else | |
{ | |
firstSplitView = [[CPSplitView alloc] initWithFrame:windowFrame]; | |
[firstSplitView setVertical:YES]; | |
[firstSplitView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; | |
[firstSplitView setIsPaneSplitter:YES]; | |
[self setView:firstSplitView]; | |
[[fileViewController view] setFrame:CGRectMake(0, 0, currentFileViewWidth, CGRectGetHeight([firstSplitView bounds]))]; | |
[firstSplitView addSubview:[fileViewController view]]; | |
[[searchMatrixViewController view] setFrame:CGRectMake(0, 0, CGRectGetHeight([firstSplitView bounds])/2 - currentFileViewWidth, CGRectGetHeight([firstSplitView bounds]))]; | |
[firstSplitView addSubview:[searchMatrixViewController view]]; | |
[[documentViewController view] setFrame:CGRectMake(0, 0, CGRectGetHeight([firstSplitView bounds])/2 - currentMetaViewWidth, CGRectGetHeight([firstSplitView bounds]))]; | |
[firstSplitView addSubview:[documentViewController view]]; | |
[[metaViewController view] setFrame:CGRectMake(0, 0, currentMetaViewWidth, CGRectGetHeight([firstSplitView bounds]))]; | |
[firstSplitView addSubview:[metaViewController view]]; | |
} | |
[[CPNotificationCenter defaultCenter] postNotificationName:"JTApplicationFree" object:nil]; | |
//[[searchMatrixViewController tableView] selectRowIndexes:[CPIndexSet indexSetWithIndex:tableViewPosition] byExtendingSelection:NO]; | |
viewMode = newViewMode; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment