summaryrefslogtreecommitdiff
path: root/muse2/muse/arranger/tlist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'muse2/muse/arranger/tlist.cpp')
-rw-r--r--muse2/muse/arranger/tlist.cpp355
1 files changed, 180 insertions, 175 deletions
diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp
index b3be35ea..3bc13934 100644
--- a/muse2/muse/arranger/tlist.cpp
+++ b/muse2/muse/arranger/tlist.cpp
@@ -2497,181 +2497,186 @@ void TList::mouseReleaseEvent(QMouseEvent* ev)
void TList::wheelEvent(QWheelEvent* ev)
{
- int x = ev->x();
- int y = ev->y();
- MusECore::Track* t = y2Track(y + ypos);
- if (t == 0) {
- emit redirectWheelEvent(ev);
- return;
- }
- TrackColumn col = TrackColumn(header->logicalIndexAt(x));
- int delta = ev->delta() / WHEEL_DELTA;
- ev->accept();
-
- switch (col) {
- case COL_RECORD:
- case COL_NONE:
- case COL_CLASS:
- case COL_NAME:
- case COL_AUTOMATION:
- break;
- case COL_MUTE:
- // p3.3.29
- if (((QInputEvent*)ev)->modifiers() & Qt::ShiftModifier)
- t->setOff(!t->off());
- else
- {
- if (t->off())
- t->setOff(false);
- else
- t->setMute(!t->mute());
- }
- MusEGlobal::song->update(SC_MUTE);
- break;
-
- case COL_SOLO:
- MusEGlobal::audio->msgSetSolo(t, !t->solo());
- MusEGlobal::song->update(SC_SOLO);
- break;
-
- case COL_TIMELOCK:
- t->setLocked(!t->locked());
- break;
-
- case COL_OPORT:
- if (t->isMidiTrack()) {
- MusECore::MidiTrack* mt = (MusECore::MidiTrack*)t;
- int port = mt->outPort() + delta;
-
- if (port >= MIDI_PORTS)
- port = MIDI_PORTS-1;
- else if (port < 0)
- port = 0;
- if (port != ((MusECore::MidiTrack*)t)->outPort()) {
- MusEGlobal::audio->msgIdle(true);
- mt->setOutPortAndUpdate(port);
- MusEGlobal::audio->msgIdle(false);
-
- MusEGlobal::audio->msgUpdateSoloStates(); // p4.0.14
- MusEGlobal::song->update(SC_MIDI_TRACK_PROP); // p4.0.17
- }
- }
- break;
-
- case COL_OCHANNEL:
- if (t->isMidiTrack()) {
- MusECore::MidiTrack* mt = (MusECore::MidiTrack*)t;
- if (mt && mt->type() == MusECore::Track::DRUM)
- break;
-
- int channel = mt->outChannel() + delta;
-
- if (channel >= MIDI_CHANNELS)
- channel = MIDI_CHANNELS-1;
- else if (channel < 0)
- channel = 0;
- if (channel != ((MusECore::MidiTrack*)t)->outChannel()) {
- MusEGlobal::audio->msgIdle(true);
- mt->setOutChanAndUpdate(channel);
- MusEGlobal::audio->msgIdle(false);
-
- // may result in adding/removing mixer strip:
- //MusEGlobal::song->update(-1);
- MusEGlobal::audio->msgUpdateSoloStates(); // p4.0.14
- MusEGlobal::song->update(SC_MIDI_TRACK_PROP);
- }
- }
- else {
- int n = t->channels() + delta;
- if (n > MAX_CHANNELS)
- n = MAX_CHANNELS;
- else if (n < 1)
- n = 1;
- if (n != t->channels()) {
- MusEGlobal::audio->msgSetChannels((MusECore::AudioTrack*)t, n);
- MusEGlobal::song->update(SC_CHANNELS);
- }
- }
- break;
- default:
- if (col>=COL_CUSTOM_MIDICTRL_OFFSET)
- {
- mode = START_DRAG;
-
- if (t->isMidiTrack())
- {
- MusECore::MidiTrack* mt = dynamic_cast<MusECore::MidiTrack*>(t);
- if (mt == 0)
- break;
-
- int ctrl_num = Arranger::custom_columns[col-COL_CUSTOM_MIDICTRL_OFFSET].ctrl;
-
- MusECore::MidiPort* mp = &MusEGlobal::midiPorts[mt->outPort()];
- MusECore::MidiController* mctl = mp->midiController(ctrl_num);
-
- int minval=mctl->minVal()+mctl->bias();
- int maxval=mctl->maxVal()+mctl->bias();
-
- int val = mt->getControllerChangeAtTick(0,ctrl_num);
- int oldval=val;
-
- if (ctrl_num!=MusECore::CTRL_PROGRAM)
- {
- val += delta;
- if(val > maxval)
- val = maxval;
- if(val < minval-1) // "-1" because of "off"
- val = minval-1;
- }
- else
- {
- MusECore::MidiInstrument* instr = mp->instrument();
- if (delta>0) val=instr->getNextPatch(mt->outChannel(), val, false);
- else if (delta<0) val=instr->getPrevPatch(mt->outChannel(), val, false);
- }
-
- if (val != oldval)
- {
- if (val!=minval-1)
- {
- int at_tick;
- if (Arranger::custom_columns[col-COL_CUSTOM_MIDICTRL_OFFSET].affected_pos ==
- Arranger::custom_col_t::AFFECT_BEGIN)
- at_tick=0;
- else
- at_tick=MusEGlobal::song->cpos();
-
- record_controller_change_and_maybe_send(at_tick, ctrl_num, val, mt);
- }
- else
- {
- MusECore::Undo operations;
- for (MusECore::iPart p = mt->parts()->begin(); p!=mt->parts()->end(); p++)
- {
- if (p->second->tick()==0)
- {
- for (MusECore::iEvent ev=p->second->events()->begin(); ev!=p->second->events()->end(); ev++)
- {
- if (ev->second.tick()!=0) break;
- else if (ev->second.type()==MusECore::Controller && ev->second.dataA()==ctrl_num)
- {
- using MusECore::UndoOp;
- operations.push_back(UndoOp(UndoOp::DeleteEvent, ev->second, p->second, false, false));
- break;
- }
- }
- }
- }
- MusEGlobal::song->applyOperationGroup(operations);
- }
- }
- }
- }
- else
- mode = START_DRAG;
-
- break;
- }
+ emit redirectWheelEvent(ev);
+
+// REMOVE Tim. Hate to just kill all this, so remove later if all tests OK.
+// int x = ev->x();
+// int y = ev->y();
+// MusECore::Track* t = y2Track(y + ypos);
+// if (t == 0) {
+// emit redirectWheelEvent(ev);
+// return;
+// }
+//
+// TrackColumn col = TrackColumn(header->logicalIndexAt(x));
+// int delta = ev->delta() / WHEEL_DELTA;
+// ev->accept();
+//
+// switch (col) {
+// case COL_RECORD:
+// case COL_NONE:
+// case COL_CLASS:
+// case COL_NAME:
+// case COL_AUTOMATION:
+// break;
+// case COL_MUTE:
+// // p3.3.29
+// if (((QInputEvent*)ev)->modifiers() & Qt::ShiftModifier)
+// t->setOff(!t->off());
+// else
+// {
+// if (t->off())
+// t->setOff(false);
+// else
+// t->setMute(!t->mute());
+// }
+// MusEGlobal::song->update(SC_MUTE);
+// break;
+//
+// case COL_SOLO:
+// MusEGlobal::audio->msgSetSolo(t, !t->solo());
+// MusEGlobal::song->update(SC_SOLO);
+// break;
+//
+// case COL_TIMELOCK:
+// t->setLocked(!t->locked());
+// break;
+//
+// case COL_OPORT:
+// if (t->isMidiTrack()) {
+// MusECore::MidiTrack* mt = (MusECore::MidiTrack*)t;
+// int port = mt->outPort() + delta;
+//
+// if (port >= MIDI_PORTS)
+// port = MIDI_PORTS-1;
+// else if (port < 0)
+// port = 0;
+// if (port != ((MusECore::MidiTrack*)t)->outPort()) {
+// MusEGlobal::audio->msgIdle(true);
+// mt->setOutPortAndUpdate(port);
+// MusEGlobal::audio->msgIdle(false);
+//
+// MusEGlobal::audio->msgUpdateSoloStates(); // p4.0.14
+// MusEGlobal::song->update(SC_MIDI_TRACK_PROP); // p4.0.17
+// }
+// }
+// break;
+//
+// case COL_OCHANNEL:
+// if (t->isMidiTrack()) {
+// MusECore::MidiTrack* mt = (MusECore::MidiTrack*)t;
+// if (mt && mt->type() == MusECore::Track::DRUM)
+// break;
+//
+// int channel = mt->outChannel() + delta;
+//
+// if (channel >= MIDI_CHANNELS)
+// channel = MIDI_CHANNELS-1;
+// else if (channel < 0)
+// channel = 0;
+// if (channel != ((MusECore::MidiTrack*)t)->outChannel()) {
+// MusEGlobal::audio->msgIdle(true);
+// mt->setOutChanAndUpdate(channel);
+// MusEGlobal::audio->msgIdle(false);
+//
+// // may result in adding/removing mixer strip:
+// //MusEGlobal::song->update(-1);
+// MusEGlobal::audio->msgUpdateSoloStates(); // p4.0.14
+// MusEGlobal::song->update(SC_MIDI_TRACK_PROP);
+// }
+// }
+// else {
+// int n = t->channels() + delta;
+// if (n > MAX_CHANNELS)
+// n = MAX_CHANNELS;
+// else if (n < 1)
+// n = 1;
+// if (n != t->channels()) {
+// MusEGlobal::audio->msgSetChannels((MusECore::AudioTrack*)t, n);
+// MusEGlobal::song->update(SC_CHANNELS);
+// }
+// }
+// break;
+// default:
+// if (col>=COL_CUSTOM_MIDICTRL_OFFSET)
+// {
+// mode = START_DRAG;
+//
+// if (t->isMidiTrack())
+// {
+// MusECore::MidiTrack* mt = dynamic_cast<MusECore::MidiTrack*>(t);
+// if (mt == 0)
+// break;
+//
+// int ctrl_num = Arranger::custom_columns[col-COL_CUSTOM_MIDICTRL_OFFSET].ctrl;
+//
+// MusECore::MidiPort* mp = &MusEGlobal::midiPorts[mt->outPort()];
+// MusECore::MidiController* mctl = mp->midiController(ctrl_num);
+//
+// int minval=mctl->minVal()+mctl->bias();
+// int maxval=mctl->maxVal()+mctl->bias();
+//
+// int val = mt->getControllerChangeAtTick(0,ctrl_num);
+// int oldval=val;
+//
+// if (ctrl_num!=MusECore::CTRL_PROGRAM)
+// {
+// val += delta;
+// if(val > maxval)
+// val = maxval;
+// if(val < minval-1) // "-1" because of "off"
+// val = minval-1;
+// }
+// else
+// {
+// MusECore::MidiInstrument* instr = mp->instrument();
+// if (delta>0) val=instr->getNextPatch(mt->outChannel(), val, false);
+// else if (delta<0) val=instr->getPrevPatch(mt->outChannel(), val, false);
+// }
+//
+// if (val != oldval)
+// {
+// if (val!=minval-1)
+// {
+// int at_tick;
+// if (Arranger::custom_columns[col-COL_CUSTOM_MIDICTRL_OFFSET].affected_pos ==
+// Arranger::custom_col_t::AFFECT_BEGIN)
+// at_tick=0;
+// else
+// at_tick=MusEGlobal::song->cpos();
+//
+// record_controller_change_and_maybe_send(at_tick, ctrl_num, val, mt);
+// }
+// else
+// {
+// MusECore::Undo operations;
+// for (MusECore::iPart p = mt->parts()->begin(); p!=mt->parts()->end(); p++)
+// {
+// if (p->second->tick()==0)
+// {
+// for (MusECore::iEvent ev=p->second->events()->begin(); ev!=p->second->events()->end(); ev++)
+// {
+// if (ev->second.tick()!=0) break;
+// else if (ev->second.type()==MusECore::Controller && ev->second.dataA()==ctrl_num)
+// {
+// using MusECore::UndoOp;
+// operations.push_back(UndoOp(UndoOp::DeleteEvent, ev->second, p->second, false, false));
+// break;
+// }
+// }
+// }
+// }
+// MusEGlobal::song->applyOperationGroup(operations);
+// }
+// }
+// }
+// }
+// else
+// mode = START_DRAG;
+//
+// break;
+// }
+
}