Skip to content

Commit

Permalink
link note attached elements for parts
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Jul 10, 2014
1 parent 8fcdf0d commit 25f25dd
Show file tree
Hide file tree
Showing 21 changed files with 2,351 additions and 2,342 deletions.
4 changes: 1 addition & 3 deletions libmscore/chord.cpp
Expand Up @@ -210,10 +210,8 @@ Chord::Chord(const Chord& c, bool link)
int n = c._notes.size();
for (int i = 0; i < n; ++i) {
Note* onote = c._notes[i];
Note* nnote = new Note(*onote);
Note* nnote = new Note(*onote, link);
add(nnote);
if (link)
nnote->linkTo(onote);
}

for (Chord* gn : c.graceNotes()) {
Expand Down
1 change: 1 addition & 0 deletions libmscore/edit.cpp
Expand Up @@ -1578,6 +1578,7 @@ void Score::deleteItem(Element* el)
case Element::Type::SLUR_SEGMENT:
case Element::Type::PEDAL_SEGMENT:
el = static_cast<SpannerSegment*>(el)->spanner();

default:
undoRemoveElement(el);
break;
Expand Down
13 changes: 10 additions & 3 deletions libmscore/note.cpp
Expand Up @@ -209,9 +209,11 @@ Note::~Note()
delete _dots[2];
}

Note::Note(const Note& n)
Note::Note(const Note& n, bool link)
: Element(n)
{
if (link)
linkTo((Note*)&n); // HACK!
_subchannel = n._subchannel;
_line = n._line;
_fret = n._fret;
Expand All @@ -238,8 +240,13 @@ Note::Note(const Note& n)
if (n._accidental)
add(new Accidental(*(n._accidental)));

for (const Element* e : n._el)
add(e->clone());
// types in _el: SYMBOL, IMAGE, FINGERING, TEXT, BEND
for (Element* e : n._el) {
Element* ce = e->clone();
add(ce);
if (link)
ce->linkTo(e);
}

_playEvents = n._playEvents;

Expand Down
9 changes: 5 additions & 4 deletions libmscore/note.h
Expand Up @@ -227,11 +227,12 @@ class Note : public Element {

public:
Note(Score* s = 0);
Note(const Note&);
Note& operator=(const Note&) = delete;
Note(const Note&, bool link = false);
~Note();
Note* clone() const { return new Note(*this); }
Element::Type type() const { return Element::Type::NOTE; }

Note& operator=(const Note&) = delete;
virtual Note* clone() const { return new Note(*this, false); }
Element::Type type() const { return Element::Type::NOTE; }

virtual qreal mag() const;

Expand Down
2 changes: 1 addition & 1 deletion mscore/importgtp.cpp
Expand Up @@ -350,7 +350,7 @@ void GuitarPro::readBend(Note* note)
// there are no notes in the bend, exit the function
if (numPoints == 0)
return;
Bend* bend = new Bend(gscore);
Bend* bend = new Bend(note->score());
for (int i = 0; i < numPoints; ++i) {
int bendTime = readInt();
int bendPitch = readInt();
Expand Down
18 changes: 9 additions & 9 deletions mtest/guitarpro/basic-bend.gp5-ref.mscx
Expand Up @@ -123,15 +123,15 @@
</Note>
</Chord>
<Rest>
<lid>7</lid>
<lid>8</lid>
<durationType>quarter</durationType>
</Rest>
<Rest>
<lid>8</lid>
<lid>9</lid>
<durationType>quarter</durationType>
</Rest>
<Rest>
<lid>9</lid>
<lid>10</lid>
<durationType>quarter</durationType>
</Rest>
<BarLine>
Expand Down Expand Up @@ -284,15 +284,15 @@
</Note>
</Chord>
<Rest>
<lid>7</lid>
<lid>8</lid>
<durationType>quarter</durationType>
</Rest>
<Rest>
<lid>8</lid>
<lid>9</lid>
<durationType>quarter</durationType>
</Rest>
<Rest>
<lid>9</lid>
<lid>10</lid>
<durationType>quarter</durationType>
</Rest>
<BarLine>
Expand Down Expand Up @@ -328,15 +328,15 @@
</Note>
</Chord>
<Rest>
<lid>7</lid>
<lid>8</lid>
<durationType>quarter</durationType>
</Rest>
<Rest>
<lid>8</lid>
<lid>9</lid>
<durationType>quarter</durationType>
</Rest>
<Rest>
<lid>9</lid>
<lid>10</lid>
<durationType>quarter</durationType>
</Rest>
<BarLine>
Expand Down
72 changes: 36 additions & 36 deletions mtest/guitarpro/bend.gp3-ref.mscx
Expand Up @@ -133,11 +133,11 @@
</Note>
</Chord>
<Chord>
<lid>7</lid>
<lid>8</lid>
<durationType>eighth</durationType>
<Beam>1</Beam>
<Note>
<lid>8</lid>
<lid>9</lid>
<Tie id="3">
</Tie>
<endSpanner id="2"/>
Expand All @@ -148,10 +148,10 @@
</Note>
</Chord>
<Chord>
<lid>9</lid>
<lid>10</lid>
<durationType>half</durationType>
<Note>
<lid>10</lid>
<lid>11</lid>
<endSpanner id="3"/>
<pitch>65</pitch>
<tpc>13</tpc>
Expand All @@ -162,10 +162,10 @@
</Measure>
<Measure number="2">
<Chord>
<lid>12</lid>
<lid>13</lid>
<durationType>half</durationType>
<Note>
<lid>13</lid>
<lid>14</lid>
<Bend>
<point time="0" pitch="0" vibrato="0"/>
<point time="15" pitch="100" vibrato="0"/>
Expand All @@ -180,10 +180,10 @@
</Note>
</Chord>
<Chord>
<lid>14</lid>
<lid>16</lid>
<durationType>half</durationType>
<Note>
<lid>15</lid>
<lid>17</lid>
<Bend>
<point time="0" pitch="0" vibrato="0"/>
<point time="30" pitch="100" vibrato="0"/>
Expand All @@ -198,10 +198,10 @@
</Measure>
<Measure number="3">
<Chord>
<lid>17</lid>
<lid>20</lid>
<durationType>half</durationType>
<Note>
<lid>18</lid>
<lid>21</lid>
<Bend>
<point time="0" pitch="100" vibrato="0"/>
<point time="60" pitch="100" vibrato="0"/>
Expand All @@ -213,10 +213,10 @@
</Note>
</Chord>
<Chord>
<lid>19</lid>
<lid>23</lid>
<durationType>half</durationType>
<Note>
<lid>20</lid>
<lid>24</lid>
<Bend>
<point time="0" pitch="100" vibrato="0"/>
<point time="20" pitch="100" vibrato="0"/>
Expand Down Expand Up @@ -389,11 +389,11 @@
</Note>
</Chord>
<Chord>
<lid>7</lid>
<lid>8</lid>
<durationType>eighth</durationType>
<Beam>2</Beam>
<Note>
<lid>8</lid>
<lid>9</lid>
<Tie id="5">
</Tie>
<endSpanner id="4"/>
Expand All @@ -404,10 +404,10 @@
</Note>
</Chord>
<Chord>
<lid>9</lid>
<lid>10</lid>
<durationType>half</durationType>
<Note>
<lid>10</lid>
<lid>11</lid>
<endSpanner id="5"/>
<pitch>65</pitch>
<tpc>13</tpc>
Expand All @@ -418,10 +418,10 @@
</Measure>
<Measure number="2">
<Chord>
<lid>12</lid>
<lid>13</lid>
<durationType>half</durationType>
<Note>
<lid>13</lid>
<lid>14</lid>
<Bend>
<point time="0" pitch="0" vibrato="0"/>
<point time="15" pitch="100" vibrato="0"/>
Expand All @@ -436,10 +436,10 @@
</Note>
</Chord>
<Chord>
<lid>14</lid>
<lid>16</lid>
<durationType>half</durationType>
<Note>
<lid>15</lid>
<lid>17</lid>
<Bend>
<point time="0" pitch="0" vibrato="0"/>
<point time="30" pitch="100" vibrato="0"/>
Expand All @@ -454,10 +454,10 @@
</Measure>
<Measure number="3">
<Chord>
<lid>17</lid>
<lid>20</lid>
<durationType>half</durationType>
<Note>
<lid>18</lid>
<lid>21</lid>
<Bend>
<point time="0" pitch="100" vibrato="0"/>
<point time="60" pitch="100" vibrato="0"/>
Expand All @@ -469,10 +469,10 @@
</Note>
</Chord>
<Chord>
<lid>19</lid>
<lid>23</lid>
<durationType>half</durationType>
<Note>
<lid>20</lid>
<lid>24</lid>
<Bend>
<point time="0" pitch="100" vibrato="0"/>
<point time="20" pitch="100" vibrato="0"/>
Expand Down Expand Up @@ -536,11 +536,11 @@
</Note>
</Chord>
<Chord>
<lid>7</lid>
<lid>8</lid>
<durationType>eighth</durationType>
<Beam>3</Beam>
<Note>
<lid>8</lid>
<lid>9</lid>
<Tie id="7">
</Tie>
<endSpanner id="6"/>
Expand All @@ -551,10 +551,10 @@
</Note>
</Chord>
<Chord>
<lid>9</lid>
<lid>10</lid>
<durationType>half</durationType>
<Note>
<lid>10</lid>
<lid>11</lid>
<endSpanner id="7"/>
<pitch>65</pitch>
<tpc>13</tpc>
Expand All @@ -565,10 +565,10 @@
</Measure>
<Measure number="2">
<Chord>
<lid>12</lid>
<lid>13</lid>
<durationType>half</durationType>
<Note>
<lid>13</lid>
<lid>14</lid>
<Bend>
<point time="0" pitch="0" vibrato="0"/>
<point time="15" pitch="100" vibrato="0"/>
Expand All @@ -583,10 +583,10 @@
</Note>
</Chord>
<Chord>
<lid>14</lid>
<lid>16</lid>
<durationType>half</durationType>
<Note>
<lid>15</lid>
<lid>17</lid>
<Bend>
<point time="0" pitch="0" vibrato="0"/>
<point time="30" pitch="100" vibrato="0"/>
Expand All @@ -601,10 +601,10 @@
</Measure>
<Measure number="3">
<Chord>
<lid>17</lid>
<lid>20</lid>
<durationType>half</durationType>
<Note>
<lid>18</lid>
<lid>21</lid>
<Bend>
<point time="0" pitch="100" vibrato="0"/>
<point time="60" pitch="100" vibrato="0"/>
Expand All @@ -616,10 +616,10 @@
</Note>
</Chord>
<Chord>
<lid>19</lid>
<lid>23</lid>
<durationType>half</durationType>
<Note>
<lid>20</lid>
<lid>24</lid>
<Bend>
<point time="0" pitch="100" vibrato="0"/>
<point time="20" pitch="100" vibrato="0"/>
Expand Down

0 comments on commit 25f25dd

Please sign in to comment.