diff options
-rw-r--r-- | muse2/muse/arranger/arranger.cpp | 4 | ||||
-rw-r--r-- | muse2/muse/arranger/tlist.cpp | 39 | ||||
-rw-r--r-- | muse2/muse/arranger/tlist.h | 1 | ||||
-rw-r--r-- | muse2/muse/midiedit/scoreedit.h | 3 | ||||
-rw-r--r-- | muse2/muse/track.cpp | 5 | ||||
-rw-r--r-- | muse2/muse/track.h | 5 | ||||
-rw-r--r-- | muse2/muse/widgets/header.cpp | 119 | ||||
-rw-r--r-- | muse2/muse/widgets/header.h | 4 | ||||
-rw-r--r-- | muse2/share/templates/audio.med | 2 | ||||
-rw-r--r-- | muse2/share/templates/default.med | 2 | ||||
-rw-r--r-- | muse2/share/templates/midiGM.med | 2 | ||||
-rw-r--r-- | muse2/share/templates/synti.med | 2 |
12 files changed, 149 insertions, 39 deletions
diff --git a/muse2/muse/arranger/arranger.cpp b/muse2/muse/arranger/arranger.cpp index d74bed78..e1205d6f 100644 --- a/muse2/muse/arranger/arranger.cpp +++ b/muse2/muse/arranger/arranger.cpp @@ -69,6 +69,7 @@ void Arranger::setHeaderToolTips() header->setToolTip(COL_OPORT, tr("Midi output port or synth midi port")); header->setToolTip(COL_TIMELOCK, tr("Time Lock")); header->setToolTip(COL_AUTOMATION, tr("Automation parameter selection")); + header->setToolTip(COL_CLEF, tr("Notation clef")); } @@ -87,6 +88,7 @@ void Arranger::setHeaderWhatsThis() header->setWhatsThis(COL_OCHANNEL, tr("Midi/drum track: Output channel number.\nAudio track: Channels.\nMid/right-click to change.")); header->setWhatsThis(COL_OPORT, tr("Midi/drum track: Output port.\nSynth track: Assigned midi port.\nLeft-click to change.\nRight-click to show GUI.")); header->setWhatsThis(COL_TIMELOCK, tr("Time lock")); + header->setToolTip(COL_CLEF, tr("Notation clef. Select this tracks notation clef.")); } //--------------------------------------------------------- @@ -290,6 +292,7 @@ Arranger::Arranger(QMainWindow* parent, const char* name) header->setColumnLabel(tr("Ch"), COL_OCHANNEL, 30); header->setColumnLabel(tr("T"), COL_TIMELOCK, fm1.width('T')+fw); header->setColumnLabel(tr("Automation"), COL_AUTOMATION, 75); + header->setColumnLabel(tr("Clef"), COL_CLEF, 75); header->setResizeMode(COL_RECORD, QHeaderView::Fixed); header->setResizeMode(COL_MUTE, QHeaderView::Fixed); header->setResizeMode(COL_SOLO, QHeaderView::Fixed); @@ -299,6 +302,7 @@ Arranger::Arranger(QMainWindow* parent, const char* name) header->setResizeMode(COL_OCHANNEL, QHeaderView::Fixed); header->setResizeMode(COL_TIMELOCK, QHeaderView::Fixed); header->setResizeMode(COL_AUTOMATION, QHeaderView::Interactive); + header->setResizeMode(COL_CLEF, QHeaderView::Interactive); setHeaderToolTips(); setHeaderWhatsThis(); diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp index 4b531607..427047c2 100644 --- a/muse2/muse/arranger/tlist.cpp +++ b/muse2/muse/arranger/tlist.cpp @@ -44,6 +44,7 @@ #include "midiedit/drummap.h" #include "synth.h" #include "config.h" +#include "scoreedit.h" #ifdef DSSI_SUPPORT #include "dssihost.h" @@ -356,6 +357,18 @@ void TList::paint(const QRect& r) p.drawText(r, Qt::AlignVCenter|Qt::AlignLeft, s); } break; + case COL_CLEF: + if (track->isMidiTrack()) { + QString s = "no clef"; + if (((MidiTrack*)track)->getClef() == ScoreEdit::trebleClef) + s="Treble Clef"; + else if (((MidiTrack*)track)->getClef() == ScoreEdit::bassClef) + s="Bass Clef"; + else if (((MidiTrack*)track)->getClef() == ScoreEdit::grandStaff) + s="Grand Staff"; + p.drawText(r, Qt::AlignVCenter|Qt::AlignLeft, s); + } + break; default: break; } @@ -1054,6 +1067,32 @@ void TList::mousePressEvent(QMouseEvent* ev) mode = START_DRAG; switch (col) { + case COL_CLEF: + if (t->isMidiTrack()) { + QMenu* p = new QMenu; + p->addAction("Treble clef")->setData(0); + p->addAction("Bass clef")->setData(1); + p->addAction("Grand Staff")->setData(2); + + // Show the menu + QAction* act = p->exec(ev->globalPos(), 0); + switch (act->data().toInt()) { + case 0: + ((MidiTrack*)t)->setClef(ScoreEdit::trebleClef); + break; + case 1: + ((MidiTrack*)t)->setClef(ScoreEdit::bassClef); + break; + case 2: + ((MidiTrack*)t)->setClef(ScoreEdit::grandStaff); + break; + default: + break; + } + delete p; + } + + break; case COL_AUTOMATION: { if (!t->isMidiTrack()) { diff --git a/muse2/muse/arranger/tlist.h b/muse2/muse/arranger/tlist.h index 8bebef95..7691b6cc 100644 --- a/muse2/muse/arranger/tlist.h +++ b/muse2/muse/arranger/tlist.h @@ -36,6 +36,7 @@ enum TrackColumn { COL_OCHANNEL, COL_TIMELOCK, COL_AUTOMATION, + COL_CLEF, COL_NONE = -1 }; diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h index 4004452f..f587483a 100644 --- a/muse2/muse/midiedit/scoreedit.h +++ b/muse2/muse/midiedit/scoreedit.h @@ -60,6 +60,7 @@ enum {CMD_COLOR_BLACK, CMD_COLOR_VELO, CMD_COLOR_PART, CMD_QUANTIZE, CMD_VELOCITY, CMD_CRESCENDO, CMD_NOTELEN }; + class ScoreCanvas; class EditToolBar; @@ -70,6 +71,8 @@ class EditToolBar; class ScoreEdit : public TopWin { Q_OBJECT + public: + enum clefTypes { trebleClef, bassClef, grandStaff }; private: virtual void closeEvent(QCloseEvent*); diff --git a/muse2/muse/track.cpp b/muse2/muse/track.cpp index 2a93968d..5dab4c09 100644 --- a/muse2/muse/track.cpp +++ b/muse2/muse/track.cpp @@ -369,6 +369,7 @@ MidiTrack::MidiTrack() init(); _events = new EventList; _mpevents = new MPEventList; + clefType=ScoreEdit::trebleClef; } //MidiTrack::MidiTrack(const MidiTrack& mt) @@ -388,6 +389,7 @@ MidiTrack::MidiTrack(const MidiTrack& mt, bool cloneParts) len = mt.len; compression = mt.compression; _recEcho = mt.recEcho(); + clefType=ScoreEdit::trebleClef; } MidiTrack::~MidiTrack() @@ -894,6 +896,7 @@ void MidiTrack::write(int level, Xml& xml) const xml.intTag(level, "len", len); xml.intTag(level, "compression", compression); xml.intTag(level, "automation", int(automationType())); + xml.intTag(level, "clef", int(clefType)); const PartList* pl = cparts(); for (ciPart p = pl->begin(); p != pl->end(); ++p) @@ -955,6 +958,8 @@ void MidiTrack::read(Xml& xml) _recEcho = xml.parseInt(); else if (tag == "automation") setAutomationType(AutomationType(xml.parseInt())); + else if (tag == "clef") + clefType = (ScoreEdit::clefTypes)xml.parseInt(); else if (Track::readProperties(xml, tag)) { // version 1.0 compatibility: if (tag == "track" && xml.majorVersion() == 1 && xml.minorVersion() == 0) diff --git a/muse2/muse/track.h b/muse2/muse/track.h index aec765da..d1dc3a6f 100644 --- a/muse2/muse/track.h +++ b/muse2/muse/track.h @@ -20,6 +20,7 @@ #include "route.h" #include "ctrl.h" #include "globaldefs.h" +#include "scoreedit.h" class Pipeline; class Xml; @@ -208,6 +209,7 @@ class MidiTrack : public Track { EventList* _events; // tmp Events during midi import MPEventList* _mpevents; // tmp Events druring recording static bool _isVisible; + ScoreEdit::clefTypes clefType; public: MidiTrack(); @@ -273,6 +275,9 @@ class MidiTrack : public Track { virtual bool canRecord() const { return true; } static void setVisible(bool t) { _isVisible = t; } static bool visible() { return _isVisible; } + + void setClef(ScoreEdit::clefTypes i) { clefType = i; } + ScoreEdit::clefTypes getClef() { return clefType; } }; //--------------------------------------------------------- diff --git a/muse2/muse/widgets/header.cpp b/muse2/muse/widgets/header.cpp index 16cc374b..00cbd29c 100644 --- a/muse2/muse/widgets/header.cpp +++ b/muse2/muse/widgets/header.cpp @@ -7,46 +7,56 @@ #include "header.h" #include "xml.h" +#include "popupmenu.h" #include <QStringList> #include <QStandardItemModel> +#include <QMouseEvent> //--------------------------------------------------------- // readStatus //--------------------------------------------------------- void Header::readStatus(Xml& xml) - { - for (;;) { - Xml::Token token = xml.parse(); - const QString& tag = xml.s1(); - switch (token) { - case Xml::Error: - case Xml::End: - return; - case Xml::Text: - { - //QStringList l = QStringList::split(QString(" "), tag); - QStringList l = tag.split(QString(" "), QString::SkipEmptyParts); - int index = count() -1; - for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { - int section = visualIndex((*it).toInt()); - moveSection(section, index); - --index; - } - } - break; - case Xml::TagStart: - xml.unknown("Header"); - break; - case Xml::TagEnd: - if (tag ==objectName()) - return; - default: - break; - } - } - } +{ + + for (;;) { + Xml::Token token = xml.parse(); + const QString& tag = xml.s1(); + switch (token) { + case Xml::Error: + case Xml::End: + return; + case Xml::Text: + { + //QStringList l = QStringList::split(QString(" "), tag); + QStringList l = tag.split(QString(" "), QString::SkipEmptyParts); + int index = count() -1; + for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + int logialIdx=abs((*it).toInt()); + bool isHidden = (*it).toInt() < 0 ? true:false; + int section = visualIndex(logialIdx); + setMovable(true); + moveSection(section, index); + if (isHidden) + hideSection(logialIdx); + else + showSection(logialIdx); + --index; + } + } + break; + case Xml::TagStart: + xml.unknown("Header"); + break; + case Xml::TagEnd: + if (tag ==objectName()) + return; + default: + break; + } + } +} //--------------------------------------------------------- // writeStatus @@ -57,8 +67,12 @@ void Header::writeStatus(int level, Xml& xml) const //xml.nput(level, "<%s> ", name()); xml.nput(level, "<%s> ", Xml::xmlString(objectName()).toLatin1().constData()); int n = count() - 1; - for (int i = n; i >= 0; --i) - xml.nput("%d ", logicalIndex(i)); + for (int i = n; i >= 0; --i) { + if (isSectionHidden(logicalIndex(i))) + xml.nput("%d ", -logicalIndex(i)); // hidden is stored as negative value + else + xml.nput("%d ", logicalIndex(i)); + } //xml.put("</%s>", name()); xml.put("</%s>", Xml::xmlString(objectName()).toLatin1().constData()); } @@ -73,8 +87,9 @@ Header::Header(QWidget* parent, const char* name) setObjectName(name); itemModel = new QStandardItemModel; setModel(itemModel); - //setResizeMode(QHeaderView::ResizeToContents); setDefaultSectionSize(30); + setStretchLastSection(true); + } //--------------------------------------------------------- @@ -86,7 +101,7 @@ void Header::setColumnLabel(const QString & text, int col, int width ) QStandardItem *sitem = new QStandardItem(text ); itemModel->setHorizontalHeaderItem(col, sitem); if (width > -1) - resizeSection(col, width); + resizeSection(col, width); } //--------------------------------------------------------- @@ -109,3 +124,37 @@ void Header::setWhatsThis(int col, const QString &text) item->setWhatsThis(text); } +void Header::mousePressEvent ( QMouseEvent * e ) +{ + if (e->button() == Qt::RightButton) { + + PopupMenu* p = new PopupMenu(); + p->disconnect(); + p->clear(); + p->setTitle(tr("Track Info Columns")); + QAction* act = 0; + + for(int i=1; i < count(); i++) { + act = p->addAction(itemModel->horizontalHeaderItem(logicalIndex(i))->text() + + "\t - "+ itemModel->horizontalHeaderItem(logicalIndex(i))->toolTip()); + + act->setCheckable(true); + act->setChecked(!isSectionHidden(logicalIndex(i))); + int data = logicalIndex(i); + act->setData(data); + } + connect(p, SIGNAL(triggered(QAction*)), SLOT(changeColumns(QAction*))); + p->exec(QCursor::pos()); + + delete p; + + } +} +void Header::changeColumns(QAction *a) +{ + int section = a->data().toInt(); + if (isSectionHidden(section)) + showSection(section); + else + hideSection(section); +} diff --git a/muse2/muse/widgets/header.h b/muse2/muse/widgets/header.h index 83680f8a..3e7b73a4 100644 --- a/muse2/muse/widgets/header.h +++ b/muse2/muse/widgets/header.h @@ -9,6 +9,7 @@ #define __HEADER_H__ #include <QHeaderView> +#include <QAction> class QStandardItemModel; @@ -26,6 +27,9 @@ class Header : public QHeaderView { void setColumnLabel( const QString & s, int col, int width = -1 ); void setToolTip(int col, const QString &text); void setWhatsThis(int col, const QString &text); + void mousePressEvent ( QMouseEvent * e ); + private slots: + void changeColumns(QAction* a); }; #endif diff --git a/muse2/share/templates/audio.med b/muse2/share/templates/audio.med index 14cd9c47..85b9edb4 100644 --- a/muse2/share/templates/audio.med +++ b/muse2/share/templates/audio.med @@ -33,7 +33,7 @@ <info>1</info> <split>298 298 </split> <list> - <header> 7 6 5 4 3 2 1 0 8 </header> + <header> 9 8 7 6 5 4 3 2 1 0 </header> </list> <xpos>0</xpos> <xmag>266</xmag> diff --git a/muse2/share/templates/default.med b/muse2/share/templates/default.med index 8772f759..82390cc4 100644 --- a/muse2/share/templates/default.med +++ b/muse2/share/templates/default.med @@ -33,7 +33,7 @@ <info>1</info> <split>418 456 </split> <list> - <header> 8 7 6 5 4 3 2 1 0 </header> + <header> 9 8 7 6 5 4 3 2 1 0 </header> </list> <xpos>0</xpos> <xmag>266</xmag> diff --git a/muse2/share/templates/midiGM.med b/muse2/share/templates/midiGM.med index bbc04498..e5459c14 100644 --- a/muse2/share/templates/midiGM.med +++ b/muse2/share/templates/midiGM.med @@ -33,7 +33,7 @@ <info>1</info> <split>298 298 </split> <list> - <header> 7 6 5 4 3 2 1 0 8 </header> + <header> 9 8 7 6 5 4 3 2 1 0 </header> </list> <xpos>0</xpos> <xmag>266</xmag> diff --git a/muse2/share/templates/synti.med b/muse2/share/templates/synti.med index 1a14a9ce..1939dacb 100644 --- a/muse2/share/templates/synti.med +++ b/muse2/share/templates/synti.med @@ -33,7 +33,7 @@ <info>0</info> <split>298 298 </split> <list> - <header> 7 6 5 4 3 2 1 0 8 </header> + <header> 9 8 7 6 5 4 3 2 1 0 </header> </list> <xpos>0</xpos> <xmag>266</xmag> |