rename _subStyle into _elementStyle
This commit is contained in:
parent
19dc450b72
commit
8fac795067
4 changed files with 41 additions and 49 deletions
|
@ -241,7 +241,7 @@ Ottava::Ottava(const Ottava& o)
|
|||
: TextLineBase(o)
|
||||
{
|
||||
_ottavaStyle = o._ottavaStyle;
|
||||
_subStyle = &_ottavaStyle;
|
||||
_elementStyle = &_ottavaStyle;
|
||||
setOttavaType(o._ottavaType);
|
||||
_numbersOnly = o._numbersOnly;
|
||||
}
|
||||
|
|
|
@ -139,9 +139,9 @@ static const ElementName elementNames[] = {
|
|||
ScoreElement::ScoreElement(const ScoreElement& se)
|
||||
{
|
||||
_score = se._score;
|
||||
_subStyle = se._subStyle;
|
||||
if (_subStyle) {
|
||||
int n = _subStyle->size();
|
||||
_elementStyle = se._elementStyle;
|
||||
if (_elementStyle) {
|
||||
int n = _elementStyle->size();
|
||||
_propertyFlagsList = new PropertyFlags[n];
|
||||
for (int i = 0; i < n; ++i)
|
||||
_propertyFlagsList[i] = se._propertyFlagsList[i];
|
||||
|
@ -172,15 +172,13 @@ ScoreElement::~ScoreElement()
|
|||
QVariant ScoreElement::propertyDefault(Pid pid) const
|
||||
{
|
||||
QVariant v;
|
||||
if (_subStyle) {
|
||||
for (const StyledProperty& spp : *_subStyle) {
|
||||
for (const StyledProperty& spp : *_elementStyle) {
|
||||
if (spp.pid == pid) {
|
||||
if (propertyType(pid) == P_TYPE::SP_REAL)
|
||||
return score()->styleP(spp.sid);
|
||||
return score()->styleV(spp.sid);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!v.isValid())
|
||||
qDebug("<%s>(%d) not found in <%s>", propertyQmlName(pid), int(pid), name());
|
||||
return v;
|
||||
|
@ -192,8 +190,8 @@ QVariant ScoreElement::propertyDefault(Pid pid) const
|
|||
|
||||
void ScoreElement::initElementStyle(const ElementStyle* ss)
|
||||
{
|
||||
_subStyle = ss;
|
||||
int n = _subStyle->size();
|
||||
_elementStyle = ss;
|
||||
int n = _elementStyle->size();
|
||||
if (isTextBase()) // HACK
|
||||
n += TEXT_STYLE_SIZE;
|
||||
delete[] _propertyFlagsList;
|
||||
|
@ -201,7 +199,7 @@ void ScoreElement::initElementStyle(const ElementStyle* ss)
|
|||
for (int i = 0; i < n; ++i)
|
||||
_propertyFlagsList[i] = PropertyFlags::STYLED;
|
||||
int i = 0;
|
||||
for (const StyledProperty& spp : *_subStyle) {
|
||||
for (const StyledProperty& spp : *_elementStyle) {
|
||||
Pid pid = spp.pid;
|
||||
QVariant v = propertyType(pid) == P_TYPE::SP_REAL ? score()->styleP(spp.sid) : score()->styleV(spp.sid);
|
||||
setProperty(pid, v);
|
||||
|
@ -543,14 +541,12 @@ MasterScore* ScoreElement::masterScore() const
|
|||
|
||||
int ScoreElement::getPropertyFlagsIdx(Pid id) const
|
||||
{
|
||||
if (_subStyle) {
|
||||
int i = 0;
|
||||
for (const StyledProperty& p : *_subStyle) {
|
||||
for (const StyledProperty& p : *_elementStyle) {
|
||||
if (p.pid == id)
|
||||
return i;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -586,12 +582,10 @@ void ScoreElement::setPropertyFlags(Pid id, PropertyFlags f)
|
|||
|
||||
Sid ScoreElement::getPropertyStyle(Pid id) const
|
||||
{
|
||||
if (_subStyle) {
|
||||
for (const StyledProperty& p : *_subStyle) {
|
||||
for (const StyledProperty& p : *_elementStyle) {
|
||||
if (p.pid == id)
|
||||
return p.sid;
|
||||
}
|
||||
}
|
||||
return Sid::NOSTYLE;
|
||||
}
|
||||
|
||||
|
@ -601,8 +595,7 @@ Sid ScoreElement::getPropertyStyle(Pid id) const
|
|||
|
||||
void ScoreElement::styleChanged()
|
||||
{
|
||||
if (_subStyle) {
|
||||
for (const StyledProperty& spp : *_subStyle) {
|
||||
for (const StyledProperty& spp : *_elementStyle) {
|
||||
PropertyFlags f = propertyFlags(spp.pid);
|
||||
if (f == PropertyFlags::STYLED) {
|
||||
if (propertyType(spp.pid) == P_TYPE::SP_REAL) {
|
||||
|
@ -614,7 +607,6 @@ void ScoreElement::styleChanged()
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// name
|
||||
|
|
|
@ -169,7 +169,7 @@ class ScoreElement {
|
|||
static ElementStyle const emptyStyle;
|
||||
|
||||
protected:
|
||||
const ElementStyle* _subStyle { &emptyStyle };
|
||||
const ElementStyle* _elementStyle { &emptyStyle };
|
||||
PropertyFlags* _propertyFlagsList { 0 };
|
||||
LinkedElements* _links { 0 };
|
||||
int getPropertyFlagsIdx(Pid id) const;
|
||||
|
@ -198,7 +198,7 @@ class ScoreElement {
|
|||
virtual void reset(); // reset all properties & position to default
|
||||
|
||||
virtual void initElementStyle(const ElementStyle*);
|
||||
virtual const ElementStyle* styledProperties() const { return _subStyle; }
|
||||
virtual const ElementStyle* styledProperties() const { return _elementStyle; }
|
||||
|
||||
virtual PropertyFlags* propertyFlagsList() const { return _propertyFlagsList; }
|
||||
virtual PropertyFlags propertyFlags(Pid) const;
|
||||
|
|
|
@ -1121,7 +1121,7 @@ TextBase::TextBase(const TextBase& st)
|
|||
_offset = st._offset;
|
||||
_offsetType = st._offsetType;
|
||||
|
||||
int n = _subStyle->size() + TEXT_STYLE_SIZE;
|
||||
int n = _elementStyle->size() + TEXT_STYLE_SIZE;
|
||||
_propertyFlagsList = new PropertyFlags[n];
|
||||
for (int i = 0; i < n; ++i)
|
||||
_propertyFlagsList[i] = st._propertyFlagsList[i];
|
||||
|
@ -1676,7 +1676,7 @@ void TextBase::writeProperties(XmlWriter& xml, bool writeText, bool /*writeStyle
|
|||
Element::writeProperties(xml);
|
||||
writeProperty(xml, Pid::SUB_STYLE);
|
||||
|
||||
for (const StyledProperty& spp : *_subStyle)
|
||||
for (const StyledProperty& spp : *_elementStyle)
|
||||
writeProperty(xml, spp.pid);
|
||||
for (const StyledProperty& spp : *textStyle(tid()))
|
||||
writeProperty(xml, spp.pid);
|
||||
|
@ -2376,7 +2376,7 @@ QVariant TextBase::propertyDefault(Pid id) const
|
|||
int TextBase::getPropertyFlagsIdx(Pid id) const
|
||||
{
|
||||
int i = 0;
|
||||
for (const StyledProperty& p : *_subStyle) {
|
||||
for (const StyledProperty& p : *_elementStyle) {
|
||||
if (p.pid == id)
|
||||
return i;
|
||||
++i;
|
||||
|
@ -2421,7 +2421,7 @@ void TextBase::setPropertyFlags(Pid id, PropertyFlags f)
|
|||
|
||||
Sid TextBase::getPropertyStyle(Pid id) const
|
||||
{
|
||||
for (const StyledProperty& p : *_subStyle) {
|
||||
for (const StyledProperty& p : *_elementStyle) {
|
||||
if (p.pid == id)
|
||||
return p.sid;
|
||||
}
|
||||
|
@ -2443,7 +2443,7 @@ void TextBase::styleChanged()
|
|||
return;
|
||||
}
|
||||
int i = 0;
|
||||
for (const StyledProperty& spp : *_subStyle) {
|
||||
for (const StyledProperty& spp : *_elementStyle) {
|
||||
PropertyFlags f = _propertyFlagsList[i];
|
||||
if (f == PropertyFlags::STYLED) {
|
||||
if (propertyType(spp.pid) == P_TYPE::SP_REAL) {
|
||||
|
@ -2475,16 +2475,16 @@ void TextBase::styleChanged()
|
|||
|
||||
void TextBase::initElementStyle(const ElementStyle* ss)
|
||||
{
|
||||
_subStyle = ss;
|
||||
int n = _subStyle->size() + TEXT_STYLE_SIZE;
|
||||
_elementStyle = ss;
|
||||
int n = _elementStyle->size() + TEXT_STYLE_SIZE;
|
||||
|
||||
// printf("<%s> initElementStyle n=%d + %d\n", name(), int(_subStyle->size()), TEXT_STYLE_SIZE);
|
||||
// printf("<%s> initElementStyle n=%d + %d\n", name(), int(_elementStyle->size()), TEXT_STYLE_SIZE);
|
||||
|
||||
delete[] _propertyFlagsList;
|
||||
_propertyFlagsList = new PropertyFlags[n];
|
||||
for (int i = 0; i < n; ++i)
|
||||
_propertyFlagsList[i] = PropertyFlags::STYLED;
|
||||
for (const StyledProperty& p : *_subStyle) {
|
||||
for (const StyledProperty& p : *_elementStyle) {
|
||||
QVariant v = propertyType(p.pid) == P_TYPE::SP_REAL ? score()->styleP(p.sid) : score()->styleV(p.sid);
|
||||
setProperty(p.pid, v);
|
||||
}
|
||||
|
@ -2504,7 +2504,7 @@ void TextBase::initElementStyle(const ElementStyle* ss)
|
|||
void TextBase::initTid(Tid tid)
|
||||
{
|
||||
setTid(tid);
|
||||
int i = _subStyle->size();
|
||||
int i = _elementStyle->size();
|
||||
for (const StyledProperty& p : *textStyle(tid)) {
|
||||
Pid pid = p.pid;
|
||||
QVariant v = propertyDefault(pid);
|
||||
|
|
Loading…
Reference in a new issue