Clean up and comment PortMatrix event handling a bit.

Fix problems with attempts to access Session after it has been
destroyed.


git-svn-id: svn://localhost/ardour2/branches/3.0@6290 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2009-12-05 03:04:54 +00:00
parent bdf5dead24
commit abd80d0f64
18 changed files with 130 additions and 92 deletions

View File

@ -340,7 +340,7 @@ void
ARDOUR_UI::create_bundle_manager ()
{
if (bundle_manager == 0) {
bundle_manager = new BundleManager (*session);
bundle_manager = new BundleManager (session);
bundle_manager->signal_unmap().connect (sigc::bind (sigc::ptr_fun (&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleBundleManager")));
}
}

View File

@ -35,7 +35,7 @@ using namespace std;
using namespace ARDOUR;
BundleEditorMatrix::BundleEditorMatrix (
Gtk::Window* parent, Session& session, boost::shared_ptr<Bundle> bundle
Gtk::Window* parent, Session* session, boost::shared_ptr<Bundle> bundle
)
: PortMatrix (parent, session, bundle->type()),
_bundle (bundle)
@ -174,7 +174,7 @@ BundleEditorMatrix::list_is_global (int dim) const
return (dim == OTHER);
}
BundleEditor::BundleEditor (Session& session, boost::shared_ptr<UserBundle> bundle)
BundleEditor::BundleEditor (Session* session, boost::shared_ptr<UserBundle> bundle)
: ArdourDialog (_("Edit Bundle")), _matrix (this, session, bundle), _bundle (bundle)
{
Gtk::Table* t = new Gtk::Table (3, 2);
@ -284,7 +284,7 @@ BundleEditor::on_map ()
}
BundleManager::BundleManager (Session& session)
BundleManager::BundleManager (Session* session)
: ArdourDialog (_("Bundle Manager")), _session (session), edit_button (_("Edit")), delete_button (_("Delete"))
{
_list_model = Gtk::ListStore::create (_list_model_columns);
@ -292,7 +292,7 @@ BundleManager::BundleManager (Session& session)
_tree_view.append_column (_("Name"), _list_model_columns.name);
_tree_view.set_headers_visible (false);
boost::shared_ptr<BundleList> bundles = _session.bundles ();
boost::shared_ptr<BundleList> bundles = _session->bundles ();
for (BundleList::iterator i = bundles->begin(); i != bundles->end(); ++i) {
add_bundle (*i);
}
@ -352,7 +352,7 @@ BundleManager::new_clicked ()
/* Start off with a single channel */
b->add_channel ("1");
_session.add_bundle (b);
_session->add_bundle (b);
add_bundle (b);
BundleEditor e (_session, b);
@ -376,7 +376,7 @@ BundleManager::delete_clicked ()
Gtk::TreeModel::iterator i = _tree_view.get_selection()->get_selected();
if (i) {
boost::shared_ptr<UserBundle> b = (*i)[_list_model_columns.bundle];
_session.remove_bundle (b);
_session->remove_bundle (b);
_list_model->erase (i);
}
}

View File

@ -35,7 +35,7 @@ namespace ARDOUR {
class BundleEditorMatrix : public PortMatrix
{
public:
BundleEditorMatrix (Gtk::Window *, ARDOUR::Session &, boost::shared_ptr<ARDOUR::Bundle>);
BundleEditorMatrix (Gtk::Window *, ARDOUR::Session *, boost::shared_ptr<ARDOUR::Bundle>);
void set_state (ARDOUR::BundleChannel c[2], bool s);
PortMatrixNode::State get_state (ARDOUR::BundleChannel c[2]) const;
@ -67,7 +67,7 @@ class BundleEditorMatrix : public PortMatrix
class BundleEditor : public ArdourDialog
{
public:
BundleEditor (ARDOUR::Session &, boost::shared_ptr<ARDOUR::UserBundle>);
BundleEditor (ARDOUR::Session *, boost::shared_ptr<ARDOUR::UserBundle>);
protected:
void on_map ();
@ -88,7 +88,7 @@ class BundleEditor : public ArdourDialog
class BundleManager : public ArdourDialog
{
public:
BundleManager (ARDOUR::Session &);
BundleManager (ARDOUR::Session *);
private:
@ -115,7 +115,7 @@ class BundleManager : public ArdourDialog
Gtk::TreeView _tree_view;
Glib::RefPtr<Gtk::ListStore> _list_model;
ModelColumns _list_model_columns;
ARDOUR::Session& _session;
ARDOUR::Session* _session;
Gtk::Button edit_button;
Gtk::Button delete_button;
};

View File

@ -4682,7 +4682,7 @@ void
Editor::show_global_port_matrix (ARDOUR::DataType t)
{
if (_global_port_matrix[t] == 0) {
_global_port_matrix[t] = new GlobalPortMatrixWindow (*session, t);
_global_port_matrix[t] = new GlobalPortMatrixWindow (session, t);
}
_global_port_matrix[t]->show ();

View File

@ -31,7 +31,7 @@
using namespace std;
GlobalPortMatrix::GlobalPortMatrix (Gtk::Window* p, ARDOUR::Session& s, ARDOUR::DataType t)
GlobalPortMatrix::GlobalPortMatrix (Gtk::Window* p, ARDOUR::Session* s, ARDOUR::DataType t)
: PortMatrix (p, s, t)
{
setup_all_ports ();
@ -55,8 +55,8 @@ GlobalPortMatrix::set_state (ARDOUR::BundleChannel c[2], bool s)
for (ARDOUR::Bundle::PortList::const_iterator i = in_ports.begin(); i != in_ports.end(); ++i) {
for (ARDOUR::Bundle::PortList::const_iterator j = out_ports.begin(); j != out_ports.end(); ++j) {
ARDOUR::Port* p = _session.engine().get_port_by_name (*i);
ARDOUR::Port* q = _session.engine().get_port_by_name (*j);
ARDOUR::Port* p = _session->engine().get_port_by_name (*i);
ARDOUR::Port* q = _session->engine().get_port_by_name (*j);
if (p) {
if (s) {
@ -73,9 +73,9 @@ GlobalPortMatrix::set_state (ARDOUR::BundleChannel c[2], bool s)
} else {
/* two non-Ardour ports */
if (s) {
jack_connect (_session.engine().jack (), j->c_str(), i->c_str());
jack_connect (_session->engine().jack (), j->c_str(), i->c_str());
} else {
jack_disconnect (_session.engine().jack (), j->c_str(), i->c_str());
jack_disconnect (_session->engine().jack (), j->c_str(), i->c_str());
}
}
}
@ -85,6 +85,10 @@ GlobalPortMatrix::set_state (ARDOUR::BundleChannel c[2], bool s)
PortMatrixNode::State
GlobalPortMatrix::get_state (ARDOUR::BundleChannel c[2]) const
{
if (_session == 0) {
return PortMatrixNode::NOT_ASSOCIATED;
}
ARDOUR::Bundle::PortList const & in_ports = c[IN].bundle->channel_ports (c[IN].channel);
ARDOUR::Bundle::PortList const & out_ports = c[OUT].bundle->channel_ports (c[OUT].channel);
if (in_ports.empty() || out_ports.empty()) {
@ -96,15 +100,15 @@ GlobalPortMatrix::get_state (ARDOUR::BundleChannel c[2]) const
for (ARDOUR::Bundle::PortList::const_iterator i = in_ports.begin(); i != in_ports.end(); ++i) {
for (ARDOUR::Bundle::PortList::const_iterator j = out_ports.begin(); j != out_ports.end(); ++j) {
ARDOUR::Port* p = _session.engine().get_port_by_name (*i);
ARDOUR::Port* q = _session.engine().get_port_by_name (*j);
ARDOUR::Port* p = _session->engine().get_port_by_name (*i);
ARDOUR::Port* q = _session->engine().get_port_by_name (*j);
if (!p && !q) {
/* two non-Ardour ports; things are slightly more involved */
/* XXX: is this the easiest way to do this? */
/* XXX: isn't this very inefficient? */
jack_client_t* jack = _session.engine().jack ();
jack_client_t* jack = _session->engine().jack ();
jack_port_t* jp = jack_port_by_name (jack, i->c_str());
if (jp == 0) {
return PortMatrixNode::NOT_ASSOCIATED;
@ -138,7 +142,7 @@ GlobalPortMatrix::get_state (ARDOUR::BundleChannel c[2]) const
return PortMatrixNode::ASSOCIATED;
}
GlobalPortMatrixWindow::GlobalPortMatrixWindow (ARDOUR::Session& s, ARDOUR::DataType t)
GlobalPortMatrixWindow::GlobalPortMatrixWindow (ARDOUR::Session* s, ARDOUR::DataType t)
: _port_matrix (this, s, t)
{
switch (t) {

View File

@ -29,7 +29,7 @@
class GlobalPortMatrix : public PortMatrix
{
public:
GlobalPortMatrix (Gtk::Window*, ARDOUR::Session&, ARDOUR::DataType);
GlobalPortMatrix (Gtk::Window*, ARDOUR::Session*, ARDOUR::DataType);
void setup_ports (int);
@ -60,7 +60,7 @@ private:
class GlobalPortMatrixWindow : public Gtk::Window
{
public:
GlobalPortMatrixWindow (ARDOUR::Session&, ARDOUR::DataType);
GlobalPortMatrixWindow (ARDOUR::Session *, ARDOUR::DataType);
private:
void on_show ();

View File

@ -41,7 +41,7 @@
using namespace ARDOUR;
using namespace Gtk;
IOSelector::IOSelector (Gtk::Window* p, ARDOUR::Session& session, boost::shared_ptr<ARDOUR::IO> io)
IOSelector::IOSelector (Gtk::Window* p, ARDOUR::Session* session, boost::shared_ptr<ARDOUR::IO> io)
: PortMatrix (p, session, io->default_type())
, _io (io)
{
@ -67,6 +67,10 @@ IOSelector::IOSelector (Gtk::Window* p, ARDOUR::Session& session, boost::shared_
void
IOSelector::setup_ports (int dim)
{
if (!_session) {
return;
}
_ports[dim].suspend_signals ();
if (dim == _other) {
@ -91,7 +95,7 @@ IOSelector::set_state (ARDOUR::BundleChannel c[2], bool s)
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) {
Port* f = _session.engine().get_port_by_name (*i);
Port* f = _session->engine().get_port_by_name (*i);
if (!f) {
return;
}
@ -120,7 +124,7 @@ IOSelector::get_state (ARDOUR::BundleChannel c[2]) const
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) {
Port* f = _session.engine().get_port_by_name (*i);
Port* f = _session->engine().get_port_by_name (*i);
/* since we are talking about an IO, our ports should all have an associated Port *,
so the above call should never fail */
@ -152,7 +156,7 @@ IOSelector::list_is_global (int dim) const
return (dim == _other);
}
IOSelectorWindow::IOSelectorWindow (ARDOUR::Session& session, boost::shared_ptr<ARDOUR::IO> io, bool /*can_cancel*/)
IOSelectorWindow::IOSelectorWindow (ARDOUR::Session* session, boost::shared_ptr<ARDOUR::IO> io, bool /*can_cancel*/)
: _selector (this, session, io)
{
set_name ("IOSelectorWindow2");
@ -209,7 +213,7 @@ IOSelectorWindow::io_name_changed (void* src)
set_title (title);
}
PortInsertUI::PortInsertUI (Gtk::Window* parent, ARDOUR::Session& sess, boost::shared_ptr<ARDOUR::PortInsert> pi)
PortInsertUI::PortInsertUI (Gtk::Window* parent, ARDOUR::Session* sess, boost::shared_ptr<ARDOUR::PortInsert> pi)
: input_selector (parent, sess, pi->input())
, output_selector (parent, sess, pi->output())
{
@ -235,7 +239,7 @@ PortInsertUI::finished (IOSelector::Result r)
}
PortInsertWindow::PortInsertWindow (ARDOUR::Session& sess, boost::shared_ptr<ARDOUR::PortInsert> pi, bool can_cancel)
PortInsertWindow::PortInsertWindow (ARDOUR::Session* sess, boost::shared_ptr<ARDOUR::PortInsert> pi, bool can_cancel)
: ArdourDialog ("port insert dialog"),
_portinsertui (this, sess, pi),
ok_button (can_cancel ? _("OK"): _("Close")),

View File

@ -31,7 +31,7 @@ namespace ARDOUR {
class IOSelector : public PortMatrix
{
public:
IOSelector (Gtk::Window*, ARDOUR::Session&, boost::shared_ptr<ARDOUR::IO>);
IOSelector (Gtk::Window*, ARDOUR::Session *, boost::shared_ptr<ARDOUR::IO>);
void set_state (ARDOUR::BundleChannel c[2], bool);
PortMatrixNode::State get_state (ARDOUR::BundleChannel c[2]) const;
@ -73,7 +73,7 @@ class IOSelector : public PortMatrix
class IOSelectorWindow : public Gtk::Window
{
public:
IOSelectorWindow (ARDOUR::Session&, boost::shared_ptr<ARDOUR::IO>, bool can_cancel = false);
IOSelectorWindow (ARDOUR::Session *, boost::shared_ptr<ARDOUR::IO>, bool can_cancel = false);
IOSelector& selector() { return _selector; }
@ -92,7 +92,7 @@ class IOSelectorWindow : public Gtk::Window
class PortInsertUI : public Gtk::HBox
{
public:
PortInsertUI (Gtk::Window*, ARDOUR::Session&, boost::shared_ptr<ARDOUR::PortInsert>);
PortInsertUI (Gtk::Window*, ARDOUR::Session *, boost::shared_ptr<ARDOUR::PortInsert>);
void redisplay ();
void finished (IOSelector::Result);
@ -105,7 +105,7 @@ class PortInsertUI : public Gtk::HBox
class PortInsertWindow : public ArdourDialog
{
public:
PortInsertWindow (ARDOUR::Session&, boost::shared_ptr<ARDOUR::PortInsert>, bool can_cancel = false);
PortInsertWindow (ARDOUR::Session *, boost::shared_ptr<ARDOUR::PortInsert>, bool can_cancel = false);
protected:
void on_map ();

View File

@ -710,7 +710,7 @@ MixerStrip::edit_output_configuration ()
output = _route->output ();
}
output_selector = new IOSelectorWindow (_session, output);
output_selector = new IOSelectorWindow (&_session, output);
}
if (output_selector->is_visible()) {
@ -724,7 +724,7 @@ void
MixerStrip::edit_input_configuration ()
{
if (input_selector == 0) {
input_selector = new IOSelectorWindow (_session, _route->input());
input_selector = new IOSelectorWindow (&_session, _route->input());
}
if (input_selector->is_visible()) {

View File

@ -238,10 +238,14 @@ PortGroupList::maybe_add_processor_to_list (
/** Gather bundles from around the system and put them in this PortGroupList */
void
PortGroupList::gather (ARDOUR::Session& session, bool inputs, bool allow_dups)
PortGroupList::gather (ARDOUR::Session* session, bool inputs, bool allow_dups)
{
clear ();
if (session == 0) {
return;
}
boost::shared_ptr<PortGroup> bus (new PortGroup (_("Bus")));
boost::shared_ptr<PortGroup> track (new PortGroup (_("Track")));
boost::shared_ptr<PortGroup> system_mono (new PortGroup (_("System (mono)")));
@ -254,7 +258,7 @@ PortGroupList::gather (ARDOUR::Session& session, bool inputs, bool allow_dups)
the route's input/output and processor bundles together so that they
are presented as one bundle in the matrix. */
boost::shared_ptr<RouteList> routes = session.get_routes ();
boost::shared_ptr<RouteList> routes = session->get_routes ();
for (RouteList::const_iterator i = routes->begin(); i != routes->end(); ++i) {
@ -309,7 +313,7 @@ PortGroupList::gather (ARDOUR::Session& session, bool inputs, bool allow_dups)
that UserBundles that offer the same ports as a normal bundle get priority
*/
boost::shared_ptr<BundleList> b = session.bundles ();
boost::shared_ptr<BundleList> b = session->bundles ();
for (BundleList::iterator i = b->begin(); i != b->end(); ++i) {
if (boost::dynamic_pointer_cast<UserBundle> (*i) && (*i)->ports_are_inputs() == inputs && (*i)->type() == _type) {
@ -338,8 +342,8 @@ PortGroupList::gather (ARDOUR::Session& session, bool inputs, bool allow_dups)
/* Ardour stuff */
if (!inputs && _type == DataType::AUDIO) {
ardour->add_bundle (session.the_auditioner()->output()->bundle());
ardour->add_bundle (session.click_io()->bundle());
ardour->add_bundle (session->the_auditioner()->output()->bundle());
ardour->add_bundle (session->click_io()->bundle());
}
/* Now find all other ports that we haven't thought of yet */
@ -347,14 +351,14 @@ PortGroupList::gather (ARDOUR::Session& session, bool inputs, bool allow_dups)
std::vector<std::string> extra_system;
std::vector<std::string> extra_other;
const char **ports = session.engine().get_ports ("", _type.to_jack_type(), inputs ?
const char **ports = session->engine().get_ports ("", _type.to_jack_type(), inputs ?
JackPortIsInput : JackPortIsOutput);
if (ports) {
int n = 0;
string client_matching_string;
client_matching_string = session.engine().client_name();
client_matching_string = session->engine().client_name();
client_matching_string += ':';
while (ports[n]) {

View File

@ -40,9 +40,8 @@ class PortMatrix;
class RouteBundle;
class PublicEditor;
/** A list of bundles and ports, grouped by some aspect of their
* type e.g. busses, tracks, system. Each group has 0 or more bundles
* and 0 or more ports, where the ports are not in the bundles.
/** A list of bundles grouped by some aspect of their type e.g. busses, tracks, system.
* A group has 0 or more bundles.
*/
class PortGroup : public sigc::trackable
{
@ -62,7 +61,10 @@ public:
bool has_port (std::string const &) const;
/** The bundle list has changed in some way; a bundle has been added or removed, or the list cleared etc. */
sigc::signal<void> Changed;
/** An individual bundle on our list has changed in some way */
sigc::signal<void, ARDOUR::Bundle::Change> BundleChanged;
struct BundleRecord {
@ -99,7 +101,7 @@ class PortGroupList : public sigc::trackable
void add_group (boost::shared_ptr<PortGroup>);
void add_group_if_not_empty (boost::shared_ptr<PortGroup>);
void set_type (ARDOUR::DataType);
void gather (ARDOUR::Session &, bool, bool);
void gather (ARDOUR::Session *, bool, bool);
PortGroup::BundleList const & bundles () const;
void clear ();
void remove_bundle (boost::shared_ptr<ARDOUR::Bundle>);
@ -122,7 +124,10 @@ class PortGroupList : public sigc::trackable
bool empty () const;
/** The group list has changed in some way; a group has been added or removed, or the list cleared etc. */
sigc::signal<void> Changed;
/** A bundle in one of our groups has changed */
sigc::signal<void, ARDOUR::Bundle::Change> BundleChanged;
private:

View File

@ -45,7 +45,7 @@ using namespace ARDOUR;
* @param session Our session.
* @param type Port type that we are handling.
*/
PortMatrix::PortMatrix (Window* parent, Session& session, DataType type)
PortMatrix::PortMatrix (Window* parent, Session* session, DataType type)
: Table (3, 3),
_session (session),
_parent (parent),
@ -95,6 +95,13 @@ PortMatrix::~PortMatrix ()
delete _menu;
}
/** Perform initial and once-only setup. This must be called by
* subclasses after they have set up _ports[] to at least some
* reasonable extent. Two-part initialisation is necessary because
* setting up _ports is largely done by virtual functions in
* subclasses.
*/
void
PortMatrix::init ()
{
@ -109,25 +116,44 @@ PortMatrix::init ()
_visible_ports[1] = *_ports[1].begin();
}
/* Signal handling is kind of split into two parts:
*
* 1. When _ports[] changes, we call setup(). This essentially sorts out our visual
* representation of the information in _ports[].
*
* 2. When certain other things change, we need to get our subclass to clear and
* re-fill _ports[], which in turn causes appropriate signals to be raised to
* hook into part (1).
*/
/* Part 1: the basic _ports[] change -> reset visuals */
for (int i = 0; i < 2; ++i) {
/* watch for the content of _ports[] changing */
_ports[i].Changed.connect (mem_fun (*this, &PortMatrix::setup));
/* and for bundles in _ports[] changing */
_ports[i].BundleChanged.connect (mem_fun (*this, &PortMatrix::bundle_changed));
_ports[i].BundleChanged.connect (sigc::hide (mem_fun (*this, &PortMatrix::setup)));
}
/* scrolling stuff */
_hscroll.signal_value_changed().connect (mem_fun (*this, &PortMatrix::hscroll_changed));
_vscroll.signal_value_changed().connect (mem_fun (*this, &PortMatrix::vscroll_changed));
/* Part 2: notice when things have changed that require our subclass to clear and refill _ports[] */
/* watch for routes being added or removed */
_session.RouteAdded.connect (sigc::hide (mem_fun (*this, &PortMatrix::routes_changed)));
_session->RouteAdded.connect (sigc::hide (mem_fun (*this, &PortMatrix::routes_changed)));
/* and also bundles */
_session.BundleAdded.connect (sigc::hide (mem_fun (*this, &PortMatrix::setup_global_ports)));
_session->BundleAdded.connect (sigc::hide (mem_fun (*this, &PortMatrix::setup_global_ports)));
/* and also ports */
_session.engine().PortRegisteredOrUnregistered.connect (mem_fun (*this, &PortMatrix::setup_all_ports));
_session->engine().PortRegisteredOrUnregistered.connect (mem_fun (*this, &PortMatrix::setup_global_ports));
_session->GoingAway.connect (mem_fun (*this, &PortMatrix::session_going_away));
reconnect_to_routes ();
@ -143,7 +169,7 @@ PortMatrix::reconnect_to_routes ()
}
_route_connections.clear ();
boost::shared_ptr<RouteList> routes = _session.get_routes ();
boost::shared_ptr<RouteList> routes = _session->get_routes ();
for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
_route_connections.push_back (
(*i)->processors_changed.connect (mem_fun (*this, &PortMatrix::route_processors_changed))
@ -476,6 +502,8 @@ PortMatrix::disassociate_all_on_channel (boost::weak_ptr<Bundle> bundle, uint32_
void
PortMatrix::setup_global_ports ()
{
ENSURE_GUI_THREAD (mem_fun (*this, &PortMatrix::setup_global_ports));
for (int i = 0; i < 2; ++i) {
if (list_is_global (i)) {
setup_ports (i);
@ -486,7 +514,7 @@ PortMatrix::setup_global_ports ()
void
PortMatrix::setup_all_ports ()
{
if (_session.deletion_in_progress()) {
if (_session->deletion_in_progress()) {
return;
}
@ -504,9 +532,8 @@ PortMatrix::toggle_show_only_bundles ()
}
_show_only_bundles = !_show_only_bundles;
_body->setup ();
setup_scrollbars ();
queue_draw ();
setup ();
}
pair<uint32_t, uint32_t>
@ -601,30 +628,20 @@ PortMatrix::add_channel_proxy (boost::weak_ptr<Bundle> w)
add_channel (b);
}
void
PortMatrix::bundle_changed (ARDOUR::Bundle::Change c)
{
if (c != Bundle::NameChanged) {
setup_all_ports ();
}
setup ();
}
void
PortMatrix::setup_notebooks ()
{
int const h_current_page = _hnotebook.get_current_page ();
int const v_current_page = _vnotebook.get_current_page ();
remove_notebook_pages (_hnotebook);
remove_notebook_pages (_vnotebook);
/* for some reason best known to GTK, erroneous switch_page signals seem to be generated
when adding pages to notebooks, so ignore them */
when adding or removing pages to or from notebooks, so ignore them */
_ignore_notebook_page_selected = true;
remove_notebook_pages (_hnotebook);
remove_notebook_pages (_vnotebook);
for (PortGroupList::List::const_iterator i = _ports[_row_index].begin(); i != _ports[_row_index].end(); ++i) {
HBox* dummy = manage (new HBox);
dummy->show ();
@ -728,3 +745,9 @@ PortMatrix::h_page_selected (GtkNotebookPage *, guint n)
queue_draw ();
}
}
void
PortMatrix::session_going_away ()
{
_session = 0;
}

View File

@ -52,7 +52,7 @@ class PortMatrixBody;
class PortMatrix : public Gtk::Table
{
public:
PortMatrix (Gtk::Window*, ARDOUR::Session&, ARDOUR::DataType);
PortMatrix (Gtk::Window*, ARDOUR::Session *, ARDOUR::DataType);
~PortMatrix ();
void set_type (ARDOUR::DataType);
@ -157,7 +157,7 @@ protected:
inputs and outputs should put outputs in list 0 and inputs in list 1. */
PortGroupList _ports[2];
boost::shared_ptr<PortGroup> _visible_ports[2];
ARDOUR::Session& _session;
ARDOUR::Session* _session;
private:
@ -174,12 +174,12 @@ private:
void toggle_show_only_bundles ();
bool on_scroll_event (GdkEventScroll *);
boost::shared_ptr<ARDOUR::IO> io_from_bundle (boost::shared_ptr<ARDOUR::Bundle>) const;
void bundle_changed (ARDOUR::Bundle::Change);
void setup_notebooks ();
void remove_notebook_pages (Gtk::Notebook &);
void v_page_selected (GtkNotebookPage *, guint);
void h_page_selected (GtkNotebookPage *, guint);
void route_processors_changed (ARDOUR::RouteProcessorChange);
void session_going_away ();
Gtk::Window* _parent;

View File

@ -842,7 +842,7 @@ ProcessorBox::choose_send ()
is closed.
*/
IOSelectorWindow *ios = new IOSelectorWindow (_session, send->output(), true);
IOSelectorWindow *ios = new IOSelectorWindow (&_session, send->output(), true);
ios->show_all ();
/* keep a reference to the send so it doesn't get deleted while
@ -1503,7 +1503,7 @@ ProcessorBox::edit_processor (boost::shared_ptr<Processor> processor)
PortInsertWindow *io_selector;
if (port_insert->get_gui() == 0) {
io_selector = new PortInsertWindow (_session, port_insert);
io_selector = new PortInsertWindow (&_session, port_insert);
port_insert->set_gui (io_selector);
} else {

View File

@ -49,7 +49,7 @@ ReturnUI::ReturnUI (Gtk::Window* parent, boost::shared_ptr<Return> r, Session& s
_vbox.pack_start (_hbox, false, false, false);
io = manage (new IOSelector (parent, se, r->output()));
io = manage (new IOSelector (parent, &se, r->output()));
pack_start (_vbox, false, false);

View File

@ -301,13 +301,13 @@ RouteParams_UI::setup_io_frames()
cleanup_io_frames();
// input
_input_iosel = new IOSelector (this, *session, _route->input());
_input_iosel = new IOSelector (this, session, _route->input());
_input_iosel->setup ();
input_frame.add (*_input_iosel);
input_frame.show_all();
// output
_output_iosel = new IOSelector (this, *session, _route->output());
_output_iosel = new IOSelector (this, session, _route->output());
_output_iosel->setup ();
output_frame.add (*_output_iosel);
output_frame.show_all();
@ -551,7 +551,7 @@ RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Processor> insert)
} else if ((port_insert = boost::dynamic_pointer_cast<PortInsert> (insert)) != 0) {
PortInsertUI *portinsert_ui = new PortInsertUI (this, *session, port_insert);
PortInsertUI *portinsert_ui = new PortInsertUI (this, session, port_insert);
cleanup_view();
_plugin_conn = port_insert->GoingAway.connect (bind (mem_fun(*this, &RouteParams_UI::redirect_going_away),

View File

@ -52,7 +52,7 @@ SendUI::SendUI (Gtk::Window* parent, boost::shared_ptr<Send> s, Session& se)
_vbox.pack_start (_hbox, false, false, false);
_vbox.pack_start (_panners, false, false);
io = manage (new IOSelector (parent, se, s->output()));
io = manage (new IOSelector (parent, &se, s->output()));
pack_start (_vbox, false, false);

View File

@ -14,7 +14,7 @@ using namespace ARDOUR;
class OptionsPortMatrix : public PortMatrix
{
public:
OptionsPortMatrix (Gtk::Window* parent, ARDOUR::Session& session)
OptionsPortMatrix (Gtk::Window* parent, ARDOUR::Session* session)
: PortMatrix (parent, session, DataType::AUDIO)
{
_port_group.reset (new PortGroup (""));
@ -26,12 +26,10 @@ public:
void setup_ports (int dim)
{
cerr << _session.the_auditioner()->output()->n_ports() << "\n";
if (dim == OURS) {
_port_group->clear ();
_port_group->add_bundle (_session.click_io()->bundle());
_port_group->add_bundle (_session.the_auditioner()->output()->bundle());
_port_group->add_bundle (_session->click_io()->bundle());
_port_group->add_bundle (_session->the_auditioner()->output()->bundle());
} else {
_ports[OTHER].gather (_session, true, false);
}
@ -42,18 +40,18 @@ public:
Bundle::PortList const & our_ports = c[OURS].bundle->channel_ports (c[OURS].channel);
Bundle::PortList const & other_ports = c[OTHER].bundle->channel_ports (c[OTHER].channel);
if (c[OURS].bundle == _session.click_io()->bundle()) {
if (c[OURS].bundle == _session->click_io()->bundle()) {
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) {
Port* f = _session.engine().get_port_by_name (*i);
Port* f = _session->engine().get_port_by_name (*i);
assert (f);
if (s) {
_session.click_io()->connect (f, *j, 0);
_session->click_io()->connect (f, *j, 0);
} else {
_session.click_io()->disconnect (f, *j, 0);
_session->click_io()->disconnect (f, *j, 0);
}
}
}
@ -65,11 +63,11 @@ public:
Bundle::PortList const & our_ports = c[OURS].bundle->channel_ports (c[OURS].channel);
Bundle::PortList const & other_ports = c[OTHER].bundle->channel_ports (c[OTHER].channel);
if (c[OURS].bundle == _session.click_io()->bundle()) {
if (c[OURS].bundle == _session->click_io()->bundle()) {
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) {
Port* f = _session.engine().get_port_by_name (*i);
Port* f = _session->engine().get_port_by_name (*i);
assert (f);
if (f->connected_to (*j)) {
@ -119,7 +117,7 @@ class ConnectionOptions : public OptionEditorBox
{
public:
ConnectionOptions (Gtk::Window* parent, ARDOUR::Session* s)
: _port_matrix (parent, *s)
: _port_matrix (parent, s)
{
_box->pack_start (_port_matrix);
}