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/stock.h>
21 #include "ardour/session.h"
22 #include "ardour/route_group.h"
23 #include "route_group_dialog.h"
24 #include "group_tabs.h"
28 using namespace ARDOUR;
30 GroupTabs::GroupTabs ()
38 GroupTabs::set_session (Session* s)
41 s->RouteGroupChanged.connect (mem_fun (*this, &GroupTabs::set_dirty));
45 /** Handle a size request.
46 * @param req GTK requisition
49 GroupTabs::on_size_request (Gtk::Requisition *req)
51 /* Use a dummy, small width and the actual height that we want */
57 GroupTabs::on_button_press_event (GdkEventButton* ev)
59 using namespace Menu_Helpers;
61 RouteGroup* g = click_to_route_group (ev);
63 if (ev->button == 1 && g) {
65 g->set_active (!g->is_active (), this);
67 } else if (ev->button == 3 && g) {
71 MenuList& items = _menu->items ();
72 items.push_back (MenuElem (_("Edit..."), bind (mem_fun (*this, &GroupTabs::edit_group), g)));
73 items.push_back (MenuElem (_("Remove"), bind (mem_fun (*this, &GroupTabs::remove_group), g)));
76 _menu->popup (ev->button, ev->time);
85 GroupTabs::edit_group (RouteGroup* g)
87 RouteGroupDialog d (g, Gtk::Stock::APPLY);
92 GroupTabs::remove_group (RouteGroup *g)
94 _session->remove_route_group (*g);