mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-11 09:06:33 +01:00
Add optional ProcessorBox to Route-Properties (bottom attachment)
This commit is contained in:
parent
fbc4156eac
commit
844d458969
2 changed files with 84 additions and 3 deletions
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include "pbd/compose.h"
|
#include "pbd/compose.h"
|
||||||
|
|
||||||
|
#include "ardour/audio_track.h"
|
||||||
#include "ardour/plugin_insert.h"
|
#include "ardour/plugin_insert.h"
|
||||||
#include "ardour/port_insert.h"
|
#include "ardour/port_insert.h"
|
||||||
#include "ardour/route.h"
|
#include "ardour/route.h"
|
||||||
|
|
@ -30,8 +31,8 @@
|
||||||
#include "gtkmm2ext/gui_thread.h"
|
#include "gtkmm2ext/gui_thread.h"
|
||||||
#include "gtkmm2ext/utils.h"
|
#include "gtkmm2ext/utils.h"
|
||||||
|
|
||||||
#include "widgets/frame.h"
|
#include "ardour_ui.h"
|
||||||
|
#include "mixer_ui.h"
|
||||||
#include "plugin_selector.h"
|
#include "plugin_selector.h"
|
||||||
#include "plugin_ui.h"
|
#include "plugin_ui.h"
|
||||||
#include "port_insert_ui.h"
|
#include "port_insert_ui.h"
|
||||||
|
|
@ -46,21 +47,34 @@ using namespace ARDOUR;
|
||||||
using namespace ArdourWidgets;
|
using namespace ArdourWidgets;
|
||||||
|
|
||||||
RoutePropertiesBox::RoutePropertiesBox ()
|
RoutePropertiesBox::RoutePropertiesBox ()
|
||||||
: _idle_refill_processors_id (-1)
|
: _insert_box (nullptr)
|
||||||
|
, _show_insert (false)
|
||||||
|
, _idle_refill_processors_id (-1)
|
||||||
{
|
{
|
||||||
_scroller.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_NEVER);
|
_scroller.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_NEVER);
|
||||||
_scroller.add (_box);
|
_scroller.add (_box);
|
||||||
|
|
||||||
_box.set_spacing (4);
|
_box.set_spacing (4);
|
||||||
|
_insert_frame.set_no_show_all ();
|
||||||
|
|
||||||
|
pack_start (_insert_frame, false, false, 4);
|
||||||
pack_start (_scroller, true, true);
|
pack_start (_scroller, true, true);
|
||||||
show_all();
|
show_all();
|
||||||
|
|
||||||
|
ARDOUR_UI::instance()->ActionsReady.connect_same_thread (_forever_connections, std::bind (&RoutePropertiesBox::ui_actions_ready, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
RoutePropertiesBox::~RoutePropertiesBox ()
|
RoutePropertiesBox::~RoutePropertiesBox ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
RoutePropertiesBox::ui_actions_ready ()
|
||||||
|
{
|
||||||
|
Glib::RefPtr<ToggleAction> tact = ActionManager::get_toggle_action (X_("Editor"), X_("show-editor-mixer"));
|
||||||
|
tact->signal_toggled().connect (sigc::mem_fun (*this, &RoutePropertiesBox::update_processor_box_visibility));
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RoutePropertiesBox::session_going_away ()
|
RoutePropertiesBox::session_going_away ()
|
||||||
{
|
{
|
||||||
|
|
@ -69,6 +83,24 @@ RoutePropertiesBox::session_going_away ()
|
||||||
|
|
||||||
drop_plugin_uis ();
|
drop_plugin_uis ();
|
||||||
drop_route ();
|
drop_route ();
|
||||||
|
delete _insert_box;
|
||||||
|
_insert_box = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
RoutePropertiesBox::set_session (ARDOUR::Session* s) {
|
||||||
|
SessionHandlePtr::set_session (s);
|
||||||
|
if (!s) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
delete _insert_box;
|
||||||
|
_insert_box = new ProcessorBox (_session, std::bind (&Mixer_UI::plugin_selector, Mixer_UI::instance()), Mixer_UI::instance()->selection(), 0);
|
||||||
|
_insert_box->show_all ();
|
||||||
|
|
||||||
|
float ui_scale = std::max<float> (1.f, UIConfiguration::instance().get_ui_scale());
|
||||||
|
_insert_frame.add (*_insert_box);
|
||||||
|
_insert_frame.set_padding (4);
|
||||||
|
_insert_frame.set_size_request (144 * ui_scale, 236 * ui_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -84,9 +116,44 @@ RoutePropertiesBox::set_route (std::shared_ptr<Route> r)
|
||||||
_route->processors_changed.connect (_route_connections, invalidator (*this), std::bind (&RoutePropertiesBox::idle_refill_processors, this), gui_context());
|
_route->processors_changed.connect (_route_connections, invalidator (*this), std::bind (&RoutePropertiesBox::idle_refill_processors, this), gui_context());
|
||||||
_route->PropertyChanged.connect (_route_connections, invalidator (*this), std::bind (&RoutePropertiesBox::property_changed, this, _1), gui_context ());
|
_route->PropertyChanged.connect (_route_connections, invalidator (*this), std::bind (&RoutePropertiesBox::property_changed, this, _1), gui_context ());
|
||||||
_route->DropReferences.connect (_route_connections, invalidator (*this), std::bind (&RoutePropertiesBox::drop_route, this), gui_context());
|
_route->DropReferences.connect (_route_connections, invalidator (*this), std::bind (&RoutePropertiesBox::drop_route, this), gui_context());
|
||||||
|
|
||||||
|
std::shared_ptr<AudioTrack> at = std::dynamic_pointer_cast<AudioTrack>(_route);
|
||||||
|
if (at) {
|
||||||
|
at->FreezeChange.connect (_route_connections, invalidator (*this), std::bind (&RoutePropertiesBox::map_frozen, this), gui_context());
|
||||||
|
}
|
||||||
|
|
||||||
|
_insert_box->set_route (r);
|
||||||
refill_processors ();
|
refill_processors ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
RoutePropertiesBox::map_frozen ()
|
||||||
|
{
|
||||||
|
ENSURE_GUI_THREAD (*this, &RoutePropertiesBox::map_frozen)
|
||||||
|
std::shared_ptr<AudioTrack> at = std::dynamic_pointer_cast<AudioTrack>(_route);
|
||||||
|
if (at && _insert_box) {
|
||||||
|
switch (at->freeze_state()) {
|
||||||
|
case AudioTrack::Frozen:
|
||||||
|
_insert_box->set_sensitive (false);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
_insert_box->set_sensitive (true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
RoutePropertiesBox::update_processor_box_visibility ()
|
||||||
|
{
|
||||||
|
_show_insert = !ActionManager::get_toggle_action (X_("Editor"), X_("show-editor-mixer"))->get_active ();
|
||||||
|
if (!_show_insert || _proc_uis.empty ()) {
|
||||||
|
_insert_frame.hide ();
|
||||||
|
} else {
|
||||||
|
_insert_frame.show ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RoutePropertiesBox::property_changed (const PBD::PropertyChange& what_changed)
|
RoutePropertiesBox::property_changed (const PBD::PropertyChange& what_changed)
|
||||||
{
|
{
|
||||||
|
|
@ -121,6 +188,7 @@ RoutePropertiesBox::drop_plugin_uis ()
|
||||||
|
|
||||||
_processor_connections.drop_connections ();
|
_processor_connections.drop_connections ();
|
||||||
_proc_uis.clear ();
|
_proc_uis.clear ();
|
||||||
|
_insert_frame.hide ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -195,5 +263,6 @@ RoutePropertiesBox::refill_processors ()
|
||||||
_box.set_size_request (-1, h);
|
_box.set_size_request (-1, h);
|
||||||
_scroller.show_all ();
|
_scroller.show_all ();
|
||||||
}
|
}
|
||||||
|
update_processor_box_visibility ();
|
||||||
_idle_refill_processors_id = -1;
|
_idle_refill_processors_id = -1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@
|
||||||
#include "ardour/ardour.h"
|
#include "ardour/ardour.h"
|
||||||
#include "ardour/session_handle.h"
|
#include "ardour/session_handle.h"
|
||||||
|
|
||||||
|
#include "widgets/frame.h"
|
||||||
|
|
||||||
namespace ARDOUR {
|
namespace ARDOUR {
|
||||||
class Route;
|
class Route;
|
||||||
class Processor;
|
class Processor;
|
||||||
|
|
@ -35,6 +37,7 @@ namespace ARDOUR {
|
||||||
}
|
}
|
||||||
|
|
||||||
class GenericPluginUI;
|
class GenericPluginUI;
|
||||||
|
class ProcessorBox;
|
||||||
|
|
||||||
class RoutePropertiesBox : public Gtk::HBox, public ARDOUR::SessionHandlePtr
|
class RoutePropertiesBox : public Gtk::HBox, public ARDOUR::SessionHandlePtr
|
||||||
{
|
{
|
||||||
|
|
@ -42,10 +45,14 @@ public:
|
||||||
RoutePropertiesBox ();
|
RoutePropertiesBox ();
|
||||||
~RoutePropertiesBox ();
|
~RoutePropertiesBox ();
|
||||||
|
|
||||||
|
void set_session (ARDOUR::Session*);
|
||||||
void set_route (std::shared_ptr<ARDOUR::Route>);
|
void set_route (std::shared_ptr<ARDOUR::Route>);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void property_changed (const PBD::PropertyChange& what_changed);
|
void property_changed (const PBD::PropertyChange& what_changed);
|
||||||
|
void map_frozen ();
|
||||||
|
void ui_actions_ready ();
|
||||||
|
void update_processor_box_visibility ();
|
||||||
void session_going_away ();
|
void session_going_away ();
|
||||||
void drop_route ();
|
void drop_route ();
|
||||||
void drop_plugin_uis ();
|
void drop_plugin_uis ();
|
||||||
|
|
@ -61,9 +68,14 @@ private:
|
||||||
std::shared_ptr<ARDOUR::Route> _route;
|
std::shared_ptr<ARDOUR::Route> _route;
|
||||||
std::vector <GenericPluginUI*> _proc_uis;
|
std::vector <GenericPluginUI*> _proc_uis;
|
||||||
|
|
||||||
|
ArdourWidgets::Frame _insert_frame;
|
||||||
|
ProcessorBox* _insert_box;
|
||||||
|
bool _show_insert;
|
||||||
|
|
||||||
int _idle_refill_processors_id;
|
int _idle_refill_processors_id;
|
||||||
|
|
||||||
PBD::ScopedConnectionList _processor_connections;
|
PBD::ScopedConnectionList _processor_connections;
|
||||||
PBD::ScopedConnectionList _route_connections;
|
PBD::ScopedConnectionList _route_connections;
|
||||||
|
PBD::ScopedConnectionList _forever_connections;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue