1 //=============================================================================
2 //  MuseScore
3 //  Music Composition & Notation
4 //
5 //  Copyright (C) 2011-2016 Werner Schweer
6 //
7 //  This program is free software; you can redistribute it and/or modify
8 //  it under the terms of the GNU General Public License version 2
9 //  as published by the Free Software Foundation and appearing in
10 //  the file LICENSE.GPL
11 //=============================================================================
12 
13 #include "inspector.h"
14 #include "inspectorTextBase.h"
15 #include "inspectorBeam.h"
16 #include "inspectorImage.h"
17 #include "inspectorLasso.h"
18 #include "inspectorGroupElement.h"
19 #include "inspectorVolta.h"
20 #include "inspectorOttava.h"
21 #include "inspectorTrill.h"
22 #include "inspectorHairpin.h"
23 #include "inspectorTextLine.h"
24 #include "inspectorMarker.h"
25 #include "inspectorJump.h"
26 #include "inspectorGlissando.h"
27 #include "inspectorArpeggio.h"
28 #include "inspectorNote.h"
29 #include "inspectorAmbitus.h"
30 #include "inspectorFret.h"
31 #include "inspectorText.h"
32 #include "inspectorBarline.h"
33 #include "inspectorFingering.h"
34 #include "inspectorDynamic.h"
35 #include "inspectorHarmony.h"
36 #include "inspectorLetRing.h"
37 #include "inspectorPedal.h"
38 #include "inspectorPalmMute.h"
39 #include "inspectorVibrato.h"
40 #include "inspectorNoteDot.h"
41 #include "inspectorInstrchange.h"
42 #include "inspectorMeasureNumber.h"
43 #include "inspectorBend.h"
44 #include "inspectorTremoloBar.h"
45 #include "musescore.h"
46 #include "scoreview.h"
47 #include "icons.h"
48 
49 #include "libmscore/element.h"
50 #include "libmscore/score.h"
51 #include "libmscore/box.h"
52 #include "libmscore/undo.h"
53 #include "libmscore/spacer.h"
54 #include "libmscore/note.h"
55 #include "libmscore/chord.h"
56 #include "libmscore/segment.h"
57 #include "libmscore/rest.h"
58 #include "libmscore/beam.h"
59 #include "libmscore/clef.h"
60 #include "libmscore/notedot.h"
61 #include "libmscore/hook.h"
62 #include "libmscore/stem.h"
63 #include "libmscore/keysig.h"
64 #include "libmscore/timesig.h"
65 #include "libmscore/barline.h"
66 #include "libmscore/staff.h"
67 #include "libmscore/measure.h"
68 #include "libmscore/tuplet.h"
69 #include "libmscore/slur.h"
70 #include "libmscore/breath.h"
71 #include "libmscore/lyrics.h"
72 #include "libmscore/accidental.h"
73 #include "libmscore/articulation.h"
74 #include "libmscore/fermata.h"
75 #include "libmscore/stafftypechange.h"
76 #include "libmscore/mscore.h"
77 #include "libmscore/stafftextbase.h"
78 
79 namespace Ms {
80 
81 //---------------------------------------------------------
82 //   showInspector
83 //---------------------------------------------------------
84 
showInspector(bool visible)85 void MuseScore::showInspector(bool visible)
86       {
87       QAction* a = getAction("inspector");
88       if (!_inspector) {
89             _inspector = new Inspector();
90             connect(_inspector, SIGNAL(visibilityChanged(bool)), a, SLOT(setChecked(bool)));
91             addDockWidget(Qt::RightDockWidgetArea, _inspector);
92             }
93       if (_inspector)
94             reDisplayDockWidget(_inspector, visible);
95       if (visible)
96             updateInspector();
97       }
98 
99 //---------------------------------------------------------
100 //   Inspector
101 //---------------------------------------------------------
102 
Inspector(QWidget * parent)103 Inspector::Inspector(QWidget* parent)
104    : QDockWidget(parent)
105       {
106       setObjectName("inspector");
107       setAllowedAreas(Qt::DockWidgetAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea));
108       sa = new QScrollArea;
109       sa->setFrameShape(QFrame::NoFrame);
110       sa->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
111       sa->setWidgetResizable(true);
112 
113 //      setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
114 //      sa->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
115 
116       setWidget(sa);
117       sa->setFocusPolicy(Qt::NoFocus);
118 
119       _inspectorEdit = false;
120       ie             = 0;
121       oe             = 0;
122       oSameTypes     = true;
123       _score         = 0;
124 //      retranslate();
125       setWindowTitle(tr("Inspector"));
126       }
127 
128 //---------------------------------------------------------
129 //   retranslate
130 //---------------------------------------------------------
131 
retranslate()132 void Inspector::retranslate()
133       {
134       setWindowTitle(tr("Inspector"));
135       sa->setAccessibleName(tr("Inspector Subwindow"));
136       Score* s = _score;
137       update(0);
138       update(s);
139       }
140 
141 //---------------------------------------------------------
142 //   element
143 //---------------------------------------------------------
144 
element() const145 Element* Inspector::element() const
146       {
147       return el() && !el()->empty() ? (*el())[0] : 0;
148       }
149 
150 //---------------------------------------------------------
151 //   reset
152 //---------------------------------------------------------
153 
update()154 void Inspector::update()
155       {
156       update(_score);
157       }
158 
159 //---------------------------------------------------------
160 //   el
161 //---------------------------------------------------------
162 
el() const163 const QList<Element*>* Inspector::el() const
164       {
165       return _score ? &_score->selection().elements() : 0;
166       }
167 
168 //---------------------------------------------------------
169 //   update
170 //---------------------------------------------------------
171 
update(Score * s)172 void Inspector::update(Score* s)
173       {
174       if (_inspectorEdit)     // if within an inspector-originated edit
175             return;
176       _score = s;
177       bool sameTypes = true;
178       bool sameSubtypes = true;
179       if (el()) {
180             for (Element* ee : *el()) {
181                   if (((element()->type() != ee->type()) && // different and
182                       (!element()->isSystemText()     || !ee->isStaffText())  && // neither system text nor
183                       (!element()->isStaffText()      || !ee->isSystemText()) && // staff text either side and
184                       (!element()->isPedalSegment()   || !ee->isTextLineSegment()) && // neither pedal nor
185                       (!element()->isTextLineSegment()|| !ee->isPedalSegment())    && // text line either side and
186                       (!element()->isSlurTieSegment() || !ee->isSlurTieSegment())) || // neither Slur nor Tie either side, or
187                       (ee->isNote() && toNote(ee)->chord()->isGrace() != toNote(element())->chord()->isGrace())) // HACK
188                         {
189                         sameTypes = false;
190                         break;
191                         }
192                       // an articulation and an ornament
193                   if ((ee->isArticulation() && toArticulation(ee)->isOrnament() != toArticulation(element())->isOrnament()) ||
194                       // a slur and a tie
195                       (ee->isSlurTieSegment() && toSlurTieSegment(ee)->isSlurSegment() != toSlurTieSegment(element())->isSlurSegment()) ||
196                       // a breath and a caesura
197                       (ee->isBreath() && toBreath(ee)->isCaesura() != toBreath(element())->isCaesura()) ||
198                       // a staff text and a system text
199                       ((ee->isStaffText() || ee->isSystemText())
200                           && (ee->type() != element()->type() || ee->isSystemText() != element()->isSystemText())))
201                         sameSubtypes = false;
202                   }
203             }
204       if (oe != element() || oSameTypes != sameTypes || (sameTypes && !sameSubtypes)) {
205             delete ie;
206             ie  = 0;
207             oe  = element();
208             oSameTypes = sameTypes;
209             if (!element())
210                   ie = new InspectorEmpty(this);
211             else if (!sameTypes)
212                   ie = new InspectorGroupElement(this);
213             else {
214                   switch (element()->type()) {
215                         case ElementType::FBOX:
216                         case ElementType::VBOX:
217                               ie = new InspectorVBox(this);
218                               break;
219                         case ElementType::TBOX:
220                               ie = new InspectorTBox(this);
221                               break;
222                         case ElementType::HBOX:
223                               ie = new InspectorHBox(this);
224                               break;
225                         case ElementType::ARTICULATION:
226                               ie = new InspectorArticulation(this);
227                               break;
228                         case ElementType::FERMATA:
229                               ie = new InspectorFermata(this);
230                               break;
231                         case ElementType::SPACER:
232                               ie = new InspectorSpacer(this);
233                               break;
234                         case ElementType::NOTE:
235                               ie = new InspectorNote(this);
236                               break;
237                         case ElementType::ACCIDENTAL:
238                               ie = new InspectorAccidental(this);
239                               break;
240                         case ElementType::REST:
241                               if (toRest(element())->measure()->isMMRest())
242                                     ie = new InspectorMMRest(this);
243                               else
244                                     ie = new InspectorRest(this);
245                               break;
246                         case ElementType::CLEF:
247                               ie = new InspectorClef(this);
248                               break;
249                         case ElementType::TIMESIG:
250                               ie = new InspectorTimeSig(this);
251                               break;
252                         case ElementType::KEYSIG:
253                               ie = new InspectorKeySig(this);
254                               break;
255                         case ElementType::TUPLET:
256                               ie = new InspectorTuplet(this);
257                               break;
258                         case ElementType::BEAM:
259                               ie = new InspectorBeam(this);
260                               break;
261                         case ElementType::IMAGE:
262                               ie = new InspectorImage(this);
263                               break;
264                         case ElementType::LASSO:
265                               ie = new InspectorLasso(this);
266                               break;
267                         case ElementType::VOLTA_SEGMENT:
268                               ie = new InspectorVolta(this);
269                               break;
270                         case ElementType::OTTAVA_SEGMENT:
271                               ie = new InspectorOttava(this);
272                               break;
273                         case ElementType::TRILL_SEGMENT:
274                               ie = new InspectorTrill(this);
275                               break;
276                         case ElementType::HAIRPIN_SEGMENT:
277                               ie = new InspectorHairpin(this);
278                               break;
279                         case ElementType::TEXTLINE_SEGMENT:
280                               ie = new InspectorTextLine(this);
281                               break;
282                         case ElementType::PEDAL_SEGMENT:
283                               ie = new InspectorPedal(this);
284                               break;
285                         case ElementType::LET_RING_SEGMENT:
286                               ie = new InspectorLetRing(this);
287                               break;
288                         case ElementType::PALM_MUTE_SEGMENT:
289                               ie = new InspectorPalmMute(this);
290                               break;
291                         case ElementType::SLUR_SEGMENT:
292                         case ElementType::TIE_SEGMENT:
293                               ie = new InspectorSlurTie(this);
294                               break;
295                         case ElementType::BAR_LINE:
296                               ie = new InspectorBarLine(this);
297                               break;
298                         case ElementType::JUMP:
299                               ie = new InspectorJump(this);
300                               break;
301                         case ElementType::MARKER:
302                               ie = new InspectorMarker(this);
303                               break;
304                         case ElementType::GLISSANDO:
305                         case ElementType::GLISSANDO_SEGMENT:
306                               ie = new InspectorGlissando(this);
307                               break;
308                         case ElementType::TEMPO_TEXT:
309                               ie = new InspectorTempoText(this);
310                               break;
311                         case ElementType::DYNAMIC:
312                               ie = new InspectorDynamic(this);
313                               break;
314                         case ElementType::AMBITUS:
315                               ie = new InspectorAmbitus(this);
316                               break;
317                         case ElementType::FRET_DIAGRAM:
318                               ie = new InspectorFretDiagram(this);
319                               break;
320                         case ElementType::LAYOUT_BREAK:
321                               if (toLayoutBreak(element())->layoutBreakType() == LayoutBreak::Type::SECTION)
322                                     ie = new InspectorSectionBreak(this);
323 #if 0 // currently empty and such not needed
324                               else
325                                     ie = new InspectorBreak(this);
326 #endif
327                               break;
328                         case ElementType::BEND:
329                               ie = new InspectorBend(this);
330                               break;
331                         case ElementType::TREMOLO:
332                               if (toTremolo(element())->customStyleApplicable())
333                                     ie = new InspectorTremolo(this);
334                               else
335                                     ie = new InspectorElement(this);
336                               break;
337                         case ElementType::TREMOLOBAR:
338                               ie = new InspectorTremoloBar(this);
339                               break;
340                         case ElementType::ARPEGGIO:
341                               ie = new InspectorArpeggio(this);
342                               break;
343                         case ElementType::BREATH:
344                               ie = new InspectorCaesura(this);
345                               break;
346                         case ElementType::LYRICS:
347                               ie = new InspectorLyric(this);
348                               break;
349                         case ElementType::STAFF_TEXT:
350                         case ElementType::SYSTEM_TEXT:
351                         case ElementType::REHEARSAL_MARK:
352                               ie = new InspectorStaffText(this);
353                               break;
354                         case ElementType::INSTRUMENT_CHANGE:
355                               ie = new InspectorInstrumentChange(this);
356                               break;
357                         case ElementType::MEASURE_NUMBER:
358                         case ElementType::MMREST_RANGE:
359                               ie = new InspectorMeasureNumber(this);
360                               break;
361                         case ElementType::STAFFTYPE_CHANGE:
362                               ie = new InspectorStaffTypeChange(this);
363                               break;
364                         case ElementType::BRACKET:
365                               ie = new InspectorBracket(this);
366                               break;
367                         case ElementType::INSTRUMENT_NAME:
368                               //ie = new InspectorIname(this);
369                               break;
370                         case ElementType::FINGERING:
371                               ie = new InspectorFingering(this);
372                               break;
373                         case ElementType::STICKING:
374                               ie = new InspectorText(this); // TODO: add a separate inspector for sticking?
375                               break;
376                         case ElementType::STEM:
377                               ie = new InspectorStem(this);
378                               break;
379                         case ElementType::HARMONY:
380                               ie = new InspectorHarmony(this);
381                               break;
382                         case ElementType::VIBRATO_SEGMENT:
383                               ie = new InspectorVibrato(this);
384                               break;
385                         case ElementType::NOTEDOT:
386                               ie = new InspectorNoteDot(this);
387                               break;
388                         default:
389                               if (element()->isText()) {
390                                     // don't allow footers/headers to be edited via the inspector
391                                     if (toText(element())->tid() != Tid::FOOTER && toText(element())->tid() != Tid::HEADER)
392                                           ie = new InspectorText(this);
393                                     else
394                                           ie = new InspectorEmpty(this);
395                                     }
396                               else {
397                                     ie = new InspectorElement(this);
398                                     }
399                               break;
400                         }
401                   }
402             connect(ie, &InspectorBase::elementChanged, this, QOverload<>::of(&Inspector::update), Qt::QueuedConnection);
403             sa->setWidget(ie);      // will destroy previous set widget
404 
405             //focus policies were set by hand in each inspector_*.ui. this code just helps keeping them like they are
406             //also fixes mac problem. on Mac Qt::TabFocus doesn't work, but Qt::StrongFocus works
407             QList<QWidget*> widgets = ie->findChildren<QWidget*>();
408             for (int i = 0; i < widgets.size(); i++) {
409                   QWidget* currentWidget = widgets.at(i);
410                   switch (currentWidget->focusPolicy()) {
411                         case Qt::WheelFocus:
412                         case Qt::StrongFocus:
413                               if (currentWidget->inherits("QComboBox")                  ||
414                                   currentWidget->parent()->inherits("QAbstractSpinBox") ||
415                                   currentWidget->inherits("QAbstractSpinBox")           ||
416                                   currentWidget->inherits("QLineEdit")) ; //leave it like it is
417                               else
418                                    currentWidget->setFocusPolicy(Qt::TabFocus);
419                               break;
420                         case Qt::NoFocus:
421                         case Qt::ClickFocus:
422                                     currentWidget->setFocusPolicy(Qt::NoFocus);
423                               break;
424                         case Qt::TabFocus:
425                               break;
426                         }
427                   }
428             }
429       if (ie)
430             ie->setElement();
431       }
432 
433 //---------------------------------------------------------
434 //   changeEvent
435 //---------------------------------------------------------
436 
changeEvent(QEvent * event)437 void Inspector::changeEvent(QEvent *event)
438       {
439       QDockWidget::changeEvent(event);
440       if (event->type() == QEvent::LanguageChange)
441             retranslate();
442       }
443 
444 //---------------------------------------------------------
445 //   setupUi
446 //---------------------------------------------------------
447 
setupUi(QWidget * inspectorElement)448 void UiInspectorElement::setupUi(QWidget* inspectorElement)
449       {
450       Ui::InspectorElement::setupUi(inspectorElement);
451       }
452 
453 //---------------------------------------------------------
454 //   InspectorElement
455 //---------------------------------------------------------
456 
InspectorElement(QWidget * parent)457 InspectorElement::InspectorElement(QWidget* parent)
458    : InspectorElementBase(parent)
459       {
460       mapSignals();
461       }
462 
463 //---------------------------------------------------------
464 //   InspectorBreak
465 //---------------------------------------------------------
466 
InspectorBreak(QWidget * parent)467 InspectorBreak::InspectorBreak(QWidget* parent)
468    : InspectorBase(parent)
469       {
470       b.setupUi(addWidget());
471 
472       // currently empty
473       iList = {};
474       pList = { { b.title, b.panel } };
475       mapSignals();
476       }
477 
478 //---------------------------------------------------------
479 //   InspectorSectionBreak
480 //---------------------------------------------------------
481 
InspectorSectionBreak(QWidget * parent)482 InspectorSectionBreak::InspectorSectionBreak(QWidget* parent)
483    : InspectorBase(parent)
484       {
485       scb.setupUi(addWidget());
486 
487       iList = {
488             { Pid::PAUSE,                    0, scb.pause,                  scb.resetPause                  },
489             { Pid::START_WITH_LONG_NAMES,    0, scb.startWithLongNames,     scb.resetStartWithLongNames     },
490             { Pid::START_WITH_MEASURE_ONE,   0, scb.startWithMeasureOne,    scb.resetStartWithMeasureOne    },
491             { Pid::FIRST_SYSTEM_INDENTATION, 0, scb.firstSystemIndentation, scb.resetFirstSystemIndentation }
492             };
493       pList = { { scb.title, scb.panel } };
494       mapSignals();
495       }
496 
497 //---------------------------------------------------------
498 //   InspectorStaffTypeChange
499 //---------------------------------------------------------
500 
InspectorStaffTypeChange(QWidget * parent)501 InspectorStaffTypeChange::InspectorStaffTypeChange(QWidget* parent)
502    : InspectorBase(parent)
503       {
504       sl.setupUi(addWidget());
505 
506       iList = {
507             { Pid::STAFF_YOFFSET,          0, sl.yoffset,         sl.resetYoffset         },
508             { Pid::SMALL,                  0, sl.small,           sl.resetSmall           },
509             { Pid::MAG,                    0, sl.scale,           sl.resetScale           },
510             { Pid::STAFF_LINES,            0, sl.lines,           sl.resetLines           },
511             { Pid::STEP_OFFSET,            0, sl.stepOffset,      sl.resetStepOffset      },
512             { Pid::LINE_DISTANCE,          0, sl.lineDistance,    sl.resetLineDistance    },
513             { Pid::STAFF_SHOW_BARLINES,    0, sl.showBarlines,    sl.resetShowBarlines    },
514             { Pid::STAFF_SHOW_LEDGERLINES, 0, sl.showLedgerlines, sl.resetShowLedgerlines },
515             { Pid::STAFF_STEMLESS,         0, sl.stemless,        sl.resetStemless        },
516             { Pid::HEAD_SCHEME,            0, sl.noteheadScheme,  sl.resetNoteheadScheme  },
517             { Pid::STAFF_GEN_CLEF,         0, sl.genClefs,        sl.resetGenClefs        },
518             { Pid::STAFF_GEN_TIMESIG,      0, sl.genTimesig,      sl.resetGenTimesig      },
519             { Pid::STAFF_GEN_KEYSIG,       0, sl.genKeysig,       sl.resetGenKeysig       },
520             { Pid::STAFF_INVISIBLE,        0, sl.invisible,       sl.resetInvisible       },
521             { Pid::STAFF_COLOR,            0, sl.color,           sl.resetColor           },
522             };
523       pList = { { sl.title, sl.panel } };
524 
525       sl.noteheadScheme->clear();
526       for (auto i : { NoteHead::Scheme::HEAD_NORMAL,
527          NoteHead::Scheme::HEAD_PITCHNAME,
528          NoteHead::Scheme::HEAD_PITCHNAME_GERMAN,
529          NoteHead::Scheme::HEAD_SOLFEGE,
530          NoteHead::Scheme::HEAD_SOLFEGE_FIXED,
531          NoteHead::Scheme::HEAD_SHAPE_NOTE_4,
532          NoteHead::Scheme::HEAD_SHAPE_NOTE_7_AIKIN,
533          NoteHead::Scheme::HEAD_SHAPE_NOTE_7_FUNK,
534          NoteHead::Scheme::HEAD_SHAPE_NOTE_7_WALKER} ) {
535             sl.noteheadScheme->addItem(NoteHead::scheme2userName(i), int(i));
536             }
537       mapSignals();
538       }
539 
540 //---------------------------------------------------------
541 //   setElement
542 //---------------------------------------------------------
543 
setElement()544 void InspectorStaffTypeChange::setElement()
545       {
546       InspectorBase::setElement();
547       bool hasTabStaff = false;
548       bool hasNonTabStaff = false;
549       for (Element* ee : *(inspector->el())) {
550             StaffTypeChange* stc = toStaffTypeChange(ee);
551             // tab staff shouldn't have key signature
552             if (stc->staffType()->group() == StaffGroup::TAB) {
553                   hasTabStaff = true;
554                   sl.genKeysig->setEnabled(false);
555                   sl.resetGenKeysig->setEnabled(false);
556                   }
557             else {
558                   hasNonTabStaff = true;
559                   }
560             }
561       if (hasTabStaff && !hasNonTabStaff)
562             sl.genKeysig->setChecked(false);
563       }
564 
565 //---------------------------------------------------------
566 //   InspectorVBox
567 //---------------------------------------------------------
568 
InspectorVBox(QWidget * parent)569 InspectorVBox::InspectorVBox(QWidget* parent)
570    : InspectorBase(parent)
571       {
572       vb.setupUi(addWidget());
573 
574       iList = {
575             { Pid::TOP_GAP,       0, vb.topGap,       vb.resetTopGap       },
576             { Pid::BOTTOM_GAP,    0, vb.bottomGap,    vb.resetBottomGap    },
577             { Pid::LEFT_MARGIN,   0, vb.leftMargin,   vb.resetLeftMargin   },
578             { Pid::RIGHT_MARGIN,  0, vb.rightMargin,  vb.resetRightMargin  },
579             { Pid::TOP_MARGIN,    0, vb.topMargin,    vb.resetTopMargin    },
580             { Pid::BOTTOM_MARGIN, 0, vb.bottomMargin, vb.resetBottomMargin },
581             { Pid::BOX_HEIGHT,    0, vb.height,       0                    },
582             { Pid::BOX_AUTOSIZE,  0, vb.enableAutoSize, vb.resetAutoSize   }
583             };
584       pList = { { vb.title, vb.panel } };
585       mapSignals();
586       }
587 
588 //---------------------------------------------------------
589 //   InspectorTBox
590 //---------------------------------------------------------
591 
InspectorTBox(QWidget * parent)592 InspectorTBox::InspectorTBox(QWidget* parent)
593    : InspectorBase(parent)
594       {
595       tb.setupUi(addWidget());
596 
597       iList = {
598             { Pid::TOP_GAP,       0, tb.topGap,       tb.resetTopGap       },
599             { Pid::BOTTOM_GAP,    0, tb.bottomGap,    tb.resetBottomGap    },
600             { Pid::LEFT_MARGIN,   0, tb.leftMargin,   tb.resetLeftMargin   },
601             { Pid::RIGHT_MARGIN,  0, tb.rightMargin,  tb.resetRightMargin  },
602             { Pid::TOP_MARGIN,    0, tb.topMargin,    tb.resetTopMargin    },
603             { Pid::BOTTOM_MARGIN, 0, tb.bottomMargin, tb.resetBottomMargin },
604             };
605       pList = { { tb.title, tb.panel } };
606       mapSignals();
607       }
608 
609 //---------------------------------------------------------
610 //   InspectorHBox
611 //---------------------------------------------------------
612 
InspectorHBox(QWidget * parent)613 InspectorHBox::InspectorHBox(QWidget* parent)
614    : InspectorBase(parent)
615       {
616       hb.setupUi(addWidget());
617 
618       iList = {
619             { Pid::TOP_GAP,               0, hb.leftGap,  hb.resetLeftGap  },
620             { Pid::BOTTOM_GAP,            0, hb.rightGap, hb.resetRightGap },
621             { Pid::BOX_WIDTH,             0, hb.width,    0                },
622             { Pid::CREATE_SYSTEM_HEADER,  0, hb.createSystemHeader, hb.resetCreateSystemHeader }
623             };
624       pList = { { hb.title, hb.panel } };
625       mapSignals();
626       }
627 
628 //---------------------------------------------------------
629 //   InspectorArticulation
630 //---------------------------------------------------------
631 
InspectorArticulation(QWidget * parent)632 InspectorArticulation::InspectorArticulation(QWidget* parent)
633    : InspectorElementBase(parent)
634       {
635       ar.setupUi(addWidget());
636 
637       Articulation* el = toArticulation(inspector->element());
638       bool sameTypes = true;
639 
640       for (const auto& ee : *inspector->el()) {
641             if (toArticulation(ee)->isOrnament() != el->isOrnament()) {
642                   sameTypes = false;
643                   break;
644                   }
645             }
646       if (sameTypes)
647             ar.title->setText(el->isOrnament() ? tr("Ornament") : tr("Articulation"));
648 
649       const std::vector<InspectorItem> iiList = {
650             { Pid::ARTICULATION_ANCHOR, 0, ar.anchor,           ar.resetAnchor           },
651             { Pid::DIRECTION,           0, ar.direction,        ar.resetDirection        },
652             { Pid::TIME_STRETCH,        0, ar.timeStretch,      ar.resetTimeStretch      },
653             { Pid::ORNAMENT_STYLE,      0, ar.ornamentStyle,    ar.resetOrnamentStyle    },
654             { Pid::PLAY,                0, ar.playArticulation, ar.resetPlayArticulation }
655             };
656       const std::vector<InspectorPanel> ppList = { { ar.title, ar.panel } };
657       mapSignals(iiList, ppList);
658       connect(ar.properties, SIGNAL(clicked()), SLOT(propertiesClicked()));
659       }
660 
661 //---------------------------------------------------------
662 //   propertiesClicked
663 //---------------------------------------------------------
664 
propertiesClicked()665 void InspectorArticulation::propertiesClicked()
666       {
667       Articulation* a = toArticulation(inspector->element());
668       Score* score = a->score();
669       score->startCmd();
670       mscore->currentScoreView()->editArticulationProperties(a);
671       a->triggerLayoutAll();
672       score->endCmd();
673       }
674 
675 //---------------------------------------------------------
676 //   setElement
677 //---------------------------------------------------------
678 
setElement()679 void InspectorArticulation::setElement()
680       {
681       InspectorElementBase::setElement();
682       if (!ar.playArticulation->isChecked())
683             ar.gridWidget->setEnabled(false);
684       }
685 
686 //---------------------------------------------------------
687 //   InspectorFermata
688 //---------------------------------------------------------
689 
InspectorFermata(QWidget * parent)690 InspectorFermata::InspectorFermata(QWidget* parent)
691    : InspectorElementBase(parent)
692       {
693       f.setupUi(addWidget());
694 
695       const std::vector<InspectorItem> iiList = {
696             { Pid::PLACEMENT,           0, f.placement,        f.resetPlacement        },
697             { Pid::TIME_STRETCH,        0, f.timeStretch,      f.resetTimeStretch      },
698             { Pid::PLAY,                0, f.playArticulation, f.resetPlayArticulation }
699             };
700       const std::vector<InspectorPanel> ppList = { { f.title, f.panel } };
701       mapSignals(iiList, ppList);
702       }
703 
704 //---------------------------------------------------------
705 //   setElement
706 //---------------------------------------------------------
707 
setElement()708 void InspectorFermata::setElement()
709       {
710       InspectorElementBase::setElement();
711       if (!f.playArticulation->isChecked()) {
712             f.labelTimeStretch->setEnabled(false);
713             f.timeStretch->setEnabled(false);
714             f.resetTimeStretch->setEnabled(false);
715             }
716       }
717 
718 //---------------------------------------------------------
719 //   InspectorSpacer
720 //---------------------------------------------------------
721 
InspectorSpacer(QWidget * parent)722 InspectorSpacer::InspectorSpacer(QWidget* parent)
723    : InspectorBase(parent)
724       {
725       sp.setupUi(addWidget());
726 
727       iList = {
728             { Pid::SPACE, 0, sp.height, 0 }
729             };
730       mapSignals();
731       }
732 
733 //---------------------------------------------------------
734 //   InspectorRest
735 //---------------------------------------------------------
736 
InspectorRest(QWidget * parent)737 InspectorRest::InspectorRest(QWidget* parent)
738    : InspectorElementBase(parent)
739       {
740       s.setupUi(addWidget());
741       r.setupUi(addWidget());
742 
743       const std::vector<InspectorItem> iiList = {
744             { Pid::LEADING_SPACE,  1, s.leadingSpace,  s.resetLeadingSpace  },
745             { Pid::SMALL,          0, r.small,         r.resetSmall         },
746             };
747       const std::vector<InspectorPanel> ppList = {
748             { s.title, s.panel },
749             { r.title, r.panel }
750             };
751       mapSignals(iiList, ppList);
752 
753       //
754       // Select
755       //
756       QLabel* l = new QLabel;
757       l->setText(tr("Select"));
758       QFont font(l->font());
759       font.setBold(true);
760       l->setFont(font);
761       l->setAlignment(Qt::AlignHCenter);
762       _layout->addWidget(l);
763 
764       QVBoxLayout* vbox = new QVBoxLayout;
765       vbox->setSpacing(3);
766       vbox->setContentsMargins(3,3,3,3);
767       _layout->addLayout(vbox);
768 
769       QHBoxLayout* hbox = new QHBoxLayout;
770       hbox->setSpacing(3);
771       dot1 = new QPushButton(this);
772       dot1->setText(tr("Dot 1"));
773       hbox->addWidget(dot1);
774       dot2 = new QPushButton(this);
775       dot2->setText(tr("Dot 2"));
776       hbox->addWidget(dot2);
777       dot3 = new QPushButton(this);
778       dot3->setText(tr("Dot 3"));
779       hbox->addWidget(dot3);
780       vbox->addLayout(hbox);
781 
782       hbox = new QHBoxLayout;
783       hbox->setSpacing(3);
784       dot4 = new QPushButton(this);
785       dot4->setText(tr("Dot 4"));
786       hbox->addWidget(dot4);
787       tuplet = new QPushButton(this);
788       tuplet->setText(tr("Tuplet"));
789       tuplet->setEnabled(false);
790       hbox->addWidget(tuplet);
791       vbox->addLayout(hbox);
792 
793 //TODO      e.offset->setSingleStep(1.0);        // step in spatium units
794 
795       connect(dot1,     SIGNAL(clicked()),     SLOT(dot1Clicked()));
796       connect(dot2,     SIGNAL(clicked()),     SLOT(dot2Clicked()));
797       connect(dot3,     SIGNAL(clicked()),     SLOT(dot3Clicked()));
798       connect(dot4,     SIGNAL(clicked()),     SLOT(dot4Clicked()));
799       connect(tuplet,   SIGNAL(clicked()),     SLOT(tupletClicked()));
800       }
801 
802 //---------------------------------------------------------
803 //   setElement
804 //---------------------------------------------------------
805 
setElement()806 void InspectorRest::setElement()
807       {
808       Rest* rest = toRest(inspector->element());
809       int dots = rest->dots();
810       dot1->setEnabled(dots > 0);
811       dot2->setEnabled(dots > 1);
812       dot3->setEnabled(dots > 2);
813       dot4->setEnabled(dots > 3);
814       tuplet->setEnabled(rest->tuplet());
815       InspectorElementBase::setElement();
816       }
817 
818 //---------------------------------------------------------
819 //   dotClicked
820 //---------------------------------------------------------
821 
dotClicked(int n)822 void InspectorRest::dotClicked(int n)
823       {
824       Rest* rest = toRest(inspector->element());
825       if (rest == 0)
826             return;
827       if (rest->dots() > n) {
828             NoteDot* dot = rest->dot(n);
829             dot->score()->select(dot);
830             dot->score()->update();
831             inspector->update();
832             }
833       }
834 
835 //---------------------------------------------------------
836 //   dot1Clicked
837 //---------------------------------------------------------
838 
dot1Clicked()839 void InspectorRest::dot1Clicked()
840       {
841       dotClicked(0);
842       }
843 
844 //---------------------------------------------------------
845 //   dot2Clicked
846 //---------------------------------------------------------
847 
dot2Clicked()848 void InspectorRest::dot2Clicked()
849       {
850       dotClicked(1);
851       }
852 
853 //---------------------------------------------------------
854 //   dot3Clicked
855 //---------------------------------------------------------
856 
dot3Clicked()857 void InspectorRest::dot3Clicked()
858       {
859       dotClicked(2);
860       }
861 
862 //---------------------------------------------------------
863 //   dot4Clicked
864 //---------------------------------------------------------
865 
dot4Clicked()866 void InspectorRest::dot4Clicked()
867       {
868       dotClicked(3);
869       }
870 
871 //---------------------------------------------------------
872 //   tupletClicked
873 //---------------------------------------------------------
874 
tupletClicked()875 void InspectorRest::tupletClicked()
876       {
877       Rest* rest = toRest(inspector->element());
878       if (rest == 0)
879             return;
880       Tuplet* t = rest->tuplet();
881       if (t) {
882             rest->score()->select(t);
883             rest->score()->update();
884             inspector->update();
885             }
886       }
887 
888 //---------------------------------------------------------
889 //   InspectorMMRest
890 //---------------------------------------------------------
891 
InspectorMMRest(QWidget * parent)892 InspectorMMRest::InspectorMMRest(QWidget* parent)
893    : InspectorElementBase(parent)
894       {
895       m.setupUi(addWidget());
896 
897       const std::vector<InspectorItem> iiList = {
898             { Pid::MMREST_NUMBER_POS, 0, m.yPos, m.resetYPos }
899             };
900 
901       const std::vector<InspectorPanel> ppList = { { m.title, m.panel } };
902       mapSignals(iiList, ppList);
903       }
904 
905 //---------------------------------------------------------
906 //   InspectorTimeSig
907 //---------------------------------------------------------
908 
InspectorTimeSig(QWidget * parent)909 InspectorTimeSig::InspectorTimeSig(QWidget* parent)
910    : InspectorElementBase(parent)
911       {
912       s.setupUi(addWidget());
913       t.setupUi(addWidget());
914 
915       const std::vector<InspectorItem> iiList = {
916             { Pid::LEADING_SPACE,  1, s.leadingSpace,   s.resetLeadingSpace  },
917             { Pid::SHOW_COURTESY,  0, t.showCourtesy,   t.resetShowCourtesy  },
918             { Pid::SCALE,          0, t.scale,          t.resetScale         },
919 //          { Pid::TIMESIG,        0, t.timesigZ,       t.resetTimesig       },
920 //          { Pid::TIMESIG,        0, t.timesigN,       t.resetTimesig       },
921 //          { Pid::TIMESIG_GLOBAL, 0, t.globalTimesigZ, t.resetGlobalTimesig },
922 //          { Pid::TIMESIG_GLOBAL, 0, t.globalTimesigN, t.resetGlobalTimesig }
923             };
924       const std::vector<InspectorPanel> ppList = {
925             { s.title, s.panel },
926             { t.title, t.panel }
927             };
928       mapSignals(iiList, ppList);
929       connect(t.properties, SIGNAL(clicked()), SLOT(propertiesClicked()));
930       }
931 
932 //---------------------------------------------------------
933 //   propertiesClicked
934 //---------------------------------------------------------
935 
propertiesClicked()936 void InspectorTimeSig::propertiesClicked()
937       {
938       TimeSig* ts = toTimeSig(inspector->element());
939       Score* score = ts->score();
940       score->startCmd();
941       mscore->currentScoreView()->editTimeSigProperties(ts);
942       ts->triggerLayoutAll();
943       score->endCmd();
944       }
945 
946 //---------------------------------------------------------
947 //   setElement
948 //---------------------------------------------------------
949 
setElement()950 void InspectorTimeSig::setElement()
951       {
952       InspectorElementBase::setElement();
953       TimeSig* ts = toTimeSig(inspector->element());
954       if (ts->generated())
955             t.showCourtesy->setEnabled(false);
956       }
957 
958 //---------------------------------------------------------
959 //   InspectorKeySig
960 //---------------------------------------------------------
961 
InspectorKeySig(QWidget * parent)962 InspectorKeySig::InspectorKeySig(QWidget* parent)
963    : InspectorElementBase(parent)
964       {
965       s.setupUi(addWidget());
966       k.setupUi(addWidget());
967 
968       const std::vector<InspectorItem> iiList = {
969             { Pid::LEADING_SPACE,  1, s.leadingSpace,  s.resetLeadingSpace  },
970             { Pid::SHOW_COURTESY,  0, k.showCourtesy,  k.resetShowCourtesy  },
971 //          { Pid::SHOW_NATURALS,  0, k.showNaturals,  k.resetShowNaturals  }
972             { Pid::KEYSIG_MODE,    0, k.keysigMode,    k.resetKeysigMode    }
973             };
974       const std::vector<InspectorPanel> ppList = {
975             { s.title, s.panel },
976             { k.title, k.panel }
977             };
978       k.keysigMode->clear();
979       k.keysigMode->addItem(tr("Unknown"),    int(KeyMode::UNKNOWN));
980       k.keysigMode->addItem(tr("None"),       int(KeyMode::NONE));
981       k.keysigMode->addItem(tr("Major"),      int(KeyMode::MAJOR));
982       k.keysigMode->addItem(tr("Minor"),      int(KeyMode::MINOR));
983       k.keysigMode->addItem(tr("Dorian"),     int(KeyMode::DORIAN));
984       k.keysigMode->addItem(tr("Phrygian"),   int(KeyMode::PHRYGIAN));
985       k.keysigMode->addItem(tr("Lydian"),     int(KeyMode::LYDIAN));
986       k.keysigMode->addItem(tr("Mixolydian"), int(KeyMode::MIXOLYDIAN));
987       k.keysigMode->addItem(tr("Ionian"),     int(KeyMode::IONIAN));
988       k.keysigMode->addItem(tr("Locrian"),    int(KeyMode::LOCRIAN));
989       mapSignals(iiList, ppList);
990       }
991 
992 //---------------------------------------------------------
993 //   setElement
994 //---------------------------------------------------------
995 
setElement()996 void InspectorKeySig::setElement()
997       {
998       InspectorElementBase::setElement();
999       KeySig* ks = toKeySig(inspector->element());
1000       if (ks->generated()) {
1001             k.showCourtesy->setEnabled(false);
1002             k.keysigModeLabel->setEnabled(false);
1003             k.keysigMode->setEnabled(false);
1004             }
1005       }
1006 
1007 //---------------------------------------------------------
1008 //   InspectorTuplet
1009 //---------------------------------------------------------
1010 
InspectorTuplet(QWidget * parent)1011 InspectorTuplet::InspectorTuplet(QWidget* parent)
1012    : InspectorElementBase(parent)
1013       {
1014       t.setupUi(addWidget());
1015 
1016       const std::vector<InspectorItem> iiList = {
1017             { Pid::FONT_FACE,      0, t.tupletFontFace,  t.resetTupletFontFace    },
1018             { Pid::FONT_SIZE,      0, t.tupletFontSize,  t.resetTupletFontSize    },
1019             { Pid::FONT_STYLE,     0, t.tupletFontStyle, t.resetTupletFontStyle   },
1020             { Pid::DIRECTION,      0, t.direction,       t.resetDirection         },
1021             { Pid::NUMBER_TYPE,    0, t.numberType,      t.resetNumberType        },
1022             { Pid::BRACKET_TYPE,   0, t.bracketType,     t.resetBracketType       },
1023             { Pid::LINE_WIDTH,     0, t.lineWidth,       t.resetLineWidth         },
1024             { Pid::SIZE_SPATIUM_DEPENDENT,      0,    t.spatiumDependent,     t.resetSpatiumDependent },
1025             };
1026       const std::vector<InspectorPanel> ppList = { { t.title, t.panel } };
1027       mapSignals(iiList, ppList);
1028       }
1029 
1030 //---------------------------------------------------------
1031 //   InspectorAccidental
1032 //---------------------------------------------------------
1033 
InspectorAccidental(QWidget * parent)1034 InspectorAccidental::InspectorAccidental(QWidget* parent)
1035    : InspectorElementBase(parent)
1036       {
1037       a.setupUi(addWidget());
1038 
1039       const std::vector<InspectorItem> iiList = {
1040             { Pid::SMALL,               0, a.small,    a.resetSmall    },
1041             { Pid::ACCIDENTAL_BRACKET,  0, a.bracket,  a.resetBracket  }
1042             };
1043       a.bracket->clear();
1044       a.bracket->addItem(tr("None", "no accidental bracket type"), int(AccidentalBracket::NONE));
1045       a.bracket->addItem(tr("Parenthesis"), int(AccidentalBracket::PARENTHESIS));
1046       a.bracket->addItem(tr("Bracket"), int(AccidentalBracket::BRACKET));
1047       a.bracket->addItem(tr("Brace"), int(AccidentalBracket::BRACE));
1048 
1049       const std::vector<InspectorPanel> ppList = { { a.title, a.panel } };
1050       mapSignals(iiList, ppList);
1051       }
1052 
1053 //---------------------------------------------------------
1054 //   InspectorTremolo
1055 //---------------------------------------------------------
1056 
InspectorTremolo(QWidget * parent)1057 InspectorTremolo::InspectorTremolo(QWidget* parent)
1058    : InspectorElementBase(parent)
1059       {
1060       g.setupUi(addWidget());
1061 
1062       const std::vector<InspectorItem> iiList = {
1063             { Pid::TREMOLO_STYLE, 0, g.style, g.resetStyle }
1064             };
1065       const std::vector<InspectorPanel> ppList = { { g.title, g.panel } };
1066 
1067       mapSignals(iiList, ppList);
1068       }
1069 
1070 #if 0 // not needed currently
1071 //---------------------------------------------------------
1072 //   setElement
1073 //---------------------------------------------------------
1074 
1075 void InspectorTremolo::setElement()
1076       {
1077       InspectorElementBase::setElement();
1078       for (Element* ee : *(inspector->el())) {
1079             if (!(toTremolo(ee)->customStyleApplicable())) {
1080                   g.labelStyle->setVisible(false);
1081                   g.style->setVisible(false);
1082                   g.resetStyle->setVisible(false);
1083                   break;
1084                   }
1085             }
1086       }
1087 #endif
1088 
1089 //---------------------------------------------------------
1090 //   InspectorClef
1091 //---------------------------------------------------------
1092 
InspectorClef(QWidget * parent)1093 InspectorClef::InspectorClef(QWidget* parent)
1094    : InspectorElementBase(parent)
1095       {
1096       s.setupUi(addWidget());
1097       c.setupUi(addWidget());
1098 
1099       const std::vector<InspectorItem> iiList = {
1100             { Pid::LEADING_SPACE, 1, s.leadingSpace,  s.resetLeadingSpace  },
1101             { Pid::SHOW_COURTESY, 0, c.showCourtesy,  c.resetShowCourtesy  }
1102             };
1103       const std::vector<InspectorPanel> ppList = {
1104             { s.title, s.panel },
1105             { c.title, c.panel }
1106             };
1107       mapSignals(iiList, ppList);
1108       }
1109 
1110 //---------------------------------------------------------
1111 //   InspectorStem
1112 //---------------------------------------------------------
1113 
InspectorStem(QWidget * parent)1114 InspectorStem::InspectorStem(QWidget* parent)
1115    : InspectorElementBase(parent)
1116       {
1117       s.setupUi(addWidget());
1118 
1119       const std::vector<InspectorItem> iiList = {
1120             { Pid::LINE_WIDTH,     0, s.lineWidth,     s.resetLineWidth     },
1121             { Pid::USER_LEN,       0, s.userLength,    s.resetUserLength    },
1122             { Pid::STEM_DIRECTION, 0, s.stemDirection, s.resetStemDirection }
1123             };
1124       const std::vector<InspectorPanel> ppList = { { s.title, s.panel } };
1125       mapSignals(iiList, ppList);
1126       }
1127 
1128 //---------------------------------------------------------
1129 //   populatePlacement
1130 //---------------------------------------------------------
1131 
populatePlacement(QComboBox * b)1132 void populatePlacement(QComboBox* b)
1133       {
1134       b->clear();
1135       b->addItem(b->QObject::tr("Above"), int(Placement::ABOVE));
1136       b->addItem(b->QObject::tr("Below"), int(Placement::BELOW));
1137       }
1138 
1139 //---------------------------------------------------------
1140 //   InspectorTempoText
1141 //---------------------------------------------------------
1142 
InspectorTempoText(QWidget * parent)1143 InspectorTempoText::InspectorTempoText(QWidget* parent)
1144    : InspectorTextBase(parent)
1145       {
1146       tt.setupUi(addWidget());
1147 
1148       const std::vector<InspectorItem> il = {
1149             { Pid::TEMPO,             0, tt.tempo,       tt.resetTempo       },
1150             { Pid::TEMPO_FOLLOW_TEXT, 0, tt.followText,  tt.resetFollowText  },
1151             { Pid::SUB_STYLE,         0, tt.style,       tt.resetStyle       },
1152             { Pid::PLACEMENT,         0, tt.placement,   tt.resetPlacement   }
1153             };
1154       const std::vector<InspectorPanel> ppList = {
1155             { tt.title, tt.panel }
1156             };
1157       populatePlacement(tt.placement);
1158       populateStyle(tt.style);
1159       mapSignals(il, ppList);
1160       connect(tt.followText, SIGNAL(toggled(bool)), tt.tempo, SLOT(setDisabled(bool)));
1161       }
1162 
1163 //---------------------------------------------------------
1164 //   postInit
1165 //---------------------------------------------------------
1166 
postInit()1167 void InspectorTempoText::postInit()
1168       {
1169       bool followText = tt.followText->isChecked();
1170       //tt.resetFollowText->setDisabled(followText);
1171       tt.tempo->setDisabled(followText);
1172       tt.resetTempo->setDisabled(followText || tt.tempo->value() == 120.0);  // a default of 120 BPM is assumed all over the place
1173       }
1174 
1175 //---------------------------------------------------------
1176 //   InspectorLyric
1177 //---------------------------------------------------------
1178 
InspectorLyric(QWidget * parent)1179 InspectorLyric::InspectorLyric(QWidget* parent)
1180    : InspectorTextBase(parent)
1181       {
1182       l.setupUi(addWidget());
1183 
1184       const std::vector<InspectorItem> il = {
1185             { Pid::VERSE,              0, l.verse,        l.resetVerse        },
1186             { Pid::SUB_STYLE,          0, l.style,        l.resetStyle        },
1187             { Pid::PLACEMENT,          0, l.placement,    l.resetPlacement    }
1188             };
1189       const std::vector<InspectorPanel> ppList = {
1190             { l.title, l.panel }
1191             };
1192       populatePlacement(l.placement);
1193       populateStyle(l.style);
1194       mapSignals(il, ppList);
1195       connect(t.resetToStyle, SIGNAL(clicked()), SLOT(resetToStyle()));
1196       }
1197 
1198 //---------------------------------------------------------
1199 //   InspectorStaffText
1200 //---------------------------------------------------------
1201 
InspectorStaffText(QWidget * parent)1202 InspectorStaffText::InspectorStaffText(QWidget* parent)
1203    : InspectorTextBase(parent)
1204       {
1205       s.setupUi(addWidget());
1206 
1207       Element* el = inspector->element();
1208       bool sameTypes = true;
1209 
1210       for (const auto& ee : *inspector->el()) {
1211             if (el->type() != ee->type() || el->isSystemText() != ee->isSystemText()) {
1212                   sameTypes = false;
1213                   break;
1214                   }
1215             }
1216       if (sameTypes)
1217             s.title->setText(el->userName());
1218 
1219       const std::vector<InspectorItem> il = {
1220             { Pid::SUB_STYLE,  0, s.style,     s.resetStyle     },
1221             { Pid::PLACEMENT,  0, s.placement, s.resetPlacement }
1222             };
1223       const std::vector<InspectorPanel> ppList = {
1224             { s.title, s.panel }
1225             };
1226       populatePlacement(s.placement);
1227       populateStyle(s.style);
1228       mapSignals(il, ppList);
1229       connect(s.properties, SIGNAL(clicked()), SLOT(propertiesClicked()));
1230       }
1231 
1232 //---------------------------------------------------------
1233 //   propertiesClicked
1234 //---------------------------------------------------------
1235 
propertiesClicked()1236 void InspectorStaffText::propertiesClicked()
1237       {
1238       StaffTextBase* st = toStaffTextBase(inspector->element());
1239       Score* score = st->score();
1240       score->startCmd();
1241       mscore->currentScoreView()->editStaffTextProperties(st);
1242       st->triggerLayoutAll();
1243       score->endCmd();
1244       }
1245 
1246 //---------------------------------------------------------
1247 //   setElement
1248 //---------------------------------------------------------
1249 
setElement()1250 void InspectorStaffText::setElement()
1251       {
1252       InspectorTextBase::setElement();
1253       Element* el = inspector->element();
1254       s.properties->setVisible(el->isStaffText() || el->isSystemText());
1255       }
1256 
1257 //---------------------------------------------------------
1258 //   InspectorSlurTie
1259 //---------------------------------------------------------
1260 
InspectorSlurTie(QWidget * parent)1261 InspectorSlurTie::InspectorSlurTie(QWidget* parent)
1262    : InspectorElementBase(parent)
1263       {
1264       s.setupUi(addWidget());
1265 
1266       Element* el = inspector->element();
1267       bool sameTypes = true;
1268 
1269       for (const auto& ee : *inspector->el()) {
1270             if (ee->isSlurSegment() != el->isSlurSegment()) {
1271                   sameTypes = false;
1272                   break;
1273                   }
1274             }
1275       if (sameTypes)
1276             s.title->setText(el->isSlurSegment() ? tr("Slur") : tr("Tie"));
1277 
1278       const std::vector<InspectorItem> iiList = {
1279             { Pid::LINE_TYPE,       0, s.lineType,      s.resetLineType      },
1280             { Pid::SLUR_DIRECTION,  0, s.slurDirection, s.resetSlurDirection }
1281             };
1282       const std::vector<InspectorPanel> ppList = { { s.title, s.panel } };
1283       mapSignals(iiList, ppList);
1284       }
1285 
1286 //---------------------------------------------------------
1287 //   InspectorEmpty
1288 //---------------------------------------------------------
1289 
InspectorEmpty(QWidget * parent)1290 InspectorEmpty::InspectorEmpty(QWidget* parent)
1291    : InspectorBase(parent)
1292       {
1293       e.setupUi(addWidget());
1294       }
1295 
1296 //---------------------------------------------------------
1297 //   sizeHint
1298 //---------------------------------------------------------
1299 
sizeHint() const1300 QSize InspectorEmpty::sizeHint() const
1301       {
1302       return QSize(255 * guiScaling, 170 * guiScaling);
1303       }
1304 
1305 //---------------------------------------------------------
1306 //   InspectorCaesura
1307 //---------------------------------------------------------
1308 
InspectorCaesura(QWidget * parent)1309 InspectorCaesura::InspectorCaesura(QWidget* parent)
1310    : InspectorElementBase(parent)
1311       {
1312       c.setupUi(addWidget());
1313 
1314       Breath* b = toBreath(inspector->element());
1315       bool sameTypes = true;
1316       for (const auto& ee : *inspector->el()) {
1317             if (toBreath(ee)->isCaesura() != b->isCaesura()) {
1318                   sameTypes = false;
1319                   break;
1320                   }
1321             }
1322       if (sameTypes)
1323             c.title->setText(b->isCaesura() ? tr("Caesura") : tr("Breath"));
1324 
1325       const std::vector<InspectorItem> iiList = {
1326             { Pid::PAUSE    ,  0, c.pause,         c.resetPause         },
1327             { Pid::PLACEMENT,  0, c.placement,     c.resetPlacement     }
1328             };
1329       const std::vector<InspectorPanel> ppList = { {c.title, c.panel} };
1330       populatePlacement(c.placement);
1331       mapSignals(iiList, ppList);
1332       }
1333 
1334 //---------------------------------------------------------
1335 //   InspectorBracket
1336 //---------------------------------------------------------
1337 
InspectorBracket(QWidget * parent)1338 InspectorBracket::InspectorBracket(QWidget* parent)
1339    : InspectorBase(parent)
1340       {
1341       b.setupUi(addWidget());
1342 
1343       const std::vector<InspectorItem> iiList = {
1344             { Pid::BRACKET_COLUMN, 0, b.column, b.resetColumn }
1345             };
1346       const std::vector<InspectorPanel> ppList = { { b.title, b.panel } };
1347       mapSignals(iiList, ppList);
1348       }
1349 
1350 //---------------------------------------------------------
1351 //   InspectorIname
1352 //---------------------------------------------------------
1353 
InspectorIname(QWidget * parent)1354 InspectorIname::InspectorIname(QWidget* parent)
1355    : InspectorTextBase(parent)
1356       {
1357       i.setupUi(addWidget());
1358 
1359       const std::vector<InspectorItem> iiList = {
1360             { Pid::INAME_LAYOUT_POSITION, 0, i.layoutPosition, i.resetLayoutPosition }
1361             };
1362       const std::vector<InspectorPanel> ppList = { { i.title, i.panel } };
1363       mapSignals(iiList, ppList);
1364       }
1365 
1366 }
1367