From 4e1ca61b03bab50d5e71e6da433503ac3b4470c0 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Mon, 16 May 2011 11:34:53 +0000 Subject: fixed saving window state dialogs now also save and restore their state templates were updated and have now sane defaults for toolbars etc. --- muse2/share/templates/midiGM.med | 274 +++++++++++++++++++++++++++++++++------ 1 file changed, 232 insertions(+), 42 deletions(-) (limited to 'muse2/share/templates/midiGM.med') diff --git a/muse2/share/templates/midiGM.med b/muse2/share/templates/midiGM.med index 1314effb..bbc04498 100644 --- a/muse2/share/templates/midiGM.med +++ b/muse2/share/templates/midiGM.med @@ -9,27 +9,31 @@ 0 0 0 - 127 - 127 - 1 - -1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 1 00:00:00:00:00 + 1 + 1 + 1 0 - 0 - 0 - 0 - 0 - 1 - 1 0 0 - 0 + 0 + + + 0 + 0 1 - 298 764 + 298 298 -
7 6 5 4 3 2 1 0
+
7 6 5 4 3 2 1 0 8
0 266 @@ -44,14 +48,15 @@ 70 9 0 - 1 - 1 + 0 + 0 4 4 0 0 1 0 + 0.5 0 28 @@ -59,7 +64,7 @@ 33 29 - GM + 1 0 @@ -67,6 +72,12 @@ 0 + + + + + + 0 @@ -78,6 +89,12 @@ 0 + + + + + + 0 @@ -89,6 +106,12 @@ 0 + + + + + + 0 @@ -100,6 +123,12 @@ 0 + + + + + + 0 @@ -111,6 +140,12 @@ 0 + + + + + + 0 @@ -122,6 +157,12 @@ 0 + + + + + + 0 @@ -133,6 +174,12 @@ 0 + + + + + + 0 @@ -144,6 +191,12 @@ 0 + + + + + + 0 @@ -155,6 +208,12 @@ 0 + + + + + + 0 @@ -166,6 +225,12 @@ 0 + + + + + + 0 @@ -177,6 +242,12 @@ 0 + + + + + + 0 @@ -188,6 +259,12 @@ 0 + + + + + + 0 @@ -199,6 +276,12 @@ 0 + + + + + + 0 @@ -210,6 +293,12 @@ 0 + + + + + + 0 @@ -221,6 +310,12 @@ 0 + + + + + + 0 @@ -232,6 +327,12 @@ 0 + + + + + + 0 @@ -239,34 +340,79 @@ - 96 96 - 600 - 400 - 50 - 300 + 883 + 465 + 126 + 753 + 000000ff00000000fd00000000000003730000015c00000004000000040000000800000008fc00000004000000020000000400000014004400720075006d00200074006f006f006c00730100000000000000d1000000000000000000000014004500640069007400200054006f006f006c007301000000d1000000c8000000000000000000000012007400720061006e00730070006f0072007401000001990000018400000000000000000000000a00700061006e00690063010000031dffffffff00000000000000000000000200000000000000020000000100000012004e006f0074006500200049006e0066006f0100000000ffffffff000000000000000000000002000000020000000c0063007500720073006f00720100000000ffffffff0000000000000000000000260050006f0073002f0053006e00610070002f0053006f006c006f002d0074006f006f006c00730100000083ffffffff0000000000000000 - 96 96 - 80 - 50 - 0 - 0 - 600 - 400 + 879 + 467 0 + 000000ff00000000fd000000000000036f0000017800000004000000040000000800000008fc00000006000000020000000000000002000000000000000200000000000000020000000000000002000000030000001e005000690061006e006f0072006f006c006c00200074006f006f006c00730100000000ffffffff000000000000000000000014004500640069007400200054006f006f006c00730100000091ffffffff000000000000000000000012004e006f0074006500200049006e0066006f0100000103ffffffff00000000000000000000000200000003000000260050006f0073002f0053006e00610070002f0053006f006c006f002d0074006f006f006c007301000000000000024c000000000000000000000012007400720061006e00730070006f00720074010000024c000000fc00000000000000000000000a00700061006e006900630100000348ffffffff0000000000000000 + + 880 + 466 + 000000ff00000000fd00000000000003700000018500000004000000040000000800000008fc0000000200000002000000030000001e0055006e0064006f002f005200650064006f00200074006f006f006c00730100000000ffffffff000000000000000000000014004500640069007400200054006f006f006c00730100000040ffffffff000000000000000000000022004e006500770020006e006f00740065002000730065007400740069006e006700730100000099ffffffff000000000000000000000002000000030000002a005100750061006e007400690073006100740069006f006e002000730065007400740069006e0067007301000000000000024a000000000000000000000012007400720061006e00730070006f00720074010000024a000000fc00000000000000000000000a00700061006e0069006301000003460000011f0000000000000000 + 0 + 875 + 464 + 000000ff00000000fd000000000000036b000001a400000004000000040000000800000008fc000000010000000200000004ffffffff0100000000ffffffff000000000000000000000014004500640069007400200054006f006f006c00730100000040ffffffff0000000000000000ffffffff0100000099ffffffff0000000000000000ffffffff01000000faffffffff0000000000000000 - - 600 - 400 + + 883 + 466 + 000000ff00000000fd0000000000000373000001a100000004000000040000000800000008fc0000000200000002000000030000001e00570061007600650020006500640069007400200074006f006f006c00730100000000ffffffff00000000000000000000001c0057006100760065004500640069007400200074006f006f006c007301000000400000023b000000000000000000000012007400720061006e00730070006f00720074010000027b0000003900000000000000000000000200000000 + + + 1 + 0 + 100 + + + 1 + 0 + 100 + + + 1 + 90 + 0 + 3 + 0 + 1 + + + 1 + + + 1 + + + 1 + 384 + + + 1 + 0 + + + 1 + 0 + + + + 1 0 0 0 @@ -282,8 +428,9 @@ 0 0 0 - 0 + 6144 1 + 44100 Track 1 0 @@ -296,9 +443,8 @@ 1 0 0 - 65535 - 65535 0 + 1 0 0 0 @@ -317,9 +463,8 @@ 0 0 0 - 65535 - 65535 0 + 1 0 0 0 @@ -338,9 +483,8 @@ 0 0 0 - 65535 - 65535 0 + 1 0 0 0 @@ -359,9 +503,8 @@ 0 0 0 - 65535 - 65535 0 + 1 0 0 0 @@ -380,9 +523,8 @@ 0 0 9 - 65535 - 65535 0 + 1 0 0 0 @@ -390,6 +532,46 @@ 100 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 @@ -403,7 +585,15 @@ 4 + + + 0 + 1 + + + + -- cgit v1.2.3 From 0ec95d49a1cdf886fc44f98f68adc703ca65b3ee Mon Sep 17 00:00:00 2001 From: Robert Jonsson Date: Sat, 21 May 2011 23:16:32 +0000 Subject: added midi clef in track list + right click menu to select columns in track list --- muse2/muse/arranger/arranger.cpp | 4 ++ muse2/muse/arranger/tlist.cpp | 39 +++++++++++++ muse2/muse/arranger/tlist.h | 1 + muse2/muse/midiedit/scoreedit.h | 3 + muse2/muse/track.cpp | 5 ++ muse2/muse/track.h | 5 ++ muse2/muse/widgets/header.cpp | 119 +++++++++++++++++++++++++++----------- muse2/muse/widgets/header.h | 4 ++ muse2/share/templates/audio.med | 2 +- muse2/share/templates/default.med | 2 +- muse2/share/templates/midiGM.med | 2 +- muse2/share/templates/synti.med | 2 +- 12 files changed, 149 insertions(+), 39 deletions(-) (limited to 'muse2/share/templates/midiGM.med') 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 #include +#include //--------------------------------------------------------- // 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("", name()); xml.put("", 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 +#include 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 @@ 1 298 298 -
7 6 5 4 3 2 1 0 8
+
9 8 7 6 5 4 3 2 1 0
0 266 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 @@ 1 418 456 -
8 7 6 5 4 3 2 1 0
+
9 8 7 6 5 4 3 2 1 0
0 266 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 @@ 1 298 298 -
7 6 5 4 3 2 1 0 8
+
9 8 7 6 5 4 3 2 1 0
0 266 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 @@ 0 298 298 -
7 6 5 4 3 2 1 0 8
+
9 8 7 6 5 4 3 2 1 0
0 266 -- cgit v1.2.3