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

Static Public Member Functions | |
| static bool | placeAutoBar (CAPlayable *elt) |
Private Attributes | |
| QList< CAVoice * > | _voiceList |
| int | _numberOfLines |
| QList< CAMusElement * > | _clefList |
| QList< CAMusElement * > | _keySignatureList |
| QList< CAMusElement * > | _timeSignatureList |
| QList< CAMusElement * > | _barlineList |
Additional Inherited Members | |
Public Types inherited from CAContext | |
| enum | CAContextType { Staff, LyricsContext, FunctionMarkContext, FiguredBassContext } |
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 | ( | ) |
| 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 voiceList().

|
inline |
References _voiceList.
Referenced by CASheet::addStaff(), CAMusicXmlImport::addVoiceIfNeeded(), clone(), CAMainWin::copySelection(), CAPropertiesDialog::createDocumentFromTree(), CAMainWin::newDocument(), CAMainWin::on_uiNewVoice_triggered(), CAMainWin::on_uiRemoveVoice_triggered(), CAMainWin::pasteAt(), CAMainWin::sourceViewCommit(), CACanorusMLImport::startElement(), and CAMidiImport::writeMidiFileEventsToScore_New().

|
inline |
References _barlineList.
Referenced by CAVoice::insertMusElement(), CAVoice::remove(), and CALilyPondExport::scanForRepeats().

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

|
inline |
References _clefList.
Referenced by CAVoice::getClef(), CAVoice::getPreviousClef(), CAVoice::insertMusElement(), CANote::notePosition(), and CAVoice::remove().

Clones the current context with the given parent sheet s.
Implements CAContext.
References CATuplet::actualNumber(), addVoice(), CAStaff(), CAPlayable::clone(), CASlur::clone(), CAPlayable::isLastInTuplet(), CAMusElement::musElementType(), CAContext::name(), CAMusElement::Note, CATuplet::number(), numberOfLines(), CANote::phrasingSlurStart(), CASlur::setNoteEnd(), CASlur::setNoteStart(), CANote::setPhrasingSlurEnd(), CANote::setSlurEnd(), CANote::setTieEnd(), CANote::slurStart(), CANote::tieStart(), CAPlayable::tuplet(), and voiceList().

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

| 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 voiceList().
Referenced by CAMainWin::deleteSelection().


| 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().

| CAMusElement * CAStaff::getOneEltByType | ( | CAMusElement::CAMusElementType | type, |
| int | startTime | ||
| ) |
Returns one music element which has the given startTime and type. This searches through all the voices of the staff.
References _voiceList.
Referenced by CAMidiImport::writeMidiChannelEventsToVoice_New().

| CATempo * CAStaff::getTempo | ( | int | time | ) |
Returns the Tempo element active at the given time.
References CAMusElement::timeStart(), and voiceList().

|
inline |
References _voiceList.
Referenced by CAMainWin::sourceViewCommit().

|
inline |
References _keySignatureList.
Referenced by CAVoice::getKeySignature(), CAMidiImport::getOrCreateKeySignature(), CAVoice::getPreviousKeySignature(), CAVoice::insertMusElement(), and CAVoice::remove().

| 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 voiceList().
Referenced by CAMainWin::scoreViewKeyPress().


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

|
static |
Places a barline in front of the element, if needed and the element is the last element in the staff.
The function finds the last barline and places a new one, if the last bar is full. It searches for the time signature in effect for the last bar, not to get fooled by time signature(s) already present at a time signature change.
References CATimeSignature::barDuration(), CAMusElement::Barline, CAVoice::insert(), CAVoice::previousByType(), CABarline::Single, CAPlayable::staff(), CAVoice::staff(), synchronizeVoices(), CAMusElement::timeEnd(), CAMusElement::TimeSignature, CAMusElement::timeStart(), CAPlayable::voice(), and voiceList().
Referenced by CAMainWin::insertMusElementAt(), CAKeybdInput::midiInEventToScore(), and CAMidiImport::writeMidiChannelEventsToVoice_New().


|
virtual |
Returns the pointer to the element right before the given elt in any of the voice.
Implements CAContext.
References voiceList().

|
inlinevirtual |
| 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 voiceList().

|
inline |
References _voiceList.
Referenced by CAPropertiesDialog::createDocumentFromTree(), CAMainWin::on_uiRemoveVoice_triggered(), CAMainWin::sourceViewCommit(), 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 _barlineList, _clefList, _keySignatureList, _timeSignatureList, CAMusElement::Barline, CAMusElement::Clef, CARest::composeRests(), CAMusElement::KeySignature, CAMusElement::timeEnd(), CAMusElement::TimeSignature, CAMusElement::timeStart(), and voiceList().
Referenced by CAMusicXmlImport::addVoiceIfNeeded(), CAMainWin::insertMusElementAt(), CAMainWin::newDocument(), CAMainWin::on_uiNewVoice_triggered(), CAMainWin::on_uiPlayableLength_toggled(), CAMainWin::pasteAt(), placeAutoBar(), CAMusicXmlImport::readMeasure(), CAMainWin::scoreViewKeyPress(), CAMainWin::sourceViewCommit(), and CAMidiImport::writeMidiFileEventsToScore_New().


|
inline |
References _timeSignatureList.
Referenced by CAMidiImport::getOrCreateTimeSignature(), CAVoice::getPreviousTimeSignature(), CAVoice::getTimeSignature(), CAVoice::insertMusElement(), and CAVoice::remove().

References _voiceList.
Referenced by CAScoreView::addCElement(), CATranspose::addContext(), addVoice(), CAMusicXmlImport::addVoiceIfNeeded(), CAPropertiesDialog::buildTree(), clone(), CAMusElementFactory::configureBarline(), CAMusElementFactory::configureClef(), CAMusElementFactory::configureKeySignature(), CAMusElementFactory::configureTimeSignature(), CAMainWin::copySelection(), CAPropertiesDialog::createDocumentFromTree(), CACanorusMLExport::exportDocumentImpl(), CAMidiExport::exportDocumentImpl(), CALilyPondExport::exportScoreBlock(), CAMidiExport::exportSheetImpl(), CAMusicXmlExport::exportStaffImpl(), CALilyPondExport::exportStaffVoices(), getChord(), getTempo(), CAPlayback::initStreams(), CAMainWin::newDocument(), next(), CAMainWin::on_uiLilyPondSource_triggered(), CAMainWin::on_uiNewVoice_triggered(), CAMainWin::on_uiRemoveVoice_triggered(), CAMainWin::pasteAt(), placeAutoBar(), previous(), CAMusicXmlImport::readMeasure(), CAMusicXmlImport::readScorePartwise(), CAVoice::remove(), remove(), CAMainWin::scoreViewKeyPress(), CAMainWin::scoreViewMousePress(), CACanorusMLImport::startElement(), synchronizeVoices(), CAMainWin::updateVoiceToolBar(), CAVoice::voiceNumber(), and CAMidiImport::writeMidiFileEventsToScore_New().

|
private |
Referenced by barlineRefs(), and synchronizeVoices().
|
private |
Referenced by clefRefs(), and synchronizeVoices().
|
private |
Referenced by keySignatureRefs(), and synchronizeVoices().
|
private |
Referenced by CAStaff(), numberOfLines(), and setNumberOfLines().
|
private |
Referenced by synchronizeVoices(), and timeSignatureRefs().
|
private |
Referenced by addVoice(), clear(), findVoice(), getEltByType(), getOneEltByType(), insertVoice(), lastTimeEnd(), removeVoice(), and voiceList().