update ottava styles and properties
This commit is contained in:
parent
afafe7000d
commit
3fc269fc8b
17 changed files with 318 additions and 177 deletions
|
@ -195,7 +195,7 @@ QVariant GlissandoSegment::propertyDefault(Pid id) const
|
|||
// propertyFlags
|
||||
//---------------------------------------------------------
|
||||
|
||||
PropertyFlags& GlissandoSegment::propertyFlags(Pid id)
|
||||
PropertyFlags GlissandoSegment::propertyFlags(Pid id) const
|
||||
{
|
||||
switch (id) {
|
||||
case Pid::FONT_FACE:
|
||||
|
|
|
@ -42,7 +42,7 @@ class GlissandoSegment final : public LineSegment {
|
|||
virtual QVariant getProperty(Pid id) const override;
|
||||
virtual bool setProperty(Pid propertyId, const QVariant&) override;
|
||||
virtual QVariant propertyDefault(Pid id) const override;
|
||||
virtual PropertyFlags& propertyFlags(Pid) override;
|
||||
virtual PropertyFlags propertyFlags(Pid) const override;
|
||||
virtual void setPropertyFlags(Pid id, PropertyFlags f) override;
|
||||
virtual Sid getPropertyStyle(Pid) const override;
|
||||
};
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "staff.h"
|
||||
#include "segment.h"
|
||||
#include "sym.h"
|
||||
#include "musescoreCore.h"
|
||||
|
||||
namespace Ms {
|
||||
|
||||
|
@ -29,22 +30,19 @@ namespace Ms {
|
|||
//---------------------------------------------------------
|
||||
|
||||
struct OttavaDefault {
|
||||
SymId id;
|
||||
SymId numbersOnlyId;
|
||||
qreal hookDirection;
|
||||
Placement place;
|
||||
OttavaType type;
|
||||
int shift;
|
||||
const char* name;
|
||||
};
|
||||
|
||||
// order is important, should be the same as OttavaType
|
||||
static const OttavaDefault ottavaDefault[] = {
|
||||
{ SymId::ottavaAlta, SymId::ottava, 1.0, Placement::ABOVE, 12, "8va" },
|
||||
{ SymId::ottavaBassaBa, SymId::ottava, -1.0, Placement::BELOW, -12, "8vb" },
|
||||
{ SymId::quindicesimaAlta, SymId::quindicesima, 1.0, Placement::ABOVE, 24, "15ma" },
|
||||
{ SymId::quindicesimaBassa, SymId::quindicesima, -1.0, Placement::BELOW, -24, "15mb" },
|
||||
{ SymId::ventiduesimaAlta, SymId::ventiduesima, 1.0, Placement::ABOVE, 36, "22ma" },
|
||||
{ SymId::ventiduesimaBassa, SymId::ventiduesima, -1.0, Placement::BELOW, -36, "22mb" }
|
||||
{ OttavaType::OTTAVA_8VA, 12, "8va" },
|
||||
{ OttavaType::OTTAVA_8VB, -12, "8vb" },
|
||||
{ OttavaType::OTTAVA_15MA, 24, "15ma" },
|
||||
{ OttavaType::OTTAVA_15MB, -24, "15mb" },
|
||||
{ OttavaType::OTTAVA_22MA, 36, "22ma" },
|
||||
{ OttavaType::OTTAVA_22MB, -36, "22mb" }
|
||||
};
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -53,14 +51,19 @@ static const OttavaDefault ottavaDefault[] = {
|
|||
|
||||
void OttavaSegment::layout()
|
||||
{
|
||||
if (autoplace())
|
||||
setUserOff(QPointF());
|
||||
|
||||
TextLineBaseSegment::layout();
|
||||
if (parent()) {
|
||||
qreal yo = score()->styleP(ottava()->placeBelow() ? Sid::ottavaPosBelow : Sid::ottavaPosAbove) * mag();
|
||||
rypos() += yo;
|
||||
qreal y;
|
||||
if (placeAbove()) {
|
||||
y = score()->styleP(Sid::ottavaPosAbove);
|
||||
}
|
||||
else {
|
||||
qreal sh = ottava()->staff() ? ottava()->staff()->height() : 0;
|
||||
y = score()->styleP(Sid::ottavaPosBelow) + sh;
|
||||
}
|
||||
rypos() = y;
|
||||
if (autoplace()) {
|
||||
setUserOff(QPointF());
|
||||
qreal minDistance = spatium() * .7;
|
||||
Shape s1 = shape().translated(pos());
|
||||
if (ottava()->placeAbove()) {
|
||||
|
@ -89,6 +92,7 @@ QVariant OttavaSegment::getProperty(Pid id) const
|
|||
}
|
||||
switch (id) {
|
||||
case Pid::OTTAVA_TYPE:
|
||||
case Pid::NUMBERS_ONLY:
|
||||
return spanner()->getProperty(id);
|
||||
default:
|
||||
return TextLineBaseSegment::getProperty(id);
|
||||
|
@ -107,6 +111,7 @@ bool OttavaSegment::setProperty(Pid id, const QVariant& v)
|
|||
}
|
||||
switch (id) {
|
||||
case Pid::OTTAVA_TYPE:
|
||||
case Pid::NUMBERS_ONLY:
|
||||
return spanner()->setProperty(id, v);
|
||||
default:
|
||||
return TextLineBaseSegment::setProperty(id, v);
|
||||
|
@ -125,12 +130,110 @@ QVariant OttavaSegment::propertyDefault(Pid id) const
|
|||
}
|
||||
switch (id) {
|
||||
case Pid::OTTAVA_TYPE:
|
||||
case Pid::NUMBERS_ONLY:
|
||||
return spanner()->propertyDefault(id);
|
||||
default:
|
||||
return TextLineBaseSegment::propertyDefault(id);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// updateStyledProperties
|
||||
// some properties change styling
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Ottava::updateStyledProperties()
|
||||
{
|
||||
Q_ASSERT(int(OttavaType::OTTAVA_22MB) - int(OttavaType::OTTAVA_8VA) == 5);
|
||||
|
||||
static const Sid ss[24] = {
|
||||
Sid::ottava8VAPlacement,
|
||||
Sid::ottava8VAnoText,
|
||||
Sid::ottava8VBPlacement,
|
||||
Sid::ottava8VBnoText,
|
||||
Sid::ottava15MAPlacement,
|
||||
Sid::ottava15MAnoText,
|
||||
Sid::ottava15MBPlacement,
|
||||
Sid::ottava15MBnoText,
|
||||
Sid::ottava22MAPlacement,
|
||||
Sid::ottava22MAnoText,
|
||||
Sid::ottava22MBPlacement,
|
||||
Sid::ottava22MBnoText,
|
||||
|
||||
Sid::ottava8VAPlacement,
|
||||
Sid::ottava8VAText,
|
||||
Sid::ottava8VBPlacement,
|
||||
Sid::ottava8VBText,
|
||||
Sid::ottava15MAPlacement,
|
||||
Sid::ottava15MAText,
|
||||
Sid::ottava15MBPlacement,
|
||||
Sid::ottava15MBText,
|
||||
Sid::ottava22MAPlacement,
|
||||
Sid::ottava22MAText,
|
||||
Sid::ottava22MBPlacement,
|
||||
Sid::ottava22MBText,
|
||||
};
|
||||
|
||||
// switch right substyles depending on _ottavaType and _numbersOnly
|
||||
|
||||
StyledProperty* spl = _styledProperties.data();
|
||||
int idx = int(_ottavaType) * 2 + (_numbersOnly ? 0 : 12);
|
||||
spl[0].sid = ss[idx]; // PLACEMENT
|
||||
spl[2].sid = ss[idx+1]; // BEGIN_TEXT
|
||||
spl[3].sid = ss[idx+1]; // CONTINUE_TEXT
|
||||
if (isStyled(Pid::PLACEMENT))
|
||||
spl[4].sid = score()->styleI(ss[idx]) == int(Placement::ABOVE) ? Sid::ottavaHookAbove : Sid::ottavaHookBelow;
|
||||
else
|
||||
spl[4].sid = placeAbove() ? Sid::ottavaHookAbove : Sid::ottavaHookBelow;
|
||||
styleChanged(); // this changes all styled properties with flag STYLED
|
||||
MuseScoreCore::mscoreCore->updateInspector();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// setOttavaType
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Ottava::setOttavaType(OttavaType val)
|
||||
{
|
||||
_ottavaType = val;
|
||||
updateStyledProperties();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// setNumbersOnly
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Ottava::setNumbersOnly(bool val)
|
||||
{
|
||||
_numbersOnly = val;
|
||||
updateStyledProperties();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// setPlacement
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Ottava::setPlacement(Placement p)
|
||||
{
|
||||
TextLineBase::setPlacement(p);
|
||||
updateStyledProperties();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// undoChangeProperty
|
||||
//---------------------------------------------------------
|
||||
|
||||
void OttavaSegment::undoChangeProperty(Pid id, const QVariant& v, PropertyFlags ps)
|
||||
{
|
||||
if (id == Pid::OTTAVA_TYPE || id == Pid::NUMBERS_ONLY || id == Pid::PLACEMENT) {
|
||||
ScoreElement::undoChangeProperty(id, v, ps);
|
||||
ottava()->updateStyledProperties();
|
||||
}
|
||||
else {
|
||||
ScoreElement::undoChangeProperty(id, v, ps);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// Ottava
|
||||
//---------------------------------------------------------
|
||||
|
@ -139,37 +242,31 @@ Ottava::Ottava(Score* s)
|
|||
: TextLineBase(s, ElementFlag::ON_STAFF | ElementFlag::MOVABLE)
|
||||
{
|
||||
_ottavaType = OttavaType::OTTAVA_8VA;
|
||||
_styledProperties = ottavaStyle; // make copy
|
||||
|
||||
setBeginTextPlace(PlaceText::LEFT);
|
||||
setContinueTextPlace(PlaceText::LEFT);
|
||||
setEndHookType(HookType::HOOK_90);
|
||||
setLineVisible(true);
|
||||
|
||||
initSubStyle(SubStyleId::OTTAVA);
|
||||
}
|
||||
|
||||
Ottava::Ottava(const Ottava& o)
|
||||
: TextLineBase(o)
|
||||
{
|
||||
_styledProperties = o._styledProperties;
|
||||
setOttavaType(o._ottavaType);
|
||||
_numbersOnly = o._numbersOnly;
|
||||
_pitchShift = o._pitchShift;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// setOttavaType
|
||||
// pitchShift
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Ottava::setOttavaType(OttavaType val)
|
||||
int Ottava::pitchShift() const
|
||||
{
|
||||
_ottavaType = val;
|
||||
|
||||
const OttavaDefault* def = &ottavaDefault[int(_ottavaType)];
|
||||
setBeginText(propertyDefault(Pid::BEGIN_TEXT).toString());
|
||||
setContinueText(propertyDefault(Pid::CONTINUE_TEXT).toString());
|
||||
|
||||
setEndHookType(HookType::HOOK_90);
|
||||
setEndHookHeight(score()->styleS(Sid::ottavaHook) * def->hookDirection);
|
||||
|
||||
setPlacement(def->place);
|
||||
_pitchShift = def->shift;
|
||||
return ottavaDefault[int(_ottavaType)].shift;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -190,7 +287,6 @@ void Ottava::write(XmlWriter& xml) const
|
|||
if (!xml.canWrite(this))
|
||||
return;
|
||||
xml.stag(QString("%1 id=\"%2\"").arg(name()).arg(xml.spannerId(this)));
|
||||
// writeProperty(xml, Pid::NUMBERS_ONLY);
|
||||
xml.tag("subtype", ottavaDefault[int(ottavaType())].name);
|
||||
|
||||
for (const StyledProperty* spp = styledProperties(); spp->sid != Sid::NOSTYLE; ++spp)
|
||||
|
@ -211,6 +307,7 @@ void Ottava::read(XmlReader& e)
|
|||
e.addSpanner(e.intAttribute("id", -1), this);
|
||||
while (e.readNextStartElement())
|
||||
readProperties(e);
|
||||
updateStyledProperties();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -225,10 +322,10 @@ bool Ottava::readProperties(XmlReader& e)
|
|||
bool ok;
|
||||
int idx = s.toInt(&ok);
|
||||
if (!ok) {
|
||||
idx = int(OttavaType::OTTAVA_8VA);
|
||||
_ottavaType = OttavaType::OTTAVA_8VA;
|
||||
for (unsigned i = 0; i < sizeof(ottavaDefault)/sizeof(*ottavaDefault); ++i) {
|
||||
if (s == ottavaDefault[i].name) {
|
||||
idx = i;
|
||||
_ottavaType = ottavaDefault[i].type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -239,9 +336,11 @@ bool Ottava::readProperties(XmlReader& e)
|
|||
idx = 2;
|
||||
else if (idx == 2)
|
||||
idx = 1;
|
||||
_ottavaType = OttavaType(idx);
|
||||
}
|
||||
setOttavaType(OttavaType(idx));
|
||||
}
|
||||
else if (readStyledProperty(e, tag))
|
||||
return true;
|
||||
else if (!TextLineBase::readProperties(e)) {
|
||||
e.unknown();
|
||||
return false;
|
||||
|
@ -249,15 +348,6 @@ bool Ottava::readProperties(XmlReader& e)
|
|||
return true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// undoSetOttavaType
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Ottava::undoSetOttavaType(OttavaType val)
|
||||
{
|
||||
undoChangeProperty(Pid::OTTAVA_TYPE, int(val));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// setYoff
|
||||
// used in musicxml import
|
||||
|
@ -277,8 +367,10 @@ QVariant Ottava::getProperty(Pid propertyId) const
|
|||
switch (propertyId) {
|
||||
case Pid::OTTAVA_TYPE:
|
||||
return int(ottavaType());
|
||||
|
||||
case Pid::NUMBERS_ONLY:
|
||||
return _numbersOnly;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -296,18 +388,8 @@ bool Ottava::setProperty(Pid propertyId, const QVariant& val)
|
|||
setOttavaType(OttavaType(val.toInt()));
|
||||
break;
|
||||
|
||||
case Pid::PLACEMENT:
|
||||
if (val != getProperty(propertyId)) {
|
||||
// reverse hooks
|
||||
// setBeginHookHeight(-beginHookHeight());
|
||||
setEndHookHeight(-endHookHeight());
|
||||
}
|
||||
setPlacement(Placement(val.toInt()));
|
||||
break;
|
||||
|
||||
case Pid::NUMBERS_ONLY:
|
||||
setNumbersOnly(val.toBool());
|
||||
setOttavaType(_ottavaType);
|
||||
_numbersOnly = val.toBool();
|
||||
break;
|
||||
|
||||
case Pid::SPANNER_TICKS:
|
||||
|
@ -340,24 +422,14 @@ QVariant Ottava::propertyDefault(Pid propertyId) const
|
|||
return QVariant();
|
||||
case Pid::END_HOOK_TYPE:
|
||||
return int(HookType::HOOK_90);
|
||||
case Pid::PLACEMENT:
|
||||
return int(ottavaDefault[int(_ottavaType)].place);
|
||||
case Pid::END_HOOK_HEIGHT:
|
||||
return score()->styleS(Sid::ottavaHook) * ottavaDefault[int(_ottavaType)].hookDirection;
|
||||
case Pid::BEGIN_TEXT:
|
||||
case Pid::CONTINUE_TEXT: {
|
||||
const OttavaDefault* def = &ottavaDefault[int(_ottavaType)];
|
||||
SymId id = _numbersOnly ? def->numbersOnlyId : def->id;
|
||||
return QString("<sym>%1</sym>").arg(Sym::id2name(id));
|
||||
}
|
||||
case Pid::LINE_VISIBLE:
|
||||
return true;
|
||||
|
||||
default:
|
||||
QVariant v = ScoreElement::styledPropertyDefault(propertyId);
|
||||
if (v.isValid())
|
||||
return v;
|
||||
return getProperty(propertyId);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,8 @@ class Ottava;
|
|||
//---------------------------------------------------------
|
||||
|
||||
class OttavaSegment final : public TextLineBaseSegment {
|
||||
virtual void undoChangeProperty(Pid id, const QVariant&, PropertyFlags ps) override;
|
||||
|
||||
public:
|
||||
OttavaSegment(Score* s) : TextLineBaseSegment(s, ElementFlag::MOVABLE) { }
|
||||
virtual ElementType type() const override { return ElementType::OTTAVA_SEGMENT; }
|
||||
|
@ -65,10 +67,11 @@ class OttavaSegment final : public TextLineBaseSegment {
|
|||
//---------------------------------------------------------
|
||||
|
||||
class Ottava final : public TextLineBase {
|
||||
std::vector<StyledProperty> _styledProperties;
|
||||
OttavaType _ottavaType;
|
||||
bool _numbersOnly;
|
||||
|
||||
int _pitchShift;
|
||||
void updateStyledProperties();
|
||||
|
||||
protected:
|
||||
friend class OttavaSegment;
|
||||
|
@ -79,15 +82,19 @@ class Ottava final : public TextLineBase {
|
|||
virtual Ottava* clone() const override { return new Ottava(*this); }
|
||||
virtual ElementType type() const override { return ElementType::OTTAVA; }
|
||||
|
||||
virtual const StyledProperty* styledProperties() const override { return _styledProperties.data(); }
|
||||
StyledProperty* styledProperties() { return _styledProperties.data(); }
|
||||
|
||||
void setOttavaType(OttavaType val);
|
||||
OttavaType ottavaType() const { return _ottavaType; }
|
||||
void undoSetOttavaType(OttavaType val);
|
||||
|
||||
bool numbersOnly() const { return _numbersOnly; }
|
||||
void setNumbersOnly(bool val) { _numbersOnly = val; }
|
||||
void setNumbersOnly(bool val);
|
||||
|
||||
void setPlacement(Placement);
|
||||
|
||||
virtual LineSegment* createLineSegment() override;
|
||||
int pitchShift() const { return _pitchShift; }
|
||||
int pitchShift() const;
|
||||
|
||||
virtual void write(XmlWriter& xml) const override;
|
||||
virtual void read(XmlReader& de) override;
|
||||
|
|
|
@ -226,7 +226,8 @@ struct StyleVal2 {
|
|||
{ Sid::voltaLineWidth, QVariant(.1) },
|
||||
{ Sid::voltaLineStyle, QVariant(int(Qt::SolidLine)) },
|
||||
{ Sid::ottavaPosAbove, QVariant(-3.0) },
|
||||
{ Sid::ottavaHook, QVariant(1.9) },
|
||||
{ Sid::ottavaHookAbove, QVariant(1.9) },
|
||||
{ Sid::ottavaHookBelow, QVariant(-1.9) },
|
||||
{ Sid::ottavaLineWidth, QVariant(.1) },
|
||||
{ Sid::ottavaLineStyle, QVariant(int(Qt::DashLine)) },
|
||||
{ Sid::ottavaNumbersOnly, true },
|
||||
|
|
|
@ -819,8 +819,9 @@ class Score : public QObject, public ScoreElement {
|
|||
qreal styleD(Sid idx) const { Q_ASSERT(!strcmp(MStyle::valueType(idx),"double")); return style().value(idx).toDouble(); }
|
||||
int styleI(Sid idx) const { Q_ASSERT(!strcmp(MStyle::valueType(idx),"int")); return style().value(idx).toInt(); }
|
||||
|
||||
void setStyleValue(Sid sid, QVariant value) { style().set(sid, value); }
|
||||
qreal spatium() const { return styleD(Sid::spatium); }
|
||||
void setSpatium(qreal v) { style().set(Sid::spatium, v); }
|
||||
void setSpatium(qreal v) { setStyleValue(Sid::spatium, v); }
|
||||
|
||||
bool genCourtesyTimesig() const { return styleB(Sid::genCourtesyTimesig); }
|
||||
bool genCourtesyClef() const { return styleB(Sid::genCourtesyClef); }
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "xml.h"
|
||||
#include "bracket.h"
|
||||
#include "bracketItem.h"
|
||||
#include "spanner.h"
|
||||
|
||||
namespace Ms {
|
||||
|
||||
|
@ -230,14 +231,14 @@ void ScoreElement::initSubStyle(SubStyleId ssid)
|
|||
// resetProperty
|
||||
//---------------------------------------------------------
|
||||
|
||||
void ScoreElement::resetProperty(Pid id)
|
||||
void ScoreElement::resetProperty(Pid pid)
|
||||
{
|
||||
QVariant v = propertyDefault(id);
|
||||
QVariant v = propertyDefault(pid);
|
||||
if (v.isValid()) {
|
||||
setProperty(id, v);
|
||||
PropertyFlags& p = propertyFlags(id);
|
||||
setProperty(pid, v);
|
||||
PropertyFlags p = propertyFlags(pid);
|
||||
if (p != PropertyFlags::NOSTYLE)
|
||||
p = PropertyFlags::STYLED;
|
||||
setPropertyFlags(pid, PropertyFlags::STYLED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,6 +255,34 @@ void ScoreElement::undoResetProperty(Pid id)
|
|||
undoChangeProperty(id, propertyDefault(id), f);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// isStyled
|
||||
//---------------------------------------------------------
|
||||
|
||||
bool ScoreElement::isStyled(Pid pid) const
|
||||
{
|
||||
PropertyFlags f = propertyFlags(pid);
|
||||
return f == PropertyFlags::STYLED;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// changeProperty
|
||||
//---------------------------------------------------------
|
||||
|
||||
static void changeProperty(ScoreElement* e, Pid t, const QVariant& st, PropertyFlags ps)
|
||||
{
|
||||
if (e->isSpannerSegment())
|
||||
e = toSpannerSegment(e)->spanner();
|
||||
if (e->getProperty(t) != st || e->propertyFlags(t) != ps) {
|
||||
if (e->isBracketItem()) {
|
||||
BracketItem* bi = toBracketItem(e);
|
||||
e->score()->undo(new ChangeBracketProperty(bi->staff(), bi->column(), t, st, ps));
|
||||
}
|
||||
else
|
||||
e->score()->undo(new ChangeProperty(e, t, st, ps));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// changeProperties
|
||||
//---------------------------------------------------------
|
||||
|
@ -261,27 +290,11 @@ void ScoreElement::undoResetProperty(Pid id)
|
|||
static void changeProperties(ScoreElement* e, Pid t, const QVariant& st, PropertyFlags ps)
|
||||
{
|
||||
if (propertyLink(t)) {
|
||||
for (ScoreElement* ee : e->linkList()) {
|
||||
if (ee->getProperty(t) != st || ee->propertyFlags(t) != ps) {
|
||||
if (ee->isBracketItem()) {
|
||||
BracketItem* bi = toBracketItem(ee);
|
||||
ee->score()->undo(new ChangeBracketProperty(bi->staff(), bi->column(), t, st, ps));
|
||||
}
|
||||
else
|
||||
ee->score()->undo(new ChangeProperty(ee, t, st, ps));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (e->getProperty(t) != st || e->propertyFlags(t) != ps) {
|
||||
if (e->isBracketItem()) {
|
||||
BracketItem* bi = toBracketItem(e);
|
||||
e->score()->undo(new ChangeBracketProperty(bi->staff(), bi->column(), t, st, ps));
|
||||
}
|
||||
else
|
||||
e->score()->undo(new ChangeProperty(e, t, st, ps));
|
||||
}
|
||||
for (ScoreElement* ee : e->linkList())
|
||||
changeProperty(ee, t, st, ps);
|
||||
}
|
||||
else
|
||||
changeProperty(e, t, st, ps);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -550,7 +563,7 @@ MasterScore* ScoreElement::masterScore() const
|
|||
// propertyFlags
|
||||
//---------------------------------------------------------
|
||||
|
||||
PropertyFlags& ScoreElement::propertyFlags(Pid id)
|
||||
PropertyFlags ScoreElement::propertyFlags(Pid id) const
|
||||
{
|
||||
static PropertyFlags f = PropertyFlags::NOSTYLE;
|
||||
|
||||
|
@ -571,9 +584,16 @@ PropertyFlags& ScoreElement::propertyFlags(Pid id)
|
|||
|
||||
void ScoreElement::setPropertyFlags(Pid id, PropertyFlags f)
|
||||
{
|
||||
PropertyFlags& p = propertyFlags(id);
|
||||
if (p != PropertyFlags::NOSTYLE)
|
||||
p = f;
|
||||
const StyledProperty* spl = styledProperties();
|
||||
for (int i = 0;;++i) {
|
||||
const StyledProperty& k = spl[i];
|
||||
if (k.sid == Sid::NOSTYLE)
|
||||
break;
|
||||
if (k.pid == id) {
|
||||
propertyFlagsList()[i] = f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -600,15 +620,14 @@ Sid ScoreElement::getPropertyStyle(Pid id) const
|
|||
void ScoreElement::styleChanged()
|
||||
{
|
||||
for (const StyledProperty* spp = styledProperties(); spp->sid != Sid::NOSTYLE; ++spp) {
|
||||
PropertyFlags& f = propertyFlags(spp->pid);
|
||||
PropertyFlags f = propertyFlags(spp->pid);
|
||||
if (f == PropertyFlags::STYLED) {
|
||||
if (propertyType(spp->pid) == P_TYPE::SP_REAL) {
|
||||
qreal val = score()->styleP(spp->sid);
|
||||
setProperty(spp->pid, val);
|
||||
}
|
||||
else {
|
||||
else
|
||||
setProperty(spp->pid, score()->styleV(spp->sid));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -202,8 +202,9 @@ class ScoreElement {
|
|||
void setSubStyleId(SubStyleId);
|
||||
void initSubStyle(SubStyleId);
|
||||
virtual const StyledProperty* styledProperties() const { return subStyle(_subStyleId).data(); }
|
||||
virtual PropertyFlags* propertyFlagsList() { return _propertyFlagsList; }
|
||||
virtual PropertyFlags& propertyFlags(Pid);
|
||||
virtual PropertyFlags* propertyFlagsList() const { return _propertyFlagsList; }
|
||||
virtual PropertyFlags propertyFlags(Pid) const;
|
||||
bool isStyled(Pid pid) const;
|
||||
|
||||
virtual void setPropertyFlags(Pid, PropertyFlags);
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ Sid SpannerSegment::getPropertyStyle(Pid id) const
|
|||
// propertyFlags
|
||||
//---------------------------------------------------------
|
||||
|
||||
PropertyFlags& SpannerSegment::propertyFlags(Pid id)
|
||||
PropertyFlags SpannerSegment::propertyFlags(Pid id) const
|
||||
{
|
||||
return spanner()->propertyFlags(id);
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ class SpannerSegment : public Element {
|
|||
virtual bool setProperty(Pid id, const QVariant& v) override;
|
||||
virtual QVariant propertyDefault(Pid id) const override;
|
||||
virtual Sid getPropertyStyle(Pid id) const override;
|
||||
virtual PropertyFlags& propertyFlags(Pid id) override;
|
||||
virtual PropertyFlags propertyFlags(Pid id) const override;
|
||||
virtual void resetProperty(Pid id) override;
|
||||
virtual void styleChanged() override;
|
||||
void reset() override;
|
||||
|
|
|
@ -323,10 +323,31 @@ static const StyleType styleTypes[] {
|
|||
{ Sid::voltaAlign, "voltaAlign", QVariant::fromValue(Align::LEFT | Align::BASELINE) },
|
||||
{ Sid::voltaOffset, "voltaOffset", QPointF(0.5, 1.9) },
|
||||
|
||||
{ Sid::ottavaPlacement, "ottavaPlacement", int(Placement::ABOVE) },
|
||||
{ Sid::ottava8VAPlacement, "ottava8VAPlacement", int(Placement::ABOVE) },
|
||||
{ Sid::ottava8VBPlacement, "ottava8VBPlacement", int(Placement::BELOW) },
|
||||
{ Sid::ottava15MAPlacement, "ottava15MAPlacement", int(Placement::ABOVE) },
|
||||
{ Sid::ottava15MBPlacement, "ottava15MBPlacement", int(Placement::BELOW) },
|
||||
{ Sid::ottava22MAPlacement, "ottava22MAPlacement", int(Placement::ABOVE) },
|
||||
{ Sid::ottava22MBPlacement, "ottava22MBPlacement", int(Placement::BELOW) },
|
||||
|
||||
{ Sid::ottava8VAText, "ottava8VAText", QString("<sym>ottavaAlta</sym>") },
|
||||
{ Sid::ottava8VBText, "ottava8VBText", QString("<sym>ottavaBassaBa</sym>") },
|
||||
{ Sid::ottava15MAText, "ottava15MAText", QString("<sym>quindicesimaAlta</sym>") },
|
||||
{ Sid::ottava15MBText, "ottava15MBText", QString("<sym>quindicesimaBassa</sym>") },
|
||||
{ Sid::ottava22MAText, "ottava22MAText", QString("<sym>ventiduesimaAlta</sym>") },
|
||||
{ Sid::ottava22MBText, "ottava22MBText", QString("<sym>ventiduesimaBassa</sym>") },
|
||||
|
||||
{ Sid::ottava8VAnoText, "ottava8VAnoText", QString("<sym>ottava</sym>") },
|
||||
{ Sid::ottava8VBnoText, "ottava8VBnoText", QString("<sym>ottava</sym>") },
|
||||
{ Sid::ottava15MAnoText, "ottava15MAnoText", QString("<sym>quindicesima</sym>") },
|
||||
{ Sid::ottava15MBnoText, "ottava15MBnoText", QString("<sym>quindicesima</sym>") },
|
||||
{ Sid::ottava22MAnoText, "ottava22MAnoText", QString("<sym>ventiduesima</sym>") },
|
||||
{ Sid::ottava22MBnoText, "ottava22MBnoText", QString("<sym>ventiduesima</sym>") },
|
||||
|
||||
{ Sid::ottavaPosAbove, "ottavaPosAbove", Spatium(-3.0) },
|
||||
{ Sid::ottavaPosBelow, "ottavaPosBelow", Spatium(3.0) },
|
||||
{ Sid::ottavaHook, "ottavaHook", Spatium(1.9) },
|
||||
{ Sid::ottavaHookAbove, "ottavaHookAbove", Spatium(1.9) },
|
||||
{ Sid::ottavaHookBelow, "ottavaHookBelow", Spatium(-1.9) },
|
||||
{ Sid::ottavaLineWidth, "ottavaLineWidth", Spatium(.1) },
|
||||
{ Sid::ottavaLineStyle, "ottavaLineStyle", QVariant(int(Qt::DashLine)) },
|
||||
{ Sid::ottavaNumbersOnly, "ottavaNumbersOnly", true },
|
||||
|
@ -878,7 +899,6 @@ const std::vector<StyledProperty> lyricistStyle {
|
|||
{ Sid::lyricistAlign, Pid::ALIGN },
|
||||
{ Sid::lyricistOffset, Pid::OFFSET },
|
||||
{ Sid::lyricistOffsetType, Pid::OFFSET_TYPE },
|
||||
// { Sid::lyricistPlacement, Pid::PLACEMENT },
|
||||
{ Sid::NOSTYLE, Pid::END } // end of list marker
|
||||
};
|
||||
|
||||
|
@ -892,18 +912,6 @@ const std::vector<StyledProperty> lyricsStyle {
|
|||
{ Sid::lyricsPlacement, Pid::PLACEMENT },
|
||||
{ Sid::NOSTYLE, Pid::END } // end of list marker
|
||||
};
|
||||
#if 0
|
||||
const std::vector<StyledProperty> lyricsEvenStyle {
|
||||
{ Sid::lyricsEvenFontFace, Pid::FONT_FACE },
|
||||
{ Sid::lyricsEvenFontSize, Pid::FONT_SIZE },
|
||||
{ Sid::lyricsEvenFontBold, Pid::FONT_BOLD },
|
||||
{ Sid::lyricsEvenFontItalic, Pid::FONT_ITALIC },
|
||||
{ Sid::lyricsEvenFontUnderline, Pid::FONT_UNDERLINE },
|
||||
{ Sid::lyricsEvenAlign, Pid::ALIGN },
|
||||
{ Sid::lyricsPlacement, Pid::PLACEMENT },
|
||||
{ Sid::NOSTYLE, Pid::END } // end of list marker
|
||||
};
|
||||
#endif
|
||||
|
||||
const std::vector<StyledProperty> fingeringStyle {
|
||||
{ Sid::fingeringFontFace, Pid::FONT_FACE },
|
||||
|
@ -1202,7 +1210,11 @@ const std::vector<StyledProperty> glissandoStyle {
|
|||
};
|
||||
|
||||
const std::vector<StyledProperty> ottavaStyle {
|
||||
{ Sid::ottava8VAPlacement, Pid::PLACEMENT },
|
||||
{ Sid::ottavaNumbersOnly, Pid::NUMBERS_ONLY },
|
||||
{ Sid::ottava8VAText, Pid::BEGIN_TEXT },
|
||||
{ Sid::ottava8VAText, Pid::CONTINUE_TEXT },
|
||||
{ Sid::ottavaHookAbove, Pid::END_HOOK_HEIGHT },
|
||||
{ Sid::ottavaFontFace, Pid::BEGIN_FONT_FACE },
|
||||
{ Sid::ottavaFontFace, Pid::CONTINUE_FONT_FACE },
|
||||
{ Sid::ottavaFontFace, Pid::END_FONT_FACE },
|
||||
|
@ -1223,7 +1235,6 @@ const std::vector<StyledProperty> ottavaStyle {
|
|||
{ Sid::ottavaTextAlign, Pid::END_TEXT_ALIGN },
|
||||
{ Sid::ottavaLineWidth, Pid::LINE_WIDTH },
|
||||
{ Sid::ottavaLineStyle, Pid::LINE_STYLE },
|
||||
{ Sid::ottavaPlacement, Pid::PLACEMENT },
|
||||
{ Sid::NOSTYLE, Pid::END } // end of list marker
|
||||
};
|
||||
|
||||
|
|
|
@ -300,10 +300,31 @@ enum class Sid {
|
|||
voltaAlign,
|
||||
voltaOffset,
|
||||
|
||||
ottavaPlacement,
|
||||
ottava8VAPlacement,
|
||||
ottava8VBPlacement,
|
||||
ottava15MAPlacement,
|
||||
ottava15MBPlacement,
|
||||
ottava22MAPlacement,
|
||||
ottava22MBPlacement,
|
||||
|
||||
ottava8VAText,
|
||||
ottava8VBText,
|
||||
ottava15MAText,
|
||||
ottava15MBText,
|
||||
ottava22MAText,
|
||||
ottava22MBText,
|
||||
|
||||
ottava8VAnoText,
|
||||
ottava8VBnoText,
|
||||
ottava15MAnoText,
|
||||
ottava15MBnoText,
|
||||
ottava22MAnoText,
|
||||
ottava22MBnoText,
|
||||
|
||||
ottavaPosAbove,
|
||||
ottavaPosBelow,
|
||||
ottavaHook,
|
||||
ottavaHookAbove,
|
||||
ottavaHookBelow,
|
||||
ottavaLineWidth,
|
||||
ottavaLineStyle,
|
||||
ottavaNumbersOnly,
|
||||
|
@ -887,6 +908,7 @@ extern const SubStyle emptyStyle;
|
|||
extern const SubStyle defaultStyle;
|
||||
extern const SubStyle fingeringStyle;
|
||||
extern const SubStyle lyricsStyle;
|
||||
extern const SubStyle ottavaStyle;
|
||||
|
||||
const SubStyle& subStyle(SubStyleId);
|
||||
const SubStyle& subStyle(const char*);
|
||||
|
|
|
@ -129,23 +129,7 @@ QVariant TextLine::getProperty(Pid propertyId) const
|
|||
|
||||
bool TextLine::setProperty(Pid propertyId, const QVariant& val)
|
||||
{
|
||||
switch (propertyId) {
|
||||
case Pid::PLACEMENT:
|
||||
if (val != getProperty(propertyId)) {
|
||||
// reverse hooks
|
||||
setBeginHookHeight(-beginHookHeight());
|
||||
setEndHookHeight(-endHookHeight());
|
||||
}
|
||||
TextLineBase::setProperty(propertyId, val);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!TextLineBase::setProperty(propertyId, val))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
score()->setLayoutAll();
|
||||
return true;
|
||||
return TextLineBase::setProperty(propertyId, val);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
|
|
@ -229,7 +229,8 @@ EditStyle::EditStyle(Score* s, QWidget* parent)
|
|||
|
||||
{ Sid::ottavaPosAbove, false, ottavaPosAbove, resetOttavaPosAbove },
|
||||
{ Sid::ottavaPosBelow, false, ottavaPosBelow, resetOttavaPosBelow },
|
||||
{ Sid::ottavaHook, false, ottavaHook, resetOttavaHook },
|
||||
{ Sid::ottavaHookAbove, false, ottavaHookAbove, resetOttavaHookAbove },
|
||||
{ Sid::ottavaHookBelow, false, ottavaHookBelow, resetOttavaHookBelow },
|
||||
{ Sid::ottavaLineWidth, false, ottavaLineWidth, resetOttavaLineWidth },
|
||||
|
||||
{ Sid::pedalPlacement, false, pedalLinePlacement, resetPedalLinePlacement },
|
||||
|
|
|
@ -191,7 +191,7 @@
|
|||
</widget>
|
||||
<widget class="QStackedWidget" name="pageStack">
|
||||
<property name="currentIndex">
|
||||
<number>4</number>
|
||||
<number>15</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="PageScore">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_20">
|
||||
|
@ -6224,7 +6224,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_88">
|
||||
<property name="text">
|
||||
<string>Line thickness:</string>
|
||||
|
@ -6247,7 +6247,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="4" column="1">
|
||||
<widget class="QDoubleSpinBox" name="ottavaLineWidth">
|
||||
<property name="suffix">
|
||||
<string extracomment="spatium unit">sp</string>
|
||||
|
@ -6257,14 +6257,14 @@
|
|||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_87">
|
||||
<property name="text">
|
||||
<string>Hook height:</string>
|
||||
<string>Hook height Above:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>ottavaHook</cstring>
|
||||
<cstring>ottavaHookAbove</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="ottavaLineStyle">
|
||||
<item>
|
||||
<property name="text">
|
||||
|
@ -6294,7 +6294,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="ottavaHook">
|
||||
<widget class="QDoubleSpinBox" name="ottavaHookAbove">
|
||||
<property name="suffix">
|
||||
<string extracomment="spatium unit">sp</string>
|
||||
</property>
|
||||
|
@ -6310,7 +6310,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<item row="6" column="0">
|
||||
<spacer name="verticalSpacer_14">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
@ -6323,7 +6323,7 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_105">
|
||||
<property name="text">
|
||||
<string>Line style:</string>
|
||||
|
@ -6334,7 +6334,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QToolButton" name="resetOttavaHook">
|
||||
<widget class="QToolButton" name="resetOttavaHookAbove">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -6356,7 +6356,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<item row="4" column="2">
|
||||
<widget class="QToolButton" name="resetOttavaLineWidth">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
|
@ -6379,7 +6379,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<item row="5" column="2">
|
||||
<widget class="QToolButton" name="resetOttavaLineStyle">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
|
@ -6494,6 +6494,46 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_185">
|
||||
<property name="text">
|
||||
<string>Hook height Below:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>ottavaHookAbove</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="ottavaHookBelow">
|
||||
<property name="suffix">
|
||||
<string extracomment="spatium unit">sp</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QToolButton" name="resetOttavaHookBelow">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Reset to default</string>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Reset 'Hook height' value</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="musescore.qrc">
|
||||
<normaloff>:/data/icons/edit-reset.svg</normaloff>:/data/icons/edit-reset.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -71,7 +71,7 @@ InspectorOttava::InspectorOttava(QWidget* parent)
|
|||
{ Pid::END_HOOK_TYPE, 0, tl.endHookType, tl.resetEndHookType },
|
||||
{ Pid::END_HOOK_HEIGHT, 0, tl.endHookHeight, tl.resetEndHookHeight },
|
||||
|
||||
{ Pid::OTTAVA_TYPE, 0, o.ottavaType, o.resetOttavaType },
|
||||
{ Pid::OTTAVA_TYPE, 0, o.ottavaType, 0 },
|
||||
{ Pid::PLACEMENT, 0, o.placement, o.resetPlacement },
|
||||
{ Pid::NUMBERS_ONLY, 0, o.numbersOnly, o.resetNumbersOnly }
|
||||
};
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>150</width>
|
||||
<height>113</height>
|
||||
<width>183</width>
|
||||
<height>129</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
|
@ -86,23 +86,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QToolButton" name="resetOttavaType">
|
||||
<property name="toolTip">
|
||||
<string>Reset to default</string>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Reset 'Type' value</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../musescore.qrc">
|
||||
<normaloff>:/data/icons/edit-reset.svg</normaloff>:/data/icons/edit-reset.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
|
@ -222,7 +205,6 @@
|
|||
<tabstops>
|
||||
<tabstop>title</tabstop>
|
||||
<tabstop>ottavaType</tabstop>
|
||||
<tabstop>resetOttavaType</tabstop>
|
||||
<tabstop>placement</tabstop>
|
||||
<tabstop>resetPlacement</tabstop>
|
||||
<tabstop>numbersOnly</tabstop>
|
||||
|
|
Loading…
Reference in a new issue