bend: add stlye page, add lineWidth property + style
This commit is contained in:
parent
e0915fcc4c
commit
c1be1e4ab5
8 changed files with 356 additions and 27 deletions
|
@ -20,7 +20,7 @@
|
|||
|
||||
namespace Ms {
|
||||
|
||||
constexpr std::array<StyledProperty,6> Bend::_styledProperties;
|
||||
constexpr std::array<StyledProperty, BEND_STYLED_PROPERTIES+1> Bend::_styledProperties;
|
||||
|
||||
//---------------------------------------------------------
|
||||
// label
|
||||
|
@ -39,12 +39,13 @@ static const char* label[] = {
|
|||
Bend::Bend(Score* s)
|
||||
: Element(s)
|
||||
{
|
||||
static constexpr std::array<P_ID,5> properties {
|
||||
static constexpr std::array<P_ID,6> properties {
|
||||
P_ID::FONT_FACE,
|
||||
P_ID::FONT_SIZE,
|
||||
P_ID::FONT_BOLD,
|
||||
P_ID::FONT_ITALIC,
|
||||
P_ID::FONT_UNDERLINE,
|
||||
P_ID::LINE_WIDTH,
|
||||
};
|
||||
|
||||
for (P_ID id : properties)
|
||||
|
@ -90,7 +91,7 @@ void Bend::layout()
|
|||
}
|
||||
}
|
||||
|
||||
_lw = _spatium * 0.15;
|
||||
qreal _lw = _lineWidth.val() * _spatium;
|
||||
Note* note = toNote(parent());
|
||||
if (note == 0) {
|
||||
noteWidth = 0.0;
|
||||
|
@ -188,11 +189,13 @@ void Bend::layout()
|
|||
|
||||
void Bend::draw(QPainter* painter) const
|
||||
{
|
||||
qreal _spatium = spatium();
|
||||
qreal _lw = _lineWidth.val() * _spatium;
|
||||
|
||||
QPen pen(curColor(), _lw, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
|
||||
painter->setPen(pen);
|
||||
painter->setBrush(QBrush(curColor()));
|
||||
|
||||
qreal _spatium = spatium();
|
||||
QFont f = font(_spatium * MScore::pixelRatio);
|
||||
painter->setFont(f);
|
||||
|
||||
|
@ -341,6 +344,8 @@ QVariant Bend::getProperty(P_ID id) const
|
|||
return _fontUnderline;
|
||||
case P_ID::PLAY:
|
||||
return bool(playBend());
|
||||
case P_ID::LINE_WIDTH:
|
||||
return _lineWidth;
|
||||
default:
|
||||
return Element::getProperty(id);
|
||||
}
|
||||
|
@ -371,6 +376,9 @@ bool Bend::setProperty(P_ID id, const QVariant& v)
|
|||
case P_ID::PLAY:
|
||||
setPlayBend(v.toBool());
|
||||
break;
|
||||
case P_ID::LINE_WIDTH:
|
||||
_lineWidth = v.value<Spatium>();
|
||||
break;
|
||||
default:
|
||||
return Element::setProperty(id, v);
|
||||
}
|
||||
|
|
|
@ -30,26 +30,29 @@ class Bend final : public Element {
|
|||
bool _fontBold;
|
||||
bool _fontItalic;
|
||||
bool _fontUnderline;
|
||||
Spatium _lineWidth;
|
||||
|
||||
bool _playBend { true };
|
||||
QList<PitchValue> _points;
|
||||
qreal _lw;
|
||||
|
||||
QPointF notePos;
|
||||
qreal noteWidth;
|
||||
|
||||
QFont font(qreal) const;
|
||||
|
||||
static constexpr std::array<StyledProperty,6> _styledProperties {{
|
||||
#define BEND_STYLED_PROPERTIES 6
|
||||
static constexpr std::array<StyledProperty, BEND_STYLED_PROPERTIES + 1> _styledProperties {{
|
||||
{ StyleIdx::bendFontFace, P_ID::FONT_FACE },
|
||||
{ StyleIdx::bendFontSize, P_ID::FONT_SIZE },
|
||||
{ StyleIdx::bendFontBold, P_ID::FONT_BOLD },
|
||||
{ StyleIdx::bendFontItalic, P_ID::FONT_ITALIC },
|
||||
{ StyleIdx::bendFontUnderline, P_ID::FONT_UNDERLINE },
|
||||
{ StyleIdx::bendLineWidth, P_ID::LINE_WIDTH },
|
||||
{ StyleIdx::NOSTYLE, P_ID::END } // end of list marker
|
||||
}};
|
||||
|
||||
PropertyFlags _propertyFlagsList[5] = {
|
||||
PropertyFlags _propertyFlagsList[BEND_STYLED_PROPERTIES] = {
|
||||
PropertyFlags::STYLED,
|
||||
PropertyFlags::STYLED,
|
||||
PropertyFlags::STYLED,
|
||||
PropertyFlags::STYLED,
|
||||
|
|
|
@ -673,6 +673,7 @@ static const StyleType styleTypes[] {
|
|||
{ StyleIdx::bendFontBold, "bendFontBold", false },
|
||||
{ StyleIdx::bendFontItalic, "bendFontItalic", false },
|
||||
{ StyleIdx::bendFontUnderline, "bendFontUnderline", false },
|
||||
{ StyleIdx::bendLineWidth, "bendLineWidth", Spatium(0.15) },
|
||||
|
||||
{ StyleIdx::headerFontFace, "headerFontFace", "FreeSerif" },
|
||||
{ StyleIdx::headerFontSize, "headerFontSize", 8.0 },
|
||||
|
|
|
@ -653,6 +653,7 @@ enum class StyleIdx {
|
|||
bendFontBold,
|
||||
bendFontItalic,
|
||||
bendFontUnderline,
|
||||
bendLineWidth,
|
||||
|
||||
headerFontFace,
|
||||
headerFontSize,
|
||||
|
|
|
@ -353,6 +353,13 @@ EditStyle::EditStyle(Score* s, QWidget* parent)
|
|||
{ StyleIdx::staffTextPosAbove, false, staffTextPosAbove, resetStaffTextPosAbove },
|
||||
{ StyleIdx::staffTextPosBelow, false, staffTextPosBelow, resetStaffTextPosBelow },
|
||||
{ StyleIdx::staffTextMinDistance, false, staffTextMinDistance, resetStaffTextMinDistance },
|
||||
|
||||
{ StyleIdx::bendFontFace, false, bendFontFace, resetBendFontFace },
|
||||
{ StyleIdx::bendFontSize, false, bendFontSize, resetBendFontSize },
|
||||
{ StyleIdx::bendFontBold, false, bendFontBold, resetBendFontBold },
|
||||
{ StyleIdx::bendFontItalic, false, bendFontItalic, resetBendFontItalic },
|
||||
{ StyleIdx::bendFontUnderline, false, bendFontUnderline, resetBendFontUnderline },
|
||||
{ StyleIdx::bendLineWidth, false, bendLineWidth, resetBendLineWidth },
|
||||
};
|
||||
|
||||
for (QComboBox* cb : std::vector<QComboBox*> {
|
||||
|
|
|
@ -158,6 +158,11 @@
|
|||
<string>Fretboard Diagrams</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Bend</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Figured Bass</string>
|
||||
|
@ -186,7 +191,7 @@
|
|||
</widget>
|
||||
<widget class="QStackedWidget" name="pageStack">
|
||||
<property name="currentIndex">
|
||||
<number>22</number>
|
||||
<number>27</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="PageScore">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_20">
|
||||
|
@ -8978,6 +8983,278 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_2">
|
||||
<layout class="QGridLayout" name="gridLayout_35">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_39">
|
||||
<property name="title">
|
||||
<string>Bend</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_36">
|
||||
<item row="1" column="4">
|
||||
<widget class="QLabel" name="label_181">
|
||||
<property name="text">
|
||||
<string>size:</string>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer_31">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="5">
|
||||
<widget class="QDoubleSpinBox" name="bendFontSize">
|
||||
<property name="suffix">
|
||||
<string>sp</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="6">
|
||||
<widget class="QToolButton" name="resetBendFontSize">
|
||||
<property name="toolTip">
|
||||
<string>Reset to default</string>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Reset 'Font size' 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_182">
|
||||
<property name="text">
|
||||
<string>Font face:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="7">
|
||||
<widget class="QLabel" name="label_183">
|
||||
<property name="text">
|
||||
<string>style:</string>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>11</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QToolButton" name="resetBendFontFace">
|
||||
<property name="toolTip">
|
||||
<string>Reset to default</string>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Reset 'Font face' 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="8">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_22">
|
||||
<item>
|
||||
<widget class="QPushButton" name="bendFontBold">
|
||||
<property name="accessibleName">
|
||||
<string>Bold</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="musescore.qrc">
|
||||
<normaloff>:/data/icons/format-text-bold.svg</normaloff>:/data/icons/format-text-bold.svg</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="resetBendFontBold">
|
||||
<property name="toolTip">
|
||||
<string>Reset to default</string>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Reset 'Bold' 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>
|
||||
<widget class="QPushButton" name="bendFontItalic">
|
||||
<property name="accessibleName">
|
||||
<string>Italic</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="musescore.qrc">
|
||||
<normaloff>:/data/icons/format-text-italic.svg</normaloff>:/data/icons/format-text-italic.svg</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="resetBendFontItalic">
|
||||
<property name="toolTip">
|
||||
<string>Reset to default</string>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Reset 'Italic' 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>
|
||||
<widget class="QToolButton" name="bendFontUnderline">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Underline</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="musescore.qrc">
|
||||
<normaloff>:/data/icons/format-text-underline.svg</normaloff>:/data/icons/format-text-underline.svg</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="resetBendFontUnderline">
|
||||
<property name="toolTip">
|
||||
<string>Reset to default</string>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Reset 'Underline' 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>
|
||||
</item>
|
||||
<item row="1" column="9">
|
||||
<spacer name="horizontalSpacer_46">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_179">
|
||||
<property name="text">
|
||||
<string>Line thickness:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>barreLineWidth</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="bendLineWidth">
|
||||
<property name="suffix">
|
||||
<string>sp</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QFontComboBox" name="bendFontFace">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QToolButton" name="resetBendLineWidth">
|
||||
<property name="toolTip">
|
||||
<string>Reset to default</string>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Reset 'Font face' 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>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="PageFiguredBass">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
|
|
|
@ -754,6 +754,7 @@ InspectorBend::InspectorBend(QWidget* parent)
|
|||
g.setupUi(addWidget());
|
||||
|
||||
const std::vector<InspectorItem> iiList = {
|
||||
{ P_ID::LINE_WIDTH, 0, g.lineWidth, g.resetLineWidth },
|
||||
{ P_ID::PLAY, 0, g.playBend, g.resetPlayBend },
|
||||
{ P_ID::FONT_FACE, 0, g.fontFace, g.resetFontFace },
|
||||
{ P_ID::FONT_SIZE, 0, g.fontSize, g.resetFontSize },
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>299</width>
|
||||
<height>180</height>
|
||||
<width>360</width>
|
||||
<height>218</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -79,7 +79,7 @@
|
|||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Font size:</string>
|
||||
|
@ -89,7 +89,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="playBend">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
|
@ -105,7 +105,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<item row="6" column="0">
|
||||
<widget class="QToolButton" name="properties">
|
||||
<property name="text">
|
||||
<string>Properties</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QToolButton" name="resetPlayBend">
|
||||
<property name="toolTip">
|
||||
<string>Reset to default</string>
|
||||
|
@ -123,13 +130,6 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QToolButton" name="properties">
|
||||
<property name="text">
|
||||
<string>Properties</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
@ -145,7 +145,7 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<item row="1" column="1">
|
||||
<widget class="QFontComboBox" name="fontFace">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
|
@ -155,7 +155,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Font face:</string>
|
||||
|
@ -165,10 +165,10 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="fontSize"/>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<item row="2" column="2">
|
||||
<widget class="QToolButton" name="resetFontSize">
|
||||
<property name="toolTip">
|
||||
<string>Reset to default</string>
|
||||
|
@ -185,7 +185,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<item row="1" column="2">
|
||||
<widget class="QToolButton" name="resetFontFace">
|
||||
<property name="toolTip">
|
||||
<string>Reset to default</string>
|
||||
|
@ -202,14 +202,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Font style:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="bold">
|
||||
|
@ -351,6 +351,37 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Line width:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="lineWidth">
|
||||
<property name="suffix">
|
||||
<string>sp</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="resetLineWidth">
|
||||
<property name="toolTip">
|
||||
<string>Reset to default</string>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Reset 'Font face' 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>
|
||||
|
|
Loading…
Reference in a new issue