1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615
|
/* drawnotes.c
*
* Functions for drawing notes and rests
*
* for Denemo, a gtk+ frontend to GNU Lilypond
* (c) 1999, 2000, 2001 Matthew Hiller
*/
#include "utils.h" /* Includes <gdk.h> */
#include "datastructures.h"
#include "drawingprims.h"
#include "notewidths.h"
#include "gcs.h"
/* Include the bitmaps; they'll actually be made into GdkBitmaps with the
* GDK create_from_xbm_d functions. Doing things this way circumvents the need
* to install the pixmaps into a /usr/share directory of some kind before
* the program can be run from anywhere on the system. */
#include "./pixmaps/feta26-noteheads-0.xbm"
#include "./pixmaps/feta26-noteheads-1.xbm"
#include "./pixmaps/feta26-noteheads-2.xbm"
#include "./pixmaps/feta26-noteheads-1diamond.xbm"
#include "./pixmaps/feta26-noteheads-2cross.xbm"
#include "./pixmaps/feta26-noteheads-2harmonic.xbm"
#include "./pixmaps/feta26-flags-u3.xbm"
#include "./pixmaps/feta26-flags-u4.xbm"
#include "./pixmaps/feta26-flags-u5.xbm"
#include "./pixmaps/feta26-flags-u6.xbm"
#include "./pixmaps/feta26-flags-d3.xbm"
#include "./pixmaps/feta26-flags-d4.xbm"
#include "./pixmaps/feta26-flags-d5.xbm"
#include "./pixmaps/feta26-flags-d6.xbm"
#include "./pixmaps/feta26-flags-ugrace.xbm"
#include "./pixmaps/feta26-flags-dgrace.xbm"
#include "./pixmaps/feta26-rests-0.xbm"
#include "./pixmaps/feta26-rests-1.xbm"
#include "./pixmaps/feta26-rests-2.xbm"
#include "./pixmaps/feta26-rests-3.xbm"
#include "./pixmaps/feta26-rests-4.xbm"
#include "./pixmaps/feta26-rests-5.xbm"
#include "./pixmaps/feta26-rests-6.xbm"
#include "./pixmaps/feta26-scripts-ufermata.xbm"
#include "./pixmaps/feta26-scripts-dfermata.xbm"
#include "./pixmaps/feta26-scripts-staccato.xbm"
#include "./pixmaps/feta26-scripts-umarcato.xbm"
#include "./pixmaps/feta26-scripts-dmarcato.xbm"
#include "./pixmaps/feta26-scripts-accent.xbm"
#include "./pixmaps/feta26-scripts-tenuto.xbm"
#include "./pixmaps/feta26-scripts-ustaccatissimo.xbm"
#include "./pixmaps/feta26-scripts-dstaccatissimo.xbm"
#include "./pixmaps/feta26-scripts-trill.xbm"
#include "./pixmaps/feta26-scripts-turn.xbm"
#include "./pixmaps/feta26-scripts-mordent.xbm"
#include "./pixmaps/feta26-scripts-downbow.xbm"
#include "./pixmaps/feta26-scripts-upbow.xbm"
#include "./pixmaps/feta26-scripts-upedalheel.xbm"
#include "./pixmaps/feta26-scripts-dpedalheel.xbm"
#include "./pixmaps/feta26-scripts-upedaltoe.xbm"
#include "./pixmaps/feta26-scripts-dpedaltoe.xbm"
gint restwidths[SMALLESTDURATION + 1] =
{ WHOLEREST_WIDTH, HALFREST_WIDTH, QUARTERREST_WIDTH, EIGHTHREST_WIDTH,
SIXTEENTHREST_WIDTH, THIRTYSECONDREST_WIDTH, SIXTYFOURTHREST_WIDTH
};
gint headwidths[3] = { WHOLEHEAD_WIDTH, HALFHEAD_WIDTH, NOTEHEAD_WIDTH
};
/* This draws dots after rests or notes */
static void
draw_dots (GdkPixmap * pixmap, GdkGC * gc,
gint xstart, gint ystart, gint numdots)
{
gint thinrecty = ystart - 2, shortrecty = ystart - 1;
xstart += 2;
for (; numdots; numdots--, xstart += 6)
{
/* Thin rectangle */
gdk_draw_rectangle (pixmap, gc, TRUE, xstart + 1, thinrecty, 2, 4);
/* Short rectangle */
gdk_draw_rectangle (pixmap, gc, TRUE, xstart, shortrecty, 4, 2);
}
}
/* This function actually draws a rest onto the backing pixmap */
void
draw_rest (GdkPixmap * pixmap, GdkGC * gc,
gint duration, gint numdots, gint xx, gint y)
{
static GdkBitmap *rests[SMALLESTDURATION + 1] = { NULL, NULL, NULL, NULL,
NULL, NULL, NULL
};
static gint restheights[SMALLESTDURATION + 1] =
{ WHOLEREST_HEIGHT, HALFREST_HEIGHT, QUARTERREST_HEIGHT,
EIGHTHREST_HEIGHT,
SIXTEENTHREST_HEIGHT, THIRTYSECONDREST_HEIGHT, SIXTYFOURTHREST_HEIGHT
};
static gint restoffsets[SMALLESTDURATION + 1] =
{ WHOLEREST_OFFSETFROMTOP, HALFREST_OFFSETFROMTOP,
QUARTERREST_OFFSETFROMTOP, EIGHTHREST_OFFSETFROMTOP,
SIXTEENTHREST_OFFSETFROMTOP, THIRTYSECONDREST_OFFSETFROMTOP,
SIXTYFOURTHREST_OFFSETFROMTOP
};
if (!rests[0])
{
rests[0] = bitmaphelper (NULL, feta26_rests_0);
rests[1] = bitmaphelper (NULL, feta26_rests_1);
rests[2] = bitmaphelper (NULL, feta26_rests_2);
rests[3] = bitmaphelper (NULL, feta26_rests_3);
rests[4] = bitmaphelper (NULL, feta26_rests_4);
rests[5] = bitmaphelper (NULL, feta26_rests_5);
rests[6] = bitmaphelper (NULL, feta26_rests_6);
}
drawbitmapinverse (pixmap, gc, rests[duration],
xx, y + restoffsets[duration],
restwidths[duration], restheights[duration]);
/* Now draw any trailing dots and we're done */
draw_dots (pixmap, gc, xx + restwidths[duration],
y + restoffsets[duration] + restheights[duration] / 2, numdots);
}
/* This function actually draws the note onto the backing pixmap */
void
draw_notehead (GdkPixmap * pixmap, GdkGC * gc,
note * thenote, gint duration, gint numdots,
gint xx, gint y, gint * accs, gint is_stemup)
{
/* Adam's changed this code; it used to be that these arrays only had
three elements. The change has defeated what had been semi-elegance;
grrr. */
static GdkBitmap *heads[6] = { NULL, NULL, NULL, NULL, NULL, NULL };
static gint headwidths[6] = { WHOLEHEAD_WIDTH, HALFHEAD_WIDTH,
NOTEHEAD_WIDTH, DIAMOND_WIDTH,
CROSS_WIDTH, HARMONIC_WIDTH,
};
static gint headheights[6] = { WHOLEHEAD_HEIGHT, HALFHEAD_HEIGHT,
NOTEHEAD_HEIGHT, DIAMOND_HEIGHT,
CROSS_HEIGHT, HARMONIC_HEIGHT
};
static gint headsemiheights[6] =
{ WHOLEHEAD_SEMI_HEIGHT, HALFHEAD_SEMI_HEIGHT, NOTEHEAD_SEMI_HEIGHT,
DIAMOND_SEMI_HEIGHT, CROSS_SEMI_HEIGHT, HARMONIC_SEMI_HEIGHT
};
gint height = thenote->y;
gint noteheadtype = MIN (duration, 2);
gint enshift = thenote->enshift;
gint pitch = offsettonumber (thenote->mid_c_offset);
if (thenote->noteheadtype == NORMAL)
{
noteheadtype = MIN (duration, 2); /* Index of relevant notehead */
}
else if (thenote->noteheadtype == CROSS)
{
noteheadtype = 4; /* Index of relevant notehead */
}
else if (thenote->noteheadtype == HARMONIC)
{
noteheadtype = 5;
}
else if (thenote->noteheadtype == DIAMOND)
{
noteheadtype = 3;
}
if (!heads[0])
{
heads[0] = bitmaphelper (NULL, feta26_noteheads_0);
heads[1] = bitmaphelper (NULL, feta26_noteheads_1);
heads[2] = bitmaphelper (NULL, feta26_noteheads_2);
heads[3] = bitmaphelper (NULL, feta26_noteheads_1diamond);
heads[4] = bitmaphelper (NULL, feta26_noteheads_2cross);
heads[5] = bitmaphelper (NULL, feta26_noteheads_2harmonic);
}
/* Draw the accidental, if necessary. Note that this has to be
done before xx is modified, as the the value in
position_of_accidental already accounts for any reverse-alignment
in the chord. */
if (thenote->showaccidental)
{
draw_accidental (pixmap, gc, xx - thenote->position_of_accidental,
y + height, enshift);
accs[pitch] = enshift;
}
if (thenote->reversealign)
{
if (is_stemup)
xx += headwidths[noteheadtype];
else
xx -= headwidths[noteheadtype];
}
drawbitmapinverse (pixmap, gc, heads[noteheadtype],
xx, y + height - headsemiheights[noteheadtype],
headwidths[noteheadtype], headheights[noteheadtype]);
/* Now draw any trailing dots and we're done */
if ((height % LINE_SPACE) == 0)
draw_dots (pixmap, gc, xx + headwidths[noteheadtype],
y + height - HALF_LINE_SPACE, numdots);
else
draw_dots (pixmap, gc, xx + headwidths[noteheadtype],
y + height, numdots);
}
void
draw_ledgers (GdkPixmap * pixmap, GdkGC * gc,
gint greaterheight, gint lesserheight,
gint xx, gint y, gint width)
{
int ledgerheight;
#define EXTRA_ON_LEDGER 3
/* Draw the top ledger lines */
for (ledgerheight = -LINE_SPACE; ledgerheight >= greaterheight;
ledgerheight -= LINE_SPACE)
gdk_draw_line (pixmap, gc, xx - EXTRA_ON_LEDGER, ledgerheight + y,
xx + width + EXTRA_ON_LEDGER, ledgerheight + y);
/* Almost identically, draw the bottom ones */
for (ledgerheight = STAFF_HEIGHT + LINE_SPACE;
ledgerheight <= lesserheight; ledgerheight += LINE_SPACE)
gdk_draw_line (pixmap, gc, xx - 2, ledgerheight + y, xx + width + 2,
ledgerheight + y);
}
void
draw_chord (GdkPixmap * pixmap, GdkGC * gc, objnode * curobj, gint xx, gint y,
gint mwidth, gint * accs)
{
static GdkBitmap *upstems[SMALLESTDURATION + 1] =
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL };
static GdkBitmap *downstems[SMALLESTDURATION + 1];
static GdkBitmap *graceflags[2];
static gint stemheights[SMALLESTDURATION + 1] =
{ 0, 0, 0, EIGHTHSTEM_HEIGHT, SIXTEENTHSTEM_HEIGHT,
THIRTYSECONDSTEM_HEIGHT,
SIXTYFOURTHSTEM_HEIGHT
};
mudelaobject *prevmuditem = curobj->prev ? curobj->prev->data : NULL;
mudelaobject *mudelaitem = curobj->data;
mudelaobject *nextmuditem = curobj->next ? curobj->next->data : NULL;
chord thechord = mudelaitem->u.chordval;
gint duration = thechord.baseduration;
gint noteheadtype = MIN (duration, 2);
/* Change those two so that they're cached instead */
gint i;
gint beampainty, arcwidth;
gint prevbaseduration, nextbaseduration;
GList *curnode;
if (!upstems[3])
{
upstems[3] = bitmaphelper (NULL, feta26_flags_u3);
upstems[4] = bitmaphelper (NULL, feta26_flags_u4);
upstems[5] = bitmaphelper (NULL, feta26_flags_u5);
upstems[6] = bitmaphelper (NULL, feta26_flags_u6);
downstems[3] = bitmaphelper (NULL, feta26_flags_d3);
downstems[4] = bitmaphelper (NULL, feta26_flags_d4);
downstems[5] = bitmaphelper (NULL, feta26_flags_d5);
downstems[6] = bitmaphelper (NULL, feta26_flags_d6);
graceflags[0] = bitmaphelper (NULL, feta26_flags_ugrace);
graceflags[1] = bitmaphelper (NULL, feta26_flags_dgrace);
}
if (thechord.is_highlighted)
gc = gcs_bluegc ();
if (!thechord.tones) /* We have a rest here */
draw_rest (pixmap, gc, duration, thechord.numdots, xx, y);
else
{
/* Draw the noteheads and accidentals */
for (curnode = thechord.tones; curnode; curnode = curnode->next)
draw_notehead (pixmap, gc, curnode->data, duration, thechord.numdots,
xx, y, accs, thechord.is_stemup);
/* Now the stem and beams. This is complicated. */
if (thechord.is_stemup)
{
if (mudelaitem->isstart_beamgroup && mudelaitem->isend_beamgroup)
{
if (duration >= 3)
/* Up-pointing stem pixmap */
drawbitmapinverse (pixmap, gc, upstems[duration],
xx + NOTEHEAD_WIDTH - 1,
thechord.highesty + y
- (duration == 6 ? EXTRA_STEM_HEIGHT
: STEM_HEIGHT),
STEM_WIDTH, stemheights[duration]);
}
else if (!mudelaitem->isend_beamgroup)
{
/* Draw the thin beam across the gap */
gdk_draw_rectangle (pixmap, gc, TRUE,
xx + headwidths[noteheadtype] - 1,
y + thechord.stemy,
nextmuditem->x - mudelaitem->x,
THINBEAM_HEIGHT);
if (mudelaitem->isstart_beamgroup)
prevbaseduration = 0;
else
prevbaseduration = prevmuditem->u.chordval.baseduration;
nextbaseduration = nextmuditem->u.chordval.baseduration;
for (i = 4, beampainty = thechord.stemy + FIRSTBEAMSPACE;
i <= thechord.baseduration;
i++, beampainty += SUBSQBEAMSPACE)
{
if (nextbaseduration >= i)
/* Draw a thick beam across the gap */
gdk_draw_rectangle (pixmap, gc, TRUE,
xx + headwidths[noteheadtype] - 1,
y + beampainty,
nextmuditem->x - mudelaitem->x,
THICKBEAM_HEIGHT);
else if (prevbaseduration < i)
/* Draw a stub to the right of the staff */
gdk_draw_rectangle (pixmap, gc, TRUE,
xx + headwidths[noteheadtype] - 1,
y + beampainty, STUB_WIDTH,
THICKBEAM_HEIGHT);
} /* end for loop */
} /* end drawing for non-end-beamgroup notes */
else
{ /* We're at the end of a beamgroup */
for (i = MAX (prevmuditem->u.chordval.baseduration + 1, 4),
beampainty = thechord.stemy + FIRSTBEAMSPACE +
(SUBSQBEAMSPACE * (i - 4));
i <= thechord.baseduration;
i++, beampainty += SUBSQBEAMSPACE)
{
/* Draw a stub to the left of the staff */
gdk_draw_rectangle (pixmap, gc, TRUE,
xx + headwidths[noteheadtype] - 1 -
STUB_WIDTH, y + beampainty, STUB_WIDTH,
THICKBEAM_HEIGHT);
}
}
if (duration > 0)
/* Vertical line */
gdk_draw_line (pixmap, gc, xx + headwidths[noteheadtype] - 1,
thechord.stemy + y,
xx + headwidths[noteheadtype] - 1,
thechord.lowesty + y);
/* Now draw the tie, if appropriate */
if (thechord.is_tied)
{
if (nextmuditem)
arcwidth = nextmuditem->x - mudelaitem->x;
else
arcwidth = mwidth - mudelaitem->x + SPACE_FOR_BARLINE;
gdk_draw_arc (pixmap, gc, FALSE,
xx + headwidths[noteheadtype] / 2,
y + thechord.lowesty + 3,
arcwidth, 8, 64 * 180, 64 * 180);
}
} /* End stemup stuff */
else
{ /* chord is stemdown */
if (mudelaitem->isstart_beamgroup && mudelaitem->isend_beamgroup)
{
if (duration >= 3)
/* Down-pointing stem */
drawbitmapinverse (pixmap, gc, downstems[duration],
xx,
thechord.lowesty + y
+ (duration == 6 ? EXTRA_STEM_HEIGHT
: STEM_HEIGHT)
- stemheights[duration],
STEM_WIDTH, stemheights[duration]);
}
else if (!mudelaitem->isend_beamgroup)
{
/* Draw the thin beam across the gap */
gdk_draw_rectangle (pixmap, gc, TRUE, xx,
y + thechord.stemy - THINBEAM_HEIGHT + 1,
nextmuditem->x - mudelaitem->x,
THINBEAM_HEIGHT);
if (mudelaitem->isstart_beamgroup)
prevbaseduration = 0;
else
prevbaseduration = prevmuditem->u.chordval.baseduration;
nextbaseduration = nextmuditem->u.chordval.baseduration;
for (i = 4, beampainty = thechord.stemy - FIRSTBEAMSPACE -
THICKBEAM_HEIGHT + 1;
i <= thechord.baseduration;
i++, beampainty -= SUBSQBEAMSPACE)
{
if (nextbaseduration >= i)
/* Draw a thick beam across the gap */
gdk_draw_rectangle (pixmap, gc, TRUE, xx,
y + beampainty,
nextmuditem->x - mudelaitem->x,
THICKBEAM_HEIGHT);
else if (prevbaseduration < i)
/* Draw a stub to the right of the staff */
gdk_draw_rectangle (pixmap, gc, TRUE, xx, y + beampainty,
STUB_WIDTH, THICKBEAM_HEIGHT);
} /* End for loop */
} /* End drawing for non-end-beamgroup notes */
else
{ /* We're at the end of a beamgroup */
for (i = MAX (prevmuditem->u.chordval.baseduration + 1, 4),
beampainty = thechord.stemy - FIRSTBEAMSPACE -
THICKBEAM_HEIGHT + 1 -
(SUBSQBEAMSPACE * (i - 4));
i <= thechord.baseduration;
i++, beampainty += SUBSQBEAMSPACE)
{
/* Draw a stub to the left of the staff */
gdk_draw_rectangle (pixmap, gc, TRUE, xx - STUB_WIDTH,
y + beampainty, STUB_WIDTH,
THICKBEAM_HEIGHT);
}
}
if (duration > 0)
/* Vertical line */
gdk_draw_line (pixmap, gc, xx, thechord.highesty + y, xx,
thechord.stemy + y);
/* Now draw the tie, if appropriate */
if (thechord.is_tied)
{
if (nextmuditem)
arcwidth = nextmuditem->x - mudelaitem->x;
else
arcwidth = mwidth - mudelaitem->x + SPACE_FOR_BARLINE;
gdk_draw_arc (pixmap, gc, FALSE,
xx + headwidths[noteheadtype] / 2,
y + thechord.highesty - 13,
arcwidth, 8, 0, 64 * 180);
}
}
/* End stemdown stuff */
draw_articulations (pixmap, gc, thechord, xx, y);
draw_ledgers (pixmap, gc, thechord.highesty, thechord.lowesty, xx, y,
headwidths[noteheadtype]);
} /* end else */
}
void
draw_articulations (GdkPixmap * pixmap, GdkGC * gc,
chord thechord, gint xx, gint y)
{
static GdkBitmap *options[10];
static GdkBitmap *noteoptions[3];
static GdkBitmap *strings[2];
static GdkBitmap *organ[4];
/* extra y position for staccato, accent, tenuto, fermata when stacked */
gint extra = 0;
if (!options[10])
{
noteoptions[0] = bitmaphelper (NULL, feta26_scripts_trill);
noteoptions[1] = bitmaphelper (NULL, feta26_scripts_turn);
noteoptions[2] = bitmaphelper (NULL, feta26_scripts_mordent);
options[0] = bitmaphelper (NULL, feta26_scripts_ufermata);
options[1] = bitmaphelper (NULL, feta26_scripts_dfermata);
options[2] = bitmaphelper (NULL, feta26_scripts_accent);
options[3] = bitmaphelper (NULL, feta26_scripts_accent);
options[4] = bitmaphelper (NULL, feta26_scripts_staccato);
options[5] = bitmaphelper (NULL, feta26_scripts_tenuto);
options[6] = bitmaphelper (NULL, feta26_scripts_ustaccatissimo);
options[7] = bitmaphelper (NULL, feta26_scripts_dstaccatissimo);
options[8] = bitmaphelper (NULL, feta26_scripts_umarcato);
options[9] = bitmaphelper (NULL, feta26_scripts_dmarcato);
strings[0] = bitmaphelper (NULL, feta26_scripts_downbow);
strings[1] = bitmaphelper (NULL, feta26_scripts_upbow);
organ[0] = bitmaphelper (NULL, feta26_scripts_upedalheel);
organ[1] = bitmaphelper (NULL, feta26_scripts_dpedalheel);
organ[2] = bitmaphelper (NULL, feta26_scripts_upedaltoe);
organ[3] = bitmaphelper (NULL, feta26_scripts_dpedaltoe);
}
/* Fermata, Accents, Staccato, tenuto stuff. */
/* The following code ought to see some serious reorganization.
(It's another chunk of code that uses arrays in a situation
where arrays aren't elegant -- rather, they're just confusing.
And how 'bout some nesting of these if statements?) */
/* Calculate the offset required when stacking symbols */
extra = calc_offset (thechord, thechord.is_stemup);
/* These rely on notehead position and stem-ends
* Usually are above the stave except tenuto and
* staccato
*/
if (thechord.has_staccatissimo_p)
drawbitmapinverse (pixmap, gc, options[6],
xx + NOTEHEAD_WIDTH / 2,
y + extra, STACCATISSIMO_WIDTH, STACCATISSIMO_HEIGHT);
else if (thechord.has_stacatto_p)
drawbitmapinverse (pixmap, gc, options[4],
xx + NOTEHEAD_WIDTH / 2,
y + extra, STACATTO, STACATTO);
if (thechord.is_accented_p)
drawbitmapinverse (pixmap, gc, options[2],
xx + 2, y + extra, ACCENT_WIDTH, ACCENT_HEIGHT);
else if (thechord.has_marcato_p)
drawbitmapinverse (pixmap, gc, options[8],
xx + 2, y + extra, MARCATO_WIDTH, MARCATO_HEIGHT);
if (thechord.has_tenuto_p)
drawbitmapinverse (pixmap, gc,
options[5], xx,
y + extra, TENUTO_WIDTH, TENUTO_HEIGHT);
/*
* Always should appear above the note(s) they
* effect.
*/
if (thechord.has_fermata_p)
drawbitmapinverse (pixmap, gc,
options[0], xx - FERMATA_WIDTH / 4,
y + extra, FERMATA_WIDTH, FERMATA_HEIGHT);
if (thechord.has_trill_p)
drawbitmapinverse (pixmap, gc,
noteoptions[0], xx - TRILL_WIDTH / 4,
y + extra, TRILL_WIDTH, TRILL_HEIGHT);
else if (thechord.has_turn_p)
drawbitmapinverse (pixmap, gc,
noteoptions[1], xx - TURN_WIDTH / 4,
y + extra, TURN_WIDTH, TURN_HEIGHT);
else if (thechord.has_mordent_p)
drawbitmapinverse (pixmap, gc,
noteoptions[2], xx - MORDENT_WIDTH / 4,
y + extra, MORDENT_WIDTH, MORDENT_HEIGHT);
if (thechord.has_dbow_p)
drawbitmapinverse (pixmap, gc,
strings[0], xx, y + extra, DBOW_WIDTH, DBOW_HEIGHT);
else if (thechord.has_ubow_p)
drawbitmapinverse (pixmap, gc,
strings[1], xx, y + extra, UBOW_WIDTH, UBOW_HEIGHT);
if (thechord.has_rheel_p)
{
drawbitmapinverse (pixmap, gc,
organ[1], xx, y + extra, HEEL_WIDTH, HEEL_HEIGHT);
}
else if (thechord.has_lheel_p)
{
drawbitmapinverse (pixmap, gc,
organ[0], xx, y + extra, HEEL_WIDTH, HEEL_HEIGHT);
}
if (thechord.has_rtoe_p)
{
drawbitmapinverse (pixmap, gc,
organ[3], xx, y + extra, TOE_WIDTH, TOE_HEIGHT);
}
else if (thechord.has_ltoe_p)
{
drawbitmapinverse (pixmap, gc,
organ[2], xx, y + extra, TOE_WIDTH, TOE_HEIGHT);
}
}
gint
calc_offset (chord thechord, gint stemdir)
{
gint offset = 0;
if (thechord.has_fermata_p || thechord.has_turn_p ||
thechord.has_trill_p || thechord.has_mordent_p)
offset = -LINE_SPACE - 7;
else if ((thechord.has_stacatto_p || thechord.has_tenuto_p) && stemdir)
offset = thechord.lowesty + 10;
else if (thechord.has_stacatto_p || thechord.has_tenuto_p)
offset = thechord.highesty - 10;
else if (thechord.is_accented_p && stemdir)
offset = thechord.lowesty + 10;
else if (thechord.has_marcato_p || thechord.is_accented_p)
offset = -thechord.highesty - 6;
return offset;
}
|