Palette* MuseScore::newNoteHeadsPalette() { Palette* sp = new Palette; sp->setName(QT_TRANSLATE_NOOP("Palette", "Note Heads")); sp->setMag(1.3); sp->setGrid(33, 36); sp->setDrawGrid(true); for (int i = 0; i < int(NoteHead::Group::HEAD_GROUPS); ++i) { SymId sym = Note::noteHead(0, NoteHead::Group(i), NoteHead::Type::HEAD_HALF); // HEAD_BREVIS_ALT shows up only for brevis value if (i == int(NoteHead::Group::HEAD_BREVIS_ALT) ) sym = Note::noteHead(0, NoteHead::Group(i), NoteHead::Type::HEAD_BREVIS); NoteHead* nh = new NoteHead(gscore); nh->setSym(sym); sp->append(nh, Sym::id2userName(sym)); } Icon* ik = new Icon(gscore); ik->setIconType(IconType::BRACKETS); Shortcut* s = Shortcut::getShortcut("add-brackets"); QAction* action = s->action(); QIcon icon(action->icon()); ik->setAction("add-brackets", icon); sp->append(ik, s->help()); return sp; }
void populateIconPalette(Palette* p, const IconAction* a) { while (a->subtype != IconType::NONE) { Icon* ik = new Icon(gscore); ik->setIconType(a->subtype); Shortcut* s = Shortcut::getShortcut(a->action); QAction* action = s->action(); QIcon icon(action->icon()); ik->setAction(a->action, icon); p->append(ik, s->help()); ++a; } }
Palette* MuseScore::newAccidentalsPalette(bool basic) { Palette* sp = new Palette; sp->setName(QT_TRANSLATE_NOOP("Palette", "Accidentals")); sp->setGrid(33, 36); sp->setDrawGrid(true); if (basic) { static AccidentalType types[] = { AccidentalType::NONE, AccidentalType::SHARP, AccidentalType::FLAT, AccidentalType::SHARP2, AccidentalType::FLAT2, AccidentalType::NATURAL }; for (auto i : types) { Accidental* s = new Accidental(gscore); s->setAccidentalType(AccidentalType(i)); sp->append(s, qApp->translate("accidental", s->subtypeUserName())); } } else { for (int i = int(AccidentalType::SHARP); i < int(AccidentalType::END); ++i) { Accidental* s = new Accidental(gscore); s->setAccidentalType(AccidentalType(i)); if (s->symbol() != SymId::noSym) sp->append(s, qApp->translate("accidental", s->subtypeUserName())); else delete s; } } Icon* ik = new Icon(gscore); ik->setIconType(IconType::BRACKETS); const Shortcut* s = Shortcut::getShortcut("add-brackets"); QAction* action = s->action(); QIcon icon(action->icon()); ik->setAction("add-brackets", icon); sp->append(ik, s->help()); return sp; }