From: werner s. <wsc...@us...> - 2005-10-20 08:49:30
|
Update of /cvsroot/lmuse/muse/awl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1279/awl Modified Files: tcanvas.cpp tcanvas.h Log Message: updates Index: tcanvas.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/awl/tcanvas.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** tcanvas.cpp 18 Oct 2005 19:41:40 -0000 1.20 --- tcanvas.cpp 20 Oct 2005 08:49:17 -0000 1.21 *************** *** 35,42 **** type = t; marker = 0; - curPitch = -1; - keyDown = -1; showCursor = false; ctrlHeight = 0; if (clockIcon == 0) { --- 35,41 ---- type = t; marker = 0; showCursor = false; ctrlHeight = 0; + curPitch = -1; if (clockIcon == 0) { *************** *** 121,126 **** raster = 0; updateScrollBars(); ! connect(hbar, SIGNAL(valueChanged(int)), SLOT(moveX(int))); ! connect(vbar, SIGNAL(valueChanged(int)), SLOT(moveY(int))); connect(hmag, SIGNAL(valueChanged(int)), SLOT(scaleX(int))); if (vmag) --- 120,125 ---- raster = 0; updateScrollBars(); ! connect(hbar, SIGNAL(sliderMoved(int)), SLOT(moveX(int))); ! connect(vbar, SIGNAL(sliderMoved(int)), SLOT(moveY(int))); connect(hmag, SIGNAL(valueChanged(int)), SLOT(scaleX(int))); if (vmag) *************** *** 160,163 **** --- 159,163 ---- updateGeometry(); updateScrollBars(); + layout(); return false; *************** *** 165,174 **** { QMouseEvent* me = (QMouseEvent*)event; button = me->button(); ! keyState = me->state(); ! int y = me->pos().y(); ! int x = me->pos().x(); ! bool shift = me->modifiers() & Qt::ShiftModifier; ! if (y < rulerHeight) { if (shift) { if (button == Qt::LeftButton) --- 165,176 ---- { QMouseEvent* me = (QMouseEvent*)event; + keyState = me->modifiers(); button = me->button(); ! QPoint p(me->pos()); ! int y = p.y(); ! int x = p.x(); ! bool shift = keyState & Qt::ShiftModifier; ! ! if (rRuler.contains(p)) { if (shift) { if (button == Qt::LeftButton) *************** *** 179,203 **** } else { - if (type == TIME_CANVAS_PIANOROLL) { - if (rCanvasA.contains(me->pos())) { - QPoint p( - lrint((x - MAP_OFFSET - pianoWidth + wpos.x()) / _xmag), - lrint((y - rulerHeight + wpos.y()) / _ymag) - ); - } - else if (rPanelA.contains(me->pos())) { - if (keyDown != -1) { - pianoReleased(keyDown, shift); - keyDown = -1; - } - int y = lrint((me->pos().y() - rulerHeight + wpos.y()) / _ymag); - keyDown = y2pitch(y); - if (keyDown != -1) { - pianoPressed(keyDown, 100, shift); - } - } - } QPoint p(x, y - rulerHeight); ! mousePress(p); } } --- 181,186 ---- } else { QPoint p(x, y - rulerHeight); ! mousePress(me); } } *************** *** 207,238 **** { QMouseEvent* me = (QMouseEvent*)event; ! keyState = me->state(); ! bool shift = me->modifiers() & Qt::ShiftModifier; ! AL::Pos pos(pix2pos(me->pos().x())); ! if (type == TIME_CANVAS_PIANOROLL) { ! int y = lrint((me->pos().y() - rulerHeight + wpos.y()) / _ymag); ! int pitch = y2pitch(y); ! if (curPitch != pitch) { ! curPitch = pitch; ! widget()->update(rPanelA); ! emit pitchChanged(curPitch); ! if (button != Qt::NoButton) { ! if (curPitch != -1) { ! if (curPitch != keyDown) ! pianoReleased(keyDown, shift); ! keyDown = curPitch; ! pianoPressed(keyDown, 100, shift); ! } ! } ! } ! if (showCursor && me->pos().x() < pianoWidth) { ! showCursor = false; ! widget()->update(rRuler); ! emit cursorPos(cursor, showCursor); ! } } ! if (rRuler.contains(me->pos())) { if (!(cursor == pos)) { cursor = pos; --- 190,204 ---- { QMouseEvent* me = (QMouseEvent*)event; ! keyState = me->modifiers(); ! QPoint p(me->pos()); ! AL::Pos pos(pix2pos(p.x())); ! if (showCursor && p.x() < rCanvasA.x()) { ! showCursor = false; ! widget()->update(rRuler); ! emit cursorPos(cursor, showCursor); } ! if (rRuler.contains(p)) { if (!(cursor == pos)) { cursor = pos; *************** *** 256,267 **** return true; } ! else if (rCanvasA.contains(me->pos())) { ! if (!(cursor == pos)) { ! cursor = pos; ! showCursor = true; ! emit cursorPos(cursor, showCursor); ! widget()->update(rRuler); } ! mouseMove(QPoint(me->pos().x(), me->pos().y() - rulerHeight)); } } --- 222,235 ---- return true; } ! else { ! if (rCanvasA.contains(p)) { ! if (!(cursor == pos)) { ! cursor = pos; ! showCursor = true; ! emit cursorPos(cursor, showCursor); ! widget()->update(rRuler); ! } } ! mouseMove(QPoint(p.x(), p.y() - rulerHeight)); } } *************** *** 272,297 **** QMouseEvent* me = (QMouseEvent*)event; button = Qt::NoButton; ! keyState = me->state(); ! bool shift = me->modifiers() & Qt::ShiftModifier; ! ! int y = me->pos().y(); ! int x = me->pos().x(); ! if (type == TIME_CANVAS_PIANOROLL) { ! if (rCanvasA.contains(me->pos())) { ! QPoint p( ! lrint((x - MAP_OFFSET - pianoWidth + wpos.x()) / _xmag), ! lrint((y - rulerHeight + wpos.y()) / _ymag) ! ); ! mouseRelease(p); ! } ! else if (rPanelA.contains(me->pos())) { ! if (keyDown != -1) { ! pianoReleased(keyDown, shift); ! keyDown = -1; ! } ! } ! } ! else ! mouseRelease(me->pos()); } return true; --- 240,245 ---- QMouseEvent* me = (QMouseEvent*)event; button = Qt::NoButton; ! keyState = me->modifiers(); ! mouseRelease(me->pos()); } return true; *************** *** 301,305 **** QMouseEvent* me = (QMouseEvent*)event; button = me->button(); ! keyState = me->state(); mouseDoubleClick(QPoint(me->pos().x(), me->pos().y() - rulerHeight)); } --- 249,253 ---- QMouseEvent* me = (QMouseEvent*)event; button = me->button(); ! keyState = me->modifiers(); mouseDoubleClick(QPoint(me->pos().x(), me->pos().y() - rulerHeight)); } *************** *** 338,342 **** showCursor = false; emit pitchChanged(-1); ! widget()->update(rPanelA); curPitch = -1; return false; --- 286,290 ---- showCursor = false; emit pitchChanged(-1); ! widget()->update(rPanelA | rRuler); curPitch = -1; return false; *************** *** 385,388 **** --- 333,337 ---- int ww = _widget->width(); int wh = _widget->height(); + QRect r(0, rulerHeight, ww, wh - rulerHeight - ctrlHeight); *************** *** 1506,1510 **** int wh = _widget->height(); int ww = _widget->width(); ! int ch = (wh < ctrlHeight) ? wh : ctrlHeight; int x1 = 0; --- 1455,1460 ---- int wh = _widget->height(); int ww = _widget->width(); ! if (wh < ctrlHeight) ! ctrlHeight = wh; int x1 = 0; *************** *** 1515,1525 **** int y2 = wh - ctrlHeight; ! rPanelA.setRect(0, rulerHeight, x1, wh - rulerHeight - ch); ! rPanelB.setRect(0, y2, x1, ch); int cw = ww - x1; rRuler.setRect( x1, 0, cw, rulerHeight); ! rCanvasA.setRect(x1, rulerHeight, cw, wh - rulerHeight - ch); ! rCanvasB.setRect(x1, y2, cw, ch); } --- 1465,1475 ---- int y2 = wh - ctrlHeight; ! rPanelA.setRect(0, rulerHeight, x1, wh - rulerHeight - ctrlHeight); ! rPanelB.setRect(0, y2, x1, ctrlHeight); int cw = ww - x1; rRuler.setRect( x1, 0, cw, rulerHeight); ! rCanvasA.setRect(x1, rulerHeight, cw, wh - rulerHeight - ctrlHeight); ! rCanvasB.setRect(x1, y2, cw, ctrlHeight); } Index: tcanvas.h =================================================================== RCS file: /cvsroot/lmuse/muse/awl/tcanvas.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tcanvas.h 18 Oct 2005 19:41:40 -0000 1.19 --- tcanvas.h 20 Oct 2005 08:49:17 -0000 1.20 *************** *** 64,69 **** // pianoroll variables // - int curPitch; - int keyDown; static QPixmap* octave; static QPixmap* mk1; --- 64,67 ---- *************** *** 97,109 **** int ctrlHeight; int raster; int button; ! int keyState; bool eventFilter(QObject*, QEvent*); virtual void paint(QPainter&, QRect) {} ! virtual void mousePress(QPoint) {} virtual void mouseMove(QPoint) {} virtual void mouseRelease(QPoint) {} --- 95,108 ---- int ctrlHeight; + int curPitch; int raster; int button; ! Qt::KeyboardModifiers keyState; bool eventFilter(QObject*, QEvent*); virtual void paint(QPainter&, QRect) {} ! virtual void mousePress(QMouseEvent*) {} virtual void mouseMove(QPoint) {} virtual void mouseRelease(QPoint) {} *************** *** 112,115 **** --- 111,115 ---- virtual void pianoReleased(int /*pitch*/, bool) {} virtual void paintDrumList(QPainter&, QRect) {} + virtual void layout() {} virtual void paintControllerCanvas(QPainter&, QRect) {} |