Remove most using declarations from header files.
[ardour.git] / gtk2_ardour / send_ui.cc
1 /*
2     Copyright (C) 2002 Paul Davis 
3
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.
8
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.
13
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.
17
18 */
19
20 #include <gtkmm2ext/doi.h>
21
22 #include "ardour/io.h"
23 #include "ardour/send.h"
24
25 #include "utils.h"
26 #include "send_ui.h"
27 #include "io_selector.h"
28 #include "ardour_ui.h"
29 #include "gui_thread.h"
30
31 using namespace std;
32 using namespace ARDOUR;
33 using namespace PBD;
34
35 SendUI::SendUI (boost::shared_ptr<Send> s, Session& se)
36         : _send (s)
37         , _session (se)
38         , _gpm (se)
39         , _panners (se)
40 {
41         _panners.set_io (s->io());
42         _gpm.set_io (s->io());
43
44         _hbox.pack_start (_gpm, true, true);
45         set_name ("SendUIFrame");
46         
47         _vbox.set_spacing (5);
48         _vbox.set_border_width (5);
49
50         _vbox.pack_start (_hbox, false, false, false);
51         _vbox.pack_start (_panners, false,false);
52
53         io = manage (new IOSelector (se, s->io(), true));
54         
55         pack_start (_vbox, false, false);
56
57         pack_start (*io, true, true);
58
59         show_all ();
60
61         _send->set_metering (true);
62
63         _send->io()->input_changed.connect (mem_fun (*this, &SendUI::ins_changed));
64         _send->io()->output_changed.connect (mem_fun (*this, &SendUI::outs_changed));
65         
66         _panners.set_width (Wide);
67         _panners.setup_pan ();
68
69         _gpm.setup_meters ();
70         _gpm.set_fader_name ("SendUIFrame");
71
72         // screen_update_connection = ARDOUR_UI::instance()->RapidScreenUpdate.connect (
73         //              mem_fun (*this, &SendUI::update));
74         fast_screen_update_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (
75                         mem_fun (*this, &SendUI::fast_update));
76 }
77
78 SendUI::~SendUI ()
79 {
80         _send->set_metering (false);
81
82         /* XXX not clear that we need to do this */
83
84         screen_update_connection.disconnect();
85         fast_screen_update_connection.disconnect();
86 }
87
88 void
89 SendUI::ins_changed (IOChange change, void* ignored)
90 {
91         ENSURE_GUI_THREAD(bind (mem_fun (*this, &SendUI::ins_changed), change, ignored));
92         if (change & ConfigurationChanged) {
93                 _panners.setup_pan ();
94         }
95 }
96
97 void
98 SendUI::outs_changed (IOChange change, void* ignored)
99 {
100         ENSURE_GUI_THREAD(bind (mem_fun (*this, &SendUI::outs_changed), change, ignored));
101         if (change & ConfigurationChanged) {
102                 _panners.setup_pan ();
103                 _gpm.setup_meters ();
104         }
105 }
106
107 void
108 SendUI::update ()
109 {
110 }
111
112 void
113 SendUI::fast_update ()
114 {
115         if (Config->get_meter_falloff() > 0.0f) {
116                 _gpm.update_meters ();
117         }
118 }
119         
120 SendUIWindow::SendUIWindow (boost::shared_ptr<Send> s, Session& ss)
121         : ArdourDialog (string("Ardour: send ") + s->name())
122 {
123         ui = new SendUI (s, ss);
124
125         hpacker.pack_start (*ui, true, true);
126
127         get_vbox()->set_border_width (5);
128         get_vbox()->pack_start (hpacker);
129
130         set_name ("SendUIWindow");
131         
132         going_away_connection = s->GoingAway.connect (
133                         mem_fun (*this, &SendUIWindow::send_going_away));
134
135         signal_delete_event().connect (bind (
136                                                sigc::ptr_fun (just_hide_it),
137                                                reinterpret_cast<Window *> (this)));
138 }
139
140 SendUIWindow::~SendUIWindow ()
141 {
142         delete ui;
143 }
144
145 void
146 SendUIWindow::send_going_away ()
147 {
148         ENSURE_GUI_THREAD (mem_fun (*this, &SendUIWindow::send_going_away));
149         delete_when_idle (this);
150         going_away_connection.disconnect ();
151 }
152