use new method in MidiPatchManager to use MIDNAM data when setting a MidiTimeAxisView
[ardour.git] / gtk2_ardour / transpose_dialog.cc
1 /*
2  * Copyright (C) 2011 Carl Hetherington <carl@carlh.net>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18
19 #include <gtkmm/table.h>
20 #include <gtkmm/label.h>
21 #include <gtkmm/stock.h>
22 #include "transpose_dialog.h"
23 #include "pbd/i18n.h"
24
25 using namespace Gtk;
26
27 TransposeDialog::TransposeDialog ()
28         : ArdourDialog (_("Transpose MIDI"))
29         , _octaves_adjustment (0.0, -4.0, 4.0, 1, 2.0)
30         , _semitones_adjustment (0.0, -12.0, 12.0, 1.0, 4.0)
31         , _octaves_spinner (_octaves_adjustment)
32         , _semitones_spinner (_semitones_adjustment)
33 {
34         Table* t = manage (new Table (2, 2));
35         t->set_row_spacings (6);
36         t->set_col_spacings (6);
37
38         int r = 0;
39         Label* l = manage (new Label (_("Octaves:"), ALIGN_LEFT, ALIGN_CENTER, false));
40         t->attach (*l, 0, 1, r, r + 1, FILL, EXPAND, 0, 0);
41         t->attach (_octaves_spinner, 1, 2, r, r + 1, FILL, EXPAND & FILL, 0, 0);
42         ++r;
43
44         l = manage (new Label (_("Semitones:"), ALIGN_LEFT, ALIGN_CENTER, false));
45         t->attach (*l, 0, 1, r, r + 1, FILL, EXPAND, 0, 0);
46         t->attach (_semitones_spinner, 1, 2, r, r + 1, FILL, EXPAND & FILL, 0, 0);
47         ++r;
48
49         get_vbox()->set_spacing (6);
50         get_vbox()->pack_start (*t, false, false);
51
52         add_button (Stock::CANCEL, RESPONSE_CANCEL);
53         add_button (_("Transpose"), RESPONSE_ACCEPT);
54
55         show_all_children ();
56 }
57
58 int
59 TransposeDialog::semitones () const
60 {
61         return _octaves_spinner.get_value () * 12 + _semitones_spinner.get_value ();
62 }