summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--muse2/muse/ctrl/ctrlcanvas.cpp37
1 files changed, 24 insertions, 13 deletions
diff --git a/muse2/muse/ctrl/ctrlcanvas.cpp b/muse2/muse/ctrl/ctrlcanvas.cpp
index 6e09e337..f592d4d3 100644
--- a/muse2/muse/ctrl/ctrlcanvas.cpp
+++ b/muse2/muse/ctrl/ctrlcanvas.cpp
@@ -337,7 +337,7 @@ void CtrlCanvas::setMidiController(int num)
_panel->setHWController(curTrack, &MusECore::veloCtrl);
else
_panel->setHWController(curTrack, _controller);
- }
+ }
}
//---------------------------------------------------------
@@ -546,14 +546,14 @@ void CtrlCanvas::partControllers(const MusECore::MidiPart* part, int num, int* d
if(!mt->isDrumTrack() && curDrumPitch != -1)
printf("keyfilter != -1 in non drum track?\n");
- if((mt->type() == MusECore::Track::DRUM) && (curDrumPitch != -1) && ((num & 0xff) == 0xff))
+ if((mt->type() == MusECore::Track::DRUM) && (curDrumPitch > 0) && ((num & 0xff) == 0xff))
{
di = (num & ~0xff) | curDrumPitch;
n = (num & ~0xff) | MusEGlobal::drumMap[curDrumPitch].anote; // construct real controller number
//num = (num & ~0xff) | curDrumPitch); // construct real controller number
mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[curDrumPitch].port];
}
- else if ((mt->type() == MusECore::Track::NEW_DRUM) && (curDrumPitch != -1) && ((num & 0xff) == 0xff)) //FINDMICHJETZT does this work?
+ else if ((mt->type() == MusECore::Track::NEW_DRUM) && (curDrumPitch > 0) && ((num & 0xff) == 0xff)) //FINDMICHJETZT does this work?
{
di = (num & ~0xff) | curDrumPitch;
n = (num & ~0xff) | curDrumPitch;
@@ -635,13 +635,13 @@ void CtrlCanvas::updateItems()
{
//printf("CtrlCanvas::updateItems MusECore::CTRL_VELOCITY curDrumPitch:%d\n", curDrumPitch);
newev = 0;
- if(curDrumPitch == -1)
+ if (curDrumPitch == -1) // and NOT >0
{
// This is interesting - it would allow ALL drum note velocities to be shown.
// But currently the drum list ALWAYS has a selected item so this is not supposed to happen.
items.add(newev = new CEvent(e, part, e.velo()));
}
- else if (e.dataA() == curDrumPitch) //same note
+ else if (e.dataA() == curDrumPitch) //same note. if curDrumPitch==-2, this never is true
items.add(newev = new CEvent(e, part, e.velo()));
if(newev && e.selected())
selection.push_back(newev);
@@ -692,7 +692,7 @@ void CtrlCanvas::updateSelections()
void CtrlCanvas::viewMousePressEvent(QMouseEvent* event)
{
- if(!_controller) // p4.0.27
+ if(!_controller || curDrumPitch==-2) // p4.0.27
return;
start = event->pos();
@@ -800,7 +800,7 @@ void CtrlCanvas::viewMousePressEvent(QMouseEvent* event)
void CtrlCanvas::viewMouseMoveEvent(QMouseEvent* event)
{
- if(!_controller) // p4.0.27
+ if(!_controller || curDrumPitch==-2) // p4.0.27
return;
QPoint pos = event->pos();
@@ -1706,7 +1706,7 @@ void CtrlCanvas::pdrawItems(QPainter& p, const QRect& rect, const MusECore::Midi
MusECore::MidiTrack* mt = part->track();
MusECore::MidiPort* mp;
- if((mt->type() == MusECore::Track::DRUM) && (curDrumPitch != -1) && ((_cnum & 0xff) == 0xff))
+ if((mt->type() == MusECore::Track::DRUM) && (curDrumPitch > 0) && ((_cnum & 0xff) == 0xff))
mp = &MusEGlobal::midiPorts[MusEGlobal::drumMap[curDrumPitch].port];
else
mp = &MusEGlobal::midiPorts[mt->outPort()];
@@ -1939,11 +1939,15 @@ void CtrlCanvas::drawOverlay(QPainter& p)
int y = fontMetrics().lineSpacing() + 2;
p.drawText(2, y, s);
- if (noEvents) {
+ if (curDrumPitch==-2)
+ {
+ p.drawText(2 , y * 2, tr("Make the current part's track match the selected drumlist entry"));
+ }
+ else if (noEvents) {
//p.setFont(MusEGlobal::config.fonts[3]);
//p.setPen(Qt::black);
//p.drawText(width()/2-100,height()/2-10, "Use shift + pencil or line tool to draw new events");
- p.drawText(2 , y * 2, "Use shift + pencil or line tool to draw new events");
+ p.drawText(2 , y * 2, tr("Use pencil or line tool to draw new events"));
}
}
@@ -1961,9 +1965,16 @@ QRect CtrlCanvas::overlayRect() const
//r.translate(2, 2); // top/left margin
int y = fm.lineSpacing() + 2;
r.translate(2, y);
- if (noEvents)
+ if (curDrumPitch==-2)
+ {
+ QRect r2(fm.boundingRect(QString(tr("Make the current part's track match the selected drumlist entry"))));
+ //r2.translate(width()/2-100, height()/2-10);
+ r2.translate(2, y * 2);
+ r |= r2;
+ }
+ else if (noEvents)
{
- QRect r2(fm.boundingRect(QString("Use shift + pencil or line tool to draw new events")));
+ QRect r2(fm.boundingRect(QString(tr("Use pencil or line tool to draw new events"))));
//r2.translate(width()/2-100, height()/2-10);
r2.translate(2, y * 2);
r |= r2;
@@ -2007,7 +2018,7 @@ void CtrlCanvas::setCurDrumPitch(int instrument)
if (drumedit->get_instrument_map()[instrument].tracks.contains(curTrack))
curDrumPitch = drumedit->get_instrument_map()[instrument].pitch;
else
- curDrumPitch = -1;
+ curDrumPitch = -2; // this means "invalid", but not "unused"
}