enough with umpteen "i18n.h" files. Consolidate on pbd/i18n.h
[ardour.git] / gtk2_ardour / transpose_dialog.cc
1 /*
2     Copyright (C) 2011 Paul Davis
3     Author: Carl Hetherington <cth@carlh.net>
4
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
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
21 #include <gtkmm/table.h>
22 #include <gtkmm/label.h>
23 #include <gtkmm/stock.h>
24 #include "transpose_dialog.h"
25 #include "pbd/i18n.h"
26
27 using namespace Gtk;
28
29 TransposeDialog::TransposeDialog ()
30         : ArdourDialog (_("Transpose MIDI"))
31         , _octaves_adjustment (0.0, -4.0, 4.0, 1, 2.0)
32         , _semitones_adjustment (0.0, -12.0, 12.0, 1.0, 4.0)
33         , _octaves_spinner (_octaves_adjustment)
34         , _semitones_spinner (_semitones_adjustment)
35 {
36         Table* t = manage (new Table (2, 2));
37         t->set_row_spacings (6);
38         t->set_col_spacings (6);
39
40         int r = 0;
41         Label* l = manage (new Label (_("Octaves:"), ALIGN_LEFT, ALIGN_CENTER, false));
42         t->attach (*l, 0, 1, r, r + 1, FILL, EXPAND, 0, 0);
43         t->attach (_octaves_spinner, 1, 2, r, r + 1, FILL, EXPAND & FILL, 0, 0);
44         ++r;
45
46         l = manage (new Label (_("Semitones:"), ALIGN_LEFT, ALIGN_CENTER, false));
47         t->attach (*l, 0, 1, r, r + 1, FILL, EXPAND, 0, 0);
48         t->attach (_semitones_spinner, 1, 2, r, r + 1, FILL, EXPAND & FILL, 0, 0);
49         ++r;
50
51         get_vbox()->set_spacing (6);
52         get_vbox()->pack_start (*t, false, false);
53
54         add_button (Stock::CANCEL, RESPONSE_CANCEL);
55         add_button (_("Transpose"), RESPONSE_ACCEPT);
56
57         show_all_children ();
58 }
59
60 int
61 TransposeDialog::semitones () const
62 {
63         return _octaves_spinner.get_value () * 12 + _semitones_spinner.get_value ();
64 }