summaryrefslogtreecommitdiff
path: root/attic/muse2-oom/muse2/awl/midimeter.cpp
diff options
context:
space:
mode:
authorRobert Jonsson <spamatica@gmail.com>2011-09-15 12:14:55 +0000
committerRobert Jonsson <spamatica@gmail.com>2011-09-15 12:14:55 +0000
commitb0546e5e7f7044019892543c6c82029db8d564a7 (patch)
tree1b96a6260900f3fbf3513fb48a5a72aa89052dc8 /attic/muse2-oom/muse2/awl/midimeter.cpp
parent583c73d1a07154d3d2672d65d8cce6495f490454 (diff)
moved attic to a branch of it's own
Diffstat (limited to 'attic/muse2-oom/muse2/awl/midimeter.cpp')
-rw-r--r--attic/muse2-oom/muse2/awl/midimeter.cpp140
1 files changed, 0 insertions, 140 deletions
diff --git a/attic/muse2-oom/muse2/awl/midimeter.cpp b/attic/muse2-oom/muse2/awl/midimeter.cpp
deleted file mode 100644
index 255232d7..00000000
--- a/attic/muse2-oom/muse2/awl/midimeter.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-//=============================================================================
-// Awl
-// Audio Widget Library
-// $Id:$
-//
-// Copyright (C) 2002-2006 by 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.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-//=============================================================================
-
-#include "fastlog.h"
-#include "midimeter.h"
-
-#include <QPainter>
-#include <QPaintEvent>
-
-namespace Awl {
-
-//---------------------------------------------------------
-// MidiMeter
-//---------------------------------------------------------
-
-MidiMeter::MidiMeter(QWidget* parent)
- : Slider(parent)
- {
- setRange(0.0f, 127.0f);
- setLineStep(2);
- setPageStep(4);
-
- setScaleWidth(7);
- _meterWidth = _scaleWidth * 3;
- meterval = 0.0f;
- }
-
-//---------------------------------------------------------
-// setMeterVal
-// v - 0.0 < 1.0
-//---------------------------------------------------------
-
-void MidiMeter::setMeterVal(double v)
- {
- if (v < 0.001)
- v = .0f;
- if (meterval != v) {
- meterval = v;
- update();
- }
- }
-
-//---------------------------------------------------------
-// mouseDoubleClickEvent
-//---------------------------------------------------------
-
-void MidiMeter::mouseDoubleClickEvent(QMouseEvent*)
- {
- _value = _minValue;
- valueChange();
- update();
- }
-
-//---------------------------------------------------------
-// paintEvent
-//---------------------------------------------------------
-
-void MidiMeter::paintEvent(QPaintEvent* ev)
- {
- int pixel = height() - sliderSize().height();
- double range = maxValue() - minValue();
- int ppos = int(pixel * (_value - minValue()) / range);
- if (_invert)
- ppos = pixel - ppos;
-
- QRect rr(ev->rect());
- QPainter p(this);
-
- QColor sc(isEnabled() ? _scaleColor : Qt::gray);
- QColor svc(isEnabled() ? _scaleValueColor : Qt::gray);
- p.setBrush(svc);
-
- int h = height();
- int kh = sliderSize().height();
-
- //---------------------------------------------------
- // draw meter
- //---------------------------------------------------
-
- int mw = _meterWidth;
- int x = 0;
-
- int y1 = kh / 2;
- int y3 = h - y1;
-
- int mh = h - kh;
-
- p.setPen(Qt::white);
- h = lrint(meterval * mh);
- if (h < 0)
- h = 0;
- else if (h > mh)
- h = mh;
- p.fillRect(x, y3-h, mw, h, QBrush(0x00ff00)); // green
- p.fillRect(x, y1, mw, mh-h, QBrush(0x007000)); // dark green
- x += mw;
-
-#if 0
- //---------------------------------------------------
- // draw scale
- //---------------------------------------------------
-
- x += _scaleWidth/2;
-
- p.setPen(QPen(sc, _scaleWidth));
- p.drawLine(x, y1, x, y2);
- p.setPen(QPen(svc, _scaleWidth));
- p.drawLine(x, y2, x, y3);
-
- //---------------------------------------------------
- // draw slider
- //---------------------------------------------------
-
- x += _scaleWidth/2;
- p.setPen(QPen(svc, 0));
- points.setPoint(0, x, y2);
- points.setPoint(1, x + kw, y2 - kh/2);
- points.setPoint(2, x + kw, y2 + kh/2);
- p.drawConvexPolygon(points);
-#endif
- }
-}
-