summaryrefslogtreecommitdiff
path: root/gtk2_ardour/program_change_dialog.cc
blob: f333447f4abe357e95e8e775f892c15170446e8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
    Copyright (C) 2010 Paul Davis
    Author: Carl Hetherington <cth@carlh.net>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/

#include <gtkmm/stock.h>
#include <gtkmm/table.h>
#include "program_change_dialog.h"

using namespace Gtk;

ProgramChangeDialog::ProgramChangeDialog ()
	: ArdourDialog (_("Add Program Change"), true)
	, _program (*manage (new Adjustment (1, 1, 128, 1, 16)))
{
	Table* t = manage (new Table (1, 2));

	Label* l = manage (new Label (_("Program")));
	l->set_alignment (0, 0.5);
	t->attach (*l, 0, 1, 1, 2);
	t->attach (_program, 1, 2, 1, 2);

	get_vbox()->add (*t);

	add_button (Stock::CANCEL, RESPONSE_CANCEL);
	add_button (Stock::ADD, RESPONSE_ACCEPT);
	set_default_response (RESPONSE_ACCEPT);

	show_all ();
}

/** @return Program change number, counted from 0 */
uint8_t
ProgramChangeDialog::program () const
{
	return _program.get_value_as_int () - 1;
}