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 <gtkmm2ext/doi.h>
22 #include "ardour/amp.h"
23 #include "ardour/io.h"
24 #include "ardour/return.h"
25 #include "ardour/rc_configuration.h"
28 #include "return_ui.h"
29 #include "io_selector.h"
30 #include "ardour_ui.h"
31 #include "gui_thread.h"
36 using namespace ARDOUR
;
39 ReturnUI::ReturnUI (Gtk::Window
* parent
, boost::shared_ptr
<Return
> r
, Session
* session
)
43 _gpm
.set_controls (boost::shared_ptr
<Route
>(), r
->meter(), r
->amp());
45 _hbox
.pack_start (_gpm
, true, true);
46 set_name ("ReturnUIFrame");
48 _vbox
.set_spacing (5);
49 _vbox
.set_border_width (5);
51 _vbox
.pack_start (_hbox
, false, false, false);
53 io
= manage (new IOSelector (parent
, session
, r
->output()));
55 pack_start (_vbox
, false, false);
57 pack_start (*io
, true, true);
61 _return
->set_metering (true);
62 _return
->input()->changed
.connect (input_change_connection
, invalidator (*this), ui_bind (&ReturnUI::ins_changed
, this, _1
, _2
), gui_context());
65 _gpm
.set_fader_name ("ReturnUIFrame");
67 // screen_update_connection = ARDOUR_UI::instance()->RapidScreenUpdate.connect (sigc::mem_fun (*this, &ReturnUI::update));
68 fast_screen_update_connection
= ARDOUR_UI::instance()->SuperRapidScreenUpdate
.connect (sigc::mem_fun (*this, &ReturnUI::fast_update
));
71 ReturnUI::~ReturnUI ()
73 _return
->set_metering (false);
75 /* XXX not clear that we need to do this */
77 screen_update_connection
.disconnect();
78 fast_screen_update_connection
.disconnect();
82 ReturnUI::ins_changed (IOChange change
, void* /*ignored*/)
84 ENSURE_GUI_THREAD (*this, &ReturnUI::ins_changed
, change
, ignored
)
85 if (change
.type
& IOChange::ConfigurationChanged
) {
96 ReturnUI::fast_update ()
98 if (Config
->get_meter_falloff() > 0.0f
) {
99 _gpm
.update_meters ();
103 ReturnUIWindow::ReturnUIWindow (boost::shared_ptr
<Return
> r
, ARDOUR::Session
* s
)
104 : ArdourDialog (string(_("Return ")) + r
->name())
106 ui
= new ReturnUI (this, r
, s
);
108 hpacker
.pack_start (*ui
, true, true);
110 get_vbox()->set_border_width (5);
111 get_vbox()->pack_start (hpacker
);
113 set_name ("ReturnUIWindow");
115 r
->DropReferences
.connect (going_away_connection
, invalidator (*this), boost::bind (&ReturnUIWindow::return_going_away
, this), gui_context());
116 signal_delete_event().connect (sigc::bind (sigc::ptr_fun (just_hide_it
), reinterpret_cast<Window
*> (this)));
119 ReturnUIWindow::~ReturnUIWindow ()
125 ReturnUIWindow::return_going_away ()
127 ENSURE_GUI_THREAD (*this, &ReturnUIWindow::return_going_away
)
128 going_away_connection
.disconnect ();
129 delete_when_idle (this);