fix for line editing; fix ottava import from 1.3
This commit is contained in:
parent
136190a49c
commit
839b2dc313
6 changed files with 30 additions and 41 deletions
|
@ -114,7 +114,7 @@ void LineSegment::setGrip(int grip, const QPointF& p)
|
|||
setUserOff(pt);
|
||||
break;
|
||||
}
|
||||
layout();
|
||||
// layout();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -139,7 +139,6 @@ QPointF LineSegment::getGrip(int grip) const
|
|||
return p;
|
||||
}
|
||||
|
||||
#if 0
|
||||
//---------------------------------------------------------
|
||||
// pagePos
|
||||
// return position in canvas coordinates
|
||||
|
@ -152,7 +151,6 @@ QPointF LineSegment::pagePos() const
|
|||
pt += parent()->pos();
|
||||
return pt;
|
||||
}
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------
|
||||
// gripAnchor
|
||||
|
@ -183,8 +181,7 @@ QPointF LineSegment::gripAnchor(int grip) const
|
|||
return QPointF(0, 0);
|
||||
else {
|
||||
System* s;
|
||||
QPointF pt(line()->linePos(grip, &s));
|
||||
return pt + s->pagePos();
|
||||
return line()->linePos(grip, &s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -363,7 +360,7 @@ void LineSegment::editDrag(const EditData& ed)
|
|||
}
|
||||
}
|
||||
}
|
||||
line()->layout();
|
||||
// line()->layout();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -539,8 +536,7 @@ QPointF SLine::linePos(int grip, System** sys)
|
|||
qFatal("Sline::linePos(): anchor not implemented\n");
|
||||
break;
|
||||
}
|
||||
printf("staff %d\n", staffIdx());
|
||||
qreal y = (*sys)->staves()->isEmpty() ? 0.0 : (*sys)->staff(staffIdx())->y();
|
||||
qreal y = (*sys)->staves()->isEmpty() ? 0.0 : (*sys)->staffY(staffIdx());
|
||||
return QPointF(x, y);
|
||||
}
|
||||
|
||||
|
@ -623,8 +619,6 @@ void SLine::layout()
|
|||
|
||||
Measure* m = system->firstMeasure();
|
||||
Segment* mseg = m->first(Segment::SegChordRest);
|
||||
qreal x1 = (mseg ? mseg->pos().x() : 0) + m->pos().x();
|
||||
qreal x2 = system->bbox().right();
|
||||
|
||||
if (sysIdx1 == sysIdx2) {
|
||||
// single segment
|
||||
|
@ -639,16 +633,20 @@ void SLine::layout()
|
|||
// start segment
|
||||
seg->setSpannerSegmentType(SEGMENT_BEGIN);
|
||||
seg->setPos(p1);
|
||||
qreal x2 = system->bbox().right();
|
||||
seg->setPos2(QPointF(x2 - p1.x(), 0.0));
|
||||
}
|
||||
else if (i > 0 && i != sysIdx2) {
|
||||
// middle segment
|
||||
seg->setSpannerSegmentType(SEGMENT_MIDDLE);
|
||||
qreal x1 = (mseg ? mseg->pos().x() : 0) + m->pos().x();
|
||||
qreal x2 = system->bbox().right();
|
||||
seg->setPos(QPointF(x1, p1.y()));
|
||||
seg->setPos2(QPointF(x2 - x1, 0.0));
|
||||
}
|
||||
else if (i == sysIdx2) {
|
||||
// end segment
|
||||
qreal x1 = (mseg ? mseg->pos().x() : 0) + m->pos().x();
|
||||
qreal len = p2.x() - x1;
|
||||
if (anchor() == ANCHOR_SEGMENT)
|
||||
len = qMax(3 * spatium(), len);
|
||||
|
|
|
@ -52,13 +52,13 @@ class LineSegment : public SpannerSegment {
|
|||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
virtual bool isEditable() const { return true; }
|
||||
virtual void editDrag(const EditData&);
|
||||
virtual bool edit(MuseScoreView*, int grip, int key, Qt::KeyboardModifiers, const QString& s);
|
||||
virtual void updateGrips(int*, QRectF*) const;
|
||||
virtual void setGrip(int grip, const QPointF& p);
|
||||
virtual QPointF getGrip(int) const;
|
||||
virtual QPointF gripAnchor(int) const;
|
||||
virtual bool isEditable() const override { return true; }
|
||||
virtual void editDrag(const EditData&) override;
|
||||
virtual bool edit(MuseScoreView*, int grip, int key, Qt::KeyboardModifiers, const QString& s) override;
|
||||
virtual void updateGrips(int*, QRectF*) const override;
|
||||
virtual void setGrip(int grip, const QPointF& p) override;
|
||||
virtual QPointF getGrip(int) const override;
|
||||
virtual QPointF gripAnchor(int) const override;
|
||||
|
||||
public:
|
||||
LineSegment(Score* s);
|
||||
|
@ -66,11 +66,11 @@ class LineSegment : public SpannerSegment {
|
|||
virtual LineSegment* clone() const = 0;
|
||||
virtual void draw(QPainter*) const = 0;
|
||||
SLine* line() const { return (SLine*)spanner(); }
|
||||
virtual void spatiumChanged(qreal, qreal);
|
||||
// virtual QPointF pagePos() const;
|
||||
virtual void spatiumChanged(qreal, qreal) override;
|
||||
virtual QPointF pagePos() const override;
|
||||
|
||||
friend class SLine;
|
||||
virtual void read(XmlReader&);
|
||||
virtual void read(XmlReader&) override;
|
||||
bool readProperties(XmlReader&);
|
||||
|
||||
virtual QVariant getProperty(P_ID id) const override;
|
||||
|
|
|
@ -38,8 +38,8 @@ struct OttavaDefault {
|
|||
|
||||
static const OttavaDefault ottavaDefault[] = {
|
||||
{ octave8va, octave8, QPointF(0.0, .7), 1.0, Element::ABOVE, 12 },
|
||||
{ octave8vb, octave8, QPointF(0.0, -1.0), -1.0, Element::BELOW, -12 },
|
||||
{ octave15ma, octave15, QPointF(0.0, .7), 1.0, Element::ABOVE, 24 },
|
||||
{ octave8vb, octave8, QPointF(0.0, -1.0), -1.0, Element::BELOW, -12 },
|
||||
{ octave15mb, octave15, QPointF(0.0, -1.0), -1.0, Element::BELOW, -24 },
|
||||
{ octave22ma, octave22, QPointF(0.0, .7), 1.0, Element::ABOVE, 36 },
|
||||
{ octave22mb, octave22, QPointF(0.0, -1.0), -1.0, Element::BELOW, -36 }
|
||||
|
@ -56,7 +56,7 @@ void OttavaSegment::layout()
|
|||
qreal yo(score()->styleS(ST_ottavaY).val() * spatium());
|
||||
if (ottava()->placement() == BELOW)
|
||||
yo = -yo + staff()->height();
|
||||
rypos() = yo;
|
||||
rypos() += yo;
|
||||
}
|
||||
adjustReadPos();
|
||||
}
|
||||
|
@ -171,16 +171,6 @@ Ottava::Ottava(Score* s)
|
|||
lineStyleStyle = PropertyStyle::STYLED;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// layout
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Ottava::layout()
|
||||
{
|
||||
setPos(0.0, 0.0);
|
||||
TextLine::layout();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// setOttavaType
|
||||
//---------------------------------------------------------
|
||||
|
@ -400,6 +390,7 @@ void Ottava::undoSetOttavaType(OttavaType val)
|
|||
|
||||
//---------------------------------------------------------
|
||||
// setYoff
|
||||
// used in musicxml import
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Ottava::setYoff(qreal val)
|
||||
|
|
|
@ -39,7 +39,8 @@ class OttavaSegment : public TextLineSegment {
|
|||
protected:
|
||||
|
||||
public:
|
||||
OttavaSegment(Score* s) : TextLineSegment(s) { setFlag(ELEMENT_ON_STAFF, true); }
|
||||
// OttavaSegment(Score* s) : TextLineSegment(s) { setFlag(ELEMENT_ON_STAFF, true); }
|
||||
OttavaSegment(Score* s) : TextLineSegment(s) { }
|
||||
virtual ElementType type() const override { return OTTAVA_SEGMENT; }
|
||||
virtual OttavaSegment* clone() const override { return new OttavaSegment(*this); }
|
||||
Ottava* ottava() const { return (Ottava*)spanner(); }
|
||||
|
@ -104,7 +105,6 @@ class Ottava : public TextLine {
|
|||
void setNumbersOnly(bool val) { _numbersOnly = val; }
|
||||
|
||||
virtual LineSegment* createLineSegment() override;
|
||||
virtual void layout() override;
|
||||
int pitchShift() const { return _pitchShift; }
|
||||
|
||||
virtual void endEdit() override;
|
||||
|
|
|
@ -516,17 +516,17 @@ Score::FileError Score::read114(XmlReader& e)
|
|||
if (s->type() == Element::OTTAVA) {
|
||||
// fix ottava position
|
||||
Ottava* ottava = static_cast<Ottava*>(s);
|
||||
ottava->staff()->updateOttava(ottava);
|
||||
|
||||
int n = ottava->spannerSegments().size();
|
||||
qreal yo(styleS(ST_ottavaY).val() * spatium());
|
||||
if (ottava->placement() == Element::BELOW)
|
||||
yo = -yo + ottava->staff()->height();
|
||||
for (int i = 0; i < n; ++i) {
|
||||
LineSegment* seg = ottava->segmentAt(i);
|
||||
seg->setUserOff(QPointF());
|
||||
seg->setUserOff2(QPointF());
|
||||
#if 0
|
||||
if (!seg->userOff().isNull())
|
||||
seg->setUserYoffset(seg->userOff().y() - styleP(ST_ottavaY));
|
||||
#endif
|
||||
seg->setUserYoffset(seg->userOff().y() - yo);
|
||||
}
|
||||
ottava->staff()->updateOttava(ottava);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ class Accidental;
|
|||
class Spanner;
|
||||
class BarLine;
|
||||
|
||||
#define DEBUG_UNDO
|
||||
// #define DEBUG_UNDO
|
||||
|
||||
#ifdef DEBUG_UNDO
|
||||
#define UNDO_NAME(a) virtual const char* name() const { return a; }
|
||||
|
|
Loading…
Reference in a new issue