diff options
Diffstat (limited to 'muse/awl')
-rw-r--r-- | muse/awl/aslider.cpp | 6 | ||||
-rw-r--r-- | muse/awl/aslider.h | 13 | ||||
-rw-r--r-- | muse/awl/checkbox.h | 4 | ||||
-rw-r--r-- | muse/awl/combobox.h | 6 | ||||
-rw-r--r-- | muse/awl/floatentry.cpp | 16 | ||||
-rw-r--r-- | muse/awl/floatentry.h | 14 | ||||
-rw-r--r-- | muse/awl/knob.cpp | 4 | ||||
-rw-r--r-- | muse/awl/midimeter.cpp | 4 | ||||
-rw-r--r-- | muse/awl/midimeter.h | 4 | ||||
-rw-r--r-- | muse/awl/midimslider.cpp | 4 | ||||
-rw-r--r-- | muse/awl/midimslider.h | 4 | ||||
-rw-r--r-- | muse/awl/midipanentry.h | 4 | ||||
-rw-r--r-- | muse/awl/midipanknob.h | 4 | ||||
-rw-r--r-- | muse/awl/midivolentry.cpp | 4 | ||||
-rw-r--r-- | muse/awl/midivolentry.h | 2 | ||||
-rw-r--r-- | muse/awl/mslider.cpp | 2 | ||||
-rw-r--r-- | muse/awl/mslider.h | 6 | ||||
-rw-r--r-- | muse/awl/tcanvas.cpp | 43 | ||||
-rw-r--r-- | muse/awl/tcanvas.h | 1 |
19 files changed, 74 insertions, 71 deletions
diff --git a/muse/awl/aslider.cpp b/muse/awl/aslider.cpp index 5f751bf6..3c5b1780 100644 --- a/muse/awl/aslider.cpp +++ b/muse/awl/aslider.cpp @@ -134,7 +134,7 @@ void AbstractSlider::wheelEvent(QWheelEvent* ev) void AbstractSlider::keyPressEvent(QKeyEvent* ev) { - float oval = _value; + double oval = _value; switch (ev->key()) { case Qt::Key_Home: _value = _minValue; break; @@ -160,7 +160,7 @@ void AbstractSlider::keyPressEvent(QKeyEvent* ev) // setValue //--------------------------------------------------------- -void AbstractSlider::setValue(float val) +void AbstractSlider::setValue(double val) { if (_log) { if (val == 0.0f) @@ -189,7 +189,7 @@ void AbstractSlider::valueChange() // value //--------------------------------------------------------- -float AbstractSlider::value() const +double AbstractSlider::value() const { return _log ? (_value <= _minValue) ? 0.0f : pow(10.0, _value*0.05f) : _value; diff --git a/muse/awl/aslider.h b/muse/awl/aslider.h index eed73277..058114e3 100644 --- a/muse/awl/aslider.h +++ b/muse/awl/aslider.h @@ -26,7 +26,8 @@ namespace Awl { //--------------------------------------------------------- // AbstractSlider // -//! The AwlAbstractSlider class provides an float value within a range +//! The AwlAbstractSlider class provides an double value +//! within a range // //! The class is designed as a common super class for //! widgets like AwlKnob and AwlSlider @@ -35,7 +36,7 @@ namespace Awl { class AbstractSlider : public QWidget { Q_OBJECT - Q_PROPERTY(float value READ value WRITE setValue) + Q_PROPERTY(double value READ value WRITE setValue) Q_PROPERTY(bool center READ center WRITE setCenter) Q_PROPERTY(bool invertedAppearance READ invertedAppearance WRITE setInvertedAppearance) @@ -55,7 +56,7 @@ class AbstractSlider : public QWidget { protected: int _id; - float _value; + double _value; double _minValue, _maxValue, _lineStep, _pageStep; bool _center; bool _invert; @@ -70,10 +71,10 @@ class AbstractSlider : public QWidget { virtual void valueChange(); signals: - void valueChanged(float, int); + void valueChanged(double, int); public slots: - virtual void setValue(float v); + virtual void setValue(double v); public: AbstractSlider(QWidget* parent = 0); @@ -101,7 +102,7 @@ class AbstractSlider : public QWidget { int id() const { return _id; } void setId(int i) { _id = i; } - virtual float value() const; + virtual double value() const; double minValue() const { return _minValue; } void setMinValue(double v) { _minValue = v; } diff --git a/muse/awl/checkbox.h b/muse/awl/checkbox.h index 145105bf..7a6252c1 100644 --- a/muse/awl/checkbox.h +++ b/muse/awl/checkbox.h @@ -35,13 +35,13 @@ class CheckBox : public QCheckBox { private slots: void hasToggled(bool val) { - emit valueChanged(float(val), _id); + emit valueChanged(double(val), _id); } signals: void valueChanged(float, int); public slots: - void setValue(float val) { setDown(val > 0.5f); } + void setValue(double val) { setDown(val > 0.5f); } public: CheckBox(QWidget* parent); diff --git a/muse/awl/combobox.h b/muse/awl/combobox.h index c3c4d91b..d335d993 100644 --- a/muse/awl/combobox.h +++ b/muse/awl/combobox.h @@ -35,14 +35,14 @@ class ComboBox : public QComboBox { private slots: void activatedIntern(int val) { - emit valueChanged(float(val), _id); + emit valueChanged(double(val), _id); } signals: - void valueChanged(float, int); + void valueChanged(double, int); public slots: - void setValue(float val) { setCurrentIndex(int(val)); } + void setValue(double val) { setCurrentIndex(int(val)); } public: ComboBox(QWidget* parent); diff --git a/muse/awl/floatentry.cpp b/muse/awl/floatentry.cpp index a9875594..7831614f 100644 --- a/muse/awl/floatentry.cpp +++ b/muse/awl/floatentry.cpp @@ -55,7 +55,7 @@ FloatEntry::FloatEntry(QWidget* parent) // setString //--------------------------------------------------------- -bool FloatEntry::setString(float v) +bool FloatEntry::setString(double v) { QString s; // if (v < _minValue || v > _maxValue) { @@ -80,7 +80,7 @@ bool FloatEntry::setString(float v) void FloatEntry::setSValue(const QString& s) { bool ok; - float v = s.toFloat(&ok); + double v = s.toFloat(&ok); if (ok && (v != _value)) { if (v < _minValue) v = _minValue; @@ -105,7 +105,7 @@ void FloatEntry::valueChange() // incValue //--------------------------------------------------------- -void FloatEntry::incValue(float) +void FloatEntry::incValue(double) { if (_value + 1.0 < _maxValue) { _value = _value + 1.0; @@ -118,7 +118,7 @@ void FloatEntry::incValue(float) // decValue //--------------------------------------------------------- -void FloatEntry::decValue(float) +void FloatEntry::decValue(double) { if (_value - 1.0 > _minValue) { _value = _value - 1.0; @@ -169,7 +169,7 @@ void FloatEntry::mousePressEvent(QMouseEvent* event) { button = event->button(); starty = event->y(); - evx = float(event->x()); + evx = double(event->x()); timecount = 0; repeat(); timer->start(TIMER1); @@ -272,7 +272,7 @@ void FloatEntry::mouseDoubleClickEvent(QMouseEvent* event) // setValue //--------------------------------------------------------- -void FloatEntry::setValue(float val) +void FloatEntry::setValue(double val) { if (_log) { if (val == 0.0f) @@ -304,9 +304,9 @@ void FloatEntry::updateValue() // value //--------------------------------------------------------- -float FloatEntry::value() const +double FloatEntry::value() const { - float rv; + double rv; if (_log) rv = pow(10.0, _value * 0.05f); else diff --git a/muse/awl/floatentry.h b/muse/awl/floatentry.h index 1fbdc7bc..a90232a9 100644 --- a/muse/awl/floatentry.h +++ b/muse/awl/floatentry.h @@ -56,15 +56,15 @@ class FloatEntry : public QLineEdit { virtual void mouseDoubleClickEvent(QMouseEvent*); virtual void mouseReleaseEvent(QMouseEvent*); virtual void setSValue(const QString&); - virtual bool setString(float); - virtual void incValue(float); - virtual void decValue(float); + virtual bool setString(double); + virtual void incValue(double); + virtual void decValue(double); void updateValue(); protected: int _id; - float _value; + double _value; virtual void valueChange(); private slots: @@ -74,15 +74,15 @@ class FloatEntry : public QLineEdit { void endEdit(); public slots: - virtual void setValue(float); + virtual void setValue(double); signals: - void valueChanged(float, int); + void valueChanged(double, int); public: FloatEntry(QWidget*); virtual QSize sizeHint() const; - virtual float value() const; + virtual double value() const; int id() const { return _id; } void setId(int i) { _id = i; } double minValue() const { return _minValue; } diff --git a/muse/awl/knob.cpp b/muse/awl/knob.cpp index 8fb57508..30956859 100644 --- a/muse/awl/knob.cpp +++ b/muse/awl/knob.cpp @@ -134,7 +134,7 @@ void Knob::mouseReleaseEvent(QMouseEvent*) void Knob::mouseMoveEvent(QMouseEvent* ev) { int y = ev->y(); - float delta = (maxValue() - minValue()) / 100.0f; + double delta = (maxValue() - minValue()) / 100.0f; if (delta == 0) delta = 1; _value += (startY - y) * delta; @@ -188,7 +188,7 @@ void Knob::paint(const QRect& r) // draw arc //----------------------------------------- - float dvalue = maxValue() - minValue(); + double dvalue = maxValue() - minValue(); if (_center) { int size = _scaleSize * 8; if (_value >= 0) { diff --git a/muse/awl/midimeter.cpp b/muse/awl/midimeter.cpp index aa6e528b..eaae83ee 100644 --- a/muse/awl/midimeter.cpp +++ b/muse/awl/midimeter.cpp @@ -44,7 +44,7 @@ MidiMeter::MidiMeter(QWidget* parent) // v - 0.0 < 1.0 //--------------------------------------------------------- -void MidiMeter::setMeterVal(float v) +void MidiMeter::setMeterVal(double v) { if (v < 0.001) v = .0f; @@ -72,7 +72,7 @@ void MidiMeter::mouseDoubleClickEvent(QMouseEvent*) void MidiMeter::paint(const QRect& r) { int pixel = height() - sliderSize().height(); - float range = maxValue() - minValue(); + double range = maxValue() - minValue(); int ppos = int(pixel * (_value - minValue()) / range); if (_invert) ppos = pixel - ppos; diff --git a/muse/awl/midimeter.h b/muse/awl/midimeter.h index 1624fd97..80f3c52a 100644 --- a/muse/awl/midimeter.h +++ b/muse/awl/midimeter.h @@ -34,7 +34,7 @@ class MidiMeter : public Slider Q_PROPERTY(int meterWidth READ meterWidth WRITE setMeterWidth) Q_OBJECT - float meterval; + double meterval; int _meterWidth; virtual void paint(const QRect& r); @@ -43,7 +43,7 @@ class MidiMeter : public Slider virtual void mouseDoubleClickEvent(QMouseEvent*); public slots: - void setMeterVal(float value); + void setMeterVal(double value); public: MidiMeter(QWidget* parent = 0); diff --git a/muse/awl/midimslider.cpp b/muse/awl/midimslider.cpp index 0c3ffc0e..c7d7efa8 100644 --- a/muse/awl/midimslider.cpp +++ b/muse/awl/midimslider.cpp @@ -44,7 +44,7 @@ MidiMeterSlider::MidiMeterSlider(QWidget* parent) // v - 0.0 < 1.0 //--------------------------------------------------------- -void MidiMeterSlider::setMeterVal(float v) +void MidiMeterSlider::setMeterVal(double v) { if (v < 0.001) v = .0f; @@ -72,7 +72,7 @@ void MidiMeterSlider::mouseDoubleClickEvent(QMouseEvent*) void MidiMeterSlider::paint(const QRect& r) { int pixel = height() - sliderSize().height(); - float range = maxValue() - minValue(); + double range = maxValue() - minValue(); int ppos = int(pixel * (_value - minValue()) / range); if (_invert) ppos = pixel - ppos; diff --git a/muse/awl/midimslider.h b/muse/awl/midimslider.h index f2f58a4d..15533b09 100644 --- a/muse/awl/midimslider.h +++ b/muse/awl/midimslider.h @@ -34,7 +34,7 @@ class MidiMeterSlider : public Slider Q_PROPERTY(int meterWidth READ meterWidth WRITE setMeterWidth) Q_OBJECT - float meterval; + double meterval; int _meterWidth; virtual void paint(const QRect& r); @@ -43,7 +43,7 @@ class MidiMeterSlider : public Slider virtual void mouseDoubleClickEvent(QMouseEvent*); public slots: - void setMeterVal(float value); + void setMeterVal(double value); public: MidiMeterSlider(QWidget* parent = 0); diff --git a/muse/awl/midipanentry.h b/muse/awl/midipanentry.h index 913339f8..25f7333a 100644 --- a/muse/awl/midipanentry.h +++ b/muse/awl/midipanentry.h @@ -36,12 +36,12 @@ class MidiPanEntry : public FloatEntry { virtual void valueChange(); public slots: - virtual void setValue(float v) { + virtual void setValue(double v) { FloatEntry::setValue(v - 64.0f); } public: MidiPanEntry(QWidget* parent); - virtual float value() const { return _value + 64.0f; } + virtual double value() const { return _value + 64.0f; } }; } diff --git a/muse/awl/midipanknob.h b/muse/awl/midipanknob.h index 5c4b715a..9b628e6b 100644 --- a/muse/awl/midipanknob.h +++ b/muse/awl/midipanknob.h @@ -42,12 +42,12 @@ class MidiPanKnob : public Knob { } public slots: - virtual void setValue(float v) { + virtual void setValue(double v) { AbstractSlider::setValue(v - 64.0f); } public: MidiPanKnob(QWidget* parent = 0); - virtual float value() const { return _value + 64.0f; } + virtual double value() const { return _value + 64.0f; } }; } diff --git a/muse/awl/midivolentry.cpp b/muse/awl/midivolentry.cpp index 80aa1d1d..0b74afcc 100644 --- a/muse/awl/midivolentry.cpp +++ b/muse/awl/midivolentry.cpp @@ -42,9 +42,9 @@ MidiVolEntry::MidiVolEntry(QWidget* parent) // setValue //--------------------------------------------------------- -void MidiVolEntry::setValue(float v) +void MidiVolEntry::setValue(double v) { - FloatEntry::setValue(-fast_log10(float(_max*_max)/(v*v))*20.0f); + FloatEntry::setValue(-fast_log10(double(_max*_max)/(v*v))*20.0f); } } diff --git a/muse/awl/midivolentry.h b/muse/awl/midivolentry.h index 45216521..99155877 100644 --- a/muse/awl/midivolentry.h +++ b/muse/awl/midivolentry.h @@ -36,7 +36,7 @@ class MidiVolEntry : public FloatEntry { int _max; public: - virtual void setValue(float); + virtual void setValue(double); void setMax(int val) { _max = val; } int max() const { return _max; } MidiVolEntry(QWidget* parent); diff --git a/muse/awl/mslider.cpp b/muse/awl/mslider.cpp index 2f910731..0bfac826 100644 --- a/muse/awl/mslider.cpp +++ b/muse/awl/mslider.cpp @@ -67,7 +67,7 @@ void MeterSlider::setChannel(int n) // setMeterVal //--------------------------------------------------------- -void MeterSlider::setMeterVal(int channel, float v, float peak) +void MeterSlider::setMeterVal(int channel, double v, double peak) { bool mustRedraw = false; if (meterval[channel] != v) { diff --git a/muse/awl/mslider.h b/muse/awl/mslider.h index 24e67889..7f02eee6 100644 --- a/muse/awl/mslider.h +++ b/muse/awl/mslider.h @@ -37,8 +37,8 @@ class MeterSlider : public VolSlider Q_OBJECT int _channel; - std::vector<float> meterval; - std::vector<float> meterPeak; + std::vector<double> meterval; + std::vector<double> meterPeak; int yellowScale, redScale; int _meterWidth; @@ -50,7 +50,7 @@ class MeterSlider : public VolSlider public slots: void resetPeaks(); - void setMeterVal(int channel, float value, float peak); + void setMeterVal(int channel, double value, double peak); public: MeterSlider(QWidget* parent = 0); diff --git a/muse/awl/tcanvas.cpp b/muse/awl/tcanvas.cpp index ef515f50..3cd0d9ff 100644 --- a/muse/awl/tcanvas.cpp +++ b/muse/awl/tcanvas.cpp @@ -891,6 +891,26 @@ void TimeCanvas::canvasPaintEvent(const QRect& r, QPainter& p) int y1 = r.y(); int y2 = y1 + r.height(); + if (drawRuler) { + p.setClipRect(hor); + int w = r.width(); + int x = r.x(); + int y = rulerHeight - 16; + QColor lcColors[3] = { Qt::red, Qt::blue, Qt::blue }; + + for (int i = 0; i < 3; ++i) { + p.setPen(lcColors[i]); + int xp = pos2pix(pos[i]) + rRuler.x(); + QPixmap* pm = markIcon[i]; + int pw = (pm->width() + 1) / 2; + int x1 = x - pw; + int x2 = x + w + pw; + if (xp >= x1 && xp < x2) { + p.drawPixmap(xp - pw, y-2, *pm); + p.drawLine(xp, y1, xp, y2); + } + } + } if (marker) { int yy1 = y1; if (yy1 < rCanvasA.x()) @@ -900,33 +920,14 @@ void TimeCanvas::canvasPaintEvent(const QRect& r, QPainter& p) if (start != marker->begin()) --start; AL::iMarker end = marker->lower_bound(pos2.tick()); + if (end != marker->end()) + ++end; for (AL::iMarker m = start; m != end; ++m) { AL::Pos pm(m->second); int x = pos2pix(pm) + rRuler.x(); p.drawLine(x, yy1, x, y2); } } - if (!drawRuler) - return; - - p.setClipRect(hor); - int w = r.width(); - int x = r.x(); - int y = rulerHeight - 16; - QColor lcColors[3] = { Qt::red, Qt::blue, Qt::blue }; - - for (int i = 0; i < 3; ++i) { - p.setPen(lcColors[i]); - int xp = pos2pix(pos[i]) + rRuler.x(); - QPixmap* pm = markIcon[i]; - int pw = (pm->width() + 1) / 2; - int x1 = x - pw; - int x2 = x + w + pw; - if (xp >= x1 && xp < x2) { - p.drawPixmap(xp - pw, y-2, *pm); - p.drawLine(xp, y1, xp, y2); - } - } } //--------------------------------------------------------- diff --git a/muse/awl/tcanvas.h b/muse/awl/tcanvas.h index df4b9d70..cdecdbe6 100644 --- a/muse/awl/tcanvas.h +++ b/muse/awl/tcanvas.h @@ -244,6 +244,7 @@ class TimeCanvas : public QFrame { void setCanvasBackground(const QPixmap& pm); void updateCanvasB() { _widget->update(rCanvasB); } + void updateRuler() { _widget->update(rRuler); } static FollowMode followMode; friend class CtrlEdit; |