summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--muse2/ChangeLog7
-rw-r--r--muse2/muse/miditransform.cpp62
-rw-r--r--muse2/muse/mplugins/midiitransform.cpp57
-rw-r--r--muse2/muse/sync.cpp6
-rw-r--r--muse2/muse/widgets/CMakeLists.txt100
-rw-r--r--muse2/muse/widgets/itransformbase.ui29
-rw-r--r--muse2/muse/widgets/mtrackinfobase.ui48
-rw-r--r--muse2/muse/widgets/spinbox.cpp13
-rw-r--r--muse2/muse/widgets/spinbox.h5
-rw-r--r--muse2/muse/widgets/spinboxFP.cpp158
-rw-r--r--muse2/muse/widgets/spinboxFP.h44
-rw-r--r--muse2/muse/widgets/transformbase.ui36
-rw-r--r--muse2/muse/widgets/utils.cpp6
-rw-r--r--muse2/muse/widgets/utils.h2
14 files changed, 368 insertions, 205 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index 77423cea..0fd05dd4 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,3 +1,10 @@
+26.11.2010
+ - Fixed midi trackinfo growing size - set output device list box and instrument button
+ h-size policy to 'Ignore'. (Tim)
+ - Fixed trackinfo spinboxes only go to 99 - changed some trackinfo ui spinbox properties
+ (maxValue -> maximum, minValue -> minimum etc). (Tim)
+ - Fixed SpinBoxFP class. Was never right before. (Tim)
+ - Fixed transform and input transform ui files and dialogs - using the corrected SpinBoxFP. (Tim)
25.11.2010
- Fixed column widths, alignments, device renaming and jack device creation issues in synthconfigbase.
Somehow the last changelog entry about this didn't get committed. That's added too. (Orcan)
diff --git a/muse2/muse/miditransform.cpp b/muse2/muse/miditransform.cpp
index c2e962a5..60ab7517 100644
--- a/muse2/muse/miditransform.cpp
+++ b/muse2/muse/miditransform.cpp
@@ -1133,6 +1133,9 @@ void MidiTransformerDialog::procEventOpSel(int val)
TransformOperator op = val == 0 ? Keep : Fix;
procType->setEnabled(op == Fix);
data->cmt->procEvent = op;
+
+ procVal1aChanged(data->cmt->procVal1a);
+ procVal1bChanged(data->cmt->procVal1b);
}
//---------------------------------------------------------
@@ -1142,6 +1145,8 @@ void MidiTransformerDialog::procEventOpSel(int val)
void MidiTransformerDialog::procEventTypeSel(int val)
{
data->cmt->eventType = EventType(eventTypeTable[val]);
+ procVal1aChanged(data->cmt->procVal1a);
+ procVal1bChanged(data->cmt->procVal1b);
}
//---------------------------------------------------------
@@ -1160,7 +1165,7 @@ void MidiTransformerDialog::procVal1OpSel(int val)
case Multiply:
case Divide:
procVal1a->setEnabled(true);
- procVal1a->setPrecision(2);
+ procVal1a->setDecimals(2);
procVal1b->setEnabled(false);
break;
case Plus:
@@ -1168,18 +1173,20 @@ void MidiTransformerDialog::procVal1OpSel(int val)
case Fix:
case Value:
case Flip:
- procVal1a->setPrecision(0);
+ procVal1a->setDecimals(0);
procVal1a->setEnabled(true);
procVal1b->setEnabled(false);
break;
case Random:
case ScaleMap:
case Dynamic:
- procVal1a->setPrecision(0);
+ procVal1a->setDecimals(0);
procVal1a->setEnabled(true);
procVal1b->setEnabled(true);
break;
}
+ procVal1aChanged(data->cmt->procVal1a);
+ procVal1bChanged(data->cmt->procVal1b);
}
//---------------------------------------------------------
@@ -1200,20 +1207,20 @@ void MidiTransformerDialog::procVal2OpSel(int val)
case Multiply:
case Divide:
procVal2a->setEnabled(true);
- procVal2a->setPrecision(2);
+ procVal2a->setDecimals(2);
procVal2b->setEnabled(false);
break;
case Plus:
case Minus:
case Fix:
case Value:
- procVal2a->setPrecision(0);
+ procVal2a->setDecimals(0);
procVal2a->setEnabled(true);
procVal2b->setEnabled(false);
break;
case Random:
case Dynamic:
- procVal2a->setPrecision(0);
+ procVal2a->setDecimals(0);
procVal2a->setEnabled(true);
procVal2b->setEnabled(true);
break;
@@ -1239,12 +1246,12 @@ void MidiTransformerDialog::procLenOpSel(int val)
case Plus:
case Minus:
case Fix:
- procLenA->setPrecision(0);
+ procLenA->setDecimals(0);
procLenA->setEnabled(true);
break;
case Multiply:
case Divide:
- procLenA->setPrecision(2);
+ procLenA->setDecimals(2);
procLenA->setEnabled(true);
break;
default:
@@ -1268,12 +1275,12 @@ void MidiTransformerDialog::procPosOpSel(int val)
break;
case Multiply:
case Divide:
- procPosA->setPrecision(2);
+ procPosA->setDecimals(2);
procPosA->setEnabled(true);
break;
case Plus:
case Minus:
- procPosA->setPrecision(0);
+ procPosA->setDecimals(0);
procPosA->setEnabled(true);
break;
default:
@@ -1483,7 +1490,10 @@ void MidiTransformerDialog::selVal1aChanged(int val)
selVal1a->setSuffix(" - " + pitch2string(val));
}
else
- selVal1a->setSuffix(QString(""));
+ {
+ if(!selVal1a->suffix().isEmpty())
+ selVal1a->setSuffix(QString(""));
+ }
}
//---------------------------------------------------------
@@ -1498,7 +1508,10 @@ void MidiTransformerDialog::selVal1bChanged(int val)
selVal1b->setSuffix(" - " + pitch2string(val));
}
else
- selVal1b->setSuffix(QString(""));
+ {
+ if(!selVal1b->suffix().isEmpty())
+ selVal1b->setSuffix(QString(""));
+ }
}
//---------------------------------------------------------
@@ -1562,6 +1575,19 @@ void MidiTransformerDialog::selBarBChanged(int val)
void MidiTransformerDialog::procVal1aChanged(int val)
{
data->cmt->procVal1a = val;
+
+ if((data->cmt->procEvent == Keep && data->cmt->selType == MIDITRANSFORM_NOTE) &&
+ (data->cmt->procVal1 == Fix || data->cmt->procVal1 == ScaleMap || data->cmt->procVal1 == Dynamic ||
+ data->cmt->procVal1 == Random || data->cmt->procVal1 == Flip))
+ {
+ procVal1a->setSuffix(" - " + pitch2string(val));
+ }
+ else
+ {
+ if(!procVal1a->suffix().isEmpty())
+ procVal1a->setSuffix(QString(""));
+ }
+
}
//---------------------------------------------------------
@@ -1571,6 +1597,18 @@ void MidiTransformerDialog::procVal1aChanged(int val)
void MidiTransformerDialog::procVal1bChanged(int val)
{
data->cmt->procVal1b = val;
+
+ if((data->cmt->procEvent == Keep && data->cmt->selType == MIDITRANSFORM_NOTE) &&
+ (data->cmt->procVal1 == Fix || data->cmt->procVal1 == ScaleMap || data->cmt->procVal1 == Dynamic ||
+ data->cmt->procVal1 == Random || data->cmt->procVal1 == Flip))
+ {
+ procVal1b->setSuffix(" - " + pitch2string(val));
+ }
+ else
+ {
+ if(!procVal1b->suffix().isEmpty())
+ procVal1b->setSuffix(QString(""));
+ }
}
//---------------------------------------------------------
diff --git a/muse2/muse/mplugins/midiitransform.cpp b/muse2/muse/mplugins/midiitransform.cpp
index 32fcbea0..c31ac7ec 100644
--- a/muse2/muse/mplugins/midiitransform.cpp
+++ b/muse2/muse/mplugins/midiitransform.cpp
@@ -23,6 +23,7 @@
#include "track.h"
#include "song.h"
#include "xml.h"
+#include "globals.h"
#include "gconfig.h"
#include "comboQuant.h"
#include "pitchedit.h"
@@ -159,7 +160,10 @@ bool applyMidiInputTransformation(MidiRecordEvent& event)
if (modules[i].valid && modules[i].transform) {
int rv = modules[i].transform->apply(event);
if (rv == 1)
- printf("drop input event\n");
+ {
+ if(debugMsg)
+ printf("drop input event\n");
+ }
if (rv)
return rv != 1;
}
@@ -1075,7 +1079,7 @@ void MidiInputTransformDialog::procVal1OpSel(int val)
case Multiply:
case Divide:
procVal1a->setEnabled(true);
- procVal1a->setPrecision(2);
+ procVal1a->setDecimals(2);
procVal1b->setEnabled(false);
break;
case Plus:
@@ -1083,14 +1087,14 @@ void MidiInputTransformDialog::procVal1OpSel(int val)
case Fix:
case Value:
case Flip:
- procVal1a->setPrecision(0);
+ procVal1a->setDecimals(0);
procVal1a->setEnabled(true);
procVal1b->setEnabled(false);
break;
case Random:
case ScaleMap:
case Dynamic:
- procVal1a->setPrecision(0);
+ procVal1a->setDecimals(0);
procVal1a->setEnabled(true);
procVal1b->setEnabled(true);
break;
@@ -1117,20 +1121,20 @@ void MidiInputTransformDialog::procVal2OpSel(int val)
case Multiply:
case Divide:
procVal2a->setEnabled(true);
- procVal2a->setPrecision(2);
+ procVal2a->setDecimals(2);
procVal2b->setEnabled(false);
break;
case Plus:
case Minus:
case Fix:
case Value:
- procVal2a->setPrecision(0);
+ procVal2a->setDecimals(0);
procVal2a->setEnabled(true);
procVal2b->setEnabled(false);
break;
case Random:
case Dynamic:
- procVal2a->setPrecision(0);
+ procVal2a->setDecimals(0);
procVal2a->setEnabled(true);
procVal2b->setEnabled(true);
break;
@@ -1256,7 +1260,10 @@ void MidiInputTransformDialog::selVal1aChanged(int val)
selVal1a->setSuffix(" - " + pitch2string(val));
}
else
- selVal1a->setSuffix(QString(""));
+ {
+ if(!selVal1a->suffix().isEmpty())
+ selVal1a->setSuffix(QString(""));
+ }
}
//---------------------------------------------------------
@@ -1271,7 +1278,10 @@ void MidiInputTransformDialog::selVal1bChanged(int val)
selVal1b->setSuffix(" - " + pitch2string(val));
}
else
- selVal1b->setSuffix(QString(""));
+ {
+ if(!selVal1b->suffix().isEmpty())
+ selVal1b->setSuffix(QString(""));
+ }
}
//---------------------------------------------------------
@@ -1307,7 +1317,10 @@ void MidiInputTransformDialog::procVal1aChanged(int val)
procVal1a->setSuffix(" - " + pitch2string(val));
}
else
- procVal1a->setSuffix(QString(""));
+ {
+ if(!procVal1a->suffix().isEmpty())
+ procVal1a->setSuffix(QString(""));
+ }
}
//---------------------------------------------------------
@@ -1325,7 +1338,10 @@ void MidiInputTransformDialog::procVal1bChanged(int val)
procVal1b->setSuffix(" - " + pitch2string(val));
}
else
- procVal1b->setSuffix(QString(""));
+ {
+ if(!procVal1b->suffix().isEmpty())
+ procVal1b->setSuffix(QString(""));
+ }
}
//---------------------------------------------------------
@@ -1454,7 +1470,7 @@ void MidiInputTransformDialog::procPortOpSel(int val)
case Multiply:
case Divide:
procPortVala->setEnabled(true);
- procPortVala->setPrecision(2);
+ procPortVala->setDecimals(2);
procPortValb->setEnabled(false);
break;
case Plus:
@@ -1462,14 +1478,14 @@ void MidiInputTransformDialog::procPortOpSel(int val)
case Fix:
case Value:
case Flip:
- procPortVala->setPrecision(0);
+ procPortVala->setDecimals(0);
procPortVala->setEnabled(true);
procPortValb->setEnabled(false);
break;
case Random:
case ScaleMap:
case Dynamic:
- procPortVala->setPrecision(0);
+ procPortVala->setDecimals(0);
procPortVala->setEnabled(true);
procPortValb->setEnabled(true);
break;
@@ -1510,7 +1526,7 @@ void MidiInputTransformDialog::procChannelOpSel(int val)
case Multiply:
case Divide:
procChannelVala->setEnabled(true);
- procChannelVala->setPrecision(2);
+ procChannelVala->setDecimals(2);
procChannelValb->setEnabled(false);
break;
case Plus:
@@ -1518,14 +1534,14 @@ void MidiInputTransformDialog::procChannelOpSel(int val)
case Fix:
case Value:
case Flip:
- procChannelVala->setPrecision(0);
+ procChannelVala->setDecimals(0);
procChannelVala->setEnabled(true);
procChannelValb->setEnabled(false);
break;
case Random:
case ScaleMap:
case Dynamic:
- procChannelVala->setPrecision(0);
+ procChannelVala->setDecimals(0);
procChannelVala->setEnabled(true);
procChannelValb->setEnabled(true);
break;
@@ -1556,12 +1572,12 @@ void MidiInputTransformDialog::procChannelValbChanged(int val)
void MidiInputTransformDialog::changeModul(int k)
{
-printf("change modul %d\n", k);
+//printf("change modul %d\n", k);
cmodul = k; // current modul
if (modules[k].transform == 0) {
- printf("transform %d ist null\n", k);
+ //printf("transform %d ist null\n", k);
modules[k].transform = cmt;
}
else {
@@ -1598,7 +1614,8 @@ void MidiInputTransformDialog::presetChanged(QListWidgetItem* item)
iMidiInputTransformation i;
for (i = mtlist.begin(); i != mtlist.end(); ++i) {
if (item->text() == (*i)->name) {
- printf("found %s\n", (*i)->name.latin1());
+ if(debugMsg)
+ printf("found %s\n", (*i)->name.latin1());
cmt = *i;
if (cmodul != -1) {
modules[cmodul].transform = *i;
diff --git a/muse2/muse/sync.cpp b/muse2/muse/sync.cpp
index 74b38122..c1056e82 100644
--- a/muse2/muse/sync.cpp
+++ b/muse2/muse/sync.cpp
@@ -258,7 +258,8 @@ void MidiSyncInfo::setTime()
if(_actDetect[i] && (t - _lastActTime[i]) >= 1.0) // Set detect indicator timeout to about 1 second.
{
_actDetect[i] = false;
- _actDetectBits &= ~bitShiftLU[i];
+ //_actDetectBits &= ~bitShiftLU[i];
+ _actDetectBits &= ~(1 << i);
}
}
}
@@ -394,7 +395,8 @@ void MidiSyncInfo::trigActDetect(const int ch)
if(ch < 0 || ch >= MIDI_CHANNELS)
return;
- _actDetectBits |= bitShiftLU[ch];
+ //_actDetectBits |= bitShiftLU[ch];
+ _actDetectBits |= (1 << ch);
_actDetect[ch] = true;
_actTrig[ch] = true;
}
diff --git a/muse2/muse/widgets/CMakeLists.txt b/muse2/muse/widgets/CMakeLists.txt
index 401ef106..9ae2d02e 100644
--- a/muse2/muse/widgets/CMakeLists.txt
+++ b/muse2/muse/widgets/CMakeLists.txt
@@ -186,56 +186,56 @@ add_library ( widgets STATIC
mmath.cpp mmath.h
scldraw.cpp scldraw.h
action.h
- scrollscale.cpp # scrollscale.h
- view.cpp # view.h
- nentry.cpp # nentry.h
- mtscale.cpp # mtscale.h
- sigscale.cpp # sigscale.h
- hitscale.cpp # hitscale.h
- intlabel.cpp # intlabel.h
- doublelabel.cpp # doublelabel.h
- canvas.cpp # canvas.h
- noteinfo.cpp # noteinfo.h
- dentry.cpp # dentry.h
- siglabel.cpp # siglabel.h
- ttoolbar.cpp # ttoolbar.h
- ttoolbutton.cpp # ttoolbutton.h
- tb1.cpp # tb1.h
- lcombo.cpp # lcombo.h
- swidget.cpp # swidget.h
- tempolabel.cpp # tempolabel.h
- tools.cpp # tools.h
- fontsel.cpp # fontsel.h
- ctrlcombo.cpp # ctrlcombo.h
- sliderbase.cpp # sliderbase.h
- slider.cpp # slider.h
- midisyncimpl.cpp # midisyncimpl.h
- header.cpp # header.h
- knob.cpp # knob.h
- mlabel.cpp # mlabel.h
- genset.cpp # genset.h
- mixdowndialog.cpp # mixdowndialog.h
- spinboxFP.cpp # spinboxFP.h
- spinbox.cpp # spinbox.h
- comboQuant.cpp # comboQuant.h
- bigtime.cpp # bigtime.h
- comment.cpp # comment.h
- splitter.cpp # splitter.h
- gatetime.cpp # gatetime.h
- velocity.cpp # velocity.h
- metronome.cpp # metronome.h
- posedit.cpp section.h # posedit.h
- pitchedit.cpp # pitchedit.h
- pitchlabel.cpp # pitchlabel.h
- poslabel.cpp # poslabel.h
- filedialog.cpp # filedialog.h
- sigedit.cpp # sigedit.h
- shortcutconfig.cpp # shortcutconfig.h
- shortcutcapturedialog.cpp #shortcutcapturedialog.h
- combobox.cpp # combobox.h
- checkbox.cpp # checkbox.h
- aboutbox_impl.cpp # aboutbox_impl.h aboutbox.h
- popupmenu.cpp # popupmenu.h
+ scrollscale.cpp
+ view.cpp
+ nentry.cpp
+ mtscale.cpp
+ sigscale.cpp
+ hitscale.cpp
+ intlabel.cpp
+ doublelabel.cpp
+ canvas.cpp
+ noteinfo.cpp
+ dentry.cpp
+ siglabel.cpp
+ ttoolbar.cpp
+ ttoolbutton.cpp
+ tb1.cpp
+ lcombo.cpp
+ swidget.cpp
+ tempolabel.cpp
+ tools.cpp
+ fontsel.cpp
+ ctrlcombo.cpp
+ sliderbase.cpp
+ slider.cpp
+ midisyncimpl.cpp
+ header.cpp
+ knob.cpp
+ mlabel.cpp
+ genset.cpp
+ mixdowndialog.cpp
+ spinboxFP.cpp
+ spinbox.cpp
+ comboQuant.cpp
+ bigtime.cpp
+ comment.cpp
+ splitter.cpp
+ gatetime.cpp
+ velocity.cpp
+ metronome.cpp
+ posedit.cpp section.h
+ pitchedit.cpp
+ pitchlabel.cpp
+ poslabel.cpp
+ filedialog.cpp
+ sigedit.cpp
+ shortcutconfig.cpp
+ shortcutcapturedialog.cpp
+ combobox.cpp
+ checkbox.cpp
+ aboutbox_impl.cpp
+ popupmenu.cpp
listitem.h
menutitleitem.h
)
diff --git a/muse2/muse/widgets/itransformbase.ui b/muse2/muse/widgets/itransformbase.ui
index 4100b2f6..51280e56 100644
--- a/muse2/muse/widgets/itransformbase.ui
+++ b/muse2/muse/widgets/itransformbase.ui
@@ -533,8 +533,8 @@
</widget>
</item>
<item row="2" column="1">
- <widget class="SpinBoxFP" name="procVal1a" native="true">
- <property name="maxValue" stdset="0">
+ <widget class="SpinBoxFP" name="procVal1a">
+ <property name="maximum" stdset="0">
<number>99999999</number>
</property>
</widget>
@@ -736,22 +736,22 @@
</widget>
</item>
<item row="2" column="2">
- <widget class="SpinBoxFP" name="procVal2a" native="true">
- <property name="maxValue" stdset="0">
+ <widget class="SpinBoxFP" name="procVal2a">
+ <property name="maximum" stdset="0">
<number>99999999</number>
</property>
</widget>
</item>
<item row="2" column="3">
- <widget class="SpinBoxFP" name="procPortVala" native="true">
- <property name="maxValue" stdset="0">
+ <widget class="SpinBoxFP" name="procPortVala">
+ <property name="maximum" stdset="0">
<number>99999999</number>
</property>
</widget>
</item>
<item row="2" column="4">
- <widget class="SpinBoxFP" name="procChannelVala" native="true">
- <property name="maxValue" stdset="0">
+ <widget class="SpinBoxFP" name="procChannelVala">
+ <property name="maximum" stdset="0">
<number>99999999</number>
</property>
</widget>
@@ -1105,11 +1105,11 @@
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
- <customwidget>
- <class>SpinBoxFP</class>
- <extends>QWidget</extends>
- <header location="global">spinboxFP.h</header>
- </customwidget>
+ <customwidget>
+ <class>SpinBoxFP</class>
+ <extends>QDoubleSpinBox</extends>
+ <header>spinboxFP.h</header>
+ </customwidget>
</customwidgets>
<tabstops>
<tabstop>selEventOp</tabstop>
@@ -1148,9 +1148,6 @@
<tabstop>buttonDelete</tabstop>
<tabstop>buttonOk</tabstop>
</tabstops>
- <includes>
- <include location="local">spinboxFP.h</include>
- </includes>
<resources/>
<connections>
<connection>
diff --git a/muse2/muse/widgets/mtrackinfobase.ui b/muse2/muse/widgets/mtrackinfobase.ui
index d354cd9e..30b111c2 100644
--- a/muse2/muse/widgets/mtrackinfobase.ui
+++ b/muse2/muse/widgets/mtrackinfobase.ui
@@ -58,10 +58,10 @@
<property name="whatsThis">
<string>all midi events are sent to this output channel</string>
</property>
- <property name="maxValue" stdset="0">
+ <property name="maximum" stdset="0">
<number>16</number>
</property>
- <property name="minValue" stdset="0">
+ <property name="minimum" stdset="0">
<number>1</number>
</property>
</widget>
@@ -90,10 +90,10 @@
<property name="suffix" stdset="0">
<string>%</string>
</property>
- <property name="maxValue" stdset="0">
+ <property name="maximum" stdset="0">
<number>200</number>
</property>
- <property name="minValue" stdset="0">
+ <property name="minimum" stdset="0">
<number>25</number>
</property>
<property name="value" stdset="0">
@@ -104,7 +104,7 @@
<item row="1" column="0" colspan="2">
<widget class="QComboBox" name="iOutput">
<property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <sizepolicy hsizetype="Ignored" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -147,10 +147,10 @@
<property name="specialValueText" stdset="0">
<string>off</string>
</property>
- <property name="maxValue" stdset="0">
+ <property name="maximum" stdset="0">
<number>1000</number>
</property>
- <property name="minValue" stdset="0">
+ <property name="minimum" stdset="0">
<number>-1000</number>
</property>
</widget>
@@ -163,10 +163,10 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="maxValue" stdset="0">
+ <property name="maximum" stdset="0">
<number>127</number>
</property>
- <property name="minValue" stdset="0">
+ <property name="minimum" stdset="0">
<number>-127</number>
</property>
<property name="value" stdset="0">
@@ -188,10 +188,10 @@
<property name="suffix" stdset="0">
<string>%</string>
</property>
- <property name="maxValue" stdset="0">
+ <property name="maximum" stdset="0">
<number>200</number>
</property>
- <property name="minValue" stdset="0">
+ <property name="minimum" stdset="0">
<number>25</number>
</property>
<property name="value" stdset="0">
@@ -210,10 +210,10 @@
<property name="specialValueText" stdset="0">
<string>off</string>
</property>
- <property name="maxValue" stdset="0">
+ <property name="maximum" stdset="0">
<number>127</number>
</property>
- <property name="minValue" stdset="0">
+ <property name="minimum" stdset="0">
<number>-127</number>
</property>
<property name="value" stdset="0">
@@ -458,7 +458,7 @@
<item row="11" column="0" colspan="2">
<widget class="QPushButton" name="iPatch">
<property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <sizepolicy hsizetype="Ignored" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -556,10 +556,10 @@
<property name="specialValueText" stdset="0">
<string>off</string>
</property>
- <property name="maxValue" stdset="0">
+ <property name="maximum" stdset="0">
<number>128</number>
</property>
- <property name="minValue" stdset="0">
+ <property name="minimum" stdset="0">
<number>0</number>
</property>
<property name="value" stdset="0">
@@ -606,10 +606,10 @@
<property name="specialValueText" stdset="0">
<string>off</string>
</property>
- <property name="maxValue" stdset="0">
+ <property name="maximum" stdset="0">
<number>128</number>
</property>
- <property name="minValue" stdset="0">
+ <property name="minimum" stdset="0">
<number>0</number>
</property>
<property name="value" stdset="0">
@@ -656,10 +656,10 @@
<property name="specialValueText" stdset="0">
<string>off</string>
</property>
- <property name="maxValue" stdset="0">
+ <property name="maximum" stdset="0">
<number>128</number>
</property>
- <property name="minValue" stdset="0">
+ <property name="minimum" stdset="0">
<number>0</number>
</property>
<property name="value" stdset="0">
@@ -739,10 +739,10 @@
<property name="specialValueText" stdset="0">
<string>off</string>
</property>
- <property name="maxValue" stdset="0">
+ <property name="maximum" stdset="0">
<number>127</number>
</property>
- <property name="minValue" stdset="0">
+ <property name="minimum" stdset="0">
<number>-1</number>
</property>
<property name="value" stdset="0">
@@ -825,10 +825,10 @@
<property name="specialValueText" stdset="0">
<string>off</string>
</property>
- <property name="maxValue" stdset="0">
+ <property name="maximum" stdset="0">
<number>63</number>
</property>
- <property name="minValue" stdset="0">
+ <property name="minimum" stdset="0">
<number>-65</number>
</property>
<property name="value" stdset="0">
diff --git a/muse2/muse/widgets/spinbox.cpp b/muse2/muse/widgets/spinbox.cpp
index de8f5593..ee585da7 100644
--- a/muse2/muse/widgets/spinbox.cpp
+++ b/muse2/muse/widgets/spinbox.cpp
@@ -4,8 +4,7 @@
// $Id: spinbox.cpp,v 1.1.2.3 2009/07/09 18:27:11 terminator356 Exp $
// (C) Copyright 2001 Werner Schweer (ws@seh.de)
//=========================================================
-//#include <qlineedit.h>
-//Added by qt3to4:
+
#include <QKeyEvent>
#include <QEvent>
#include "spinbox.h"
@@ -14,15 +13,17 @@
// SpinBox
//---------------------------------------------------------
-SpinBox::SpinBox(QWidget* parent, const char* name)
- : QSpinBox(parent, name)
+SpinBox::SpinBox(QWidget* parent)
+ : QSpinBox(parent)
{
_clearFocus = true;
}
-SpinBox::SpinBox(int minValue, int maxValue, int step, QWidget* parent, const char* name)
- : QSpinBox(minValue, maxValue, step, parent, name)
+SpinBox::SpinBox(int minValue, int maxValue, int step, QWidget* parent)
+ : QSpinBox(parent)
{
+ setRange(minValue, maxValue);
+ setSingleStep(step);
_clearFocus = true;
}
diff --git a/muse2/muse/widgets/spinbox.h b/muse2/muse/widgets/spinbox.h
index 8e391702..43ff85be 100644
--- a/muse2/muse/widgets/spinbox.h
+++ b/muse2/muse/widgets/spinbox.h
@@ -13,7 +13,6 @@
#define __SPINBOX_H__
#include <QSpinBox>
-//Added by qt3to4:
#include <QEvent>
//---------------------------------------------------------
@@ -36,8 +35,8 @@ class SpinBox : public QSpinBox {
void doubleClicked();
public:
- SpinBox(QWidget* parent=0, const char* name = 0);
- SpinBox(int minValue, int maxValue, int step = 1, QWidget* parent=0, const char* name = 0);
+ SpinBox(QWidget* parent=0);
+ SpinBox(int minValue, int maxValue, int step = 1, QWidget* parent=0);
};
#endif
diff --git a/muse2/muse/widgets/spinboxFP.cpp b/muse2/muse/widgets/spinboxFP.cpp
index c2906940..503a19a3 100644
--- a/muse2/muse/widgets/spinboxFP.cpp
+++ b/muse2/muse/widgets/spinboxFP.cpp
@@ -8,73 +8,165 @@
#include <stdio.h>
#include <cmath>
-//#include <qvalidator.h>
-#include <QtGui>
+//#include <QtGui>
+//#include <QDoubleValidator>
+//#include <QLineEdit>
+
#include "spinboxFP.h"
//---------------------------------------------------------
// SpinBoxFP
//---------------------------------------------------------
-SpinBoxFP::SpinBoxFP(QWidget* parent, const char* name)
- : QSpinBox(parent, name)
+SpinBoxFP::SpinBoxFP(QWidget* parent)
+ //: QSpinBox(parent)
+ : QDoubleSpinBox(parent)
+ {
+ //validator = new QDoubleValidator(this);
+ //lineEdit()->setValidator(validator = new QDoubleValidator(this));
+ //validator->setNotation(QDoubleValidator::StandardNotation);
+
+ //_decimals = 0;
+ setDecimals(0);
+
+ connect(this, SIGNAL(valueChanged(double)), SLOT(valueChange(double)));
+ }
+
+SpinBoxFP::SpinBoxFP(int minValue, int maxValue, int step, QWidget* parent)
+//SpinBoxFP::SpinBoxFP(double minValue, double maxValue, double step, QWidget* parent)
+ //: QSpinBox(parent)
+ : QDoubleSpinBox(parent)
+ {
+ //validator = new QDoubleValidator(this);
+ //lineEdit()->setValidator(validator = new QDoubleValidator(this));
+ //validator->setNotation(QDoubleValidator::StandardNotation);
+
+ //_decimals = 0;
+ QDoubleSpinBox::setDecimals(0);
+
+ setRange(minValue, maxValue);
+ setSingleStep(step);
+
+ connect(this, SIGNAL(valueChanged(double)), SLOT(valueChange(double)));
+ }
+
+//---------------------------------------------------------
+// valueChange
+//---------------------------------------------------------
+
+void SpinBoxFP::valueChange(double)
+{
+ double div = exp10(decimals());
+ emit valueChanged(int(value() * div));
+}
+
+//---------------------------------------------------------
+// setValue
+//---------------------------------------------------------
+
+void SpinBoxFP::setValue(int val)
{
- _precision = 0;
- //setValidator(new QDoubleValidator(this)); ddskrjo
+ double div = exp10(decimals());
+ QDoubleSpinBox::setValue(double(val) / div );
}
-SpinBoxFP::SpinBoxFP(int minValue, int maxValue, int step, QWidget* parent, const char* name)
- : QSpinBox(minValue, maxValue, step, parent, name)
+//---------------------------------------------------------
+// intValue
+//---------------------------------------------------------
+
+int SpinBoxFP::intValue()
{
- _precision = 0;
- //setValidator(new QDoubleValidator(this)); ddskrjo
+ double div = exp10(decimals());
+ return int(value() * div);
}
//---------------------------------------------------------
-// setPrecision
+// setDecimals
//---------------------------------------------------------
-void SpinBoxFP::setPrecision(int val)
+void SpinBoxFP::setDecimals(int val)
{
- _precision = val;
- //updateDisplay(); ddskrjo
+ //_decimals = val;
+
+ //updateDisplay();
+ //interpretText(); // TODO: Check - is this what we need? Will send out signals?
+ //setValue(value()); // Try this. "setValue() will emit valueChanged() if the new value is different from the old one."
+
+ QDoubleSpinBox::setDecimals(val);
+ double step = 1.0 / exp10(val);
+ setSingleStep(step);
}
+/*
+//---------------------------------------------------------
+// validate
+//---------------------------------------------------------
+
+QValidator::State SpinBoxFP::validate(QString& input, int& pos) const
+{
+ // Must set these dynamically as settings may have changed.
+ validator->setRange(minimum(), maximum(), _decimals);
+
+ QValidator::State s = validator->validate(input, pos);
+ return s;
+}
+
//---------------------------------------------------------
// mapValueToText
//---------------------------------------------------------
-QString SpinBoxFP::mapValueToText(int value)
+QString SpinBoxFP::textFromValue(int value) const
{
- if (_precision) {
+ if (_decimals) {
QString s;
- int div = int(exp10(_precision));
+ int div = int(exp10(_decimals));
// printf("val %d, prec %d, div %d\n", value, _precision, div);
- s.sprintf("%d.%0*d", value/div, _precision, value%div);
+
+ s.sprintf("%d.%0*d", value/div, _decimals, value%div);
+ //s.sprintf("%0*f", value, _decimals);
+
return s;
}
- return textFromValue(value); // ddskrjo
+ return QSpinBox::textFromValue(value);
}
//---------------------------------------------------------
// mapTextToValue
//---------------------------------------------------------
-/* ddskrjo
-int SpinBoxFP::mapTextToValue(bool* ok)
+
+int SpinBoxFP::valueFromText(const QString& text) const
{
- QString qs = cleanText();
- if (_precision) {
- const char* s = qs.latin1();
- int a, b;
- int n = sscanf(s, "%d.%d", &a, &b);
- if (n != 2) {
- *ok = false;
- return 0;
+ //QString qs = cleanText();
+ if (_decimals) {
+ //const char* s = qs.latin1();
+ //const char* s = cleanText().toAscii().data();
+
+ //int a, b;
+ bool ok;
+ double f = text.toDouble(&ok);
+
+ //int n = sscanf(s, "%d.%d", &a, &b);
+ //int n = sscanf(s, "%f", &f);
+
+ //if (n != 2) {
+ //if (n != 1) {
+ if (!ok) {
+
+ // *ok = false;
+ //return 0;
+ // TODO: Check - Hmm, no OK parameter. Why return 0? Let's try:
+ // Keep returning the current value until something valid comes in...
+ return value();
}
- int div = int(exp10(_precision));
- return a * div + b;
+
+ //int div = int(exp10(_decimals));
+ double div = int(exp10(_decimals));
+
+ //return a * div + b;
+ return (f * div);
+
}
- return QSpinBox::mapTextToValue(ok);
+ return QSpinBox::valueFromText(text);
}
-*/
+*/ \ No newline at end of file
diff --git a/muse2/muse/widgets/spinboxFP.h b/muse2/muse/widgets/spinboxFP.h
index 760a7d06..4c0b75db 100644
--- a/muse2/muse/widgets/spinboxFP.h
+++ b/muse2/muse/widgets/spinboxFP.h
@@ -8,27 +8,45 @@
#ifndef __SPINBOXFP_H__
#define __SPINBOXFP_H__
-#include <qspinbox.h>
+//#include <QSpinBox>
+#include <QDoubleSpinBox>
+
+//class QValidator;
+//class QDoubleValidator;
//---------------------------------------------------------
// SpinBoxFP
//---------------------------------------------------------
-class SpinBoxFP : public QSpinBox {
+//class SpinBoxFP : public QSpinBox {
+class SpinBoxFP : public QDoubleSpinBox {
Q_OBJECT
- Q_PROPERTY( int precision READ precision WRITE setPrecision )
-
- int _precision;
-
- protected:
- virtual QString mapValueToText(int value);
- //virtual int mapTextToValue(bool* ok);
+ //Q_PROPERTY( int decimals READ decimals WRITE setDecimals )
+
+ //int _decimals;
+ //QDoubleValidator* validator;
+
+ signals:
+ void valueChanged(int);
+
+ private slots:
+ void valueChange(double);
+
+ protected:
+ //virtual QString textFromValue(int) const;
+ //virtual int valueFromText(const QString&) const;
+ //virtual QValidator::State validate(QString&, int&) const;
public:
- SpinBoxFP(QWidget* parent=0, const char* name = 0);
- SpinBoxFP(int minValue, int maxValue, int step = 1, QWidget* parent=0, const char* name = 0);
- void setPrecision(int val);
- int precision() const { return _precision; }
+ SpinBoxFP(QWidget* parent=0);
+ SpinBoxFP(int minValue, int maxValue, int step = 1, QWidget* parent=0);
+ //SpinBoxFP(double minValue, double maxValue, double step = 1.0, QWidget* parent=0);
+
+ void setValue(int val);
+ int intValue();
+
+ void setDecimals(int);
+ //int decimals() const { return _decimals; }
};
#endif
diff --git a/muse2/muse/widgets/transformbase.ui b/muse2/muse/widgets/transformbase.ui
index 5ad09459..1b8ca5f2 100644
--- a/muse2/muse/widgets/transformbase.ui
+++ b/muse2/muse/widgets/transformbase.ui
@@ -417,8 +417,8 @@
</widget>
</item>
<item row="2" column="1">
- <widget class="SpinBoxFP" name="procVal1a" native="true">
- <property name="maxValue" stdset="0">
+ <widget class="SpinBoxFP" name="procVal1a">
+ <property name="maximum" stdset="0">
<number>99999999</number>
</property>
</widget>
@@ -453,22 +453,22 @@
</widget>
</item>
<item row="2" column="2">
- <widget class="SpinBoxFP" name="procVal2a" native="true">
- <property name="maxValue" stdset="0">
+ <widget class="SpinBoxFP" name="procVal2a">
+ <property name="maximum" stdset="0">
<number>99999999</number>
</property>
</widget>
</item>
<item row="2" column="3">
- <widget class="SpinBoxFP" name="procLenA" native="true">
- <property name="maxValue" stdset="0">
+ <widget class="SpinBoxFP" name="procLenA">
+ <property name="maximum" stdset="0">
<number>99999999</number>
</property>
</widget>
</item>
<item row="2" column="4">
- <widget class="SpinBoxFP" name="procPosA" native="true">
- <property name="maxValue" stdset="0">
+ <widget class="SpinBoxFP" name="procPosA">
+ <property name="maximum" stdset="0">
<number>99999999</number>
</property>
</widget>
@@ -798,18 +798,18 @@
</widget>
</item>
<item row="3" column="4">
- <widget class="SpinBoxFP" name="selBarB" native="true">
- <property name="precision" stdset="0">
+ <widget class="SpinBoxFP" name="selBarB">
+ <property name="decimals" stdset="0">
<number>3</number>
</property>
</widget>
</item>
<item row="2" column="4">
- <widget class="SpinBoxFP" name="selBarA" native="true">
- <property name="minValue" stdset="0">
+ <widget class="SpinBoxFP" name="selBarA">
+ <property name="minimum" stdset="0">
<number>1000</number>
</property>
- <property name="precision" stdset="0">
+ <property name="decimals" stdset="0">
<number>3</number>
</property>
</widget>
@@ -985,11 +985,11 @@
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
- <customwidget>
- <class>SpinBoxFP</class>
- <extends>QWidget</extends>
- <header location="global">spinboxFP.h</header>
- </customwidget>
+ <customwidget>
+ <class>SpinBoxFP</class>
+ <extends>QDoubleSpinBox</extends>
+ <header>spinboxFP.h</header>
+ </customwidget>
<customwidget>
<class>ComboQuant</class>
<extends>QWidget</extends>
diff --git a/muse2/muse/widgets/utils.cpp b/muse2/muse/widgets/utils.cpp
index 2c4aeb01..453459cc 100644
--- a/muse2/muse/widgets/utils.cpp
+++ b/muse2/muse/widgets/utils.cpp
@@ -12,12 +12,6 @@
#include <QFrame>
#include <sys/time.h>
-// Quick bit-shift lookup table
-const unsigned int bitShiftLU[32] = { 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80,
- 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000,
- 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000, 0x800000,
- 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, 0x20000000, 0x40000000, 0x80000000 };
-
//---------------------------------------------------------
// curTime
//---------------------------------------------------------
diff --git a/muse2/muse/widgets/utils.h b/muse2/muse/widgets/utils.h
index 297994c0..026ba360 100644
--- a/muse2/muse/widgets/utils.h
+++ b/muse2/muse/widgets/utils.h
@@ -27,7 +27,5 @@ extern QFrame* vLine(QWidget* parent);
extern void dump(const unsigned char* p, int n);
extern double curTime();
-extern const unsigned int bitShiftLU[32];
-
#endif