mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 03:36:32 +01:00
push2: tweak layout APIs etc.
This commit is contained in:
parent
db4edbf3b5
commit
3a7cf72752
11 changed files with 87 additions and 53 deletions
|
|
@ -24,10 +24,11 @@ using namespace ARDOUR;
|
||||||
using namespace ArdourSurface;
|
using namespace ArdourSurface;
|
||||||
using namespace ArdourCanvas;
|
using namespace ArdourCanvas;
|
||||||
|
|
||||||
Push2Layout::Push2Layout (Push2& p, Session& s)
|
Push2Layout::Push2Layout (Push2& p, Session& s, std::string const & name)
|
||||||
: Container (p.canvas())
|
: Container (p.canvas())
|
||||||
, p2 (p)
|
, p2 (p)
|
||||||
, session (s)
|
, session (s)
|
||||||
|
, _name (name)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ class Push2;
|
||||||
class Push2Layout : public sigc::trackable, public ArdourCanvas::Container
|
class Push2Layout : public sigc::trackable, public ArdourCanvas::Container
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Push2Layout (Push2& p, ARDOUR::Session& s);
|
Push2Layout (Push2& p, ARDOUR::Session& s, std::string const & name);
|
||||||
virtual ~Push2Layout ();
|
virtual ~Push2Layout ();
|
||||||
|
|
||||||
int display_width () const;
|
int display_width () const;
|
||||||
|
|
@ -71,9 +71,12 @@ class Push2Layout : public sigc::trackable, public ArdourCanvas::Container
|
||||||
virtual void update_meters () {}
|
virtual void update_meters () {}
|
||||||
virtual void update_clocks () {}
|
virtual void update_clocks () {}
|
||||||
|
|
||||||
|
std::string name() const { return _name; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Push2& p2;
|
Push2& p2;
|
||||||
ARDOUR::Session& session;
|
ARDOUR::Session& session;
|
||||||
|
std::string _name;
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace */
|
} /* namespace */
|
||||||
|
|
|
||||||
|
|
@ -66,8 +66,8 @@ using namespace Glib;
|
||||||
using namespace ArdourSurface;
|
using namespace ArdourSurface;
|
||||||
using namespace ArdourCanvas;
|
using namespace ArdourCanvas;
|
||||||
|
|
||||||
MixLayout::MixLayout (Push2& p, Session& s)
|
MixLayout::MixLayout (Push2& p, Session & s, std::string const & name)
|
||||||
: Push2Layout (p, s)
|
: Push2Layout (p, s, name)
|
||||||
, bank_start (0)
|
, bank_start (0)
|
||||||
, vpot_mode (Volume)
|
, vpot_mode (Volume)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ class LevelMeter;
|
||||||
class MixLayout : public Push2Layout
|
class MixLayout : public Push2Layout
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MixLayout (Push2& p, ARDOUR::Session&);
|
MixLayout (Push2& p, ARDOUR::Session&, std::string const &);
|
||||||
~MixLayout ();
|
~MixLayout ();
|
||||||
|
|
||||||
void render (ArdourCanvas::Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
void render (ArdourCanvas::Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
|
|
|
||||||
|
|
@ -233,10 +233,10 @@ Push2::open ()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
_canvas = new Push2Canvas (*this, 960, 160);
|
_canvas = new Push2Canvas (*this, 960, 160);
|
||||||
mix_layout = new MixLayout (*this, *session);
|
mix_layout = new MixLayout (*this, *session, "globalmix");
|
||||||
scale_layout = new ScaleLayout (*this, *session);
|
scale_layout = new ScaleLayout (*this, *session, "scale");
|
||||||
track_mix_layout = new TrackMixLayout (*this, *session);
|
track_mix_layout = new TrackMixLayout (*this, *session, "trackmix");
|
||||||
splash_layout = new SplashLayout (*this, *session);
|
splash_layout = new SplashLayout (*this, *session, "splash");
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
error << _("Cannot construct Canvas for display") << endmsg;
|
error << _("Cannot construct Canvas for display") << endmsg;
|
||||||
libusb_release_interface (handle, 0x00);
|
libusb_release_interface (handle, 0x00);
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,8 @@ using namespace ArdourCanvas;
|
||||||
|
|
||||||
static double unselected_root_alpha = 0.5;
|
static double unselected_root_alpha = 0.5;
|
||||||
|
|
||||||
ScaleLayout::ScaleLayout (Push2& p, Session& s)
|
ScaleLayout::ScaleLayout (Push2& p, Session & s, std::string const & name)
|
||||||
: Push2Layout (p, s)
|
: Push2Layout (p, s, name)
|
||||||
, last_vpot (-1)
|
, last_vpot (-1)
|
||||||
, vpot_delta_cnt (0)
|
, vpot_delta_cnt (0)
|
||||||
, root_button (0)
|
, root_button (0)
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ namespace ArdourSurface {
|
||||||
class ScaleLayout : public Push2Layout
|
class ScaleLayout : public Push2Layout
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ScaleLayout (Push2& p, ARDOUR::Session&);
|
ScaleLayout (Push2& p, ARDOUR::Session&, std::string const &);
|
||||||
~ScaleLayout ();
|
~ScaleLayout ();
|
||||||
|
|
||||||
void render (ArdourCanvas::Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
void render (ArdourCanvas::Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,8 @@ using namespace std;
|
||||||
using namespace ArdourSurface;
|
using namespace ArdourSurface;
|
||||||
using namespace ArdourCanvas;
|
using namespace ArdourCanvas;
|
||||||
|
|
||||||
SplashLayout::SplashLayout (Push2& p, Session& s)
|
SplashLayout::SplashLayout (Push2& p, Session& s, std::string const & name)
|
||||||
: Push2Layout (p, s)
|
: Push2Layout (p, s, name)
|
||||||
{
|
{
|
||||||
std::string splash_file;
|
std::string splash_file;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ namespace ArdourSurface {
|
||||||
class SplashLayout : public Push2Layout
|
class SplashLayout : public Push2Layout
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SplashLayout (Push2& p, ARDOUR::Session&);
|
SplashLayout (Push2& p, ARDOUR::Session&, std::string const &);
|
||||||
~SplashLayout ();
|
~SplashLayout ();
|
||||||
|
|
||||||
void render (ArdourCanvas::Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
void render (ArdourCanvas::Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,8 @@ using namespace Glib;
|
||||||
using namespace ArdourSurface;
|
using namespace ArdourSurface;
|
||||||
using namespace ArdourCanvas;
|
using namespace ArdourCanvas;
|
||||||
|
|
||||||
TrackMixLayout::TrackMixLayout (Push2& p, Session& s)
|
TrackMixLayout::TrackMixLayout (Push2& p, Session & s, std::string const & name)
|
||||||
: Push2Layout (p, s)
|
: Push2Layout (p, s, name)
|
||||||
{
|
{
|
||||||
Pango::FontDescription fd ("Sans 10");
|
Pango::FontDescription fd ("Sans 10");
|
||||||
|
|
||||||
|
|
@ -169,11 +169,8 @@ TrackMixLayout::~TrackMixLayout ()
|
||||||
void
|
void
|
||||||
TrackMixLayout::selection_changed ()
|
TrackMixLayout::selection_changed ()
|
||||||
{
|
{
|
||||||
if (!parent()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
boost::shared_ptr<Stripable> s = ControlProtocol::first_selected_stripable();
|
boost::shared_ptr<Stripable> s = ControlProtocol::first_selected_stripable();
|
||||||
|
|
||||||
if (s) {
|
if (s) {
|
||||||
set_stripable (s);
|
set_stripable (s);
|
||||||
}
|
}
|
||||||
|
|
@ -192,7 +189,7 @@ TrackMixLayout::show ()
|
||||||
p2.write (b->state_msg());
|
p2.write (b->state_msg());
|
||||||
}
|
}
|
||||||
|
|
||||||
selection_changed ();
|
show_state ();
|
||||||
|
|
||||||
Container::show ();
|
Container::show ();
|
||||||
}
|
}
|
||||||
|
|
@ -200,7 +197,7 @@ TrackMixLayout::show ()
|
||||||
void
|
void
|
||||||
TrackMixLayout::hide ()
|
TrackMixLayout::hide ()
|
||||||
{
|
{
|
||||||
set_stripable (boost::shared_ptr<Stripable>());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -225,23 +222,31 @@ TrackMixLayout::button_lower (uint32_t n)
|
||||||
|
|
||||||
switch (n) {
|
switch (n) {
|
||||||
case 0:
|
case 0:
|
||||||
stripable->mute_control()->set_value (!stripable->mute_control()->get_value(), PBD::Controllable::UseGroup);
|
if (stripable->mute_control()) {
|
||||||
|
stripable->mute_control()->set_value (!stripable->mute_control()->get_value(), PBD::Controllable::UseGroup);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
stripable->solo_control()->set_value (!stripable->solo_control()->get_value(), PBD::Controllable::UseGroup);
|
if (stripable->solo_control()) {
|
||||||
|
stripable->solo_control()->set_value (!stripable->solo_control()->get_value(), PBD::Controllable::UseGroup);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
stripable->rec_enable_control()->set_value (!stripable->rec_enable_control()->get_value(), PBD::Controllable::UseGroup);
|
if (stripable->rec_enable_control()) {
|
||||||
|
stripable->rec_enable_control()->set_value (!stripable->rec_enable_control()->get_value(), PBD::Controllable::UseGroup);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
mc = stripable->monitoring_control()->monitoring_choice();
|
if (stripable->monitor_control()) {
|
||||||
switch (mc) {
|
mc = stripable->monitoring_control()->monitoring_choice();
|
||||||
case MonitorInput:
|
switch (mc) {
|
||||||
stripable->monitoring_control()->set_value (MonitorAuto, PBD::Controllable::UseGroup);
|
case MonitorInput:
|
||||||
break;
|
stripable->monitoring_control()->set_value (MonitorAuto, PBD::Controllable::UseGroup);
|
||||||
default:
|
break;
|
||||||
stripable->monitoring_control()->set_value (MonitorInput, PBD::Controllable::UseGroup);
|
default:
|
||||||
break;
|
stripable->monitoring_control()->set_value (MonitorInput, PBD::Controllable::UseGroup);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
|
|
@ -256,10 +261,14 @@ TrackMixLayout::button_lower (uint32_t n)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
stripable->solo_isolate_control()->set_value (!stripable->solo_isolate_control()->get_value(), PBD::Controllable::UseGroup);
|
if (stripable->solo_isolate_control()) {
|
||||||
|
stripable->solo_isolate_control()->set_value (!stripable->solo_isolate_control()->get_value(), PBD::Controllable::UseGroup);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
stripable->solo_safe_control()->set_value (!stripable->solo_safe_control()->get_value(), PBD::Controllable::UseGroup);
|
if (stripable->solo_safe_control()) {
|
||||||
|
stripable->solo_safe_control()->set_value (!stripable->solo_safe_control()->get_value(), PBD::Controllable::UseGroup);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
/* nothing here */
|
/* nothing here */
|
||||||
|
|
@ -434,6 +443,28 @@ TrackMixLayout::monitoring_change ()
|
||||||
p2.write (b2->state_msg());
|
p2.write (b2->state_msg());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TrackMixLayout::show_state ()
|
||||||
|
{
|
||||||
|
if (!parent()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stripable) {
|
||||||
|
name_changed ();
|
||||||
|
color_changed ();
|
||||||
|
solo_mute_change ();
|
||||||
|
rec_enable_change ();
|
||||||
|
solo_iso_change ();
|
||||||
|
solo_safe_change ();
|
||||||
|
monitoring_change ();
|
||||||
|
|
||||||
|
meter->set_meter (stripable->peak_meter ().get());
|
||||||
|
} else {
|
||||||
|
meter->set_meter (0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackMixLayout::set_stripable (boost::shared_ptr<Stripable> s)
|
TrackMixLayout::set_stripable (boost::shared_ptr<Stripable> s)
|
||||||
{
|
{
|
||||||
|
|
@ -471,19 +502,9 @@ TrackMixLayout::set_stripable (boost::shared_ptr<Stripable> s)
|
||||||
knobs[5]->set_controllable (boost::shared_ptr<AutomationControl>());
|
knobs[5]->set_controllable (boost::shared_ptr<AutomationControl>());
|
||||||
knobs[6]->set_controllable (boost::shared_ptr<AutomationControl>());
|
knobs[6]->set_controllable (boost::shared_ptr<AutomationControl>());
|
||||||
knobs[7]->set_controllable (boost::shared_ptr<AutomationControl>());
|
knobs[7]->set_controllable (boost::shared_ptr<AutomationControl>());
|
||||||
|
|
||||||
name_changed ();
|
|
||||||
color_changed ();
|
|
||||||
solo_mute_change ();
|
|
||||||
rec_enable_change ();
|
|
||||||
solo_iso_change ();
|
|
||||||
solo_safe_change ();
|
|
||||||
monitoring_change ();
|
|
||||||
|
|
||||||
meter->set_meter (stripable->peak_meter ().get());
|
|
||||||
} else {
|
|
||||||
meter->set_meter (0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
show_state ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -497,10 +518,16 @@ void
|
||||||
TrackMixLayout::name_changed ()
|
TrackMixLayout::name_changed ()
|
||||||
{
|
{
|
||||||
if (stripable) {
|
if (stripable) {
|
||||||
/* poor-man's right justification */
|
|
||||||
char buf[92];
|
name_text->set (stripable->name());
|
||||||
snprintf (buf, sizeof (buf), "%*s", (int) sizeof (buf) - 1, stripable->name().c_str());
|
|
||||||
name_text->set (buf);
|
/* right justify */
|
||||||
|
|
||||||
|
Duple pos;
|
||||||
|
pos.y = name_text->position().y;
|
||||||
|
pos.x = display_width() - 10 - name_text->width();
|
||||||
|
|
||||||
|
name_text->set_position (pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ class LevelMeter;
|
||||||
class TrackMixLayout : public Push2Layout
|
class TrackMixLayout : public Push2Layout
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TrackMixLayout (Push2& p, ARDOUR::Session&);
|
TrackMixLayout (Push2& p, ARDOUR::Session&, std::string const &);
|
||||||
~TrackMixLayout ();
|
~TrackMixLayout ();
|
||||||
|
|
||||||
void set_stripable (boost::shared_ptr<ARDOUR::Stripable>);
|
void set_stripable (boost::shared_ptr<ARDOUR::Stripable>);
|
||||||
|
|
@ -63,6 +63,8 @@ class TrackMixLayout : public Push2Layout
|
||||||
void update_meters ();
|
void update_meters ();
|
||||||
void update_clocks ();
|
void update_clocks ();
|
||||||
|
|
||||||
|
boost::shared_ptr<ARDOUR::Stripable> current_stripable() const { return stripable; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
boost::shared_ptr<ARDOUR::Stripable> stripable;
|
boost::shared_ptr<ARDOUR::Stripable> stripable;
|
||||||
PBD::ScopedConnectionList stripable_connections;
|
PBD::ScopedConnectionList stripable_connections;
|
||||||
|
|
@ -84,6 +86,7 @@ class TrackMixLayout : public Push2Layout
|
||||||
|
|
||||||
PBD::ScopedConnection selection_connection;
|
PBD::ScopedConnection selection_connection;
|
||||||
void selection_changed ();
|
void selection_changed ();
|
||||||
|
void show_state ();
|
||||||
|
|
||||||
void drop_stripable ();
|
void drop_stripable ();
|
||||||
void name_changed ();
|
void name_changed ();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue