patch from lucus for long names in trackbus inspector
[ardour2.git] / gtk2_ardour / send_ui.cc
blobbb1069be9d80d5e77f7283dbd0baee73f7912a2b
1 /*
2 Copyright (C) 2002 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 <ardour/send.h>
21 #include <gtkmm2ext/doi.h>
23 #include "utils.h"
24 #include "send_ui.h"
25 #include "io_selector.h"
26 #include "ardour_ui.h"
27 #include "gui_thread.h"
29 #include "i18n.h"
31 using namespace ARDOUR;
32 using namespace PBD;
34 SendUI::SendUI (boost::shared_ptr<Send> s, Session& se)
35 : _send (s),
36 _session (se),
37 gpm (se),
38 panners (se)
40 panners.set_io (s);
41 gpm.set_io (s);
43 hbox.pack_start (gpm, true, true);
44 set_name ("SendUIFrame");
46 vbox.set_spacing (5);
47 vbox.set_border_width (5);
49 vbox.pack_start (hbox, false, false, false);
50 vbox.pack_start (panners, false,false);
52 io = manage (new IOSelector (se, s, false));
54 pack_start (vbox, false, false);
56 pack_start (*io, true, true);
58 show_all ();
60 _send->set_metering (true);
62 _send->output_changed.connect (mem_fun (*this, &SendUI::ins_changed));
63 _send->output_changed.connect (mem_fun (*this, &SendUI::outs_changed));
65 panners.set_width (Wide);
66 panners.setup_pan ();
68 gpm.setup_meters ();
69 gpm.set_fader_name ("SendUIFrame");
71 // screen_update_connection = ARDOUR_UI::instance()->RapidScreenUpdate.connect (mem_fun (*this, &SendUI::update));
72 fast_screen_update_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (mem_fun (*this, &SendUI::fast_update));
75 SendUI::~SendUI ()
77 _send->set_metering (false);
79 /* XXX not clear that we need to do this */
81 screen_update_connection.disconnect();
82 fast_screen_update_connection.disconnect();
85 void
86 SendUI::ins_changed (IOChange change, void* ignored)
88 ENSURE_GUI_THREAD(bind (mem_fun (*this, &SendUI::ins_changed), change, ignored));
89 if (change & ConfigurationChanged) {
90 panners.setup_pan ();
94 void
95 SendUI::outs_changed (IOChange change, void* ignored)
97 ENSURE_GUI_THREAD(bind (mem_fun (*this, &SendUI::outs_changed), change, ignored));
98 if (change & ConfigurationChanged) {
99 panners.setup_pan ();
100 gpm.setup_meters ();
104 void
105 SendUI::update ()
109 void
110 SendUI::fast_update ()
112 if (Config->get_meter_falloff() > 0.0f) {
113 gpm.update_meters ();
117 SendUIWindow::SendUIWindow (boost::shared_ptr<Send> s, Session& ss)
118 : ArdourDialog (string_compose (_("%1: send "), PROGRAM_NAME) + s->name())
120 ui = new SendUI (s, ss);
122 hpacker.pack_start (*ui, true, true);
124 get_vbox()->set_border_width (5);
125 get_vbox()->pack_start (hpacker);
127 set_name ("SendUIWindow");
129 going_away_connection = s->GoingAway.connect (mem_fun (*this, &SendUIWindow::send_going_away));
131 signal_delete_event().connect (bind (ptr_fun (just_hide_it), reinterpret_cast<Window *> (this)));
134 SendUIWindow::~SendUIWindow ()
136 delete ui;
139 void
140 SendUIWindow::send_going_away ()
142 ENSURE_GUI_THREAD (mem_fun (*this, &SendUIWindow::send_going_away));
143 delete_when_idle (this);
144 going_away_connection.disconnect ();