mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 07:14:56 +01:00
Clean and overhaul up SendUI
* add polarity control * set transient parent * remove unused methods * clang-format source
This commit is contained in:
parent
8113633bb9
commit
5a48a56bfe
5 changed files with 81 additions and 103 deletions
|
|
@ -3964,8 +3964,9 @@ ProcessorBox::get_editor_window (boost::shared_ptr<Processor> processor, bool us
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boost::dynamic_pointer_cast<InternalSend> (processor) == 0) {
|
if (boost::dynamic_pointer_cast<InternalSend> (processor) == 0) {
|
||||||
|
Gtk::Window* tlw = dynamic_cast<Gtk::Window*> (get_toplevel ());
|
||||||
gidget = new SendUIWindow (send, _session);
|
assert (tlw);
|
||||||
|
gidget = new SendUIWindow (*tlw, _session, send);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ((retrn = boost::dynamic_pointer_cast<Return> (processor)) != 0) {
|
} else if ((retrn = boost::dynamic_pointer_cast<Return> (processor)) != 0) {
|
||||||
|
|
|
||||||
|
|
@ -362,13 +362,9 @@ RouteParams_UI::set_session (Session *sess)
|
||||||
boost::shared_ptr<RouteList> r = _session->get_routes();
|
boost::shared_ptr<RouteList> r = _session->get_routes();
|
||||||
add_routes (*r);
|
add_routes (*r);
|
||||||
_session->RouteAdded.connect (_session_connections, invalidator (*this), boost::bind (&RouteParams_UI::add_routes, this, _1), gui_context());
|
_session->RouteAdded.connect (_session_connections, invalidator (*this), boost::bind (&RouteParams_UI::add_routes, this, _1), gui_context());
|
||||||
start_updating ();
|
|
||||||
} else {
|
|
||||||
stop_updating ();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
RouteParams_UI::session_going_away ()
|
RouteParams_UI::session_going_away ()
|
||||||
{
|
{
|
||||||
|
|
@ -479,7 +475,7 @@ RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Processor> proc)
|
||||||
return;
|
return;
|
||||||
} else if ((send = boost::dynamic_pointer_cast<Send> (proc)) != 0) {
|
} else if ((send = boost::dynamic_pointer_cast<Send> (proc)) != 0) {
|
||||||
|
|
||||||
SendUI *send_ui = new SendUI (this, send, _session);
|
SendUI *send_ui = new SendUI (this, _session, send);
|
||||||
|
|
||||||
cleanup_view();
|
cleanup_view();
|
||||||
send->DropReferences.connect (_processor_going_away_connection, invalidator (*this), boost::bind (&RouteParams_UI::processor_going_away, this, boost::weak_ptr<Processor>(proc)), gui_context());
|
send->DropReferences.connect (_processor_going_away_connection, invalidator (*this), boost::bind (&RouteParams_UI::processor_going_away, this, boost::weak_ptr<Processor>(proc)), gui_context());
|
||||||
|
|
@ -576,27 +572,3 @@ RouteParams_UI::update_title ()
|
||||||
set_title(title.get_string());
|
set_title(title.get_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
RouteParams_UI::start_updating ()
|
|
||||||
{
|
|
||||||
update_connection = Timers::rapid_connect
|
|
||||||
(sigc::mem_fun(*this, &RouteParams_UI::update_views));
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
RouteParams_UI::stop_updating ()
|
|
||||||
{
|
|
||||||
update_connection.disconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
RouteParams_UI::update_views ()
|
|
||||||
{
|
|
||||||
SendUI *sui;
|
|
||||||
// TODO: only do it if correct tab is showing
|
|
||||||
|
|
||||||
if ((sui = dynamic_cast<SendUI*> (_active_view)) != 0) {
|
|
||||||
sui->update ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -174,12 +174,6 @@ private:
|
||||||
|
|
||||||
void update_title ();
|
void update_title ();
|
||||||
//void unselect_all_redirects ();
|
//void unselect_all_redirects ();
|
||||||
|
|
||||||
sigc::connection update_connection;
|
|
||||||
void update_views ();
|
|
||||||
|
|
||||||
void start_updating ();
|
|
||||||
void stop_updating ();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
#include "ardour/panner_manager.h"
|
#include "ardour/panner_manager.h"
|
||||||
#include "ardour/rc_configuration.h"
|
#include "ardour/rc_configuration.h"
|
||||||
#include "ardour/send.h"
|
#include "ardour/send.h"
|
||||||
|
#include "ardour/session.h"
|
||||||
|
|
||||||
#include "gui_thread.h"
|
#include "gui_thread.h"
|
||||||
#include "io_selector.h"
|
#include "io_selector.h"
|
||||||
|
|
@ -38,8 +39,9 @@ using namespace std;
|
||||||
using namespace ARDOUR;
|
using namespace ARDOUR;
|
||||||
using namespace PBD;
|
using namespace PBD;
|
||||||
|
|
||||||
SendUI::SendUI (Gtk::Window* parent, boost::shared_ptr<Send> s, Session* session)
|
SendUI::SendUI (Gtk::Window* parent, Session* session, boost::shared_ptr<Send> s)
|
||||||
: _send (s)
|
: _send (s)
|
||||||
|
, _invert_button (X_("Ø"))
|
||||||
, _gpm (session, 250)
|
, _gpm (session, 250)
|
||||||
, _panners (session)
|
, _panners (session)
|
||||||
{
|
{
|
||||||
|
|
@ -47,12 +49,13 @@ SendUI::SendUI (Gtk::Window* parent, boost::shared_ptr<Send> s, Session* session
|
||||||
|
|
||||||
uint32_t const in = _send->pans_required ();
|
uint32_t const in = _send->pans_required ();
|
||||||
uint32_t const out = _send->pan_outs ();
|
uint32_t const out = _send->pan_outs ();
|
||||||
|
|
||||||
_panners.set_width (Wide);
|
_panners.set_width (Wide);
|
||||||
_panners.set_available_panners (PannerManager::instance ().PannerManager::get_available_panners (in, out));
|
_panners.set_available_panners (PannerManager::instance ().PannerManager::get_available_panners (in, out));
|
||||||
_panners.set_panner (s->panner_shell (), s->panner ());
|
_panners.set_panner (s->panner_shell (), s->panner ());
|
||||||
|
|
||||||
_send->set_metering (true);
|
_send->set_metering (true);
|
||||||
_send->output ()->changed.connect (connections, invalidator (*this), boost::bind (&SendUI::outs_changed, this, _1, _2), gui_context ());
|
_send->output ()->changed.connect (_send_connection, invalidator (*this), boost::bind (&SendUI::outs_changed, this, _1, _2), gui_context ());
|
||||||
|
|
||||||
_gpm.setup_meters ();
|
_gpm.setup_meters ();
|
||||||
_gpm.set_fader_name (X_("SendUIFader"));
|
_gpm.set_fader_name (X_("SendUIFader"));
|
||||||
|
|
@ -60,34 +63,34 @@ SendUI::SendUI (Gtk::Window* parent, boost::shared_ptr<Send> s, Session* session
|
||||||
|
|
||||||
_io = Gtk::manage (new IOSelector (parent, session, s->output ()));
|
_io = Gtk::manage (new IOSelector (parent, session, s->output ()));
|
||||||
|
|
||||||
|
_invert_button.set_controllable (_send->polarity_control ());
|
||||||
|
_invert_button.watch ();
|
||||||
|
_invert_button.set_name (X_("invert button"));
|
||||||
|
_invert_button.signal_button_press_event ().connect (sigc::mem_fun (*this, &SendUI::invert_press), false);
|
||||||
|
_invert_button.signal_button_release_event ().connect (sigc::mem_fun (*this, &SendUI::invert_release), false);
|
||||||
|
Gtkmm2ext::UI::instance ()->set_tip (_invert_button, _("Click to invert polarity of all send channels"));
|
||||||
|
|
||||||
set_name (X_("SendUIFrame"));
|
set_name (X_("SendUIFrame"));
|
||||||
|
|
||||||
_hbox.pack_start (_gpm, true, true);
|
_vbox.set_spacing (4);
|
||||||
|
_vbox.set_border_width (4);
|
||||||
_vbox.set_spacing (5);
|
_vbox.pack_start (_gpm, false, false, false);
|
||||||
_vbox.set_border_width (5);
|
_vbox.pack_start (_invert_button, false, false);
|
||||||
_vbox.pack_start (_hbox, false, false, false);
|
|
||||||
_vbox.pack_start (_panners, false, false);
|
_vbox.pack_start (_panners, false, false);
|
||||||
|
|
||||||
pack_start (_vbox, false, false);
|
pack_start (_vbox, false, false);
|
||||||
pack_start (*_io, true, true);
|
pack_start (*_io, true, true);
|
||||||
|
|
||||||
_io->show ();
|
_io->show ();
|
||||||
_gpm.show_all ();
|
_vbox.show_all ();
|
||||||
_panners.show_all ();
|
|
||||||
_vbox.show ();
|
|
||||||
_hbox.show ();
|
|
||||||
|
|
||||||
fast_screen_update_connection = Timers::super_rapid_connect (
|
_fast_screen_update_connection = Timers::super_rapid_connect (sigc::mem_fun (*this, &SendUI::fast_update));
|
||||||
sigc::mem_fun (*this, &SendUI::fast_update));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SendUI::~SendUI ()
|
SendUI::~SendUI ()
|
||||||
{
|
{
|
||||||
_send->set_metering (false);
|
_send->set_metering (false);
|
||||||
|
_fast_screen_update_connection.disconnect ();
|
||||||
screen_update_connection.disconnect ();
|
|
||||||
fast_screen_update_connection.disconnect ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -107,11 +110,6 @@ SendUI::outs_changed (IOChange change, void* /*ignored*/)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
SendUI::update ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SendUI::fast_update ()
|
SendUI::fast_update ()
|
||||||
{
|
{
|
||||||
|
|
@ -124,22 +122,40 @@ SendUI::fast_update ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SendUIWindow::SendUIWindow (boost::shared_ptr<Send> s, Session* session)
|
bool
|
||||||
: ArdourWindow (string (_("Send ")) + s->name ())
|
SendUI::invert_press (GdkEventButton* ev)
|
||||||
{
|
{
|
||||||
ui = new SendUI (this, s, session);
|
if (ArdourWidgets::BindingProxy::is_bind_action (ev)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
hpacker.pack_start (*ui, true, true);
|
if (ev->button != 1 || ev->type == GDK_2BUTTON_PRESS || ev->type == GDK_3BUTTON_PRESS) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
add (hpacker);
|
boost::shared_ptr<AutomationControl> ac = _send->polarity_control ();
|
||||||
|
ac->start_touch (timepos_t (ac->session ().audible_sample ()));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
SendUI::invert_release (GdkEventButton* ev)
|
||||||
|
{
|
||||||
|
if (ev->button != 1 || ev->type == GDK_2BUTTON_PRESS || ev->type == GDK_3BUTTON_PRESS) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<AutomationControl> ac = _send->polarity_control ();
|
||||||
|
ac->set_value (_invert_button.get_active () ? 0 : 1, PBD::Controllable::NoGroup);
|
||||||
|
ac->stop_touch (timepos_t (ac->session ().audible_sample ()));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
SendUIWindow::SendUIWindow (Gtk::Window& parent, ARDOUR::Session* session, boost::shared_ptr<Send> send)
|
||||||
|
: ArdourWindow (parent, string_compose (_("Send: %1"), send->name ()))
|
||||||
|
, _ui (this, session, send)
|
||||||
|
{
|
||||||
set_name ("SendUIWindow");
|
set_name ("SendUIWindow");
|
||||||
|
add (_ui);
|
||||||
ui->show ();
|
_ui.show ();
|
||||||
hpacker.show ();
|
|
||||||
}
|
|
||||||
|
|
||||||
SendUIWindow::~SendUIWindow ()
|
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,14 @@
|
||||||
#ifndef __ardour_gtk_send_ui_h__
|
#ifndef __ardour_gtk_send_ui_h__
|
||||||
#define __ardour_gtk_send_ui_h__
|
#define __ardour_gtk_send_ui_h__
|
||||||
|
|
||||||
|
#include "widgets/ardour_button.h"
|
||||||
|
|
||||||
|
#include "ardour_window.h"
|
||||||
#include "gain_meter.h"
|
#include "gain_meter.h"
|
||||||
#include "panner_ui.h"
|
#include "panner_ui.h"
|
||||||
#include "ardour_window.h"
|
|
||||||
|
|
||||||
namespace ARDOUR {
|
namespace ARDOUR
|
||||||
|
{
|
||||||
class Send;
|
class Send;
|
||||||
class IOProcessor;
|
class IOProcessor;
|
||||||
}
|
}
|
||||||
|
|
@ -35,44 +38,36 @@ class IOSelector;
|
||||||
|
|
||||||
class SendUI : public Gtk::HBox
|
class SendUI : public Gtk::HBox
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SendUI (Gtk::Window *, boost::shared_ptr<ARDOUR::Send>, ARDOUR::Session*);
|
SendUI (Gtk::Window*, ARDOUR::Session*, boost::shared_ptr<ARDOUR::Send>);
|
||||||
~SendUI();
|
~SendUI ();
|
||||||
|
|
||||||
void update ();
|
private:
|
||||||
void fast_update ();
|
void fast_update ();
|
||||||
|
|
||||||
boost::shared_ptr<ARDOUR::Send>& send() { return _send; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
boost::shared_ptr<ARDOUR::Send> _send;
|
|
||||||
GainMeter _gpm;
|
|
||||||
PannerUI _panners;
|
|
||||||
Gtk::VBox _vbox;
|
|
||||||
Gtk::VBox _hbox;
|
|
||||||
IOSelector* _io;
|
|
||||||
|
|
||||||
sigc::connection screen_update_connection;
|
|
||||||
sigc::connection fast_screen_update_connection;
|
|
||||||
|
|
||||||
void outs_changed (ARDOUR::IOChange, void*);
|
void outs_changed (ARDOUR::IOChange, void*);
|
||||||
PBD::ScopedConnectionList connections;
|
|
||||||
|
bool invert_press (GdkEventButton* ev);
|
||||||
|
bool invert_release (GdkEventButton* ev);
|
||||||
|
|
||||||
|
boost::shared_ptr<ARDOUR::Send> _send;
|
||||||
|
|
||||||
|
ArdourWidgets::ArdourButton _invert_button;
|
||||||
|
GainMeter _gpm;
|
||||||
|
PannerUI _panners;
|
||||||
|
Gtk::VBox _vbox;
|
||||||
|
IOSelector* _io;
|
||||||
|
|
||||||
|
sigc::connection _fast_screen_update_connection;
|
||||||
|
PBD::ScopedConnection _send_connection;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SendUIWindow : public ArdourWindow
|
class SendUIWindow : public ArdourWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SendUIWindow(boost::shared_ptr<ARDOUR::Send>, ARDOUR::Session*);
|
SendUIWindow (Gtk::Window&, ARDOUR::Session*, boost::shared_ptr<ARDOUR::Send>);
|
||||||
~SendUIWindow();
|
|
||||||
|
|
||||||
SendUI* ui;
|
private:
|
||||||
|
SendUI _ui;
|
||||||
private:
|
|
||||||
Gtk::HBox hpacker;
|
|
||||||
|
|
||||||
PBD::ScopedConnection going_away_connection;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __ardour_gtk_send_ui_h__ */
|
#endif /* __ardour_gtk_send_ui_h__ */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue