MuseScore/libmscore/sticking.h
Marc Sabatella 7bc8ccdef0 fix #295531: unable to enter successive sticking elements
Resolves: https://musescore.org/en/node/295531

In an earlier fix for a crash entering fingering with custom text style,
I introduced a change to how the textTab() function ("fingering mode") works,
so instead of creating a new text element with the same text style as the previous element
(which could conceivably be a user style),
we create one with the same text style as the *default* text style for that element,
and then change the text style later if needed.
This fails for sticking because it had no default text style.
So this change simply adds one, by overriding Sticking::propertyDefault().

The same previous bug fix also broke expression text a little,
because this is actually a staff text, and this process of first creating an element
with the default text style and then changing it ends up missing the placement property.
So you get an object with expression text style but palcement above.
I fix that by special-casing this combination - one of the few places
where we create a pseudo element type that is really just a different text style.
We formerly did this for  system text, but it's a first class element now.
Also, RNA is just a different text style on chord symbol,
but that goes through a totally different code path, which works correctly already.
2019-10-10 22:04:41 -06:00

49 lines
1.8 KiB
C++

//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2019 Werner Schweer and others
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//=============================================================================
#ifndef __STICKING_H__
#define __STICKING_H__
#include "textbase.h"
namespace Ms {
//-----------------------------------------------------------------------------
// @@ Sticking
/// Drum sticking
//-----------------------------------------------------------------------------
class Sticking final : public TextBase {
virtual Sid getPropertyStyle(Pid) const override;
virtual QVariant propertyDefault(Pid id) const override;
public:
Sticking(Score*);
virtual Sticking* clone() const override { return new Sticking(*this); }
virtual ElementType type() const override { return ElementType::STICKING; }
Segment* segment() const { return (Segment*)parent(); }
Measure* measure() const { return (Measure*)parent()->parent(); }
virtual void layout() override;
virtual void write(XmlWriter& xml) const override;
virtual void read(XmlReader&) override;
};
} // namespace Ms
#endif