1 //=============================================================================
2 //  MuseScore
3 //  Music Composition & Notation
4 //
5 //  Copyright (C) 2017 Werner Schweer and others
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 "inspectorInstrchange.h"
14 #include "musescore.h"
15 #include "inspector.h"
16 #include "libmscore/instrchange.h"
17 #include "libmscore/score.h"
18 #include "scoreview.h"
19 
20 namespace Ms {
21 
22 extern void populatePlacement(QComboBox*);
23 
24 //---------------------------------------------------------
25 //   InspectorInstrumentChange
26 //---------------------------------------------------------
27 
InspectorInstrumentChange(QWidget * parent)28 InspectorInstrumentChange::InspectorInstrumentChange(QWidget* parent)
29    : InspectorTextBase(parent)
30       {
31       ic.setupUi(addWidget());
32 
33       const std::vector<InspectorItem> il = {
34             { Pid::SUB_STYLE,        0, ic.style,        ic.resetStyle        },
35             { Pid::PLACEMENT,        0, ic.placement,    ic.resetPlacement    }
36             };
37       const std::vector<InspectorPanel> ppList = {
38             { ic.title, ic.panel }
39             };
40       populatePlacement(ic.placement);
41       populateStyle(ic.style);
42       mapSignals(il, ppList);
43       connect(ic.selectInstrument, SIGNAL(clicked()), SLOT(selectInstrumentClicked()));
44       }
45 
46 //---------------------------------------------------------
47 //   selectInstrumentClicked
48 //---------------------------------------------------------
49 
selectInstrumentClicked()50 void InspectorInstrumentChange::selectInstrumentClicked()
51       {
52       InstrumentChange* i = toInstrumentChange(inspector->element());
53       Score* score = i->score();
54       score->startCmd();
55       mscore->currentScoreView()->selectInstrument(i);
56       score->setLayoutAll();
57       score->endCmd();
58       }
59 
60 } // namespace Ms
61 
62