add instrument name panel to inspector
This commit is contained in:
parent
95ce45afec
commit
35b948adaf
12 changed files with 227 additions and 15 deletions
|
@ -224,13 +224,13 @@ void Bracket::draw(QPainter* painter) const
|
|||
}
|
||||
break;
|
||||
case BracketType::NORMAL: {
|
||||
qreal h = 2 * h2;
|
||||
qreal h = 2 * h2;
|
||||
qreal _spatium = spatium();
|
||||
qreal w = score()->styleP(StyleIdx::bracketWidth);
|
||||
qreal w = score()->styleP(StyleIdx::bracketWidth);
|
||||
qreal bd = _spatium * .25;
|
||||
QPen pen(curColor(), w, Qt::SolidLine, Qt::FlatCap);
|
||||
painter->setPen(pen);
|
||||
qreal bd = _spatium * .25;
|
||||
painter->drawLine(QLineF(0.0, -bd, 0.0, h + bd));
|
||||
painter->drawLine(QLineF(0.0, -bd - w * .5, 0.0, h + bd + w * .5));
|
||||
qreal x = -w * .5;
|
||||
qreal y1 = -bd;
|
||||
qreal y2 = h + bd;
|
||||
|
|
|
@ -26,7 +26,6 @@ InstrumentName::InstrumentName(Score* s)
|
|||
: Text(s)
|
||||
{
|
||||
setInstrumentNameType(InstrumentNameType::SHORT);
|
||||
_layoutPos = 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -81,5 +80,51 @@ void InstrumentName::endEdit()
|
|||
score()->undo(new ChangePart(part, instrument, part->name()));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// getProperty
|
||||
//---------------------------------------------------------
|
||||
|
||||
QVariant InstrumentName::getProperty(P_ID id) const
|
||||
{
|
||||
switch (id) {
|
||||
case P_ID::INAME_LAYOUT_POSITION:
|
||||
return _layoutPos;
|
||||
default:
|
||||
return Text::getProperty(id);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// setProperty
|
||||
//---------------------------------------------------------
|
||||
|
||||
bool InstrumentName::setProperty(P_ID id, const QVariant& v)
|
||||
{
|
||||
switch (id) {
|
||||
case P_ID::INAME_LAYOUT_POSITION:
|
||||
_layoutPos = v.toInt();
|
||||
printf("%p set layoutPos %d\n", this, _layoutPos);
|
||||
break;
|
||||
default:
|
||||
return Text::setProperty(id, v);
|
||||
}
|
||||
score()->setLayoutAll();
|
||||
return true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// propertyDefault
|
||||
//---------------------------------------------------------
|
||||
|
||||
QVariant InstrumentName::propertyDefault(P_ID id) const
|
||||
{
|
||||
switch (id) {
|
||||
case P_ID::INAME_LAYOUT_POSITION:
|
||||
return 0;
|
||||
default:
|
||||
return Text::propertyDefault(id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ enum class InstrumentNameType : char {
|
|||
|
||||
class InstrumentName : public Text {
|
||||
InstrumentNameType _instrumentNameType;
|
||||
int _layoutPos;
|
||||
int _layoutPos { 0 };
|
||||
|
||||
public:
|
||||
InstrumentName(Score*);
|
||||
|
@ -42,6 +42,10 @@ class InstrumentName : public Text {
|
|||
void setInstrumentNameType(InstrumentNameType v);
|
||||
void setInstrumentNameType(const QString& s);
|
||||
virtual void endEdit() override;
|
||||
|
||||
virtual QVariant getProperty(P_ID propertyId) const override;
|
||||
virtual bool setProperty(P_ID propertyId, const QVariant&) override;
|
||||
virtual QVariant propertyDefault(P_ID) const override;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ class Part : public QObject, public ScoreElement {
|
|||
Q_PROPERTY(int startTrack READ startTrack)
|
||||
Q_PROPERTY(int volume READ volume WRITE setVolume)
|
||||
|
||||
QString _partName; ///< used in tracklist (mixer)
|
||||
QString _partName; ///< used in tracklist (mixer)
|
||||
InstrumentList _instruments;
|
||||
QList<Staff*> _staves;
|
||||
QString _id; ///< used for MusicXml import
|
||||
|
|
|
@ -270,6 +270,8 @@ static const PropertyData propertyList[] = {
|
|||
{ P_ID::STAFF_BARLINE_SPAN_TO, false, "barLineSpanTo", P_TYPE::INT },
|
||||
|
||||
{ P_ID::BRACKET_COLUMN, false, "level", P_TYPE::INT },
|
||||
{ P_ID::INAME_LAYOUT_POSITION, false, "layoutPosition", P_TYPE::INT },
|
||||
|
||||
{ P_ID::END, false, "", P_TYPE::INT }
|
||||
};
|
||||
|
||||
|
|
|
@ -262,6 +262,7 @@ enum class P_ID : int {
|
|||
STAFF_BARLINE_SPAN_TO,
|
||||
|
||||
BRACKET_COLUMN,
|
||||
INAME_LAYOUT_POSITION,
|
||||
|
||||
END
|
||||
};
|
||||
|
|
|
@ -554,7 +554,7 @@ void System::setInstrumentNames(bool longName)
|
|||
for (SysStaff* staff : _staves) {
|
||||
Staff* s = score()->staff(staffIdx);
|
||||
if (!s->isTop() || !s->show()) {
|
||||
foreach (InstrumentName* t, staff->instrumentNames)
|
||||
for (InstrumentName* t : staff->instrumentNames)
|
||||
score()->removeElement(t);
|
||||
++staffIdx;
|
||||
continue;
|
||||
|
@ -564,7 +564,7 @@ void System::setInstrumentNames(bool longName)
|
|||
const QList<StaffName>& names = longName? part->longNames(tick) : part->shortNames(tick);
|
||||
|
||||
int idx = 0;
|
||||
foreach (const StaffName& sn, names) {
|
||||
for (const StaffName& sn : names) {
|
||||
InstrumentName* iname = staff->instrumentNames.value(idx);
|
||||
if (iname == 0) {
|
||||
iname = new InstrumentName(score());
|
||||
|
@ -572,10 +572,10 @@ void System::setInstrumentNames(bool longName)
|
|||
iname->setParent(this);
|
||||
iname->setTrack(staffIdx * VOICES);
|
||||
iname->setInstrumentNameType(longName ? InstrumentNameType::LONG : InstrumentNameType::SHORT);
|
||||
iname->setLayoutPos(sn.pos());
|
||||
score()->addElement(iname);
|
||||
}
|
||||
iname->setXmlText(sn.name());
|
||||
iname->setLayoutPos(sn.pos());
|
||||
++idx;
|
||||
}
|
||||
for (; idx < staff->instrumentNames.size(); ++idx)
|
||||
|
|
|
@ -409,6 +409,21 @@ void TieSegment::computeBezier(QPointF p6o)
|
|||
|
||||
path.translate(staffOffset);
|
||||
shapePath.translate(staffOffset);
|
||||
|
||||
QPainterPath p;
|
||||
p.moveTo(QPointF());
|
||||
p.cubicTo(p3 + p3o - th, p4 + p4o - th, p2);
|
||||
_shape.clear();
|
||||
QPointF start;
|
||||
start = t.map(start);
|
||||
int nbShapes = 15;
|
||||
for (int i = 1; i <= nbShapes; i++) {
|
||||
QPointF point = t.map(p.pointAtPercent(i/float(nbShapes)));
|
||||
QRectF re(start, point);
|
||||
re.translate(staffOffset);
|
||||
_shape.add(re);
|
||||
start = point;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
|
|
@ -132,6 +132,7 @@ QT5_WRAP_UI (ui_headers
|
|||
inspector/inspector_tremolo.ui
|
||||
inspector/inspector_caesura.ui
|
||||
inspector/inspector_bracket.ui
|
||||
inspector/inspector_iname.ui
|
||||
${SCRIPT_UI}
|
||||
)
|
||||
|
||||
|
|
|
@ -239,10 +239,7 @@ void Inspector::setElements(const QList<Element*>& l)
|
|||
ie = new InspectorSlurTie(this);
|
||||
break;
|
||||
case Element::Type::BAR_LINE:
|
||||
// if (_element->isEditable())
|
||||
ie = new InspectorBarLine(this);
|
||||
// else
|
||||
// ie = new InspectorEmpty(this);
|
||||
ie = new InspectorBarLine(this);
|
||||
break;
|
||||
case Element::Type::JUMP:
|
||||
ie = new InspectorJump(this);
|
||||
|
@ -294,7 +291,7 @@ void Inspector::setElements(const QList<Element*>& l)
|
|||
ie = new InspectorBracket(this);
|
||||
break;
|
||||
case Element::Type::INSTRUMENT_NAME:
|
||||
ie = new InspectorEmpty(this);
|
||||
ie = new InspectorIname(this);
|
||||
break;
|
||||
default:
|
||||
if (_element->isText())
|
||||
|
@ -1209,5 +1206,19 @@ InspectorBracket::InspectorBracket(QWidget* parent) : InspectorBase(parent)
|
|||
mapSignals(il);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// InspectorIname
|
||||
//---------------------------------------------------------
|
||||
|
||||
InspectorIname::InspectorIname(QWidget* parent) : InspectorBase(parent)
|
||||
{
|
||||
i.setupUi(addWidget());
|
||||
|
||||
const std::vector<InspectorItem> il = {
|
||||
{ P_ID::INAME_LAYOUT_POSITION, 0, 0, i.layoutPosition, i.resetLayoutPosition }
|
||||
};
|
||||
mapSignals(il);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "ui_inspector_tremolo.h"
|
||||
#include "ui_inspector_caesura.h"
|
||||
#include "ui_inspector_bracket.h"
|
||||
#include "ui_inspector_iname.h"
|
||||
|
||||
namespace Ms {
|
||||
|
||||
|
@ -442,6 +443,19 @@ class InspectorBracket : public InspectorBase {
|
|||
InspectorBracket(QWidget* parent);
|
||||
};
|
||||
|
||||
//---------------------------------------------------------
|
||||
// InspectorIname
|
||||
//---------------------------------------------------------
|
||||
|
||||
class InspectorIname : public InspectorBase {
|
||||
Q_OBJECT
|
||||
|
||||
Ui::InspectorIname i;
|
||||
|
||||
public:
|
||||
InspectorIname(QWidget* parent);
|
||||
};
|
||||
|
||||
//---------------------------------------------------------
|
||||
// InspectorEmpty
|
||||
//---------------------------------------------------------
|
||||
|
|
119
mscore/inspector/inspector_iname.ui
Normal file
119
mscore/inspector/inspector_iname.ui
Normal file
|
@ -0,0 +1,119 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>InspectorIname</class>
|
||||
<widget class="QWidget" name="InspectorIname">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>209</width>
|
||||
<height>119</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Breath/Caesura Inspector</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="title">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Instrument Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::HLine</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>2</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="panel" native="true">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="layoutPosition">
|
||||
<property name="maximum">
|
||||
<number>5</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Layout position:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="resetLayoutPosition">
|
||||
<property name="toolTip">
|
||||
<string>Reset to default</string>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Reset 'Pause' 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>
|
||||
<resources>
|
||||
<include location="../musescore.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in a new issue