convert enum SelectType into enum class

This commit is contained in:
Joachim Schmitz 2014-05-27 10:34:08 +02:00
parent 7f9cfd4dda
commit 826c956013
24 changed files with 107 additions and 107 deletions

View file

@ -2257,7 +2257,7 @@ Element* Chord::drop(const DropData& data)
atr = 0;
// if attribute is already there, remove
// score()->cmdRemove(oa); // unexpected behaviour?
score()->select(oa, SELECT_SINGLE, 0);
score()->select(oa, SelectType::SINGLE, 0);
}
else {
atr->setParent(this);

View file

@ -248,7 +248,7 @@ void Score::cmdAddSpanner(Spanner* spanner, const QPointF& pos)
}
undoAddElement(spanner);
select(spanner, SELECT_SINGLE, 0);
select(spanner, SelectType::SINGLE, 0);
if (spanner->type() == Element::ElementType::TRILL) {
Element* e = segment->element(staffIdx * VOICES);
@ -494,7 +494,7 @@ void Score::cmdAddInterval(int val, const QList<Note*>& nl)
undoAddElement(note);
_playNote = true;
select(note, SELECT_SINGLE, 0);
select(note, SelectType::SINGLE, 0);
}
Chord* c = nl.front()->chord();
c->measure()->cmdUpdateNotes(c->staffIdx());
@ -531,7 +531,7 @@ void Score::setGraceNote(Chord* ch, int pitch, NoteType type, int len)
chord->setMag(ch->staff()->mag() * styleD(StyleIdx::graceNoteMag));
undoAddElement(chord);
select(note, SELECT_SINGLE, 0);
select(note, SelectType::SINGLE, 0);
}
//---------------------------------------------------------
@ -641,7 +641,7 @@ Segment* Score::setNoteRest(Segment* segment, int track, NoteVal nval, Fraction
if (tie)
connectTies();
if (nr)
select(nr, SELECT_SINGLE, 0);
select(nr, SelectType::SINGLE, 0);
return segment;
}
@ -965,9 +965,9 @@ qDebug(" setRest at %d+%d, %d/%d",
cr->tick(), cr->actualTicks(), (srcF-dstF).numerator(), (srcF-dstF).denominator());
setRest(cr->tick() + cr->actualTicks(), track, srcF - dstF, false, tuplet);
if(!selNote)
select(cr, SELECT_SINGLE, 0);
select(cr, SelectType::SINGLE, 0);
else
select(selNote, SELECT_SINGLE, 0);
select(selNote, SelectType::SINGLE, 0);
return;
}
@ -1010,7 +1010,7 @@ qDebug(" +ChangeCRLen::setRest %d/%d", f2.numerator(), f2.denominator());
r = setRest(tick, track, f2 * timeStretch, (d.dots() > 0), tuplet);
}
if (first) {
select(r, SELECT_SINGLE, 0);
select(r, SelectType::SINGLE, 0);
first = false;
}
qDebug(" ChangeCRLen:: %d += %d(actual=%d)", tick, f2.ticks(), f2.ticks() * timeStretch.numerator() / timeStretch.denominator());
@ -1039,9 +1039,9 @@ qDebug(" ChangeCRLen:: %d += %d(actual=%d)", tick, f2.ticks(), f2.ticks() * tim
}
if (oc && first) {
if(!selNote)
select(oc, SELECT_SINGLE, 0);
select(oc, SelectType::SINGLE, 0);
else
select(selNote, SELECT_SINGLE, 0);
select(selNote, SelectType::SINGLE, 0);
first = false;
}
if (oc)
@ -1064,7 +1064,7 @@ qDebug(" ChangeCRLen:: %d += %d(actual=%d)", tick, f2.ticks(), f2.ticks() * tim
oc = cc;
}
if (first) {
select(oc, SELECT_SINGLE, 0);
select(oc, SelectType::SINGLE, 0);
first = false;
}
tick += oc->actualTicks();
@ -1773,7 +1773,7 @@ Element* Score::move(const QString& cmd)
if (trg->type() == Element::ElementType::CHORD)
trg = static_cast<Chord*>(trg)->upNote();
_playNote = true;
select(trg, SELECT_SINGLE, 0);
select(trg, SelectType::SINGLE, 0);
return trg;
}
// if no chordrest found, do nothing
@ -1838,7 +1838,7 @@ Element* Score::move(const QString& cmd)
if (el->type() == Element::ElementType::CHORD)
el = static_cast<Chord*>(el)->upNote(); // originally downNote
_playNote = true;
select(el, SELECT_SINGLE, 0);
select(el, SelectType::SINGLE, 0);
}
return el;
}
@ -1897,7 +1897,7 @@ Element* Score::selectMove(const QString& cmd)
else if (cmd == "select-staff-below")
el = downStaff(cr);
if (el)
select(el, SELECT_RANGE, el->staffIdx());
select(el, SelectType::RANGE, el->staffIdx());
return el;
}
@ -2126,7 +2126,7 @@ void Score::cmd(const QAction* a)
if (e->type() == Element::ElementType::NOTE) {
_playNote = true;
}
select(e, SELECT_SINGLE, 0);
select(e, SelectType::SINGLE, 0);
}
}
setLayoutAll(false);
@ -2138,7 +2138,7 @@ void Score::cmd(const QAction* a)
if (e->type() == Element::ElementType::NOTE) {
_playNote = true;
}
select(e, SELECT_SINGLE, 0);
select(e, SelectType::SINGLE, 0);
}
}
setLayoutAll(false);
@ -2150,7 +2150,7 @@ void Score::cmd(const QAction* a)
if (e->type() == Element::ElementType::NOTE) {
_playNote = true;
}
select(e, SELECT_SINGLE, 0);
select(e, SelectType::SINGLE, 0);
}
}
setLayoutAll(false);
@ -2162,7 +2162,7 @@ void Score::cmd(const QAction* a)
if (e->type() == Element::ElementType::NOTE) {
_playNote = true;
}
select(e, SELECT_SINGLE, 0);
select(e, SelectType::SINGLE, 0);
}
}
setLayoutAll(false);

View file

@ -358,7 +358,7 @@ Note* Score::addNote(Chord* chord, NoteVal& noteVal)
note->setNval(noteVal);
undoAddElement(note);
_playNote = true;
select(note, SELECT_SINGLE, 0);
select(note, SelectType::SINGLE, 0);
if (!chord->staff()->isTabStaff())
_is.moveToNextInputPos();
return note;
@ -974,7 +974,7 @@ void Score::cmdAddHairpin(bool decrescendo)
pin->setTick2(cr2->segment()->tick());
undoAddElement(pin);
if (!noteEntryMode())
select(pin, SELECT_SINGLE, 0);
select(pin, SelectType::SINGLE, 0);
}
//---------------------------------------------------------
@ -999,7 +999,7 @@ void Score::cmdAddOttava(OttavaType type)
ottava->setTick2(cr2->tick());
undoAddElement(ottava);
if (!noteEntryMode())
select(ottava, SELECT_SINGLE, 0);
select(ottava, SelectType::SINGLE, 0);
}
//---------------------------------------------------------
@ -1147,7 +1147,7 @@ void Score::deleteItem(Element* el)
Chord* chord = static_cast<Chord*>(el->parent());
if (chord->notes().size() > 1) {
undoRemoveElement(el);
select(chord->downNote(), SELECT_SINGLE, 0);
select(chord->downNote(), SelectType::SINGLE, 0);
break;
}
// else fall through
@ -1178,7 +1178,7 @@ void Score::deleteItem(Element* el)
rest->setTuplet(tuplet);
rest->setDurationType(chord->durationType());
}
select(rest, SELECT_SINGLE, 0);
select(rest, SelectType::SINGLE, 0);
}
else {
// remove segment if empty
@ -1460,7 +1460,7 @@ void Score::cmdDeleteSelectedMeasures()
}
}
select(0, SELECT_SINGLE, 0);
select(0, SelectType::SINGLE, 0);
_is.setSegment(0); // invalidate position
}
@ -1687,7 +1687,7 @@ Lyrics* Score::addLyrics()
lyrics->setParent(cr);
lyrics->setNo(no);
undoAddElement(lyrics);
select(lyrics, SELECT_SINGLE, 0);
select(lyrics, SelectType::SINGLE, 0);
return lyrics;
}
@ -1912,7 +1912,7 @@ void Score::nextInputPos(ChordRest* cr, bool doSelect)
}
_is.setSegment(ncr ? ncr->segment() : 0);
if (doSelect)
select(ncr, SELECT_SINGLE, 0);
select(ncr, SelectType::SINGLE, 0);
if (ncr)
setPlayPos(ncr->tick());
}

View file

@ -1720,7 +1720,7 @@ FiguredBass* Score::addFiguredBass()
if(bNew)
undoAddElement(fb);
select(fb, SELECT_SINGLE, 0);
select(fb, SelectType::SINGLE, 0);
return fb;
}

View file

@ -1506,7 +1506,7 @@ RepeatMeasure* Measure::cmdInsertRepeatMeasure(int staffIdx)
//
// see also cmdDeleteSelection()
//
_score->select(0, SELECT_SINGLE, 0);
_score->select(0, SelectType::SINGLE, 0);
for (Segment* s = first(); s; s = s->next()) {
if (s->segmentType() & Segment::SegChordRest) {
int strack = staffIdx * VOICES;

View file

@ -193,8 +193,8 @@ enum class TransposeMode : char {
// SelectType
//---------------------------------------------------------
enum SelectType {
SELECT_SINGLE, SELECT_RANGE, SELECT_ADD
enum class SelectType : char {
SINGLE, RANGE, ADD
};
//---------------------------------------------------------

View file

@ -1161,7 +1161,7 @@ void Note::endDrag()
n->undoChangeProperty(P_ID::TPC2, tpc2);
}
}
score()->select(this, SELECT_SINGLE, 0);
score()->select(this, SelectType::SINGLE, 0);
}
//---------------------------------------------------------
@ -1413,7 +1413,7 @@ Element* Note::drop(const DropData& data)
Note* n = c->upNote();
Direction dir = c->stemDirection();
int t = (staff2track(staffIdx()) + n->voice());
score()->select(0, SELECT_SINGLE, 0);
score()->select(0, SelectType::SINGLE, 0);
NoteVal nval;
nval.pitch = n->pitch();
nval.headGroup = n->headGroup();

View file

@ -221,7 +221,7 @@ Element* Rest::drop(const DropData& data)
Chord* c = static_cast<Chord*>(e);
Note* n = c->upNote();
Direction dir = c->stemDirection();
// score()->select(0, SELECT_SINGLE, 0);
// score()->select(0, SelectType::SINGLE, 0);
NoteVal nval;
nval.pitch = n->pitch();
nval.headGroup = n->headGroup();

View file

@ -2204,7 +2204,7 @@ void Score::splitStaff(int staffIdx, int splitPoint)
//
// move notes
//
select(0, SELECT_SINGLE, 0);
select(0, SelectType::SINGLE, 0);
int strack = staffIdx * VOICES;
int dtrack = (staffIdx + 1) * VOICES;
@ -2740,7 +2740,7 @@ void Score::select(Element* e, SelectType type, int staffIdx)
SelState selState = _selection.state();
if (type == SELECT_SINGLE) {
if (type == SelectType::SINGLE) {
deselectAll();
if (e == 0) {
selState = SelState::NONE;
@ -2748,7 +2748,7 @@ void Score::select(Element* e, SelectType type, int staffIdx)
}
else {
if (e->type() == Element::ElementType::MEASURE) {
select(e, SELECT_RANGE, staffIdx);
select(e, SelectType::RANGE, staffIdx);
return;
}
refresh |= e->abbox();
@ -2765,7 +2765,7 @@ void Score::select(Element* e, SelectType type, int staffIdx)
_selection.setActiveSegment(0);
_selection.setActiveTrack(0);
}
else if (type == SELECT_ADD) {
else if (type == SelectType::ADD) {
if (e->type() == Element::ElementType::MEASURE) {
Measure* m = static_cast<Measure*>(e);
int tick = m->tick();
@ -2776,7 +2776,7 @@ void Score::select(Element* e, SelectType type, int staffIdx)
_selection.setEndSegment(m == lastMeasure() ? 0 : m->last());
}
else {
select(0, SELECT_SINGLE, 0);
select(0, SelectType::SINGLE, 0);
return;
}
_updateAll = true;
@ -2787,7 +2787,7 @@ void Score::select(Element* e, SelectType type, int staffIdx)
}
else {
if (_selection.state() == SelState::RANGE) {
select(0, SELECT_SINGLE, 0);
select(0, SelectType::SINGLE, 0);
return;
}
else {
@ -2801,7 +2801,7 @@ void Score::select(Element* e, SelectType type, int staffIdx)
}
}
}
else if (type == SELECT_RANGE) {
else if (type == SelectType::RANGE) {
bool activeIsFirst = false;
int activeTrack = e->track();
if (e->type() == Element::ElementType::MEASURE) {
@ -2872,11 +2872,11 @@ void Score::select(Element* e, SelectType type, int staffIdx)
break;
}
if (el)
select(el, SELECT_RANGE, staffIdx);
select(el, SelectType::RANGE, staffIdx);
return;
}
else {
qDebug("SELECT_RANGE: measure: sel state %d", _selection.state());
qDebug("SelectType::RANGE: measure: sel state %d", _selection.state());
return;
}
}
@ -2930,7 +2930,7 @@ void Score::select(Element* e, SelectType type, int staffIdx)
}
}
else {
select(e, SELECT_SINGLE, 0);
select(e, SelectType::SINGLE, 0);
return;
}
}
@ -2974,7 +2974,7 @@ void Score::select(Element* e, SelectType type, int staffIdx)
_selection.setStartSegment(cr->segment());
}
else {
select(e, SELECT_SINGLE, staffIdx);
select(e, SelectType::SINGLE, staffIdx);
return;
}
@ -2997,7 +2997,7 @@ void Score::select(Element* e, SelectType type, int staffIdx)
void Score::lassoSelect(const QRectF& bbox)
{
select(0, SELECT_SINGLE, 0);
select(0, SelectType::SINGLE, 0);
QRectF fr(bbox.normalized());
foreach(Page* page, _pages) {
QRectF pr(page->bbox());
@ -3012,7 +3012,7 @@ void Score::lassoSelect(const QRectF& bbox)
Element* e = el.at(i);
if (frr.contains(e->abbox())) {
if (e->type() != Element::ElementType::MEASURE && e->selectable())
select(e, SELECT_ADD, 0);
select(e, SelectType::ADD, 0);
}
}
}

View file

@ -614,7 +614,7 @@ class Score : public QObject {
ChordRest* getSelectedChordRest() const;
void getSelectedChordRest2(ChordRest** cr1, ChordRest** cr2) const;
void select(Element* obj, SelectType = SELECT_SINGLE, int staff = 0);
void select(Element* obj, SelectType = SelectType::SINGLE, int staff = 0);
void deselect(Element* obj);
void deselectAll() { _selection.deselectAll(); }
void updateSelection() { _selection.update(); }

View file

@ -1803,7 +1803,7 @@ void ShowElementBase::selectedClicked(bool val)
{
QRectF r(el->abbox());
if (val)
el->score()->select(el, SELECT_ADD, 0);
el->score()->select(el, SelectType::ADD, 0);
else
el->score()->deselect(el);
el->score()->addRefresh(r | el->abbox());

View file

@ -407,7 +407,7 @@ void ScoreView::dropEvent(QDropEvent* event)
Element* dropElement = el->drop(dropData);
_score->addRefresh(el->canvasBoundingRect());
if (dropElement) {
_score->select(dropElement, SELECT_SINGLE, 0);
_score->select(dropElement, SelectType::SINGLE, 0);
_score->addRefresh(dropElement->canvasBoundingRect());
}
}
@ -475,7 +475,7 @@ void ScoreView::dropEvent(QDropEvent* event)
_score->addRefresh(el->canvasBoundingRect());
if (dropElement) {
if (!_score->noteEntryMode())
_score->select(dropElement, SELECT_SINGLE, 0);
_score->select(dropElement, SelectType::SINGLE, 0);
_score->addRefresh(dropElement->canvasBoundingRect());
}
event->acceptProposedAction();

View file

@ -257,17 +257,17 @@ void DrumrollEditor::selectionChanged()
QGraphicsItem* item = items[0];
Note* note = static_cast<Note*>(item->data(0).value<void*>());
if (note)
_score->select(note, SELECT_SINGLE, 0);
_score->select(note, SelectType::SINGLE, 0);
}
else if (items.size() == 0) {
_score->select(0, SELECT_SINGLE, 0);
_score->select(0, SelectType::SINGLE, 0);
}
else {
_score->select(0, SELECT_SINGLE, 0);
_score->select(0, SelectType::SINGLE, 0);
foreach(QGraphicsItem* item, items) {
Note* note = static_cast<Note*>(item->data(0).value<void*>());
if (note)
_score->select(note, SELECT_ADD, 0);
_score->select(note, SelectType::ADD, 0);
}
}
_score->setUpdateAll();

View file

@ -51,7 +51,7 @@ void ScoreView::lyricsUpDown(bool up, bool end)
_score->undoAddElement(lyrics);
}
_score->select(lyrics, SELECT_SINGLE, 0);
_score->select(lyrics, SelectType::SINGLE, 0);
startEdit(lyrics, -1);
mscore->changeState(mscoreState());
adjustCanvasPosition(lyrics, false);
@ -159,7 +159,7 @@ void ScoreView::lyricsTab(bool back, bool end, bool moveOnly)
if (newLyrics)
_score->undoAddElement(lyrics);
_score->select(lyrics, SELECT_SINGLE, 0);
_score->select(lyrics, SelectType::SINGLE, 0);
startEdit(lyrics, -1);
mscore->changeState(mscoreState());
@ -248,7 +248,7 @@ void ScoreView::lyricsMinus()
if(newLyrics)
_score->undoAddElement(lyrics);
_score->select(lyrics, SELECT_SINGLE, 0);
_score->select(lyrics, SelectType::SINGLE, 0);
startEdit(lyrics, -1);
mscore->changeState(mscoreState());
@ -337,7 +337,7 @@ void ScoreView::lyricsUnderscore()
if (newLyrics)
_score->undoAddElement(lyrics);
_score->select(lyrics, SELECT_SINGLE, 0);
_score->select(lyrics, SelectType::SINGLE, 0);
startEdit(lyrics, -1);
mscore->changeState(mscoreState());
@ -368,7 +368,7 @@ void ScoreView::lyricsReturn()
lyrics->setParent(segment->element(oldLyrics->track()));
lyrics->setNo(oldLyrics->no() + 1);
_score->undoAddElement(lyrics);
_score->select(lyrics, SELECT_SINGLE, 0);
_score->select(lyrics, SelectType::SINGLE, 0);
startEdit(lyrics, -1);
mscore->changeState(mscoreState());

View file

@ -686,7 +686,7 @@ void MuseScore::newFile()
for (Segment* s = m->first(); s; s = s->next()) {
if (s->segmentType() == Segment::SegChordRest) {
if (s->element(0)) {
score->select(s->element(0), SELECT_SINGLE, 0);
score->select(s->element(0), SelectType::SINGLE, 0);
break;
}
}

View file

@ -217,7 +217,7 @@ void MeasureProperties::apply()
if (m->len() != len())
m->adjustToLen(len());
score->select(0, SELECT_SINGLE, 0);
score->select(0, SelectType::SINGLE, 0);
score->end();
}
}

View file

@ -3759,9 +3759,9 @@ void MuseScore::selectSimilar(Element* e, bool sameStaff)
score->scanElements(&pattern, collectMatch);
score->select(0, SELECT_SINGLE, 0);
score->select(0, SelectType::SINGLE, 0);
foreach(Element* e, pattern.el) {
score->select(e, SELECT_ADD, 0);
score->select(e, SelectType::ADD, 0);
}
if (score->selectionChanged()) {
score->setSelectionChanged(false);
@ -3783,23 +3783,23 @@ void MuseScore::selectElementDialog(Element* e)
sd.setPattern(&pattern);
score->scanElements(&pattern, collectMatch);
if (sd.doReplace()) {
score->select(0, SELECT_SINGLE, 0);
score->select(0, SelectType::SINGLE, 0);
foreach(Element* ee, pattern.el)
score->select(ee, SELECT_ADD, 0);
score->select(ee, SelectType::ADD, 0);
}
else if (sd.doSubtract()) {
QList<Element*> sl(score->selection().elements());
foreach(Element* ee, pattern.el)
sl.removeOne(ee);
score->select(0, SELECT_SINGLE, 0);
score->select(0, SelectType::SINGLE, 0);
foreach(Element* ee, sl)
score->select(ee, SELECT_ADD, 0);
score->select(ee, SelectType::ADD, 0);
}
else if (sd.doAdd()) {
QList<Element*> sl(score->selection().elements());
foreach(Element* ee, pattern.el) {
if(!sl.contains(ee))
score->select(ee, SELECT_ADD, 0);
score->select(ee, SelectType::ADD, 0);
}
}
if (score->selectionChanged()) {

View file

@ -273,7 +273,7 @@ static void applyDrop(Score* score, ScoreView* viewer, Element* target, Element*
ne = target->drop(dropData);
if (ne)
score->select(ne, SELECT_SINGLE, 0);
score->select(ne, SelectType::SINGLE, 0);
viewer->setDropTarget(0); // acceptDrop sets dropTarget
}
}

View file

@ -337,17 +337,17 @@ void PianorollEditor::selectionChanged()
QGraphicsItem* item = items[0];
if (item->type() == PianoItemType) {
Note* note = static_cast<PianoItem*>(item)->note();
_score->select(note, SELECT_SINGLE, 0);
_score->select(note, SelectType::SINGLE, 0);
}
}
else if (items.size() == 0)
_score->select(0, SELECT_SINGLE, 0);
_score->select(0, SelectType::SINGLE, 0);
else {
_score->deselectAll();
for (QGraphicsItem* item : items) {
if (item->type() == PianoItemType) {
Note* note = static_cast<PianoItem*>(item)->note();
_score->select(note, SELECT_ADD, 0);
_score->select(note, SelectType::ADD, 0);
}
}
}

View file

@ -346,7 +346,7 @@ void ScoreView::elementPropertyAction(const QString& cmd, Element* e)
s->setTextStyleType(TEXT_STYLE_FRAME);
s->setParent(e);
score()->undoAddElement(s);
score()->select(s, SELECT_SINGLE, 0);
score()->select(s, SelectType::SINGLE, 0);
startEdit(s);
score()->setLayoutAll(true);
}
@ -358,7 +358,7 @@ void ScoreView::elementPropertyAction(const QString& cmd, Element* e)
t->setTextStyleType(TEXT_STYLE_FRAME);
t->setParent(e);
score()->undoAddElement(t);
score()->select(t, SELECT_SINGLE, 0);
score()->select(t, SelectType::SINGLE, 0);
startEdit(t);
}
else if (cmd == "title-text") {
@ -366,7 +366,7 @@ void ScoreView::elementPropertyAction(const QString& cmd, Element* e)
t->setTextStyleType(TEXT_STYLE_TITLE);
t->setParent(e);
score()->undoAddElement(t);
score()->select(t, SELECT_SINGLE, 0);
score()->select(t, SelectType::SINGLE, 0);
startEdit(t);
}
else if (cmd == "subtitle-text") {
@ -374,7 +374,7 @@ void ScoreView::elementPropertyAction(const QString& cmd, Element* e)
t->setTextStyleType(TEXT_STYLE_SUBTITLE);
t->setParent(e);
score()->undoAddElement(t);
score()->select(t, SELECT_SINGLE, 0);
score()->select(t, SelectType::SINGLE, 0);
startEdit(t);
}
else if (cmd == "composer-text") {
@ -382,7 +382,7 @@ void ScoreView::elementPropertyAction(const QString& cmd, Element* e)
t->setTextStyleType(TEXT_STYLE_COMPOSER);
t->setParent(e);
score()->undoAddElement(t);
score()->select(t, SELECT_SINGLE, 0);
score()->select(t, SelectType::SINGLE, 0);
startEdit(t);
}
else if (cmd == "poet-text") {
@ -390,7 +390,7 @@ void ScoreView::elementPropertyAction(const QString& cmd, Element* e)
t->setTextStyleType(TEXT_STYLE_POET);
t->setParent(e);
score()->undoAddElement(t);
score()->select(t, SELECT_SINGLE, 0);
score()->select(t, SelectType::SINGLE, 0);
startEdit(t);
}
else if (cmd == "insert-hbox") {
@ -399,7 +399,7 @@ void ScoreView::elementPropertyAction(const QString& cmd, Element* e)
s->setBoxWidth(Spatium(w / s->spatium()));
s->setParent(e);
score()->undoAddElement(s);
score()->select(s, SELECT_SINGLE, 0);
score()->select(s, SelectType::SINGLE, 0);
startEdit(s);
}
else if (cmd == "picture")

View file

@ -975,7 +975,7 @@ void ScoreView::objectPopup(const QPoint& pos, Element* obj)
if (obj->type() == Element::ElementType::TEXT && obj->parent() && obj->parent()->type() == Element::ElementType::TUPLET) {
obj = obj->parent();
if (!obj->selected())
obj->score()->select(obj, SELECT_SINGLE, 0);
obj->score()->select(obj, SelectType::SINGLE, 0);
}
QMenu* popup = new QMenu(this);
@ -2746,11 +2746,11 @@ void ScoreView::cmd(const QAction* a)
cmdInsertMeasures(1, Element::ElementType::VBOX);
else if (cmd == "append-hbox") {
MeasureBase* mb = appendMeasure(Element::ElementType::HBOX);
_score->select(mb, SELECT_SINGLE, 0);
_score->select(mb, SelectType::SINGLE, 0);
}
else if (cmd == "append-vbox") {
MeasureBase* mb = appendMeasure(Element::ElementType::VBOX);
_score->select(mb, SELECT_SINGLE, 0);
_score->select(mb, SelectType::SINGLE, 0);
}
else if (cmd == "insert-textframe")
cmdInsertMeasure(Element::ElementType::TBOX);
@ -2766,7 +2766,7 @@ void ScoreView::cmd(const QAction* a)
}
}
if (text) {
_score->select(text, SELECT_SINGLE, 0);
_score->select(text, SelectType::SINGLE, 0);
startEdit(text);
}
}
@ -3035,7 +3035,7 @@ void ScoreView::startNoteEntry()
if (!d.isValid() || d.isZero() || d.type() == TDuration::DurationType::V_MEASURE)
is.setDuration(TDuration(TDuration::DurationType::V_QUARTER));
_score->select(el, SELECT_SINGLE, 0);
_score->select(el, SelectType::SINGLE, 0);
is.update(el);
is.setNoteEntryMode(true);
@ -3106,7 +3106,7 @@ void ScoreView::contextPopup(QContextMenuEvent* ev)
if (e) {
if (!e->selected()) {
// bool control = (ev->modifiers() & Qt::ControlModifier) ? true : false;
// _score->select(e, control ? SELECT_ADD : SELECT_SINGLE, 0);
// _score->select(e, control ? SelectType::ADD : SelectType::SINGLE, 0);
curElement = e;
//TODO? select(ev);
}
@ -3211,11 +3211,11 @@ void ScoreView::select(QMouseEvent* ev)
// may not find the staff and return -1, which would cause
// select() to crash
if (dragStaffIdx >= 0) {
SelectType st = SELECT_SINGLE;
SelectType st = SelectType::SINGLE;
if (keyState == Qt::NoModifier)
st = SELECT_SINGLE;
st = SelectType::SINGLE;
else if (keyState & Qt::ShiftModifier)
st = SELECT_RANGE;
st = SelectType::RANGE;
else if (keyState & Qt::ControlModifier) {
if (curElement->selected() && (ev->type() == QEvent::MouseButtonPress)) {
// do not deselect on ButtonPress, only on ButtonRelease
@ -3223,7 +3223,7 @@ void ScoreView::select(QMouseEvent* ev)
return;
}
addSelect = true;
st = SELECT_ADD;
st = SelectType::ADD;
}
_score->select(curElement, st, dragStaffIdx);
if (curElement && curElement->type() == Element::ElementType::NOTE) {
@ -4284,7 +4284,7 @@ void ScoreView::cmdCreateTuplet( ChordRest* cr, Tuplet* tuplet)
else if (ne > 1)
el = cl[1];
if (el) {
_score->select(el, SELECT_SINGLE, 0);
_score->select(el, SelectType::SINGLE, 0);
if (!noteEntryMode()) {
sm->postEvent(new CommandEvent("note-input"));
qApp->processEvents();
@ -4351,7 +4351,7 @@ void ScoreView::changeVoice(int voice)
}
score()->selection().clear();
foreach(Element* e, el)
score()->select(e, SELECT_ADD, -1);
score()->select(e, SelectType::ADD, -1);
score()->setLayoutAll(true);
score()->endCmd();
}
@ -4469,7 +4469,7 @@ void ScoreView::harmonyTab(bool back)
_score->undoAddElement(harmony);
}
_score->select(harmony, SELECT_SINGLE, 0);
_score->select(harmony, SelectType::SINGLE, 0);
startEdit(harmony, -1);
mscore->changeState(mscoreState());
@ -4567,7 +4567,7 @@ void ScoreView::harmonyBeatsTab(bool noterest, bool back)
_score->undoAddElement(harmony);
}
_score->select(harmony, SELECT_SINGLE, 0);
_score->select(harmony, SelectType::SINGLE, 0);
startEdit(harmony, -1);
mscore->changeState(mscoreState());
@ -4638,7 +4638,7 @@ void ScoreView::harmonyTicksTab(int ticks)
_score->undoAddElement(harmony);
}
_score->select(harmony, SELECT_SINGLE, 0);
_score->select(harmony, SelectType::SINGLE, 0);
startEdit(harmony, -1);
mscore->changeState(mscoreState());
@ -4891,7 +4891,7 @@ void ScoreView::cmdAddChordName()
harmony->setParent(cr->segment());
_score->undoAddElement(harmony);
_score->select(harmony, SELECT_SINGLE, 0);
_score->select(harmony, SelectType::SINGLE, 0);
startEdit(harmony);
_score->setLayoutAll(true);
_score->update();
@ -4960,7 +4960,7 @@ void ScoreView::cmdAddText(int type)
if (s) {
_score->undoAddElement(s);
_score->setLayoutAll(true);
_score->select(s, SELECT_SINGLE, 0);
_score->select(s, SelectType::SINGLE, 0);
_score->endCmd();
startEdit(s);
}
@ -5054,7 +5054,7 @@ void ScoreView::cmdInsertMeasures(int n, Element::ElementType type)
// measure may be part of mm rest:
if (!_score->styleB(StyleIdx::createMultiMeasureRests) && type == Element::ElementType::MEASURE)
_score->select(mb, SELECT_SINGLE, 0);
_score->select(mb, SelectType::SINGLE, 0);
_score->endCmd();
}
@ -5072,13 +5072,13 @@ void ScoreView::cmdInsertMeasure(Element::ElementType type)
if (mb->type() == Element::ElementType::TBOX) {
TBox* tbox = static_cast<TBox*>(mb);
Text* s = tbox->getText();
_score->select(s, SELECT_SINGLE, 0);
_score->select(s, SelectType::SINGLE, 0);
_score->endCmd();
startEdit(s);
return;
}
if (mb)
_score->select(mb, SELECT_SINGLE, 0);
_score->select(mb, SelectType::SINGLE, 0);
_score->endCmd();
}
@ -5273,7 +5273,7 @@ void ScoreView::gotoMeasure(Measure* measure)
else //REST
e = cr;
_score->select(e, SELECT_SINGLE, 0);
_score->select(e, SelectType::SINGLE, 0);
break;
}
}
@ -5377,7 +5377,7 @@ void ScoreView::figuredBassTab(bool bMeas, bool bBack)
FiguredBass * fbNew = FiguredBass::addFiguredBassToSegment(nextSegm, track, 0, &bNew);
if (bNew)
_score->undoAddElement(fbNew);
_score->select(fbNew, SELECT_SINGLE, 0);
_score->select(fbNew, SelectType::SINGLE, 0);
startEdit(fbNew, -1);
mscore->changeState(mscoreState());
adjustCanvasPosition(fbNew, false);
@ -5433,7 +5433,7 @@ void ScoreView::figuredBassTicksTab(int ticks)
FiguredBass * fbNew = FiguredBass::addFiguredBassToSegment(nextSegm, track, ticks, &bNew);
if (bNew)
_score->undoAddElement(fbNew);
_score->select(fbNew, SELECT_SINGLE, 0);
_score->select(fbNew, SelectType::SINGLE, 0);
startEdit(fbNew, -1);
mscore->changeState(mscoreState());
adjustCanvasPosition(fbNew, false);

View file

@ -88,7 +88,7 @@ void TestChordSymbol::testClear()
{
Score* score = test_pre("clear");
Measure* m = score->firstMeasure();
score->select(m, SELECT_SINGLE, 0);
score->select(m, SelectType::SINGLE, 0);
score->cmdDeleteSelection();
score->doLayout();
test_post(score, "clear");

View file

@ -188,7 +188,7 @@ void TestCopyPaste::copypastestaff(const char* idx)
QVERIFY(m1 != 0);
QVERIFY(m2 != 0);
score->select(m2, SELECT_RANGE, 0);
score->select(m2, SelectType::RANGE, 0);
QVERIFY(score->selection().canCopy());
QString mimeType = score->selection().mimeType();
QVERIFY(!mimeType.isEmpty());
@ -198,7 +198,7 @@ void TestCopyPaste::copypastestaff(const char* idx)
score->deselectAll();
score->select(m2, SELECT_RANGE, 1);
score->select(m2, SelectType::RANGE, 1);
paste(score);
score->doLayout();
@ -217,7 +217,7 @@ void TestCopyPaste::copyPastePartial() {
s = s->next(Segment::SegChordRest);
score->select(s->element(0));
s = s->next(Segment::SegChordRest);
score->select(s->element(4), SelectType::SELECT_RANGE);
score->select(s->element(4), SelectType::RANGE);
QVERIFY(score->selection().canCopy());
QString mimeType = score->selection().mimeType();

View file

@ -123,7 +123,7 @@ void TestCopyPasteSymbolList::copypaste(const char* name, const char* idx)
pattern.system = nullptr;
score->scanElements(&pattern, collectMatch);
foreach(Element* e, pattern.el) {
score->select(e, SELECT_ADD, 0);
score->select(e, SelectType::ADD, 0);
}
// copy selection to clipboard