Skip to content

Commit

Permalink
touches limit macro
Browse files Browse the repository at this point in the history
  • Loading branch information
cnharris10 committed May 7, 2012
2 parents 757a268 + 5801718 commit 1b4d308
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 32 deletions.
3 changes: 2 additions & 1 deletion Staff.xcodeproj/project.pbxproj
Expand Up @@ -284,7 +284,6 @@
2AF14AB7154715A200C899B2 /* dashedlineAccidental.h */,
2AF14AB8154715A200C899B2 /* dashedlineAccidental.m */,
2AAF8E851555B9F900F31082 /* scaledot.png */,
0826BDCF1523E5C2004A9B22 /* StaffController.h */,
2A94A4DE1542622000766EAF /* AccidentalsController.h */,
2A94A4DF1542622000766EAF /* AccidentalsController.m */,
2AE1DE8215154B72008C538D /* AppDelegate.h */,
Expand Down Expand Up @@ -354,6 +353,8 @@
A7A180C3154EF70600712D92 /* solidVerticalLine.m */,
2AF14AB8154715A200C899B2 /* dashedlineAccidental.m */,
0826BDCF1523E5C2004A9B22 /* StaffController.h */,
0826BDC51523E5C2004A9B22 /* MainController.h */,
0826BDCF1523E5C2004A9B22 /* StaffController.h */,
0826BDD01523E5C2004A9B22 /* StaffController.m */,
0826BDC51523E5C2004A9B22 /* MainController.h */,
08ACF4BB152B9D1F00512760 /* star.png */,
Expand Down
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions Staff/Chord.h
Expand Up @@ -18,6 +18,7 @@
@property (nonatomic, retain) NSString* key;

-(id)initWithName:(NSString*)name Notes:(NSArray*)notes andID:(int)number;
-(id)initWithName:(NSString*)aName Notes:(NSArray*)someNotes andKey:(NSString*)aKey;
-(void)setupKey:(NSString*)aKey;
-(void)resetValues;

Expand Down
14 changes: 14 additions & 0 deletions Staff/Chord.m
Expand Up @@ -26,6 +26,20 @@ -(id)initWithName:(NSString*)aName Notes:(NSArray*)someNotes andID:(int)num{
return self;
}

-(id)initWithName:(NSString*)aName Notes:(NSArray*)someNotes andKey:(NSString*)aKey{
self = [super init];

if(self){
name = aName;
notes = someNotes;
key = aKey;
beatsPerMeasure = 1;
numberOfMeasures = 1;
}

return self;
}

-(void)setupKey:(NSString*)aKey{
key = aKey;
}
Expand Down
3 changes: 2 additions & 1 deletion Staff/ChordViewController.h
Expand Up @@ -11,6 +11,7 @@
#import "ChordInstrumentsController.h"
#import "CircleOfFifthsViewController.h"
#import "solidVerticalLine.h"
#import "Circleof5thsController.h"

@interface ChordViewController : UIViewController <UITextFieldDelegate, UIPopoverControllerDelegate>
{
Expand Down Expand Up @@ -112,7 +113,7 @@

@property (nonatomic, retain) UIButton *circleOfFifthsButton;
@property (nonatomic, retain) UIPopoverController *circleOfFifthsPopoverController;
@property (nonatomic, retain) CircleOfFifthsViewController *circleOfFirthsViewController;
@property (nonatomic, retain) Circleof5thsController *circleOfFifthsViewController;


@property (nonatomic, retain) IBOutlet UISlider *chordVolume;
Expand Down
13 changes: 6 additions & 7 deletions Staff/ChordViewController.m
Expand Up @@ -20,7 +20,7 @@ @implementation ChordViewController
@synthesize bpmLabel;
@synthesize metronomeOnOff;
@synthesize metronomeTimer;
@synthesize topMenu, instrumentsButton, instumentPopoverController, instrumentsController, chordVolume, circleOfFirthsViewController, circleOfFifthsButton, circleOfFifthsPopoverController;
@synthesize topMenu, instrumentsButton, instumentPopoverController, instrumentsController, chordVolume, circleOfFifthsViewController, circleOfFifthsButton, circleOfFifthsPopoverController;

#define GROW_ANIMATION_DURATION_SECONDS 0.15 // Determines how fast a piece size grows when it is moved.
#define SHRINK_ANIMATION_DURATION_SECONDS 0.15 // Determines how fast a piece size shrinks when a piece stops moving.
Expand Down Expand Up @@ -92,7 +92,7 @@ - (void)buildTopMenu
topMenu = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 624, 70)];
[topMenu setBackgroundColor:[UIColor colorWithRed:100.0/255 green:100.0/255 blue:100.0/255 alpha:1.0]];

circleOfFirthsViewController = [[CircleOfFifthsViewController alloc]init];
circleOfFifthsViewController = [[Circleof5thsController alloc]init];

circleOfFifthsButton = [[UIButton alloc] initWithFrame:CGRectMake(450, 10, 150, 50)];
[circleOfFifthsButton setBackgroundColor:[UIColor colorWithRed:170.0/255 green:170.0/255 blue:170.0/255 alpha:1.0]];
Expand Down Expand Up @@ -134,9 +134,6 @@ - (void)buildTopMenu
[topMenu addSubview:instrumentsButton];
[topMenu addSubview:circleOfFifthsButton];
[self.view addSubview:topMenu];

//[self.view addSubview:instrumentsButton];
//[self.view addSubview:circleOfFifthsButton];

solidVerticalLine *divider = [[solidVerticalLine alloc] initWithFrame:CGRectMake(0, 0, 2, 70)];
[divider addSubview:[self deepCopySolidVerticalLine:[[solidVerticalLine alloc]init]]];
Expand Down Expand Up @@ -172,10 +169,12 @@ -(IBAction)openCircleOfFifthsMenu:(id)sender{
[circleOfFifthsPopoverController dismissPopoverAnimated:YES];
return;
}
circleOfFifthsPopoverController = [[UIPopoverController alloc] initWithContentViewController:circleOfFirthsViewController];
circleOfFifthsPopoverController = [[UIPopoverController alloc] initWithContentViewController:circleOfFifthsViewController];
[circleOfFifthsPopoverController presentPopoverFromBarButtonItem:sender
permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
[circleOfFifthsPopoverController setPopoverContentSize:CGSizeMake(510, 510)];
//[circleOfFifthsPopoverController setPopoverContentSize:CGSizeMake(550, 550)];
[circleOfFifthsPopoverController setPopoverContentSize:CGSizeMake(260, 250)];

}

-(void) layoutChordPickers
Expand Down
10 changes: 0 additions & 10 deletions Staff/Circleof5thsController.m
Expand Up @@ -70,18 +70,8 @@ - (void)setup
[circleOf5thsPicker setDataSource:self];
[circleOf5thsPicker setShowsSelectionIndicator:YES];

/*
circleOf5thsButton = [[UIButton alloc] initWithFrame:CGRectMake(60, 240, 250, 50)];
[circleOf5thsButton setTitle:@"Select" forState:UIControlStateNormal];
[[circleOf5thsButton layer] setBorderWidth:1];
[[circleOf5thsButton layer] setBorderColor:[UIColor colorWithRed:204.0/255 green:204.0/255 blue:204.0/255 alpha:1].CGColor];
[circleOf5thsButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[[circleOf5thsButton layer] setCornerRadius:10];
*/

[circleOf5thsView addSubview:circleOf5thsTab];
[circleOf5thsView addSubview:circleOf5thsPicker];
//[circleOf5thsView addSubview:circleOf5thsButton];

[mainDelegate.viewController.chordController.view addSubview:circleOf5thsView];
[circleOf5thsPicker selectRow:6 inComponent:0 animated:YES];
Expand Down
41 changes: 30 additions & 11 deletions Staff/DataController.m
Expand Up @@ -93,7 +93,7 @@ -(void)fillKeySignatureAccidentals{

/** b: B **/

NSArray *FMajor = [[NSArray alloc] initWithObjects:B3,
NSArray *FMajor = [[NSArray alloc] initWithObjects:F4,
none,none,none,none,
none,none,none,flat,
none,none,none,none,
Expand Down Expand Up @@ -506,15 +506,14 @@ -(void) fillChordsDictionary{
Maj: I, ii, iii, IV, V, V7, vi
min: i, ii°, III, iv, V, V7, VI
*/

[self setUpFriendChords];

_majorKeyChordFormulas = [[NSArray alloc]initWithObjects:
Maj, min, min, Maj, Maj, dom7, min, rest, nil];

_minorKeyChordFormulas = [[NSArray alloc]initWithObjects:
min, dim, Maj, min, Maj, dom7, Maj, rest, nil];

[self setUpFriendChords];

}

-(void)setUpFriendChords{
Expand Down Expand Up @@ -630,7 +629,34 @@ -(void)setUpFriendChords{
// name with, e.g. "F" + "Maj"
-(NSArray*)setUpChordsToSendWithRootKey:(NSString*)root{
NSArray *friends = [_friendChords objectForKey:root];
if(isupper([_currentKey characterAtIndex:0])) {
_currentChords = [_majorKeyChordFormulas mutableCopy];
}
else{
_currentChords = [_minorKeyChordFormulas mutableCopy];
}

int pos = 0;

Chord *one = [[Chord alloc] initWithName:[[_currentChords objectAtIndex:0] name] Notes:[[_currentChords objectAtIndex:0] notes]
andKey:[friends objectAtIndex:0]];
Chord *two = [[Chord alloc] initWithName:[[_currentChords objectAtIndex:1] name] Notes:[[_currentChords objectAtIndex:1] notes]
andKey:[friends objectAtIndex:1]];
Chord *three = [[Chord alloc] initWithName:[[_currentChords objectAtIndex:2] name] Notes:[[_currentChords objectAtIndex:2] notes]
andKey:[friends objectAtIndex:2]];
Chord *four = [[Chord alloc] initWithName:[[_currentChords objectAtIndex:3] name] Notes:[[_currentChords objectAtIndex:3] notes]
andKey:[friends objectAtIndex:3]];
Chord *five = [[Chord alloc] initWithName:[[_currentChords objectAtIndex:4] name] Notes:[[_currentChords objectAtIndex:4] notes]
andKey:[friends objectAtIndex:4]];
Chord *six = [[Chord alloc] initWithName:[[_currentChords objectAtIndex:5] name] Notes:[[_currentChords objectAtIndex:5] notes]
andKey:[friends objectAtIndex:5]];
Chord *seven = [[Chord alloc] initWithName:[[_currentChords objectAtIndex:6] name] Notes:[[_currentChords objectAtIndex:6] notes]
andKey:[friends objectAtIndex:6]];
Chord *eight = [[Chord alloc] initWithName:[[_currentChords objectAtIndex:7] name] Notes:[[_currentChords objectAtIndex:7] notes]
andKey:[friends objectAtIndex:7]];

_currentChords =[[NSArray alloc] initWithObjects:one, two, three, four, five, six, seven, eight, nil];

NSArray* toSend = [_currentChords mutableCopy];
NSLog(@"Creating chords to send:");
for(Chord *c in toSend){
Expand All @@ -655,13 +681,6 @@ -(void)keySignatureWasChosen:(NSString*)choice
_currentKeySignatureNotes = [_keySignatureNoteMap objectForKey:choice];
_currentKey = choice;

if(isupper([choice characterAtIndex:0])) {
_currentChords = [_majorKeyChordFormulas mutableCopy];
}
else{
_currentChords = [_minorKeyChordFormulas mutableCopy];
}

AppDelegate *mainDelegate = (AppDelegate*)[[UIApplication sharedApplication]delegate];
[mainDelegate.viewController.staffController changeScale:keySignaturetoDraw];
[mainDelegate.viewController.chordController setUpChords:[self setUpChordsToSendWithRootKey:choice]];
Expand Down
4 changes: 2 additions & 2 deletions Staff/StaffController.m
Expand Up @@ -340,13 +340,13 @@ -(void)setDotAt:(int)location
{
// hide old dot

[[dots objectForKey:[[NSString alloc] initWithFormat:@"%d", currentDotLocation]] setHidden:TRUE];
[[dots objectForKey:[[NSString alloc] initWithFormat:@"%d", currentDotLocation+4]] setHidden:TRUE];

// show new dot
NSLog(@"Dot LOC: %d",location);
NSLog(@"Dot STR: %@", [[NSString alloc] initWithFormat:@"%d", location]);
NSLog(@"Dot OBJ: %@",[dots objectForKey:[[NSString alloc] initWithFormat:@"%d", location]]);
[[dots objectForKey:[[NSString alloc] initWithFormat:@"%d", location]] setHidden:FALSE];
[[dots objectForKey:[[NSString alloc] initWithFormat:@"%d", location+4]] setHidden:FALSE];
}

- (void)findAccidentalNote:(int)pos
Expand Down

0 comments on commit 1b4d308

Please sign in to comment.