summaryrefslogtreecommitdiff
path: root/muse2/muse/ctrl/ctrlcanvas.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'muse2/muse/ctrl/ctrlcanvas.cpp')
-rw-r--r--muse2/muse/ctrl/ctrlcanvas.cpp38
1 files changed, 35 insertions, 3 deletions
diff --git a/muse2/muse/ctrl/ctrlcanvas.cpp b/muse2/muse/ctrl/ctrlcanvas.cpp
index 9c19cf8b..1825d75d 100644
--- a/muse2/muse/ctrl/ctrlcanvas.cpp
+++ b/muse2/muse/ctrl/ctrlcanvas.cpp
@@ -191,12 +191,16 @@ CtrlCanvas::CtrlCanvas(MidiEditor* e, QWidget* parent, int xmag,
setBg(Qt::white);
setFont(MusEGlobal::config.fonts[3]);
editor = e;
+ _panel = pnl;
drag = DRAG_OFF;
tool = MusEGui::PointerTool;
pos[0] = 0;
pos[1] = 0;
pos[2] = 0;
noEvents=false;
+ _perNoteVeloMode = MusEGlobal::config.velocityPerNote;
+ if(_panel)
+ _panel->setVeloPerNoteMode(_perNoteVeloMode);
if (dynamic_cast<DrumEdit*>(editor) && dynamic_cast<DrumEdit*>(editor)->old_style_drummap_mode()==false)
filterTrack=true;
@@ -205,7 +209,6 @@ CtrlCanvas::CtrlCanvas(MidiEditor* e, QWidget* parent, int xmag,
ctrl = &veloList;
_controller = &MusECore::veloCtrl;
- _panel = pnl;
_cnum = MusECore::CTRL_VELOCITY;
_dnum = MusECore::CTRL_VELOCITY;
_didx = MusECore::CTRL_VELOCITY;
@@ -233,6 +236,17 @@ CtrlCanvas::~CtrlCanvas()
}
//---------------------------------------------------------
+// setPanel
+//---------------------------------------------------------
+
+void CtrlCanvas::setPanel(CtrlPanel* pnl)
+{
+ _panel = pnl;
+ if(_panel)
+ _panel->setVeloPerNoteMode(_perNoteVeloMode);
+}
+
+//---------------------------------------------------------
// setPos
// set one of three markers
// idx - 0-cpos 1-lpos 2-rpos
@@ -602,14 +616,14 @@ void CtrlCanvas::updateItems()
for (MusECore::iEvent i = el->begin(); i != el->end(); ++i)
{
MusECore::Event e = i->second;
- // Added by T356. Do not add events which are past the end of the part.
+ // Do not add events which are past the end of the part.
if(e.tick() >= len)
break;
if(_cnum == MusECore::CTRL_VELOCITY && e.type() == MusECore::Note)
{
newev = 0;
- if (curDrumPitch == -1 || !MusEGlobal::config.velocityPerNote) // and NOT >=0
+ if (curDrumPitch == -1 || !_perNoteVeloMode) // and NOT >=0
items.add(newev = new CEvent(e, part, e.velo()));
else if (e.dataA() == curDrumPitch) //same note. if curDrumPitch==-2, this never is true
items.add(newev = new CEvent(e, part, e.velo()));
@@ -892,6 +906,15 @@ void CtrlCanvas::viewMouseReleaseEvent(QMouseEvent* event)
}
//---------------------------------------------------------
+// wheelEvent
+//---------------------------------------------------------
+
+void CtrlCanvas::wheelEvent(QWheelEvent* ev)
+{
+ emit redirectWheelEvent(ev);
+}
+
+//---------------------------------------------------------
// newValRamp
//---------------------------------------------------------
@@ -2076,4 +2099,13 @@ void CtrlCanvas::curPartHasChanged(MusECore::Part*)
songChanged(SC_EVENT_MODIFIED);
}
+void CtrlCanvas::setPerNoteVeloMode(bool v)
+{
+ if(v == _perNoteVeloMode)
+ return;
+ _perNoteVeloMode = v;
+ if(_cnum == MusECore::CTRL_VELOCITY)
+ updateItems();
+}
+
} // namespace MusEGui