partial fix for #23324

This commit is contained in:
ws 2014-06-27 13:41:49 +02:00
parent b42d129364
commit b70f9b8766
19 changed files with 84 additions and 73 deletions

View file

@ -77,7 +77,7 @@ class Articulation : public Element {
public:
Articulation(Score*);
Articulation &operator=(const Articulation&);
Articulation &operator=(const Articulation&) = delete;
virtual Articulation* clone() const { return new Articulation(*this); }
virtual Element::Type type() const { return Element::Type::ARTICULATION; }

View file

@ -62,7 +62,7 @@ class BarLine : public Element {
public:
BarLine(Score*);
BarLine &operator=(const BarLine&);
BarLine &operator=(const BarLine&) = delete;
virtual BarLine* clone() const { return new BarLine(*this); }
virtual Element::Type type() const { return Element::Type::BAR_LINE; }

View file

@ -36,7 +36,7 @@ class BSymbol : public Element, public ElementLayout {
BSymbol(Score* s);
BSymbol(const BSymbol&);
BSymbol &operator=(const BSymbol&);
BSymbol &operator=(const BSymbol&) = delete;
virtual void add(Element*);
virtual void remove(Element*);

View file

@ -201,16 +201,24 @@ Chord::Chord(Score* s)
setFlags(ElementFlag::MOVABLE | ElementFlag::ON_STAFF);
}
Chord::Chord(const Chord& c)
: ChordRest(c)
Chord::Chord(const Chord& c, bool link)
: ChordRest(c, link)
{
if (link)
linkTo((Chord*)&c); // HACK!
_ledgerLines = 0;
int n = c._notes.size();
for (int i = 0; i < n; ++i)
add(new Note(*c._notes.at(i)));
for (int i = 0; i < n; ++i) {
Note* onote = c._notes[i];
Note* nnote = new Note(*onote);
add(nnote);
if (link)
nnote->linkTo(onote);
}
for (Chord* gn : c.graceNotes()) {
add(new Chord(*gn));
Chord* nc = new Chord(*gn, link);
add(nc);
}
_stem = 0;
@ -223,52 +231,45 @@ Chord::Chord(const Chord& c)
_graceIndex = c._graceIndex;
_noStem = c._noStem;
_playEventType = c._playEventType;
_stemDirection = c._stemDirection;
_noteType = c._noteType;
_crossMeasure = CrossMeasure::UNKNOWN;
if (c._stem)
add(new Stem(*(c._stem)));
if (c._hook)
add(new Hook(*(c._hook)));
if (c._glissando)
add(new Glissando(*(c._glissando)));
if (c._arpeggio)
add(new Arpeggio(*(c._arpeggio)));
if (c._stemSlash)
add(new StemSlash(*(c._stemSlash)));
_stemDirection = c._stemDirection;
if (c._tremolo && !c._tremolo->twoNotes())
add(new Tremolo(*(c._tremolo)));
_noteType = c._noteType;
_crossMeasure = CrossMeasure::UNKNOWN;
if (c._glissando) {
Glissando* g = new Glissando(*(c._glissando));
add(g);
if (link)
g->linkTo(c._glissando);
}
if (c._arpeggio) {
Arpeggio* a = new Arpeggio(*(c._arpeggio));
add(a);
if (link)
a->linkTo(c._arpeggio);
}
if (c._tremolo && !c._tremolo->twoNotes()) {
Tremolo* t = new Tremolo(*(c._tremolo));
add(t);
if (link)
t->linkTo(c._tremolo);
}
for (Element* e : c.el()) {
if (e->type() == Element::Type::CHORDLINE) {
ChordLine* cl = static_cast<ChordLine*>(e);
add(new ChordLine(*cl));
}
// TODO deal with slurs
}
}
//---------------------------------------------------------
// linkedClone
//---------------------------------------------------------
Chord* Chord::linkedClone()
{
Chord* chord = new Chord(*this);
linkTo(chord);
int n = notes().size();
for (int i = 0; i < n; ++i)
_notes[i]->linkTo(chord->_notes[i]);
n = _graceNotes.size();
for (int i = 0; i < n; ++i)
_graceNotes[i]->linkTo(chord->_graceNotes[i]);
for (int i = 0; i < _el.size(); ++i) { // TODO deal with slurs
if (_el[i]->type() == Element::Type::CHORDLINE) {
_el[i]->linkTo(chord->el()[i]);
ChordLine* cl = static_cast<ChordLine*>(e);
ChordLine* ncl = new ChordLine(*cl);
add(ncl);
if (link)
cl->linkTo(ncl);
}
}
return chord;
}
//---------------------------------------------------------

View file

@ -101,12 +101,12 @@ class Chord : public ChordRest {
public:
Chord(Score* s = 0);
Chord(const Chord&);
Chord(const Chord&, bool link = false);
~Chord();
Chord &operator=(const Chord&);
Chord &operator=(const Chord&) = delete;
virtual Chord* clone() const { return new Chord(*this); }
virtual Chord* linkedClone();
virtual Chord* clone() const { return new Chord(*this, false); }
virtual Chord* linkedClone() { return new Chord(*this, true); }
virtual void setScore(Score* s);
virtual Element::Type type() const { return Element::Type::CHORD; }

View file

@ -74,7 +74,7 @@ ChordRest::ChordRest(Score* s)
_crossMeasure = CrossMeasure::UNKNOWN;
}
ChordRest::ChordRest(const ChordRest& cr)
ChordRest::ChordRest(const ChordRest& cr, bool link)
: DurationElement(cr)
{
_durationType = cr._durationType;
@ -83,8 +83,10 @@ ChordRest::ChordRest(const ChordRest& cr)
_tabDur = 0; // tab sur. symb. depends upon context: can't be
// simply copied from another CR
for (const Articulation* a : cr._articulations) { // make deep copy
for (Articulation* a : cr._articulations) { // make deep copy
Articulation* na = new Articulation(*a);
if (link)
na->linkTo(a);
na->setParent(this);
na->setTrack(track());
_articulations.append(na);
@ -96,10 +98,12 @@ ChordRest::ChordRest(const ChordRest& cr)
_crossMeasure = cr._crossMeasure;
_space = cr._space;
foreach(Lyrics* l, cr._lyricsList) { // make deep copy
foreach (Lyrics* l, cr._lyricsList) { // make deep copy
if (l == 0)
continue;
Lyrics* nl = new Lyrics(*l);
if (link)
nl->linkTo(l);
nl->setParent(this);
nl->setTrack(track());
_lyricsList.append(nl);

View file

@ -73,8 +73,8 @@ class ChordRest : public DurationElement {
public:
ChordRest(Score*);
ChordRest(const ChordRest&);
ChordRest &operator=(const ChordRest&);
ChordRest(const ChordRest&, bool link = false);
ChordRest &operator=(const ChordRest&) = delete;
~ChordRest();
virtual Element::Type type() const = 0;
virtual Element* drop(const DropData&);

View file

@ -311,7 +311,7 @@ class Element : public QObject {
Element(Score* s = 0);
Element(const Element&);
virtual ~Element();
Element &operator=(const Element&);
Element &operator=(const Element&) = delete;
Q_INVOKABLE virtual Ms::Element* clone() const = 0;
virtual Element* linkedClone();
QList<Element*> linkList() const;

View file

@ -164,7 +164,7 @@ class FiguredBassItem : public Element {
FiguredBassItem(const FiguredBassItem&);
~FiguredBassItem();
FiguredBassItem &operator=(const FiguredBassItem&);
FiguredBassItem &operator=(const FiguredBassItem&) = delete;
FiguredBassItem::Modifier MusicXML2Modifier(const QString prefix) const;

View file

@ -35,7 +35,7 @@ class LedgerLine : public Line {
public:
LedgerLine(Score*);
LedgerLine &operator=(const LedgerLine&);
LedgerLine &operator=(const LedgerLine&) = delete;
virtual LedgerLine* clone() const { return new LedgerLine(*this); }
virtual Element::Type type() const{ return Element::Type::LEDGER_LINE; }
virtual QPointF pagePos() const; ///< position in page coordinates

View file

@ -80,7 +80,7 @@ class NoteHead : public Symbol {
};
NoteHead(Score* s) : Symbol(s) {}
NoteHead &operator=(const NoteHead&);
NoteHead &operator=(const NoteHead&) = delete;
virtual NoteHead* clone() const { return new NoteHead(*this); }
virtual Element::Type type() const { return Element::Type::NOTEHEAD; }
@ -228,7 +228,7 @@ class Note : public Element {
public:
Note(Score* s = 0);
Note(const Note&);
Note& operator=(const Note&);
Note& operator=(const Note&) = delete;
~Note();
Note* clone() const { return new Note(*this); }
Element::Type type() const { return Element::Type::NOTE; }

View file

@ -32,7 +32,7 @@ class RepeatMeasure : public Rest {
public:
RepeatMeasure(Score*);
RepeatMeasure &operator=(const RepeatMeasure&);
RepeatMeasure &operator=(const RepeatMeasure&) = delete;
virtual RepeatMeasure* clone() const { return new RepeatMeasure(*this); }
virtual Element::Type type() const { return Element::Type::REPEAT_MEASURE; }
virtual void draw(QPainter*) const;

View file

@ -57,6 +57,16 @@ Rest::Rest(Score* s, const TDuration& d)
setDuration(d.fraction());
}
Rest::Rest(const Rest& r, bool link)
: ChordRest(r, link)
{
if (link)
linkTo((Rest*)&r); // HACK!
_sym = r._sym;
dotline = r.dotline;
_mmWidth = r._mmWidth;
}
//---------------------------------------------------------
// Rest::draw
//---------------------------------------------------------

View file

@ -42,7 +42,11 @@ class Rest : public ChordRest {
public:
Rest(Score* s = 0);
Rest(Score*, const TDuration&);
virtual Rest* clone() const override { return new Rest(*this); }
Rest(const Rest&, bool link = false);
Rest &operator=(const Rest&) = delete;
virtual Rest* clone() const override { return new Rest(*this, false); }
virtual Rest* linkedClone() const { return new Rest(*this, true); }
virtual Element::Type type() const override { return Element::Type::REST; }
virtual Measure* measure() const override { return parent() ? (Measure*)(parent()->parent()) : 0; }

View file

@ -37,7 +37,7 @@ class Stem : public Element {
public:
Stem(Score*);
Stem &operator=(const Stem&);
Stem &operator=(const Stem&) = delete;
virtual Stem* clone() const { return new Stem(*this); }
virtual Element::Type type() const { return Element::Type::STEM; }

View file

@ -33,19 +33,11 @@ Symbol::Symbol(Score* s)
setZ(int(Element::Type::SYMBOL) * 100);
}
#if 0
Symbol::Symbol(Score* s, SymId sy)
: BSymbol(s)
{
_sym = sy;
setZ(SYMBOL * 100);
}
#endif
Symbol::Symbol(const Symbol& s)
: BSymbol(s)
{
_sym = s._sym;
_sym = s._sym;
_scoreFont = s._scoreFont;
setZ(int(Element::Type::SYMBOL) * 100);
}

View file

@ -39,7 +39,7 @@ class Symbol : public BSymbol {
Symbol(Score* s);
Symbol(const Symbol&);
Symbol &operator=(const Symbol&);
Symbol &operator=(const Symbol&) = delete;
virtual Symbol* clone() const { return new Symbol(*this); }
virtual Element::Type type() const { return Element::Type::SYMBOL; }

View file

@ -215,7 +215,7 @@ class Text : public Element {
virtual Element::Type type() const override { return Element::Type::TEXT; }
virtual bool mousePress(const QPointF&, QMouseEvent* ev) override;
Text &operator=(const Text&);
Text &operator=(const Text&) = delete;
virtual void draw(QPainter*) const override;

View file

@ -51,7 +51,7 @@ class Tremolo : public Element {
public:
Tremolo(Score*);
Tremolo(const Tremolo&);
Tremolo &operator=(const Tremolo&);
Tremolo &operator=(const Tremolo&) = delete;
virtual Tremolo* clone() const { return new Tremolo(*this); }
virtual Element::Type type() const { return Element::Type::TREMOLO; }