Skip to content

Commit

Permalink
add play property to arpeggio
Browse files Browse the repository at this point in the history
  • Loading branch information
lasconic committed Jul 6, 2015
1 parent 0c825c8 commit a34fdf5
Show file tree
Hide file tree
Showing 8 changed files with 233 additions and 1 deletion.
26 changes: 26 additions & 0 deletions libmscore/arpeggio.cpp
Expand Up @@ -36,6 +36,7 @@ Arpeggio::Arpeggio(Score* s)
_span = 1;
_userLen1 = 0.0;
_userLen2 = 0.0;
_playArpeggio = true;
}

//---------------------------------------------------------
Expand Down Expand Up @@ -64,6 +65,7 @@ void Arpeggio::write(Xml& xml) const
xml.tag("userLen2", _userLen2 / spatium());
if (_span != 1)
xml.tag("span", _span);
writeProperty(xml, P_ID::PLAY);
xml.etag();
}

Expand All @@ -83,6 +85,8 @@ void Arpeggio::read(XmlReader& e)
_userLen2 = e.readDouble() * spatium();
else if (tag == "span")
_span = e.readInt();
else if (tag == "play")
_playArpeggio = e.readBool();
else if (!Element::readProperties(e))
e.unknown();
}
Expand Down Expand Up @@ -401,6 +405,8 @@ QVariant Arpeggio::getProperty(P_ID propertyId) const
return userLen1();
case P_ID::ARP_USER_LEN2:
return userLen2();
case P_ID::PLAY:
return _playArpeggio;
default:
break;
}
Expand All @@ -420,6 +426,9 @@ bool Arpeggio::setProperty(P_ID propertyId, const QVariant& val)
case P_ID::ARP_USER_LEN2:
setUserLen2(val.toDouble());
break;
case P_ID::PLAY:
setPlayArpeggio(val.toBool());
break;
default:
if (!Element::setProperty(propertyId, val))
return false;
Expand All @@ -429,6 +438,23 @@ bool Arpeggio::setProperty(P_ID propertyId, const QVariant& val)
return true;
}

//---------------------------------------------------------
// propertyDefault
//---------------------------------------------------------

QVariant Arpeggio::propertyDefault(P_ID propertyId) const
{
switch(propertyId) {
case P_ID::ARP_USER_LEN1:
return 0.0;
case P_ID::ARP_USER_LEN2:
return 0.0;
case P_ID::PLAY:
return true;
default:
break;
}
return Element::propertyDefault(propertyId);
}
}

5 changes: 5 additions & 0 deletions libmscore/arpeggio.h
Expand Up @@ -38,6 +38,7 @@ class Arpeggio : public Element {
qreal _height;
int _span; // spanning staves
QList<SymId> symbols;
bool _playArpeggio;

void symbolLine(SymId start, SymId fill);
void symbolLine2(SymId end, SymId fill);
Expand Down Expand Up @@ -79,8 +80,12 @@ class Arpeggio : public Element {
void setUserLen1(qreal v) { _userLen1 = v; }
void setUserLen2(qreal v) { _userLen2 = v; }

bool playArpeggio() { return _playArpeggio; }
void setPlayArpeggio(bool p) { _playArpeggio = p; }

virtual QVariant getProperty(P_ID propertyId) const override;
virtual bool setProperty(P_ID propertyId, const QVariant&) override;
virtual QVariant propertyDefault(P_ID propertyId) const override;
};


Expand Down
2 changes: 1 addition & 1 deletion libmscore/rendermidi.cpp
Expand Up @@ -1261,7 +1261,7 @@ static QList<NoteEventList> renderChord(Chord* chord, int gateTime, int ontime)
renderTremolo(chord, ell);

}
else if (chord->arpeggio()) {
else if (chord->arpeggio() && chord->arpeggio()->playArpeggio()) {
renderArpeggio(chord, ell);
return ell; // dont apply gateTime to arpeggio events
}
Expand Down
2 changes: 2 additions & 0 deletions mscore/CMakeLists.txt
Expand Up @@ -124,6 +124,7 @@ QT5_WRAP_UI (ui_headers
inspector/inspector_fret.ui
inspector/inspector_break.ui
inspector/inspector_bend.ui
inspector/inspector_arpeggio.ui
${SCRIPT_UI}
)

Expand Down Expand Up @@ -256,6 +257,7 @@ add_executable ( ${ExecutableName}
musicxmlfonthandler.cpp musicxmlsupport.cpp exportxml.cpp importxml.cpp importxmlfirstpass.cpp
savePositions.cpp inspector/inspectorJump.cpp inspector/inspectorMarker.cpp
inspector/inspectorGlissando.cpp inspector/inspectorNote.cpp inspector/inspectorAmbitus.cpp
inspector/inspectorArpeggio.cpp
paletteBoxButton.cpp driver.cpp exportmidi.cpp noteGroups.cpp
pathlistdialog.cpp exampleview.cpp inspector/inspectorTextLine.cpp miconengine.cpp
importmidi/importmidi.cpp
Expand Down
4 changes: 4 additions & 0 deletions mscore/inspector/inspector.cpp
Expand Up @@ -24,6 +24,7 @@
#include "inspectorMarker.h"
#include "inspectorJump.h"
#include "inspectorGlissando.h"
#include "inspectorArpeggio.h"
#include "inspectorNote.h"
#include "inspectorAmbitus.h"
#include "inspectorFret.h"
Expand Down Expand Up @@ -247,6 +248,9 @@ void Inspector::setElements(const QList<Element*>& l)
case Element::Type::BEND:
ie = new InspectorBend(this);
break;
case Element::Type::ARPEGGIO:
ie = new InspectorArpeggio(this);
break;
default:
if (_element->isText())
ie = new InspectorText(this);
Expand Down
43 changes: 43 additions & 0 deletions mscore/inspector/inspectorArpeggio.cpp
@@ -0,0 +1,43 @@
//=============================================================================
// 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 "inspectorArpeggio.h"
#include "musescore.h"
#include "libmscore/arpeggio.h"
#include "libmscore/score.h"

namespace Ms {

//---------------------------------------------------------
// InspectorArpeggio
//---------------------------------------------------------

InspectorArpeggio::InspectorArpeggio(QWidget* parent)
: InspectorBase(parent)
{
e.setupUi(addWidget());
g.setupUi(addWidget());

iList = {
{ P_ID::COLOR, 0, false, e.color, e.resetColor },
{ P_ID::VISIBLE, 0, false, e.visible, e.resetVisible },
{ P_ID::USER_OFF, 0, false, e.offsetX, e.resetX },
{ P_ID::USER_OFF, 1, false, e.offsetY, e.resetY },

{ P_ID::PLAY, 0, 0, g.playArpeggio, g.resetPlayArpeggio}
};

mapSignals();
}
}

39 changes: 39 additions & 0 deletions mscore/inspector/inspectorArpeggio.h
@@ -0,0 +1,39 @@
//=============================================================================
// 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_ARPEGGIO_H__
#define __INSPECTOR_ARPEGGIO_H__

#include "inspector.h"
#include "ui_inspector_arpeggio.h"
#include "libmscore/property.h"

namespace Ms {

//---------------------------------------------------------
// InspectorArpeggio
//---------------------------------------------------------

class InspectorArpeggio : public InspectorBase {
Q_OBJECT

UiInspectorElement e;
Ui::InspectorArpeggio g;

public:
InspectorArpeggio(QWidget* parent);
};


} // namespace Ms
#endif
113 changes: 113 additions & 0 deletions mscore/inspector/inspector_arpeggio.ui
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>InspectorArpeggio</class>
<widget class="QWidget" name="InspectorArpeggio">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>270</width>
<height>151</height>
</rect>
</property>
<property name="windowTitle">
<string/>
</property>
<property name="accessibleName">
<string>Glissando 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="QLabel" name="elementName">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="accessibleName">
<string/>
</property>
<property name="text">
<string>Arpeggio</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="minimumSize">
<size>
<width>0</width>
<height>6</height>
</size>
</property>
<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>
<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="0">
<widget class="QCheckBox" name="playArpeggio">
<property name="text">
<string>Play</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QToolButton" name="resetPlayArpeggio">
<property name="accessibleName">
<string>Reset Play value</string>
</property>
<property name="text">
<string notr="true">...</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

0 comments on commit a34fdf5

Please sign in to comment.