Skip to content
Snippets Groups Projects
Commit 7da23fdd authored by Maxime Graulich's avatar Maxime Graulich
Browse files

Use segue for iPhone

parent 593d309d
No related branches found
No related tags found
No related merge requests found
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
@property (strong, nonatomic) UIWindow *window; @property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) UITableViewController *modelListController; @property (strong, nonatomic) UITableViewController *modelListController;
@property (strong, nonatomic) SplitViewController *splitViewController; @property (strong, nonatomic) SplitViewController *splitViewController; // iPad
@end @end
...@@ -14,11 +14,10 @@ ...@@ -14,11 +14,10 @@
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{ {
// Override point for customization after application launch. // Override point for customization after application launch.
self.modelListController = (ModelListController *)self.window.rootViewController;
if([[UIDevice currentDevice].model isEqualToString:@"iPad"] || [[UIDevice currentDevice].model isEqualToString:@"iPad Simulator"]){
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPadStoryboard" bundle:nil]; UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPadStoryboard" bundle:nil];
self.modelListController = (ModelListController *)self.window.rootViewController;
if([[UIDevice currentDevice].model isEqualToString:@"iPad"] || [[UIDevice currentDevice].model isEqualToString:@"iPad Simulator"])
self.splitViewController = [storyboard instantiateViewControllerWithIdentifier:@"SplitViewController"]; self.splitViewController = [storyboard instantiateViewControllerWithIdentifier:@"SplitViewController"];
}
return YES; return YES;
} }
......
...@@ -58,12 +58,12 @@ ...@@ -58,12 +58,12 @@
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(requestRender) name:@"requestRender" object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(requestRender) name:@"requestRender" object:nil];
if(![[UIDevice currentDevice].model isEqualToString:@"iPad"] && ![[UIDevice currentDevice].model isEqualToString:@"iPad Simulator"]){ if(![[UIDevice currentDevice].model isEqualToString:@"iPad"] && ![[UIDevice currentDevice].model isEqualToString:@"iPad Simulator"]){
UIBarButtonItem *settings = [[UIBarButtonItem alloc] initWithTitle:@"Settings" style:UIBarButtonItemStyleBordered target:self action:@selector(showSettings)]; UIBarButtonItem *settings = [[UIBarButtonItem alloc] initWithTitle:@"Settings" style:UIBarButtonItemStyleBordered target:self action:@selector(showSettings)];
UIBarButtonItem *postpro = [[UIBarButtonItem alloc] initWithTitle:@"Post processing" style:UIBarButtonItemStyleBordered target:self action:@selector(showPostpro)]; UIBarButtonItem *postpro = [[UIBarButtonItem alloc] initWithTitle:@"Post-pro" style:UIBarButtonItemStyleBordered target:self action:@selector(showPostpro)];
UIBarButtonItem *more = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(showMore:)]; UIBarButtonItem *more = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(showMore:)];
UIBarButtonItem *model = [[UIBarButtonItem alloc] initWithTitle:@"Load model" style:UIBarButtonItemStyleBordered target:self action:@selector(showModelsList)]; UIBarButtonItem *model = [[UIBarButtonItem alloc] initWithTitle:@"Models" style:UIBarButtonItemStyleBordered target:self action:@selector(showModelsList)];
NSArray *btns = [[NSArray alloc] initWithObjects:settings, postpro, more, nil]; NSArray *btns = [[NSArray alloc] initWithObjects:settings, postpro, more, nil];
[self.navigationItem setLeftBarButtonItems:btns]; [self.navigationItem setLeftBarButtonItem:model];
[self.navigationItem setRightBarButtonItem:model]; [self.navigationItem setRightBarButtonItems:btns];
} }
else { else {
UIBarButtonItem *model = [[UIBarButtonItem alloc] initWithTitle:@"Models list" style:UIBarButtonItemStyleBordered target:self action:@selector(showModelsList)]; UIBarButtonItem *model = [[UIBarButtonItem alloc] initWithTitle:@"Models list" style:UIBarButtonItemStyleBordered target:self action:@selector(showModelsList)];
...@@ -138,8 +138,7 @@ ...@@ -138,8 +138,7 @@
- (void) showSettings - (void) showSettings
{ {
MasterViewController *masterViewController = [[MasterViewController alloc] init]; [self performSegueWithIdentifier:@"showSettingsSegue" sender:self];
[self.navigationController pushViewController:masterViewController animated:true];
} }
- (void) showPostpro - (void) showPostpro
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
/* OpenGL name for the depth buffer that is attached to viewFramebuffer, if it exists (0 if it does not exist) */ /* OpenGL name for the depth buffer that is attached to viewFramebuffer, if it exists (0 if it does not exist) */
GLuint depthRenderbuffer; GLuint depthRenderbuffer;
NSString *docPath;
BOOL rendering; BOOL rendering;
@public @public
/* our GModel drawing class */ /* our GModel drawing class */
......
...@@ -55,7 +55,6 @@ ...@@ -55,7 +55,6 @@
[EAGLContext setCurrentContext:context]; [EAGLContext setCurrentContext:context];
glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer); glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
glViewport(0, 0, backingWidth, backingHeight); // need this ...??
mContext->initView(backingWidth, backingHeight); mContext->initView(backingWidth, backingHeight);
mContext->drawView(); mContext->drawView();
...@@ -66,8 +65,8 @@ ...@@ -66,8 +65,8 @@
- (void)load:(NSString*) file - (void)load:(NSString*) file
{ {
mContext->load(*new std::string([file fileSystemRepresentation])); mContext->load(*new std::string([file fileSystemRepresentation]));
[[NSNotificationCenter defaultCenter] postNotificationName:@"resetParameters" object:nil];
[self drawView]; [self drawView];
[[NSNotificationCenter defaultCenter] postNotificationName:@"refreshParameters" object:nil];
} }
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{ {
......
...@@ -86,7 +86,10 @@ ...@@ -86,7 +86,10 @@
{ {
NSMutableArray *section = [_sections objectAtIndex:j]; NSMutableArray *section = [_sections objectAtIndex:j];
for(int k=0; k<[section count];k++) for(int k=0; k<[section count];k++)
if([[(parameter*)[section objectAtIndex: k] getName] isEqualToString:name]){found = true; break;} if([[[section objectAtIndex: k] getName] isEqualToString:name]) {
found = true;
break;
}
if(!found) if(!found)
[self addParameterNumber:number[i] inSection:section]; [self addParameterNumber:number[i] inSection:section];
found = true; found = true;
...@@ -117,7 +120,10 @@ ...@@ -117,7 +120,10 @@
{ {
NSMutableArray *section = [_sections objectAtIndex:j]; NSMutableArray *section = [_sections objectAtIndex:j];
for(int k=0; k<[section count];k++) for(int k=0; k<[section count];k++)
if([[(parameter*)[section objectAtIndex: k] getName] isEqualToString:name]){found = true; break;} // the parameters is already in the section if([[(parameter*)[section objectAtIndex: k] getName] isEqualToString:name]) {
found = true;
break;
} // the parameters is already in the section
if(!found) if(!found)
[self addParameterString:string[i] inSection:section]; [self addParameterString:string[i] inSection:section];
found = true; found = true;
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
NSMutableArray *models, *modelsName, *modelsDescription; NSMutableArray *models, *modelsName, *modelsDescription;
NSString *currentElement; NSString *currentElement;
NSMutableString *currentElementValue; NSMutableString *currentElementValue;
NSString *selectedModel;
} }
@property (nonatomic, retain) EAGLView *glView; @property (nonatomic, retain) EAGLView *glView;
@end @end
...@@ -11,11 +11,6 @@ ...@@ -11,11 +11,6 @@
#import "Utils.h" #import "Utils.h"
@interface ModelListController () {
}
@end
@implementation ModelListController @implementation ModelListController
-(void)viewDidLoad -(void)viewDidLoad
{ {
...@@ -75,9 +70,10 @@ ...@@ -75,9 +70,10 @@
} }
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{ {
if([[UIDevice currentDevice].model isEqualToString:@"iPad"] || [[UIDevice currentDevice].model isEqualToString:@"iPad Simulator"]){
AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate; AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
appDelegate.splitViewController.initialModel = [NSString stringWithFormat:@"%@/%@/%@.geo",[Utils getApplicationDocumentsDirectory],[models objectAtIndex:indexPath.row], [models objectAtIndex:indexPath.row]]; selectedModel = [NSString stringWithFormat:@"%@/%@/%@.geo",[Utils getApplicationDocumentsDirectory],[models objectAtIndex:indexPath.row], [models objectAtIndex:indexPath.row]];
if([[UIDevice currentDevice].model isEqualToString:@"iPad"] || [[UIDevice currentDevice].model isEqualToString:@"iPad Simulator"]){
appDelegate.splitViewController.initialModel = selectedModel;
[UIView transitionWithView:appDelegate.window [UIView transitionWithView:appDelegate.window
duration:0.5 duration:0.5
options:UIViewAnimationOptionTransitionFlipFromLeft options:UIViewAnimationOptionTransitionFlipFromLeft
...@@ -86,9 +82,7 @@ ...@@ -86,9 +82,7 @@
} }
else else
{ {
DetailViewController *detailVIewController = [[DetailViewController alloc] init]; [self performSegueWithIdentifier:@"showModelSegue" sender:self];
[detailVIewController.glView load:[NSString stringWithFormat:@"%@/%@/%@.geo",[Utils getApplicationDocumentsDirectory],[modelsName objectAtIndex:indexPath.row], [modelsName objectAtIndex:indexPath.row]]];
[self.navigationController pushViewController:detailVIewController animated:YES];
} }
} }
- (BOOL) parseInfosFile:(NSString *)file - (BOOL) parseInfosFile:(NSString *)file
...@@ -123,4 +117,12 @@ ...@@ -123,4 +117,12 @@
//[currentElementValue release]; //[currentElementValue release];
currentElementValue = nil; currentElementValue = nil;
} }
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"showModelSegue"])
{
DetailViewController *detailViewControler = [segue destinationViewController];
detailViewControler.initialModel = selectedModel;
}
}
@end @end
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<key>UIFileSharingEnabled</key> <key>UIFileSharingEnabled</key>
<true/> <true/>
<key>UIMainStoryboardFile</key> <key>UIMainStoryboardFile</key>
<string>iPhoneStoryboard</string> <string>iPhoneiPodStoryboard</string>
<key>UIMainStoryboardFile~ipad</key> <key>UIMainStoryboardFile~ipad</key>
<string>iPadStoryboard</string> <string>iPadStoryboard</string>
<key>UIRequiredDeviceCapabilities</key> <key>UIRequiredDeviceCapabilities</key>
......
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes> <prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="dad-rm-zwY"> <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="ModelsCell" id="dad-rm-zwY">
<rect key="frame" x="0.0" y="22" width="768" height="44"/> <rect key="frame" x="0.0" y="22" width="768" height="44"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
...@@ -93,9 +93,6 @@ ...@@ -93,9 +93,6 @@
</prototypes> </prototypes>
</tableView> </tableView>
<navigationItem key="navigationItem" title="Models list" id="sdX-f6-lSz"/> <navigationItem key="navigationItem" title="Models list" id="sdX-f6-lSz"/>
<connections>
<segue destination="5" kind="push" id="bSD-X0-f0E"/>
</connections>
</tableViewController> </tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="zLU-RU-aDe" userLabel="First Responder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="zLU-RU-aDe" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects> </objects>
...@@ -126,7 +123,7 @@ ...@@ -126,7 +123,7 @@
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/> <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<simulatedOrientationMetrics key="simulatedOrientationMetrics" orientation="landscapeRight"/> <simulatedOrientationMetrics key="simulatedOrientationMetrics" orientation="landscapeRight"/>
<prototypes> <prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="gray" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" textLabel="tIi-5l-S0i" style="IBUITableViewCellStyleDefault" id="ZSw-0O-9Pw"> <tableViewCell contentMode="scaleToFill" selectionStyle="gray" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="SettingsCell" textLabel="tIi-5l-S0i" style="IBUITableViewCellStyleDefault" id="ZSw-0O-9Pw">
<rect key="frame" x="0.0" y="34" width="320" height="46"/> <rect key="frame" x="0.0" y="34" width="320" height="46"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
...@@ -178,7 +175,6 @@ ...@@ -178,7 +175,6 @@
<class className="DetailViewController" superclassName="UIViewController"> <class className="DetailViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/DetailViewController.h"/> <source key="sourceIdentifier" type="project" relativePath="./Classes/DetailViewController.h"/>
<relationships> <relationships>
<relationship kind="action" name="PViewIntervalType:"/>
<relationship kind="action" name="pinch:" candidateClass="UIPinchGestureRecognizer"/> <relationship kind="action" name="pinch:" candidateClass="UIPinchGestureRecognizer"/>
<relationship kind="action" name="tap:" candidateClass="UITapGestureRecognizer"/> <relationship kind="action" name="tap:" candidateClass="UITapGestureRecognizer"/>
<relationship kind="outlet" name="detailDescriptionLabel" candidateClass="UILabel"/> <relationship kind="outlet" name="detailDescriptionLabel" candidateClass="UILabel"/>
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
<!--Model List Controller - Models list--> <!--Model List Controller - Models list-->
<scene sceneID="Y4S-jQ-WHz"> <scene sceneID="Y4S-jQ-WHz">
<objects> <objects>
<placeholder placeholderIdentifier="IBFirstResponder" id="5qi-J8-Zn2" userLabel="First Responder" sceneMemberID="firstResponder"/>
<tableViewController id="aNd-kg-MlN" customClass="ModelListController" sceneMemberID="viewController"> <tableViewController id="aNd-kg-MlN" customClass="ModelListController" sceneMemberID="viewController">
<tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="E1y-UA-Su2"> <tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="E1y-UA-Su2">
<rect key="frame" x="0.0" y="64" width="320" height="416"/> <rect key="frame" x="0.0" y="64" width="320" height="416"/>
...@@ -30,6 +29,7 @@ ...@@ -30,6 +29,7 @@
<segue destination="NyB-7w-cP0" kind="push" identifier="showModelSegue" id="urr-vz-3XW"/> <segue destination="NyB-7w-cP0" kind="push" identifier="showModelSegue" id="urr-vz-3XW"/>
</connections> </connections>
</tableViewController> </tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="5qi-J8-Zn2" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects> </objects>
<point key="canvasLocation" x="-329" y="160"/> <point key="canvasLocation" x="-329" y="160"/>
</scene> </scene>
...@@ -47,7 +47,9 @@ ...@@ -47,7 +47,9 @@
<outletCollection property="gestureRecognizers" destination="qCm-Ub-mO2" appends="YES" id="yww-Ed-CcX"/> <outletCollection property="gestureRecognizers" destination="qCm-Ub-mO2" appends="YES" id="yww-Ed-CcX"/>
</connections> </connections>
</view> </view>
<navigationItem key="navigationItem" id="WX3-lU-bHf"/> <navigationItem key="navigationItem" id="WX3-lU-bHf">
<barButtonItem key="backBarButtonItem" title="Model" id="ed6-hv-E3j"/>
</navigationItem>
<connections> <connections>
<outlet property="glView" destination="zrj-Dd-WPc" id="sIP-YC-fg2"/> <outlet property="glView" destination="zrj-Dd-WPc" id="sIP-YC-fg2"/>
<segue destination="0h7-h3-thM" kind="push" identifier="showSettingsSegue" id="cJz-7s-fgZ"/> <segue destination="0h7-h3-thM" kind="push" identifier="showSettingsSegue" id="cJz-7s-fgZ"/>
...@@ -119,6 +121,8 @@ ...@@ -119,6 +121,8 @@
<class className="DetailViewController" superclassName="UIViewController"> <class className="DetailViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/DetailViewController.h"/> <source key="sourceIdentifier" type="project" relativePath="./Classes/DetailViewController.h"/>
<relationships> <relationships>
<relationship kind="action" name="PViewIntervalType:"/>
<relationship kind="action" name="PViewVisible:"/>
<relationship kind="action" name="pinch:" candidateClass="UIPinchGestureRecognizer"/> <relationship kind="action" name="pinch:" candidateClass="UIPinchGestureRecognizer"/>
<relationship kind="action" name="tap:" candidateClass="UITapGestureRecognizer"/> <relationship kind="action" name="tap:" candidateClass="UITapGestureRecognizer"/>
<relationship kind="outlet" name="detailDescriptionLabel" candidateClass="UILabel"/> <relationship kind="outlet" name="detailDescriptionLabel" candidateClass="UILabel"/>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment