summaryrefslogtreecommitdiff
path: root/gtk2_ardour/route_group_dialog.cc
blob: 6a87ea3c9505965ee86bf404b9eeada0e865a050 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include <gtkmm/stock.h>
#include "ardour/route_group.h"
#include "route_group_dialog.h"
#include "i18n.h"

using namespace Gtk;
using namespace ARDOUR;

RouteGroupDialog::RouteGroupDialog (RouteGroup* g, StockID const & s)
	: Dialog (_("Route group")),
	  _group (g),
	  _active (_("Active")),
	  _gain (_("Gain")),
	  _relative (_("Relative")),
	  _mute (_("Muting")),
	  _solo (_("Soloing")),
	  _rec_enable (_("Record enable")),
	  _select (_("Selection")),
	  _edit (_("Editing"))
{
	_name.set_text (_group->name ());
	_active.set_active (_group->is_active ());

	_gain.set_active (_group->property (RouteGroup::Gain));
	_relative.set_active (_group->is_relative());
	_mute.set_active (_group->property (RouteGroup::Mute));
	_solo.set_active (_group->property (RouteGroup::Solo));
	_rec_enable.set_active (_group->property (RouteGroup::RecEnable));
	_select.set_active (_group->property (RouteGroup::Select));
	_edit.set_active (_group->property (RouteGroup::Edit));
	
	HBox* h = manage (new HBox);
	h->pack_start (*manage (new Label (_("Name:"))));
	h->pack_start (_name);

	get_vbox()->pack_start (*h);
	get_vbox()->pack_start (_active);
	get_vbox()->pack_start (_gain);

	h = manage (new HBox);
	h->pack_start (_relative, PACK_EXPAND_PADDING);
	get_vbox()->pack_start (*h);

	get_vbox()->pack_start (_mute);
	get_vbox()->pack_start (_solo);
	get_vbox()->pack_start (_rec_enable);
	get_vbox()->pack_start (_select);
	get_vbox()->pack_start (_edit);

	get_vbox()->set_border_width (8);

	add_button (Stock::CANCEL, RESPONSE_CANCEL);
	add_button (s, RESPONSE_OK);

	show_all ();
}

int
RouteGroupDialog::do_run ()
{
	int const r = run ();

	if (r == Gtk::RESPONSE_OK) {
		_group->set_name (_name.get_text ());
		_group->set_active (_active.get_active (), this);

		_group->set_property (RouteGroup::Gain, _gain.get_active ());
		_group->set_property (RouteGroup::Mute, _mute.get_active ());
		_group->set_property (RouteGroup::Solo, _solo.get_active ());
		_group->set_property (RouteGroup::RecEnable, _rec_enable.get_active ());
		_group->set_property (RouteGroup::Select, _select.get_active ());
		_group->set_property (RouteGroup::Edit, _edit.get_active ());
		_group->set_relative (_relative.get_active(), this);
	}

	return r;
}