summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
authorRobert Jonsson <spamatica@gmail.com>2011-10-05 20:52:49 +0000
committerRobert Jonsson <spamatica@gmail.com>2011-10-05 20:52:49 +0000
commitb936d9e9af142158c01d984d4fc9c47717148a35 (patch)
tree518fd224c6f9d4d13c173aa5883349db3ce5b133 /muse2
parentad507206af844ea5f9ca0b89726a92e159fc9c8c (diff)
more SigEdit
Diffstat (limited to 'muse2')
-rw-r--r--muse2/ChangeLog2
-rw-r--r--muse2/awl/sigedit.cpp3
-rw-r--r--muse2/awl/sigspinbox.cpp30
-rw-r--r--muse2/awl/sigspinbox.h3
-rw-r--r--muse2/muse/master/lmaster.cpp15
-rw-r--r--muse2/muse/master/lmaster.h3
6 files changed, 53 insertions, 3 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index 6487f593..fad3182b 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,3 +1,5 @@
+05.09.2011:
+ - SigEdit, up/down arrow in denominator only moves between powers of two, 2,4,8...128 (rj)
04.09.2011:
- More fixes to SigEdit, close on enter, navigate with arrows and / between values, fixed background color, focus (rj)
02.09.2011:
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();
diff --git a/muse2/muse/master/lmaster.cpp b/muse2/muse/master/lmaster.cpp
index ce6010c7..a64d444f 100644
--- a/muse2/muse/master/lmaster.cpp
+++ b/muse2/muse/master/lmaster.cpp
@@ -1063,5 +1063,18 @@ void LMaster::initShortcuts()
void LMaster::comboboxTimerSlot()
{
- key_editor->showPopup();
+ key_editor->showPopup();
}
+
+//void LMaster::keyPressEvent(QKeyEvent*ev)
+//{
+// switch (ev->key()) {
+// case Qt::Key_Return:
+// // add return as a valid action for editing values too
+// cmd (CMD_EDIT_VALUE);
+// break;
+// default:
+// break;
+// }
+// MidiEditor::keyPressEvent(ev);
+//}
diff --git a/muse2/muse/master/lmaster.h b/muse2/muse/master/lmaster.h
index 4d2c03e9..66acff47 100644
--- a/muse2/muse/master/lmaster.h
+++ b/muse2/muse/master/lmaster.h
@@ -152,6 +152,9 @@ class LMaster : public MidiEditor {
QAction *tempoAction, *signAction, *posAction, *valAction, *delAction, *keyAction;
+// protected:
+// virtual void keyPressEvent(QKeyEvent*);
+
private slots:
void select(QTreeWidgetItem*, QTreeWidgetItem*);
void itemDoubleClicked(QTreeWidgetItem* item);