add inspector panel for Bracket
This commit is contained in:
parent
b0074320d7
commit
95ce45afec
11 changed files with 188 additions and 38 deletions
|
@ -194,7 +194,6 @@ void Bracket::layout()
|
|||
case BracketType::NO_BRACKET:
|
||||
break;
|
||||
}
|
||||
_shape.translate(pos());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -213,9 +212,9 @@ void Bracket::draw(QPainter* painter) const
|
|||
painter->drawPath(path);
|
||||
}
|
||||
else {
|
||||
qreal h = 2 * h2;
|
||||
qreal h = 2 * h2;
|
||||
qreal _spatium = spatium();
|
||||
qreal mag = h / (4 *_spatium);
|
||||
qreal mag = h / (4 *_spatium);
|
||||
painter->setPen(curColor());
|
||||
painter->save();
|
||||
painter->scale(_magx, mag);
|
||||
|
@ -322,14 +321,6 @@ void Bracket::read(XmlReader& e)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// startEdit
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Bracket::startEdit(MuseScoreView*, const QPointF&)
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// updateGrips
|
||||
//---------------------------------------------------------
|
||||
|
@ -340,22 +331,14 @@ void Bracket::updateGrips(Grip* defaultGrip, QVector<QRectF>& grip) const
|
|||
grip[0].translate(QPointF(0.0, h2 * 2) + pagePos());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// gripAnchor
|
||||
//---------------------------------------------------------
|
||||
|
||||
QPointF Bracket::gripAnchor(Grip) const
|
||||
{
|
||||
return QPointF();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// endEdit
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Bracket::endEdit()
|
||||
{
|
||||
//TODO endEditDrag();
|
||||
EditData d;
|
||||
endEditDrag(d);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -485,6 +468,8 @@ QVariant Bracket::getProperty(P_ID id) const
|
|||
switch (id) {
|
||||
case P_ID::SYSTEM_BRACKET:
|
||||
return int(bracketType());
|
||||
case P_ID::BRACKET_COLUMN:
|
||||
return _column;
|
||||
default:
|
||||
return Element::getProperty(id);
|
||||
}
|
||||
|
@ -500,11 +485,19 @@ bool Bracket::setProperty(P_ID id, const QVariant& v)
|
|||
case P_ID::SYSTEM_BRACKET:
|
||||
staff()->setBracket(level(), BracketType(v.toInt())); // change bracket type global
|
||||
// setBracketType(BracketType(v.toInt()));
|
||||
score()->setLayoutAll();
|
||||
break;
|
||||
case P_ID::BRACKET_COLUMN: {
|
||||
int oldColumn = _column;
|
||||
_column = v.toInt(); // TODO
|
||||
staff()->swapBracket(oldColumn, _column, _bracketType);
|
||||
staff()->setBracketSpan(_column, _lastStaff - _firstStaff + 1);
|
||||
score()->moveBracket(staffIdx(), oldColumn, _column);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return Element::setProperty(id, v);
|
||||
}
|
||||
score()->setLayoutAll();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -517,6 +510,8 @@ QVariant Bracket::propertyDefault(P_ID id) const
|
|||
switch (id) {
|
||||
case P_ID::SYSTEM_BRACKET:
|
||||
return int(BracketType::NORMAL);
|
||||
case P_ID::BRACKET_COLUMN:
|
||||
return 0;
|
||||
default:
|
||||
return Element::propertyDefault(id);
|
||||
}
|
||||
|
|
|
@ -75,14 +75,12 @@ class Bracket : public Element {
|
|||
virtual void layout() override;
|
||||
|
||||
virtual bool isEditable() const override { return true; }
|
||||
virtual void startEdit(MuseScoreView*, const QPointF&) override;
|
||||
virtual bool edit(MuseScoreView*, Grip, int, Qt::KeyboardModifiers, const QString&) override;
|
||||
virtual void endEdit() override;
|
||||
virtual void editDrag(const EditData&) override;
|
||||
virtual void endEditDrag(const EditData&) override;
|
||||
virtual void updateGrips(Grip*, QVector<QRectF>&) const override;
|
||||
virtual int grips() const override { return 1; }
|
||||
virtual QPointF gripAnchor(Grip) const override;
|
||||
|
||||
virtual bool acceptDrop(const DropData&) const override;
|
||||
virtual Element* drop(const DropData&) override;
|
||||
|
|
|
@ -269,6 +269,7 @@ static const PropertyData propertyList[] = {
|
|||
{ P_ID::STAFF_BARLINE_SPAN_FROM, false, "barLineSpanFrom", P_TYPE::INT },
|
||||
{ P_ID::STAFF_BARLINE_SPAN_TO, false, "barLineSpanTo", P_TYPE::INT },
|
||||
|
||||
{ P_ID::BRACKET_COLUMN, false, "level", P_TYPE::INT },
|
||||
{ P_ID::END, false, "", P_TYPE::INT }
|
||||
};
|
||||
|
||||
|
|
|
@ -261,6 +261,8 @@ enum class P_ID : int {
|
|||
STAFF_BARLINE_SPAN_FROM,
|
||||
STAFF_BARLINE_SPAN_TO,
|
||||
|
||||
BRACKET_COLUMN,
|
||||
|
||||
END
|
||||
};
|
||||
|
||||
|
|
|
@ -85,6 +85,19 @@ void Staff::setBracket(int idx, BracketType val)
|
|||
_brackets.removeLast();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// swapBracket
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Staff::swapBracket(int oldIdx, int newIdx, BracketType val)
|
||||
{
|
||||
for (int i = _brackets.size(); i <= newIdx; ++i)
|
||||
_brackets.append(BracketItem());
|
||||
_brackets.swap(oldIdx, newIdx);
|
||||
while (!_brackets.empty() && (_brackets.last()._bracket == BracketType::NO_BRACKET))
|
||||
_brackets.removeLast();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// setBracketSpan
|
||||
//---------------------------------------------------------
|
||||
|
|
|
@ -155,6 +155,7 @@ class Staff : public QObject, public ScoreElement {
|
|||
BracketType bracket(int idx) const;
|
||||
int bracketSpan(int idx) const;
|
||||
void setBracket(int idx, BracketType val);
|
||||
void swapBracket(int oldIdx, int newIdx, BracketType val);
|
||||
void setBracketSpan(int idx, int val);
|
||||
int bracketLevels() const { return _brackets.size(); }
|
||||
void addBracket(BracketItem);
|
||||
|
|
|
@ -229,7 +229,6 @@ void System::layoutSystem(qreal xo1)
|
|||
|
||||
_leftMargin = xoff2;
|
||||
|
||||
|
||||
qreal bd = score()->styleP(StyleIdx::bracketDistance);
|
||||
if ( _brackets.size() > 0) {
|
||||
for (int i = 0; i < bracketLevels; ++i)
|
||||
|
|
|
@ -131,6 +131,7 @@ QT5_WRAP_UI (ui_headers
|
|||
inspector/inspector_arpeggio.ui
|
||||
inspector/inspector_tremolo.ui
|
||||
inspector/inspector_caesura.ui
|
||||
inspector/inspector_bracket.ui
|
||||
${SCRIPT_UI}
|
||||
)
|
||||
|
||||
|
|
|
@ -290,19 +290,17 @@ void Inspector::setElements(const QList<Element*>& l)
|
|||
case Element::Type::STAFFTYPE_CHANGE:
|
||||
ie = new InspectorStaffTypeChange(this);
|
||||
break;
|
||||
case Element::Type::BRACKET:
|
||||
ie = new InspectorBracket(this);
|
||||
break;
|
||||
case Element::Type::INSTRUMENT_NAME:
|
||||
ie = new InspectorEmpty(this);
|
||||
break;
|
||||
default:
|
||||
if (_element->isText()) {
|
||||
if (_element->type() == Element::Type::INSTRUMENT_NAME) // these are generated
|
||||
ie = new InspectorEmpty(this);
|
||||
else
|
||||
ie = new InspectorText(this);
|
||||
}
|
||||
else {
|
||||
if (_element->type() == Element::Type::BRACKET) // these are generated
|
||||
ie = new InspectorEmpty(this);
|
||||
else
|
||||
ie = new InspectorElement(this);
|
||||
}
|
||||
if (_element->isText())
|
||||
ie = new InspectorText(this);
|
||||
else
|
||||
ie = new InspectorElement(this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1197,5 +1195,19 @@ InspectorCaesura::InspectorCaesura(QWidget* parent) : InspectorElementBase(paren
|
|||
mapSignals(il, ppList);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// InspectorBracket
|
||||
//---------------------------------------------------------
|
||||
|
||||
InspectorBracket::InspectorBracket(QWidget* parent) : InspectorBase(parent)
|
||||
{
|
||||
b.setupUi(addWidget());
|
||||
|
||||
const std::vector<InspectorItem> il = {
|
||||
{ P_ID::BRACKET_COLUMN, 0, 0, b.column, b.resetColumn }
|
||||
};
|
||||
mapSignals(il);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "ui_inspector_fret.h"
|
||||
#include "ui_inspector_tremolo.h"
|
||||
#include "ui_inspector_caesura.h"
|
||||
#include "ui_inspector_bracket.h"
|
||||
|
||||
namespace Ms {
|
||||
|
||||
|
@ -422,13 +423,25 @@ class InspectorSlurTie : public InspectorElementBase {
|
|||
class InspectorCaesura : public InspectorElementBase {
|
||||
Q_OBJECT
|
||||
|
||||
// UiInspectorElement e;
|
||||
Ui::InspectorCaesura c;
|
||||
|
||||
public:
|
||||
InspectorCaesura(QWidget* parent);
|
||||
};
|
||||
|
||||
//---------------------------------------------------------
|
||||
// InspectorBracket
|
||||
//---------------------------------------------------------
|
||||
|
||||
class InspectorBracket : public InspectorBase {
|
||||
Q_OBJECT
|
||||
|
||||
Ui::InspectorBracket b;
|
||||
|
||||
public:
|
||||
InspectorBracket(QWidget* parent);
|
||||
};
|
||||
|
||||
//---------------------------------------------------------
|
||||
// InspectorEmpty
|
||||
//---------------------------------------------------------
|
||||
|
|
115
mscore/inspector/inspector_bracket.ui
Normal file
115
mscore/inspector/inspector_bracket.ui
Normal file
|
@ -0,0 +1,115 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>InspectorBracket</class>
|
||||
<widget class="QWidget" name="InspectorBracket">
|
||||
<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>Bracket</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="column"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Column:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="resetColumn">
|
||||
<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