Mercurial > hg > soniczoomios
changeset 24:a4908ad8c78e
Top and bottom toolbars. Intro page.
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Fri, 01 Feb 2013 11:16:56 +0000 |
parents | dae6d77657a0 |
children | f42a00e3f22d |
files | BottomTabViewController.h BottomTabViewController.mm BottomTabViewController.xib IntroViewController.h IntroViewController.mm IntroViewController.xib Question.h Question.m TopButtonViewController.h TopButtonViewController.mm TopButtonViewController.xib eventLogger.h eventLogger.mm grid.h grid.mm testApp.h testApp.mm |
diffstat | 17 files changed, 1791 insertions(+), 203 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BottomTabViewController.h Fri Feb 01 11:16:56 2013 +0000 @@ -0,0 +1,20 @@ +// +// BottomTabViewController.h +// sonicZoom +// +// Created by Robert Tubb on 31/01/2013. +// +// + +#import <UIKit/UIKit.h> + +@interface BottomTabViewController : UIViewController + +@property (nonatomic, assign) id theOFAppRef; + + +-(IBAction)show:(id)sender; +-(void)setAppRef:(id)theOFApp; +- (IBAction)interfaceSelected:(id)sender; + +@end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BottomTabViewController.mm Fri Feb 01 11:16:56 2013 +0000 @@ -0,0 +1,56 @@ +// +// BottomTabViewController.m +// sonicZoom +// +// Created by Robert Tubb on 31/01/2013. +// +// + +#import "BottomTabViewController.h" +#import "testApp.h" +@interface BottomTabViewController () + +@end + +@implementation BottomTabViewController + +- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +{ + self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + if (self) { + // Custom initialization + } + return self; +} + +- (void)viewDidLoad +{ + [super viewDidLoad]; + // Do any additional setup after loading the view from its nib. +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)setAppRef:(id)theOFApp{ + self.theOFAppRef = theOFApp; + +} + +- (IBAction)interfaceSelected:(UISegmentedControl *)sender { + + NSInteger whichTab = sender.selectedSegmentIndex; + ((testApp *)self.theOFAppRef)->interfaceSelected(whichTab); + +} + +- (IBAction)show:(id)sender +{ + self.theOFAppRef = sender; + self.view.hidden = NO; +} + +@end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BottomTabViewController.xib Fri Feb 01 11:16:56 2013 +0000 @@ -0,0 +1,191 @@ +<?xml version="1.0" encoding="UTF-8"?> +<archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="8.00"> + <data> + <int key="IBDocument.SystemTarget">1536</int> + <string key="IBDocument.SystemVersion">11G63</string> + <string key="IBDocument.InterfaceBuilderVersion">2844</string> + <string key="IBDocument.AppKitVersion">1138.51</string> + <string key="IBDocument.HIToolboxVersion">569.00</string> + <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> + <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="NS.object.0">1930</string> + </object> + <array key="IBDocument.IntegratedClassDependencies"> + <string>IBProxyObject</string> + <string>IBUISegmentedControl</string> + <string>IBUIView</string> + </array> + <array key="IBDocument.PluginDependencies"> + <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + </array> + <object class="NSMutableDictionary" key="IBDocument.Metadata"> + <string key="NS.key.0">PluginDependencyRecalculationVersion</string> + <integer value="1" key="NS.object.0"/> + </object> + <array class="NSMutableArray" key="IBDocument.RootObjects" id="1000"> + <object class="IBProxyObject" id="841351856"> + <string key="IBProxiedObjectIdentifier">IBFilesOwner</string> + <string key="targetRuntimeIdentifier">IBIPadFramework</string> + </object> + <object class="IBProxyObject" id="606714003"> + <string key="IBProxiedObjectIdentifier">IBFirstResponder</string> + <string key="targetRuntimeIdentifier">IBIPadFramework</string> + </object> + <object class="IBUIView" id="766721923"> + <reference key="NSNextResponder"/> + <int key="NSvFlags">292</int> + <array class="NSMutableArray" key="NSSubviews"> + <object class="IBUISegmentedControl" id="416841628"> + <reference key="NSNextResponder" ref="766721923"/> + <int key="NSvFlags">292</int> + <string key="NSFrameSize">{768, 44}</string> + <reference key="NSSuperview" ref="766721923"/> + <reference key="NSWindow"/> + <string key="NSReuseIdentifierKey">_NS:9</string> + <bool key="IBUIOpaque">NO</bool> + <string key="targetRuntimeIdentifier">IBIPadFramework</string> + <int key="IBNumberOfSegments">3</int> + <int key="IBSelectedSegmentIndex">0</int> + <array key="IBSegmentTitles"> + <string>SLIDERS</string> + <string>BOTH</string> + <string>ZOOMER</string> + </array> + <array class="NSMutableArray" key="IBSegmentWidths"> + <real value="0.0"/> + <real value="0.0"/> + <real value="0.0"/> + </array> + <array class="NSMutableArray" key="IBSegmentEnabledStates"> + <boolean value="YES"/> + <boolean value="YES"/> + <boolean value="YES"/> + </array> + <array class="NSMutableArray" key="IBSegmentContentOffsets"> + <string>{0, 0}</string> + <string>{0, 0}</string> + <string>{0, 0}</string> + </array> + <array class="NSMutableArray" key="IBSegmentImages"> + <object class="NSNull" id="4"/> + <reference ref="4"/> + <reference ref="4"/> + </array> + </object> + </array> + <string key="NSFrameSize">{768, 43}</string> + <reference key="NSSuperview"/> + <reference key="NSWindow"/> + <reference key="NSNextKeyView" ref="416841628"/> + <bool key="IBUIOpaque">NO</bool> + <bool key="IBUIClearsContextBeforeDrawing">NO</bool> + <int key="IBUIContentMode">6</int> + <object class="IBUISimulatedSizeMetrics" key="IBUISimulatedDestinationMetrics"> + <string key="IBUISimulatedSizeMetricsClass">IBUISimulatedFreeformSizeMetricsSentinel</string> + <string key="IBUIDisplayName">Freeform</string> + </object> + <string key="targetRuntimeIdentifier">IBIPadFramework</string> + </object> + </array> + <object class="IBObjectContainer" key="IBDocument.Objects"> + <array class="NSMutableArray" key="connectionRecords"> + <object class="IBConnectionRecord"> + <object class="IBCocoaTouchOutletConnection" key="connection"> + <string key="label">view</string> + <reference key="source" ref="841351856"/> + <reference key="destination" ref="766721923"/> + </object> + <int key="connectionID">3</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBCocoaTouchEventConnection" key="connection"> + <string key="label">interfaceSelected:</string> + <reference key="source" ref="416841628"/> + <reference key="destination" ref="841351856"/> + <int key="IBEventType">13</int> + </object> + <int key="connectionID">5</int> + </object> + </array> + <object class="IBMutableOrderedSet" key="objectRecords"> + <array key="orderedObjects"> + <object class="IBObjectRecord"> + <int key="objectID">0</int> + <array key="object" id="0"/> + <reference key="children" ref="1000"/> + <nil key="parent"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-1</int> + <reference key="object" ref="841351856"/> + <reference key="parent" ref="0"/> + <string key="objectName">File's Owner</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-2</int> + <reference key="object" ref="606714003"/> + <reference key="parent" ref="0"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">2</int> + <reference key="object" ref="766721923"/> + <array class="NSMutableArray" key="children"> + <reference ref="416841628"/> + </array> + <reference key="parent" ref="0"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">4</int> + <reference key="object" ref="416841628"/> + <reference key="parent" ref="766721923"/> + </object> + </array> + </object> + <dictionary class="NSMutableDictionary" key="flattenedProperties"> + <string key="-1.CustomClassName">BottomTabViewController</string> + <string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="-2.CustomClassName">UIResponder</string> + <string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <integer value="1" key="4.IUISegmentedControlInspectorSelectedSegmentMetadataKey"/> + </dictionary> + <dictionary class="NSMutableDictionary" key="unlocalizedProperties"/> + <nil key="activeLocalization"/> + <dictionary class="NSMutableDictionary" key="localizations"/> + <nil key="sourceID"/> + <int key="maxID">5</int> + </object> + <object class="IBClassDescriber" key="IBDocument.Classes"> + <array class="NSMutableArray" key="referencedPartialClassDescriptions"> + <object class="IBPartialClassDescription"> + <string key="className">BottomTabViewController</string> + <string key="superclassName">UIViewController</string> + <dictionary class="NSMutableDictionary" key="actions"> + <string key="interfaceSelected:">id</string> + <string key="show:">id</string> + </dictionary> + <dictionary class="NSMutableDictionary" key="actionInfosByName"> + <object class="IBActionInfo" key="interfaceSelected:"> + <string key="name">interfaceSelected:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo" key="show:"> + <string key="name">show:</string> + <string key="candidateClassName">id</string> + </object> + </dictionary> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">./Classes/BottomTabViewController.h</string> + </object> + </object> + </array> + </object> + <int key="IBDocument.localizationMode">0</int> + <string key="IBDocument.TargetRuntimeIdentifier">IBIPadFramework</string> + <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> + <int key="IBDocument.defaultPropertyAccessControl">3</int> + <string key="IBCocoaTouchPluginVersion">1930</string> + </data> +</archive>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IntroViewController.h Fri Feb 01 11:16:56 2013 +0000 @@ -0,0 +1,20 @@ +// +// IntroViewController.h +// sonicZoom +// +// Created by Robert Tubb on 29/01/2013. +// +// + +#import <UIKit/UIKit.h> + +@interface IntroViewController : UIViewController + +@property (nonatomic, assign) id theOFAppRef; +@property (retain, nonatomic) IBOutlet UILabel *text; + +-(IBAction)hide:(id)sender; +-(IBAction)show:(id)sender; +-(IBAction)disagree:(id)sender; +-(void)setAppRef:(id)theOFApp; +@end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IntroViewController.mm Fri Feb 01 11:16:56 2013 +0000 @@ -0,0 +1,68 @@ +// +// IntroViewController.m +// sonicZoom +// +// Created by Robert Tubb on 29/01/2013. +// +// + +#import "IntroViewController.h" +#import "testApp.h" +@interface IntroViewController () + +@end + +@implementation IntroViewController + +- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +{ + self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + if (self) { + // Custom initialization + } + return self; +} + +- (void)viewDidLoad +{ + [super viewDidLoad]; + // Do any additional setup after loading the view from its nib. +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)setAppRef:(id)theOFApp{ + self.theOFAppRef = theOFApp; + +} + +- (IBAction)show:(id)sender +{ + self.theOFAppRef = sender; + self.view.hidden = NO; +} +- (IBAction)hide:(id)sender +{ + self.view.hidden = YES; + ((testApp *)self.theOFAppRef)->introHidden(YES); + +} +- (IBAction)disagree:(id)sender +{ + // shut down the app + self.view.hidden = YES; + ((testApp *)self.theOFAppRef)->introHidden(NO); +} +- (void)dealloc { + [_text release]; + [super dealloc]; +} +- (void)viewDidUnload { + [self setText:nil]; + [super viewDidUnload]; +} +@end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IntroViewController.xib Fri Feb 01 11:16:56 2013 +0000 @@ -0,0 +1,347 @@ +<?xml version="1.0" encoding="UTF-8"?> +<archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="8.00"> + <data> + <int key="IBDocument.SystemTarget">1536</int> + <string key="IBDocument.SystemVersion">11G63</string> + <string key="IBDocument.InterfaceBuilderVersion">2844</string> + <string key="IBDocument.AppKitVersion">1138.51</string> + <string key="IBDocument.HIToolboxVersion">569.00</string> + <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> + <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="NS.object.0">1930</string> + </object> + <array key="IBDocument.IntegratedClassDependencies"> + <string>IBProxyObject</string> + <string>IBUIButton</string> + <string>IBUILabel</string> + <string>IBUIView</string> + </array> + <array key="IBDocument.PluginDependencies"> + <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + </array> + <object class="NSMutableDictionary" key="IBDocument.Metadata"> + <string key="NS.key.0">PluginDependencyRecalculationVersion</string> + <integer value="1" key="NS.object.0"/> + </object> + <array class="NSMutableArray" key="IBDocument.RootObjects" id="1000"> + <object class="IBProxyObject" id="841351856"> + <string key="IBProxiedObjectIdentifier">IBFilesOwner</string> + <string key="targetRuntimeIdentifier">IBIPadFramework</string> + </object> + <object class="IBProxyObject" id="606714003"> + <string key="IBProxiedObjectIdentifier">IBFirstResponder</string> + <string key="targetRuntimeIdentifier">IBIPadFramework</string> + </object> + <object class="IBUIView" id="766721923"> + <reference key="NSNextResponder"/> + <int key="NSvFlags">292</int> + <array class="NSMutableArray" key="NSSubviews"> + <object class="IBUIButton" id="83132392"> + <reference key="NSNextResponder" ref="766721923"/> + <int key="NSvFlags">292</int> + <string key="NSFrame">{{326, 881}, {116, 44}}</string> + <reference key="NSSuperview" ref="766721923"/> + <reference key="NSWindow"/> + <string key="NSReuseIdentifierKey">_NS:9</string> + <bool key="IBUIOpaque">NO</bool> + <string key="targetRuntimeIdentifier">IBIPadFramework</string> + <int key="IBUIContentHorizontalAlignment">0</int> + <int key="IBUIContentVerticalAlignment">0</int> + <int key="IBUIButtonType">1</int> + <string key="IBUINormalTitle">AGREE</string> + <object class="NSColor" key="IBUIHighlightedTitleColor"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MQA</bytes> + </object> + <object class="NSColor" key="IBUINormalTitleColor"> + <int key="NSColorSpace">1</int> + <bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes> + </object> + <object class="NSColor" key="IBUINormalTitleShadowColor"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MC41AA</bytes> + </object> + <object class="IBUIFontDescription" key="IBUIFontDescription"> + <int key="type">2</int> + <double key="pointSize">15</double> + </object> + <object class="NSFont" key="IBUIFont"> + <string key="NSName">Helvetica-Bold</string> + <double key="NSSize">15</double> + <int key="NSfFlags">16</int> + </object> + </object> + <object class="IBUILabel" id="814850245"> + <reference key="NSNextResponder" ref="766721923"/> + <int key="NSvFlags">292</int> + <string key="NSFrame">{{20, 68}, {728, 795}}</string> + <reference key="NSSuperview" ref="766721923"/> + <reference key="NSWindow"/> + <reference key="NSNextKeyView" ref="83132392"/> + <string key="NSReuseIdentifierKey">_NS:9</string> + <bool key="IBUIOpaque">NO</bool> + <bool key="IBUIClipsSubviews">YES</bool> + <int key="IBUIContentMode">9</int> + <bool key="IBUIUserInteractionEnabled">NO</bool> + <string key="targetRuntimeIdentifier">IBIPadFramework</string> + <object class="NSMutableString" key="IBUIText"> + <bytes key="NS.bytes">V2VsY29tZSB0byB0aGUgIlNvbmljIFpvb20iLiBUaGlzIGlzIGEgcmVzZWFyY2ggcHJvamVjdCBhaW1l +ZCBhdCBmaW5kaW5nIG91dCBob3cgcGVvcGxlIGV4cGxvcmUgdGhlIHNwYWNlIG9mIHNvdW5kIHN5bnRo +ZXNpcyBwYXJhbWV0ZXJzLiANDUluIHRoaXMgYXBwIHRoZXJlIGFyZSBqdXN0IDEwIHBhcmFtZXRlcnMg +4oCTIDUgZm9yIHRoZSBzZXF1ZW5jZXIgcGF0dGVybiBnZW5lcmF0b3IgYW5kIDUgZm9yIGEgYmFzaWMg +Rk0vc3VidHJhY3RpdmUgc3ludGhlc2l6ZXIuIEhvd2V2ZXIsIGV2ZW4gd2l0aCBvbmx5IDEwIHBhcmFt +ZXRlcnMgdGhlIGFtb3VudCBvZiBkaWZmZXJlbnQgc291bmRzIHRvIGV4cGxvcmUgaXMgdmFzdDogaW4g +ZmFjdCB0aGVyZSBhcmUganVzdCBvdmVyIGEgYmlsbGlvbiB0cmlsbGlvbiBkaXN0aW5jdCBzZXR0aW5n +cyEgV2UgYWltIHRvIGxvb2sgYXQgd2hhdCBwYXRocyBwZW9wbGUgdGFrZSBpbiB0aGlzIGh1Z2Ugc3Bh +Y2UsIHdoYXQgcG9pbnRzIHRoZXkgbGlrZSBhbmQgZGlzbGlrZSwgYW5kIHVzZSB0aGUgZGF0YSB0byBj +cmVhdGUgc3ludGhzIHRoYXQgYXJlIGVhc2llciB0byBuYXZpZ2F0ZSwgb3IgdGhhdCBlbmNvdXJhZ2Ug +Y3JlYXRpdml0eS4NDVRoZXJlIGFyZSB0d28gaW50ZXJmYWNlcyBwcmVzZW50ZWQgaGVyZS4gVGhlIGZp +cnN0IGlzIG9uZSB5b3Ugd2lsbCBwcm9iYWJseSBiZSB1c2VkIHRvIGlmIHlvdSBhcmUgYSBtdXNpY2lh +bjogMTAgc2xpZGVycyBmb3IgZWFjaCBvZiB0aGUgcGFyYW1ldGVycy4gVGhlIHNlY29uZCBpcyBzb21l +d2hhdCBuZXc6IGV2ZXJ5IG9uZSBvZiB0aGUgYmlsbGlvbiB0cmlsbGlvbiBwb2ludHMgaGFzIGJlZW4g +bWFwcGVkIHRvIGEgMkQgc3VyZmFjZSAoaWYgeW91IHJlYWxseSB3YW50IHRvIGtub3cgLSBlYWNoIHNx +dWFyZSB5b3Ugc2VlIGlzIGEgc3F1YXNoZWQgb3V0IDEwRCBoeXBlcmN1YmUsIGFuZCBhbGwgb2YgdGhl +IDEwMjQgc3ViLXNxdWFyZXMgYXJlIHRoZSDigJxjb3JuZXJz4oCdIG9mIHRoaXMgMTAtY3ViZSwgd2hp +Y2ggdGhlbXNlbHZlcyBhcmUgYnVpbHQgZnJvbSBzbWFsbGVyIGh5cGVyY3ViZXMgYW5kIHNvIG9u4oCm +KS4gQXMgZmFyIGFzIHBvc3NpYmxlLCB0aGUgZnVydGhlciB5b3UgdHJhdmVsIGFsb25nIHRoaXMgMkQg +c3VyZmFjZSwgdGhlIG1vcmUgZGlmZmVyZW50IHRoZSBzb3VuZCB3aWxsIGJlY29tZS4NDVVwIGRvd24g +bW92ZW1lbnQgY29udHJvbHMgdGhlIHN5bnRoIHRpbWJyZSwgbGVmdCByaWdodCBjb250cm9scyB0aGUg +c2VxdWVuY2VyLiBXaGVuIHlvdSBjbGljayDigJxzYXZlIHByZXNldOKAnSB5b3Ugd2lsbCBkcm9wIGEg +cGluIG9udG8gdGhlIHN1cmZhY2UsIGFuZCB5b3UgY2FuIHJldmlzaXQgdGhpcyBwb2ludCBhdCBhbnl0 +aW1lIGJ5IHNjcm9sbGluZyB0byBpdC4gVGhpbmsgb2YgaXQgbGlrZSBhICJHb29nbGUgTWFwcyIgZm9y +IHN5bnRoIHNvdW5kcy4uLg0NWW91IGNhbiB1c2UgYSBwaW5jaCBnZXN0dXJlIHRvIHpvb20gaW4gYW5k +IG91dCBvZiB0aGUgc3VyZmFjZS4gWm9vbWluZyBpbiB3aWxsIGVuYWJsZSB5b3UgdG8gZXhwbG9yZSBz +bWFsbGVyIGxvY2FsaXRpZXMgb2YgdGhlIHNvdW5kIHNwYWNlLiBab29taW5nIG91dCB3aWxsIGdpdmUg +eW91IGEgYmlnZ2VyIHBlcnNwZWN0aXZlLCBidXQgb2YgY291cnNlIHRoZSBzb3VuZCB3aWxsIGJlY29t +ZSBmYXIgbW9yZSByYW5kb20gYW5kIHVuY29udHJvbGxhYmxlIGFzIHlvdSBtb3ZlIGJpZ2dlciBkaXN0 +YW5jZXMuDQ1XaGF0IHdlIGFyZSBhc2tpbmcgeW91LCB0aGUgcGFydGljaXBhbnQsIHRvIGRvIGlzIHVz +ZSBib3RoIHRoZSB6b29tZXIgYW5kIHRoZSBzbGlkZXJzIGZvciBhYm91dCAxMCBtaW51dGVzIGVhY2gs +IGFuZCBzYXZlIGFueSBzb3VuZHMgdGhhdCB5b3UgbGlrZS4gQWZ0ZXIgYWJvdXQgMjAgbWludXRlcyBv +ZiBpbnRlcmFjdGlvbiBhIHByb21wdCB3aWxsIGFwcGVhciBmb3IgYSBzaG9ydCBxdWVzdGlvbm5haXJl +IHRoYXQgd2lsbCBoZWxwIHVzIGFzc2VzcyB0aGUgaW50ZXJmYWNlIGZ1cnRoZXIuICBBZnRlciB0aGF0 +LCBwbGVhc2UgZmVlbCBmcmVlIHRvIHVzZSBpdCBzb21lIG1vcmU6IHRoZSBtb3JlIGRhdGEgd2UgZ2V0 +IHRoZSBiZXR0ZXIuIE1vcmUgZXhjaXRpbmcgZmVhdHVyZXMgYXJlIHBsYW5uZWQgZm9yIHRoaXMgYXBw +LCBzbyBwbGVhc2Ugd2F0Y2ggb3V0IGZvciB1cGRhdGVzLg0NTk9URTogWW91ciBhY3Rpb25zIHdpbGwg +YmUgbG9nZ2VkLCBhbmQgc2VudCB0byBhIHNlY3VyZSBzZXJ2ZXIgaGVyZSBhdCBRdWVlbiBNYXJ5IFVu +aXZlcnNpdHkuICBIb3dldmVyIG5vIHBlcnNvbmFsIGRhdGEgKG5hbWUsIGVtYWlsIGV0Yy4pIHdpbGwg +YmUgY29sbGVjdGVkLCBhc3NvY2lhdGVkIHdpdGggdGhpcyBJRCBvciBzdG9yZWQgaW4gdGhlIGRhdGFi +YXNlLiBJdCBpcyBoaWdobHkgcmVjb21tZW5kZWQgdGhhdCB5b3UgYXJlIGNvbm5lY3RlZCB0byBXaUZp +IGludGVybmV0IHdoaWxzdCB1c2luZyB0aGlzIEFwcC4NVG8gY29uc2VudCB0byB0aGlzIHBsZWFzZSBw +cmVzcyAiQWdyZWUiIGJlbG93LiBUbyBkZWNsaW5lIGp1c3QgZXhpdCB0aGUgYXBwLg0</bytes> + </object> + <object class="NSColor" key="IBUITextColor"> + <int key="NSColorSpace">1</int> + <bytes key="NSRGB">MC4zMzgyNjY5OTg0IDAuOTA1MzMyMjM5OSAxAA</bytes> + </object> + <nil key="IBUIHighlightedColor"/> + <int key="IBUIBaselineAdjustment">0</int> + <int key="IBUINumberOfLines">39</int> + <object class="IBUIFontDescription" key="IBUIFontDescription" id="983432270"> + <int key="type">1</int> + <double key="pointSize">17</double> + </object> + <object class="NSFont" key="IBUIFont" id="220964298"> + <string key="NSName">Helvetica</string> + <double key="NSSize">17</double> + <int key="NSfFlags">16</int> + </object> + <bool key="IBUIAdjustsFontSizeToFit">NO</bool> + <double key="preferredMaxLayoutWidth">728</double> + </object> + <object class="IBUILabel" id="530886577"> + <reference key="NSNextResponder" ref="766721923"/> + <int key="NSvFlags">292</int> + <string key="NSFrame">{{299, 20}, {123, 21}}</string> + <reference key="NSSuperview" ref="766721923"/> + <reference key="NSWindow"/> + <reference key="NSNextKeyView" ref="814850245"/> + <string key="NSReuseIdentifierKey">_NS:9</string> + <bool key="IBUIOpaque">NO</bool> + <bool key="IBUIClipsSubviews">YES</bool> + <int key="IBUIContentMode">7</int> + <bool key="IBUIUserInteractionEnabled">NO</bool> + <string key="targetRuntimeIdentifier">IBIPadFramework</string> + <string key="IBUIText">SONIC ZOOM</string> + <object class="NSColor" key="IBUITextColor"> + <int key="NSColorSpace">1</int> + <bytes key="NSRGB">MC4zMzgyNjY5OTg0IDAuOTA1MzMyMjM5OSAxAA</bytes> + </object> + <nil key="IBUIHighlightedColor"/> + <int key="IBUIBaselineAdjustment">0</int> + <reference key="IBUIFontDescription" ref="983432270"/> + <reference key="IBUIFont" ref="220964298"/> + <bool key="IBUIAdjustsFontSizeToFit">NO</bool> + </object> + </array> + <string key="NSFrameSize">{768, 1024}</string> + <reference key="NSSuperview"/> + <reference key="NSWindow"/> + <reference key="NSNextKeyView" ref="530886577"/> + <object class="NSColor" key="IBUIBackgroundColor"> + <int key="NSColorSpace">1</int> + <bytes key="NSRGB">MCAwIDAAA</bytes> + <string key="IBUIColorCocoaTouchKeyPath">darkTextColor</string> + </object> + <bool key="IBUIClearsContextBeforeDrawing">NO</bool> + <object class="IBUIScreenMetrics" key="IBUISimulatedDestinationMetrics"> + <string key="IBUISimulatedSizeMetricsClass">IBUIScreenMetrics</string> + <object class="NSMutableDictionary" key="IBUINormalizedOrientationToSizeMap"> + <bool key="EncodedWithXMLCoder">YES</bool> + <array key="dict.sortedKeys"> + <integer value="1"/> + <integer value="3"/> + </array> + <array key="dict.values"> + <string>{768, 1024}</string> + <string>{1024, 768}</string> + </array> + </object> + <string key="IBUITargetRuntime">IBIPadFramework</string> + <string key="IBUIDisplayName">iPad Full Screen</string> + <int key="IBUIType">1</int> + </object> + <string key="targetRuntimeIdentifier">IBIPadFramework</string> + </object> + </array> + <object class="IBObjectContainer" key="IBDocument.Objects"> + <array class="NSMutableArray" key="connectionRecords"> + <object class="IBConnectionRecord"> + <object class="IBCocoaTouchOutletConnection" key="connection"> + <string key="label">view</string> + <reference key="source" ref="841351856"/> + <reference key="destination" ref="766721923"/> + </object> + <int key="connectionID">3</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBCocoaTouchOutletConnection" key="connection"> + <string key="label">text</string> + <reference key="source" ref="841351856"/> + <reference key="destination" ref="814850245"/> + </object> + <int key="connectionID">57</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBCocoaTouchEventConnection" key="connection"> + <string key="label">hide:</string> + <reference key="source" ref="83132392"/> + <reference key="destination" ref="841351856"/> + <int key="IBEventType">7</int> + </object> + <int key="connectionID">55</int> + </object> + </array> + <object class="IBMutableOrderedSet" key="objectRecords"> + <array key="orderedObjects"> + <object class="IBObjectRecord"> + <int key="objectID">0</int> + <array key="object" id="0"/> + <reference key="children" ref="1000"/> + <nil key="parent"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-1</int> + <reference key="object" ref="841351856"/> + <reference key="parent" ref="0"/> + <string key="objectName">File's Owner</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-2</int> + <reference key="object" ref="606714003"/> + <reference key="parent" ref="0"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">2</int> + <reference key="object" ref="766721923"/> + <array class="NSMutableArray" key="children"> + <reference ref="814850245"/> + <reference ref="530886577"/> + <reference ref="83132392"/> + </array> + <reference key="parent" ref="0"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">4</int> + <reference key="object" ref="83132392"/> + <array class="NSMutableArray" key="children"/> + <reference key="parent" ref="766721923"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">14</int> + <reference key="object" ref="814850245"/> + <array class="NSMutableArray" key="children"/> + <reference key="parent" ref="766721923"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">50</int> + <reference key="object" ref="530886577"/> + <array class="NSMutableArray" key="children"/> + <reference key="parent" ref="766721923"/> + </object> + </array> + </object> + <dictionary class="NSMutableDictionary" key="flattenedProperties"> + <string key="-1.CustomClassName">IntroViewController</string> + <string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="-2.CustomClassName">UIResponder</string> + <string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="14.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="50.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + </dictionary> + <dictionary class="NSMutableDictionary" key="unlocalizedProperties"/> + <nil key="activeLocalization"/> + <dictionary class="NSMutableDictionary" key="localizations"/> + <nil key="sourceID"/> + <int key="maxID">57</int> + </object> + <object class="IBClassDescriber" key="IBDocument.Classes"> + <array class="NSMutableArray" key="referencedPartialClassDescriptions"> + <object class="IBPartialClassDescription"> + <string key="className">IntroViewController</string> + <string key="superclassName">UIViewController</string> + <dictionary class="NSMutableDictionary" key="actions"> + <string key="disagree:">id</string> + <string key="hide:">id</string> + <string key="show:">id</string> + </dictionary> + <dictionary class="NSMutableDictionary" key="actionInfosByName"> + <object class="IBActionInfo" key="disagree:"> + <string key="name">disagree:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo" key="hide:"> + <string key="name">hide:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo" key="show:"> + <string key="name">show:</string> + <string key="candidateClassName">id</string> + </object> + </dictionary> + <object class="NSMutableDictionary" key="outlets"> + <string key="NS.key.0">text</string> + <string key="NS.object.0">UILabel</string> + </object> + <object class="NSMutableDictionary" key="toOneOutletInfosByName"> + <string key="NS.key.0">text</string> + <object class="IBToOneOutletInfo" key="NS.object.0"> + <string key="name">text</string> + <string key="candidateClassName">UILabel</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">./Classes/IntroViewController.h</string> + </object> + </object> + </array> + </object> + <int key="IBDocument.localizationMode">0</int> + <string key="IBDocument.TargetRuntimeIdentifier">IBIPadFramework</string> + <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> + <int key="IBDocument.defaultPropertyAccessControl">3</int> + <string key="IBCocoaTouchPluginVersion">1930</string> + </data> +</archive>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Question.h Fri Feb 01 11:16:56 2013 +0000 @@ -0,0 +1,24 @@ +// +// Question.h +// sonicZoom +// +// Created by Robert Tubb on 21/01/2013. +// +// included by Qviewcont + +#import <Foundation/Foundation.h> +typedef enum QuestionType{AGREE_DISAGREE, SLIDERS_ZOOMER} QuestionType; + +@interface Question : NSObject +{ + + +} +@property (strong, nonatomic) NSString *questionText; +@property QuestionType questionType; +@property int answer; // answer 0 means no answer was given (the blank line in picker) this distiguishes between "neither" and "don't know / no answer" + +-(id)initWithTextAndType:(NSString *)text:(QuestionType)type; ++ (int)count; ++(NSArray *)answersWithType:(QuestionType)type; +@end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Question.m Fri Feb 01 11:16:56 2013 +0000 @@ -0,0 +1,61 @@ +// +// Question.m +// sonicZoom +// +// Created by Robert Tubb on 21/01/2013. +// +// + +#import "Question.h" + +@implementation Question + +@synthesize questionText = _questionText; +@synthesize questionType = _questionType; +@synthesize answer = _answer; + +static int theCount = 0; + +-(id)initWithTextAndType:(NSString *)text:(QuestionType)type{ + self = [super init]; + if(self){ + self.questionText = text; + self.questionType = type; + self.answer = 0; + } + + return self; + +} +//// +- (id)init +{ + return [self initWithTextAndType:@"Quo Vadis?":AGREE_DISAGREE]; +} + ++ (int) count { return theCount; } ++ (void) setCount:(int)c { theCount = c; } + + + ++(NSArray *)answersWithType:(QuestionType)type{ +// get the set of answers depending on what type the q was + // pseudo static variable + if(type == AGREE_DISAGREE){ + [Question setCount:6]; + return [[NSArray alloc] initWithObjects: + @" ", @"Strongly disagree", @"Disagree", @"Neither", + @"Agree", @"Strongly agree", nil]; + + + }else if(type == SLIDERS_ZOOMER){ + [Question setCount:6]; + return [[NSArray alloc] initWithObjects: + @" ", @"Definitely Sliders", @"Maybe Sliders", @"Neither", + @"Maybe Zoomer", @"Definitely Zoomer", nil]; + }else{ + return nil; + } +} +/// +@end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TopButtonViewController.h Fri Feb 01 11:16:56 2013 +0000 @@ -0,0 +1,27 @@ +// +// TopButtonViewController.h +// sonicZoom +// +// Created by Robert Tubb on 31/01/2013. +// +// + +#import <UIKit/UIKit.h> + +@interface TopButtonViewController : UIViewController + +@property (nonatomic, assign) id theOFAppRef; + +@property (retain, nonatomic) IBOutlet UIBarButtonItem *playButton; +@property (retain, nonatomic) IBOutlet UIBarButtonItem *pauseButton; + +-(IBAction)show:(id)sender; +-(void)setAppRef:(id)theOFApp; +- (IBAction)playPressed:(id)sender; +- (IBAction)pausePressed:(id)sender; +- (IBAction)savePressed:(id)sender; +- (IBAction)lockSequencePressed:(id)sender; +- (IBAction)lockSynthPressed:(id)sender; +- (IBAction)qPressed:(id)sender; + +@end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TopButtonViewController.mm Fri Feb 01 11:16:56 2013 +0000 @@ -0,0 +1,113 @@ +// +// TopButtonViewController.m +// sonicZoom +// +// Created by Robert Tubb on 31/01/2013. +// +// + +#import "TopButtonViewController.h" +#import "testApp.h" +#import "presetManager.h" + +extern PresetManager presetManager; + + +@interface TopButtonViewController () + +@end + +@implementation TopButtonViewController + +- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +{ + self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + if (self) { + // Custom initialization + } + return self; +} + +- (void)viewDidLoad +{ + [super viewDidLoad]; + // Do any additional setup after loading the view from its nib. + self.playButton.enabled = true; + self.pauseButton.enabled = false; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)setAppRef:(id)theOFApp{ + self.theOFAppRef = theOFApp; + +} + +- (IBAction)playPressed:(id)sender { + ((testApp *)self.theOFAppRef)->seqStartStop(true); + self.playButton.enabled = false; + self.pauseButton.enabled = true; +} + +- (IBAction)pausePressed:(id)sender { + ((testApp *)self.theOFAppRef)->seqStartStop(false); + self.pauseButton.enabled = false; + self.playButton.enabled = true; +} + +- (IBAction)savePressed:(id)sender { + cout << "SAVE PRESET\n"; + presetManager.showNameDialog(); +} + +- (IBAction)lockSequencePressed:(id)sender { + UIBarButtonItem *button = (UIBarButtonItem *)sender; + if([button.title isEqualToString:@"Lock Sequence (X)"]){ + ((testApp *)self.theOFAppRef)->lockSequencerPressed(true); + button.title = @"Unlock Sequence (X)"; + }else if([button.title isEqualToString:@"Unlock Sequence (X)"]){ + ((testApp *)self.theOFAppRef)->lockSequencerPressed(false); + button.title = @"Lock Sequence (X)"; + }else{ + NSLog(@"button title error"); + } +} + +- (IBAction)lockSynthPressed:(id)sender { + UIBarButtonItem *button = (UIBarButtonItem *)sender; + if([button.title isEqualToString:@"Lock Synth (Y)"]){ + ((testApp *)self.theOFAppRef)->lockSynthPressed(true); + button.title = @"Unlock Synth (Y)"; + }else if([button.title isEqualToString:@"Unlock Synth (Y)"]){ + ((testApp *)self.theOFAppRef)->lockSynthPressed(false); + button.title = @"Lock Synth (Y)"; + }else{ + NSLog(@"button title error"); + } +} + +- (IBAction)qPressed:(id)sender { + ((testApp *)self.theOFAppRef)->showQuestionnaire(); +} + +- (IBAction)show:(id)sender +{ + self.theOFAppRef = sender; + self.view.hidden = NO; +} + +- (void)dealloc { + [_playButton release]; + [_pauseButton release]; + [super dealloc]; +} +- (void)viewDidUnload { + [self setPlayButton:nil]; + [self setPauseButton:nil]; + [super viewDidUnload]; +} +@end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TopButtonViewController.xib Fri Feb 01 11:16:56 2013 +0000 @@ -0,0 +1,466 @@ +<?xml version="1.0" encoding="UTF-8"?> +<archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="8.00"> + <data> + <int key="IBDocument.SystemTarget">1536</int> + <string key="IBDocument.SystemVersion">11G63</string> + <string key="IBDocument.InterfaceBuilderVersion">2844</string> + <string key="IBDocument.AppKitVersion">1138.51</string> + <string key="IBDocument.HIToolboxVersion">569.00</string> + <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> + <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="NS.object.0">1930</string> + </object> + <array key="IBDocument.IntegratedClassDependencies"> + <string>IBNSLayoutConstraint</string> + <string>IBProxyObject</string> + <string>IBUIBarButtonItem</string> + <string>IBUIToolbar</string> + <string>IBUIView</string> + </array> + <array key="IBDocument.PluginDependencies"> + <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + </array> + <object class="NSMutableDictionary" key="IBDocument.Metadata"> + <string key="NS.key.0">PluginDependencyRecalculationVersion</string> + <integer value="1" key="NS.object.0"/> + </object> + <array class="NSMutableArray" key="IBDocument.RootObjects" id="1000"> + <object class="IBProxyObject" id="841351856"> + <string key="IBProxiedObjectIdentifier">IBFilesOwner</string> + <string key="targetRuntimeIdentifier">IBIPadFramework</string> + </object> + <object class="IBProxyObject" id="606714003"> + <string key="IBProxiedObjectIdentifier">IBFirstResponder</string> + <string key="targetRuntimeIdentifier">IBIPadFramework</string> + </object> + <object class="IBUIView" id="766721923"> + <reference key="NSNextResponder"/> + <int key="NSvFlags">292</int> + <array class="NSMutableArray" key="NSSubviews"> + <object class="IBUIToolbar" id="358683122"> + <reference key="NSNextResponder" ref="766721923"/> + <int key="NSvFlags">266</int> + <string key="NSFrameSize">{768, 44}</string> + <reference key="NSSuperview" ref="766721923"/> + <reference key="NSWindow"/> + <string key="NSReuseIdentifierKey">_NS:9</string> + <bool key="IBUIOpaque">NO</bool> + <bool key="IBUIClearsContextBeforeDrawing">NO</bool> + <string key="targetRuntimeIdentifier">IBIPadFramework</string> + <array class="NSMutableArray" key="IBUIItems"> + <object class="IBUIBarButtonItem" id="379344923"> + <string key="targetRuntimeIdentifier">IBIPadFramework</string> + <int key="IBUIStyle">1</int> + <reference key="IBUIToolbar" ref="358683122"/> + <int key="IBUISystemItemIdentifier">17</int> + </object> + <object class="IBUIBarButtonItem" id="898331149"> + <string key="targetRuntimeIdentifier">IBIPadFramework</string> + <int key="IBUIStyle">1</int> + <reference key="IBUIToolbar" ref="358683122"/> + <int key="IBUISystemItemIdentifier">18</int> + </object> + <object class="IBUIBarButtonItem" id="220646609"> + <string key="targetRuntimeIdentifier">IBIPadFramework</string> + <float key="IBUIWidth">52</float> + <reference key="IBUIToolbar" ref="358683122"/> + <int key="IBUISystemItemIdentifier">6</int> + </object> + <object class="IBUIBarButtonItem" id="996249183"> + <string key="IBUITitle">Save Preset</string> + <string key="targetRuntimeIdentifier">IBIPadFramework</string> + <int key="IBUIStyle">1</int> + <reference key="IBUIToolbar" ref="358683122"/> + <object class="NSColor" key="IBUITintColor"> + <int key="NSColorSpace">1</int> + <bytes key="NSRGB">MC4zNjc1OTI2Njc5IDAuNTkyNTIwODk2NyAxAA</bytes> + </object> + </object> + <object class="IBUIBarButtonItem" id="318310914"> + <string key="targetRuntimeIdentifier">IBIPadFramework</string> + <float key="IBUIWidth">62</float> + <reference key="IBUIToolbar" ref="358683122"/> + <int key="IBUISystemItemIdentifier">6</int> + </object> + <object class="IBUIBarButtonItem" id="702923516"> + <string key="IBUITitle">Take Questionnaire</string> + <string key="targetRuntimeIdentifier">IBIPadFramework</string> + <int key="IBUIStyle">1</int> + <reference key="IBUIToolbar" ref="358683122"/> + </object> + <object class="IBUIBarButtonItem" id="680653375"> + <string key="targetRuntimeIdentifier">IBIPadFramework</string> + <reference key="IBUIToolbar" ref="358683122"/> + <int key="IBUISystemItemIdentifier">5</int> + </object> + <object class="IBUIBarButtonItem" id="189059998"> + <string key="IBUITitle">Lock Sequence (X)</string> + <string key="targetRuntimeIdentifier">IBIPadFramework</string> + <int key="IBUIStyle">1</int> + <reference key="IBUIToolbar" ref="358683122"/> + </object> + <object class="IBUIBarButtonItem" id="597523981"> + <string key="IBUITitle">Lock Synth (Y)</string> + <string key="targetRuntimeIdentifier">IBIPadFramework</string> + <int key="IBUIStyle">1</int> + <reference key="IBUIToolbar" ref="358683122"/> + </object> + </array> + </object> + </array> + <string key="NSFrameSize">{768, 44}</string> + <reference key="NSSuperview"/> + <reference key="NSWindow"/> + <reference key="NSNextKeyView" ref="358683122"/> + <object class="NSColor" key="IBUIBackgroundColor"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MQA</bytes> + <object class="NSColorSpace" key="NSCustomColorSpace"> + <int key="NSID">2</int> + </object> + </object> + <bool key="IBUIClearsContextBeforeDrawing">NO</bool> + <string key="targetRuntimeIdentifier">IBIPadFramework</string> + </object> + </array> + <object class="IBObjectContainer" key="IBDocument.Objects"> + <array class="NSMutableArray" key="connectionRecords"> + <object class="IBConnectionRecord"> + <object class="IBCocoaTouchOutletConnection" key="connection"> + <string key="label">view</string> + <reference key="source" ref="841351856"/> + <reference key="destination" ref="766721923"/> + </object> + <int key="connectionID">3</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBCocoaTouchOutletConnection" key="connection"> + <string key="label">playButton</string> + <reference key="source" ref="841351856"/> + <reference key="destination" ref="379344923"/> + </object> + <int key="connectionID">26</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBCocoaTouchOutletConnection" key="connection"> + <string key="label">pauseButton</string> + <reference key="source" ref="841351856"/> + <reference key="destination" ref="898331149"/> + </object> + <int key="connectionID">27</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBCocoaTouchEventConnection" key="connection"> + <string key="label">savePressed:</string> + <reference key="source" ref="996249183"/> + <reference key="destination" ref="841351856"/> + </object> + <int key="connectionID">22</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBCocoaTouchEventConnection" key="connection"> + <string key="label">playPressed:</string> + <reference key="source" ref="379344923"/> + <reference key="destination" ref="841351856"/> + </object> + <int key="connectionID">20</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBCocoaTouchEventConnection" key="connection"> + <string key="label">qPressed:</string> + <reference key="source" ref="702923516"/> + <reference key="destination" ref="841351856"/> + </object> + <int key="connectionID">25</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBCocoaTouchEventConnection" key="connection"> + <string key="label">lockSequencePressed:</string> + <reference key="source" ref="189059998"/> + <reference key="destination" ref="841351856"/> + </object> + <int key="connectionID">23</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBCocoaTouchEventConnection" key="connection"> + <string key="label">lockSynthPressed:</string> + <reference key="source" ref="597523981"/> + <reference key="destination" ref="841351856"/> + </object> + <int key="connectionID">24</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBCocoaTouchEventConnection" key="connection"> + <string key="label">pausePressed:</string> + <reference key="source" ref="898331149"/> + <reference key="destination" ref="841351856"/> + </object> + <int key="connectionID">21</int> + </object> + </array> + <object class="IBMutableOrderedSet" key="objectRecords"> + <array key="orderedObjects"> + <object class="IBObjectRecord"> + <int key="objectID">0</int> + <array key="object" id="0"/> + <reference key="children" ref="1000"/> + <nil key="parent"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-1</int> + <reference key="object" ref="841351856"/> + <reference key="parent" ref="0"/> + <string key="objectName">File's Owner</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-2</int> + <reference key="object" ref="606714003"/> + <reference key="parent" ref="0"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">2</int> + <reference key="object" ref="766721923"/> + <array class="NSMutableArray" key="children"> + <reference ref="358683122"/> + <object class="IBNSLayoutConstraint" id="901616674"> + <reference key="firstItem" ref="358683122"/> + <int key="firstAttribute">3</int> + <int key="relation">0</int> + <reference key="secondItem" ref="766721923"/> + <int key="secondAttribute">3</int> + <float key="multiplier">1</float> + <object class="IBLayoutConstant" key="constant"> + <double key="value">0.0</double> + </object> + <float key="priority">1000</float> + <reference key="containingView" ref="766721923"/> + <int key="scoringType">8</int> + <float key="scoringTypeFloat">29</float> + <int key="contentType">3</int> + </object> + <object class="IBNSLayoutConstraint" id="227999361"> + <reference key="firstItem" ref="358683122"/> + <int key="firstAttribute">5</int> + <int key="relation">0</int> + <reference key="secondItem" ref="766721923"/> + <int key="secondAttribute">5</int> + <float key="multiplier">1</float> + <object class="IBLayoutConstant" key="constant"> + <double key="value">0.0</double> + </object> + <float key="priority">1000</float> + <reference key="containingView" ref="766721923"/> + <int key="scoringType">8</int> + <float key="scoringTypeFloat">29</float> + <int key="contentType">3</int> + </object> + <object class="IBNSLayoutConstraint" id="1035495854"> + <reference key="firstItem" ref="358683122"/> + <int key="firstAttribute">6</int> + <int key="relation">0</int> + <reference key="secondItem" ref="766721923"/> + <int key="secondAttribute">6</int> + <float key="multiplier">1</float> + <object class="IBLayoutConstant" key="constant"> + <double key="value">0.0</double> + </object> + <float key="priority">1000</float> + <reference key="containingView" ref="766721923"/> + <int key="scoringType">8</int> + <float key="scoringTypeFloat">29</float> + <int key="contentType">3</int> + </object> + </array> + <reference key="parent" ref="0"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">4</int> + <reference key="object" ref="358683122"/> + <array class="NSMutableArray" key="children"> + <reference ref="220646609"/> + <reference ref="702923516"/> + <reference ref="189059998"/> + <reference ref="597523981"/> + <reference ref="318310914"/> + <reference ref="379344923"/> + <reference ref="996249183"/> + <reference ref="898331149"/> + <reference ref="680653375"/> + </array> + <reference key="parent" ref="766721923"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">5</int> + <reference key="object" ref="996249183"/> + <reference key="parent" ref="358683122"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">6</int> + <reference key="object" ref="1035495854"/> + <reference key="parent" ref="766721923"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">7</int> + <reference key="object" ref="227999361"/> + <reference key="parent" ref="766721923"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">8</int> + <reference key="object" ref="901616674"/> + <reference key="parent" ref="766721923"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">9</int> + <reference key="object" ref="379344923"/> + <reference key="parent" ref="358683122"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">10</int> + <reference key="object" ref="220646609"/> + <reference key="parent" ref="358683122"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">11</int> + <reference key="object" ref="702923516"/> + <reference key="parent" ref="358683122"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">12</int> + <reference key="object" ref="189059998"/> + <reference key="parent" ref="358683122"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">13</int> + <reference key="object" ref="597523981"/> + <reference key="parent" ref="358683122"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">14</int> + <reference key="object" ref="318310914"/> + <reference key="parent" ref="358683122"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">16</int> + <reference key="object" ref="898331149"/> + <reference key="parent" ref="358683122"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">28</int> + <reference key="object" ref="680653375"/> + <reference key="parent" ref="358683122"/> + </object> + </array> + </object> + <dictionary class="NSMutableDictionary" key="flattenedProperties"> + <string key="-1.CustomClassName">TopButtonViewController</string> + <string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="-2.CustomClassName">UIResponder</string> + <string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="10.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="11.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="12.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="13.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="14.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="16.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <array class="NSMutableArray" key="2.IBViewMetadataConstraints"> + <reference ref="1035495854"/> + <reference ref="227999361"/> + <reference ref="901616674"/> + </array> + <string key="28.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <boolean value="NO" key="4.IBViewMetadataTranslatesAutoresizingMaskIntoConstraints"/> + <string key="5.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="7.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="8.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + <string key="9.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> + </dictionary> + <dictionary class="NSMutableDictionary" key="unlocalizedProperties"/> + <nil key="activeLocalization"/> + <dictionary class="NSMutableDictionary" key="localizations"/> + <nil key="sourceID"/> + <int key="maxID">28</int> + </object> + <object class="IBClassDescriber" key="IBDocument.Classes"> + <array class="NSMutableArray" key="referencedPartialClassDescriptions"> + <object class="IBPartialClassDescription"> + <string key="className">NSLayoutConstraint</string> + <string key="superclassName">NSObject</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">./Classes/NSLayoutConstraint.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">TopButtonViewController</string> + <string key="superclassName">UIViewController</string> + <dictionary class="NSMutableDictionary" key="actions"> + <string key="lockSequencePressed:">id</string> + <string key="lockSynthPressed:">id</string> + <string key="pausePressed:">id</string> + <string key="playPressed:">id</string> + <string key="qPressed:">id</string> + <string key="savePressed:">id</string> + <string key="show:">id</string> + </dictionary> + <dictionary class="NSMutableDictionary" key="actionInfosByName"> + <object class="IBActionInfo" key="lockSequencePressed:"> + <string key="name">lockSequencePressed:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo" key="lockSynthPressed:"> + <string key="name">lockSynthPressed:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo" key="pausePressed:"> + <string key="name">pausePressed:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo" key="playPressed:"> + <string key="name">playPressed:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo" key="qPressed:"> + <string key="name">qPressed:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo" key="savePressed:"> + <string key="name">savePressed:</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo" key="show:"> + <string key="name">show:</string> + <string key="candidateClassName">id</string> + </object> + </dictionary> + <dictionary class="NSMutableDictionary" key="outlets"> + <string key="pauseButton">UIBarButtonItem</string> + <string key="playButton">UIBarButtonItem</string> + </dictionary> + <dictionary class="NSMutableDictionary" key="toOneOutletInfosByName"> + <object class="IBToOneOutletInfo" key="pauseButton"> + <string key="name">pauseButton</string> + <string key="candidateClassName">UIBarButtonItem</string> + </object> + <object class="IBToOneOutletInfo" key="playButton"> + <string key="name">playButton</string> + <string key="candidateClassName">UIBarButtonItem</string> + </object> + </dictionary> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">./Classes/TopButtonViewController.h</string> + </object> + </object> + </array> + </object> + <int key="IBDocument.localizationMode">0</int> + <string key="IBDocument.TargetRuntimeIdentifier">IBIPadFramework</string> + <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> + <int key="IBDocument.defaultPropertyAccessControl">3</int> + <bool key="IBDocument.UseAutolayout">YES</bool> + <string key="IBCocoaTouchPluginVersion">1930</string> + </data> +</archive>
--- a/eventLogger.h Fri Jan 25 17:42:47 2013 +0000 +++ b/eventLogger.h Fri Feb 01 11:16:56 2013 +0000 @@ -25,6 +25,7 @@ #include <map> #include "2dvector.h" #include "json.h" +#include "testApp.h" #import "usernameAlertViewController.h"
--- a/eventLogger.mm Fri Jan 25 17:42:47 2013 +0000 +++ b/eventLogger.mm Fri Feb 01 11:16:56 2013 +0000 @@ -30,6 +30,9 @@ nextUploadQty = 5000; // amount of data uploaded is always more than 5000 events } //--------------------------------------------------------------------------- +// draw() - show path of last N scroll events - can be scrubbed along? +// +//--------------------------------------------------------------------------- void EventLogger::init(){ readJsonToLog(ofxiPhoneGetDocumentsDirectory() + EVENT_LOG_FILENAME); @@ -80,7 +83,7 @@ ofURLFileLoader fileLoader; ofHttpResponse resp; resp = fileLoader.get(request); - + //fileLoader.getAsync(request); cout << "HTTP STATUS " << resp.status << "\n"; cout << "HTTP ERROR " << resp.error << "\n"; cout << "HTTP DATA " << resp.data << "\n"; // ofBuffer @@ -133,14 +136,11 @@ return; }else{ - while(theFile){ theFile >> line; // cout << line; // lots!!!! fileText << line; - } - theFile.close(); } @@ -228,7 +228,10 @@ questionnaireCompleted = false; questionnaireUploaded = false; - [usernameAlertViewController showUserNamePrompt]; + ((testApp *)ofGetAppPtr())->showIntro(); + + + //[usernameAlertViewController showUserNamePrompt]; // then we get userName via setUsername, called from button delegate }
--- a/grid.h Fri Jan 25 17:42:47 2013 +0000 +++ b/grid.h Fri Feb 01 11:16:56 2013 +0000 @@ -18,8 +18,38 @@ class Preset; class Grid { + +public: + bool snapped; + + + Grid(); + ~Grid(); + void init(); + void move(TwoVector moveP); // shift view by pixels + void zoom(float factor); + + + void snapCheck(); + void shiftCentreToSnapped(); + void draw(); // draw lines + + void update(); // change according to zoom + + vector<int> getParams(); + TwoVector getCoord(); + void setMinZoom(); + void setMaxZoom(); + + vector<int> calculateParamsFromCoord(TwoVector coord) const; + TwoVector calculateCoordFromParams(vector<int> params) const; + TwoVector coordToPixel(TwoVector coord); + + // the inverse stuff + void setParams(vector<int>); + private: - double scale; // surface units per pixel + double scale; // surface units per pixel GUI const double maxValue; // width of entire space const double minValue; // smallest zoom @@ -29,15 +59,14 @@ - TwoVector topLeft; // top left corner of view, surface coords + TwoVector topLeft; // top left corner of view, surface coords GUI TwoVector bottomRight; TwoVector size; // size of view, surface coords TwoVector pixSize; // size of view pixels (ie screen size!) + TwoVector centre; - - TwoVector snapCentre; - TwoVector snapDist; // number of pixels to snap to + TwoVector snapDist; // number of pixels to snap to GUI Preset * closestPreset; // pointer to the currently selected (snapped to ) preset.. NULL if none. bool maxZoom, minZoom; @@ -73,31 +102,7 @@ void setCoord(TwoVector coord); void drawCrossHairs(); -public: - Grid(); - ~Grid(); - void init(); - void move(TwoVector moveP); // shift view by pixels - void zoom(float factor); - bool snapped; - - void snapCheck(); - void shiftCentreToSnapped(); - void draw(); // draw lines - - void update(); // change according to zoom - - vector<int> calculateParamsFromCoord(TwoVector coord) const; - TwoVector calculateCoordFromParams(vector<int> params) const; - TwoVector coordToPixel(TwoVector coord); - vector<int> getParams(); - TwoVector getCoord(); - void setMinZoom(); - void setMaxZoom(); - - // the inverse stuff - void setParams(vector<int>);
--- a/grid.mm Fri Jan 25 17:42:47 2013 +0000 +++ b/grid.mm Fri Feb 01 11:16:56 2013 +0000 @@ -33,7 +33,7 @@ pixSize.setCoord(ofGetWidth(), ofGetHeight()); //set scale and position to mid way - scale = pow(32.0,3.0); + scale = 5500.0; snapDist = TwoVector(9,9); snapped = false; @@ -425,6 +425,7 @@ } //-------------------------------------------------------------- +// would be advisable to only have one "mover" object that has permission to move the grid (?) void Grid::move(TwoVector moveP){ // numspacing, pixelspacing stay the same
--- a/testApp.h Fri Jan 25 17:42:47 2013 +0000 +++ b/testApp.h Fri Feb 01 11:16:56 2013 +0000 @@ -19,16 +19,23 @@ #import "QuestionnaireViewController.h" +#import "BottomTabViewController.h" +#import "IntroViewController.h" +#import "TopButtonViewController.h" #define HOST "169.254.1.1" #define PORT 12345 +typedef enum {SLIDERS,ZOOMER,BOTH,INTRO,QUESTIONNAIRE}interfaceType; + class testApp : public ofxiPhoneApp { public: - + interfaceType whichInterfaceShowing; + bool consentGiven; + BottomTabViewController *bottomTabViewController; int prevTouchX; int prevTouchY; double prevDist; @@ -57,6 +64,9 @@ int numActiveTouches; QuestionnaireViewController * questionnaireViewController; + IntroViewController * introViewController; + TopButtonViewController * topButtonViewController; + // void setup(); @@ -86,14 +96,26 @@ ofxOscSender sender; void sendOSCParams(); + void lockSynthPressed(bool locked); + void lockSequencerPressed(bool locked); + void showQuestionnaire(); void questionnaireHidden(vector<int> answers); + void showIntro(); + void introHidden(bool OK); + void interfaceSelected(int which); + void seqStartStop(bool go); + + void setupBottomGui(); + void bottomGuiEvent(); + void setupTopGui(); + void topGuiEvent(); // stardard GUI - knbs and sliders - hides zoomer - bool standardGUIShowing; - void standardGUIEvent(ofxUIEventArgs &e); - void setupStandardGui(); - ofxUICanvas *standardGUI; + void sliderGUIEvent(ofxUIEventArgs &e); + void setupSliderGui(); + ofxUICanvas *sliderGUI; + void sliderMoved(int which, float value); void setAllGUISliders(vector<int> vals);
--- a/testApp.mm Fri Jan 25 17:42:47 2013 +0000 +++ b/testApp.mm Fri Feb 01 11:16:56 2013 +0000 @@ -1,16 +1,23 @@ #include "testApp.h" - +#define SLIDER_GUI_WIDTH 256 extern Grid theGridView; extern PresetManager presetManager; extern EventLogger eventLogger; extern Frequencer frequencer; +const vector<string> parameterNames; + +const string sliderParamNames[10] = {"Transpose", "1/4 note","1/6 note","1/7 note","1/8 note","Waveform", "Filter Type","Filter Freq", "Envelope","FM amt"}; +//const vector<const string> v(ra[0],ra[1]); + + //DeviceID3523537000 //-------------------------------------------------------------- void testApp::setup(){ paused = true; + ofBackground( 0, 0, 0 ); ofEnableAlphaBlending(); //ofEnableSmoothing(); @@ -46,20 +53,19 @@ ofxiPhoneSetOrientation( OFXIPHONE_ORIENTATION_PORTRAIT ); // do this before setting up all the other objects + // initialise the interfaces theGridView.init(); - setupStandardGui(); - standardGUIShowing = false; - standardGUI->setVisible(standardGUIShowing); - - setupZoomGui(); - zoomGUI->setVisible(!standardGUIShowing); + setupSliderGui(); + sliderGUI->setVisible(true); // initial slider vals for(int i=0; i<10;i++){ sliderVals.push_back(64); } + // initialise PD + int ticksPerBuffer = 8; // 8 * 64 = buffer len of 512 // setup the app core @@ -68,13 +74,58 @@ // setup OF sound stream ofSoundStreamSetup(2, 1, this, 44100, ofxPd::blockSize()*ticksPerBuffer, 3); + + + // set up iOS gui stuff + bottomTabViewController = [[BottomTabViewController alloc] initWithNibName:@"BottomTabViewController" bundle:nil]; + [ofxiPhoneGetGLParentView() addSubview:bottomTabViewController.view]; + + [bottomTabViewController setAppRef:(id)this]; + [bottomTabViewController show:(id)this]; + + bottomTabViewController.view.frame = CGRectMake(0,getHeight()-44,getWidth(),44); + + ///// + + topButtonViewController = [[TopButtonViewController alloc] initWithNibName:@"TopButtonViewController" bundle:nil]; + [ofxiPhoneGetGLParentView() addSubview:topButtonViewController.view]; + + [topButtonViewController setAppRef:(id)this]; + [topButtonViewController show:(id)this]; + + topButtonViewController.view.frame = CGRectMake(0,0,getWidth(),44); + + // initialise user logging stuff presetManager.startupLoadAll(); eventLogger.init(); - + + + // GO paused = false; +} + + +//-------------------------------------------------------------- +void testApp::exit(){ + if(consentGiven){ + presetManager.exitAndSaveAll(); + eventLogger.exitAndSave(); + } + // else - don't save anything and app will boot up into consent/intro screen + core.exit(); + + [introViewController release]; + [topButtonViewController release]; + [bottomTabViewController release]; + + delete sliderGUI; + + cout << "exit done \n"; } + +//-------------------------------------------------------------- #pragma mark GUI //-- float testApp::getWidth(){ @@ -87,41 +138,39 @@ return ofGetHeight(); } +#pragma mark GUI + //-------------------------------------------------------------- +/* void testApp::setupZoomGui(){ // width = height - zoomGUI = new ofxUICanvas(getWidth()-200,0,190,300); - zoomGUI->setTheme(OFX_UI_THEME_HACKER ); + int buttonHeight = 45; + zoomGUI = new ofxUICanvas(getWidth()-200,0,190,buttonHeight*7); + zoomGUI->setTheme(OFX_UI_THEME_METALGEAR ); - zoomGUI->addLabelToggle("SWITCH VIEW", false); - - zoomGUI->addLabelButton("SAVE PRESET", false); - - + zoomGUI->addLabelToggle("START/STOP", false); + zoomGUI->addLabelButton("SAVE PRESET", false); zoomGUI->addLabelButton("ZOOM MIN", false); zoomGUI->addLabelButton("ZOOM MAX", false); zoomGUI->addLabelButton("QUESTIONS", false); + + ofxUILabelToggle * butt = zoomGUI->addLabelToggle("LOCK SEQUENCE (X)", false); + butt->setColorFill(ofColor(0,0,255)); + butt->setColorFillHighlight(ofColor(0,0,255)); + + ofxUILabelToggle * butt2 = zoomGUI->addLabelToggle("LOCK SYNTH (Y)", false); + butt2->setColorFill(ofColor(255,0,0)); + butt2->setColorFillHighlight(ofColor(255,0,0)); + + ofAddListener(zoomGUI->newGUIEvent, this, &testApp::zoomGUIEvent); } + //-------------------------------------------------------------- void testApp::zoomGUIEvent(ofxUIEventArgs &e){ - if(e.widget->getName() == "SWITCH VIEW") - { - // is toggle - cout << "change VIEW\n"; - cout << "of width " << ofGetWidth() <<'\n'; - cout << "of height " << ofGetHeight() <<'\n'; - standardGUI->setVisible(!standardGUIShowing); - standardGUIShowing = !standardGUIShowing; - if(standardGUIShowing){ - // set the slider values to stuff got from zoomer - sliderVals = theGridView.getParams(); - setAllGUISliders(sliderVals); - } - - }else if(e.widget->getName() == "SAVE PRESET") + if(e.widget->getName() == "SAVE PRESET") { if(((ofxUIButton *)e.widget)->getValue()==0){ // touchup @@ -150,89 +199,7 @@ if(((ofxUIButton *)e.widget)->getValue()==0){ // touchup showQuestionnaire(); } - }else{ - cout << "GUI error : unknown event recieved\n"; - } - -} -//-------------------------------------------------------------- -void testApp::showQuestionnaire(){ - // stop updating / drawing - - // if(eventLogger.questionnaireCompleted) return; - - paused = true; - - questionnaireViewController = [[QuestionnaireViewController alloc] initWithNibName:@"QuestionnaireViewController" bundle:nil]; - [ofxiPhoneGetGLParentView() addSubview:questionnaireViewController.view]; - - [questionnaireViewController setAppRef:(id)this]; - [questionnaireViewController show:(id)this]; - - //IF THE VIEW IS HIDDEN LETS BRING IT BACK! - //if( questionnaireViewController.view.hidden ){ - // questionnaireViewController.view.hidden = NO; - //} - -} -//-------------------------------------------------------------- -void testApp::questionnaireHidden(vector<int> answers){ - // send answers to server as json - eventLogger.questionnaireAnswersObtained(answers); - - // set "we've done questionnaire" to true in event logger - paused = false; -} -//-------------------------------------------------------------- -void testApp::setupStandardGui(){ - float xInit = OFX_UI_GLOBAL_WIDGET_SPACING; - float length = 256-xInit*2; - - - float dim = 42; - - // LEFT GUI - standardGUI = new ofxUICanvas(0,0,length+90,getHeight()); - - - ofxUILabelToggle * butt = standardGUI->addLabelToggle("LOCK SEQUENCE (X)", false); - butt->setColorFill(ofColor(0,0,255)); - butt->setColorFillHighlight(ofColor(0,0,255)); - - // Uh.. loop this - for(int i = 1; i<=10;i++){ - stringstream ss; - ss << "P" << i; - ofxUISlider *slider; - slider = (ofxUISlider *)standardGUI->addWidgetDown(new ofxUISlider(length,dim,0.0,127,64,ss.str())); - slider->setDrawPadding(true); - if(i <= 5){ - slider->setColorFill(ofColor(0,0,255)); - slider->setColorFillHighlight(ofColor(0,0,255)); - }else{ - slider->setColorFill(ofColor(255,0,0)); - slider->setColorFillHighlight(ofColor(255,0,0)); - } - - sliders.push_back(slider); - } - - ofxUILabelToggle * butt2 = standardGUI->addLabelToggle("LOCK SYNTH (Y)", false); - butt2->setColorFill(ofColor(255,0,0)); - butt2->setColorFillHighlight(ofColor(255,0,0)); - - ofAddListener(standardGUI->newGUIEvent, this, &testApp::standardGUIEvent); - standardGUI->loadSettings(ofxiPhoneGetDocumentsDirectory() + "guiSettings.xml"); - -} -//-------------------------------------------------------------- -void testApp::standardGUIEvent(ofxUIEventArgs &e){ - if(!standardGUIShowing){ - cout << "GUI ERROR"; - return; - } - - if(e.widget->getName() == "LOCK SEQUENCE (X)") + }else if(e.widget->getName() == "LOCK SEQUENCE (X)") { cout << "LOCK SEQUENCE (X)\n"; @@ -252,36 +219,205 @@ yLocked = false; } + + }else if(e.widget->getName() == "START/STOP") + { + + + //pd.startMessage(); + /// pd.addSymbol("hello"); + /// pd.addFloat(1.23); + /// pd.finishList("test"); + }else{ + cout << "GUI error : unknown event recieved\n"; } +} + */ + + +//////////////////////////// +// These functions called from iOS toolbars +//-------------------------------------------------------------- +void testApp::lockSequencerPressed(bool locked){ + theGridView.shiftCentreToSnapped(); + xLocked = locked; + +} +//-------------------------------------------------------------- +void testApp::lockSynthPressed(bool locked){ + theGridView.shiftCentreToSnapped(); + yLocked = locked; + +} +//-------------------------------------------------------------- +void testApp::seqStartStop(bool go){ + if(!go){ //stop + core.pd.startMessage(); + core.pd.addFloat(0); + core.pd.finishMessage("fromOF", "seqStartStop"); + }else { // play + //stopSequencer(); + core.pd.startMessage(); + core.pd.addFloat(1); + core.pd.finishMessage("fromOF", "seqStartStop"); + } +} +//-------------------------------------------------------------- +void testApp::showQuestionnaire(){ + // stop updating / drawing + + // if(eventLogger.questionnaireCompleted) return; + + paused = true; + + //stopSequencer + core.pd.startMessage(); + core.pd.addFloat(0); + core.pd.finishMessage("fromOF", "seqStartStop"); + + questionnaireViewController = [[QuestionnaireViewController alloc] initWithNibName:@"QuestionnaireViewController" bundle:nil]; + [ofxiPhoneGetGLParentView() addSubview:questionnaireViewController.view]; + + [questionnaireViewController setAppRef:(id)this]; + [questionnaireViewController show:(id)this]; + + whichInterfaceShowing = QUESTIONNAIRE; + + +} +//-------------------------------------------------------------- +void testApp::questionnaireHidden(vector<int> answers){ + // send answers to server as json + eventLogger.questionnaireAnswersObtained(answers); + + // set "we've done questionnaire" to true in event logger + paused = false; + + //startSequencer (TODO what about the toggle ? ?) + core.pd.startMessage(); + core.pd.addFloat(1); + core.pd.finishMessage("fromOF", "seqStartStop"); + whichInterfaceShowing = BOTH; + // tell bottomtabviewcontroller + +} +//-------------------------------------------------------------- +void testApp::showIntro(){ + paused = true; + consentGiven = false; + cout << "SHOW INTRO\n"; + + introViewController = [[IntroViewController alloc] initWithNibName:@"IntroViewController" bundle:nil]; + [ofxiPhoneGetGLParentView() addSubview:introViewController.view]; + + [introViewController setAppRef:(id)this]; + [introViewController show:(id)this]; + + + whichInterfaceShowing = INTRO; + +} +//-------------------------------------------------------------- +void testApp::introHidden(bool OK){ + if(OK){ + paused = false; + consentGiven = true; + whichInterfaceShowing = BOTH; + } + // no unOK +} +//-------------------------------------------------------------- +// called from BottomTabViewController iOS segmented thing +void testApp::interfaceSelected(int which){ + switch (which){ + case 0: + + whichInterfaceShowing = SLIDERS; + sliderGUI->setVisible(true); + // set the slider values to stuff got from zoomer + sliderVals = theGridView.getParams(); + setAllGUISliders(sliderVals); + break; + case 1: + + whichInterfaceShowing = BOTH; + sliderGUI->setVisible(true); + // set the slider values to stuff got from zoomer + sliderVals = theGridView.getParams(); + setAllGUISliders(sliderVals); + break; + case 2: + + sliderGUI->setVisible(false); + whichInterfaceShowing = ZOOMER; + break; + } + +} +//-------------------------------------------------------------- +//-------------------------------------------------------------- +void testApp::setupSliderGui(){ + float xInit = OFX_UI_GLOBAL_WIDGET_SPACING; + float length = SLIDER_GUI_WIDTH - (OFX_UI_GLOBAL_WIDGET_SPACING*2); + + + //float dim = 42; + + // make this iphone size...? + int height = 480; + int width = 320; + float dim = (height-10.0*OFX_UI_GLOBAL_WIDGET_SPACING)/10.0; + // LEFT GUI + sliderGUI = new ofxUICanvas(0,100,SLIDER_GUI_WIDTH,getHeight()); + + // Uh.. loop this + for(int i = 1; i<=10;i++){ + + ofxUISlider *slider; + slider = (ofxUISlider *)sliderGUI->addWidgetDown(new ofxUISlider(width,dim,0.0,127,64,sliderParamNames[i-1])); + slider->setDrawPadding(true); + if(i <= 5){ + slider->setColorFill(ofColor(0,0,255)); + slider->setColorFillHighlight(ofColor(0,0,255)); + }else{ + slider->setColorFill(ofColor(255,0,0)); + slider->setColorFillHighlight(ofColor(255,0,0)); + } + + sliders.push_back(slider); + } + + + + ofAddListener(sliderGUI->newGUIEvent, this, &testApp::sliderGUIEvent); + +} +//-------------------------------------------------------------- +void testApp::sliderGUIEvent(ofxUIEventArgs &e){ + if(whichInterfaceShowing == ZOOMER){ + cout << "GUI ERROR"; + return; + } + // "normal" parameter changes for(int i = 1; i<=10;i++){ - stringstream ss; - ss << "P" << i; - string p = ss.str(); - if(e.widget->getName() == p) + if(e.widget->getName() == sliderParamNames[i-1]) { //cout << "param change: " << p; ofxUISlider *slider = (ofxUISlider *) e.widget; sliderMoved(i-1,slider->getScaledValue()); // internal array 0 indexed - - - } } - - // TODO reflect these changes in zoomer view? Or only when switching? - + } //-------------------------------------------------------------- void testApp::sliderMoved(int which, float value){ // an update caused by slider view being touched sliderVals[which] = (int)value; theGridView.setParams(sliderVals); - - // TODO if <5 do frequencer stuff and send list to PD - // if > 5 send control value to PD + sendParametersToPD(); eventLogger.logEvent(CHANGE_SLIDER, TwoVector(),0.0,which , value); @@ -343,7 +479,6 @@ // continiue to move at velocity, unless snapped if (numActiveTouches == 0){ // no touches, use momentum - // TODO set velocity to 0 when hits walls if(moveVel.norm() > 0.3){ if(theGridView.snapped){ @@ -394,32 +529,38 @@ //-------------------------------------------------------------- void testApp::draw(){ if(paused) return; - if (standardGUIShowing){// ? - ofSetColor(57, 57, 57,200); - ofRect(0,0,getWidth(),getHeight()); + + switch (whichInterfaceShowing){ + case SLIDERS: + break; + case ZOOMER: + theGridView.draw(); + break; + case BOTH: + + theGridView.draw(); + break; + case INTRO: + break; + + case QUESTIONNAIRE: + break; + } - theGridView.draw(); -} - -//-------------------------------------------------------------- -void testApp::exit(){ - presetManager.exitAndSaveAll(); - eventLogger.exitAndSave(); - core.exit(); - - delete standardGUI; - delete zoomGUI; - cout << "exit done \n"; } //-------------------------------------------------------------- void testApp::touchDown(ofTouchEventArgs &touch){ - if(standardGUIShowing){ - // check if in GUI area - if(touch.x < 256) return; - } + + // TODO check if in gui area!!! + if(whichInterfaceShowing == SLIDERS){ + return; + }else if (whichInterfaceShowing == BOTH && touch.x < (SLIDER_GUI_WIDTH+10)){ + return; + + }// otherwise we're good to let the zoomer handle touch numActiveTouches++; // absolute position doesn't matter @@ -450,14 +591,15 @@ //-------------------------------------------------------------- void testApp::touchMoved(ofTouchEventArgs &touch){ - //cout << "touch id " << touch.id << "\n"; - //cout << "active touches " << numActiveTouches << "\n"; + // TODO check if in gui area!!! + if(whichInterfaceShowing == SLIDERS){ + return; + }else if (whichInterfaceShowing == BOTH && touch.x < (SLIDER_GUI_WIDTH+10)){ + return; + + }// otherwise we're good to let the zoomer handle touch + - - if(standardGUIShowing){ - // TODO check if in GUI area - if(touch.x < 256) return; - } // check if in other gui area if(touch.x > getWidth()-200 && touch.y < 300){ return; @@ -541,13 +683,14 @@ void testApp::touchUp(ofTouchEventArgs &touch){ if(numActiveTouches > 0) numActiveTouches--; // dirty - if(standardGUIShowing){ - // check if in GUI area - if(touch.x < 256) + // TODO check if in gui area!!! + if(whichInterfaceShowing == SLIDERS){ + return; + }else if (whichInterfaceShowing == BOTH && touch.x < 256){ + return; - return; - } - // check if in + }// otherwise we're good to let the zoomer handle touch + // which one? if(touch.id == 0){ @@ -672,6 +815,22 @@ return y0; } +float ctrlSmoother(float newsamp){ + static float x1,x2,y1,y2; + float x0, y0; + + x0 = newsamp; + + y0 = fB[0]*x0 + fB[1]*x1 + fB[2]*x2 - fA[1]*y1 - fA[2]*y2; + + // shift + x2 = x1; + x1 = x0; + y2 = y1; + y1 = y0; + + return y0; +} //--------------------------------------------------------------- void testApp::sendOscShape(int ctrlin){ @@ -711,9 +870,9 @@ float ctrlout[numcontrols]; string ctrlName[4] = {"lpLev" , "bpLev", "hpLev", "reson"}; float values[3][4] = - {{1., 0., 0., 1}, // 0 - {0., 10., 0., 10}, // 64 - {0., 0., 1., 1}}; // 127 + {{2., 0., 0., 1.}, // 0 + {0., 10., 0., 10.}, // 64 + {0., 0., 1., 1.}}; // 127 float fidx = (numpoints-1)*ctrlin/128.; int idx = floor(fidx); @@ -732,10 +891,14 @@ } //--------------------------------------------------------------- void testApp::sendFiltFreq(int ctrlin){ + // smooth this + float fin = ctrlin; + float fout; + fout = (int)ctrlSmoother(fin); List toPD; toPD.addSymbol("filtFreq"); - toPD.addFloat(ctrlin); + toPD.addFloat(fout); core.pd.sendList("fromOF", toPD); }