Skip to content
Permalink
Browse files

Merge pull request #4702 from MarcSabatella/284347-fingering-placement

fix #284347: support Placement property and flip command for fingering
  • Loading branch information
anatoly-os committed Mar 7, 2019
2 parents 1602f6d + e09ab8e commit d9f656e246046228e9435e65811738a18f0ff100
@@ -1428,6 +1428,7 @@ void Score::cmdFlip()
}
else if (e->isTempoText()
|| e->isStaffText()
|| e->isFingering()
|| e->isDynamic()
|| e->isHairpin()
|| e->isHairpinSegment()
@@ -29,6 +29,7 @@ namespace Ms {
//---------------------------------------------------------

static const ElementStyle fingeringStyle {
{ Sid::fingeringPlacement, Pid::PLACEMENT },
};

//---------------------------------------------------------
@@ -68,18 +69,18 @@ ElementType Fingering::layoutType()
// calculatePlacement
//---------------------------------------------------------

void Fingering::calculatePlacement()
Placement Fingering::calculatePlacement() const
{
Note* n = note();
if (!n)
return;
return Placement::ABOVE;
Chord* chord = n->chord();
Staff* staff = chord->staff();
Part* part = staff->part();
int nstaves = part->nstaves();
bool voices = chord->measure()->hasVoices(staff->idx());
bool below = voices ? !chord->up() : (nstaves > 1) && (staff->rstaff() == nstaves - 1);
setPlacement(below ? Placement::BELOW : Placement::ABOVE);
return below ? Placement::BELOW : Placement::ABOVE;
}

//---------------------------------------------------------
@@ -221,7 +222,7 @@ QVariant Fingering::propertyDefault(Pid id) const
{
switch (id) {
case Pid::PLACEMENT:
return int(Placement::ABOVE);
return int(calculatePlacement());
case Pid::SUB_STYLE:
return int(Tid::FINGERING);
default:
@@ -32,7 +32,7 @@ class Fingering final : public TextBase {

Note* note() const { return toNote(parent()); }
ElementType layoutType();
void calculatePlacement();
Placement calculatePlacement() const;

virtual void draw(QPainter*) const override;
virtual void layout() override;
@@ -2085,7 +2085,8 @@ void Note::layout2()
}
else if (e->isFingering()) {
Fingering* f = toFingering(e);
f->calculatePlacement();
if (f->propertyFlags(Pid::PLACEMENT) == PropertyFlags::STYLED)
f->setPlacement(f->calculatePlacement());
// layout fingerings that are placed relative to notehead
// fingerings placed relative to chord will be laid out later
if (f->layoutType() == ElementType::NOTE)
@@ -1112,6 +1112,8 @@ static const StyleType styleTypes[] {
{ Sid::fermataPosAbove, "fermataPosAbove", QPointF(.0, -1.0) },
{ Sid::fermataPosBelow, "fermataPosBelow", QPointF(.0, 1.0) },
{ Sid::fermataMinDistance, "fermataMinDistance", Spatium(0.4) },

{ Sid::fingeringPlacement, "fingeringPlacement", int(Placement::ABOVE) },
};

MStyle MScore::_baseStyle;
@@ -1089,6 +1089,8 @@ enum class Sid {
fermataPosBelow,
fermataMinDistance,

fingeringPlacement,

STYLES
};

@@ -22,20 +22,8 @@ namespace Ms {
//---------------------------------------------------------

InspectorFingering::InspectorFingering(QWidget* parent)
: InspectorTextBase(parent)
: InspectorStaffText(parent)
{
f.setupUi(addWidget());

const std::vector<InspectorItem> iiList = {
{ Pid::SUB_STYLE, 0, f.style, f.resetStyle },
};
const std::vector<InspectorPanel> ppList = {
{ f.title, f.panel }
};

populateStyle(f.style);

mapSignals(iiList, ppList);
}

//---------------------------------------------------------
@@ -13,20 +13,18 @@
#ifndef __INSPECTOR_FINGERING_H__
#define __INSPECTOR_FINGERING_H__

#include "inspectorTextBase.h"
#include "ui_inspector_fingering.h"
#include "inspector.h"
#include "ui_inspector_stafftext.h"

namespace Ms {

//---------------------------------------------------------
// InspectorFingering
//---------------------------------------------------------

class InspectorFingering : public InspectorTextBase {
class InspectorFingering : public InspectorStaffText {
Q_OBJECT

Ui::InspectorFingering f;

public:
InspectorFingering(QWidget* parent);
virtual const std::vector<Tid>& allowedTextStyles() override;
@@ -603,7 +603,6 @@
<linked>
<indexDiff>5</indexDiff>
</linked>
<placement>below</placement>
<text>T</text>
</Fingering>
<pitch>62</pitch>
@@ -622,7 +621,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>1</text>
</Fingering>
<pitch>53</pitch>
@@ -641,7 +639,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>2</text>
</Fingering>
<pitch>47</pitch>
@@ -660,7 +657,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>3</text>
</Fingering>
<pitch>55</pitch>
@@ -683,7 +679,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>4</text>
</Fingering>
<pitch>59</pitch>
@@ -702,7 +697,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>T</text>
</Fingering>
<pitch>51</pitch>
@@ -721,7 +715,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>I</text>
</Fingering>
<pitch>61</pitch>
@@ -740,7 +733,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>M</text>
</Fingering>
<pitch>52</pitch>
@@ -763,7 +755,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>A</text>
</Fingering>
<pitch>55</pitch>
@@ -782,7 +773,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>O</text>
</Fingering>
<pitch>56</pitch>
@@ -603,7 +603,6 @@
<linked>
<indexDiff>5</indexDiff>
</linked>
<placement>below</placement>
<text>T</text>
</Fingering>
<pitch>62</pitch>
@@ -622,7 +621,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>1</text>
</Fingering>
<pitch>53</pitch>
@@ -641,7 +639,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>2</text>
</Fingering>
<pitch>47</pitch>
@@ -660,7 +657,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>3</text>
</Fingering>
<pitch>55</pitch>
@@ -683,7 +679,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>4</text>
</Fingering>
<pitch>59</pitch>
@@ -702,7 +697,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>T</text>
</Fingering>
<pitch>51</pitch>
@@ -721,7 +715,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>I</text>
</Fingering>
<pitch>61</pitch>
@@ -740,7 +733,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>M</text>
</Fingering>
<pitch>52</pitch>
@@ -763,7 +755,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>A</text>
</Fingering>
<pitch>55</pitch>
@@ -782,7 +773,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>O</text>
</Fingering>
<pitch>56</pitch>
@@ -723,7 +723,6 @@
<linked>
<indexDiff>5</indexDiff>
</linked>
<placement>below</placement>
<text>O</text>
</Fingering>
<pitch>62</pitch>
@@ -742,7 +741,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>t</text>
</Fingering>
<pitch>53</pitch>
@@ -761,7 +759,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>1</text>
</Fingering>
<pitch>47</pitch>
@@ -780,7 +777,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>2</text>
</Fingering>
<pitch>55</pitch>
@@ -803,7 +799,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>3</text>
</Fingering>
<pitch>59</pitch>
@@ -822,7 +817,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>4</text>
</Fingering>
<pitch>51</pitch>
@@ -841,7 +835,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>P</text>
</Fingering>
<pitch>61</pitch>
@@ -860,7 +853,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>I</text>
</Fingering>
<pitch>52</pitch>
@@ -883,7 +875,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>M</text>
</Fingering>
<pitch>55</pitch>
@@ -902,7 +893,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>A</text>
</Fingering>
<pitch>56</pitch>
@@ -921,7 +911,6 @@
<Fingering>
<linked>
</linked>
<placement>below</placement>
<text>C</text>
</Fingering>
<pitch>52</pitch>
@@ -295,7 +295,6 @@
<linkedMain/>
<Fingering>
<linkedMain/>
<placement>below</placement>
<offset x="1.05809" y="-4.67501"/>
<text>2</text>
</Fingering>
@@ -712,7 +711,6 @@
<linkedMain/>
<Fingering>
<linkedMain/>
<placement>below</placement>
<offset x="1.05809" y="-4.67501"/>
<text>2</text>
</Fingering>

0 comments on commit d9f656e

Please sign in to comment.
You can’t perform that action at this time.