summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNil Geisweiller <a-lin@sourceforge.net>2007-03-15 02:52:35 +0000
committerNil Geisweiller <a-lin@sourceforge.net>2007-03-15 02:52:35 +0000
commitdb3fbd2faa043a1f14b1ec80486673cc169e8dcd (patch)
treedffdcf804c9357eab91eaf022a139049b550a27a
parent551cb0226f36789f49754451f5269370e1472d14 (diff)
update miditracker
-rw-r--r--muse/ChangeLog2
-rw-r--r--muse/muse/midiedit/midieditor.h4
-rw-r--r--muse/muse/midiedit/miditracker.cpp44
-rw-r--r--muse/muse/midiedit/miditracker.h8
-rw-r--r--muse/muse/midiedit/trackpattern.cpp45
-rw-r--r--muse/muse/midiedit/trackpattern.h11
6 files changed, 65 insertions, 49 deletions
diff --git a/muse/ChangeLog b/muse/ChangeLog
index b6f2f700..61c70b63 100644
--- a/muse/ChangeLog
+++ b/muse/ChangeLog
@@ -1,3 +1,5 @@
+15.03 (ng)
+ - update IV miditracker
04.03 (ng)
- update III miditracker
02.02 (ng)
diff --git a/muse/muse/midiedit/midieditor.h b/muse/muse/midiedit/midieditor.h
index d35eee6c..3791e017 100644
--- a/muse/muse/midiedit/midieditor.h
+++ b/muse/muse/midiedit/midieditor.h
@@ -96,7 +96,9 @@ class MidiEditor : public Editor {
protected slots:
void clipboardChanged(); // enable/disable "Paste"
void selectionChanged(); // enable/disable "Copy" & "Paste"
- void songChanged(int);
+ virtual void songChanged(int); //add virtual to allow editors that do not use
+ //ecancav to use there own songChanged slot
+ //and avoid crashing, like MidiTrackerEditor
void setPos(int, const AL::Pos&);
virtual void cmd(QAction*) = 0;
diff --git a/muse/muse/midiedit/miditracker.cpp b/muse/muse/midiedit/miditracker.cpp
index 6e6a9a5b..e345f454 100644
--- a/muse/muse/midiedit/miditracker.cpp
+++ b/muse/muse/midiedit/miditracker.cpp
@@ -5,6 +5,7 @@
// (C) Copyright 2006 Nil Geisweiller (a_lin@user.sourceforge.net)
//=================================================================
+#include "ecanvas.h"
#include "miditracker.h"
#include "trackpattern.h"
#include "song.h"
@@ -14,6 +15,7 @@
#define MAX(x,y) (x>y?x:y)
class TrackPattern;
+//class EventCanvas;
//---------------------------------------------------------
// MidiTrackerEditor
@@ -84,17 +86,17 @@ MidiTrackerEditor::MidiTrackerEditor(PartList* pl, bool /*init*/)
//number of visible rows
//rowfeatures->addSeparator();
- QLabel* nvrLabel = new QLabel(tr("Number of visible rows"), rowfeatures);
+ /*QLabel* nvrLabel = new QLabel(tr("Number of visible rows"), rowfeatures);
nvrLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
nvrLabel->setIndent(3);
rowfeatures->addWidget(nvrLabel);
_nvrSpinBox = new QSpinBox(rowfeatures);
_nvrSpinBox->setRange(1, 256);
_nvrSpinBox->setFixedHeight(24);
- rowfeatures->addWidget(_nvrSpinBox);
+ rowfeatures->addWidget(_nvrSpinBox);*/
//init number of visible row
- setNumVisibleRows(20);
- updateNumVisibleRows();
+ /*setNumVisibleRows(20);
+ updateNumVisibleRows();*/
//evaluate fisrtTick and lastTick
unsigned firstTick = _pl->begin()->second->tick();
@@ -175,21 +177,21 @@ MidiTrackerEditor::MidiTrackerEditor(PartList* pl, bool /*init*/)
}
//---------------------------------------------------------
-// setRowPerBar
+// setQuant
//---------------------------------------------------------
void MidiTrackerEditor::setQuant(int q) {
_quant = q;
}
//---------------------------------------------------------
-// getRowPerBar
+// getQuant
//---------------------------------------------------------
int MidiTrackerEditor::getQuant() {
return _quant;
}
//---------------------------------------------------------
-// updateRowPerBar
+// updateQuant
//---------------------------------------------------------
void MidiTrackerEditor::updateQuant() {
_quantCombo->blockSignals(true);
@@ -198,33 +200,17 @@ void MidiTrackerEditor::updateQuant() {
}
//---------------------------------------------------------
-// setNumVisibleRows
-//---------------------------------------------------------
-void MidiTrackerEditor::setNumVisibleRows(int nvr) {
- _numVisibleRows = nvr;
-}
-
-//---------------------------------------------------------
-// getNumVisibleRows
-//---------------------------------------------------------
-int MidiTrackerEditor::getNumVisibleRows() {
- return _numVisibleRows;
-}
-
-//---------------------------------------------------------
-// updateNumVisibleRows
+// setFollow
//---------------------------------------------------------
-void MidiTrackerEditor::updateNumVisibleRows() {
- _nvrSpinBox->blockSignals(true);
- _nvrSpinBox->setValue(_numVisibleRows);
- _nvrSpinBox->blockSignals(false);
+void MidiTrackerEditor::setFollow(bool f) {
+ _follow = f;
}
//---------------------------------------------------------
-// setFollow
+// songChanged
//---------------------------------------------------------
-void MidiTrackerEditor::setFollow(bool f) {
- _follow = f;
+void MidiTrackerEditor::songChanged(int i) {
+ emit signalSongChanged(i);
}
//---------------------------------------------------------
diff --git a/muse/muse/midiedit/miditracker.h b/muse/muse/midiedit/miditracker.h
index aad3a090..5e6d706a 100644
--- a/muse/muse/midiedit/miditracker.h
+++ b/muse/muse/midiedit/miditracker.h
@@ -31,8 +31,8 @@ class MidiTrackerEditor : public MidiEditor {
private:
int _quant;
QuantCombo* _quantCombo;
- int _numVisibleRows;
- QSpinBox* _nvrSpinBox;
+ //int _numVisibleRows;
+ //QSpinBox* _nvrSpinBox;
QMenu* menuView;
bool _follow;
@@ -45,6 +45,9 @@ class MidiTrackerEditor : public MidiEditor {
void updateMoveCurrentRow(unsigned);
virtual void cmd(QAction*);
+ protected slots:
+ virtual void songChanged(int);
+
public:
MidiTrackerEditor(PartList*, bool);
~MidiTrackerEditor() {}
@@ -67,6 +70,7 @@ class MidiTrackerEditor : public MidiEditor {
signals:
void signalMoveCurrentRow(unsigned);
+ void signalSongChanged(int);
};
#endif
diff --git a/muse/muse/midiedit/trackpattern.cpp b/muse/muse/midiedit/trackpattern.cpp
index 84f4aeda..d50fffd0 100644
--- a/muse/muse/midiedit/trackpattern.cpp
+++ b/muse/muse/midiedit/trackpattern.cpp
@@ -283,7 +283,8 @@ BaseTrackPat::BaseTrackPat(QMainWindow* parent, unsigned anr) {
SLOT(currentItemChanged(QTreeWidgetItem*)));
connect(_parent, SIGNAL(signalMoveCurrentRow(unsigned)), this,
SLOT(moveRowFromSignal(unsigned)));
- //connect(_tree, SIGNAL(itemSelectionChanged()), this, SLOT(itemSelectionChanged()));
+ //connect signalSongChanged to update the pattern
+ connect(parent, SIGNAL(signalSongChanged(int)), this, SLOT(updatePattern(int)));
}
BaseTrackPat::~BaseTrackPat() {
@@ -366,13 +367,23 @@ void BaseTrackPat::resizeEvent(QResizeEvent* /*event*/) {
}
void BaseTrackPat::selectCurrentRow() {
- _tree->blockSignals(true);
-
- QTreeWidgetItem* item = _tree->topLevelItem(getRelativeCurrentRow());
- item->setSelected(true);
- _tree->setCurrentItem(item);
+ unsigned rcr = getRelativeCurrentRow();
+ if(rcr < getRowMag()) {
+ QTreeWidgetItem* item = _tree->topLevelItem(getRelativeCurrentRow());
+ if(item) {
+ _tree->blockSignals(true);
+ item->setSelected(true);
+ _tree->setCurrentItem(item);
+ _tree->blockSignals(false);
+ }
+ }
+}
- _tree->blockSignals(false);
+void BaseTrackPat::updatePattern(int /*type*/) {
+ clearMatrix();
+ buildMatrix();
+ fillPattern();
+ selectCurrentRow();
}
//----------------------------------------------------------
@@ -395,8 +406,8 @@ TrackPattern::TrackPattern(QMainWindow* parent, QString name,
}
//build the matrix of events
- buildEventMatrix();
-
+ buildMatrix();
+
//configure and add the dockWidget
setWindowTitle(_track->name());
setFeatures(QDockWidget::DockWidgetClosable |QDockWidget::DockWidgetMovable);
@@ -436,7 +447,6 @@ TrackPattern::TrackPattern(QMainWindow* parent, QString name,
//Resize the columns
for(unsigned i = 0; i < _voiceColumns.size(); i++)
_tree->resizeColumnToContents(i);
-
}
TrackPattern::~TrackPattern() {
@@ -468,7 +478,12 @@ void TrackPattern::setQuant(int /*quant*/) {
//TODO
}
-void TrackPattern::buildEventMatrix() {
+void TrackPattern::clearMatrix() {
+ _voiceColumns.clear();
+ _ctrlColumns.clear();
+}
+
+void TrackPattern::buildMatrix() {
for(ciPart p = _partList->begin(); p != _partList->end(); p++) {
Part* part = p->second;
EventList* events = part->events();
@@ -543,7 +558,7 @@ TimingPattern::TimingPattern(QMainWindow* parent, QString name,
unsigned firstTick, unsigned lastTick, int quant)
: BasePat(name, firstTick, lastTick, quant), BaseTrackPat(parent) {
//build the timing matrix
- buildTimingMatrix();
+ buildMatrix();
//configure and add the dockWidget
setWindowTitle(name);
@@ -582,7 +597,11 @@ TimingPattern::TimingPattern(QMainWindow* parent, QString name,
TimingPattern::~TimingPattern() {
}
-void TimingPattern::buildTimingMatrix() {
+void TimingPattern::clearMatrix() {
+ _timingEvents.clear();
+}
+
+void TimingPattern::buildMatrix() {
for(unsigned tick = _firstTick; tick <= _lastTick; tick++) {
if(isRow(tick)) {
TimingEvent* te = new TimingEvent(tick2row(tick) - tick2row(_firstTick));
diff --git a/muse/muse/midiedit/trackpattern.h b/muse/muse/midiedit/trackpattern.h
index 52bb87b3..d9d91aee 100644
--- a/muse/muse/midiedit/trackpattern.h
+++ b/muse/muse/midiedit/trackpattern.h
@@ -180,6 +180,8 @@ class BaseTrackPat : public QDockWidget {
void resizeEvent(QResizeEvent* /*event*/);
+ virtual void clearMatrix() {}
+ virtual void buildMatrix() {}
virtual void fillPattern() {} //fill the treeWidget with the right window of times
//according to _firstRow and _lastRow
@@ -192,7 +194,7 @@ class BaseTrackPat : public QDockWidget {
private slots:
void currentItemChanged(QTreeWidgetItem* nitem);
void moveRowFromSignal(unsigned index);
-
+ void updatePattern(int songChangeType);
};
//------------------------------------------------------
@@ -216,8 +218,9 @@ class TrackPattern : public BaseTrackPat, public BasePat {
//creating new voices when necessary
MidiTrack* getTrack() {return _track;}
void setQuant(int quant);
- void buildEventMatrix();
+ virtual void clearMatrix();
+ virtual void buildMatrix();
virtual void fillPattern();
};
@@ -250,8 +253,8 @@ class TimingPattern : public BasePat, public BaseTrackPat {
unsigned lastTick, int quant);
~TimingPattern();
- void buildTimingMatrix();
-
+ virtual void clearMatrix();
+ virtual void buildMatrix();
virtual void fillPattern();
};