diff --git a/src/libs/core/tnootkaqml.cpp b/src/libs/core/tnootkaqml.cpp index 38d4c84770e235d0c01c48f7fe036b1c6551c3b8..2e29c373e968275ad5b8b976fe2645b81ca88459 100755 --- a/src/libs/core/tnootkaqml.cpp +++ b/src/libs/core/tnootkaqml.cpp @@ -23,6 +23,7 @@ #include "tpath.h" #include "music/tkeysignature.h" #include "music/tnamestylefilter.h" +#include "score/tnotepair.h" #include "score/tscoreobject.h" #include "score/tstaffobject.h" #include "score/tnoteobject.h" @@ -509,6 +510,7 @@ void TnootkaQML::instrumentChangesNoteSlot() { if (m_scoreObject->singleNote()) { m_scoreObject->setNote(0, rawNote); + m_scoreObject->setTechnical(0, m_instrument->noteData()); } else { if (m_scoreObject->selectedItem()) { rawNote.setRhythm(m_scoreObject->selectedItem()->note()->rtm); @@ -517,6 +519,21 @@ void TnootkaQML::instrumentChangesNoteSlot() { rawNote.setRhythm(m_scoreObject->workRhythm()); m_scoreObject->addNote(rawNote, true); } + if (GLOB->instrument().type() == Tinstrument::Bandoneon) { + auto seg = m_scoreObject->selectedItem() ? m_scoreObject->noteSegment(m_scoreObject->selectedItem()->index()) : m_scoreObject->lastSegment(); + TnoteData instrData(m_instrument->noteData()); + if (seg->index() > 0) { + for (int i = seg->index() - 1; i >= 0; --i) { + auto searchNoteData = m_scoreObject->noteSegment(i)->techicalData(); + if (searchNoteData.bowing()) { // Show bowing but only when it changes comparing to the previously set bow direction + if (searchNoteData.bowing() == instrData.bowing()) // if it is the same - just reset bowing on note data from the instrument + instrData.setBowing(TnoteData::BowUndefined); + break; + } + } + } + seg->setTechnical(instrData.data()); + } } } @@ -541,7 +558,22 @@ void TnootkaQML::scoreChangedNote() { auto n = m_scoreObject->selectedNote(); if (n.isValid()) n.transpose(GLOB->transposition()); - m_instrument->setNote(n); + quint32 noteData = 255; // empty by default + if (GLOB->instrument().type() == Tinstrument::Bandoneon && m_scoreObject->selectedItem()) { + auto selectedSegment = m_scoreObject->noteSegment(m_scoreObject->selectedItem()->index()); + TnoteData dataToSet = selectedSegment->technical(); + if (!dataToSet.bowing()) { // no bowing, so look up for any previous note with bowing mark + for (int i = selectedSegment->index(); i >= 0; --i) { + auto searchNoteData = m_scoreObject->noteSegment(i)->techicalData(); + if (searchNoteData.bowing()) { + dataToSet.setBowing(searchNoteData.bowing()); + break; + } + } + } + noteData = dataToSet.data(); + } + m_instrument->setNote(n, noteData); emit playNote(n); qDebug() << "Got note from score" << n.toText() << n.chromatic(); } diff --git a/src/main/texamexecutor.cpp b/src/main/texamexecutor.cpp index 1568a13a71405d78f1ee14de6d26154f773bee2c..ea27e8ecb84c4b9f37650301e3b70d7582ade6a4 100755 --- a/src/main/texamexecutor.cpp +++ b/src/main/texamexecutor.cpp @@ -369,8 +369,8 @@ void TexamExecutor::askQuestion(bool isAttempt) { MAIN_SCORE->askQuestion(curQ->melody()); if (m_level.showStrNr) { // we may be sure that instrument is kind of a guitar for (int i = 0; i < curQ->melody()->length(); ++i) { - // if (curQ->melody()->note(i)->g().str() > 1) - // SCORE->noteFromId(i)->setString(curQ->melody()->note(i)->g().str()); + if (curQ->melody()->note(i)->g().str() > 1) + MAIN_SCORE->setTechnical(i, curQ->melody()->note(i)->noteData()); } // if (INSTRUMENT->isVisible()) // INSTRUMENT->prepareAnswer(); // It just shows range frame