summaryrefslogtreecommitdiff
path: root/attic/muse_qt4_evolution/muse/widgets/siglabel.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/muse_qt4_evolution/muse/widgets/siglabel.cpp
parent583c73d1a07154d3d2672d65d8cce6495f490454 (diff)
moved attic to a branch of it's own
Diffstat (limited to 'attic/muse_qt4_evolution/muse/widgets/siglabel.cpp')
-rw-r--r--attic/muse_qt4_evolution/muse/widgets/siglabel.cpp165
1 files changed, 0 insertions, 165 deletions
diff --git a/attic/muse_qt4_evolution/muse/widgets/siglabel.cpp b/attic/muse_qt4_evolution/muse/widgets/siglabel.cpp
deleted file mode 100644
index 2f8d3e84..00000000
--- a/attic/muse_qt4_evolution/muse/widgets/siglabel.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-//=============================================================================
-// MusE
-// Linux Music Editor
-// $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 "siglabel.h"
-
-#define TIMER1 400
-#define TIMER2 200
-#define TIMEC 7
-#define TIMER3 100
-#define TIMEC2 20
-#define TIMER4 50
-
-#include "globals.h"
-
-//---------------------------------------------------------
-// SigLabel
-// edit Signature Values (4/4)
-//---------------------------------------------------------
-
-SigLabel::SigLabel(QWidget* parent)
- : QLabel(parent)
- {
- z = n = 0;
- setFocusPolicy(Qt::NoFocus);
- setAlignment(Qt::AlignCenter);
- }
-
-//---------------------------------------------------------
-// mousePressEvent
-//---------------------------------------------------------
-
-void SigLabel::mousePressEvent(QMouseEvent* event)
- {
- int button = event->button();
- bool zaehler = event->x() < width() /2;
-
- int zz = z, nn = n;
- switch (button) {
- case Qt::LeftButton:
- return;
- case Qt::MidButton:
- incValue(zaehler, false, zz, nn);
- break;
- case Qt::RightButton:
- incValue(zaehler, true, zz, nn);
- break;
- default:
- break;
- }
- if ((zz != z) || (nn != n)) {
- setValue(zz, nn);
- emit valueChanged(zz, nn);
- }
- }
-
-//---------------------------------------------------------
-// incValue
-//---------------------------------------------------------
-
-void SigLabel::incValue(bool zaehler, bool up, int& zz, int& nn)
- {
- if (!up) {
- if (zaehler) {
- --zz;
- if (zz < 1)
- zz = 1;
- }
- else {
- switch (nn) {
- case 1: break;
- case 2: nn = 1; break;
- case 4: nn = 2; break;
- case 8: nn = 4; break;
- case 16: nn = 8; break;
- case 32: nn = 16; break;
- case 64: nn = 32; break;
- case 128: nn = 64; break;
- }
- }
- }
- else {
- if (zaehler) {
- ++zz;
- if (zz > 16)
- zz = 16;
- }
- else {
- switch (nn) {
- case 1: nn = 2; break;
- case 2: nn = 4; break;
- case 4: nn = 8; break;
- case 8: nn = 16; break;
- case 16: nn = 32; break;
- case 32: nn = 64; break;
- case 64: nn = 128; break;
- case 128: break;
- }
- }
- }
- }
-
-//---------------------------------------------------------
-// wheelEvent
-//---------------------------------------------------------
-
-void SigLabel::wheelEvent(QWheelEvent* event)
- {
- bool zaehler = event->x() < width() /2;
- int delta = event->delta();
- int zz = z, nn = n;
-
- bool inc = delta >= 0;
- incValue(zaehler, inc, zz, nn);
- if ((zz != z) || (nn != n)) {
- setValue(zz, nn);
- emit valueChanged(zz, nn);
- }
- }
-
-//---------------------------------------------------------
-// setValue
-//---------------------------------------------------------
-
-void SigLabel::setValue(int a, int b)
- {
- if (a == z && b == n)
- return;
- z = a;
- n = b;
- QString sa;
- sa.setNum(a);
-
- QString sb;
- sb.setNum(b);
-
- QString s = sa + QString("/") + sb;
- setText(s);
- }
-
-//---------------------------------------------------------
-// setFrame
-//---------------------------------------------------------
-
-void SigLabel::setFrame(bool flag)
- {
- setFrameStyle(flag ? Panel | Sunken : NoFrame);
- setLineWidth(2);
- }