diff options
Diffstat (limited to 'muse2')
-rw-r--r-- | muse2/ChangeLog | 3 | ||||
-rw-r--r-- | muse2/muse/arranger/tlist.cpp | 4 | ||||
-rw-r--r-- | muse2/muse/widgets/header.cpp | 56 | ||||
-rw-r--r-- | muse2/muse/widgets/visibletracks.cpp | 2 |
4 files changed, 43 insertions, 22 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog index 57147fc6..92108489 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,3 +1,6 @@ +28.05.2011: + - fixed dragging and resizing of track header, also changed default index of new + sections, they should appear last now (rj) 27.05.2011: - fixed bug in scoreeditor: invalid Part*s are now not used any more (flo93) - applied some hunks of the patch sent in by WillyFoobar (flo93) diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp index 9e4db5ba..bd58ad88 100644 --- a/muse2/muse/arranger/tlist.cpp +++ b/muse2/muse/arranger/tlist.cpp @@ -231,13 +231,15 @@ void TList::paint(const QRect& r) switch (section) { case COL_RECORD: - if (track->canRecord()) { + if (track->canRecord() && !header->isSectionHidden(COL_RECORD)) { drawCenteredPixmap(p, track->recordFlag() ? record_on_Icon : record_off_Icon, r); } break; case COL_CLASS: { + if (header->isSectionHidden(COL_CLASS)) + break; const QPixmap* pm = 0; switch(type) { case Track::MIDI: diff --git a/muse2/muse/widgets/header.cpp b/muse2/muse/widgets/header.cpp index 61ebcc74..c12c8eaf 100644 --- a/muse2/muse/widgets/header.cpp +++ b/muse2/muse/widgets/header.cpp @@ -29,21 +29,34 @@ void Header::readStatus(Xml& xml) 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; - } + 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); + moveSection(section, index); + if (isHidden) + hideSection(logialIdx-1); + else + showSection(logialIdx); + --index; + } + + // loop again looking for missing indexes + for (int i =0; i < count(); i++) { + bool foundIt=false; + for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + int id=((*it).toInt()); + if ( id == i || i ==1-id ) + foundIt=true; + } + if (foundIt == false) { + int section = visualIndex(i); + moveSection(section, i); + //printf("Adding missing i %d index %d section %d!\n", i, index, section); + } + } } break; case Xml::TagStart: @@ -66,10 +79,10 @@ 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; + int n = count(); for (int i = n; i >= 0; --i) { if (isSectionHidden(logicalIndex(i))) - xml.nput("%d ", -logicalIndex(i)); // hidden is stored as negative value + xml.nput("%d ", -logicalIndex(i)-1); // hidden is stored as negative value starting from -1 else xml.nput("%d ", logicalIndex(i)); } @@ -88,7 +101,7 @@ Header::Header(QWidget* parent, const char* name) itemModel = new QStandardItemModel; setModel(itemModel); setDefaultSectionSize(30); -// setStretchLastSection(true); + setStretchLastSection(true); } @@ -134,7 +147,7 @@ void Header::mousePressEvent ( QMouseEvent * e ) p->setTitle(tr("Track Info Columns")); QAction* act = 0; - for(int i=1; i < count(); i++) { + for(int i=0; i < count(); i++) { act = p->addAction(itemModel->horizontalHeaderItem(logicalIndex(i))->text() + "\t - "+ itemModel->horizontalHeaderItem(logicalIndex(i))->toolTip()); @@ -147,8 +160,11 @@ void Header::mousePressEvent ( QMouseEvent * e ) p->exec(QCursor::pos()); delete p; - + return; } + + QHeaderView::mousePressEvent(e); + } void Header::changeColumns(QAction *a) { diff --git a/muse2/muse/widgets/visibletracks.cpp b/muse2/muse/widgets/visibletracks.cpp index e261c274..f6acf206 100644 --- a/muse2/muse/widgets/visibletracks.cpp +++ b/muse2/muse/widgets/visibletracks.cpp @@ -87,7 +87,7 @@ void VisibleTracks::updateVisibleTracksButtons() void VisibleTracks::visibilityChanged(QAction* action) { - printf("update visibility\n"); +// printf("update visibility\n"); switch (((Action*)action)->id()) { case 0: WaveTrack::setVisible(action->isChecked()); |