diff options
Diffstat (limited to 'muse2/awl')
-rw-r--r-- | muse2/awl/sigedit.cpp | 3 | ||||
-rw-r--r-- | muse2/awl/sigspinbox.cpp | 30 | ||||
-rw-r--r-- | muse2/awl/sigspinbox.h | 3 |
3 files changed, 34 insertions, 2 deletions
diff --git a/muse2/awl/sigedit.cpp b/muse2/awl/sigedit.cpp index 0cad9057..ecfa4551 100644 --- a/muse2/awl/sigedit.cpp +++ b/muse2/awl/sigedit.cpp @@ -46,7 +46,8 @@ SigEdit::SigEdit(QWidget* parent) zSpin = new SigSpinBox(this); nSpin = new SigSpinBox(this); zSpin->setRange(1,100); - nSpin->setRange(1,100); + nSpin->setDenominator(); + nSpin->setRange(1,128); layout = new QHBoxLayout(this); layout->setContentsMargins(0,0,0,0); layout->setSpacing(1); diff --git a/muse2/awl/sigspinbox.cpp b/muse2/awl/sigspinbox.cpp index 3f1bf1f4..5ee98bc9 100644 --- a/muse2/awl/sigspinbox.cpp +++ b/muse2/awl/sigspinbox.cpp @@ -1,10 +1,12 @@ #include "sigspinbox.h" +#include "al/sig.h" #include <QKeyEvent> #include <stdio.h> SigSpinBox::SigSpinBox(QWidget *parent) : QSpinBox(parent) { + _denominator=false; } void SigSpinBox::keyPressEvent(QKeyEvent*ev) { @@ -17,8 +19,36 @@ void SigSpinBox::keyPressEvent(QKeyEvent*ev) case Qt::Key_Slash: emit moveFocus(); break; + case Qt::Key_Up: + if (_denominator) { + // make sure that sig is valid then increase + AL::TimeSignature sig(4,value()); + if (sig.isValid()) + setValue(value()*2); + return; + } + break; + case Qt::Key_Down: + if (_denominator) { + // make sure that sig is valid then increase + AL::TimeSignature sig(4,value()); + if (sig.isValid()) { + int v = value()/2; + if (v<2) + v=2; + setValue(v); + return; + } + return; + } + break; default: break; } QSpinBox::keyPressEvent(ev); } + +void SigSpinBox::setDenominator() +{ + _denominator=true; +} diff --git a/muse2/awl/sigspinbox.h b/muse2/awl/sigspinbox.h index ca893a24..2465bdf2 100644 --- a/muse2/awl/sigspinbox.h +++ b/muse2/awl/sigspinbox.h @@ -6,11 +6,12 @@ class SigSpinBox : public QSpinBox { Q_OBJECT - + bool _denominator; protected: virtual void keyPressEvent(QKeyEvent*); public: explicit SigSpinBox(QWidget *parent = 0); + void setDenominator(); signals: void returnPressed(); |