|
Canorus
0.7
|
Represents a staff in the sheet. More...
#include <staff.h>

Private Attributes | |
| QList< CAVoice * > | _voiceList |
| int | _numberOfLines |
Additional Inherited Members | |
Public Types inherited from CAContext | |
| enum | CAContextType { Staff, FunctionMarkContext, LyricsContext } |
Protected Member Functions inherited from CAContext | |
| void | setContextType (CAContextType t) |
Protected Attributes inherited from CAContext | |
| CASheet * | _sheet |
| QString | _name |
| CAContextType | _contextType |
Represents a staff in the sheet.
Copyright (c) 2006-2008, Matevž Jekovec, Canorus development team All Rights Reserved. See AUTHORS for a complete list of authors.
Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE.GPL for details.
This class represents usually an infinite long n-line staff where notes, rests, barlines, clefs and other music elements are placed.
CAStaff is by hierarchy part of CASheet and can include various number of CAVoice objects.
Creates a new empty staff with parent sheet s, named name and numberOfLines.
References CAContext::_contextType, CAContext::_name, _numberOfLines, CAContext::name(), numberOfLines(), and CAContext::Staff.
Referenced by clone().


| CAStaff::~CAStaff | ( | ) |
| void CAStaff::addVoice | ( | CAVoice * | voice | ) |
Adds a voice voice to the staff and sets its parent to this staff. Call synchronizeVoices() manually to synchronize a new voice with other voices.
References _voiceList, and CAVoice::setStaff().
Referenced by CASheet::addStaff(), CAMusicXmlImport::addVoiceIfNeeded(), clone(), CAMainWin::copySelection(), CAPropertiesDialog::createDocumentFromTree(), CAMainWin::on_uiNewVoice_triggered(), CAMainWin::on_uiRemoveVoice_triggered(), CAMainWin::pasteAt(), CAMainWin::sourceViewPortCommit(), CACanorusMLImport::startElement(), and CAMidiImport::writeMidiFileEventsToScore().


| CAVoice * CAStaff::addVoice | ( | ) |
Adds an empty voice to the staff. Call synchronizeVoices() manually to synchronize a new voice with other voices.
References CAContext::name(), and voiceCount().

|
virtual |
Implements CAContext.
References _voiceList.
Referenced by ~CAStaff().

Clones the current context with the given parent sheet s.
Implements CAContext.
References CATuplet::actualNumber(), addVoice(), CAVoice::append(), CAStaff(), CAPlayable::clone(), CANote::clone(), CAMusElement::clone(), CAPlayable::isLastInTuplet(), CAMusElement::isPlayable(), CAVoice::musElementAt(), CAVoice::musElementCount(), CAMusElement::musElementType(), CAContext::name(), CAMusElement::Note, CATuplet::number(), numberOfLines(), CASlur::setNoteEnd(), CASlur::setNoteStart(), CAVoice::synchronizeMusElements(), CAPlayable::tuplet(), voiceAt(), and voiceCount().

| QList< CAPlayable * > CAStaff::getChord | ( | int | time | ) |
Returns a list of notes and rests (chord) for all the voices in the staff in the given time slice time.
This is useful for determination of the harmony at certain point in time.
References CAVoice::getChord(), voiceAt(), and voiceCount().
Referenced by CAMainWin::deleteSelection(), and CASheet::getChord().


| QList< CAMusElement * > CAStaff::getEltByType | ( | CAMusElement::CAMusElementType | type, |
| int | startTime | ||
| ) |
Returns a list of pointers to actual music elements which have the given startTime and are of given type. This searches the entire staff through all the voices.
References _voiceList.
Referenced by CALilyPondImport::findSharedElement(), and CAMidiImport::findSharedElement().

| int CAStaff::lastTimeEnd | ( | ) |
Returns the end of the last music element in the staff.
References _voiceList.
|
virtual |
Returns the pointer to the element right next to the given elt in any of the voice.
Implements CAContext.
References CAVoice::contains(), CAVoice::next(), voiceAt(), and voiceCount().
Referenced by CAMainWin::scoreViewPortKeyPress().


|
inline |
References _numberOfLines.
Referenced by CADrawableKeySignature::CADrawableKeySignature(), CAStaff(), clone(), CAMainWin::copySelection(), CADrawableStaff::draw(), CACanorusMLExport::exportDocumentImpl(), and CAPropertiesDialog::updateStaffProperties().

|
virtual |
Returns the pointer to the element right before the given elt in any of the voice.
Implements CAContext.
References CAVoice::contains(), CAVoice::previous(), voiceAt(), and voiceCount().

| bool CAStaff::remove | ( | CAMusElement * | elt, |
| bool | updateSignTimes | ||
| ) |
Removes the element elt. Updates timeStarts for elements after the given element.
Also updates non-playable shared signs after the element, if updateSignTimes is True.
Eventually does the same as CAVoice::remove(), but checks for any voices present in the staff.
References CAVoice::remove(), voiceAt(), and voiceCount().

|
inlinevirtual |
Implements CAContext.
|
inline |
References _voiceList.
Referenced by CAPropertiesDialog::createDocumentFromTree(), CAMainWin::on_uiRemoveVoice_triggered(), CAMainWin::sourceViewPortCommit(), and CAVoice::~CAVoice().

|
inline |
References _numberOfLines.
Referenced by CAPropertiesDialog::applyProperties().

| bool CAStaff::synchronizeVoices | ( | ) |
Fixes voices inconsistency: 1) If any of the voices include signs (key sigs, clefs etc.) which aren't present in all voices, add that sign to all the voices. 2) If a voice includes a sign which overlaps a playable element in other voice, insert rests until the sign is moved at the end of the overlapped chord in all voices. 3) If a voice elements are not linear (every N-th element's timeEnd should be N+1-th element's timeStart) inserts rests to achieve linearity.
Synchronizing voices is relatively slow (O(n*m) where n is number of voices and m number of elements in voice n). This was the main reason to not automate the synchronization: import filters use lots of insertions and synchronization of the voices every time a new element is inserted would considerably slow down the import filter.
Returns True, if everything was ok. False, if fixes were needed.
References CARest::composeRests(), CAVoice::musElementList(), CAVoice::synchronizeMusElements(), CAMusElement::timeEnd(), CAMusElement::timeStart(), CAVoice::updateTimes(), voiceAt(), and voiceCount().
Referenced by CAMusicXmlImport::addVoiceIfNeeded(), CACanorusMLImport::endElement(), CAMainWin::insertMusElementAt(), CAMainWin::on_uiNewVoice_triggered(), CAMainWin::on_uiPlayableLength_toggled(), CAMainWin::pasteAt(), CAMusElementFactory::placeAutoBar(), CAMusicXmlImport::readMeasure(), CAMainWin::scoreViewPortKeyPress(), and CAMainWin::sourceViewPortCommit().


|
inline |
Returns voice with the specified index in the staff starting with 0.
References _voiceList.
Referenced by CASettingsDialog::buildPreviewSheet(), CAPropertiesDialog::buildTree(), clone(), CAMusElementFactory::configureBarline(), CAMusElementFactory::configureClef(), CAMusElementFactory::configureKeySignature(), CAMusElementFactory::configureTimeSignature(), CAPropertiesDialog::createDocumentFromTree(), CAMainWin::currentVoice(), CACanorusMLExport::exportDocumentImpl(), CAMidiExport::exportDocumentImpl(), CALilyPondExport::exportScoreBlock(), CALilyPondExport::exportStaffVoices(), getChord(), CAPlayback::initStreams(), next(), CAMainWin::on_uiLilyPondSource_triggered(), CAMainWin::on_uiNewVoice_triggered(), CAMainWin::pasteAt(), previous(), CAMusicXmlImport::readMeasure(), CAMusicXmlImport::readScorePartwise(), CAVoice::remove(), remove(), CAMainWin::scoreViewPortKeyPress(), CASettingsDialog::setupPages(), synchronizeVoices(), and CAMainWin::updateVoiceToolBar().

Returns the first voice with the given name or Null, if such a voice doesn't exist.
References _voiceList, and CAContext::name().

|
inline |
Returns the number of voices in the staff.
References _voiceList.
Referenced by CATranspose::addContext(), addVoice(), CAMusicXmlImport::addVoiceIfNeeded(), CAPropertiesDialog::buildTree(), CAVoice::CAVoice(), CAVoice::clear(), clone(), CAMusElementFactory::configureBarline(), CAMusElementFactory::configureClef(), CAMusElementFactory::configureKeySignature(), CAMusElementFactory::configureTimeSignature(), CAMainWin::copySelection(), CAPropertiesDialog::createDocumentFromTree(), CAMainWin::currentVoice(), CACanorusMLExport::exportDocumentImpl(), CAMidiExport::exportDocumentImpl(), CALilyPondExport::exportScoreBlock(), CALilyPondExport::exportStaffVoices(), getChord(), CAPlayback::initStreams(), next(), CAMainWin::on_uiNewVoice_triggered(), CAMainWin::on_uiRemoveVoice_triggered(), CAMainWin::pasteAt(), previous(), CAMusicXmlImport::readMeasure(), CAMusicXmlImport::readScorePartwise(), CAVoice::remove(), remove(), CACanorusMLImport::startElement(), synchronizeVoices(), and CAMainWin::updateVoiceToolBar().

|
inline |
References _voiceList.
Referenced by CAMainWin::copySelection(), and CAVoice::voiceNumber().

|
inline |
References _voiceList.
Referenced by CATranspose::addContext(), CALilyPondExport::exportScoreBlock(), CASheet::voiceList(), and CAMidiImport::writeMidiFileEventsToScore().

|
private |
Referenced by CAStaff(), numberOfLines(), and setNumberOfLines().
|
private |
Referenced by addVoice(), clear(), getEltByType(), lastTimeEnd(), removeVoice(), voiceAt(), voiceByName(), voiceCount(), voiceIndex(), and voiceList().
1.8.3