1
//=========================================================
4
// $Id: sigscale.cpp,v 1.1.1.1 2003/10/29 10:06:24 wschweer Exp $
5
// (C) Copyright 1999 Werner Schweer (ws@seh.de)
6
//=========================================================
9
#include "midieditor.h"
16
//---------------------------------------------------------
18
//---------------------------------------------------------
20
SigScale::SigScale(int* r, QWidget* parent, int xs)
23
QToolTip::add(this, tr("signature scale"));
25
pos[0] = song->cpos();
26
pos[1] = song->lpos();
27
pos[2] = song->rpos();
28
button = QMouseEvent::NoButton;
29
setMouseTracking(true);
30
connect(song, SIGNAL(posChanged(int, int, bool)), this, SLOT(setPos(int, int, bool)));
34
//---------------------------------------------------------
36
//---------------------------------------------------------
38
void SigScale::setPos(int idx, int val, bool)
42
int opos = mapx(pos[idx]);
57
redraw(QRect(x, 0, w, height()));
60
void SigScale::viewMousePressEvent(QMouseEvent* event)
62
button = event->button();
63
viewMouseMoveEvent(event);
66
void SigScale::viewMouseReleaseEvent(QMouseEvent*)
68
button = QMouseEvent::NoButton;
71
void SigScale::viewMouseMoveEvent(QMouseEvent* event)
73
int x = sigmap.raster(event->x(), *raster);
77
case QMouseEvent::LeftButton:
80
case QMouseEvent::MidButton:
83
case QMouseEvent::RightButton:
92
//---------------------------------------------------------
94
//---------------------------------------------------------
96
void SigScale::leaveEvent(QEvent*)
101
//---------------------------------------------------------
103
//---------------------------------------------------------
105
void SigScale::pdraw(QPainter& p, const QRect& r)
114
for (ciSigEvent si = sigmap.begin(); si != sigmap.end(); ++si) {
115
SigEvent* e = si->second;
116
int xp = mapx(e->tick);
121
p.drawLine(xp, 0, xp, h/2);
122
p.drawLine(xp, h/2, xp+5, h/2);
124
s.sprintf("%d/%d", e->z, e->n);
125
p.drawText(xp+8, h-6, s);
128
//---------------------------------------------------
129
// draw location marker
130
//---------------------------------------------------
133
int xp = mapx(pos[0]);
134
if (xp >= x && xp < x+w)
135
p.drawLine(xp, 0, xp, h);
138
if (xp >= x && xp < x+w)
139
p.drawLine(xp, 0, xp, h);
141
if (xp >= x && xp < x+w)
142
p.drawLine(xp, 0, xp, h);