d11f1b118b
- Measure: -- firstSegment -- lastSegment - MeasureBase: -- nextMeasure -- nextMeasureMM (new) -- prevMeasure -- prevMeasureMM (new) - Score: -- firstMeasure -- firstMeasureMM (new) -- (for firstSegment(), see special cases below) -- lastMeasure -- lastMeasureMM (new) -- lastSegment - Segment: -- next (renamed from `next1`) -- nextInMeasure (renamed from `next`) -- prev (renamed from `prev1`) -- prevInMeasure (renamed from prev) Special cases: - Cursor: The prototype of the `Q_INVOKABLE Ms::Note* Cursor::addNote(int pitch)` was wrong: corrected in `Q_INVOKABLE void Cursor::addNote(int pitch)`. - QmlPlugin: `Q_INVOKABLE Score* QmlPlugin::readScore()` and `Q_INVOKABLE Score* QmlPlugin::newScore()` has been kept, as they are intended to be called from QML; code has been added to ensure the C++ ownership of the returned object. - Score: `Q_INVOKABLE Segment* Score::firstSegment(Segment::Type segType)` is kept (as it needs a parameters), but code is added to ensure C++ ownership of the returned Segment*. - Segment: `Ms::Element* Segment::element(int track)` has been made NOT Q_INVOKABLE; a variant `Q_INVOKABLE Ms::Element* elementAt(int track)` has been added specifically for QML with code to ensure the C++ ownership of the returned Element* (this was the cause for the crash of the Walk plug-in). - FiguredBass: `Q_INVOKABLE Ms::FiguredBassItem* FiguredBass::addItem()` has been removed; plugin interface for FiguredBass needs to be redesigned anyway. The few occurrences in the supplied plug-ins of the methods whose names did change have been updated.
111 lines
3.1 KiB
C++
111 lines
3.1 KiB
C++
//=============================================================================
|
|
// MuseScore
|
|
// Music Composition & Notation
|
|
//
|
|
// Copyright (C) 2012 Werner Schweer
|
|
//
|
|
// This program is free software; you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License version 2
|
|
// as published by the Free Software Foundation and appearing in
|
|
// the file LICENCE.GPL
|
|
//=============================================================================
|
|
|
|
#ifndef __CURSOR_H__
|
|
#define __CURSOR_H__
|
|
|
|
namespace Ms {
|
|
|
|
class Element;
|
|
class Score;
|
|
class Chord;
|
|
class Rest;
|
|
class Note;
|
|
class Segment;
|
|
class RepeatSegment;
|
|
class ChordRest;
|
|
class StaffText;
|
|
class Measure;
|
|
|
|
//---------------------------------------------------------
|
|
// @@ Cursor
|
|
// @P track int current track
|
|
// @P staffIdx int current staff (track / 4)
|
|
// @P voice int current voice (track % 4)
|
|
// @P element Ms::Element* current element at track, read only
|
|
// @P segment Ms::Segment* current segment, read only
|
|
// @P measure Ms::Measure* current measure, read only
|
|
// @P tick int midi tick position, read only
|
|
// @P time double time at tick position, read only
|
|
// @P score Ms::Score* associated score
|
|
//---------------------------------------------------------
|
|
|
|
class Cursor : public QObject {
|
|
Q_OBJECT
|
|
Q_PROPERTY(int track READ track WRITE setTrack)
|
|
Q_PROPERTY(int staffIdx READ staffIdx WRITE setStaffIdx)
|
|
Q_PROPERTY(int voice READ voice WRITE setVoice)
|
|
|
|
Q_PROPERTY(Ms::Element* element READ element)
|
|
Q_PROPERTY(Ms::Segment* segment READ segment)
|
|
Q_PROPERTY(Ms::Measure* measure READ measure)
|
|
|
|
Q_PROPERTY(int tick READ tick)
|
|
Q_PROPERTY(double time READ time)
|
|
Q_PROPERTY(Ms::Score* score READ score WRITE setScore)
|
|
|
|
Score* _score;
|
|
int _track;
|
|
bool _expandRepeats;
|
|
|
|
//state
|
|
Segment* _segment;
|
|
|
|
// utility methods
|
|
void firstChordRestInTrack();
|
|
|
|
public:
|
|
Cursor(Score* c = 0);
|
|
Cursor(Score*, bool);
|
|
|
|
Score* score() const { return _score; }
|
|
void setScore(Score* s);
|
|
|
|
int track() const { return _track; }
|
|
void setTrack(int v);
|
|
|
|
int staffIdx() const;
|
|
void setStaffIdx(int v);
|
|
|
|
int voice() const;
|
|
void setVoice(int v);
|
|
|
|
Element* element() const;
|
|
Segment* segment() const { return _segment; }
|
|
Measure* measure() const;
|
|
|
|
int tick();
|
|
double time();
|
|
|
|
//@ rewind cursor
|
|
//@ type=0 rewind to start of score
|
|
//@ type=1 rewind to start of selection
|
|
//@ type=2 rewind to end of selection
|
|
Q_INVOKABLE void rewind(int type);
|
|
|
|
Q_INVOKABLE bool next();
|
|
Q_INVOKABLE bool nextMeasure();
|
|
Q_INVOKABLE void add(Ms::Element*);
|
|
|
|
Q_INVOKABLE void addNote(int pitch);
|
|
|
|
//@ set duration
|
|
//@ z: numerator
|
|
//@ n: denominator
|
|
//@ Quarter, if n == 0
|
|
Q_INVOKABLE void setDuration(int z, int n);
|
|
};
|
|
|
|
|
|
} // namespace Ms
|
|
#endif
|
|
|