1 //=============================================================================
2 //  MuseScore
3 //  Linux Music Score Editor
4 //
5 //  Copyright (C) 2002-2007 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 //
10 //  This program is distributed in the hope that it will be useful,
11 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 //  GNU General Public License for more details.
14 //
15 //  You should have received a copy of the GNU General Public License
16 //  along with this program; if not, write to the Free Software
17 //  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 //=============================================================================
19 
20 #include "editinstrument.h"
21 #include "libmscore/instrtemplate.h"
22 
23 namespace Ms {
24 
25 //---------------------------------------------------------
26 //   EditInstrument
27 //---------------------------------------------------------
28 
EditInstrument(QWidget * parent)29 EditInstrument::EditInstrument(QWidget* parent)
30    : QDialog(parent)
31       {
32       lt = new InstrumentTemplate;
33       setupUi(this);
34       setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
35       connect(minPitch, SIGNAL(valueChanged(int)), SLOT(valueChanged()));
36       connect(maxPitch, SIGNAL(valueChanged(int)), SLOT(valueChanged()));
37       }
38 
39 //---------------------------------------------------------
40 //   setInstrument
41 //---------------------------------------------------------
42 
setInstrument(InstrumentTemplate * t)43 void EditInstrument::setInstrument(InstrumentTemplate* t)
44       {
45       instr = t;
46 //TODO      *lt   = *t;
47 //      nameEdit->setText(t->name);
48 //      shortNameEdit->setText(t->shortName);
49       minPitch->setValue(t->minPitchA);
50       maxPitch->setValue(t->maxPitchA);
51       transposeChromatic->setValue(t->transpose.chromatic);
52       transposeDiatonic->setValue(t->transpose.diatonic);
53 //      midiProgram->setValue(t->midiProgram);
54       staves->setValue(t->nstaves());
55       }
56 
57 //---------------------------------------------------------
58 //   ~EditInstrument
59 //---------------------------------------------------------
60 
~EditInstrument()61 EditInstrument::~EditInstrument()
62       {
63       delete lt;
64       }
65 
66 //---------------------------------------------------------
67 //   on_buttonCancel_pressed
68 //---------------------------------------------------------
69 
on_buttonCancel_pressed()70 void EditInstrument::on_buttonCancel_pressed()
71       {
72 //      qDebug("cancel");
73       }
74 
75 //---------------------------------------------------------
76 //   on_buttonOk_pressed
77 //---------------------------------------------------------
78 
on_buttonOk_pressed()79 void EditInstrument::on_buttonOk_pressed()
80       {
81       valueChanged();
82 //TODO      *instr = *lt;
83       }
84 
85 //---------------------------------------------------------
86 //   valueChanged
87 //---------------------------------------------------------
88 
valueChanged()89 void EditInstrument::valueChanged()
90       {
91 //      lt->name        = nameEdit->text();
92 //      lt->shortName   = shortNameEdit->text();
93       lt->minPitchA    = minPitch->value();
94       lt->maxPitchA    = maxPitch->value();
95       lt->transpose.diatonic   = transposeDiatonic->value();
96       lt->transpose.chromatic   = transposeChromatic->value();
97 //      lt->midiProgram = midiProgram->value();
98       lt->setStaves(staves->value());
99       }
100 }
101 
102