diff --git a/oom/Composer/Composer.cpp b/oom/Composer/Composer.cpp index 016b72bd..90a2bd77 100644 --- a/oom/Composer/Composer.cpp +++ b/oom/Composer/Composer.cpp @@ -531,6 +531,8 @@ void Composer::posChanged(int idx, unsigned val, bool) cursVal = val; m_timeHeader->setTime(val); time->setPos(3, val, false); + canvas->setPos(3, val, false); + m_tempoHeader->setPos(3, val, false); //m_sigRuler->setPos(3, val, false); } @@ -585,27 +587,31 @@ void Composer::currentTabChanged(int tab) void Composer::setTime(unsigned tick)/*{{{*/ { - if (tick == MAXINT) + /*if (tick == MAXINT) return; else - { + {*/ cursVal = tick; m_timeHeader->setTime(tick); time->setPos(3, tick, false); m_sigRuler->setPos(3, tick, false); - } + canvas->setPos(3, tick, false); + m_tempoHeader->setPos(3, tick, false); + //} }/*}}}*/ void Composer::setTimeFromSig(unsigned tick)/*{{{*/ { - if (tick == MAXINT) - return; - else - { + //if (tick == MAXINT) + // return; + //else + //{ cursVal = tick; m_timeHeader->setTime(tick); time->setPos(3, tick, false); - } + canvas->setPos(3, tick, false); + m_tempoHeader->setPos(3, tick, false); + //} }/*}}}*/ //--------------------------------------------------------- diff --git a/oom/Composer/ComposerCanvas.cpp b/oom/Composer/ComposerCanvas.cpp index 173d1226..52b79202 100644 --- a/oom/Composer/ComposerCanvas.cpp +++ b/oom/Composer/ComposerCanvas.cpp @@ -1834,7 +1834,7 @@ void ComposerCanvas::keyPress(QKeyEvent* event)/*{{{*/ } else if (key == shortcuts[SHRT_POS_DEC].key) { - int spos = _pos[0]; + int spos = _pos[0]; if (spos > 0) { spos -= 1; // Nudge by -1, then snap down with raster1. diff --git a/oom/audio.cpp b/oom/audio.cpp index 32a31323..301631ec 100644 --- a/oom/audio.cpp +++ b/oom/audio.cpp @@ -546,9 +546,10 @@ void Audio::process1(unsigned samplePos, unsigned offset, unsigned frames) int channels; for (ciTrack it = tl->begin(); it != tl->end(); ++it) { - if ((*it)->isMidiTrack()) + Track* t = *it; + if (!t || t->isMidiTrack()) continue; - track = (AudioTrack*) (*it); + track = (AudioTrack*) t; // For audio track types, synths etc. which need some kind of non-audio // (but possibly audio-affecting) processing always, even if their output path @@ -578,9 +579,10 @@ void Audio::process1(unsigned samplePos, unsigned offset, unsigned frames) // processing is 'turned on', if there was a backlog of events while it was off, then they all happen at once. for (ciTrack it = tl->begin(); it != tl->end(); ++it) { - if ((*it)->isMidiTrack()) + Track* t = *it; + if (!t || t->isMidiTrack()) continue; - track = (AudioTrack*) (*it); + track = (AudioTrack*) t; // Ignore unprocessed tracks which have an output route, because they will be processed by // whatever track(s) they are routed to. if (!track->processed() && track->noOutRoute() && (track->type() != Track::AUDIO_OUTPUT)) diff --git a/oom/ctrl/ctrlcanvas.cpp b/oom/ctrl/ctrlcanvas.cpp index e109f917..9a0d107a 100644 --- a/oom/ctrl/ctrlcanvas.cpp +++ b/oom/ctrl/ctrlcanvas.cpp @@ -237,7 +237,7 @@ void CtrlCanvas::setPos(int idx, unsigned val, bool adjustScrollbar)/*{{{*/ w += npos - opos; x = opos; } - pos[idx] = val; + pos[idx] = val; // FIXME: redrawing this rectangle wipes out the controller lane // items when cursor passes over them. @@ -1409,13 +1409,7 @@ void CtrlCanvas::pdraw(QPainter& p, const QRect& rect)/*{{{*/ // draw marker //--------------------------------------------------- - int xp = mapx(pos[0]); - if (xp >= x && xp < x + w) - { - p.setPen(QColor(0, 186, 255)); - p.drawLine(xp, y, xp, y + h); - } - xp = mapx(pos[1]); + int xp = mapx(pos[1]); if ((song->loop() || song->punchin()) && xp >= x && xp < x + w) { p.setPen(QColor(139, 225, 69)); @@ -1428,6 +1422,21 @@ void CtrlCanvas::pdraw(QPainter& p, const QRect& rect)/*{{{*/ p.drawLine(xp, y, xp, y + h); } + p.setPen(QColor(156,75,219)); + xp = mapx(pos[3]); + if (pos[3] != MAXINT) + { + if (xp >= x && xp < x + w) + p.drawLine(xp, y, xp, y+h); + } + + xp = mapx(pos[0]); + if (xp >= x && xp < x + w) + { + p.setPen(QColor(0, 186, 255)); + p.drawLine(xp, y, xp, y + h); + } + //--------------------------------------------------- // draw lasso //--------------------------------------------------- diff --git a/oom/ctrl/ctrledit.h b/oom/ctrl/ctrledit.h index c46cae53..ad1c59c2 100644 --- a/oom/ctrl/ctrledit.h +++ b/oom/ctrl/ctrledit.h @@ -69,6 +69,10 @@ public slots: { canvas->update(); } + void setPos(int idx, unsigned x, bool adjustScrollbar) + { + canvas->setPos(idx, x, adjustScrollbar); + } void setMinHeight(int); void setMaxHeight(int); void updateHeight(int); diff --git a/oom/midiedit/Performer.cpp b/oom/midiedit/Performer.cpp index 99963f14..1051a84b 100644 --- a/oom/midiedit/Performer.cpp +++ b/oom/midiedit/Performer.cpp @@ -1697,6 +1697,12 @@ void Performer::setTime(unsigned tick)/*{{{*/ time->setPos(3, tick, false); pcbar->setPos(3, tick, false); m_sigRuler->setPos(3, tick, false); + canvas->setPos(3, tick, false); + foreach(CtrlEdit* ctrl, ctrlEditList) + { + if(ctrl) + ctrl->setPos(3, tick, false); + } }/*}}}*/ void Performer::setTimeFromSig(unsigned tick)/*{{{*/ @@ -1705,7 +1711,12 @@ void Performer::setTimeFromSig(unsigned tick)/*{{{*/ posLabel->setValue(tick); time->setPos(3, tick, false); pcbar->setPos(3, tick, false); - //m_sigRuler->setPos(3, tick, false); + canvas->setPos(3, tick, false); + foreach(CtrlEdit* ctrl, ctrlEditList) + { + if(ctrl) + ctrl->setPos(3, tick, false); + } }/*}}}*/ //--------------------------------------------------------- diff --git a/oom/widgets/TempoCanvas.cpp b/oom/widgets/TempoCanvas.cpp index 59fc1726..a0dc4598 100644 --- a/oom/widgets/TempoCanvas.cpp +++ b/oom/widgets/TempoCanvas.cpp @@ -190,22 +190,31 @@ void TempoCanvas::pdraw(QPainter& p, const QRect& rect)/*{{{*/ // draw marker //--------------------------------------------------- - int xp = mapx(pos[0]); + int xp = mapx(pos[1]); if (xp >= x && xp < x + w) { - p.setPen(QColor(0, 186, 255)); + p.setPen(QColor(139, 225, 69)); p.drawLine(xp, y, xp, y + h); } - xp = mapx(pos[1]); + xp = mapx(pos[2]); if (xp >= x && xp < x + w) { p.setPen(QColor(139, 225, 69)); p.drawLine(xp, y, xp, y + h); } - xp = mapx(pos[2]); + + xp = mapx(pos[3]); + if (pos[3] != MAXINT) + { + p.setPen(QColor(156,75,219)); + if (xp >= x && xp < x + w) + p.drawLine(xp, y, xp, y+h); + } + + xp = mapx(pos[0]); if (xp >= x && xp < x + w) { - p.setPen(QColor(139, 225, 69)); + p.setPen(QColor(0, 186, 255)); p.drawLine(xp, y, xp, y + h); } }/*}}}*/ diff --git a/oom/widgets/TempoHeader.cpp b/oom/widgets/TempoHeader.cpp index e4b7b1e5..dc08cf96 100644 --- a/oom/widgets/TempoHeader.cpp +++ b/oom/widgets/TempoHeader.cpp @@ -90,3 +90,10 @@ void TempoHeader::setOrigin(int x, int y) if(m_canvas) m_canvas->setOrigin(x, y); } + +void TempoHeader::setPos(int idx, unsigned x, bool sb) +{ + if(m_canvas) + m_canvas->setPos(idx, x, sb); +} + diff --git a/oom/widgets/TempoHeader.h b/oom/widgets/TempoHeader.h index 1c346f8d..759d1646 100644 --- a/oom/widgets/TempoHeader.h +++ b/oom/widgets/TempoHeader.h @@ -31,6 +31,7 @@ public slots: void setStartTempo(double); void setEndTempo(double); void setOrigin(int x, int y); + void setPos(int idx, unsigned x, bool adjustScrollbar); signals: void updateXMag(float); diff --git a/oom/widgets/canvas.cpp b/oom/widgets/canvas.cpp index a780c9aa..5578a722 100644 --- a/oom/widgets/canvas.cpp +++ b/oom/widgets/canvas.cpp @@ -1,11 +1,12 @@ //========================================================= -// OOMidi +// OOStudio // OpenOctave Midi and Audio Editor -// $Id: canvas.cpp,v 1.10.2.17 2009/05/03 04:14:01 terminator356 Exp $ // (C) Copyright 1999 Werner Schweer (ws@seh.de) +// (C) Copyright 2011 - 2012 Andrew Williams and Christopher Cherrett //========================================================= #include +#include #include "canvas.h" @@ -428,11 +429,15 @@ void Canvas::draw(QPainter& p, const QRect& rect)/*{{{*/ if(_drawPartEndLine) p.drawLine(_curPart->endTick(), y, _curPart->endTick(), y2); } - //QPen playbackPen(QColor(8,193,156), 1); - //p.setPen(playbackPen); - //p.setPen(Qt::green); - p.setPen(QColor(0, 186, 255)); + p.setPen(QColor(156,75,219)); + if (_pos[3] != MAXINT) + { + if (_pos[3] >= unsigned(x) && _pos[3] < unsigned(x2)) + p.drawLine(_pos[3], y, _pos[3], y2); + } + + p.setPen(QColor(0, 186, 255)); if (_pos[0] >= unsigned(x) && _pos[0] < unsigned(x2)) { p.drawLine(_pos[0], y, _pos[0], y2); @@ -1304,6 +1309,8 @@ void Canvas::viewMouseMoveEvent(QMouseEvent* event)/*{{{*/ break; } + _pos[3] = _evPos.x(); + redraw(); mouseMove(event); }/*}}}*/