Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 137 lines (102 sloc) 3.596 kb
86a3973 @oatmealandcoffee Initial commit to GitHub
authored
1 //
2 // MyDocument.h
3 // OCDocumentFramework
4 //
5 // Created by Philip Regan on 2/19/10.
6 // Copyright __MyCompanyName__ 2010 . All rights reserved.
7 //
8
9 /*
10 * MyDocument is the Model/Controller for the application.
11 * All core data objects are held here, and handles interaction between the document
12 * and the operating system including the menu system
13 */
14
15 #import <Cocoa/Cocoa.h>
16 #import "OCConstants.h"
17
18 @class OCConstantsLib;
19 @class OCWindowController;
20
21 @class OCMusicObj;
22 @class OCNoteObj;
23 @class OCGroupObj;
24 @class OCChordObj;
25 @class OCSequenceObj;
26 @class OCResizeTabObj;
27 @class OCMusicPieceObj;
28
29 @interface MyDocument : NSDocument
30 {
31
32 NSColor *defaultColor;
33 NSRect defaultEditorArea;
34 NSRect editorArea;
35
36 int zoomXIndex;
37 int zoomYIndex;
38
39 NSMutableArray *notes;
40 NSMutableArray *groups;
41 NSMutableArray *chords;
42 NSMutableArray *sequences;
43 NSMutableArray *resizeTabs;
44
45 OCMusicPieceObj *musicPiece;
46
47 int timeSignatureBeatsPerMeasure;
48 int timeSignatureBasicBeatIndex;
49
50 // this is the level of granularity an edit is to fall into
51 int snapToIndex;
52 // this is the length of any new notes
53 int newNoteindex;
54
55 }
56
57 @property (nonatomic, retain) NSColor *defaultColor;
58 @property (nonatomic) NSRect editorArea;
59
60 @property (nonatomic) int zoomXIndex;
61 @property (nonatomic) int zoomYIndex;
62
63 @property (nonatomic, retain) NSMutableArray *notes;
64 @property (nonatomic, retain) NSMutableArray *groups;
65 @property (nonatomic, retain) NSMutableArray *chords;
66 @property (nonatomic, retain) NSMutableArray *sequences;
67 @property (nonatomic, retain) NSMutableArray *resizeTabs;
68
69 @property (nonatomic, retain) OCMusicPieceObj *musicPiece;
70
71 @property (nonatomic) int snapToIndex;
72 @property (nonatomic) int newNoteindex;
73
74 #pragma mark -
75 #pragma mark Calculated Properties (Property Accessors)
76 #pragma mark -
77
78 - (void) setTimeSignatureBeatsPerMeasure:(int)beatsPerMeasure;
79 - (int) timeSignatureBeatsPerMeasure;
80
81 - (void) setTimeSignatureBasicBeatIndex:(int)basicBeatIndex;
82 - (int) timeSignatureBasicBeatIndex;
83
84 - (void) calculateEditorArea;
85
86 #pragma mark -
87 #pragma mark NoteObj Management
88 #pragma mark -
89
90 /*
91 * CRUD-like paradigm for managing notes at this level*
92 *
93 * Any higher-level interaction and updates happens in the WindowController.
94 */
95
96 - (OCNoteObj *) createNoteAtStartBeat:(float)theStartBeat pitch:(float)thePitch length:(float)theLength;
97 - (OCMusicObj *) retrieveNoteAtBeat:(float)beat pitch:(float)pitch;
98 - (void) deleteFromDocumentNote:(OCNoteObj *)note;
99 - (BOOL) resizeTabHitForNote:(OCNoteObj *)note atBeat:(float)beat pitch:(float)pitch;
100
101 #pragma mark -
102 #pragma mark GroupObj Management
103 #pragma mark -
104
105 - (OCGroupObj *)createGroup;
106 - (void) deleteFromDocumentGroup:(OCGroupObj *)group;
107 - (void) deleteObjectsFromGroup:(OCGroupObj *)group;
108
109 #pragma mark -
110 #pragma mark ChordObj Management
111 #pragma mark -
112
113 - (OCChordObj *)createChord;
114 - (void) deleteFromDocumentChord:(OCChordObj *)chord;
115 - (void) deleteObjectsFromChord:(OCChordObj *)chord;
116
117 #pragma mark -
118 #pragma mark SequenceObj Management
119 #pragma mark -
120
121 - (OCSequenceObj *)createSequence;
122 - (void) deleteFromDocumentSequence:(OCSequenceObj *)sequence;
123 - (void) deleteObjectsFromSequence:(OCSequenceObj *)sequence;
124
125 #pragma mark -
126 #pragma mark ResizeTabObj Management
127 #pragma mark -
128
129 - (OCResizeTabObj *)createResizeTab;
130 - (void) deleteFromDocumentResizeTabObj:(OCResizeTabObj *)resizeTab;
131
132 - (BOOL) resizeTabHitForSequence:(OCSequenceObj *)sequence atBeat:(float)beat pitch:(float)pitch;
133
134 - (BOOL) isPoint:(NSPoint)point inRect:(NSRect)rect;
135 - (void) logPoint:(NSPoint)point andRect:(NSRect)rect;
136 @end
Something went wrong with that request. Please try again.