Permalink
Browse files

Added two-finger changes to topmenu

  • Loading branch information...
1 parent a290a8d commit c5ede4fff42631389815e549ed0877ff7a07d40c @cnharris10 cnharris10 committed Apr 21, 2012
@@ -26,6 +26,8 @@
0826BDEB1523F6B7004A9B22 /* DeleteIcon.png in Resources */ = {isa = PBXBuildFile; fileRef = 0826BDEA1523F6B7004A9B22 /* DeleteIcon.png */; };
08ACF4BC152B9D1F00512760 /* star.png in Resources */ = {isa = PBXBuildFile; fileRef = 08ACF4BB152B9D1F00512760 /* star.png */; };
2A8E8FBA15374EF80067DB3D /* Circleof5thsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A8E8FB915374EF80067DB3D /* Circleof5thsController.m */; };
+ 2A94A4D61542517F00766EAF /* graybutton.png in Resources */ = {isa = PBXBuildFile; fileRef = 2A94A4D51542517F00766EAF /* graybutton.png */; };
+ 2A94A4E01542622000766EAF /* AccidentalsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A94A4DF1542622000766EAF /* AccidentalsController.m */; };
2AE1DE7415154B72008C538D /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2AE1DE7315154B72008C538D /* UIKit.framework */; };
2AE1DE7615154B72008C538D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2AE1DE7515154B72008C538D /* Foundation.framework */; };
2AE1DE7815154B72008C538D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2AE1DE7715154B72008C538D /* CoreGraphics.framework */; };
@@ -69,6 +71,9 @@
08ACF4BB152B9D1F00512760 /* star.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = star.png; sourceTree = "<group>"; };
2A8E8FB815374EF80067DB3D /* Circleof5thsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Circleof5thsController.h; sourceTree = "<group>"; };
2A8E8FB915374EF80067DB3D /* Circleof5thsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Circleof5thsController.m; sourceTree = "<group>"; };
+ 2A94A4D51542517F00766EAF /* graybutton.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = graybutton.png; sourceTree = "<group>"; };
+ 2A94A4DE1542622000766EAF /* AccidentalsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccidentalsController.h; sourceTree = "<group>"; };
+ 2A94A4DF1542622000766EAF /* AccidentalsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AccidentalsController.m; sourceTree = "<group>"; };
2AE1DE6F15154B72008C538D /* Staff.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Staff.app; sourceTree = BUILT_PRODUCTS_DIR; };
2AE1DE7315154B72008C538D /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
2AE1DE7515154B72008C538D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
@@ -154,6 +159,9 @@
0826BDCE1523E5C2004A9B22 /* solidLine.m */,
0826BDCF1523E5C2004A9B22 /* StaffController.h */,
0826BDD01523E5C2004A9B22 /* StaffController.m */,
+ 2A94A4DE1542622000766EAF /* AccidentalsController.h */,
+ 2A94A4DF1542622000766EAF /* AccidentalsController.m */,
+ 2A94A4D51542517F00766EAF /* graybutton.png */,
2AE1DE8215154B72008C538D /* AppDelegate.h */,
2AE1DE8315154B72008C538D /* AppDelegate.m */,
0826BDB01523E5AF004A9B22 /* Chord.h */,
@@ -257,6 +265,7 @@
0826BDD61523E5C2004A9B22 /* smallsharp.gif in Resources */,
0826BDEB1523F6B7004A9B22 /* DeleteIcon.png in Resources */,
08ACF4BC152B9D1F00512760 /* star.png in Resources */,
+ 2A94A4D61542517F00766EAF /* graybutton.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -281,6 +290,7 @@
0826BDE31523EFED004A9B22 /* ChordOptionsViewController.m in Sources */,
2A8E8FBA15374EF80067DB3D /* Circleof5thsController.m in Sources */,
A76A7A061539CEDA00A43222 /* TwoFingerOptionSelector.m in Sources */,
+ 2A94A4E01542622000766EAF /* AccidentalsController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -0,0 +1,20 @@
+//
+// AccidentalsController.h
+// Staff
+//
+// Created by Christopher Harris on 4/20/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface AccidentalsController : UIViewController <UIPickerViewDelegate, UIPickerViewDataSource>
+{
+ NSArray *elements;
+ UIView *content;
+ IBOutlet UIPickerView *picker;
+}
+
+@property (nonatomic, retain) IBOutlet UIPickerView *picker;
+
+@end
@@ -0,0 +1,87 @@
+//
+// AccidentalsController.m
+// Staff
+//
+// Created by Christopher Harris on 4/20/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import "AppDelegate.h"
+#import "AccidentalsController.h"
+
+@implementation AccidentalsController
+
+@synthesize picker;
+
+- (id)init
+{
+ return self;
+}
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+ // Do any additional setup after loading the view.
+
+ elements = [[NSArray alloc] initWithObjects:@"No Effect", @"Apply Sharp", @"Apply Flat", nil];
+
+ content = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 216)];
+ picker = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 0, 320, 216)];
+ [picker setDataSource:self];
+ [picker setDelegate:self];
+ [picker setShowsSelectionIndicator:YES];
+
+ [content addSubview:picker];
+ [self.view addSubview:content];
+}
+
+- (void)viewDidUnload
+{
+ [super viewDidUnload];
+ // Release any retained subviews of the main view.
+}
+
+// Number of components.
+-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView{
+ return 1;
+}
+
+// Total rows in our component.
+-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component{
+ return [elements count];
+}
+
+// Display each row's data.
+-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component{
+ return [elements objectAtIndex:row];
+}
+
+// Do something with the selected row.
+-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{
+ AppDelegate *mainDelegate = (AppDelegate*)[[UIApplication sharedApplication]delegate];
+ [mainDelegate.viewController.dataController twoFingerOptionWasSelected:[elements objectAtIndex: row]];
+ [mainDelegate.viewController.staffController.sharpFlatButton.titleLabel setFont:[UIFont systemFontOfSize:24]];
+ [mainDelegate.viewController.staffController.sharpFlatButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
+ switch (row) {
+ case 0:
+ [mainDelegate.viewController.staffController.sharpFlatButton setTitle:@"-" forState:UIControlStateNormal];
+ break;
+ case 1:
+ [mainDelegate.viewController.staffController.sharpFlatButton setTitle:@"#" forState:UIControlStateNormal];
+ break;
+ case 2:
+ [mainDelegate.viewController.staffController.sharpFlatButton setTitle:@"b" forState:UIControlStateNormal];
+ break;
+ default:
+ break;
+ }
+
+}
+
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
+{
+ return (interfaceOrientation == UIInterfaceOrientationPortrait);
+}
+
+@end
@@ -219,7 +219,7 @@ - (void) loadView
[self layoutStars];
[self setupMetronome];
[mainDelegate.viewController.circleOf5thsController setup];
- [mainDelegate.viewController.twoFingerOptionSelector setup];
+ //[mainDelegate.viewController.twoFingerOptionSelector setup];
}
@@ -41,7 +41,7 @@ - (void)setup
initWithObjects:@"F#",@"B",@"E",@"A",@"D",@"G",@"C",@"F",@"Bb",@"Eb",@"Ab",@"Db",@"Gb", nil];
// CHANGED THE SECOND PARAMETER TO 100 FROM 200
- circleOf5thsView = [[UIView alloc] initWithFrame:CGRectMake(577, 100, 260, 250)];
+ circleOf5thsView = [[UIView alloc] initWithFrame:CGRectMake(577, 250, 260, 250)];
[circleOf5thsView setBackgroundColor:[UIColor whiteColor]];
[[circleOf5thsView layer] setCornerRadius:10];
[[circleOf5thsView layer] setBorderColor:[UIColor blackColor].CGColor];
View
@@ -10,6 +10,7 @@
#import "solidLine.h"
#import "dashedLine.h"
#import "sharpIcon.h"
+#import "AccidentalsController.h"
#define NUMBER_OF_NOTES 15
@@ -24,6 +25,11 @@ typedef struct image_view_metadata {
@interface StaffController : UIViewController {
UIView *staffView;
+ UIView *topMenu;
+ UIButton *sharpFlatButton;
+ UIPopoverController *popoverController;
+ UIView *popoverView;
+ AccidentalsController *accidentalsController;
@private
NSMutableDictionary *lines;
@@ -35,6 +41,11 @@ typedef struct image_view_metadata {
}
@property (nonatomic, retain) IBOutlet UIView *staffView;
+@property (nonatomic, retain) IBOutlet UIView *topMenu;
+@property (nonatomic, retain) IBOutlet UIButton *sharpFlatButton;
+@property (nonatomic, retain) UIPopoverController *popoverController;
+@property (nonatomic, retain) UIView *popoverView;
+
@property (nonatomic, retain) NSMutableDictionary *lines;
@property (nonatomic, retain) NSMutableDictionary *spaces;
@property (nonatomic, retain) NSArray *notes;
View
@@ -8,13 +8,18 @@
#import "AppDelegate.h"
#import "StaffController.h"
+#import "AccidentalsController.h"
@implementation StaffController
@synthesize staffView;
@synthesize lines;
@synthesize spaces;
@synthesize notes;
+@synthesize sharpFlatButton;
+@synthesize topMenu;
+@synthesize popoverView;
+@synthesize popoverController;
const float PERCENTAGE_OF_FULL_SCREEN_HEIGHT = 0.9;
const int SCREEN_HEIGHT = 748;
@@ -38,8 +43,11 @@ - (void)viewDidLoad
[self buildStaff];
[self buildLines];
[self buildSpaces];
+ [self buildTopMenu];
[self setFlatsAndSharps];
+ accidentalsController = [[AccidentalsController alloc] init];
+
//EXAMPLE OF HOW STAFF CHANGES//
// NSMutableArray *thing = [[NSMutableArray alloc] initWithObjects:@"0",@"0",@"0",@"0",@"-1",@"-1",@"-1",@"-1",@"-1",@"-1",@"-1",@"-1",@"0",@"0",@"0",nil];
@@ -61,12 +69,13 @@ - (void)buildStaff
{
self.staffView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 400, 748)];
[self.staffView setBackgroundColor:[UIColor whiteColor]];
+ //[self.staffView.layer setBorderWidth:1];
+ //[self.staffView.layer setBorderColor:[UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:1.0].CGColor];
self.view = self.staffView;
}
- (void)buildLines
{
-
lines = [[NSMutableDictionary alloc] initWithCapacity:7];
[lines setObject:[[dashedLine alloc] initWithFrame:CGRectMake(0, (int)(SCREEN_HEIGHT - (SCREEN_HEIGHT * PERCENTAGE_OF_FULL_SCREEN_HEIGHT)) + (58 * PERCENTAGE_OF_FULL_SCREEN_HEIGHT), 400, (int)(32 * PERCENTAGE_OF_FULL_SCREEN_HEIGHT))] forKey:@"aline"];
[lines setObject:[[solidLine alloc] initWithFrame:CGRectMake(0, (int)(SCREEN_HEIGHT - (SCREEN_HEIGHT * PERCENTAGE_OF_FULL_SCREEN_HEIGHT )) + (158 * PERCENTAGE_OF_FULL_SCREEN_HEIGHT) , 400, (int)(32 * PERCENTAGE_OF_FULL_SCREEN_HEIGHT))] forKey:@"fline"];
@@ -97,6 +106,53 @@ -(void)setLineTags
[[lines objectForKey:@"cline"] setTag:14];
}
+- (void)buildTopMenu
+{
+ topMenu = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 400, 70)];
+ [topMenu setBackgroundColor:[UIColor colorWithRed:100.0/255 green:100.0/255 blue:100.0/255 alpha:1.0]];
+
+ sharpFlatButton = [[UIButton alloc] initWithFrame:CGRectMake(340, 10, 50, 50)];
+ [sharpFlatButton setBackgroundColor:[UIColor colorWithRed:170.0/255 green:170.0/255 blue:170.0/255 alpha:1.0]];
+ [[sharpFlatButton layer] setBorderColor:[UIColor colorWithRed:0.0/255 green:0.0/255 blue:0.0/255 alpha:1.0].CGColor];
+ [[sharpFlatButton layer] setBorderWidth:1];
+ [[sharpFlatButton layer] setCornerRadius:10];
+ [sharpFlatButton.titleLabel setFont:[UIFont systemFontOfSize:24]];
+ [sharpFlatButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
+ [sharpFlatButton setTitle:@"-" forState:UIControlStateNormal];
+ [[sharpFlatButton layer] setBorderColor:[UIColor blackColor].CGColor];
+ [[sharpFlatButton layer] setBorderWidth:2];
+ [[sharpFlatButton layer] setShadowColor:[UIColor blackColor].CGColor];
+ [[sharpFlatButton layer] setShadowOpacity:0.7f];
+ [[sharpFlatButton layer] setShadowOffset:CGSizeMake(3.0f, 3.0f)];
+ [[sharpFlatButton layer] setShadowRadius:5.0f];
+ [[sharpFlatButton layer] setMasksToBounds:NO];
+ UIBezierPath *path = [UIBezierPath bezierPathWithRect:sharpFlatButton.bounds];
+ [[sharpFlatButton layer] setShadowPath:path.CGPath];
+
+ [topMenu addSubview:sharpFlatButton];
+ [self.staffView addSubview:topMenu];
+
+ [sharpFlatButton addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(openAccidentalMenu:)]];
+
+ [sharpFlatButton addTarget:self action:@selector(openAccidentalMenu:) forControlEvents:UIControlEventTouchUpInside];
+}
+
+- (IBAction)openAccidentalMenu:(id)sender
+{
+ if([popoverController isPopoverVisible]){
+ [popoverController dismissPopoverAnimated:YES];
+ return;
+ }
+ popoverController = [[UIPopoverController alloc] initWithContentViewController:accidentalsController];
+ [popoverController presentPopoverFromBarButtonItem:sender
+ permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
+ [popoverController setPopoverContentSize:CGSizeMake(320, 216)];
+}
+
+
+
+
+
- (void)buildSpaces
{
spaces = [[NSMutableDictionary alloc] initWithCapacity:8];

0 comments on commit c5ede4f

Please sign in to comment.