From e58e08ef52d764ad3e454763f6660da57ae4978f Mon Sep 17 00:00:00 2001 From: "Tim E. Real" Date: Sun, 26 Dec 2010 07:49:22 +0000 Subject: Initial addition of midi track info to pianoroll. WORK IN PROGRESS. --- muse2/ChangeLog | 4 + muse2/muse/arranger/alayout.h | 20 +- muse2/muse/arranger/arranger.cpp | 20 +- muse2/muse/arranger/arranger.h | 3 +- muse2/muse/arranger/tlist.cpp | 14 +- muse2/muse/arranger/tlist.h | 3 +- muse2/muse/importmidi.cpp | 2 +- muse2/muse/midiedit/pianoroll.cpp | 114 ++++++++-- muse2/muse/midiedit/pianoroll.h | 9 + muse2/muse/midiedit/prcanvas.cpp | 11 + muse2/muse/midiedit/prcanvas.h | 2 + muse2/muse/song.cpp | 1 + muse2/muse/song.h | 1 + muse2/muse/widgets/lcombo.cpp | 6 +- muse2/muse/widgets/mtrackinfo.cpp | 121 +++++----- muse2/muse/widgets/mtrackinfo.h | 7 +- muse2/muse/widgets/mtrackinfobase.ui | 422 +++++++++++++++++------------------ 17 files changed, 435 insertions(+), 325 deletions(-) diff --git a/muse2/ChangeLog b/muse2/ChangeLog index 8c42e9e7..0847ab73 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,3 +1,7 @@ +26.12.2010: + - Initial addition of midi track info to pianoroll. WORK IN PROGRESS. (Tim) + TODO: Just to get off the hard drive. A few things still need to be linked up! + And we really need icons to replace those 'T' 'C' 'S' 'X' buttons. 25.12.2010: - Added fancy background selection widget with live preview to Appearance Settings. (Orcan) - Applied Geoff King's second capitalization patch. diff --git a/muse2/muse/arranger/alayout.h b/muse2/muse/arranger/alayout.h index b85b5e9a..616c94c1 100644 --- a/muse2/muse/arranger/alayout.h +++ b/muse2/muse/arranger/alayout.h @@ -36,20 +36,20 @@ class TLLayout : public QLayout ~TLLayout() { clear(); } void addItem(QLayoutItem *item) { ilist.append(item); } - Qt::Orientations expandingDirections() const { return 0; } - bool hasHeightForWidth() const { return false; } - int count() const { return ilist.size(); } + virtual Qt::Orientations expandingDirections() const { return 0; } + virtual bool hasHeightForWidth() const { return false; } + virtual int count() const { return ilist.size(); } void clear(); void wadd(int idx, QWidget* w); - ///virtual QSize sizeHint() const; - ///virtual QSize minimumSize() const; - ///virtual QSize maximumSize() const; - QSize sizeHint() const; - QSize minimumSize() const; - QSize maximumSize() const; + virtual QSize sizeHint() const; + virtual QSize minimumSize() const; + virtual QSize maximumSize() const; + //QSize sizeHint() const; + //QSize minimumSize() const; + //QSize maximumSize() const; ///QLayoutIterator iterator(); - void setGeometry(const QRect &rect); + virtual void setGeometry(const QRect &rect); //virtual QLayoutItem* itemAt(int) const { return 0;} // ddskrjo, is pure virtual, overridden virtual QLayoutItem* itemAt(int i) const { return ilist.value(i);} diff --git a/muse2/muse/arranger/arranger.cpp b/muse2/muse/arranger/arranger.cpp index d2bd4412..62578d48 100644 --- a/muse2/muse/arranger/arranger.cpp +++ b/muse2/muse/arranger/arranger.cpp @@ -297,7 +297,9 @@ Arranger::Arranger(QMainWindow* parent, const char* name) // Do this now that the list is available. genTrackInfo(tracklist); - connect(list, SIGNAL(selectionChanged()), SLOT(trackSelectionChanged())); + ///connect(list, SIGNAL(selectionChanged()), SLOT(trackSelectionChanged())); + connect(list, SIGNAL(selectionChanged(Track*)), SLOT(trackSelectionChanged())); + connect(list, SIGNAL(selectionChanged(Track*)), midiTrackInfo, SLOT(setTrack(Track*))); connect(header, SIGNAL(sectionResized(int,int,int)), list, SLOT(redraw())); connect(header, SIGNAL(sectionMoved(int,int,int)), list, SLOT(redraw())); connect(header, SIGNAL(sectionMoved(int,int,int)), this, SLOT(headerMoved())); @@ -398,6 +400,7 @@ Arranger::Arranger(QMainWindow* parent, const char* name) connect(canvas, SIGNAL(startEditor(PartList*,int)), SIGNAL(startEditor(PartList*, int))); connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + //connect(song, SIGNAL(mTypeChanged(MType)), SLOT(setMode((int)MType))); // p4.0.7 Tim. connect(canvas, SIGNAL(followEvent(int)), hscroll, SLOT(setOffset(int))); connect(canvas, SIGNAL(selectionChanged()), SIGNAL(selectionChanged())); connect(canvas, SIGNAL(dropSongFile(const QString&)), SIGNAL(dropSongFile(const QString&))); @@ -482,7 +485,6 @@ void Arranger::dclickPart(Track* t) void Arranger::configChanged() { - // Added by Tim. p3.3.6 //printf("Arranger::configChanged\n"); if (config.canvasBgPixmap.isEmpty()) { @@ -495,7 +497,7 @@ void Arranger::configChanged() //printf("Arranger::configChanged - bitmap %s!\n", config.canvasBgPixmap.ascii()); canvas->setBg(QPixmap(config.canvasBgPixmap)); } - midiTrackInfo->setFont(config.fonts[2]); + ///midiTrackInfo->setFont(config.fonts[2]); //updateTrackInfo(type); } @@ -532,6 +534,9 @@ void Arranger::songChanged(int type) lenEntry->setValue(bar); lenEntry->blockSignals(false); + if(type & SC_SONG_TYPE) // p4.0.7 Tim. + setMode(song->mtype()); + trackSelectionChanged(); canvas->partsChanged(); typeBox->setCurrentIndex(int(song->mtype())); @@ -600,7 +605,10 @@ void Arranger::modeChange(int mode) void Arranger::setMode(int mode) { + typeBox->blockSignals(true); // + // This will only set if different. typeBox->setCurrentIndex(mode); + typeBox->blockSignals(false); // } //--------------------------------------------------------- @@ -873,7 +881,10 @@ QWidget* WidgetStack::visibleWidget() const QSize WidgetStack::minimumSizeHint() const { if (top == -1) + { + //printf("WidgetStack::minimumSizeHint top is -1\n"); return (QSize(0, 0)); + } QSize s(0,0); for (unsigned int i = 0; i < stack.size(); ++i) { if (stack[i]) { @@ -883,6 +894,7 @@ QSize WidgetStack::minimumSizeHint() const s = s.expandedTo(ss); } } + //printf("WidgetStack::minimumSizeHint width:%d height:%d\n", s.width(), s.height()); return s; } @@ -972,7 +984,7 @@ void Arranger::updateTrackInfo(int flags) if (selected->isMidiTrack()) { switchInfo(1); ///updateMidiTrackInfo(flags); - midiTrackInfo->setTrack(selected); + //midiTrackInfo->setTrack(selected); midiTrackInfo->updateTrackInfo(flags); } else { diff --git a/muse2/muse/arranger/arranger.h b/muse2/muse/arranger/arranger.h index c8d33a39..af3cc4b0 100644 --- a/muse2/muse/arranger/arranger.h +++ b/muse2/muse/arranger/arranger.h @@ -53,7 +53,8 @@ class WidgetStack : public QWidget { QWidget* getWidget(unsigned int idx); QWidget* visibleWidget() const; int curIdx() const { return top; } - QSize minimumSizeHint() const; + virtual QSize minimumSizeHint() const; + //QSize minimumSize() const { return minimumSizeHint(); } }; //--------------------------------------------------------- diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp index 1eda506e..44e9f2b5 100644 --- a/muse2/muse/arranger/tlist.cpp +++ b/muse2/muse/arranger/tlist.cpp @@ -711,9 +711,11 @@ void TList::moveSelection(int n) ++nselect; if (nselect != 1) return; + Track* selTrack = 0; for (iTrack t = tracks->begin(); t != tracks->end(); ++t) { iTrack s = t; if ((*t)->selected()) { + selTrack = *t; if (n > 0) { while (n--) { ++t; @@ -746,7 +748,8 @@ void TList::moveSelection(int n) break; } } - emit selectionChanged(); + ///emit selectionChanged(); + emit selectionChanged(selTrack); } TrackList TList::getRecEnabledTracks() @@ -861,7 +864,8 @@ void TList::mousePressEvent(QMouseEvent* ev) song->deselectTracks(); t->setSelected(true); - emit selectionChanged(); + ///emit selectionChanged(); + emit selectionChanged(t); adjustScrollbar(); } } @@ -986,7 +990,8 @@ void TList::mousePressEvent(QMouseEvent* ev) t->setSelected(!t->selected()); if (editTrack && editTrack != t) returnPressed(); - emit selectionChanged(); + ///emit selectionChanged(); + emit selectionChanged(t->selected() ? t : 0); } else if (button == Qt::RightButton) { mode = NORMAL; @@ -1110,7 +1115,8 @@ void TList::selectTrack(Track* tr) // By T356. Force a redraw for wave tracks, since it does not seem to happen. //if(!tr->isMidiTrack()) redraw(); - emit selectionChanged(); + ///emit selectionChanged(); + emit selectionChanged(tr); } //--------------------------------------------------------- diff --git a/muse2/muse/arranger/tlist.h b/muse2/muse/arranger/tlist.h index 3b579061..3431a7a1 100644 --- a/muse2/muse/arranger/tlist.h +++ b/muse2/muse/arranger/tlist.h @@ -89,7 +89,8 @@ class TList : public QWidget { void songChanged(int flags); signals: - void selectionChanged(); + ///void selectionChanged(); + void selectionChanged(Track*); void keyPressExt(QKeyEvent*); void redirectWheelEvent(QWheelEvent*); diff --git a/muse2/muse/importmidi.cpp b/muse2/muse/importmidi.cpp index 793c34a8..6917a0fd 100644 --- a/muse2/muse/importmidi.cpp +++ b/muse2/muse/importmidi.cpp @@ -255,7 +255,7 @@ bool MusE::importMidi(const QString name, bool merge) song->updatePos(); arranger->reset(); - arranger->setMode(int(song->mtype())); + ///arranger->setMode(int(song->mtype())); // p4.0.7 Tim } else { song->initLen(); diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp index 77f8bdab..eebefa5f 100644 --- a/muse2/muse/midiedit/pianoroll.cpp +++ b/muse2/muse/midiedit/pianoroll.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include @@ -31,6 +32,7 @@ #include "mtscale.h" #include "prcanvas.h" #include "pianoroll.h" +#include "mtrackinfo.h" #include "scrollscale.h" #include "piano.h" #include "../ctrl/ctrledit.h" @@ -323,23 +325,39 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i //--------------------------------------------------- splitter = new Splitter(Qt::Vertical, mainw, "splitter"); - QPushButton* ctrl = new QPushButton(tr("ctrl"), mainw); + ///QPushButton* ctrl = new QPushButton(tr("ctrl"), mainw); + QPushButton* ctrl = new QPushButton(tr("C"), mainw); ctrl->setObjectName("Ctrl"); ctrl->setFont(config.fonts[3]); ctrl->setToolTip(tr("Add Controller View")); hscroll = new ScrollScale(-25, -2, xscale, 20000, Qt::Horizontal, mainw); - ctrl->setFixedSize(pianoWidth, hscroll->sizeHint().height()); - + ///ctrl->setFixedSize(pianoWidth, hscroll->sizeHint().height()); + ctrl->setFixedSize(pianoWidth / 2, hscroll->sizeHint().height()); + + QPushButton* trackInfoButton = new QPushButton(tr("T"), mainw); + trackInfoButton->setObjectName("TrackInfo"); + trackInfoButton->setFont(config.fonts[3]); + trackInfoButton->setToolTip(tr("Show track info")); + trackInfoButton->setFixedSize(pianoWidth / 2, hscroll->sizeHint().height()); + QSizeGrip* corner = new QSizeGrip(mainw); mainGrid->setRowStretch(0, 100); - mainGrid->setColumnStretch(1, 100); - mainGrid->addWidget(splitter, 0, 0, 1, 3); - mainGrid->addWidget(ctrl, 1, 0); - mainGrid->addWidget(hscroll, 1, 1); - mainGrid->addWidget(corner, 1, 2, Qt::AlignBottom|Qt::AlignRight); + ///mainGrid->setColumnStretch(1, 100); + ///mainGrid->addWidget(splitter, 0, 0, 1, 3); + ///mainGrid->addWidget(ctrl, 1, 0); + ///mainGrid->addWidget(hscroll, 1, 1); + ///mainGrid->addWidget(corner, 1, 2, Qt::AlignBottom|Qt::AlignRight); + + mainGrid->setColumnStretch(2, 100); + mainGrid->addWidget(splitter, 0, 0, 1, 4); + mainGrid->addWidget(trackInfoButton, 1, 0); + mainGrid->addWidget(ctrl, 1, 1); + mainGrid->addWidget(hscroll, 1, 2); + mainGrid->addWidget(corner, 1, 3, Qt::AlignBottom|Qt::AlignRight); //mainGrid->addRowSpacing(1, hscroll->sizeHint().height()); + ///mainGrid->addItem(new QSpacerItem(0, hscroll->sizeHint().height()), 1, 0); mainGrid->addItem(new QSpacerItem(0, hscroll->sizeHint().height()), 1, 0); QWidget* split1 = new QWidget(splitter); @@ -351,7 +369,20 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i Piano* piano = new Piano(split1, yscale); canvas = new PianoCanvas(this, split1, xscale, yscale); vscroll = new ScrollScale(-3, 7, yscale, KH * 75, Qt::Vertical, split1); - + trackInfo = new MidiTrackInfo(this, canvas->part() ? canvas->part()->track() : 0); + //trackInfo->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); + trackInfo->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Expanding)); + infoScroll = new QScrollArea; + infoScroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + //infoScroll->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); /// No choice right now. Got 'Issues' with AsNeeded. + infoScroll->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); + infoScroll->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding)); + //infoScroll->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); + infoScroll->setWidget(trackInfo); + infoScroll->setWidgetResizable(true); + infoScroll->setVisible(false); + infoScroll->setEnabled(false); + int offset = -(config.division/4); canvas->setOrigin(offset, 0); canvas->setCanvasTools(pianorollTools); @@ -360,25 +391,31 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i time->setOrigin(offset, 0); gridS1->setRowStretch(2, 100); - gridS1->setColumnStretch(1, 100); + ///gridS1->setColumnStretch(1, 100); + gridS1->setColumnStretch(2, 100); +/* gridS1->addWidget(time, 0, 1, 1, 2); gridS1->addWidget(hLine(split1), 1, 0, 1, 3); gridS1->addWidget(piano, 2, 0); gridS1->addWidget(canvas, 2, 1); - gridS1->addWidget(vscroll, 2, 2); -// gridS1->addWidget(time, 0, 1); -// gridS1->addWidget(hLine(split1), 1, 1); -// gridS1->addWidget(piano, 2, 0); -// gridS1->addWidget(canvas, 2, 1); -// gridS1->addMultiCellWidget(vscroll, 1, 2, 2, 2); +*/ + + gridS1->addWidget(time, 0, 2, 1, 3); + gridS1->addWidget(hLine(split1), 1, 1, 1, 4); + //gridS1->addWidget(infoScroll, 2, 0); + gridS1->addWidget(infoScroll, 0, 0, 3, 1); + gridS1->addWidget(piano, 2, 1); + gridS1->addWidget(canvas, 2, 2); + gridS1->addWidget(vscroll, 2, 3); piano->setFixedWidth(pianoWidth); connect(tools2, SIGNAL(toolChanged(int)), canvas, SLOT(setTool(int))); connect(ctrl, SIGNAL(clicked()), SLOT(addCtrl())); + connect(trackInfoButton, SIGNAL(clicked()), SLOT(toggleTrackInfo())); connect(info, SIGNAL(valueChanged(NoteInfo::ValType, int)), SLOT(noteinfoChanged(NoteInfo::ValType, int))); connect(vscroll, SIGNAL(scrollChanged(int)), piano, SLOT(setYPos(int))); connect(vscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setYPos(int))); @@ -391,6 +428,7 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i connect(hscroll, SIGNAL(scaleChanged(int)), canvas, SLOT(setXMag(int))); connect(hscroll, SIGNAL(scaleChanged(int)), time, SLOT(setXMag(int))); + connect(canvas, SIGNAL(newWidth(int)), SLOT(newCanvasWidth(int))); connect(canvas, SIGNAL(pitchChanged(int)), piano, SLOT(setPitch(int))); connect(canvas, SIGNAL(verticalScroll(unsigned)), vscroll, SLOT(setPos(unsigned))); connect(canvas, SIGNAL(horizontalScroll(unsigned)),hscroll, SLOT(setPos(unsigned))); @@ -468,6 +506,7 @@ void PianoRoll::songChanged1(int bits) return; } songChanged(bits); + //trackInfo->songChanged(bits); } //--------------------------------------------------------- @@ -477,6 +516,7 @@ void PianoRoll::songChanged1(int bits) void PianoRoll::configChanged() { initShortcuts(); + //trackInfo->updateTrackInfo(); } //--------------------------------------------------------- @@ -1169,6 +1209,18 @@ void PianoRoll::resizeEvent(QResizeEvent* ev) } +/* +//--------------------------------------------------------- +// trackInfoScroll +//--------------------------------------------------------- + +void PianoRoll::trackInfoScroll(int y) + { + if (trackInfo->visibleWidget()) + trackInfo->visibleWidget()->move(0, -y); + } +*/ + //--------------------------------------------------------- // initShortcuts //--------------------------------------------------------- @@ -1236,3 +1288,33 @@ void PianoRoll::execUserScript(int id) song->executeScript(scriptfile.toAscii().data(), parts(), quant(), true); } +//--------------------------------------------------------- +// newCanvasWidth +//--------------------------------------------------------- + +void PianoRoll::newCanvasWidth(int w) + { + int nw = w + (vscroll->width() - 18); // 18 is the fixed width of the CtlEdit VScale widget. + if(nw < 1) + nw = 1; + + for (std::list::iterator i = ctrlEditList.begin(); + i != ctrlEditList.end(); ++i) { + // Changed by Tim. p3.3.7 + //(*i)->setCanvasWidth(w); + (*i)->setCanvasWidth(nw); + } + + updateHScrollRange(); + } + +//--------------------------------------------------------- +// toggleTrackInfo +//--------------------------------------------------------- + +void PianoRoll::toggleTrackInfo() +{ + bool vis = trackInfo->isVisible(); + infoScroll->setVisible(!vis); + infoScroll->setEnabled(!vis); +} diff --git a/muse2/muse/midiedit/pianoroll.h b/muse2/muse/midiedit/pianoroll.h index 8f225dc1..b81fefdb 100644 --- a/muse2/muse/midiedit/pianoroll.h +++ b/muse2/muse/midiedit/pianoroll.h @@ -42,6 +42,9 @@ class SNode; class QMenu; class QAction; class QWidget; +class QScrollBar; +class MidiTrackInfo; +class QScrollArea; //--------------------------------------------------------- // PianoRoll @@ -133,6 +136,9 @@ class PianoRoll : public MidiEditor { QuantConfig* quantConfig; bool _playEvents; + //QScrollBar* infoScroll; + QScrollArea* infoScroll; + MidiTrackInfo* trackInfo; Q_OBJECT void initShortcuts(); @@ -148,6 +154,7 @@ class PianoRoll : public MidiEditor { CtrlEdit* addCtrl(); void removeCtrl(CtrlEdit* ctrl); void soloChanged(bool flag); + //void trackInfoScroll(int); void setRaster(int); void setQuant(int); void configQuant(); @@ -165,6 +172,8 @@ class PianoRoll : public MidiEditor { void follow(int pos); void songChanged1(int); void configChanged(); + void newCanvasWidth(int); + void toggleTrackInfo(); signals: void deleted(unsigned long); diff --git a/muse2/muse/midiedit/prcanvas.cpp b/muse2/muse/midiedit/prcanvas.cpp index 279ed6bb..9489c4ab 100644 --- a/muse2/muse/midiedit/prcanvas.cpp +++ b/muse2/muse/midiedit/prcanvas.cpp @@ -1730,3 +1730,14 @@ void PianoCanvas::modifySelected(NoteInfo::ValType type, int delta) audio->msgIdle(false); } +//--------------------------------------------------------- +// resizeEvent +//--------------------------------------------------------- + +void PianoCanvas::resizeEvent(QResizeEvent* ev) + { + if (ev->size().width() != ev->oldSize().width()) + emit newWidth(ev->size().width()); + EventCanvas::resizeEvent(ev); + } + diff --git a/muse2/muse/midiedit/prcanvas.h b/muse2/muse/midiedit/prcanvas.h index 3a16ef10..81acf426 100644 --- a/muse2/muse/midiedit/prcanvas.h +++ b/muse2/muse/midiedit/prcanvas.h @@ -69,6 +69,7 @@ class PianoCanvas : public EventCanvas { virtual void itemReleased(const CItem*, const QPoint&); virtual void itemMoved(const CItem*, const QPoint&); virtual void curPartChanged(); + virtual void resizeEvent(QResizeEvent*); private slots: void midiNote(int pitch, int velo); @@ -76,6 +77,7 @@ class PianoCanvas : public EventCanvas { signals: void quantChanged(int); void rasterChanged(int); + void newWidth(int); public slots: void pianoCmd(int); diff --git a/muse2/muse/song.cpp b/muse2/muse/song.cpp index 2212228e..999cfefd 100644 --- a/muse2/muse/song.cpp +++ b/muse2/muse/song.cpp @@ -1612,6 +1612,7 @@ void Song::setMType(MType t) { // printf("set MType %d\n", t); _mtype = t; + song->update(SC_SONG_TYPE); // p4.0.7 Tim. } //--------------------------------------------------------- diff --git a/muse2/muse/song.h b/muse2/muse/song.h index 593d0767..da987e90 100644 --- a/muse2/muse/song.h +++ b/muse2/muse/song.h @@ -74,6 +74,7 @@ class AudioDevice; #define SC_CLIP_MODIFIED 0x4000000 #define SC_MIDI_CONTROLLER_ADD 0x8000000 // a hardware midi controller was added or deleted #define SC_MIDI_CHANNEL 0x10000000 // a midi track's channel changed +#define SC_SONG_TYPE 0x20000000 // the midi song type (mtype) changed #define REC_NOTE_FIFO_SIZE 16 diff --git a/muse2/muse/widgets/lcombo.cpp b/muse2/muse/widgets/lcombo.cpp index 15cf6266..e4bdf00c 100644 --- a/muse2/muse/widgets/lcombo.cpp +++ b/muse2/muse/widgets/lcombo.cpp @@ -44,6 +44,8 @@ void LabelCombo::setCurrentIndex(int i) int c = i / rc; if(c >= box->model()->columnCount()) return; - box->setModelColumn(c); - box->setCurrentIndex(r); + if(box->modelColumn() != c) + box->setModelColumn(c); + if(box->currentIndex() != r) + box->setCurrentIndex(r); } diff --git a/muse2/muse/widgets/mtrackinfo.cpp b/muse2/muse/widgets/mtrackinfo.cpp index 58e2024a..66222519 100644 --- a/muse2/muse/widgets/mtrackinfo.cpp +++ b/muse2/muse/widgets/mtrackinfo.cpp @@ -33,8 +33,16 @@ void MidiTrackInfo::setTrack(Track* t) { + if(!t) + { + selected = 0; + return; + } + + if(!t->isMidiTrack()) + return; selected = t; - //updateTrackInfo(-1); + updateTrackInfo(-1); } //--------------------------------------------------------- @@ -54,6 +62,8 @@ MidiTrackInfo::MidiTrackInfo(QWidget* parent, Track* sel_track) : QWidget(parent pan = -65; volume = -1; + setFont(config.fonts[2]); + //iChanDetectLabel->setPixmap(*darkgreendotIcon); iChanDetectLabel->setPixmap(*darkRedLedIcon); @@ -87,10 +97,11 @@ MidiTrackInfo::MidiTrackInfo(QWidget* parent, Track* sel_track) : QWidget(parent trackNameLabel->setFrameStyle(QFrame::Sunken | QFrame::StyledPanel); trackNameLabel->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum)); - // Added by Tim. p3.3.9 setLabelText(); setLabelFont(); + //setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding)); + connect(iPatch, SIGNAL(released()), SLOT(instrPopup())); ///pop = new QMenu(iPatch); @@ -126,9 +137,12 @@ MidiTrackInfo::MidiTrackInfo(QWidget* parent, Track* sel_track) : QWidget(parent connect(iRButton, SIGNAL(pressed()), SLOT(inRoutesPressed())); // TODO: Works OK, but disabled for now, until we figure out what to do about multiple out routes and display values... - oRButton->setEnabled(false); - oRButton->setVisible(false); - connect(oRButton, SIGNAL(pressed()), SLOT(outRoutesPressed())); + //oRButton->setEnabled(false); + //oRButton->setVisible(false); + //connect(oRButton, SIGNAL(pressed()), SLOT(outRoutesPressed())); + + connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + connect(muse, SIGNAL(configChanged()), SLOT(configChanged())); connect(heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat())); } @@ -425,63 +439,40 @@ void MidiTrackInfo::heartBeat() } //--------------------------------------------------------- -// songChanged +// configChanged //--------------------------------------------------------- -void MidiTrackInfo::songChanged(int type) - { - // Is it simply a midi controller value adjustment? Forget it. - if(type != SC_MIDI_CONTROLLER) +void MidiTrackInfo::configChanged() { -/* - unsigned endTick = song->len(); - int offset = AL::sigmap.ticksMeasure(endTick); - hscroll->setRange(-offset, endTick + offset); //DEBUG - canvas->setOrigin(-offset, 0); - time->setOrigin(-offset, 0); - - int bar, beat; - unsigned tick; - AL::sigmap.tickValues(endTick, &bar, &beat, &tick); - if (tick || beat) - ++bar; - lenEntry->blockSignals(true); - lenEntry->setValue(bar); - lenEntry->blockSignals(false); - - trackSelectionChanged(); - canvas->partsChanged(); - typeBox->setCurrentIndex(int(song->mtype())); - if (type & SC_SIG) - time->redraw(); - if (type & SC_TEMPO) - setGlobalTempo(tempomap.globalTempo()); - - if(type & SC_TRACK_REMOVED) - { - AudioStrip* w = (AudioStrip*)(trackInfo->getWidget(2)); - if(w) - { - Track* t = w->getTrack(); - if(t) - { - TrackList* tl = song->tracks(); - iTrack it = tl->find(t); - if(it == tl->end()) - { - delete w; - trackInfo->addWidget(0, 2); - selected = 0; - } - } - } - } -*/ + //printf("MidiTrackInfo::configChanged\n"); + //if (config.canvasBgPixmap.isEmpty()) { + // canvas->setBg(config.partCanvasBg); + // canvas->setBg(QPixmap()); + //} + //else { + // canvas->setBg(QPixmap(config.canvasBgPixmap)); + //} + + setFont(config.fonts[2]); + //updateTrackInfo(type); } - - updateTrackInfo(type); - } + +//--------------------------------------------------------- +// songChanged +//--------------------------------------------------------- + +void MidiTrackInfo::songChanged(int type) +{ + // Is it simply a midi controller value adjustment? Forget it. + if(type == SC_MIDI_CONTROLLER) + return; + if(type == SC_SELECTION) + return; + if(!isVisible()) + return; + updateTrackInfo(type); +} //--------------------------------------------------------- // setLabelText @@ -502,9 +493,9 @@ void MidiTrackInfo::setLabelText() void MidiTrackInfo::setLabelFont() { - if(!selected) - return; - MidiTrack* track = (MidiTrack*)selected; + //if(!selected) + // return; + //MidiTrack* track = (MidiTrack*)selected; // Use the new font #6 I created just for these labels (so far). // Set the label's font. @@ -645,7 +636,7 @@ void MidiTrackInfo::outRoutesPressed() connect(pup, SIGNAL(triggered(QAction*)), SLOT(routingPopupMenuActivated(QAction*))); connect(pup, SIGNAL(aboutToHide()), muse, SLOT(routingPopupMenuAboutToHide())); pup->popup(QCursor::pos()); - oRButton->setDown(false); + ///oRButton->setDown(false); return; } @@ -1235,14 +1226,14 @@ void MidiTrackInfo::iPanDoubleClicked() void MidiTrackInfo::updateTrackInfo(int flags) { - if(!selected) - return; - MidiTrack* track = (MidiTrack*)selected; - // Is it simply a midi controller value adjustment? Forget it. if(flags == SC_MIDI_CONTROLLER) return; + if(!selected) + return; + MidiTrack* track = (MidiTrack*)selected; + // p3.3.47 Update the routing popup menu if anything relevant changes. //if(gRoutingPopupMenuMaster == midiTrackInfo && selected && (flags & (SC_ROUTE | SC_CHANNELS | SC_CONFIG))) if(flags & (SC_ROUTE | SC_CHANNELS | SC_CONFIG)) // p3.3.50 diff --git a/muse2/muse/widgets/mtrackinfo.h b/muse2/muse/widgets/mtrackinfo.h index c643cc08..8db91797 100644 --- a/muse2/muse/widgets/mtrackinfo.h +++ b/muse2/muse/widgets/mtrackinfo.h @@ -38,7 +38,6 @@ class MidiTrackInfo : public QWidget, public Ui::MidiTrackInfoBase void iKomprChanged(int); void iPanChanged(int); void iPanDoubleClicked(); - void songChanged(int); void instrPopup(); void recordClicked(); void progRecClicked(); @@ -56,10 +55,14 @@ class MidiTrackInfo : public QWidget, public Ui::MidiTrackInfoBase signals: void outputPortChanged(int); + public slots: + void setTrack(Track*); + void configChanged(); + void songChanged(int); + public: MidiTrackInfo(QWidget*, Track* = 0); Track* track() const { return selected; } - void setTrack(Track*); void setLabelText(); void setLabelFont(); void updateTrackInfo(int); diff --git a/muse2/muse/widgets/mtrackinfobase.ui b/muse2/muse/widgets/mtrackinfobase.ui index 43cf6927..88da348d 100644 --- a/muse2/muse/widgets/mtrackinfobase.ui +++ b/muse2/muse/widgets/mtrackinfobase.ui @@ -6,12 +6,12 @@ 0 0 - 149 - 555 + 100 + 400 - + 0 0 @@ -44,10 +44,36 @@ 0 + + + + + 0 + 0 + + + + true + + + + + + + + 0 + 0 + + + + output port + + + - + 0 0 @@ -66,80 +92,159 @@ - - + + - + 0 0 + + Out ch + - true + false + + + 0 + + + 1 - - + + + + + + + 0 + 0 + + + + input routing + + + Inputs + + + + + + + + + + + + 0 + 0 + + + + input detect + + + Input detect indicator. Detects all note on-off, controller, aftertouch, + program change, and pitchbend (but not sysex or realtime) events + on the selected channels, on the selected midi ports. + + + W + + + Qt::AlignCenter + + + false + + + + + + + + 0 + 0 + + + + Midi thru + + + Pass input events through ('thru') to output. + + + true + + + + + + + Qt::Horizontal + + + QSizePolicy::Maximum + + + + 4 + 2 + + + + + + + + - + 0 0 - - % + + off - 200 + 127 - 25 + -127 - 100 - - - - - - - - 0 - 0 - - - - output port + 1 - - + + - + 0 0 - Out ch + Transp. false - - 0 - - 1 + 2 - + 0 0 @@ -155,36 +260,33 @@ - - + + - + 0 0 - - 127 + + Delay - - -127 + + false - - 0 + + 2 - - + + - + 0 0 - - - % @@ -199,38 +301,16 @@ - - - - - 0 - 0 - - - - off - - - 127 - - - -127 - - - 1 - - - - - + + - + 0 0 - Transp. + Length false @@ -240,73 +320,79 @@ - - + + - + 0 0 - - Delay + + 127 - - false + + -127 - - 2 + + 0 - - + + - + 0 0 - Compr. + Velocity false - 2 + 0 - - + + - + 0 0 - - Velocity + + - - false + + % - - 0 + + 200 + + + 25 + + + 100 - - + + - + 0 0 - Length + Compr. false @@ -316,112 +402,10 @@ - - - - - - - 0 - 0 - - - - input routing - - - Inputs - - - - - - - - 0 - 0 - - - - output routing - - - oR - - - - - - - - - - - - 0 - 0 - - - - input detect - - - Input detect indicator. Detects all note on-off, controller, aftertouch, - program change, and pitchbend (but not sysex or realtime) events - on the selected channels, on the selected midi ports. - - - W - - - Qt::AlignCenter - - - false - - - - - - - - 0 - 0 - - - - Midi thru - - - Pass input events through ('thru') to output. - - - true - - - - - - - Qt::Horizontal - - - QSizePolicy::Maximum - - - - 4 - 2 - - - - - - - + 0 0 @@ -468,7 +452,7 @@ - + 0 0 @@ -539,7 +523,7 @@ - + 0 0 @@ -564,7 +548,7 @@ - + 0 0 @@ -589,7 +573,7 @@ - + 0 0 @@ -614,7 +598,7 @@ - + 0 0 @@ -639,7 +623,7 @@ - + 0 0 @@ -722,7 +706,7 @@ - + 0 0 @@ -805,7 +789,7 @@ - + 0 0 @@ -857,7 +841,7 @@ - + 0 0 @@ -899,7 +883,7 @@ 20 - 40 + 20 -- cgit v1.2.3