mirror of
https://github.com/microtherion/VocalEasel.git
synced 2024-12-22 03:04:00 +00:00
Centralize drawing method (tried to switch to drawAtPoint, but that does the wrong thing)
This commit is contained in:
parent
0487d549e2
commit
86456c8422
|
@ -5,7 +5,7 @@
|
|||
//
|
||||
// (MN) Matthias Neeracher
|
||||
//
|
||||
// Copyright © 2005-2011 Matthias Neeracher
|
||||
// Copyright © 2005-2012 Matthias Neeracher
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
@ -161,6 +161,13 @@ const uint32_t kNoMeasure = (uint32_t)-1;
|
|||
|
||||
@end
|
||||
|
||||
@interface NSImage (VLSheetViewDrawing)
|
||||
|
||||
- (void) drawAllAtPoint:(NSPoint)p operation:(NSCompositingOperation)op;
|
||||
- (void) drawAllAtPoint:(NSPoint)p;
|
||||
|
||||
@end
|
||||
|
||||
// Local Variables:
|
||||
// mode:ObjC
|
||||
// End:
|
||||
|
|
|
@ -457,9 +457,7 @@ const char * sBreak[3] = {"", "\xE2\xA4\xBE", "\xE2\x8E\x98"};
|
|||
[bz setLineWidth:2.0];
|
||||
}
|
||||
if (song->fGoToCoda == m || song->fCoda == m)
|
||||
[[self musicElement:kMusicCoda]
|
||||
compositeToPoint: NSMakePoint(x+kCodaX, yy+kCodaY)
|
||||
operation: NSCompositeSourceOver];
|
||||
[[self musicElement:kMusicCoda] drawAllAtPoint:NSMakePoint(x+kCodaX, yy+kCodaY)];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -485,9 +483,7 @@ const char * sBreak[3] = {"", "\xE2\xA4\xBE", "\xE2\x8E\x98"};
|
|||
//
|
||||
// Draw clef
|
||||
//
|
||||
[[self musicElement:kMusicGClef]
|
||||
compositeToPoint: NSMakePoint(kClefX, kSystemY+kClefY)
|
||||
operation: NSCompositeSourceOver];
|
||||
[[self musicElement:kMusicGClef] drawAllAtPoint:NSMakePoint(kClefX, kSystemY+kClefY)];
|
||||
//
|
||||
// Draw measure #
|
||||
//
|
||||
|
@ -500,19 +496,13 @@ const char * sBreak[3] = {"", "\xE2\xA4\xBE", "\xE2\x8E\x98"};
|
|||
if (kProp.fKey > 0) {
|
||||
float x = kClefX+kClefW;
|
||||
for (int i=0; i<kProp.fKey; ++i) {
|
||||
[[self musicElement:kMusicSharp]
|
||||
compositeToPoint:
|
||||
NSMakePoint(x, kSystemY+sSharpPos[i]+kSharpY)
|
||||
operation: NSCompositeSourceOver];
|
||||
[[self musicElement:kMusicSharp] drawAllAtPoint:NSMakePoint(x, kSystemY+sSharpPos[i]+kSharpY)];
|
||||
x += kAccW;
|
||||
}
|
||||
} else if (kProp.fKey < 0) {
|
||||
float x = kClefX+kClefW;
|
||||
for (int i=0; -i>kProp.fKey; ++i) {
|
||||
[[self musicElement: kMusicFlat]
|
||||
compositeToPoint:
|
||||
NSMakePoint(x, kSystemY+sFlatPos[i]+kFlatY)
|
||||
operation: NSCompositeSourceOver];
|
||||
[[self musicElement: kMusicFlat] drawAllAtPoint:NSMakePoint(x, kSystemY+sFlatPos[i]+kFlatY)];
|
||||
x += kAccW;
|
||||
}
|
||||
}
|
||||
|
@ -1051,3 +1041,17 @@ const float kSemiFloor = -1.0f*kLineH;
|
|||
|
||||
@end
|
||||
|
||||
@implementation NSImage (VLSheetViewDrawing)
|
||||
|
||||
- (void) drawAllAtPoint:(NSPoint)p operation:(NSCompositingOperation)op
|
||||
{
|
||||
[self compositeToPoint:p operation:op];
|
||||
}
|
||||
|
||||
- (void) drawAllAtPoint:(NSPoint)p
|
||||
{
|
||||
[self compositeToPoint:p operation:NSCompositeSourceOver];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -127,9 +127,7 @@
|
|||
}
|
||||
|
||||
NSPoint xy = NSMakePoint(cursorX-kNoteX, cursorY);
|
||||
[[self musicElement:cursorElt]
|
||||
compositeToPoint:xy
|
||||
operation: NSCompositeSourceOver];
|
||||
[[self musicElement:cursorElt] drawAllAtPoint:xy];
|
||||
|
||||
if (accidental) {
|
||||
xy.y += kNoteY;
|
||||
|
@ -156,9 +154,7 @@
|
|||
xy.y += kNaturalY;
|
||||
break;
|
||||
}
|
||||
[[self musicElement:accidental]
|
||||
compositeToPoint:xy
|
||||
operation: NSCompositeSourceOver];
|
||||
[[self musicElement:accidental] drawAllAtPoint:xy];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -198,8 +194,7 @@
|
|||
s.x -= 2.0f;
|
||||
break;
|
||||
}
|
||||
[head compositeToPoint:p
|
||||
operation: NSCompositePlusDarker];
|
||||
[head drawAllAtPoint:p operation:NSCompositePlusDarker];
|
||||
//
|
||||
// Draw accidental
|
||||
//
|
||||
|
@ -230,8 +225,7 @@
|
|||
default:
|
||||
break;
|
||||
}
|
||||
[[self musicElement:accidental]
|
||||
compositeToPoint:at operation: NSCompositeSourceOver];
|
||||
[[self musicElement:accidental] drawAllAtPoint:at];
|
||||
}
|
||||
//
|
||||
// Draw stem
|
||||
|
@ -261,8 +255,7 @@
|
|||
[bz lineToPoint:s1];
|
||||
[bz stroke];
|
||||
if (flag)
|
||||
[flag compositeToPoint:s
|
||||
operation: NSCompositePlusDarker];
|
||||
[flag drawAllAtPoint:s operation:NSCompositePlusDarker];
|
||||
}
|
||||
//
|
||||
// Draw tie
|
||||
|
@ -319,8 +312,7 @@
|
|||
p.x -= kNoteX;
|
||||
break;
|
||||
}
|
||||
[head compositeToPoint:p
|
||||
operation: NSCompositeSourceOver];
|
||||
[head drawAllAtPoint:p];
|
||||
}
|
||||
|
||||
- (void) drawTuplet:(uint16_t)tuplet bracketFrom:(int)startX to:(int)endX atY:(int)y
|
||||
|
|
Loading…
Reference in New Issue
Block a user