Added Harmony view to the Object Debugger

This commit is contained in:
Tony Mountifield 2013-04-16 11:09:54 +01:00
parent 268c657188
commit fa71326c16
5 changed files with 539 additions and 1 deletions

View file

@ -104,6 +104,7 @@ class Harmony : public Text {
virtual bool edit(MuseScoreView*, int grip, int key, Qt::KeyboardModifiers, const QString& s);
virtual void endEdit();
QString hUserName() const { return _userName; }
int baseTpc() const { return _baseTpc; }
void setBaseTpc(int val) { _baseTpc = val; }
int rootTpc() const { return _rootTpc; }

View file

@ -62,7 +62,7 @@ QT4_WRAP_UI (ui_headers
box.ui pluginManager.ui inspector_jump.ui inspector_marker.ui inspector_glissando.ui
inspector_clef.ui inspector_timesig.ui inspector_keysig.ui inspector_barline.ui
inspector_tuplet.ui inspector_accidental.ui inspector_tempotext.ui
inspector_dynamic.ui inspector_line.ui
inspector_dynamic.ui inspector_line.ui harmony.ui
${SCRIPT_UI}
)

View file

@ -63,6 +63,8 @@
#include "libmscore/harmony.h"
#include "libmscore/stemslash.h"
#include "libmscore/ledgerline.h"
#include "libmscore/pitchspelling.h"
#include "libmscore/chordlist.h"
extern bool useFactorySettings;
@ -588,6 +590,9 @@ void Debugger::updateElement(Element* el)
case Element::HARMONY:
ew = new TextView;
break;
case Element::HARMONY:
ew = new HarmonyView;
break;
case Element::TRILL_SEGMENT:
case Element::HAIRPIN_SEGMENT:
ew = new LineSegmentView; break;
@ -1409,6 +1414,83 @@ void TextView::setElement(Element* e)
tb.layoutToParentWidth->setChecked(te->layoutToParentWidth());
}
//---------------------------------------------------------
// HarmonyView
//---------------------------------------------------------
HarmonyView::HarmonyView()
: ShowElementBase()
{
QWidget* tw = new QWidget;
tb.setupUi(tw);
layout->addWidget(tw);
QWidget* hw = new QWidget;
hb.setupUi(hw);
layout->addWidget(hw);
layout->addStretch(10);
}
//---------------------------------------------------------
// setElement
//---------------------------------------------------------
void HarmonyView::setElement(Element* e)
{
Harmony* harmony = (Harmony*)e;
bool germanNames = e->score()->styleB(ST_useGermanNoteNames);
tb.textStyle->clear();
for (int i = 0; i < TEXT_STYLES; ++i)
tb.textStyle->addItem(e->score()->textStyle(i).name());
ShowElementBase::setElement(e);
tb.text->setPlainText(harmony->text());
tb.xoffset->setValue(harmony->xoff());
tb.yoffset->setValue(harmony->yoff());
tb.rxoffset->setValue(harmony->reloff().x());
tb.ryoffset->setValue(harmony->reloff().y());
tb.offsetType->setCurrentIndex(int(harmony->offsetType()));
tb.textStyle->setCurrentIndex(harmony->textStyleType());
tb.styled->setChecked(harmony->styled());
tb.layoutToParentWidth->setChecked(harmony->layoutToParentWidth());
hb.tbboxx->setValue(harmony->bboxtight().x());
hb.tbboxy->setValue(harmony->bboxtight().y());
hb.tbboxw->setValue(harmony->bboxtight().width());
hb.tbboxh->setValue(harmony->bboxtight().height());
hb.rootTpc->setValue(harmony->rootTpc());
if (harmony->rootTpc() == INVALID_TPC)
hb.rootName->setText("");
else
hb.rootName->setText(tpc2name(harmony->rootTpc(),germanNames));
hb.bassTpc->setValue(harmony->baseTpc());
if (harmony->baseTpc() == INVALID_TPC)
hb.bassName->setText("");
else
hb.bassName->setText(tpc2name(harmony->baseTpc(),germanNames));
hb.chordId->setValue(harmony->id());
hb.chordName->setText(harmony->extensionName());
hb.userName->setText(harmony->hUserName());
// need to set header row
hb.degreeTab->setRowCount(harmony->numberOfDegrees());
for (int i = 0, n = harmony->numberOfDegrees(); i < n; ++i) {
const HDegree& d = harmony->degree(i);
QString s;
switch (d.type()) {
case ADD: s = "add"; break;
case ALTER: s = "alter"; break;
case SUBTRACT: s = "subtract"; break;
default: s = ""; break;
}
hb.degreeTab->setItem(i, 0, new QTableWidgetItem(s));
hb.degreeTab->setItem(i, 1, new QTableWidgetItem(QVariant(d.value()).toString()));
hb.degreeTab->setItem(i, 2, new QTableWidgetItem(QVariant(d.alter()).toString()));
}
}
//---------------------------------------------------------
// HairpinView
//---------------------------------------------------------

View file

@ -51,6 +51,7 @@
#include "ui_rest.h"
#include "ui_stem.h"
#include "ui_box.h"
#include "ui_harmony.h"
#include "globals.h"
#include "libmscore/element.h"
@ -316,6 +317,21 @@ class TextView : public ShowElementBase {
virtual void setElement(Element*);
};
//---------------------------------------------------------
// HarmonyView
//---------------------------------------------------------
class HarmonyView : public ShowElementBase {
Q_OBJECT;
Ui::TextBase tb;
Ui::HarmonyBase hb;
public:
HarmonyView();
virtual void setElement(Element*);
};
//---------------------------------------------------------
// HairpinView
//---------------------------------------------------------

439
mscore/harmony.ui Normal file
View file

@ -0,0 +1,439 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>HarmonyBase</class>
<widget class="QWidget" name="HarmonyBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>476</width>
<height>297</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string notr="true" comment="do not translate">Harmony</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string notr="true">Tight BBox</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="indent">
<number>5</number>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="tbboxx">
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="minimum">
<double>-100000.000000000000000</double>
</property>
<property name="maximum">
<double>100000.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="tbboxy">
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="minimum">
<double>-100000.000000000000000</double>
</property>
<property name="maximum">
<double>100000.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string notr="true">w/h</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="indent">
<number>5</number>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="tbboxw">
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="minimum">
<double>-100000.000000000000000</double>
</property>
<property name="maximum">
<double>100000.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="tbboxh">
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="minimum">
<double>-100000.000000000000000</double>
</property>
<property name="maximum">
<double>100000.000000000000000</double>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string notr="true">Root TPC</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="indent">
<number>5</number>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="rootTpc">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="minimum">
<number>-2</number>
</property>
<property name="maximum">
<number>33</number>
</property>
<property name="value">
<number>-2</number>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="rootName">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="maxLength">
<number>3</number>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string notr="true">Bass TPC</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="indent">
<number>5</number>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="bassTpc">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="minimum">
<number>-2</number>
</property>
<property name="maximum">
<number>33</number>
</property>
<property name="value">
<number>-2</number>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="bassName">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>16777215</height>
</size>
</property>
<property name="maxLength">
<number>3</number>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string notr="true">ID</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="indent">
<number>5</number>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="chordId">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="value">
<number>-1</number>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="chordName">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string notr="true">UserName</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="indent">
<number>5</number>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="userName">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string notr="true">Degree List</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
</property>
<property name="indent">
<number>5</number>
</property>
</widget>
</item>
<item>
<widget class="QTableWidget" name="degreeTab">
<property name="columnCount">
<number>3</number>
</property>
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderCascadingSectionResizes">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>100</number>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>Type</string>
</property>
</column>
<column>
<property name="text">
<string>Value</string>
</property>
</column>
<column>
<property name="text">
<string>Alter</string>
</property>
</column>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>