Skip to content

Commit

Permalink
boom. good enough
Browse files Browse the repository at this point in the history
  • Loading branch information
schacon committed May 10, 2010
1 parent 533842e commit cfba6b8
Show file tree
Hide file tree
Showing 7 changed files with 348 additions and 82 deletions.
9 changes: 7 additions & 2 deletions Classes/ShowOffPadAppDelegate.m
Expand Up @@ -23,15 +23,19 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
presentController = [[ShowOffPadPresentController alloc]
initWithNibName:@"ShowOffPadPresentController"
bundle:nil];
viewController.extDisplay = presentController.mainView;
viewController.extDisplay = presentController;

if([[UIScreen screens]count] > 1) //if there are more than 1 screens connected to the device
{
UIScreenMode *bestScreenMode;
BOOL screenChoosen = FALSE;
for(int i = 0; i < [[[[UIScreen screens] objectAtIndex:1] availableModes]count]; i++)
{
UIScreenMode *current = [[[[UIScreen screens]objectAtIndex:1]availableModes]objectAtIndex:i];
if((current.size.width == 1024) && (current.size.height == 768)) {
if (!screenChoosen) {
bestScreenMode = current;
}
if (current.size.width == 1024.0) {
bestScreenMode = current;
}
}
Expand All @@ -52,6 +56,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

[window addSubview:viewController.view];
[window makeKeyAndVisible];


return YES;
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/ShowOffPadPresentController.h
Expand Up @@ -13,6 +13,6 @@
IBOutlet UIWebView *mainView;
}

@property(nonatomic,retain) UIWebView *mainView;
@property(assign, readwrite) UIWebView *mainView;

@end
9 changes: 7 additions & 2 deletions Classes/ShowOffPadViewController.h
Expand Up @@ -8,9 +8,11 @@

#import <UIKit/UIKit.h>

@class ShowOffPadPresentController;

@interface ShowOffPadViewController : UIViewController {
IBOutlet UIWebView *webDisplayiPad;
IBOutlet UIWebView *extDisplay;
ShowOffPadPresentController *extDisplay;
UIButton *nextButton;
UIButton *prevButton;
UIButton *footerButton;
Expand All @@ -26,7 +28,7 @@
}

@property(nonatomic,retain) UIWebView *webDisplayiPad;
@property(nonatomic,retain) UIWebView *extDisplay;
@property(nonatomic,retain) ShowOffPadPresentController *extDisplay;

@property (nonatomic, retain) IBOutlet UIButton *nextButton;
@property (nonatomic, retain) IBOutlet UIButton *prevButton;
Expand All @@ -44,6 +46,9 @@
- (IBAction)doFooterButton;
- (IBAction)doResetTimer;

- (void)setScreenStatus;
- (NSString *) sendJs:(NSString *)command;

- (void) updateProgress;
- (void)updateCounter:(NSTimer *)theTimer;

Expand Down
32 changes: 29 additions & 3 deletions Classes/ShowOffPadViewController.m
Expand Up @@ -7,6 +7,7 @@
//

#import "ShowOffPadViewController.h"
#import "ShowOffPadPresentController.h"

@implementation ShowOffPadViewController

Expand All @@ -25,7 +26,7 @@ - (void)viewDidLoad {

//Load the request in the UIWebView.
[webDisplayiPad loadRequest:requestObj];
[extDisplay loadRequest:requestObj];
[extDisplay.mainView loadRequest:requestObj];

counter = 0;
basetime = 0;
Expand All @@ -35,9 +36,29 @@ - (void)viewDidLoad {
selector:@selector(updateCounter:)
userInfo:nil
repeats:YES];
[self setScreenStatus];

[super viewDidLoad];
}

- (void)setScreenStatus {
NSString *screenStatus = @"";
if([[UIScreen screens]count] > 1) //if there are more than 1 screens connected to the device
{
for(int i = 0; i < [[[[UIScreen screens] objectAtIndex:1] availableModes]count]; i++)
{
UIScreenMode *current = [[[[UIScreen screens]objectAtIndex:1]availableModes]objectAtIndex:i];
if (current.size.width == 1024.0) {
screenStatus = [screenStatus stringByAppendingFormat:@"* %5.0f,%5.0f\n", current.size.width, current.size.height];
} else {
screenStatus = [screenStatus stringByAppendingFormat:@" %5.0f,%5.0f\n", current.size.width, current.size.height];
}
}
}

padStatus.text = screenStatus;
}

- (void)updateCounter:(NSTimer *)theTimer {
counter += 1;
float elapsed = (float)(counter - basetime);
Expand All @@ -50,15 +71,20 @@ - (void)updateCounter:(NSTimer *)theTimer {
}

- (IBAction) doNextButton {
NSString *output = [webDisplayiPad stringByEvaluatingJavaScriptFromString:@"nextStep()"];
NSString *output = [self sendJs:@"nextStep()"];
if (output && ![output isEqualToString:@""]) {
notesArea.text = output;
}
[self updateProgress];
}

- (NSString *) sendJs:(NSString *)command {
[extDisplay.mainView stringByEvaluatingJavaScriptFromString:command];
return [webDisplayiPad stringByEvaluatingJavaScriptFromString:command];
}

- (IBAction) doPrevButton {
NSString *output = [webDisplayiPad stringByEvaluatingJavaScriptFromString:@"prevStep()"];
NSString *output = [self sendJs:@"prevStep()"];
if (![output isEqualToString:@""]) {
notesArea.text = output;
}
Expand Down
23 changes: 12 additions & 11 deletions ShowOffPad.xcodeproj/schacon.mode1v3
Expand Up @@ -278,6 +278,7 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
<integer>4</integer>
<integer>1</integer>
<integer>0</integer>
</array>
Expand Down Expand Up @@ -320,29 +321,29 @@
<key>PBXProjectModuleGUID</key>
<string>1CE0B20306471E060097A5F4</string>
<key>PBXProjectModuleLabel</key>
<string>ShowOffPadViewController.m</string>
<string>ShowOffPadViewController.h</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
<dict>
<key>PBXProjectModuleGUID</key>
<string>1CE0B20406471E060097A5F4</string>
<key>PBXProjectModuleLabel</key>
<string>ShowOffPadViewController.m</string>
<string>ShowOffPadViewController.h</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>31CE751111988BE7006C68D9</string>
<string>31CE75841198A1DF006C68D9</string>
<key>history</key>
<array>
<string>31CE72A811986D07006C68D9</string>
<string>31CE73BE11987F7F006C68D9</string>
<string>31CE74D6119884F4006C68D9</string>
<string>31CE750D11988BE7006C68D9</string>
<string>31CE750E11988BE7006C68D9</string>
<string>31CE750F11988BE7006C68D9</string>
<string>31CE751011988BE7006C68D9</string>
<string>31CE74D5119884F4006C68D9</string>
<string>31CE75761198A138006C68D9</string>
<string>31CE75771198A138006C68D9</string>
<string>31CE75781198A138006C68D9</string>
<string>31CE75791198A138006C68D9</string>
<string>31CE757F1198A1D4006C68D9</string>
<string>31CE75801198A1D4006C68D9</string>
</array>
</dict>
<key>SplitCount</key>
Expand Down Expand Up @@ -544,8 +545,8 @@
<string>31CE721A1198648C006C68D9</string>
<string>1CD10A99069EF8BA00B06720</string>
<string>311D6F7211922E4400C21AED</string>
<string>1C78EAAD065D492600B07095</string>
<string>1C530D57069F1CE1000CFCEE</string>
<string>1C78EAAD065D492600B07095</string>
<string>/Users/schacon/Documents/ShowOffPad/ShowOffPad.xcodeproj</string>
</array>
<key>WindowString</key>
Expand All @@ -572,7 +573,7 @@
<key>PBXProjectModuleGUID</key>
<string>1CD0528F0623707200166675</string>
<key>PBXProjectModuleLabel</key>
<string>ShowOffPadAppDelegate.m</string>
<string>ShowOffPadViewController.h</string>
<key>StatusBarVisibility</key>
<true/>
</dict>
Expand Down

0 comments on commit cfba6b8

Please sign in to comment.