From 990704873b94b4844a42fdb1192f2e6f1e3e766a Mon Sep 17 00:00:00 2001 From: ws Date: Thu, 28 Feb 2013 15:06:54 +0100 Subject: [PATCH] updates for Glissando --- awl/colorlabel.h | 2 + libmscore/chord.cpp | 1 + libmscore/element.cpp | 13 +- libmscore/glissando.cpp | 117 ++++++++++++- libmscore/glissando.h | 31 +++- libmscore/note.cpp | 5 +- libmscore/property.cpp | 4 + libmscore/property.h | 4 + libmscore/undo.cpp | 22 ++- mscore/CMakeLists.txt | 5 +- mscore/exportly.cpp | 2 +- mscore/exportxml.cpp | 32 ++-- mscore/importove.cpp | 2 +- mscore/importxml.cpp | 4 +- mscore/inspector.cpp | 4 + mscore/inspectorBase.cpp | 126 +++++++------- mscore/inspectorBase.h | 3 + mscore/inspectorGlissando.cpp | 40 +++++ mscore/inspectorGlissando.h | 43 +++++ mscore/inspectorJump.cpp | 2 +- mscore/inspectorJump.h | 2 +- mscore/inspectorMarker.cpp | 2 +- mscore/inspector_glissando.ui | 304 ++++++++++++++++++++++++++++++++++ mscore/menus.cpp | 2 +- 24 files changed, 660 insertions(+), 112 deletions(-) create mode 100644 mscore/inspectorGlissando.cpp create mode 100644 mscore/inspectorGlissando.h create mode 100644 mscore/inspector_glissando.ui diff --git a/awl/colorlabel.h b/awl/colorlabel.h index 0324b39ab48e3..a8c6cacc7c61d 100644 --- a/awl/colorlabel.h +++ b/awl/colorlabel.h @@ -29,6 +29,8 @@ namespace Awl { class ColorLabel : public QFrame { Q_OBJECT + Q_PROPERTY(QColor color READ color WRITE setColor) + QColor _color; QPixmap* _pixmap; diff --git a/libmscore/chord.cpp b/libmscore/chord.cpp index d954b9c356ad7..bcb5493caa869 100644 --- a/libmscore/chord.cpp +++ b/libmscore/chord.cpp @@ -1735,6 +1735,7 @@ Element* Chord::drop(const DropData& data) case CHORDLINE: e->setParent(this); + e->setTrack(track()); score()->undoAddElement(e); break; diff --git a/libmscore/element.cpp b/libmscore/element.cpp index 5bdb93ce2ca11..6c49d7350c221 100644 --- a/libmscore/element.cpp +++ b/libmscore/element.cpp @@ -1450,7 +1450,7 @@ void Element::undoSetPlacement(Placement v) QVariant Element::getProperty(P_ID propertyId) const { - switch(propertyId) { + switch (propertyId) { case P_COLOR: return _color; case P_VISIBLE: return _visible; case P_SELECTED: return _selected; @@ -1499,7 +1499,16 @@ bool Element::setProperty(P_ID propertyId, const QVariant& v) QVariant Element::propertyDefault(P_ID id) const { switch(id) { - case P_PLACEMENT: return BELOW; + case P_VISIBLE: + return true; + case P_COLOR: + return MScore::defaultColor; + case P_PLACEMENT: + return BELOW; + case P_SELECTED: + return false; + case P_USER_OFF: + return QPointF(); default: // not all properties have a default break; } diff --git a/libmscore/glissando.cpp b/libmscore/glissando.cpp index aa87f57ff2b63..28bf467232523 100644 --- a/libmscore/glissando.cpp +++ b/libmscore/glissando.cpp @@ -27,14 +27,24 @@ Glissando::Glissando(Score* s) : Element(s) { - _subtype = GLISS_STRAIGHT; setFlags(ELEMENT_MOVABLE | ELEMENT_SELECTABLE); - _text = "gliss."; - _showText = true; + + _subtype = GlissandoType::STRAIGHT; + _text = "gliss."; + _showText = true; qreal _spatium = spatium(); setSize(QSizeF(_spatium * 2, _spatium * 4)); // for use in palettes } +Glissando::Glissando(const Glissando& g) + : Element(g) + { + _subtype = g._subtype; + line = g.line; + _text = g._text; + _showText = g._showText; + } + //--------------------------------------------------------- // layout //--------------------------------------------------------- @@ -42,9 +52,8 @@ Glissando::Glissando(Score* s) void Glissando::layout() { Chord* chord = static_cast(parent()); - if (chord == 0) { + if (chord == 0) return; - } Note* anchor2 = chord->upNote(); Segment* s = chord->segment(); s = s->prev1(); @@ -107,7 +116,7 @@ void Glissando::write(Xml& xml) const xml.stag("Glissando"); if (_showText && !_text.isEmpty()) xml.tag("text", _text); - xml.tag("subtype", _subtype); + xml.tag("subtype", int(_subtype)); Element::writeProperties(xml); xml.etag(); } @@ -126,7 +135,7 @@ void Glissando::read(XmlReader& e) _text = e.readElementText(); } else if (tag == "subtype") - _subtype = e.readInt(); + _subtype = GlissandoType(e.readInt()); else if (!Element::readProperties(e)) e.unknown(); } @@ -154,10 +163,10 @@ void Glissando::draw(QPainter* painter) const qreal wi = asin(-h / l) * 180.0 / M_PI; painter->rotate(-wi); - if (subtype() == GLISS_STRAIGHT) { + if (subtype() == GlissandoType::STRAIGHT) { painter->drawLine(QLineF(0.0, 0.0, l, 0.0)); } - else if (subtype() == GLISS_WAVY) { + else if (subtype() == GlissandoType::WAVY) { qreal mags = magS(); QRectF b = symbols[score()->symIdx()][trillelementSym].bbox(mags); qreal w = symbols[score()->symIdx()][trillelementSym].width(mags); @@ -197,3 +206,93 @@ void Glissando::setSize(const QSizeF& s) setbbox(QRectF(QPointF(), s)); } +//--------------------------------------------------------- +// undoSetSubtype +//--------------------------------------------------------- + +void Glissando::undoSetSubtype(GlissandoType t) + { + score()->undoChangeProperty(this, P_GLISS_TYPE, int(t)); + } + +//--------------------------------------------------------- +// undoSetText +//--------------------------------------------------------- + +void Glissando::undoSetText(const QString& s) + { + score()->undoChangeProperty(this, P_GLISS_TEXT, s); + } + +//--------------------------------------------------------- +// undoSetShowText +//--------------------------------------------------------- + +void Glissando::undoSetShowText(bool f) + { + score()->undoChangeProperty(this, P_GLISS_SHOW_TEXT, f); + } + +//--------------------------------------------------------- +// getProperty +//--------------------------------------------------------- + +QVariant Glissando::getProperty(P_ID propertyId) const + { + switch (propertyId) { + case P_GLISS_TYPE: + return int(subtype()); + case P_GLISS_TEXT: + return text(); + case P_GLISS_SHOW_TEXT: + return showText(); + default: + break; + } + return Element::getProperty(propertyId); + } + +//--------------------------------------------------------- +// setProperty +//--------------------------------------------------------- + +bool Glissando::setProperty(P_ID propertyId, const QVariant& v) + { + switch (propertyId) { + case P_GLISS_TYPE: + setSubtype(GlissandoType(v.toInt())); + break; + case P_GLISS_TEXT: + setText(v.toString()); + break; + case P_GLISS_SHOW_TEXT: + setShowText(v.toBool()); + break; + default: + if (!Element::setProperty(propertyId, v)) + return false; + break; + } + score()->setLayoutAll(true); + return true; + } + +//--------------------------------------------------------- +// propertyDefault +//--------------------------------------------------------- + +QVariant Glissando::propertyDefault(P_ID propertyId) const + { + switch (propertyId) { + case P_GLISS_TYPE: + return int(GlissandoType::STRAIGHT); + case P_GLISS_TEXT: + return "gliss."; + case P_GLISS_SHOW_TEXT: + return true; + default: + break; + } + return Element::propertyDefault(propertyId); + } + diff --git a/libmscore/glissando.h b/libmscore/glissando.h index 6695bffc68f4a..70e36c2ed7caa 100644 --- a/libmscore/glissando.h +++ b/libmscore/glissando.h @@ -16,11 +16,16 @@ #include "element.h" -#define GLISS_STRAIGHT 0 -#define GLISS_WAVY 1 - class Note; +//--------------------------------------------------------- +// GlissandoType +//--------------------------------------------------------- + +enum class GlissandoType { + STRAIGHT, WAVY + }; + //--------------------------------------------------------- // @@ Glissando //--------------------------------------------------------- @@ -28,17 +33,23 @@ class Note; class Glissando : public Element { Q_OBJECT - int _subtype; + Q_PROPERTY(GlissandoType subtype READ subtype WRITE undoSetSubtype) + Q_PROPERTY(QString text READ text WRITE undoSetText) + Q_PROPERTY(bool showText READ showText WRITE undoSetShowText) + + GlissandoType _subtype; QLineF line; QString _text; bool _showText; public: Glissando(Score* s); + Glissando(const Glissando&); + virtual Glissando* clone() const { return new Glissando(*this); } virtual ElementType type() const { return GLISSANDO; } - int subtype() const { return _subtype; } - void setSubtype(int v) { _subtype = v; } + GlissandoType subtype() const { return _subtype; } + void setSubtype(GlissandoType v) { _subtype = v; } virtual Space space() const; virtual void draw(QPainter*) const; @@ -52,6 +63,14 @@ class Glissando : public Element { void setText(const QString& t) { _text = t; } bool showText() const { return _showText; } void setShowText(bool v) { _showText = v; } + + void undoSetSubtype(GlissandoType); + void undoSetText(const QString&); + void undoSetShowText(bool); + + virtual QVariant getProperty(P_ID propertyId) const; + virtual bool setProperty(P_ID propertyId, const QVariant&); + virtual QVariant propertyDefault(P_ID) const; }; #endif diff --git a/libmscore/note.cpp b/libmscore/note.cpp index ffd6d9eb2831b..90e37751ea461 100644 --- a/libmscore/note.cpp +++ b/libmscore/note.cpp @@ -1238,11 +1238,10 @@ Element* Note::drop(const DropData& data) e->setParent(cr1); // in TAB, use straight line with no text if (staff()->isTabStaff()) { - (static_cast(e))->setSubtype(GLISS_STRAIGHT); + (static_cast(e))->setSubtype(GlissandoType::STRAIGHT); (static_cast(e))->setShowText(false); - } + } score()->undoAddElement(e); - score()->setLayout(cr1->measure()); } break; diff --git a/libmscore/property.cpp b/libmscore/property.cpp index b911e152a1e25..656c3166797e8 100644 --- a/libmscore/property.cpp +++ b/libmscore/property.cpp @@ -139,6 +139,10 @@ static const PropertyData propertyList[] = { { P_REPEAT_FLAGS, false, 0, T_INT }, + { P_GLISS_TYPE, false, 0, T_INT }, + { P_GLISS_TEXT, false, 0, T_STRING }, + { P_GLISS_SHOW_TEXT, false, 0, T_BOOL }, + { P_END, false, "", T_INT } }; diff --git a/libmscore/property.h b/libmscore/property.h index 67e664f981aa1..03c7767fcee0d 100644 --- a/libmscore/property.h +++ b/libmscore/property.h @@ -132,6 +132,10 @@ enum P_ID { P_REPEAT_FLAGS, + P_GLISS_TYPE, + P_GLISS_TEXT, + P_GLISS_SHOW_TEXT, + P_END }; diff --git a/libmscore/undo.cpp b/libmscore/undo.cpp index fdc180d4550fd..6e00291e2bc44 100644 --- a/libmscore/undo.cpp +++ b/libmscore/undo.cpp @@ -69,6 +69,7 @@ #include "rehearsalmark.h" #include "excerpt.h" #include "stafftext.h" +#include "chordline.h" extern Measure* tick2measure(int tick); @@ -806,6 +807,7 @@ void Score::undoAddElement(Element* element) || (et == Element::IMAGE && element->parent()->type() != Element::SEGMENT) || (et == Element::SYMBOL && element->parent()->type() != Element::SEGMENT) || et == Element::NOTE + || et == Element::GLISSANDO ) { Element* parent = element->parent(); LinkedElements* links = parent->links(); @@ -827,7 +829,9 @@ void Score::undoAddElement(Element* element) return; } - if (ostaff == 0 || (et != Element::ARTICULATION + if (ostaff == 0 || ( + et != Element::ARTICULATION + && et != Element::CHORDLINE && et != Element::SLUR && et != Element::TIE && et != Element::NOTE @@ -902,6 +906,22 @@ void Score::undoAddElement(Element* element) } undo(new AddElement(na)); } + else if (element->type() == Element::CHORDLINE) { + ChordLine* a = static_cast(element); + Segment* segment = a->chord()->segment(); + int tick = segment->tick(); + Measure* m = score->tick2measure(tick); + Segment* seg = m->findSegment(Segment::SegChordRest, tick); + if (seg == 0) { + qDebug("undoAddSegment: segment not found"); + break; + } + int ntrack = staffIdx * VOICES + a->voice(); + ne->setTrack(ntrack); + ChordRest* ncr = static_cast(seg->element(ntrack)); + ne->setParent(ncr); + undo(new AddElement(ne)); + } // // elements with Segment as parent // diff --git a/mscore/CMakeLists.txt b/mscore/CMakeLists.txt index 347bb01796a0a..29d0f10f5fc29 100644 --- a/mscore/CMakeLists.txt +++ b/mscore/CMakeLists.txt @@ -60,7 +60,7 @@ QT4_WRAP_UI (ui_headers rest.ui inspector_chord.ui omrpanel.ui startdialog.ui masterpalette.ui inspector_group_element.ui inspector_image.ui stem.ui inspector_lasso.ui inspector_volta.ui inspector_ottava.ui inspector_trill.ui inspector_hairpin.ui - box.ui pluginManager.ui inspector_jump.ui inspector_marker.ui + box.ui pluginManager.ui inspector_jump.ui inspector_marker.ui inspector_glissando.ui ${SCRIPT_UI} ) @@ -92,7 +92,7 @@ QT4_WRAP_CPP (mocs inspectorGroupElement.h inspectorImage.h waveview.h helpBrowser.h inspectorLasso.h inspectorVolta.h inspectorOttava.h inspectorTrill.h inspectorHairpin.h qmlplugin.h palettebox.h workspace.h pluginManager.h - inspectorJump.h inspectorMarker.h + inspectorJump.h inspectorMarker.h inspectorGlissando.h ${OMR_MOCS} ${SCRIPT_MOCS} ) @@ -197,6 +197,7 @@ add_executable ( ${ExecutableName} inspectorHairpin.cpp qmlplugin.cpp editlyrics.cpp musicxmlsupport.cpp exportxml.cpp importxml.cpp importxmlfirstpass.cpp savePositions.cpp pluginManager.cpp inspectorJump.cpp inspectorMarker.cpp + inspectorGlissando.cpp ${OMR_FILES} ${AUDIO} ${SCRIPT_FILES} diff --git a/mscore/exportly.cpp b/mscore/exportly.cpp index 6eaaee679ded0..24d4b797f9595 100644 --- a/mscore/exportly.cpp +++ b/mscore/exportly.cpp @@ -2031,7 +2031,7 @@ void ExportLy::buildGlissandoList(int strack, int etrack) Element* prevel = seg->prev()->element(st); //(st); Chord* prevchord = (Chord*)prevel; glisstable[glisscount].chord = prevchord; - glisstable[glisscount].type = cd->glissando()->subtype(); + glisstable[glisscount].type = int(cd->glissando()->subtype()); glisstable[glisscount].glisstext = cd->glissando()->text(); glisstable[glisscount].tick = prevchord->tick(); } diff --git a/mscore/exportxml.cpp b/mscore/exportxml.cpp index a7c929049fc82..11de888e9a99e 100644 --- a/mscore/exportxml.cpp +++ b/mscore/exportxml.cpp @@ -523,14 +523,14 @@ void SlurHandler::doSlurStop(Chord* chord, Notations& notations, Xml& xml) static void glissando(Glissando* gli, int number, bool start, Notations& notations, Xml& xml) { - int st = gli->subtype(); + GlissandoType st = gli->subtype(); switch (st) { - case 0: + case GlissandoType::STRAIGHT: notations.tag(xml); xml.tagE("slide line-type=\"solid\" number=\"%d\" type=\"%s\"", number, start ? "start" : "stop"); break; - case 1: + case GlissandoType::WAVY: notations.tag(xml); xml.tagE("glissando line-type=\"wavy\" number=\"%d\" type=\"%s\"", number, start ? "start" : "stop"); @@ -577,24 +577,24 @@ int GlissandoHandler::findChord(const Chord* c, int st) const void GlissandoHandler::doGlissandoStart(Chord* chord, Notations& notations, Xml& xml) { - int st = chord->glissando()->subtype(); - if (st != 0 && st != 1) { + GlissandoType st = chord->glissando()->subtype(); + if (st != GlissandoType::STRAIGHT && st != GlissandoType::WAVY) { qDebug("doGlissandoStart: unknown glissando subtype %d", st); return; } // check if on chord list - int i = findChord(chord, st); + int i = findChord(chord, int(st)); if (i >= 0) { // print error and remove from list qDebug("doGlissandoStart: chord %p already on list", chord); - if (st == 0) slideChrd[i] = 0; - if (st == 1) glissChrd[i] = 0; + if (st == GlissandoType::STRAIGHT) slideChrd[i] = 0; + if (st == GlissandoType::WAVY) glissChrd[i] = 0; } // find free slot to store it - i = findChord(0, st); + i = findChord(0, int(st)); if (i >= 0) { - if (st == 0) slideChrd[i] = chord; - if (st == 1) glissChrd[i] = chord; + if (st == GlissandoType::STRAIGHT) slideChrd[i] = chord; + if (st == GlissandoType::WAVY) glissChrd[i] = chord; glissando(chord->glissando(), i + 1, true, notations, xml); } else @@ -607,18 +607,18 @@ void GlissandoHandler::doGlissandoStart(Chord* chord, Notations& notations, Xml& void GlissandoHandler::doGlissandoStop(Chord* chord, Notations& notations, Xml& xml) { - int st = chord->glissando()->subtype(); - if (st != 0 && st != 1) { - qDebug("doGlissandoStop: unknown glissando subtype %d", st); + GlissandoType st = chord->glissando()->subtype(); + if (st != GlissandoType::STRAIGHT && st != GlissandoType::WAVY) { + qDebug("doGlissandoStart: unknown glissando subtype %d", st); return; } for (int i = 0; i < MAX_NUMBER_LEVEL; ++i) { - if (st == 0 && slideChrd[i] == chord) { + if (st == GlissandoType::STRAIGHT && slideChrd[i] == chord) { slideChrd[i] = 0; glissando(chord->glissando(), i + 1, false, notations, xml); return; } - if (st == 1 && glissChrd[i] == chord) { + if (st == GlissandoType::WAVY && glissChrd[i] == chord) { glissChrd[i] = 0; glissando(chord->glissando(), i + 1, false, notations, xml); return; diff --git a/mscore/importove.cpp b/mscore/importove.cpp index 0a8f4bed8e189..b9693d6574768 100644 --- a/mscore/importove.cpp +++ b/mscore/importove.cpp @@ -2339,7 +2339,7 @@ void OveToMScore::convertGlissandos(Measure* measure, int part, int staff, int t ChordRest* cr = measure->findChordRest(absTick, track); if(cr != 0){ Glissando* g = new Glissando(score_); - g->setSubtype(1); + g->setSubtype(GlissandoType::WAVY); cr->add(g); } } diff --git a/mscore/importxml.cpp b/mscore/importxml.cpp index a185f1d047a62..4ca9e93bb2f50 100644 --- a/mscore/importxml.cpp +++ b/mscore/importxml.cpp @@ -4267,9 +4267,9 @@ void MusicXml::xmlNotations(Note* note, ChordRest* cr, int trk, int ticks, QDomE if (!glissandoType.isEmpty()) { Glissando* g = new Glissando(score); if (glissandoType == "slide") - g->setSubtype(0); + g->setSubtype(GlissandoType::STRAIGHT); else if (glissandoType == "glissando") - g->setSubtype(1); + g->setSubtype(GlissandoType::WAVY); else { qDebug("unknown glissando type %s", glissandoType.toLatin1().data()); delete g; diff --git a/mscore/inspector.cpp b/mscore/inspector.cpp index bf366e95b836c..176c749fda793 100644 --- a/mscore/inspector.cpp +++ b/mscore/inspector.cpp @@ -22,6 +22,7 @@ #include "inspectorHairpin.h" #include "inspectorMarker.h" #include "inspectorJump.h" +#include "inspectorGlissando.h" #include "musescore.h" #include "scoreview.h" @@ -194,6 +195,9 @@ void Inspector::setElement(Element* e) case Element::MARKER: ie = new InspectorMarker(this); break; + case Element::GLISSANDO: + ie = new InspectorGlissando(this); + break; default: ie = new InspectorElement(this); break; diff --git a/mscore/inspectorBase.cpp b/mscore/inspectorBase.cpp index b6df6757e95b0..91fe84014df2d 100644 --- a/mscore/inspectorBase.cpp +++ b/mscore/inspectorBase.cpp @@ -41,19 +41,21 @@ InspectorBase::InspectorBase(QWidget* parent) QVariant InspectorBase::getValue(int idx) const { - const InspectorItem& ii = item(idx); - QWidget* w = ii.w; + QWidget* w = item(idx).w; - switch (propertyType(ii.t)) { - case T_SIZE: - case T_POINT: - case T_SCALE: - case T_SREAL: - case T_REAL: return w->property("value"); - case T_DIRECTION: return w->property("currentIndex"); - case T_BOOL: return w->property("checked"); - default: - abort(); + if (qobject_cast(w)) + return w->property("value"); + else if (qobject_cast(w)) + return w->property("currentIndex"); + else if (qobject_cast(w)) + return w->property("checked"); + else if (qobject_cast(w)) + return w->property("text"); + else if (qobject_cast(w)) + return static_cast(w)->color(); + else { + qDebug("not supported widget"); + abort(); } return QVariant(); } @@ -67,22 +69,19 @@ void InspectorBase::setValue(int idx, const QVariant& val) const InspectorItem& ii = item(idx); QWidget* w = ii.w; - switch (propertyType(ii.t)) { - case T_SIZE: - case T_POINT: - case T_SCALE: - case T_SREAL: - case T_REAL: - static_cast(w)->setValue(val.toDouble()); - break; - case T_DIRECTION: - static_cast(w)->setCurrentIndex(val.toInt()); - break; - case T_BOOL: - static_cast(w)->setChecked(val.toBool()); - break; - default: - abort(); + if (qobject_cast(w)) + static_cast(w)->setValue(val.toDouble()); + else if (qobject_cast(w)) + static_cast(w)->setCurrentIndex(val.toInt()); + else if (qobject_cast(w)) + static_cast(w)->setChecked(val.toBool()); + else if (qobject_cast(w)) + static_cast(w)->setText(val.toString()); + else if (qobject_cast(w)) + static_cast(w)->setColor(val.value()); + else { + qDebug("not supported widget"); + abort(); } } @@ -148,10 +147,9 @@ void InspectorBase::valueChanged(int idx) void InspectorBase::setElement(Element* e) { for (int i = 0; i < inspectorItems(); ++i) { - QWidget* w = item(i).w; - QToolButton* r = item(i).r; - P_ID id = item(i).t; - P_TYPE pt = propertyType(id); + QWidget* w = item(i).w; + P_ID id = item(i).t; + P_TYPE pt = propertyType(id); QVariant val; if (pt == T_SIZE || pt == T_SCALE) { QSizeF sz = e->getProperty(id).toSizeF(); @@ -174,6 +172,7 @@ void InspectorBase::setElement(Element* e) setValue(i, val); w->blockSignals(false); + QToolButton* r = item(i).r; if (r) r->setEnabled(!isDefault(i)); } @@ -240,19 +239,19 @@ void InspectorBase::resetClicked(int i) QVariant def = e->propertyDefault(id); QWidget* w = item(i).w; - switch (propertyType(id)) { - case T_SREAL: - case T_REAL: - static_cast(w)->setValue(def.toDouble()); - break; - case T_DIRECTION: - static_cast(w)->setCurrentIndex(def.toInt()); - break; - case T_BOOL: - static_cast(w)->setChecked(def.toBool()); - break; - default: - abort(); + if (qobject_cast(w)) + static_cast(w)->setValue(def.toDouble()); + else if (qobject_cast(w)) + static_cast(w)->setCurrentIndex(def.toInt()); + else if (qobject_cast(w)) + static_cast(w)->setChecked(def.toBool()); + else if (qobject_cast(w)) + static_cast(w)->setText(def.toString()); + else if (qobject_cast(w)) + static_cast(w)->setColor(def.value()); + else { + qDebug("not supported widget"); + abort(); } } @@ -263,29 +262,26 @@ void InspectorBase::resetClicked(int i) void InspectorBase::mapSignals() { for (int i = 0; i < inspectorItems(); ++i) { - QToolButton* b = item(i).r; - if (b) { - connect(b, SIGNAL(clicked()), resetMapper, SLOT(map())); - resetMapper->setMapping(b, i); + QToolButton* resetButton = item(i).r; + if (resetButton) { + connect(resetButton, SIGNAL(clicked()), resetMapper, SLOT(map())); + resetMapper->setMapping(resetButton, i); } QWidget* w = item(i).w; valueMapper->setMapping(w, i); - switch (propertyType(item(i).t)) { - case T_REAL: - case T_SREAL: - case T_SIZE: - case T_POINT: - case T_SCALE: - connect(w, SIGNAL(valueChanged(double)), valueMapper, SLOT(map())); - break; - case T_DIRECTION: - connect(w, SIGNAL(currentIndexChanged(int)), valueMapper, SLOT(map())); - break; - case T_BOOL: - connect(w, SIGNAL(toggled(bool)), valueMapper, SLOT(map())); - break; - default: - abort(); + if (qobject_cast(w)) + connect(w, SIGNAL(valueChanged(double)), valueMapper, SLOT(map())); + else if (qobject_cast(w)) + connect(w, SIGNAL(currentIndexChanged(int)), valueMapper, SLOT(map())); + else if (qobject_cast(w)) + connect(w, SIGNAL(toggled(bool)), valueMapper, SLOT(map())); + else if (qobject_cast(w)) + connect(w, SIGNAL(textChanged(const QString&)), valueMapper, SLOT(map())); + else if (qobject_cast(w)) + connect(w, SIGNAL(colorChanged(QColor)), valueMapper, SLOT(map())); + else { + qDebug("not supported widget"); + abort(); } } connect(resetMapper, SIGNAL(mapped(int)), SLOT(resetClicked(int))); diff --git a/mscore/inspectorBase.h b/mscore/inspectorBase.h index 10715492c66da..38b9c2f3b53ff 100644 --- a/mscore/inspectorBase.h +++ b/mscore/inspectorBase.h @@ -28,6 +28,9 @@ struct InspectorItem { int sv; // subvalue; example for T_SIZE: 0 - width 1 - height QWidget* w; QToolButton* r; + InspectorItem() {} + InspectorItem(P_ID _t, QWidget* _w, QToolButton* _r) : t(_t), w(_w), r(_r) {} + InspectorItem(P_ID _t, int _sv, QWidget* _w, QToolButton* _r) : t(_t), sv(_sv), w(_w), r(_r) {} }; //--------------------------------------------------------- diff --git a/mscore/inspectorGlissando.cpp b/mscore/inspectorGlissando.cpp new file mode 100644 index 0000000000000..19fb4d6c2508f --- /dev/null +++ b/mscore/inspectorGlissando.cpp @@ -0,0 +1,40 @@ +//============================================================================= +// MuseScore +// Music Composition & Notation +// $Id:$ +// +// Copyright (C) 2013 Werner Schweer +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2 +// as published by the Free Software Foundation and appearing in +// the file LICENSE.GPL +//============================================================================= + +#include "inspectorGlissando.h" +#include "musescore.h" +#include "libmscore/glissando.h" +#include "libmscore/score.h" + +//--------------------------------------------------------- +// InspectorGlissando +//--------------------------------------------------------- + +InspectorGlissando::InspectorGlissando(QWidget* parent) + : InspectorBase(parent) + { + QWidget* w = new QWidget; + b.setupUi(w); + layout->addWidget(w); + + iList[0] = InspectorItem(P_COLOR, b.color, b.resetColor); + iList[1] = InspectorItem(P_VISIBLE, b.visible, b.resetVisible); + iList[2] = InspectorItem(P_USER_OFF, 0, b.offsetX, b.resetX); + iList[3] = InspectorItem(P_USER_OFF, 1, b.offsetY, b.resetY); + iList[4] = InspectorItem(P_GLISS_TYPE, b.type, b.resetType); + iList[5] = InspectorItem(P_GLISS_TEXT, b.text, b.resetText); + iList[6] = InspectorItem(P_GLISS_SHOW_TEXT, b.showText, b.resetShowText); + + mapSignals(); + } + diff --git a/mscore/inspectorGlissando.h b/mscore/inspectorGlissando.h new file mode 100644 index 0000000000000..219a83462ce4c --- /dev/null +++ b/mscore/inspectorGlissando.h @@ -0,0 +1,43 @@ +//============================================================================= +// MuseScore +// Music Composition & Notation +// $Id:$ +// +// Copyright (C) 2013 Werner Schweer and others +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2 +// as published by the Free Software Foundation and appearing in +// the file LICENSE.GPL +//============================================================================= + +#ifndef __INSPECTOR_GLISSANDO_H__ +#define __INSPECTOR_GLISSANDO_H__ + +#include "inspector.h" +#include "ui_inspector_glissando.h" +#include "libmscore/property.h" + +//--------------------------------------------------------- +// InspectorGlissando +//--------------------------------------------------------- + +class InspectorGlissando : public InspectorBase { + Q_OBJECT + + Ui::InspectorGlissando b; + + static const int _inspectorItems = 7; + InspectorItem iList[_inspectorItems]; + + protected: + virtual const InspectorItem& item(int idx) const { return iList[idx]; } + virtual int inspectorItems() const { return _inspectorItems; } + + public: + InspectorGlissando(QWidget* parent); + }; + +#endif + + diff --git a/mscore/inspectorJump.cpp b/mscore/inspectorJump.cpp index defefd3fda619..7a5cdd33ead72 100644 --- a/mscore/inspectorJump.cpp +++ b/mscore/inspectorJump.cpp @@ -3,7 +3,7 @@ // Music Composition & Notation // $Id:$ // -// Copyright (C) 2012 Werner Schweer +// Copyright (C) 2013 Werner Schweer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 diff --git a/mscore/inspectorJump.h b/mscore/inspectorJump.h index 07d4b0337e0cd..bda1cb497e3b4 100644 --- a/mscore/inspectorJump.h +++ b/mscore/inspectorJump.h @@ -3,7 +3,7 @@ // Music Composition & Notation // $Id:$ // -// Copyright (C) 2012 Werner Schweer and others +// Copyright (C) 2013 Werner Schweer and others // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 diff --git a/mscore/inspectorMarker.cpp b/mscore/inspectorMarker.cpp index 73691dd9f7a23..d23641425cda2 100644 --- a/mscore/inspectorMarker.cpp +++ b/mscore/inspectorMarker.cpp @@ -3,7 +3,7 @@ // Music Composition & Notation // $Id:$ // -// Copyright (C) 2012 Werner Schweer +// Copyright (C) 2013 Werner Schweer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 diff --git a/mscore/inspector_glissando.ui b/mscore/inspector_glissando.ui new file mode 100644 index 0000000000000..8de8bcca9feeb --- /dev/null +++ b/mscore/inspector_glissando.ui @@ -0,0 +1,304 @@ + + + InspectorGlissando + + + + 0 + 0 + 270 + 225 + + + + Form + + + + 0 + + + 0 + + + + + + 75 + true + + + + Glissando + + + Qt::AlignCenter + + + + + + + + 0 + 6 + + + + QFrame::HLine + + + QFrame::Raised + + + 2 + + + + + + + 0 + + + + + ... + + + + :/data/icons-dark/resetproperty.png:/data/icons-dark/resetproperty.png + + + + + + + QFrame::Box + + + + + + + Offset X: + + + + + + + Color: + + + + + + + + 0 + 0 + + + + Offset Y: + + + + + + + + 0 + 0 + + + + sp + + + -10000.000000000000000 + + + 10000.000000000000000 + + + 0.500000000000000 + + + + + + + + 0 + 0 + + + + sp + + + -10000.000000000000000 + + + 10000.000000000000000 + + + 0.500000000000000 + + + + + + + ... + + + + :/data/icons-dark/resetproperty.png:/data/icons-dark/resetproperty.png + + + + + + + ... + + + + :/data/icons-dark/resetproperty.png:/data/icons-dark/resetproperty.png + + + + + + + ... + + + + :/data/icons-dark/resetproperty.png:/data/icons-dark/resetproperty.png + + + + + + + Visible + + + + + + + + + + 0 + 6 + + + + QFrame::HLine + + + QFrame::Raised + + + 2 + + + + + + + 0 + + + + + show text + + + + + + + + + + + straight + + + + + wavy + + + + + + + + Type + + + + + + + Text + + + + + + + ... + + + + :/data/icons-dark/resetproperty.png:/data/icons-dark/resetproperty.png + + + + + + + ... + + + + :/data/icons-dark/resetproperty.png:/data/icons-dark/resetproperty.png + + + + + + + ... + + + + :/data/icons-dark/resetproperty.png:/data/icons-dark/resetproperty.png + + + + + + + + + + Awl::ColorLabel + QFrame +
awl/colorlabel.h
+
+
+ + + + +
diff --git a/mscore/menus.cpp b/mscore/menus.cpp index e362c22d50fc1..a04de90eb2058 100644 --- a/mscore/menus.cpp +++ b/mscore/menus.cpp @@ -597,7 +597,7 @@ Palette* MuseScore::newArpeggioPalette() } for (int i = 0; i < 2; ++i) { Glissando* a = new Glissando(gscore); - a->setSubtype(i); + a->setSubtype(GlissandoType(i)); sp->append(a, tr("Glissando")); } return sp;