Ejemplo n.º 1
0
bool LayerElement::IsCueSize()
{
    if ( this->Is() == NOTE ) {
        Note *note = dynamic_cast<Note*>(this);
        assert( note );
        return ( note->HasGrace() );
    }
    Note *note = dynamic_cast<Note*>(this->GetFirstParent( NOTE, MAX_ACCID_DEPTH ) );
    return ( note && ( note->HasGrace() ) );
}
Ejemplo n.º 2
0
void Beam::FilterList( ListOfObjects *childList )
{
    bool firstNoteGrace = false;
    // We want to keep only notes and rest
    // Eventually, we also need to filter out grace notes properly (e.g., with sub-beams)
    ListOfObjects::iterator iter = childList->begin();

    while ( iter != childList->end()) {
        if ( !(*iter)->IsLayerElement() ) {
            // remove anything that is not an LayerElement (e.g. Verse, Syl, etc)
            iter = childList->erase( iter );
            continue;
        }
        LayerElement *currentElement = dynamic_cast<LayerElement*>(*iter);
        assert( currentElement );
        if ( !currentElement->HasInterface(INTERFACE_DURATION) )
        {
            // remove anything that has not a DurationInterface
            iter = childList->erase( iter );
        } else {
            // Drop notes that are signaled as grace notes
            Note *n = dynamic_cast<Note*>(currentElement);

            if (n) {
                // if we are at the beginning of the beam
                // and the note is cueSize
                // assume all the beam is of grace notes
                if (childList->begin() == iter) {
                    if (n->HasGrace())
                        firstNoteGrace = true;
                }

                // if the first note in beam was NOT a grace
                // we have grace notes embedded in a beam
                // drop them
                if ( !firstNoteGrace && n->HasGrace() == true)
                    iter = childList->erase( iter );
                else
                    iter++;

            } else {
                // if it is a Rest, do not drop
                iter++;
            }
        }
    }

    InitCoords( childList );
}
Ejemplo n.º 3
0
bool LayerElement::IsGraceNote()
{
    Note *note = dynamic_cast<Note*>(this);
    return (note && note->HasGrace());
}
Ejemplo n.º 4
0
void View::DrawMensuralNote ( DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure )
{
    assert( dc );
    assert( element );
    assert( layer );
    assert( staff );
    assert( measure );
    
    Note *note = dynamic_cast<Note*>(element);
    assert( note );
    
    int staffSize = staff->m_drawingStaffSize;
    int noteY = element->GetDrawingY();
    int xLedger, xNote, xStem;
    int drawingDur;
    bool drawingCueSize;
    int staffY = staff->GetDrawingY();
    wchar_t fontNo;
    int ledge;
    int verticalCenter = 0;

    xStem = element->GetDrawingX();
    xLedger = xStem;
    
    drawingDur = note->GetDrawingDur();
    drawingCueSize = note->HasGrace();
    
    int radius = m_doc->GetGlyphWidth(SMUFL_E0A3_noteheadHalf, staffSize, drawingCueSize);
    
    if (drawingDur > DUR_1 || (drawingDur == DUR_1 && staff->notAnc)) {	// annuler provisoirement la modif. des lignes addit.
        ledge = m_doc->GetDrawingLedgerLineLength(staffSize, drawingCueSize);
    }
    else {
        ledge = m_doc->GetDrawingLedgerLineLength(staffSize, drawingCueSize);
        radius += radius/3;
    }
    
    /************** Stem/notehead direction: **************/
    
    verticalCenter = staffY - m_doc->GetDrawingDoubleUnit(staffSize)*2;
    data_STEMDIRECTION noteStemDir = note->CalcDrawingStemDir();
    if ( noteStemDir != STEMDIRECTION_NONE ) {
        note->SetDrawingStemDir( noteStemDir );
    }
    else if ( layer->GetDrawingStemDir() != STEMDIRECTION_NONE) {
        note->SetDrawingStemDir( layer->GetDrawingStemDir() );
    }
    else {
        note->SetDrawingStemDir((noteY >= verticalCenter) ? STEMDIRECTION_down : STEMDIRECTION_up);
    }
    
    xNote = xStem - radius;
    
    /************** Noteheads: **************/
    
    // Long, breve and ligatures
    if ((note->GetLig()!=LIGATURE_NONE) && (drawingDur <= DUR_1)) {
        DrawLigature ( dc, noteY, element, layer, staff);
    }
    else if (drawingDur < DUR_1) {
        DrawMaximaToBrevis( dc, noteY, element, layer, staff);
    }
    else if (drawingDur == DUR_1) {
        if (note->GetColored())
            fontNo = SMUFL_E938_mensuralNoteheadSemibrevisBlack;
        else
            fontNo = SMUFL_E939_mensuralNoteheadSemibrevisVoid;
        
        DrawSmuflCode( dc, xNote, noteY, fontNo, staff->m_drawingStaffSize, drawingCueSize );
    }
    // Other values ??WE WANT MENSURAL NOTEHEADS, NOT CMN!!!!!!!!
   else {
        if (note->GetColored()) {
            if (drawingDur == DUR_2) fontNo = SMUFL_E0A4_noteheadBlack;
            else fontNo = SMUFL_E0A3_noteheadHalf;
        }
        else {
            if (drawingDur > DUR_2) fontNo = SMUFL_E0A4_noteheadBlack;
            else fontNo = SMUFL_E0A3_noteheadHalf;
        }

        DrawSmuflCode( dc, xNote, noteY, fontNo,  staff->m_drawingStaffSize, drawingCueSize );
        
        DrawStem(dc, note, staff, note->GetDrawingStemDir(), radius, xStem, noteY);
    }
    
    /************** Ledger lines: **************/
    
    int staffTop = staffY + m_doc->GetDrawingUnit(staffSize);
    int staffBot = staffY - m_doc->GetDrawingStaffSize(staffSize) - m_doc->GetDrawingUnit(staffSize);
    
    //if the note is not in the staff
    if (!is_in(noteY,staffTop,staffBot))
    {
        int distance, highestNewLine, numLines;
        bool aboveStaff = (noteY > staffTop);
        
        distance = (aboveStaff ? (noteY - staffY) : staffY - m_doc->GetDrawingStaffSize(staffSize) - noteY);
        highestNewLine = ((distance % m_doc->GetDrawingDoubleUnit(staffSize) > 0) ? (distance - m_doc->GetDrawingUnit(staffSize)) : distance);
        numLines = highestNewLine / m_doc->GetDrawingDoubleUnit(staffSize);
        
        DrawLedgerLines(dc, note, staff, aboveStaff, false, 0, numLines);

    }
    
    /************** dots **************/
    
    if (note->GetDots()) {
        int xDot;
        if (note->GetDur() < DUR_2 || (note->GetDur() > DUR_8 && (note->GetDrawingStemDir() == STEMDIRECTION_up)))
            xDot = xStem + m_doc->GetDrawingUnit(staffSize)*7/2;
        else
            xDot = xStem + m_doc->GetDrawingUnit(staffSize)*5/2;
        
        DrawDots( dc, xDot, noteY, note->GetDots(), staff );
    }
}