mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 06:44:57 +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) {
|
||||
|
||||
gidget = new SendUIWindow (send, _session);
|
||||
Gtk::Window* tlw = dynamic_cast<Gtk::Window*> (get_toplevel ());
|
||||
assert (tlw);
|
||||
gidget = new SendUIWindow (*tlw, _session, send);
|
||||
}
|
||||
|
||||
} 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();
|
||||
add_routes (*r);
|
||||
_session->RouteAdded.connect (_session_connections, invalidator (*this), boost::bind (&RouteParams_UI::add_routes, this, _1), gui_context());
|
||||
start_updating ();
|
||||
} else {
|
||||
stop_updating ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
RouteParams_UI::session_going_away ()
|
||||
{
|
||||
|
|
@ -479,7 +475,7 @@ RouteParams_UI::redirect_selected (boost::shared_ptr<ARDOUR::Processor> proc)
|
|||
return;
|
||||
} 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();
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
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 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/rc_configuration.h"
|
||||
#include "ardour/send.h"
|
||||
#include "ardour/session.h"
|
||||
|
||||
#include "gui_thread.h"
|
||||
#include "io_selector.h"
|
||||
|
|
@ -38,8 +39,9 @@ using namespace std;
|
|||
using namespace ARDOUR;
|
||||
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)
|
||||
, _invert_button (X_("Ø"))
|
||||
, _gpm (session, 250)
|
||||
, _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 out = _send->pan_outs ();
|
||||
|
||||
_panners.set_width (Wide);
|
||||
_panners.set_available_panners (PannerManager::instance ().PannerManager::get_available_panners (in, out));
|
||||
_panners.set_panner (s->panner_shell (), s->panner ());
|
||||
|
||||
_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.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 ()));
|
||||
|
||||
_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"));
|
||||
|
||||
_hbox.pack_start (_gpm, true, true);
|
||||
|
||||
_vbox.set_spacing (5);
|
||||
_vbox.set_border_width (5);
|
||||
_vbox.pack_start (_hbox, false, false, false);
|
||||
_vbox.set_spacing (4);
|
||||
_vbox.set_border_width (4);
|
||||
_vbox.pack_start (_gpm, false, false, false);
|
||||
_vbox.pack_start (_invert_button, false, false);
|
||||
_vbox.pack_start (_panners, false, false);
|
||||
|
||||
pack_start (_vbox, false, false);
|
||||
pack_start (*_io, true, true);
|
||||
|
||||
_io->show ();
|
||||
_gpm.show_all ();
|
||||
_panners.show_all ();
|
||||
_vbox.show ();
|
||||
_hbox.show ();
|
||||
_vbox.show_all ();
|
||||
|
||||
fast_screen_update_connection = Timers::super_rapid_connect (
|
||||
sigc::mem_fun (*this, &SendUI::fast_update));
|
||||
_fast_screen_update_connection = Timers::super_rapid_connect (sigc::mem_fun (*this, &SendUI::fast_update));
|
||||
}
|
||||
|
||||
SendUI::~SendUI ()
|
||||
{
|
||||
_send->set_metering (false);
|
||||
|
||||
screen_update_connection.disconnect ();
|
||||
fast_screen_update_connection.disconnect ();
|
||||
_fast_screen_update_connection.disconnect ();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -107,11 +110,6 @@ SendUI::outs_changed (IOChange change, void* /*ignored*/)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
SendUI::update ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
SendUI::fast_update ()
|
||||
{
|
||||
|
|
@ -124,22 +122,40 @@ SendUI::fast_update ()
|
|||
}
|
||||
}
|
||||
|
||||
SendUIWindow::SendUIWindow (boost::shared_ptr<Send> s, Session* session)
|
||||
: ArdourWindow (string (_("Send ")) + s->name ())
|
||||
bool
|
||||
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");
|
||||
|
||||
ui->show ();
|
||||
hpacker.show ();
|
||||
}
|
||||
|
||||
SendUIWindow::~SendUIWindow ()
|
||||
{
|
||||
delete ui;
|
||||
add (_ui);
|
||||
_ui.show ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,11 +22,14 @@
|
|||
#ifndef __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 "panner_ui.h"
|
||||
#include "ardour_window.h"
|
||||
|
||||
namespace ARDOUR {
|
||||
namespace ARDOUR
|
||||
{
|
||||
class Send;
|
||||
class IOProcessor;
|
||||
}
|
||||
|
|
@ -35,44 +38,36 @@ class IOSelector;
|
|||
|
||||
class SendUI : public Gtk::HBox
|
||||
{
|
||||
public:
|
||||
SendUI (Gtk::Window *, boost::shared_ptr<ARDOUR::Send>, ARDOUR::Session*);
|
||||
~SendUI();
|
||||
public:
|
||||
SendUI (Gtk::Window*, ARDOUR::Session*, boost::shared_ptr<ARDOUR::Send>);
|
||||
~SendUI ();
|
||||
|
||||
void update ();
|
||||
private:
|
||||
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*);
|
||||
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
|
||||
{
|
||||
public:
|
||||
SendUIWindow(boost::shared_ptr<ARDOUR::Send>, ARDOUR::Session*);
|
||||
~SendUIWindow();
|
||||
public:
|
||||
SendUIWindow (Gtk::Window&, ARDOUR::Session*, boost::shared_ptr<ARDOUR::Send>);
|
||||
|
||||
SendUI* ui;
|
||||
|
||||
private:
|
||||
Gtk::HBox hpacker;
|
||||
|
||||
PBD::ScopedConnection going_away_connection;
|
||||
private:
|
||||
SendUI _ui;
|
||||
};
|
||||
|
||||
#endif /* __ardour_gtk_send_ui_h__ */
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue