Esempio n. 1
0
void TmultiScore::onClefChanged(Tclef cl) {
  if (staffCount() > 1) {
      int staffNr = SENDER_TO_STAFF->number();
      for (int i = 0; i < staffCount(); i++)
        if (staves(i)->number() != staffNr) {
          staves(i)->disconnect(SIGNAL(clefChanged(Tclef)));
          staves(i)->onClefChanged(cl);
          connect(staves(i), SIGNAL(clefChanged(Tclef)), this, SLOT(onClefChanged(Tclef)));
        }
  }
  TsimpleScore::onClefChanged(cl);
}
Esempio n. 2
0
Staff* Part::insertStaff(int before)
{
    Q_ASSERT( before >= 0 && before <= staffCount() );
    Staff* staff = new Staff(this);
    d->staves.insert(before, staff);
    return staff;
}
Esempio n. 3
0
/**
 * Before emitting signals about clicked/selected note in read only state,
 * a code below checks is any staff lays under clicked note.
 * This is due to staves are partially placed one over another.
 */
void TmultiScore::roClickedSlot(TscoreNote* sn, const QPointF& clickPos) {
  if (m_selectReadOnly) {
    int staffNr = sn->staff()->number();
    if (clickPos.y() < sn->staff()->hiNotePos() && sn->staff()->number() > 0) // above staff
      staffNr--;
    else if (clickPos.y() > sn->staff()->loNotePos() && sn->staff()->number() < staffCount() - 1 &&
      sn->index() <= staves(staffNr + 1)->count()) // below staff
      staffNr++;
    if (staffNr != sn->staff()->number()) {
      sn->staff()->setZValue(10); // // put fake staff under
      staves(staffNr)->setZValue(11); // and clicked staff above others
    }
    emit lockedNoteClicked(staffNr * staff()->maxNoteCount() + sn->index());
  }
}
Esempio n. 4
0
void TmultiScore::deleteNotes() {
  if (!staff()->count())
      return; // nothing to delete
  m_currentIndex = 0;
  while (staffCount() > 1)
    deleteLastStaff();
  if (staff()->count() > 1) {
    QList<TscoreNote*> notesToDel;
    staff()->takeNotes(notesToDel, 1, staff()->count() - 1);
    for (int i = 0; i <notesToDel.size(); i++)
      delete notesToDel[i];
  }
  removeCurrentNote();
  updateSceneRect();
  m_currentIndex = -1;
}
Esempio n. 5
0
void TmultiScore::setNote(const Tnote& note) {
  if (insertMode() != e_single) {
      if (currentIndex() == -1)
        changeCurrentIndex(0);
      TscoreStaff *thisStaff = currentStaff();
      if (insertMode() == e_record) {
          if (m_clickedOff > 0)
            checkAndAddNote(thisStaff, currentIndex() % staff()->maxNoteCount());
          changeCurrentIndex(currentIndex() + m_clickedOff);
          thisStaff = currentStaff();
          m_clickedOff = 1;
      }
      thisStaff->setNote(currentIndex() % staff()->maxNoteCount(), note);
      if (staffCount() > 1)
        QTimer::singleShot(5, this, SLOT(ensureNoteIsVisible()));
  } else {
      TsimpleScore::setNote(0, note);
  }
}
Esempio n. 6
0
Staff* Part::staff(int index)
{
    Q_ASSERT( index >= 0 && index < staffCount() );
    return d->staves[index];
}