fix math bug with numthreads computation
[ardour2.git] / gtk2_ardour / route_group_dialog.cc
blob176c23d8e2ae468a069b76e2f278715002efdeaf
1 /*
2 Copyright (C) 2009 Paul Davis
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.
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.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include <gtkmm/table.h>
21 #include <gtkmm/stock.h>
22 #include "ardour/route_group.h"
23 #include "route_group_dialog.h"
24 #include "i18n.h"
25 #include <iostream>
27 using namespace Gtk;
28 using namespace ARDOUR;
29 using namespace std;
30 using namespace PBD;
32 RouteGroupDialog::RouteGroupDialog (RouteGroup* g, StockID const & s)
33 : ArdourDialog (_("Route Group")),
34 _group (g),
35 _active (_("Active")),
36 _gain (_("Gain")),
37 _relative (_("Relative")),
38 _mute (_("Muting")),
39 _solo (_("Soloing")),
40 _rec_enable (_("Record enable")),
41 _select (_("Selection")),
42 _edit (_("Editing"))
44 set_modal (true);
45 set_skip_taskbar_hint (true);
46 set_resizable (false);
47 set_position (Gtk::WIN_POS_MOUSE);
48 set_name (N_("RouteGroupDialog"));
50 VBox* vbox = manage (new VBox);
51 Gtk::Label* l;
53 get_vbox()->set_spacing (4);
55 vbox->set_spacing (18);
56 vbox->set_border_width (5);
58 HBox* hbox = manage (new HBox);
59 hbox->set_spacing (6);
60 l = manage (new Label (_("Name:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false ));
62 hbox->pack_start (*l, false, true);
63 hbox->pack_start (_name, true, true);
65 vbox->pack_start (*hbox, false, true);
67 VBox* options_box = manage (new VBox);
68 options_box->set_spacing (6);
70 l = manage (new Label (_("<b>Sharing</b>"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false ));
71 l->set_use_markup ();
72 options_box->pack_start (*l, false, true);
74 _name.set_text (_group->name ());
75 _active.set_active (_group->is_active ());
77 _name.signal_activate ().connect (sigc::bind (sigc::mem_fun (*this, &Dialog::response), RESPONSE_OK));
79 _gain.set_active (_group->is_gain());
80 _relative.set_active (_group->is_relative());
81 _mute.set_active (_group->is_mute());
82 _solo.set_active (_group->is_solo());
83 _rec_enable.set_active (_group->is_recenable());
84 _select.set_active (_group->is_select());
85 _edit.set_active (_group->is_edit());
87 gain_toggled ();
89 Table* table = manage (new Table (8, 3, false));
90 table->set_row_spacings (6);
92 l = manage (new Label ("", Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
93 l->set_padding (8, 0);
94 table->attach (*l, 0, 1, 0, 8, Gtk::FILL, Gtk::FILL, 0, 0);
96 table->attach (_active, 1, 3, 0, 1, Gtk::FILL, Gtk::FILL, 0, 0);
97 table->attach (_gain, 1, 3, 1, 2, Gtk::FILL, Gtk::FILL, 0, 0);
99 l = manage (new Label ("", Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
100 l->set_padding (0, 0);
101 table->attach (*l, 1, 2, 2, 3, Gtk::FILL, Gtk::FILL, 0, 0);
102 table->attach (_relative, 2, 3, 2, 3, Gtk::FILL, Gtk::FILL, 0, 0);
104 table->attach (_mute, 1, 3, 3, 4, Gtk::FILL, Gtk::FILL, 0, 0);
105 table->attach (_solo, 1, 3, 4, 5, Gtk::FILL, Gtk::FILL, 0, 0);
106 table->attach (_rec_enable, 1, 3, 5, 6, Gtk::FILL, Gtk::FILL, 0, 0);
107 table->attach (_select, 1, 3, 6, 7, Gtk::FILL, Gtk::FILL, 0, 0);
108 table->attach (_edit, 1, 3, 7, 8, Gtk::FILL, Gtk::FILL, 0, 0);
110 options_box->pack_start (*table, false, true);
111 vbox->pack_start (*options_box, false, true);
113 get_vbox()->pack_start (*vbox, false, false);
115 _gain.signal_toggled().connect(sigc::mem_fun (*this, &RouteGroupDialog::gain_toggled));
117 add_button (Stock::CANCEL, RESPONSE_CANCEL);
118 add_button (s, RESPONSE_OK);
119 set_default_response (RESPONSE_OK);
121 show_all_children ();
125 RouteGroupDialog::do_run ()
127 int const r = run ();
129 if (r == Gtk::RESPONSE_OK || r == Gtk::RESPONSE_ACCEPT) {
131 PropertyList plist;
133 plist.add (Properties::gain, _gain.get_active());
134 plist.add (Properties::recenable, _rec_enable.get_active());
135 plist.add (Properties::mute, _mute.get_active());
136 plist.add (Properties::solo, _solo.get_active ());
137 plist.add (Properties::select, _select.get_active());
138 plist.add (Properties::edit, _edit.get_active());
139 plist.add (Properties::relative, _relative.get_active());
140 plist.add (Properties::active, _active.get_active());
141 plist.add (Properties::name, string (_name.get_text()));
143 _group->set_properties (plist);
146 return r;
149 void
150 RouteGroupDialog::gain_toggled ()
152 _relative.set_sensitive (_gain.get_active ());