summaryrefslogtreecommitdiff
path: root/muse2/muse
diff options
context:
space:
mode:
authorRobert Jonsson <spamatica@gmail.com>2011-05-24 18:31:42 +0000
committerRobert Jonsson <spamatica@gmail.com>2011-05-24 18:31:42 +0000
commit9e3802aadd279ffd0a677df9dd5d21e02315d8b4 (patch)
treec37f010624dee5e463a1d301335bc10d5c764ea4 /muse2/muse
parent9defbf3c671ccb70ff4b29f222ea9fb9227099b2 (diff)
template sample rate, drum track channel, track list header
Diffstat (limited to 'muse2/muse')
-rw-r--r--muse2/muse/app.cpp2
-rw-r--r--muse2/muse/app.h2
-rw-r--r--muse2/muse/arranger/tlist.cpp15
-rw-r--r--muse2/muse/song.h2
-rw-r--r--muse2/muse/songfile.cpp8
-rw-r--r--muse2/muse/widgets/header.cpp2
-rw-r--r--muse2/muse/widgets/mtrackinfo.cpp9
7 files changed, 26 insertions, 14 deletions
diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp
index f94f4a64..62871b18 100644
--- a/muse2/muse/app.cpp
+++ b/muse2/muse/app.cpp
@@ -1815,7 +1815,7 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll
}
else {
Xml xml(f);
- read(xml, !loadAll);
+ read(xml, !loadAll, songTemplate);
bool fileError = ferror(f);
popenFlag ? pclose(f) : fclose(f);
if (fileError) {
diff --git a/muse2/muse/app.h b/muse2/muse/app.h
index 2aa2834f..c194b603 100644
--- a/muse2/muse/app.h
+++ b/muse2/muse/app.h
@@ -195,7 +195,7 @@ class MusE : public QMainWindow
QMenu* openRecent;
bool readMidi(FILE*);
- void read(Xml& xml, bool skipConfig);
+ void read(Xml& xml, bool skipConfig, bool isTemplate);
void processTrack(MidiTrack* track);
void write(Xml& xml) const;
diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp
index fbd763d8..b1033a2a 100644
--- a/muse2/muse/arranger/tlist.cpp
+++ b/muse2/muse/arranger/tlist.cpp
@@ -299,7 +299,11 @@ void TList::paint(const QRect& r)
{
QString s;
int n;
- if (track->isMidiTrack()) {
+ if (track->isMidiTrack() && track->type() == Track::DRUM) {
+ p.drawText(r, Qt::AlignVCenter|Qt::AlignHCenter, "-");
+ break;
+ }
+ else if (track->isMidiTrack()) {
n = ((MidiTrack*)track)->outChannel() + 1;
}
else {
@@ -1279,8 +1283,10 @@ void TList::mousePressEvent(QMouseEvent* ev)
{
MidiTrack* mt = dynamic_cast<MidiTrack*>(t);
if (mt == 0)
- break;
-
+ break;
+ if (mt->type() == Track::DRUM)
+ break;
+
int channel = mt->outChannel();
channel += delta;
if(channel >= MIDI_CHANNELS)
@@ -1554,6 +1560,9 @@ void TList::wheelEvent(QWheelEvent* ev)
case COL_OCHANNEL:
if (t->isMidiTrack()) {
MidiTrack* mt = (MidiTrack*)t;
+ if (mt && mt->type() == Track::DRUM)
+ break;
+
int channel = mt->outChannel() + delta;
if (channel >= MIDI_CHANNELS)
diff --git a/muse2/muse/song.h b/muse2/muse/song.h
index e1378480..47fd96d4 100644
--- a/muse2/muse/song.h
+++ b/muse2/muse/song.h
@@ -162,7 +162,7 @@ class Song : public QObject {
AudioOutput* bounceOutput;
void updatePos();
- void read(Xml&);
+ void read(Xml&, bool isTemplate=false);
void write(int, Xml&) const;
void writeFont(int level, Xml& xml, const char* name,
const QFont& font) const;
diff --git a/muse2/muse/songfile.cpp b/muse2/muse/songfile.cpp
index a8134b1d..72cacfaa 100644
--- a/muse2/muse/songfile.cpp
+++ b/muse2/muse/songfile.cpp
@@ -1213,7 +1213,7 @@ void Song::readMarker(Xml& xml)
// read
//---------------------------------------------------------
-void Song::read(Xml& xml)
+void Song::read(Xml& xml, bool isTemplate)
{
cloneList.clear();
for (;;) {
@@ -1260,7 +1260,7 @@ void Song::read(Xml& xml)
_follow = FollowMode(xml.parseInt());
else if (tag == "sampleRate") {
int sRate = xml.parseInt();
- if (audioDevice->deviceType() != AudioDevice::DUMMY_AUDIO && sRate != sampleRate)
+ if (!isTemplate && audioDevice->deviceType() != AudioDevice::DUMMY_AUDIO && sRate != sampleRate)
QMessageBox::warning(muse,"Wrong sample rate", "The sample rate in this project and the current system setting differs, the project may not work as intended!");
}
else if (tag == "tempolist") {
@@ -1373,7 +1373,7 @@ void Song::read(Xml& xml)
// read song
//---------------------------------------------------------
-void MusE::read(Xml& xml, bool skipConfig)
+void MusE::read(Xml& xml, bool skipConfig, bool isTemplate)
{
bool skipmode = true;
for (;;) {
@@ -1398,7 +1398,7 @@ void MusE::read(Xml& xml, bool skipConfig)
readConfiguration(xml, false);
else if (tag == "song")
{
- song->read(xml);
+ song->read(xml, isTemplate);
audio->msgUpdateSoloStates();
}
else if (tag == "midiport")
diff --git a/muse2/muse/widgets/header.cpp b/muse2/muse/widgets/header.cpp
index 00cbd29c..61ebcc74 100644
--- a/muse2/muse/widgets/header.cpp
+++ b/muse2/muse/widgets/header.cpp
@@ -88,7 +88,7 @@ Header::Header(QWidget* parent, const char* name)
itemModel = new QStandardItemModel;
setModel(itemModel);
setDefaultSectionSize(30);
- setStretchLastSection(true);
+// setStretchLastSection(true);
}
diff --git a/muse2/muse/widgets/mtrackinfo.cpp b/muse2/muse/widgets/mtrackinfo.cpp
index e6e618bd..465b7130 100644
--- a/muse2/muse/widgets/mtrackinfo.cpp
+++ b/muse2/muse/widgets/mtrackinfo.cpp
@@ -44,10 +44,13 @@ void MidiTrackInfo::setTrack(Track* t)
selected = t;
QPalette pal;
- if(selected->type() == Track::DRUM)
+ if(selected->type() == Track::DRUM) {
pal.setColor(trackNameLabel->backgroundRole(), config.drumTrackLabelBg);
- else
- pal.setColor(trackNameLabel->backgroundRole(), config.midiTrackLabelBg);
+ iOutputChannel->setEnabled(false);
+ } else {
+ pal.setColor(trackNameLabel->backgroundRole(), config.midiTrackLabelBg);
+ iOutputChannel->setEnabled(true);
+ }
trackNameLabel->setPalette(pal);
updateTrackInfo(-1);