Various fixups to bundle manager. Add a separator between the benign and more serious menu options on the port matrix context menu. Finally (maybe) fix port matrix sizing issues relatively nicely.

git-svn-id: svn://localhost/ardour2/branches/3.0@5409 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2009-07-22 01:28:31 +00:00
parent 7186593442
commit 272cad6241
14 changed files with 80 additions and 115 deletions

View file

@ -34,9 +34,9 @@ using namespace std;
using namespace ARDOUR;
BundleEditorMatrix::BundleEditorMatrix (
Session& session, boost::shared_ptr<Bundle> bundle
Gtk::Window* parent, Session& session, boost::shared_ptr<Bundle> bundle
)
: PortMatrix (session, bundle->type()),
: PortMatrix (parent, session, bundle->type()),
_bundle (bundle)
{
_port_group = boost::shared_ptr<PortGroup> (new PortGroup (""));
@ -161,8 +161,8 @@ BundleEditorMatrix::list_is_global (int dim) const
return (dim == OTHER);
}
BundleEditor::BundleEditor (Session& session, boost::shared_ptr<UserBundle> bundle, bool /*add*/)
: ArdourDialog (_("Edit Bundle")), _matrix (session, bundle), _bundle (bundle)
BundleEditor::BundleEditor (Session& session, boost::shared_ptr<UserBundle> bundle, bool add)
: ArdourDialog (_("Edit Bundle")), _matrix (this, session, bundle), _bundle (bundle)
{
Gtk::Table* t = new Gtk::Table (3, 2);
t->set_spacings (4);
@ -219,7 +219,16 @@ BundleEditor::BundleEditor (Session& session, boost::shared_ptr<UserBundle> bund
get_vbox()->pack_start (_matrix);
get_vbox()->set_spacing (4);
add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
if (add) {
add_button (Gtk::Stock::ADD, Gtk::RESPONSE_ACCEPT);
} else {
add_button (Gtk::Stock::APPLY, Gtk::RESPONSE_ACCEPT);
}
show_all ();
resize (32768, 32768);
}
void
@ -321,10 +330,10 @@ BundleManager::set_button_sensitivity ()
void
BundleManager::new_clicked ()
{
boost::shared_ptr<UserBundle> b (new UserBundle (""));
boost::shared_ptr<UserBundle> b (new UserBundle (_("Bundle")));
/* Start off with a single channel */
b->add_channel ("");
b->add_channel ("1");
BundleEditor e (_session, b, true);

View file

@ -35,7 +35,7 @@ namespace ARDOUR {
class BundleEditorMatrix : public PortMatrix
{
public:
BundleEditorMatrix (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;

View file

@ -30,8 +30,8 @@
using namespace std;
GlobalPortMatrix::GlobalPortMatrix (ARDOUR::Session& s, ARDOUR::DataType t)
: PortMatrix (s, t)
GlobalPortMatrix::GlobalPortMatrix (Gtk::Window* p, ARDOUR::Session& s, ARDOUR::DataType t)
: PortMatrix (p, s, t)
{
setup_all_ports ();
}
@ -110,7 +110,7 @@ GlobalPortMatrix::get_state (ARDOUR::BundleChannel c[2]) const
}
GlobalPortMatrixWindow::GlobalPortMatrixWindow (ARDOUR::Session& s, ARDOUR::DataType t)
: _port_matrix (s, t)
: _port_matrix (this, s, t)
{
switch (t) {
case ARDOUR::DataType::AUDIO:
@ -128,36 +128,11 @@ GlobalPortMatrixWindow::GlobalPortMatrixWindow (ARDOUR::Session& s, ARDOUR::Data
people with very large monitors */
resize (32768, 32768);
_port_matrix.MaxSizeChanged.connect (mem_fun (*this, &GlobalPortMatrixWindow::max_size_changed));
}
void
GlobalPortMatrixWindow::on_realize ()
GlobalPortMatrixWindow::on_show ()
{
Window::on_realize ();
set_max_size ();
}
void
GlobalPortMatrixWindow::max_size_changed ()
{
set_max_size ();
resize (32768, 32768);
}
void
GlobalPortMatrixWindow::set_max_size ()
{
if ((get_flags() & Gtk::REALIZED) == 0) {
return;
}
pair<uint32_t, uint32_t> const m = _port_matrix.max_size ();
GdkGeometry g;
g.max_width = m.first;
g.max_height = m.second;
set_geometry_hints (*this, g, Gdk::HINT_MAX_SIZE);
Gtk::Window::on_show ();
_port_matrix.setup_max_size ();
}

View file

@ -29,7 +29,7 @@
class GlobalPortMatrix : public PortMatrix
{
public:
GlobalPortMatrix (ARDOUR::Session&, ARDOUR::DataType);
GlobalPortMatrix (Gtk::Window*, ARDOUR::Session&, ARDOUR::DataType);
void setup_ports (int);
@ -63,9 +63,7 @@ public:
GlobalPortMatrixWindow (ARDOUR::Session&, ARDOUR::DataType);
private:
void on_realize ();
void max_size_changed ();
void set_max_size ();
void on_show ();
GlobalPortMatrix _port_matrix;
Gtk::Button _rescan_button;

View file

@ -41,8 +41,8 @@
using namespace ARDOUR;
using namespace Gtk;
IOSelector::IOSelector (ARDOUR::Session& session, boost::shared_ptr<ARDOUR::IO> io)
: PortMatrix (session, io->default_type())
IOSelector::IOSelector (Gtk::Window* p, ARDOUR::Session& session, boost::shared_ptr<ARDOUR::IO> io)
: PortMatrix (p, session, io->default_type())
, _io (io)
{
/* signal flow from 0 to 1 */
@ -152,7 +152,7 @@ IOSelector::list_is_global (int dim) const
}
IOSelectorWindow::IOSelectorWindow (ARDOUR::Session& session, boost::shared_ptr<ARDOUR::IO> io, bool /*can_cancel*/)
: _selector (session, io)
: _selector (this, session, io)
{
set_name ("IOSelectorWindow2");
set_title (_("I/O selector"));
@ -168,8 +168,6 @@ IOSelectorWindow::IOSelectorWindow (ARDOUR::Session& session, boost::shared_ptr<
signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), this));
resize (32768, 32768);
_selector.MaxSizeChanged.connect (mem_fun (*this, &IOSelectorWindow::max_size_changed));
}
void
@ -195,37 +193,9 @@ IOSelectorWindow::io_name_changed (void* src)
set_title (title);
}
void
IOSelectorWindow::on_realize ()
{
Window::on_realize ();
set_max_size ();
}
void
IOSelectorWindow::set_max_size ()
{
pair<uint32_t, uint32_t> const m = _selector.max_size ();
GdkGeometry g;
g.max_width = m.first;
g.max_height = m.second;
set_geometry_hints (*this, g, Gdk::HINT_MAX_SIZE);
}
void
IOSelectorWindow::max_size_changed ()
{
set_max_size ();
resize (32768, 32768);
}
PortInsertUI::PortInsertUI (ARDOUR::Session& sess, boost::shared_ptr<ARDOUR::PortInsert> pi)
: input_selector (sess, pi->input())
, output_selector (sess, pi->output())
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())
{
output_selector.set_min_height_divisor (2);
input_selector.set_min_height_divisor (2);
@ -251,7 +221,7 @@ PortInsertUI::finished (IOSelector::Result r)
PortInsertWindow::PortInsertWindow (ARDOUR::Session& sess, boost::shared_ptr<ARDOUR::PortInsert> pi, bool can_cancel)
: ArdourDialog ("port insert dialog"),
_portinsertui (sess, pi),
_portinsertui (this, sess, pi),
ok_button (can_cancel ? _("OK"): _("Close")),
cancel_button (_("Cancel"))
{

View file

@ -31,7 +31,7 @@ namespace ARDOUR {
class IOSelector : public PortMatrix
{
public:
IOSelector (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;
@ -79,21 +79,18 @@ class IOSelectorWindow : public Gtk::Window
protected:
void on_map ();
void on_realize ();
private:
IOSelector _selector;
void io_name_changed (void *src);
void set_max_size ();
void max_size_changed ();
};
class PortInsertUI : public Gtk::VBox
{
public:
PortInsertUI (ARDOUR::Session&, boost::shared_ptr<ARDOUR::PortInsert>);
PortInsertUI (Gtk::Window*, ARDOUR::Session&, boost::shared_ptr<ARDOUR::PortInsert>);
void redisplay ();
void finished (IOSelector::Result);

View file

@ -24,6 +24,7 @@
#include <gtkmm/menu.h>
#include <gtkmm/menushell.h>
#include <gtkmm/menu_elems.h>
#include <gtkmm/window.h>
#include "ardour/bundle.h"
#include "ardour/types.h"
#include "ardour/session.h"
@ -42,9 +43,10 @@ using namespace ARDOUR;
* @param session Our session.
* @param type Port type that we are handling.
*/
PortMatrix::PortMatrix (Session& session, DataType type)
PortMatrix::PortMatrix (Window* parent, Session& session, DataType type)
: Table (2, 2),
_session (session),
_parent (parent),
_type (type),
_menu (0),
_arrangement (TOP_TO_RIGHT),
@ -280,15 +282,6 @@ PortMatrix::popup_menu (
sub.push_back (MenuElem (buf, bind (mem_fun (*this, &PortMatrix::add_channel_proxy), w)));
}
if (can_remove_channels (bc[dim].bundle)) {
snprintf (buf, sizeof (buf), _("Remove '%s'"), bc[dim].bundle->channel_name (bc[dim].channel).c_str());
sub.push_back (
MenuElem (
buf,
bind (mem_fun (*this, &PortMatrix::remove_channel_proxy), w, bc[dim].channel)
)
);
}
if (can_rename_channels (bc[dim].bundle)) {
snprintf (buf, sizeof (buf), _("Rename '%s'..."), bc[dim].bundle->channel_name (bc[dim].channel).c_str());
@ -299,7 +292,19 @@ PortMatrix::popup_menu (
)
);
}
sub.push_back (SeparatorElem ());
if (can_remove_channels (bc[dim].bundle)) {
snprintf (buf, sizeof (buf), _("Remove '%s'"), bc[dim].bundle->channel_name (bc[dim].channel).c_str());
sub.push_back (
MenuElem (
buf,
bind (mem_fun (*this, &PortMatrix::remove_channel_proxy), w, bc[dim].channel)
)
);
}
if (_show_only_bundles) {
snprintf (buf, sizeof (buf), _("%s all"), disassociation_verb().c_str());
} else {
@ -473,7 +478,17 @@ PortMatrix::max_size () const
void
PortMatrix::setup_max_size ()
{
MaxSizeChanged ();
if (!_parent) {
return;
}
pair<uint32_t, uint32_t> const m = max_size ();
GdkGeometry g;
g.max_width = m.first;
g.max_height = m.second;
_parent->set_geometry_hints (*this, g, Gdk::HINT_MAX_SIZE);
}
bool

View file

@ -50,7 +50,7 @@ class PortMatrixBody;
class PortMatrix : public Gtk::Table
{
public:
PortMatrix (ARDOUR::Session&, ARDOUR::DataType);
PortMatrix (Gtk::Window*, ARDOUR::Session&, ARDOUR::DataType);
~PortMatrix ();
void set_type (ARDOUR::DataType);
@ -112,7 +112,6 @@ public:
std::pair<uint32_t, uint32_t> max_size () const;
void setup_max_size ();
sigc::signal<void> MaxSizeChanged;
/** @param c Channels; where c[0] is from _ports[0] and c[1] is from _ports[1].
* @param s New state.
@ -172,6 +171,8 @@ private:
bool on_scroll_event (GdkEventScroll *);
boost::shared_ptr<ARDOUR::IO> io_from_bundle (boost::shared_ptr<ARDOUR::Bundle>) const;
Gtk::Window* _parent;
/// port type that we are working with
ARDOUR::DataType _type;
std::vector<sigc::connection> _route_connections;

View file

@ -33,7 +33,7 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
ReturnUI::ReturnUI (boost::shared_ptr<Return> r, Session& se)
ReturnUI::ReturnUI (Gtk::Window* parent, boost::shared_ptr<Return> r, Session& se)
: _return (r)
, _session (se)
, _gpm (se)
@ -48,7 +48,7 @@ ReturnUI::ReturnUI (boost::shared_ptr<Return> r, Session& se)
_vbox.pack_start (_hbox, false, false, false);
io = manage (new IOSelector (se, r->output()));
io = manage (new IOSelector (parent, se, r->output()));
pack_start (_vbox, false, false);
@ -101,7 +101,7 @@ ReturnUI::fast_update ()
ReturnUIWindow::ReturnUIWindow (boost::shared_ptr<Return> s, Session& ss)
: ArdourDialog (string("Ardour: return ") + s->name())
{
ui = new ReturnUI (s, ss);
ui = new ReturnUI (this, s, ss);
hpacker.pack_start (*ui, true, true);

View file

@ -35,7 +35,7 @@ class IOSelector;
class ReturnUI : public Gtk::HBox
{
public:
ReturnUI (boost::shared_ptr<ARDOUR::Return>, ARDOUR::Session&);
ReturnUI (Gtk::Window *,boost::shared_ptr<ARDOUR::Return>, ARDOUR::Session&);
~ReturnUI();
void update ();

View file

@ -304,13 +304,13 @@ RouteParams_UI::setup_io_frames()
cleanup_io_frames();
// input
_input_iosel = new IOSelector (*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 (*session, _route->output());
_output_iosel = new IOSelector (this, *session, _route->output());
_output_iosel->setup ();
output_frame.add (*_output_iosel);
output_frame.show_all();
@ -518,7 +518,7 @@ RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Processor> insert)
if ((send = boost::dynamic_pointer_cast<Send> (insert)) != 0) {
SendUI *send_ui = new SendUI (send, *session);
SendUI *send_ui = new SendUI (this, send, *session);
cleanup_view();
_plugin_conn = send->GoingAway.connect (bind (mem_fun(*this, &RouteParams_UI::redirect_going_away),
@ -530,7 +530,7 @@ RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Processor> insert)
} else if ((retrn = boost::dynamic_pointer_cast<Return> (insert)) != 0) {
ReturnUI *return_ui = new ReturnUI (retrn, *session);
ReturnUI *return_ui = new ReturnUI (this, retrn, *session);
cleanup_view();
_plugin_conn = retrn->GoingAway.connect (bind (mem_fun(*this, &RouteParams_UI::redirect_going_away),
@ -554,7 +554,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 (*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

@ -33,7 +33,7 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
SendUI::SendUI (boost::shared_ptr<Send> s, Session& se)
SendUI::SendUI (Gtk::Window* parent, boost::shared_ptr<Send> s, Session& se)
: _send (s)
, _session (se)
, _gpm (se)
@ -51,7 +51,7 @@ SendUI::SendUI (boost::shared_ptr<Send> s, Session& se)
_vbox.pack_start (_hbox, false, false, false);
_vbox.pack_start (_panners, false,false);
io = manage (new IOSelector (se, s->output()));
io = manage (new IOSelector (parent, se, s->output()));
pack_start (_vbox, false, false);
@ -121,7 +121,7 @@ SendUI::fast_update ()
SendUIWindow::SendUIWindow (boost::shared_ptr<Send> s, Session& ss)
: ArdourDialog (string("Ardour: send ") + s->name())
{
ui = new SendUI (s, ss);
ui = new SendUI (this, s, ss);
hpacker.pack_start (*ui, true, true);

View file

@ -35,7 +35,7 @@ class IOSelector;
class SendUI : public Gtk::HBox
{
public:
SendUI (boost::shared_ptr<ARDOUR::Send>, ARDOUR::Session&);
SendUI (Gtk::Window *, boost::shared_ptr<ARDOUR::Send>, ARDOUR::Session&);
~SendUI();
void update ();

View file

@ -14,8 +14,8 @@ using namespace ARDOUR;
class OptionsPortMatrix : public PortMatrix
{
public:
OptionsPortMatrix (ARDOUR::Session& session)
: PortMatrix (session, DataType::AUDIO)
OptionsPortMatrix (Gtk::Window* parent, ARDOUR::Session& session)
: PortMatrix (parent, session, DataType::AUDIO)
{
_port_group.reset (new PortGroup (""));
_ports[OURS].add_group (_port_group);
@ -117,8 +117,8 @@ private:
class ConnectionOptions : public OptionEditorBox
{
public:
ConnectionOptions (ARDOUR::Session* s)
: _port_matrix (*s)
ConnectionOptions (Gtk::Window* parent, ARDOUR::Session* s)
: _port_matrix (parent, *s)
{
_box->pack_start (_port_matrix);
}
@ -330,5 +330,5 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
mem_fun (*_session_config, &SessionConfiguration::set_bwf_organization_code)
));
add_option (_("Connections"), new ConnectionOptions (s));
add_option (_("Connections"), new ConnectionOptions (this, s));
}