2005-09-25 14:42:24 -04:00
|
|
|
/*
|
2009-10-14 12:10:01 -04:00
|
|
|
Copyright (C) 2002-2007 Paul Davis
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
#include <gtkmm/messagedialog.h>
|
2007-10-10 14:37:13 -04:00
|
|
|
#include <glibmm/objectbase.h>
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2005-09-25 16:33:00 -04:00
|
|
|
#include <gtkmm2ext/doi.h>
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/port_insert.h"
|
2007-10-10 14:37:13 -04:00
|
|
|
#include "ardour/session.h"
|
|
|
|
#include "ardour/io.h"
|
|
|
|
#include "ardour/audioengine.h"
|
2007-10-12 08:13:11 -04:00
|
|
|
#include "ardour/track.h"
|
2007-10-12 10:49:07 -04:00
|
|
|
#include "ardour/audio_track.h"
|
|
|
|
#include "ardour/midi_track.h"
|
2010-03-16 11:33:04 -04:00
|
|
|
#include "ardour/mtdm.h"
|
2007-10-12 10:49:07 -04:00
|
|
|
#include "ardour/data_type.h"
|
2009-01-20 21:27:21 -05:00
|
|
|
#include "ardour/port.h"
|
2009-01-20 09:46:00 -05:00
|
|
|
#include "ardour/bundle.h"
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "io_selector.h"
|
2007-10-10 14:37:13 -04:00
|
|
|
#include "utils.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "gui_thread.h"
|
|
|
|
#include "i18n.h"
|
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
using namespace ARDOUR;
|
|
|
|
using namespace Gtk;
|
|
|
|
|
2009-12-04 22:04:54 -05:00
|
|
|
IOSelector::IOSelector (Gtk::Window* p, ARDOUR::Session* session, boost::shared_ptr<ARDOUR::IO> io)
|
2010-06-30 21:14:14 -04:00
|
|
|
: PortMatrix (p, session, DataType::NIL)
|
2008-12-14 04:35:23 -05:00
|
|
|
, _io (io)
|
2007-10-12 20:58:03 -04:00
|
|
|
{
|
2010-07-26 22:09:51 -04:00
|
|
|
setup_type ();
|
|
|
|
|
2009-01-30 10:08:09 -05:00
|
|
|
/* signal flow from 0 to 1 */
|
2009-06-09 16:21:19 -04:00
|
|
|
|
|
|
|
_find_inputs_for_io_outputs = (_io->direction() == IO::Output);
|
|
|
|
|
2009-01-30 10:08:09 -05:00
|
|
|
if (_find_inputs_for_io_outputs) {
|
|
|
|
_other = 1;
|
|
|
|
_ours = 0;
|
|
|
|
} else {
|
|
|
|
_other = 0;
|
|
|
|
_ours = 1;
|
|
|
|
}
|
|
|
|
|
2009-11-18 08:35:31 -05:00
|
|
|
_port_group.reset (new PortGroup (io->name()));
|
2009-01-30 10:08:09 -05:00
|
|
|
_ports[_ours].add_group (_port_group);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-07-26 22:09:51 -04:00
|
|
|
io->changed.connect (_io_connection, invalidator (*this), boost::bind (&IOSelector::io_changed_proxy, this), gui_context ());
|
|
|
|
|
2009-02-08 22:18:10 -05:00
|
|
|
setup_all_ports ();
|
2009-11-18 08:35:31 -05:00
|
|
|
init ();
|
2009-01-20 09:46:00 -05:00
|
|
|
}
|
2008-12-14 04:35:23 -05:00
|
|
|
|
2010-07-26 22:09:51 -04:00
|
|
|
void
|
|
|
|
IOSelector::setup_type ()
|
|
|
|
{
|
|
|
|
/* set type according to what's in the IO */
|
|
|
|
|
|
|
|
int N = 0;
|
|
|
|
DataType type_with_ports = DataType::NIL;
|
|
|
|
for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) {
|
|
|
|
if (_io->ports().num_ports (*i)) {
|
|
|
|
type_with_ports = *i;
|
|
|
|
++N;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (N <= 1) {
|
|
|
|
set_type (type_with_ports);
|
|
|
|
} else {
|
|
|
|
set_type (DataType::NIL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
IOSelector::io_changed_proxy ()
|
|
|
|
{
|
|
|
|
/* The IO's changed signal is emitted from code that holds its route's processor lock,
|
|
|
|
so we can't call setup_all_ports (which results in a call to Route::foreach_processor)
|
|
|
|
without a deadlock unless we break things up with this idle handler.
|
|
|
|
*/
|
|
|
|
|
|
|
|
Glib::signal_idle().connect_once (sigc::mem_fun (*this, &IOSelector::io_changed));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
IOSelector::io_changed ()
|
|
|
|
{
|
|
|
|
setup_type ();
|
|
|
|
setup_all_ports ();
|
|
|
|
}
|
|
|
|
|
2009-01-20 09:46:00 -05:00
|
|
|
void
|
2009-02-08 22:18:10 -05:00
|
|
|
IOSelector::setup_ports (int dim)
|
2009-01-20 09:46:00 -05:00
|
|
|
{
|
2009-12-04 22:04:54 -05:00
|
|
|
if (!_session) {
|
|
|
|
return;
|
|
|
|
}
|
2010-07-26 22:09:51 -04:00
|
|
|
|
2009-02-08 22:18:10 -05:00
|
|
|
_ports[dim].suspend_signals ();
|
2009-01-20 09:46:00 -05:00
|
|
|
|
2009-02-08 22:18:10 -05:00
|
|
|
if (dim == _other) {
|
|
|
|
|
2010-06-29 22:59:13 -04:00
|
|
|
_ports[_other].gather (_session, type(), _find_inputs_for_io_outputs, false);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-29 09:34:35 -04:00
|
|
|
} else {
|
2008-12-14 04:35:23 -05:00
|
|
|
|
2009-02-08 22:18:10 -05:00
|
|
|
_port_group->clear ();
|
2009-07-19 20:22:09 -04:00
|
|
|
_port_group->add_bundle (_io->bundle (), _io);
|
2007-10-12 20:58:03 -04:00
|
|
|
}
|
2009-01-12 20:15:19 -05:00
|
|
|
|
2009-02-08 22:18:10 -05:00
|
|
|
_ports[dim].resume_signals ();
|
2007-10-10 14:37:13 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-10-10 14:37:13 -04:00
|
|
|
void
|
2009-01-30 10:08:09 -05:00
|
|
|
IOSelector::set_state (ARDOUR::BundleChannel c[2], bool s)
|
2007-10-10 14:37:13 -04:00
|
|
|
{
|
2009-01-30 10:08:09 -05:00
|
|
|
ARDOUR::Bundle::PortList const & our_ports = c[_ours].bundle->channel_ports (c[_ours].channel);
|
|
|
|
ARDOUR::Bundle::PortList const & other_ports = c[_other].bundle->channel_ports (c[_other].channel);
|
2009-01-20 09:46:00 -05:00
|
|
|
|
|
|
|
for (ARDOUR::Bundle::PortList::const_iterator i = our_ports.begin(); i != our_ports.end(); ++i) {
|
|
|
|
for (ARDOUR::Bundle::PortList::const_iterator j = other_ports.begin(); j != other_ports.end(); ++j) {
|
|
|
|
|
2009-12-04 22:04:54 -05:00
|
|
|
Port* f = _session->engine().get_port_by_name (*i);
|
2009-01-20 09:46:00 -05:00
|
|
|
if (!f) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s) {
|
2009-06-09 16:21:19 -04:00
|
|
|
_io->connect (f, *j, 0);
|
2009-01-20 09:46:00 -05:00
|
|
|
} else {
|
2009-06-09 16:21:19 -04:00
|
|
|
_io->disconnect (f, *j, 0);
|
2009-01-20 09:46:00 -05:00
|
|
|
}
|
2008-10-07 18:24:00 -04:00
|
|
|
}
|
|
|
|
}
|
2007-10-10 14:37:13 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-05-03 10:31:42 -04:00
|
|
|
PortMatrixNode::State
|
2009-01-30 10:08:09 -05:00
|
|
|
IOSelector::get_state (ARDOUR::BundleChannel c[2]) const
|
2007-10-10 14:37:13 -04:00
|
|
|
{
|
2009-01-30 10:08:09 -05:00
|
|
|
ARDOUR::Bundle::PortList const & our_ports = c[_ours].bundle->channel_ports (c[_ours].channel);
|
|
|
|
ARDOUR::Bundle::PortList const & other_ports = c[_other].bundle->channel_ports (c[_other].channel);
|
2007-10-31 14:24:43 -04:00
|
|
|
|
2009-02-14 15:17:45 -05:00
|
|
|
if (our_ports.empty() || other_ports.empty()) {
|
|
|
|
/* we're looking at a bundle with no parts associated with this channel,
|
|
|
|
so nothing to connect */
|
2009-11-16 17:32:58 -05:00
|
|
|
return PortMatrixNode::NOT_ASSOCIATED;
|
2009-02-14 15:17:45 -05:00
|
|
|
}
|
|
|
|
|
2009-01-20 09:46:00 -05:00
|
|
|
for (ARDOUR::Bundle::PortList::const_iterator i = our_ports.begin(); i != our_ports.end(); ++i) {
|
|
|
|
for (ARDOUR::Bundle::PortList::const_iterator j = other_ports.begin(); j != other_ports.end(); ++j) {
|
|
|
|
|
2009-12-04 22:04:54 -05:00
|
|
|
Port* f = _session->engine().get_port_by_name (*i);
|
2009-01-20 09:46:00 -05:00
|
|
|
|
2009-01-21 12:44:41 -05:00
|
|
|
/* since we are talking about an IO, our ports should all have an associated Port *,
|
|
|
|
so the above call should never fail */
|
|
|
|
assert (f);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-01-20 09:46:00 -05:00
|
|
|
if (!f->connected_to (*j)) {
|
|
|
|
/* if any one thing is not connected, all bets are off */
|
2009-05-03 10:31:42 -04:00
|
|
|
return PortMatrixNode::NOT_ASSOCIATED;
|
2009-01-20 09:46:00 -05:00
|
|
|
}
|
|
|
|
}
|
2007-10-31 14:24:43 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-05-03 10:31:42 -04:00
|
|
|
return PortMatrixNode::ASSOCIATED;
|
2007-10-10 14:37:13 -04:00
|
|
|
}
|
2006-11-19 11:45:16 -05:00
|
|
|
|
2007-10-19 09:30:07 -04:00
|
|
|
uint32_t
|
2009-01-30 10:08:09 -05:00
|
|
|
IOSelector::n_io_ports () const
|
2007-10-10 14:37:13 -04:00
|
|
|
{
|
2009-01-30 10:08:09 -05:00
|
|
|
if (!_find_inputs_for_io_outputs) {
|
2009-06-09 16:21:19 -04:00
|
|
|
return _io->n_ports().get (_io->default_type());
|
2007-10-19 09:30:07 -04:00
|
|
|
} else {
|
2009-06-09 16:21:19 -04:00
|
|
|
return _io->n_ports().get (_io->default_type());
|
2007-10-12 08:13:11 -04:00
|
|
|
}
|
2007-10-12 20:58:03 -04:00
|
|
|
}
|
2006-11-19 11:45:16 -05:00
|
|
|
|
2009-02-08 22:18:10 -05:00
|
|
|
bool
|
|
|
|
IOSelector::list_is_global (int dim) const
|
|
|
|
{
|
|
|
|
return (dim == _other);
|
|
|
|
}
|
|
|
|
|
2010-05-07 21:20:33 -04:00
|
|
|
string
|
|
|
|
IOSelector::disassociation_verb () const
|
|
|
|
{
|
|
|
|
return _("Disconnect");
|
|
|
|
}
|
|
|
|
|
|
|
|
string
|
|
|
|
IOSelector::channel_noun () const
|
|
|
|
{
|
|
|
|
return _("port");
|
|
|
|
}
|
|
|
|
|
2009-12-04 22:04:54 -05:00
|
|
|
IOSelectorWindow::IOSelectorWindow (ARDOUR::Session* session, boost::shared_ptr<ARDOUR::IO> io, bool /*can_cancel*/)
|
2009-07-21 21:28:31 -04:00
|
|
|
: _selector (this, session, io)
|
2007-10-10 14:37:13 -04:00
|
|
|
{
|
|
|
|
set_name ("IOSelectorWindow2");
|
2009-07-17 18:54:45 -04:00
|
|
|
set_title (_("I/O selector"));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2010-07-26 22:10:27 -04:00
|
|
|
add (_selector);
|
2006-11-19 11:45:16 -05:00
|
|
|
|
2007-10-10 14:37:13 -04:00
|
|
|
set_position (Gtk::WIN_POS_MOUSE);
|
2006-11-19 11:45:16 -05:00
|
|
|
|
2008-09-30 10:18:15 -04:00
|
|
|
io_name_changed (this);
|
2008-10-01 05:18:30 -04:00
|
|
|
|
2007-10-10 14:37:13 -04:00
|
|
|
show_all ();
|
2006-11-19 11:45:16 -05:00
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
signal_delete_event().connect (sigc::mem_fun (*this, &IOSelectorWindow::wm_delete));
|
2007-10-10 14:37:13 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-09-12 22:03:04 -04:00
|
|
|
bool
|
|
|
|
IOSelectorWindow::wm_delete (GdkEventAny* /*event*/)
|
|
|
|
{
|
|
|
|
_selector.Finished (IOSelector::Accepted);
|
|
|
|
hide ();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-10 14:37:13 -04:00
|
|
|
void
|
|
|
|
IOSelectorWindow::on_map ()
|
|
|
|
{
|
2009-02-08 22:18:10 -05:00
|
|
|
_selector.setup_all_ports ();
|
2007-10-10 14:37:13 -04:00
|
|
|
Window::on_map ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2009-08-29 16:48:11 -04:00
|
|
|
void
|
|
|
|
IOSelectorWindow::on_show ()
|
|
|
|
{
|
|
|
|
Gtk::Window::on_show ();
|
|
|
|
pair<uint32_t, uint32_t> const pm_max = _selector.max_size ();
|
|
|
|
resize_window_to_proportion_of_monitor (this, pm_max.first, pm_max.second);
|
2009-10-14 12:10:01 -04:00
|
|
|
}
|
2009-08-29 16:48:11 -04:00
|
|
|
|
2008-09-30 10:18:15 -04:00
|
|
|
void
|
|
|
|
IOSelectorWindow::io_name_changed (void* src)
|
|
|
|
{
|
2009-12-11 18:29:48 -05:00
|
|
|
ENSURE_GUI_THREAD (*this, &IOSelectorWindow::io_name_changed, src)
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-30 10:18:15 -04:00
|
|
|
string title;
|
|
|
|
|
2009-01-30 10:08:09 -05:00
|
|
|
if (!_selector.find_inputs_for_io_outputs()) {
|
2008-09-30 10:18:15 -04:00
|
|
|
title = string_compose(_("%1 input"), _selector.io()->name());
|
|
|
|
} else {
|
|
|
|
title = string_compose(_("%1 output"), _selector.io()->name());
|
|
|
|
}
|
|
|
|
|
|
|
|
set_title (title);
|
|
|
|
}
|
2007-10-10 14:37:13 -04:00
|
|
|
|
2009-12-04 22:04:54 -05:00
|
|
|
PortInsertUI::PortInsertUI (Gtk::Window* parent, ARDOUR::Session* sess, boost::shared_ptr<ARDOUR::PortInsert> pi)
|
2010-03-16 11:33:04 -04:00
|
|
|
: _pi (pi)
|
|
|
|
, latency_button (_("Measure Latency"))
|
|
|
|
, input_selector (parent, sess, pi->input())
|
|
|
|
, output_selector (parent, sess, pi->output())
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2010-03-16 11:33:04 -04:00
|
|
|
latency_hbox.pack_start (latency_button, false, false);
|
|
|
|
latency_hbox.pack_start (latency_display, false, false);
|
|
|
|
latency_frame.add (latency_hbox);
|
|
|
|
|
2009-02-09 21:09:46 -05:00
|
|
|
output_selector.set_min_height_divisor (2);
|
|
|
|
input_selector.set_min_height_divisor (2);
|
2010-03-16 11:33:04 -04:00
|
|
|
|
|
|
|
pack_start (latency_frame);
|
2009-01-20 09:46:00 -05:00
|
|
|
pack_start (output_selector, true, true);
|
|
|
|
pack_start (input_selector, true, true);
|
2010-03-16 11:33:04 -04:00
|
|
|
|
|
|
|
latency_button.signal_toggled().connect (mem_fun (*this, &PortInsertUI::latency_button_toggled));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2010-03-16 11:33:04 -04:00
|
|
|
bool
|
|
|
|
PortInsertUI::check_latency_measurement ()
|
|
|
|
{
|
|
|
|
MTDM* mtdm = _pi->mtdm ();
|
|
|
|
|
|
|
|
if (mtdm->resolve () < 0) {
|
|
|
|
latency_display.set_text (_("No signal detected"));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mtdm->err () > 0.3) {
|
|
|
|
mtdm->invert ();
|
|
|
|
mtdm->resolve ();
|
|
|
|
}
|
|
|
|
|
|
|
|
char buf[64];
|
|
|
|
nframes_t sample_rate = AudioEngine::instance()->frame_rate();
|
|
|
|
|
|
|
|
if (sample_rate == 0) {
|
|
|
|
latency_display.set_text (_("Disconnected from audio engine"));
|
|
|
|
_pi->stop_latency_detection ();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
snprintf (buf, sizeof (buf), "%10.3lf frames %10.3lf ms", mtdm->del (), mtdm->del () * 1000.0f/sample_rate);
|
|
|
|
|
|
|
|
bool solid = true;
|
|
|
|
|
|
|
|
if (mtdm->err () > 0.2) {
|
|
|
|
strcat (buf, " ??");
|
|
|
|
solid = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mtdm->inv ()) {
|
|
|
|
strcat (buf, " (Inv)");
|
|
|
|
solid = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (solid) {
|
|
|
|
_pi->set_measured_latency ((nframes_t) rint (mtdm->del()));
|
|
|
|
strcat (buf, " (set)");
|
|
|
|
}
|
|
|
|
|
|
|
|
latency_display.set_text (buf);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PortInsertUI::latency_button_toggled ()
|
|
|
|
{
|
|
|
|
if (latency_button.get_active ()) {
|
|
|
|
|
|
|
|
_pi->start_latency_detection ();
|
|
|
|
latency_display.set_text (_("Detecting ..."));
|
|
|
|
latency_timeout = Glib::signal_timeout().connect (mem_fun (*this, &PortInsertUI::check_latency_measurement), 250);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
_pi->stop_latency_detection ();
|
|
|
|
latency_timeout.disconnect ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
2007-10-10 14:37:13 -04:00
|
|
|
PortInsertUI::redisplay ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-02-08 22:18:10 -05:00
|
|
|
input_selector.setup_ports (input_selector.other());
|
|
|
|
output_selector.setup_ports (output_selector.other());
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2007-10-10 14:37:13 -04:00
|
|
|
PortInsertUI::finished (IOSelector::Result r)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
input_selector.Finished (r);
|
|
|
|
output_selector.Finished (r);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-04 22:04:54 -05:00
|
|
|
PortInsertWindow::PortInsertWindow (ARDOUR::Session* sess, boost::shared_ptr<ARDOUR::PortInsert> pi, bool can_cancel)
|
2005-09-25 14:42:24 -04:00
|
|
|
: ArdourDialog ("port insert dialog"),
|
2009-07-21 21:28:31 -04:00
|
|
|
_portinsertui (this, sess, pi),
|
2005-09-25 14:42:24 -04:00
|
|
|
ok_button (can_cancel ? _("OK"): _("Close")),
|
2009-07-17 18:54:45 -04:00
|
|
|
cancel_button (_("Cancel"))
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
|
|
|
|
set_name ("IOSelectorWindow");
|
2010-05-02 19:54:25 -04:00
|
|
|
string title = _("Port Insert ");
|
2006-07-27 21:08:57 -04:00
|
|
|
title += pi->name();
|
2005-09-25 14:42:24 -04:00
|
|
|
set_title (title);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
ok_button.set_name ("IOSelectorButton");
|
2007-10-10 14:37:13 -04:00
|
|
|
if (!can_cancel) {
|
|
|
|
ok_button.set_image (*Gtk::manage (new Gtk::Image (Gtk::Stock::CLOSE, Gtk::ICON_SIZE_BUTTON)));
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
cancel_button.set_name ("IOSelectorButton");
|
|
|
|
|
|
|
|
if (can_cancel) {
|
2007-10-10 14:37:13 -04:00
|
|
|
cancel_button.set_image (*Gtk::manage (new Gtk::Image (Gtk::Stock::CANCEL, Gtk::ICON_SIZE_BUTTON)));
|
|
|
|
get_action_area()->pack_start (cancel_button, false, false);
|
|
|
|
} else {
|
2005-09-25 14:42:24 -04:00
|
|
|
cancel_button.hide();
|
|
|
|
}
|
2007-10-10 14:37:13 -04:00
|
|
|
get_action_area()->pack_start (ok_button, false, false);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-03-05 05:24:31 -05:00
|
|
|
get_vbox()->pack_start (_portinsertui);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
ok_button.signal_clicked().connect (sigc::mem_fun (*this, &PortInsertWindow::accept));
|
|
|
|
cancel_button.signal_clicked().connect (sigc::mem_fun (*this, &PortInsertWindow::cancel));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
signal_delete_event().connect (sigc::mem_fun (*this, &PortInsertWindow::wm_delete), false);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-03-30 11:18:43 -04:00
|
|
|
pi->DropReferences.connect (going_away_connection, invalidator (*this), boost::bind (&PortInsertWindow::plugin_going_away, this), gui_context());
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2009-09-12 22:03:04 -04:00
|
|
|
bool
|
|
|
|
PortInsertWindow::wm_delete (GdkEventAny* /*event*/)
|
|
|
|
{
|
|
|
|
accept ();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
2006-08-29 17:21:48 -04:00
|
|
|
PortInsertWindow::plugin_going_away ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-12-11 18:29:48 -05:00
|
|
|
ENSURE_GUI_THREAD (*this, &PortInsertWindow::plugin_going_away)
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-04-12 19:20:37 -04:00
|
|
|
going_away_connection.disconnect ();
|
2005-09-25 14:42:24 -04:00
|
|
|
delete_when_idle (this);
|
|
|
|
}
|
|
|
|
|
2005-10-31 19:56:09 -05:00
|
|
|
void
|
|
|
|
PortInsertWindow::on_map ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
_portinsertui.redisplay ();
|
2005-10-31 19:56:09 -05:00
|
|
|
Window::on_map ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
PortInsertWindow::cancel ()
|
|
|
|
{
|
2007-10-10 14:37:13 -04:00
|
|
|
_portinsertui.finished (IOSelector::Cancelled);
|
2005-09-25 14:42:24 -04:00
|
|
|
hide ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PortInsertWindow::accept ()
|
|
|
|
{
|
2007-10-10 14:37:13 -04:00
|
|
|
_portinsertui.finished (IOSelector::Accepted);
|
2005-09-25 14:42:24 -04:00
|
|
|
hide ();
|
|
|
|
}
|
2009-02-08 22:18:10 -05:00
|
|
|
|