void InspectorTimeSig::setElement() { InspectorElementBase::setElement(); TimeSig* ts = toTimeSig(inspector->element()); if (ts->generated()) t.showCourtesy->setEnabled(false); }
void ScoreView::createElementPropertyMenu(Element* e, QMenu* popup) { if (e->type() == Element::BAR_LINE) { genPropertyMenu1(e, popup); } else if (e->type() == Element::ARTICULATION) { genPropertyMenu1(e, popup); popup->addAction(tr("Articulation Properties..."))->setData("a-props"); } else if (e->type() == Element::BEAM) { popup->addAction(getAction("flip")); } else if (e->type() == Element::STEM) { popup->addAction(getAction("flip")); } else if (e->type() == Element::HOOK) { popup->addAction(getAction("flip")); } else if (e->type() == Element::BEND) { genPropertyMenu1(e, popup); popup->addAction(tr("Bend Properties..."))->setData("b-props"); } else if (e->type() == Element::TREMOLOBAR) { genPropertyMenu1(e, popup); popup->addAction(tr("TremoloBar Properties..."))->setData("tr-props"); } else if (e->type() == Element::HBOX) { QMenu* textMenu = popup->addMenu(tr("Add")); textMenu->addAction(getAction("frame-text")); textMenu->addAction(getAction("picture")); popup->addAction(tr("Frame Properties..."))->setData("f-props"); } else if (e->type() == Element::VBOX) { QMenu* textMenu = popup->addMenu(tr("Add")); textMenu->addAction(getAction("frame-text")); textMenu->addAction(getAction("title-text")); textMenu->addAction(getAction("subtitle-text")); textMenu->addAction(getAction("composer-text")); textMenu->addAction(getAction("poet-text")); textMenu->addAction(getAction("insert-hbox")); textMenu->addAction(getAction("picture")); popup->addAction(tr("Frame Properties..."))->setData("f-props"); } else if (e->type() == Element::TBOX) { popup->addAction(tr("Frame Properties..."))->setData("f-props"); } else if (e->type() == Element::VOLTA_SEGMENT) { genPropertyMenu1(e, popup); popup->addAction(tr("Volta Properties..."))->setData("v-props"); } else if (e->type() == Element::TIMESIG) { genPropertyMenu1(e, popup); TimeSig* ts = static_cast<TimeSig*>(e); int _track = ts->track(); // if the time sig. is not generated (= not courtesy) and is in track 0 // add the specific menu item QAction* a; if (!ts->generated() && !_track) { a = popup->addAction(ts->showCourtesySig() ? QT_TRANSLATE_NOOP("TimeSig", "Hide Courtesy Time Signature") : QT_TRANSLATE_NOOP("TimeSig", "Show Courtesy Time Signature") ); a->setData("ts-courtesy"); } popup->addSeparator(); popup->addAction(tr("Time Signature Properties..."))->setData("ts-props"); } else if (e->type() == Element::ACCIDENTAL) { Accidental* acc = static_cast<Accidental*>(e); genPropertyMenu1(e, popup); QAction* a = popup->addAction(QT_TRANSLATE_NOOP("Properties", "small")); a->setCheckable(true); a->setChecked(acc->small()); a->setData("smallAcc"); } else if (e->type() == Element::CLEF) { genPropertyMenu1(e, popup); // if the clef is not generated (= not courtesy) add the specific menu item if (!e->generated()) { QAction* a = popup->addAction(static_cast<Clef*>(e)->showCourtesy() ? QT_TRANSLATE_NOOP("Clef", "Hide courtesy clef") : QT_TRANSLATE_NOOP("Clef", "Show courtesy clef") ); a->setData("clef-courtesy"); } } else if (e->type() == Element::DYNAMIC) { popup->addSeparator(); if (e->visible()) popup->addAction(tr("Set Invisible"))->setData("invisible"); else popup->addAction(tr("Set Visible"))->setData("invisible"); popup->addAction(tr("MIDI Properties..."))->setData("d-dynamics"); popup->addAction(tr("Text Properties..."))->setData("d-props"); } else if (e->type() == Element::TEXTLINE_SEGMENT || e->type() == Element::OTTAVA_SEGMENT || e->type() == Element::VOLTA_SEGMENT || e->type() == Element::PEDAL_SEGMENT) { if (e->visible()) popup->addAction(tr("Set Invisible"))->setData("invisible"); else popup->addAction(tr("Set Visible"))->setData("invisible"); popup->addAction(tr("Line Properties..."))->setData("l-props"); } else if (e->type() == Element::STAFF_TEXT) { genPropertyMenuText(e, popup); popup->addAction(tr("Staff Text Properties..."))->setData("st-props"); } else if (e->type() == Element::TEXT || e->type() == Element::FINGERING || e->type() == Element::LYRICS || e->type() == Element::FIGURED_BASS) { genPropertyMenuText(e, popup); } else if (e->type() == Element::TEMPO_TEXT) { genPropertyMenu1(e, popup); popup->addAction(tr("Tempo Properties..."))->setData("tempo-props"); popup->addAction(tr("Text Properties..."))->setData("text-props"); } else if (e->type() == Element::KEYSIG) { genPropertyMenu1(e, popup); KeySig* ks = static_cast<KeySig*>(e); if (!e->generated()) { QAction* a = popup->addAction(ks->showCourtesy() ? QT_TRANSLATE_NOOP("KeySig", "Hide Courtesy Key Signature") : QT_TRANSLATE_NOOP("KeySig", "Show Courtesy Key Signature") ); a->setData("key-courtesy"); a = popup->addAction(ks->showNaturals() ? QT_TRANSLATE_NOOP("KeySig", "Hide Naturals") : QT_TRANSLATE_NOOP("KeySig", "Show Naturals") ); a->setData("key-naturals"); } } else if (e->type() == Element::STAFF_STATE && static_cast<StaffState*>(e)->staffStateType() == STAFF_STATE_INSTRUMENT) { popup->addAction(tr("Change Instrument Properties..."))->setData("ss-props"); } else if (e->type() == Element::SLUR_SEGMENT) { genPropertyMenu1(e, popup); popup->addAction(tr("Edit Mode"))->setData("edit"); popup->addAction(tr("Slur Properties..."))->setData("slur-props"); } else if (e->type() == Element::REST) { genPropertyMenu1(e, popup); } else if (e->type() == Element::NOTE) { QAction* b = popup->actions()[0]; QAction* a = popup->insertSeparator(b); a->setText(tr("Staff")); a = new QAction(tr("Staff Properties..."), 0); a->setData("staff-props"); popup->insertAction(b, a); a = popup->insertSeparator(b); a->setText(tr("Measure")); a = new QAction(tr("Measure Properties..."), 0); a->setData("measure-props"); popup->insertAction(b, a); genPropertyMenu1(e, popup); popup->addSeparator(); popup->addAction(tr("Style..."))->setData("style"); popup->addAction(tr("Chord Articulation..."))->setData("articulation"); } else if (e->type() == Element::LAYOUT_BREAK && static_cast<LayoutBreak*>(e)->layoutBreakType() == LAYOUT_BREAK_SECTION) { popup->addAction(tr("Section Break Properties..."))->setData("break-props"); } else if (e->type() == Element::INSTRUMENT_CHANGE) { genPropertyMenu1(e, popup); popup->addAction(tr("Change Instrument..."))->setData("ch-instr"); } else if (e->type() == Element::FRET_DIAGRAM) { if (e->visible()) popup->addAction(tr("Set Invisible"))->setData("invisible"); else popup->addAction(tr("Set Visible"))->setData("invisible"); popup->addAction(tr("Color..."))->setData("color"); popup->addAction(tr("Fret Diagram Properties..."))->setData("fret-props"); } else if (e->type() == Element::GLISSANDO) { genPropertyMenu1(e, popup); popup->addAction(tr("Glissando Properties..."))->setData("gliss-props"); } else if (e->type() == Element::HAIRPIN_SEGMENT) { QAction* a = popup->addSeparator(); a->setText(tr("Dynamics")); if (e->visible()) a = popup->addAction(tr("Set Invisible")); else a = popup->addAction(tr("Set Visible")); a->setData("invisible"); popup->addAction(tr("Hairpin Properties..."))->setData("hp-props"); } else if (e->type() == Element::HARMONY) { genPropertyMenu1(e, popup); popup->addSeparator(); popup->addAction(tr("Harmony Properties..."))->setData("ha-props"); popup->addAction(tr("Text Properties..."))->setData("text-props"); } else if (e->type() == Element::INSTRUMENT_NAME) { popup->addAction(tr("Staff Properties..."))->setData("staff-props"); } else genPropertyMenu1(e, popup); }