diff options
-rw-r--r-- | muse2/muse/midiedit/drumedit.cpp | 36 | ||||
-rw-r--r-- | muse2/muse/midiedit/ecanvas.cpp | 2 | ||||
-rw-r--r-- | muse2/muse/midiedit/ecanvas.h | 6 | ||||
-rw-r--r-- | muse2/muse/midiedit/pianoroll.cpp | 21 | ||||
-rw-r--r-- | muse2/muse/midiedit/prcanvas.cpp | 3 | ||||
-rw-r--r-- | muse2/muse/midiedit/prcanvas.h | 4 |
6 files changed, 62 insertions, 10 deletions
diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp index e64379a2..4d632984 100644 --- a/muse2/muse/midiedit/drumedit.cpp +++ b/muse2/muse/midiedit/drumedit.cpp @@ -289,6 +289,26 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini tools->addSeparator(); tools->addActions(undoRedo->actions()); + tools->addSeparator(); + + srec = new QToolButton(); + srec->setToolTip(tr("Step Record")); + srec->setIcon(*steprecIcon); + srec->setCheckable(true); + srec->setEnabled(false); //disabled by flo93 (see below) + tools->addWidget(srec); + + midiin = new QToolButton(); + midiin->setToolTip(tr("Midi Input")); + midiin->setIcon(*midiinIcon); + midiin->setCheckable(true); + midiin->setEnabled(false); //disabled by flo93 (see below) + tools->addWidget(midiin); + + // I disabled these buttons because they're without function; + // muse should not lie to the user pretending some functionality + // it doesn't have; they should be enabled as soon step-recording + // has been implemented. tools2 = new EditToolBar(this, drumeditTools); @@ -440,6 +460,8 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini connect(vscroll, SIGNAL(scaleChanged(int)), dlist, SLOT(setYMag(int))); connect(hscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setXPos(int))); connect(hscroll, SIGNAL(scaleChanged(int)), canvas, SLOT(setXMag(int))); + connect(srec, SIGNAL(toggled(bool)), canvas, SLOT(setSteprec(bool))); + connect(midiin, SIGNAL(toggled(bool)), canvas, SLOT(setMidiin(bool))); connect(vscroll, SIGNAL(scrollChanged(int)), dlist, SLOT(setYPos(int))); connect(hscroll, SIGNAL(scrollChanged(int)), time, SLOT(setXPos(int))); @@ -660,6 +682,8 @@ void DrumEdit::writeStatus(int level, Xml& xml) const split2->writeStatus(level, xml); header->writeStatus(level, xml); + xml.intTag(level, "steprec", canvas->steprec()); + xml.intTag(level, "midiin", canvas->midiin()); xml.intTag(level, "xpos", hscroll->pos()); xml.intTag(level, "xmag", hscroll->mag()); xml.intTag(level, "ypos", vscroll->pos()); @@ -681,7 +705,17 @@ void DrumEdit::readStatus(Xml& xml) case Xml::End: return; case Xml::TagStart: - if (tag == "ctrledit") { + if (tag == "steprec") { + int val = xml.parseInt(); + canvas->setSteprec(val); + srec->setChecked(val); + } + else if (tag == "midiin") { + int val = xml.parseInt(); + canvas->setMidiin(val); + midiin->setChecked(val); + } + else if (tag == "ctrledit") { CtrlEdit* ctrl = addCtrl(); ctrl->readStatus(xml); } diff --git a/muse2/muse/midiedit/ecanvas.cpp b/muse2/muse/midiedit/ecanvas.cpp index 8f04bdfc..7a421411 100644 --- a/muse2/muse/midiedit/ecanvas.cpp +++ b/muse2/muse/midiedit/ecanvas.cpp @@ -35,6 +35,8 @@ EventCanvas::EventCanvas(MidiEditor* pr, QWidget* parent, int sx, : Canvas(parent, sx, sy, name) { editor = pr; + _steprec = false; + _midiin = false; _playEvents = false; curVelo = 70; diff --git a/muse2/muse/midiedit/ecanvas.h b/muse2/muse/midiedit/ecanvas.h index a278fb19..86e1c200 100644 --- a/muse2/muse/midiedit/ecanvas.h +++ b/muse2/muse/midiedit/ecanvas.h @@ -51,6 +51,8 @@ class EventCanvas : public Canvas { MidiEditor* editor; unsigned start_tick, end_tick; int curVelo; + bool _steprec; + bool _midiin; void updateSelection(); virtual void addItem(Part*, Event&) = 0; @@ -59,6 +61,8 @@ class EventCanvas : public Canvas { public slots: void redrawGrid() { redraw(); } + void setSteprec(bool f) { _steprec = f; } + void setMidiin(bool f) { _midiin = f; } signals: void pitchChanged(int); // current cursor position @@ -71,6 +75,8 @@ class EventCanvas : public Canvas { MidiTrack* track() const; unsigned start() const { return start_tick; } unsigned end() const { return end_tick; } + bool midiin() const { return _midiin; } + bool steprec() const { return _steprec; } QString getCaption() const; void songChanged(int); void range(int* s, int* e) const { *s = start_tick; *e = end_tick; } diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp index 89f5ad6a..ab83e85f 100644 --- a/muse2/muse/midiedit/pianoroll.cpp +++ b/muse2/muse/midiedit/pianoroll.cpp @@ -236,6 +236,12 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i srec->setCheckable(true); tools->addWidget(srec); + midiin = new QToolButton(); + midiin->setToolTip(tr("Midi Input")); + midiin->setIcon(*midiinIcon); + midiin->setCheckable(true); + tools->addWidget(midiin); + speaker = new QToolButton(); speaker->setToolTip(tr("Play Events")); speaker->setIcon(*speakerIcon); @@ -435,6 +441,7 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i connect(piano, SIGNAL(keyPressed(int, int, bool)), canvas, SLOT(pianoPressed(int, int, bool))); connect(piano, SIGNAL(keyReleased(int, bool)), canvas, SLOT(pianoReleased(int, bool))); connect(srec, SIGNAL(toggled(bool)), SLOT(setSteprec(bool))); + connect(midiin, SIGNAL(toggled(bool)), canvas, SLOT(setMidiin(bool))); connect(speaker, SIGNAL(toggled(bool)), SLOT(setSpeaker(bool))); connect(canvas, SIGNAL(followEvent(int)), SLOT(follow(int))); @@ -866,7 +873,8 @@ void PianoRoll::writeStatus(int level, Xml& xml) const (*i)->writeStatus(level, xml); } - xml.intTag(level, "steprec", ((PianoCanvas*)canvas)->steprec()); + xml.intTag(level, "steprec", canvas->steprec()); + xml.intTag(level, "midiin", canvas->midiin()); xml.intTag(level, "tool", int(canvas->tool())); xml.intTag(level, "playEvents", _playEvents); xml.intTag(level, "xpos", hscroll->pos()); @@ -891,9 +899,14 @@ void PianoRoll::readStatus(Xml& xml) case Xml::TagStart: if (tag == "steprec") { int val = xml.parseInt(); - ((PianoCanvas*)canvas)->setSteprec(val); + canvas->setSteprec(val); srec->setChecked(val); } + else if (tag == "midiin") { + int val = xml.parseInt(); + canvas->setMidiin(val); + midiin->setChecked(val); + } else if (tag == "tool") { int tool = xml.parseInt(); canvas->setTool(tool); @@ -1117,7 +1130,9 @@ void PianoRoll::keyPressEvent(QKeyEvent* event) void PianoRoll::setSteprec(bool flag) { - ((PianoCanvas*)canvas)->setSteprec(flag); + canvas->setSteprec(flag); + if (flag == false) + midiin->setChecked(flag); } //--------------------------------------------------------- diff --git a/muse2/muse/midiedit/prcanvas.cpp b/muse2/muse/midiedit/prcanvas.cpp index c9f66737..7794c520 100644 --- a/muse2/muse/midiedit/prcanvas.cpp +++ b/muse2/muse/midiedit/prcanvas.cpp @@ -85,7 +85,6 @@ PianoCanvas::PianoCanvas(MidiEditor* pr, QWidget* parent, int sx, int sy) { colorMode = 0; playedPitch = -1; - _steprec = false; for (int i=0;i<128;i++) noteHeldDown[i]=false; chordTimer = new QTimer(this); @@ -1074,7 +1073,7 @@ void PianoCanvas::midiNote(int pitch, int velo) printf("\n"); } - if (_steprec && curPart + if (_midiin && _steprec && curPart && !audio->isPlaying() && velo && pos[0] >= start_tick && pos[0] < end_tick && !(globalKeyState & Qt::AltModifier)) { diff --git a/muse2/muse/midiedit/prcanvas.h b/muse2/muse/midiedit/prcanvas.h index e90ac613..c6d84e88 100644 --- a/muse2/muse/midiedit/prcanvas.h +++ b/muse2/muse/midiedit/prcanvas.h @@ -44,7 +44,6 @@ class PianoCanvas : public EventCanvas { QTimer* chordTimer; unsigned chordTimer_setToTick; bool noteHeldDown[128]; - bool _steprec; Q_OBJECT virtual void viewMouseDoubleClickEvent(QMouseEvent*); @@ -89,7 +88,6 @@ class PianoCanvas : public EventCanvas { void pianoCmd(int); void pianoPressed(int pitch, int velocity, bool shift); void pianoReleased(int pitch, bool); - void setSteprec(bool f) { _steprec = f; } public: enum { @@ -111,8 +109,6 @@ class PianoCanvas : public EventCanvas { redraw(); } virtual void modifySelected(NoteInfo::ValType type, int delta); - - bool steprec() const { return _steprec; } }; #endif |