From 0cd8973b68235867309c9c62b735dbdb53d60d01 Mon Sep 17 00:00:00 2001 From: Werner Schweer Date: Wed, 22 Aug 2012 09:32:58 +0200 Subject: [PATCH] new wizard: don't create instrument names if only one part --- libmscore/event.h | 1 - mscore/newwizard.cpp | 24 ++++++++++++++++++------ mscore/palette.cpp | 1 - 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/libmscore/event.h b/libmscore/event.h index e6358c917d..d052996fe4 100644 --- a/libmscore/event.h +++ b/libmscore/event.h @@ -140,7 +140,6 @@ class Event { Event& operator=(const Event&); bool operator==(const Event&) const; -// void write(MidiFile*) const; void write(Xml&) const; void dump() const; diff --git a/mscore/newwizard.cpp b/mscore/newwizard.cpp index 19d3e7be60..2165999e73 100644 --- a/mscore/newwizard.cpp +++ b/mscore/newwizard.cpp @@ -122,7 +122,7 @@ void InstrumentWizard::on_partiturList_itemSelectionChanged() } QTreeWidgetItem* item = wi.front(); bool flag = item != 0; - + int count = 0; // item can be hidden QTreeWidgetItem* it = 0; QList witems; @@ -142,12 +142,12 @@ void InstrumentWizard::on_partiturList_itemSelectionChanged() } } } - - bool onlyOne = (count == 1); + + bool onlyOne = (count == 1); bool onlyOneStaff = ((item->type() == STAFF_LIST_ITEM) && onlyOne); bool first = (witems.first() == item); bool last = (witems.last() == item); - + removeButton->setEnabled(flag && !onlyOneStaff); upButton->setEnabled(flag && !onlyOne && !first); downButton->setEnabled(flag && !onlyOne && !last); @@ -434,7 +434,7 @@ void InstrumentWizard::createInstruments(Score* cs) dst.push_back(sli->staff); } } -#if 1 + // // check for bar lines // @@ -453,7 +453,19 @@ void InstrumentWizard::createInstruments(Score* cs) staffIdx = nstaffIdx; } -#endif + + // + // remove instrument names if only one part + // + if (cs->parts().size() == 1) { + Part* part = cs->parts().front(); + if (part->instrList()->size() == 1) { + Instrument& instrument = part->instrList()->instrument(0); + instrument.setShortName(QTextDocumentFragment()); + instrument.setLongName(QTextDocumentFragment()); + } + } + cs->setLayoutAll(true); } diff --git a/mscore/palette.cpp b/mscore/palette.cpp index a60cb473b8..260a9a52cb 100644 --- a/mscore/palette.cpp +++ b/mscore/palette.cpp @@ -1177,7 +1177,6 @@ void Palette::read(QDomElement e) element->read(ee); if (element->type() == ICON) { Icon* icon = static_cast(element); - // Shortcut* s = getShortcut(icon->action()); QIcon qicon(getAction(icon->action())->icon()); icon->setAction(icon->action(), qicon); }