2006-09-11 02:49:56 +00:00
|
|
|
//
|
2007-04-27 06:41:34 +00:00
|
|
|
// File: VLSheetView.h - Lead sheet editing view
|
2006-09-11 02:49:56 +00:00
|
|
|
//
|
2007-04-27 06:41:34 +00:00
|
|
|
// Author(s):
|
|
|
|
//
|
|
|
|
// (MN) Matthias Neeracher
|
|
|
|
//
|
2018-02-19 00:59:23 +00:00
|
|
|
// Copyright © 2005-2018 Matthias Neeracher
|
2006-09-11 02:49:56 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#import <Cocoa/Cocoa.h>
|
2008-05-29 18:54:30 +00:00
|
|
|
#import <AudioToolbox/AudioToolbox.h>
|
2006-09-11 02:49:56 +00:00
|
|
|
|
|
|
|
#import "VLModel.h"
|
2007-12-23 12:45:17 +00:00
|
|
|
#import "VLLayout.h"
|
2011-09-06 01:15:51 +00:00
|
|
|
#import "VLKeyValueUndo.h"
|
2006-09-11 02:49:56 +00:00
|
|
|
|
|
|
|
@class VLDocument;
|
|
|
|
|
|
|
|
enum VLMusicElement {
|
2006-10-21 09:23:37 +00:00
|
|
|
kMusicNothing = 0,
|
|
|
|
kMusicGClef = 0,
|
2006-09-11 02:49:56 +00:00
|
|
|
kMusicFlat,
|
|
|
|
kMusicSharp,
|
|
|
|
kMusicNatural,
|
2011-08-28 04:12:44 +00:00
|
|
|
kMusic2Flat,
|
|
|
|
kMusic2Sharp,
|
2006-09-11 02:49:56 +00:00
|
|
|
kMusicWholeNote,
|
|
|
|
kMusicHalfNote,
|
|
|
|
kMusicNote,
|
|
|
|
kMusicWholeRest,
|
|
|
|
kMusicHalfRest,
|
|
|
|
kMusicQuarterRest,
|
|
|
|
kMusicEighthRest,
|
|
|
|
kMusicSixteenthRest,
|
|
|
|
kMusicThirtysecondthRest,
|
|
|
|
kMusicEighthFlag,
|
|
|
|
kMusicSixteenthFlag,
|
|
|
|
kMusicThirtysecondthFlag,
|
|
|
|
kMusicNoteCursor,
|
2006-10-21 09:23:37 +00:00
|
|
|
kMusicFlatCursor,
|
|
|
|
kMusicSharpCursor,
|
|
|
|
kMusicNaturalCursor,
|
2011-08-28 04:12:44 +00:00
|
|
|
kMusic2FlatCursor,
|
|
|
|
kMusic2SharpCursor,
|
2006-10-16 09:01:25 +00:00
|
|
|
kMusicRestCursor,
|
2006-10-21 09:23:37 +00:00
|
|
|
kMusicKillCursor,
|
2007-04-22 02:59:52 +00:00
|
|
|
kMusicExtendCursor,
|
2007-01-21 11:34:56 +00:00
|
|
|
kMusicCoda,
|
2006-09-11 02:49:56 +00:00
|
|
|
kMusicElements
|
|
|
|
};
|
|
|
|
|
2006-10-02 08:32:25 +00:00
|
|
|
enum VLRegion {
|
|
|
|
kRegionNowhere,
|
|
|
|
kRegionNote,
|
|
|
|
kRegionChord,
|
2006-12-28 05:03:28 +00:00
|
|
|
kRegionLyrics,
|
|
|
|
kRegionMeasure
|
2006-10-02 08:32:25 +00:00
|
|
|
};
|
|
|
|
|
2006-10-08 05:56:25 +00:00
|
|
|
enum VLRecalc {
|
|
|
|
kNoRecalc,
|
|
|
|
kRecalc,
|
|
|
|
kFirstRecalc
|
|
|
|
};
|
|
|
|
|
2011-08-28 10:42:39 +00:00
|
|
|
enum VLCursorVisual {
|
|
|
|
kCursorExtend = 1<<15,
|
|
|
|
kCursorFlagsMask= 0x8000,
|
|
|
|
kCursorNoPitch = -128
|
|
|
|
};
|
|
|
|
|
2011-09-11 02:39:54 +00:00
|
|
|
const uint32_t kNoMeasure = (uint32_t)-1;
|
|
|
|
|
2006-10-28 09:18:55 +00:00
|
|
|
@class VLEditable;
|
|
|
|
|
2006-09-11 02:49:56 +00:00
|
|
|
@interface VLSheetView : NSView {
|
2006-12-02 23:05:12 +00:00
|
|
|
NSImage ** fMusic;
|
2006-10-08 05:56:25 +00:00
|
|
|
VLRecalc fNeedsRecalc;
|
2006-10-16 09:01:25 +00:00
|
|
|
char fClickMode;
|
2007-05-04 05:21:16 +00:00
|
|
|
size_t fLastMeasures;
|
2006-10-02 06:07:44 +00:00
|
|
|
float fDisplayScale;
|
|
|
|
NSPoint fLastNoteCenter;
|
2006-10-02 08:32:25 +00:00
|
|
|
NSTrackingRectTag fCursorTracking;
|
2006-10-03 17:52:54 +00:00
|
|
|
VLRegion fCursorRegion;
|
2011-09-11 02:03:22 +00:00
|
|
|
VLLocation fCursorLocation;
|
2011-08-28 10:42:39 +00:00
|
|
|
int fCursorVertPos;
|
|
|
|
uint16_t fCursorVisual;
|
2006-12-02 09:02:44 +00:00
|
|
|
size_t fCursorStanza;
|
2011-09-11 02:39:54 +00:00
|
|
|
uint32_t fSelStart;
|
|
|
|
uint32_t fSelEnd;
|
2007-04-21 07:09:52 +00:00
|
|
|
int fNumTopLedgers;
|
|
|
|
int fNumBotLedgers;
|
|
|
|
int fNumStanzas;
|
2006-12-30 09:57:40 +00:00
|
|
|
size_t fVolta;
|
|
|
|
size_t fVoltaOK;
|
2007-12-23 12:45:17 +00:00
|
|
|
VLLayout * fLayout;
|
2011-09-11 02:03:22 +00:00
|
|
|
VLLocation fHighlightStart;
|
|
|
|
VLLocation fHighlightEnd;
|
2008-05-29 18:54:30 +00:00
|
|
|
size_t fHighlightStanza;
|
2011-09-06 01:15:51 +00:00
|
|
|
VLKeyValueUndo * fUndo;
|
2006-09-11 02:49:56 +00:00
|
|
|
|
2006-10-02 06:07:44 +00:00
|
|
|
IBOutlet id fFieldEditor;
|
2006-12-30 09:57:40 +00:00
|
|
|
IBOutlet id fRepeatSheet;
|
|
|
|
IBOutlet id fEndingSheet;
|
|
|
|
IBOutlet id fRepeatMsg;
|
|
|
|
IBOutlet id fEndingMsg;
|
2007-04-15 05:22:30 +00:00
|
|
|
IBOutlet id fGrooveMenu;
|
2008-01-16 13:04:01 +00:00
|
|
|
IBOutlet id fKeyMenu;
|
|
|
|
IBOutlet id fTimeMenu;
|
|
|
|
IBOutlet id fDivisionMenu;
|
2018-02-19 00:59:23 +00:00
|
|
|
IBOutlet NSMenu *fNoteActionMenu;
|
2006-09-11 02:49:56 +00:00
|
|
|
}
|
|
|
|
|
2011-09-06 01:15:51 +00:00
|
|
|
@property (nonatomic) int numTopLedgers;
|
|
|
|
@property (nonatomic) int numBotLedgers;
|
|
|
|
@property (nonatomic) int numStanzas;
|
|
|
|
|
2006-09-11 02:49:56 +00:00
|
|
|
- (IBAction) setKey:(id)sender;
|
|
|
|
- (IBAction) setTime:(id)sender;
|
|
|
|
- (IBAction) setDivisions:(id)sender;
|
2006-09-12 07:55:28 +00:00
|
|
|
- (IBAction) hideFieldEditor:(id)sender;
|
2007-04-21 07:09:52 +00:00
|
|
|
- (IBAction) endSheetWithButton:(id)sender;
|
2007-04-15 05:22:30 +00:00
|
|
|
- (IBAction) selectGroove:(id)sender;
|
2008-04-12 21:33:43 +00:00
|
|
|
- (IBAction) transposeOctave:(id)sender;
|
2011-09-06 01:15:51 +00:00
|
|
|
- (IBAction) zoomIn: (id) sender;
|
|
|
|
- (IBAction) zoomOut: (id) sender;
|
2011-09-04 19:48:57 +00:00
|
|
|
|
2006-09-11 02:49:56 +00:00
|
|
|
- (VLDocument *) document;
|
|
|
|
- (VLSong *) song;
|
|
|
|
- (NSImage *) musicElement:(VLMusicElement)elt;
|
|
|
|
|
2006-10-02 05:29:37 +00:00
|
|
|
- (float) systemY:(int)system;
|
2011-08-28 02:57:49 +00:00
|
|
|
- (int) gridInSection:(int)section withPitch:(int)pitch visual:(uint16_t)visual;
|
2011-08-28 10:42:39 +00:00
|
|
|
- (float) noteYInGrid:(int)vertPos;
|
2011-08-28 02:57:49 +00:00
|
|
|
- (float) noteYInSection:(int)section withPitch:(int)pitch visual:(uint16_t *)visual;
|
|
|
|
- (float) noteYInSection:(int)section withPitch:(int)pitch;
|
|
|
|
- (VLMusicElement)accidentalForVisual:(uint16_t)visual;
|
2011-08-28 10:42:39 +00:00
|
|
|
- (float) noteYInMeasure:(int)measure withGrid:(int)vertPos;
|
2011-09-11 02:03:22 +00:00
|
|
|
- (float) noteXAt:(VLLocation)at;
|
2011-09-06 01:15:51 +00:00
|
|
|
- (void) needsRecalculation;
|
2006-09-11 02:49:56 +00:00
|
|
|
|
2006-10-09 07:28:49 +00:00
|
|
|
- (void) scrollMeasureToVisible:(int)measure;
|
|
|
|
|
2006-10-02 08:32:25 +00:00
|
|
|
- (void) mouseMoved:(NSEvent *)event;
|
|
|
|
- (void) mouseDown:(NSEvent *)event;
|
|
|
|
- (void) mouseEntered:(NSEvent *)event;
|
|
|
|
- (void) mouseExited:(NSEvent *)event;
|
|
|
|
|
2006-10-03 17:52:54 +00:00
|
|
|
- (BOOL)control:(NSControl *)control textShouldEndEditing:(NSText *)fieldEditor;
|
|
|
|
|
2006-10-28 09:18:55 +00:00
|
|
|
- (VLEditable *) editTarget;
|
|
|
|
- (void) setEditTarget:(VLEditable *)editable;
|
2011-09-10 23:15:21 +00:00
|
|
|
- (void) updateEditTarget;
|
2006-12-30 09:57:40 +00:00
|
|
|
- (VLRegion) findRegionForEvent:(NSEvent *) event;
|
2006-10-28 09:18:55 +00:00
|
|
|
|
2007-04-15 05:22:30 +00:00
|
|
|
- (void) setGroove:(NSString *)groove;
|
2008-01-24 01:29:18 +00:00
|
|
|
- (void) playWithGroove:(NSString *)groove;
|
2007-04-15 05:22:30 +00:00
|
|
|
|
2008-05-29 18:54:30 +00:00
|
|
|
- (NSColor *)textBackgroundColorForSystem:(int)system;
|
2011-09-06 01:15:51 +00:00
|
|
|
- (void)removeObservers:(id)target;
|
2008-05-29 18:54:30 +00:00
|
|
|
|
2006-09-11 02:49:56 +00:00
|
|
|
@end
|
|
|
|
|
2012-05-19 20:37:58 +00:00
|
|
|
@interface NSImage (VLSheetViewDrawing)
|
|
|
|
|
|
|
|
- (void) drawAllAtPoint:(NSPoint)p operation:(NSCompositingOperation)op;
|
|
|
|
- (void) drawAllAtPoint:(NSPoint)p;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
2006-09-11 02:49:56 +00:00
|
|
|
// Local Variables:
|
|
|
|
// mode:ObjC
|
|
|
|
// End:
|