2007-10-19 09:30:07 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2007-2012 Carl Hetherington <carl@carlh.net>
|
|
|
|
* Copyright (C) 2008-2016 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2009-2014 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2014-2016 Robin Gareus <robin@gareus.org>
|
|
|
|
*
|
|
|
|
* 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.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2007-10-19 09:30:07 -04:00
|
|
|
|
|
|
|
#include <gtkmm/stock.h>
|
|
|
|
#include <gtkmm/button.h>
|
|
|
|
#include <gtkmm/label.h>
|
|
|
|
#include <gtkmm/entry.h>
|
|
|
|
#include <gtkmm/table.h>
|
|
|
|
#include <gtkmm/comboboxtext.h>
|
|
|
|
#include <gtkmm/alignment.h>
|
2009-12-21 13:23:07 -05:00
|
|
|
|
2007-10-19 09:30:07 -04:00
|
|
|
#include "ardour/session.h"
|
|
|
|
#include "ardour/user_bundle.h"
|
|
|
|
#include "bundle_manager.h"
|
2009-12-21 13:23:07 -05:00
|
|
|
#include "gui_thread.h"
|
2016-07-14 14:44:52 -04:00
|
|
|
#include "pbd/i18n.h"
|
2009-08-29 16:48:11 -04:00
|
|
|
#include "utils.h"
|
2007-10-19 09:30:07 -04:00
|
|
|
|
2009-07-19 20:22:09 -04:00
|
|
|
using namespace std;
|
|
|
|
using namespace ARDOUR;
|
2014-06-25 15:27:37 -04:00
|
|
|
using namespace ARDOUR_UI_UTILS;
|
2009-07-19 20:22:09 -04:00
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
BundleEditorMatrix::BundleEditorMatrix (Gtk::Window* parent, Session* session, std::shared_ptr<Bundle> bundle)
|
2010-06-29 22:59:13 -04:00
|
|
|
: PortMatrix (parent, session, DataType::NIL)
|
2009-12-17 13:24:23 -05:00
|
|
|
, _bundle (bundle)
|
2007-10-19 09:30:07 -04:00
|
|
|
{
|
2023-02-16 18:33:28 -05:00
|
|
|
_port_group = std::shared_ptr<PortGroup> (new PortGroup (""));
|
2009-02-08 22:18:10 -05:00
|
|
|
_port_group->add_bundle (_bundle);
|
2009-11-18 08:35:31 -05:00
|
|
|
|
|
|
|
setup_all_ports ();
|
|
|
|
init ();
|
2009-01-25 01:47:11 -05:00
|
|
|
}
|
|
|
|
|
2009-01-30 10:08:09 -05:00
|
|
|
void
|
2009-02-08 22:18:10 -05:00
|
|
|
BundleEditorMatrix::setup_ports (int dim)
|
2009-01-25 01:47:11 -05:00
|
|
|
{
|
2009-02-08 22:18:10 -05:00
|
|
|
if (dim == OURS) {
|
|
|
|
_ports[OURS].clear ();
|
|
|
|
_ports[OURS].add_group (_port_group);
|
|
|
|
} else {
|
|
|
|
_ports[OTHER].suspend_signals ();
|
2009-11-14 18:08:17 -05:00
|
|
|
|
|
|
|
/* when we gather, allow the matrix to contain bundles with duplicate port sets,
|
2021-02-26 13:14:57 -05:00
|
|
|
* otherwise ports already associated with this bundle will be hidden, making
|
|
|
|
* the bundle editor useless */
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2012-05-20 17:56:28 -04:00
|
|
|
_ports[OTHER].gather (_session, DataType::NIL, _bundle->ports_are_inputs(), true, show_only_bundles ());
|
2009-02-08 22:18:10 -05:00
|
|
|
_ports[OTHER].remove_bundle (_bundle);
|
|
|
|
_ports[OTHER].resume_signals ();
|
|
|
|
}
|
2007-10-19 09:30:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-07-19 20:22:09 -04:00
|
|
|
BundleEditorMatrix::set_state (BundleChannel c[2], bool s)
|
2007-10-19 09:30:07 -04:00
|
|
|
{
|
2009-07-19 20:22:09 -04:00
|
|
|
Bundle::PortList const& pl = c[OTHER].bundle->channel_ports (c[OTHER].channel);
|
|
|
|
for (Bundle::PortList::const_iterator i = pl.begin(); i != pl.end(); ++i) {
|
2009-01-20 09:46:00 -05:00
|
|
|
if (s) {
|
2009-01-30 10:08:09 -05:00
|
|
|
c[OURS].bundle->add_port_to_channel (c[OURS].channel, *i);
|
2009-01-20 09:46:00 -05:00
|
|
|
} else {
|
2009-01-30 10:08:09 -05:00
|
|
|
c[OURS].bundle->remove_port_from_channel (c[OURS].channel, *i);
|
2009-01-20 09:46:00 -05:00
|
|
|
}
|
2007-10-19 09:30:07 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-03 10:31:42 -04:00
|
|
|
PortMatrixNode::State
|
2009-07-19 20:22:09 -04:00
|
|
|
BundleEditorMatrix::get_state (BundleChannel c[2]) const
|
2007-10-19 09:30:07 -04:00
|
|
|
{
|
2011-08-19 10:45:08 -04:00
|
|
|
if (c[0].bundle->nchannels() == ChanCount::ZERO || c[1].bundle->nchannels() == ChanCount::ZERO) {
|
|
|
|
return PortMatrixNode::NOT_ASSOCIATED;
|
|
|
|
}
|
|
|
|
|
2009-07-19 20:22:09 -04:00
|
|
|
Bundle::PortList const& pl = c[OTHER].bundle->channel_ports (c[OTHER].channel);
|
2009-11-07 15:33:41 -05:00
|
|
|
if (pl.empty ()) {
|
|
|
|
return PortMatrixNode::NOT_ASSOCIATED;
|
|
|
|
}
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2009-07-19 20:22:09 -04:00
|
|
|
for (Bundle::PortList::const_iterator i = pl.begin(); i != pl.end(); ++i) {
|
2009-01-30 10:08:09 -05:00
|
|
|
if (!c[OURS].bundle->port_attached_to_channel (c[OURS].channel, *i)) {
|
2009-05-03 10:31:42 -04:00
|
|
|
return PortMatrixNode::NOT_ASSOCIATED;
|
2009-01-20 09:46:00 -05:00
|
|
|
}
|
|
|
|
}
|
2007-10-19 09:30:07 -04:00
|
|
|
|
2009-05-03 10:31:42 -04:00
|
|
|
return PortMatrixNode::ASSOCIATED;
|
2007-10-19 09:30:07 -04:00
|
|
|
}
|
|
|
|
|
2009-07-19 20:22:09 -04:00
|
|
|
bool
|
2023-02-16 18:33:28 -05:00
|
|
|
BundleEditorMatrix::can_add_channels (std::shared_ptr<Bundle> b) const
|
2009-07-19 16:12:59 -04:00
|
|
|
{
|
2009-07-19 20:22:09 -04:00
|
|
|
if (b == _bundle) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-05-20 17:56:33 -04:00
|
|
|
return PortMatrix::can_add_channels (b);
|
2009-07-19 16:12:59 -04:00
|
|
|
}
|
|
|
|
|
2021-02-26 08:06:04 -05:00
|
|
|
bool
|
2023-02-16 18:33:28 -05:00
|
|
|
BundleEditorMatrix::can_add_port (std::shared_ptr<Bundle> b, DataType t) const
|
2021-02-26 08:06:04 -05:00
|
|
|
{
|
|
|
|
#if 1
|
|
|
|
return true; // anything goes
|
|
|
|
#else
|
|
|
|
/* Do not allow to mix datatypes */
|
|
|
|
return _bundle->nchannels().get (t) > 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2009-01-20 09:46:00 -05:00
|
|
|
void
|
2023-02-16 18:33:28 -05:00
|
|
|
BundleEditorMatrix::add_channel (std::shared_ptr<Bundle> b, DataType t)
|
2007-10-19 09:30:07 -04:00
|
|
|
{
|
2009-07-19 20:22:09 -04:00
|
|
|
if (b == _bundle) {
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-19 20:22:09 -04:00
|
|
|
NameChannelDialog d;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-19 20:22:09 -04:00
|
|
|
if (d.run () != Gtk::RESPONSE_ACCEPT) {
|
|
|
|
return;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-06-30 21:14:14 -04:00
|
|
|
_bundle->add_channel (d.get_name(), t);
|
2009-07-19 20:22:09 -04:00
|
|
|
setup_ports (OURS);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-19 20:22:09 -04:00
|
|
|
} else {
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-06-30 21:14:14 -04:00
|
|
|
PortMatrix::add_channel (b, t);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-19 20:22:09 -04:00
|
|
|
}
|
|
|
|
}
|
2007-10-19 09:30:07 -04:00
|
|
|
|
2009-07-19 20:22:09 -04:00
|
|
|
bool
|
2023-02-16 18:33:28 -05:00
|
|
|
BundleEditorMatrix::can_remove_channels (std::shared_ptr<Bundle> b) const
|
2009-07-19 20:22:09 -04:00
|
|
|
{
|
2021-02-26 08:06:04 -05:00
|
|
|
if (b != _bundle) {
|
|
|
|
return false;
|
2009-01-20 09:46:00 -05:00
|
|
|
}
|
2021-02-26 08:06:04 -05:00
|
|
|
return _bundle->n_total () > 1;
|
2007-10-19 09:30:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-07-19 20:22:09 -04:00
|
|
|
BundleEditorMatrix::remove_channel (BundleChannel bc)
|
2007-10-19 09:30:07 -04:00
|
|
|
{
|
2009-01-30 10:08:09 -05:00
|
|
|
bc.bundle->remove_channel (bc.channel);
|
2009-02-08 22:18:10 -05:00
|
|
|
setup_ports (OURS);
|
2007-10-19 09:30:07 -04:00
|
|
|
}
|
|
|
|
|
2009-07-19 20:22:09 -04:00
|
|
|
bool
|
2023-02-16 18:33:28 -05:00
|
|
|
BundleEditorMatrix::can_rename_channels (std::shared_ptr<Bundle> b) const
|
2009-07-19 20:22:09 -04:00
|
|
|
{
|
|
|
|
if (b == _bundle) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return PortMatrix::can_rename_channels (b);
|
|
|
|
}
|
|
|
|
|
2007-10-19 09:30:07 -04:00
|
|
|
void
|
2009-07-19 20:22:09 -04:00
|
|
|
BundleEditorMatrix::rename_channel (BundleChannel bc)
|
2007-10-19 09:30:07 -04:00
|
|
|
{
|
2009-01-30 10:08:09 -05:00
|
|
|
NameChannelDialog d (bc.bundle, bc.channel);
|
2007-10-19 09:30:07 -04:00
|
|
|
|
2009-01-20 09:46:00 -05:00
|
|
|
if (d.run () != Gtk::RESPONSE_ACCEPT) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-01-30 10:08:09 -05:00
|
|
|
bc.bundle->set_channel_name (bc.channel, d.get_name ());
|
2007-10-19 09:30:07 -04:00
|
|
|
}
|
|
|
|
|
2009-02-08 22:18:10 -05:00
|
|
|
bool
|
|
|
|
BundleEditorMatrix::list_is_global (int dim) const
|
|
|
|
{
|
|
|
|
return (dim == OTHER);
|
|
|
|
}
|
|
|
|
|
2010-05-07 21:20:33 -04:00
|
|
|
string
|
|
|
|
BundleEditorMatrix::disassociation_verb () const
|
|
|
|
{
|
|
|
|
return _("Disassociate");
|
|
|
|
}
|
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
BundleEditor::BundleEditor (Session* session, std::shared_ptr<UserBundle> bundle)
|
2009-07-21 21:28:31 -04:00
|
|
|
: ArdourDialog (_("Edit Bundle")), _matrix (this, session, bundle), _bundle (bundle)
|
2007-10-19 09:30:07 -04:00
|
|
|
{
|
|
|
|
Gtk::Table* t = new Gtk::Table (3, 2);
|
|
|
|
t->set_spacings (4);
|
|
|
|
|
2009-01-20 09:46:00 -05:00
|
|
|
/* Bundle name */
|
2007-10-19 09:30:07 -04:00
|
|
|
Gtk::Alignment* a = new Gtk::Alignment (1, 0.5, 0, 1);
|
|
|
|
a->add (*Gtk::manage (new Gtk::Label (_("Name:"))));
|
|
|
|
t->attach (*Gtk::manage (a), 0, 1, 0, 1, Gtk::FILL, Gtk::FILL);
|
|
|
|
t->attach (_name, 1, 2, 0, 1);
|
|
|
|
_name.set_text (_bundle->name ());
|
|
|
|
_name.signal_changed().connect (sigc::mem_fun (*this, &BundleEditor::name_changed));
|
|
|
|
|
2009-01-20 09:46:00 -05:00
|
|
|
/* Direction (input or output) */
|
2007-10-19 09:30:07 -04:00
|
|
|
a = new Gtk::Alignment (1, 0.5, 0, 1);
|
|
|
|
a->add (*Gtk::manage (new Gtk::Label (_("Direction:"))));
|
|
|
|
t->attach (*Gtk::manage (a), 0, 1, 1, 2, Gtk::FILL, Gtk::FILL);
|
|
|
|
a = new Gtk::Alignment (0, 0.5, 0, 1);
|
|
|
|
a->add (_input_or_output);
|
|
|
|
t->attach (*Gtk::manage (a), 1, 2, 1, 2);
|
2022-01-26 15:11:15 -05:00
|
|
|
_input_or_output.append (_("Destination"));
|
|
|
|
_input_or_output.append (_("Source"));
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-10-19 09:30:07 -04:00
|
|
|
if (bundle->ports_are_inputs()) {
|
2016-08-21 16:58:01 -04:00
|
|
|
_input_or_output.set_active_text (_("Destination"));
|
2021-02-26 07:44:04 -05:00
|
|
|
} else {
|
|
|
|
_input_or_output.set_active_text (_("Source"));
|
2007-10-19 09:30:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
_input_or_output.signal_changed().connect (sigc::mem_fun (*this, &BundleEditor::input_or_output_changed));
|
|
|
|
|
|
|
|
get_vbox()->pack_start (*Gtk::manage (t), false, false);
|
|
|
|
get_vbox()->pack_start (_matrix);
|
|
|
|
get_vbox()->set_spacing (4);
|
|
|
|
|
|
|
|
show_all ();
|
2012-06-20 18:01:22 -04:00
|
|
|
|
|
|
|
signal_key_press_event().connect (sigc::mem_fun (_matrix, &BundleEditorMatrix::key_press));
|
2009-08-29 16:48:11 -04:00
|
|
|
}
|
2009-07-21 21:28:31 -04:00
|
|
|
|
2009-08-29 16:48:11 -04:00
|
|
|
void
|
|
|
|
BundleEditor::on_show ()
|
|
|
|
{
|
|
|
|
Gtk::Window::on_show ();
|
|
|
|
pair<uint32_t, uint32_t> const pm_max = _matrix.max_size ();
|
|
|
|
resize_window_to_proportion_of_monitor (this, pm_max.first, pm_max.second);
|
2007-10-19 09:30:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BundleEditor::name_changed ()
|
|
|
|
{
|
|
|
|
_bundle->set_name (_name.get_text ());
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BundleEditor::input_or_output_changed ()
|
|
|
|
{
|
2009-02-08 22:18:10 -05:00
|
|
|
_bundle->remove_ports_from_channels ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2016-08-21 16:58:01 -04:00
|
|
|
if (_input_or_output.get_active_text() == _("Source")) {
|
2007-10-19 09:30:07 -04:00
|
|
|
_bundle->set_ports_are_outputs ();
|
2009-02-08 22:18:10 -05:00
|
|
|
} else {
|
|
|
|
_bundle->set_ports_are_inputs ();
|
2007-10-19 09:30:07 -04:00
|
|
|
}
|
2009-01-30 10:08:09 -05:00
|
|
|
|
2009-02-08 22:18:10 -05:00
|
|
|
_matrix.setup_all_ports ();
|
2007-10-19 09:30:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BundleEditor::on_map ()
|
|
|
|
{
|
2009-02-08 22:18:10 -05:00
|
|
|
_matrix.setup_all_ports ();
|
2007-10-19 09:30:07 -04:00
|
|
|
Window::on_map ();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-04 22:04:54 -05:00
|
|
|
BundleManager::BundleManager (Session* session)
|
2009-12-17 13:24:23 -05:00
|
|
|
: ArdourDialog (_("Bundle Manager"))
|
|
|
|
, edit_button (_("Edit"))
|
|
|
|
, delete_button (_("Delete"))
|
2007-10-19 09:30:07 -04:00
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
set_session (session);
|
|
|
|
|
2007-10-19 09:30:07 -04:00
|
|
|
_list_model = Gtk::ListStore::create (_list_model_columns);
|
|
|
|
_tree_view.set_model (_list_model);
|
|
|
|
_tree_view.append_column (_("Name"), _list_model_columns.name);
|
|
|
|
_tree_view.set_headers_visible (false);
|
|
|
|
|
2023-04-07 17:33:13 -04:00
|
|
|
std::shared_ptr<BundleList const> bundles = _session->bundles ();
|
|
|
|
for (auto const& i : *bundles) {
|
|
|
|
add_bundle (i);
|
2009-01-25 01:47:11 -05:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-10-19 09:30:07 -04:00
|
|
|
/* New / Edit / Delete buttons */
|
|
|
|
Gtk::VBox* buttons = new Gtk::VBox;
|
|
|
|
buttons->set_spacing (8);
|
|
|
|
Gtk::Button* b = new Gtk::Button (_("New"));
|
|
|
|
b->set_image (*Gtk::manage (new Gtk::Image (Gtk::Stock::NEW, Gtk::ICON_SIZE_BUTTON)));
|
|
|
|
b->signal_clicked().connect (sigc::mem_fun (*this, &BundleManager::new_clicked));
|
|
|
|
buttons->pack_start (*Gtk::manage (b), false, false);
|
|
|
|
edit_button.set_image (*Gtk::manage (new Gtk::Image (Gtk::Stock::EDIT, Gtk::ICON_SIZE_BUTTON)));
|
|
|
|
edit_button.signal_clicked().connect (sigc::mem_fun (*this, &BundleManager::edit_clicked));
|
|
|
|
buttons->pack_start (edit_button, false, false);
|
2013-07-11 22:05:06 -04:00
|
|
|
delete_button.set_image (*Gtk::manage (new Gtk::Image (Gtk::StockID(GTK_STOCK_DELETE), Gtk::ICON_SIZE_BUTTON)));
|
2007-10-19 09:30:07 -04:00
|
|
|
delete_button.signal_clicked().connect (sigc::mem_fun (*this, &BundleManager::delete_clicked));
|
|
|
|
buttons->pack_start (delete_button, false, false);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-10-19 09:30:07 -04:00
|
|
|
Gtk::HBox* h = new Gtk::HBox;
|
|
|
|
h->set_spacing (8);
|
|
|
|
h->set_border_width (8);
|
|
|
|
h->pack_start (_tree_view);
|
|
|
|
h->pack_start (*Gtk::manage (buttons), false, false);
|
|
|
|
|
|
|
|
get_vbox()->set_spacing (8);
|
|
|
|
get_vbox()->pack_start (*Gtk::manage (h));
|
|
|
|
|
|
|
|
set_default_size (480, 240);
|
|
|
|
|
|
|
|
_tree_view.get_selection()->signal_changed().connect (
|
|
|
|
sigc::mem_fun (*this, &BundleManager::set_button_sensitivity)
|
|
|
|
);
|
|
|
|
|
2009-11-07 15:33:41 -05:00
|
|
|
_tree_view.signal_row_activated().connect (
|
|
|
|
sigc::mem_fun (*this, &BundleManager::row_activated)
|
|
|
|
);
|
|
|
|
|
2007-10-19 09:30:07 -04:00
|
|
|
set_button_sensitivity ();
|
|
|
|
|
|
|
|
show_all ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BundleManager::set_button_sensitivity ()
|
|
|
|
{
|
|
|
|
bool const sel = (_tree_view.get_selection()->get_selected() != 0);
|
|
|
|
edit_button.set_sensitive (sel);
|
|
|
|
delete_button.set_sensitive (sel);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
BundleManager::new_clicked ()
|
|
|
|
{
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<UserBundle> b (new UserBundle (_("Bundle")));
|
2007-10-19 09:30:07 -04:00
|
|
|
|
|
|
|
/* Start off with a single channel */
|
2010-06-29 22:59:13 -04:00
|
|
|
/* XXX: allow user to specify type */
|
|
|
|
b->add_channel ("1", DataType::AUDIO);
|
2007-10-19 09:30:07 -04:00
|
|
|
|
2009-12-04 22:04:54 -05:00
|
|
|
_session->add_bundle (b);
|
2009-11-07 15:33:41 -05:00
|
|
|
add_bundle (b);
|
2009-02-08 22:18:10 -05:00
|
|
|
|
2009-11-07 15:33:41 -05:00
|
|
|
BundleEditor e (_session, b);
|
|
|
|
e.run ();
|
2007-10-19 09:30:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BundleManager::edit_clicked ()
|
|
|
|
{
|
|
|
|
Gtk::TreeModel::iterator i = _tree_view.get_selection()->get_selected();
|
|
|
|
if (i) {
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<UserBundle> b = (*i)[_list_model_columns.bundle];
|
2009-11-07 15:33:41 -05:00
|
|
|
BundleEditor e (_session, b);
|
|
|
|
e.run ();
|
2007-10-19 09:30:07 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BundleManager::delete_clicked ()
|
|
|
|
{
|
|
|
|
Gtk::TreeModel::iterator i = _tree_view.get_selection()->get_selected();
|
|
|
|
if (i) {
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<UserBundle> b = (*i)[_list_model_columns.bundle];
|
2009-12-04 22:04:54 -05:00
|
|
|
_session->remove_bundle (b);
|
2007-10-19 09:30:07 -04:00
|
|
|
_list_model->erase (i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2023-02-16 18:33:28 -05:00
|
|
|
BundleManager::add_bundle (std::shared_ptr<Bundle> b)
|
2007-10-19 09:30:07 -04:00
|
|
|
{
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<UserBundle> u = std::dynamic_pointer_cast<UserBundle> (b);
|
2007-10-19 09:30:07 -04:00
|
|
|
if (u == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Gtk::TreeModel::iterator i = _list_model->append ();
|
|
|
|
(*i)[_list_model_columns.name] = u->name ();
|
|
|
|
(*i)[_list_model_columns.bundle] = u;
|
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
u->Changed.connect (bundle_connections, invalidator (*this), boost::bind (&BundleManager::bundle_changed, this, _1, std::weak_ptr<UserBundle> (u)), gui_context());
|
2007-10-19 09:30:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2023-02-16 18:33:28 -05:00
|
|
|
BundleManager::bundle_changed (Bundle::Change c, std::weak_ptr<UserBundle> wb)
|
2007-10-19 09:30:07 -04:00
|
|
|
{
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<UserBundle> b = wb.lock ();
|
2020-09-04 16:47:20 -04:00
|
|
|
if (!b || 0 == (c & Bundle::NameChanged)) {
|
2009-02-08 22:18:10 -05:00
|
|
|
return;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-10-19 09:30:07 -04:00
|
|
|
Gtk::TreeModel::iterator i = _list_model->children().begin ();
|
|
|
|
while (i != _list_model->children().end()) {
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<UserBundle> t = (*i)[_list_model_columns.bundle];
|
2007-10-19 09:30:07 -04:00
|
|
|
if (t == b) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i != _list_model->children().end()) {
|
|
|
|
(*i)[_list_model_columns.name] = b->name ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-07 15:33:41 -05:00
|
|
|
void
|
2009-12-21 13:23:07 -05:00
|
|
|
BundleManager::row_activated (Gtk::TreeModel::Path const & p, Gtk::TreeViewColumn*)
|
2009-11-07 15:33:41 -05:00
|
|
|
{
|
|
|
|
Gtk::TreeModel::iterator i = _list_model->get_iter (p);
|
|
|
|
if (!i) {
|
|
|
|
return;
|
|
|
|
}
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<UserBundle> b = (*i)[_list_model_columns.bundle];
|
2009-11-07 15:33:41 -05:00
|
|
|
BundleEditor e (_session, b);
|
|
|
|
e.run ();
|
|
|
|
}
|
|
|
|
|
2009-01-20 09:46:00 -05:00
|
|
|
NameChannelDialog::NameChannelDialog ()
|
2010-05-02 19:54:25 -04:00
|
|
|
: ArdourDialog (_("Add Channel")),
|
2009-01-20 09:46:00 -05:00
|
|
|
_adding (true)
|
|
|
|
{
|
|
|
|
setup ();
|
|
|
|
}
|
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
NameChannelDialog::NameChannelDialog (std::shared_ptr<Bundle> b, uint32_t c)
|
2010-05-02 19:54:25 -04:00
|
|
|
: ArdourDialog (_("Rename Channel")),
|
2009-01-20 09:46:00 -05:00
|
|
|
_bundle (b),
|
|
|
|
_adding (false)
|
|
|
|
{
|
|
|
|
_name.set_text (b->channel_name (c));
|
|
|
|
|
|
|
|
setup ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
NameChannelDialog::setup ()
|
2009-10-14 12:10:01 -04:00
|
|
|
{
|
2009-01-20 09:46:00 -05:00
|
|
|
Gtk::HBox* box = Gtk::manage (new Gtk::HBox ());
|
|
|
|
|
|
|
|
box->pack_start (*Gtk::manage (new Gtk::Label (_("Name"))));
|
|
|
|
box->pack_start (_name);
|
2009-11-07 15:33:41 -05:00
|
|
|
_name.set_activates_default (true);
|
2009-01-20 09:46:00 -05:00
|
|
|
|
|
|
|
get_vbox ()->pack_end (*box);
|
|
|
|
box->show_all ();
|
|
|
|
|
|
|
|
add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
|
|
|
|
if (_adding) {
|
|
|
|
add_button (Gtk::Stock::ADD, Gtk::RESPONSE_ACCEPT);
|
|
|
|
} else {
|
|
|
|
add_button (Gtk::Stock::APPLY, Gtk::RESPONSE_ACCEPT);
|
|
|
|
}
|
|
|
|
set_default_response (Gtk::RESPONSE_ACCEPT);
|
|
|
|
}
|
|
|
|
|
2009-07-19 20:22:09 -04:00
|
|
|
string
|
2009-01-20 09:46:00 -05:00
|
|
|
NameChannelDialog::get_name () const
|
|
|
|
{
|
|
|
|
return _name.get_text ();
|
|
|
|
}
|
2009-08-29 16:48:11 -04:00
|
|
|
|