make ArdourButtons be MIDI-learnable; tweaks to ArdourButton design and implementation; use ArdourButtons (all gray for now) in the Monitor section.
git-svn-id: svn://localhost/ardour2/branches/3.0@10338 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
d7b685cc5f
commit
bde8437387
|
@ -142,6 +142,7 @@
|
|||
<Option name="waveform fill" value="3d4753dc"/>
|
||||
<Option name="zero line" value="b5b5b525"/>
|
||||
<Option name="zoom rect" value="c6d1b26d"/>
|
||||
<Option name="monitor knob" value="329edfff"/>
|
||||
<Option name="processor prefader border start" value="630a0aff"/>
|
||||
<Option name="processor prefader border end" value="630a0aff"/>
|
||||
<Option name="processor prefader border start selected" value="edc400ff"/>
|
||||
|
@ -238,5 +239,165 @@
|
|||
<Option name="solo safe text" value="e2e2d8ff"/>
|
||||
<Option name="solo safe text active" value="e3e3d9ff"/>
|
||||
<Option name="solo safe text mid" value="e3e3d9ff"/>
|
||||
<Option name="monitor section cut border start" value="cfd1e8ff"/>
|
||||
<Option name="monitor section cut border end" value="797a87ff"/>
|
||||
<Option name="monitor section cut border start selected" value="00000000"/>
|
||||
<Option name="monitor section cut border end selected" value="00000000"/>
|
||||
<Option name="monitor section cut fill start" value="808190ff"/>
|
||||
<Option name="monitor section cut fill end" value="5f606bff"/>
|
||||
<Option name="monitor section cut fill start active" value="808290ff"/>
|
||||
<Option name="monitor section cut fill end active" value="5f616bff"/>
|
||||
<Option name="monitor section cut fill start mid" value="00000000"/>
|
||||
<Option name="monitor section cut fill end mid" value="00000000"/>
|
||||
<Option name="monitor section cut led" value="473812ff"/>
|
||||
<Option name="monitor section cut led active" value="78cb4eff"/>
|
||||
<Option name="monitor section cut led mid" value="00000000"/>
|
||||
<Option name="monitor section cut text" value="c7c7d8ff"/>
|
||||
<Option name="monitor section cut text active" value="c8c8d9ff"/>
|
||||
<Option name="monitor section cut text mid" value="00000000"/>
|
||||
<Option name="monitor section dim border start" value="cfd1e8ff"/>
|
||||
<Option name="monitor section dim border end" value="797a87ff"/>
|
||||
<Option name="monitor section dim border start selected" value="00000000"/>
|
||||
<Option name="monitor section dim border end selected" value="00000000"/>
|
||||
<Option name="monitor section dim fill start" value="808190ff"/>
|
||||
<Option name="monitor section dim fill end" value="5f606bff"/>
|
||||
<Option name="monitor section dim fill start active" value="808290ff"/>
|
||||
<Option name="monitor section dim fill end active" value="5f616bff"/>
|
||||
<Option name="monitor section dim fill start mid" value="00000000"/>
|
||||
<Option name="monitor section dim fill end mid" value="00000000"/>
|
||||
<Option name="monitor section dim led" value="473812ff"/>
|
||||
<Option name="monitor section dim led active" value="78cb4eff"/>
|
||||
<Option name="monitor section dim led mid" value="00000000"/>
|
||||
<Option name="monitor section dim text" value="c8c8d9ff"/>
|
||||
<Option name="monitor section dim text active" value="c8c8d9ff"/>
|
||||
<Option name="monitor section dim text mid" value="00000000"/>
|
||||
<Option name="monitor section solo border start" value="cfd1e8ff"/>
|
||||
<Option name="monitor section solo border end" value="797a87ff"/>
|
||||
<Option name="monitor section solo border start selected" value="00000000"/>
|
||||
<Option name="monitor section solo border end selected" value="00000000"/>
|
||||
<Option name="monitor section solo fill start" value="808190ff"/>
|
||||
<Option name="monitor section solo fill end" value="5f606bff"/>
|
||||
<Option name="monitor section solo fill start active" value="808290ff"/>
|
||||
<Option name="monitor section solo fill end active" value="5f616bff"/>
|
||||
<Option name="monitor section solo fill start mid" value="00000000"/>
|
||||
<Option name="monitor section solo fill end mid" value="00000000"/>
|
||||
<Option name="monitor section solo led" value="473812ff"/>
|
||||
<Option name="monitor section solo led active" value="78cb4eff"/>
|
||||
<Option name="monitor section solo led mid" value="00000000"/>
|
||||
<Option name="monitor section solo text" value="00000000"/>
|
||||
<Option name="monitor section solo text active" value="00000000"/>
|
||||
<Option name="monitor section solo text mid" value="00000000"/>
|
||||
<Option name="monitor section invert border start" value="cfd1e8ff"/>
|
||||
<Option name="monitor section invert border end" value="797a87ff"/>
|
||||
<Option name="monitor section invert border start selected" value="00000000"/>
|
||||
<Option name="monitor section invert border end selected" value="00000000"/>
|
||||
<Option name="monitor section invert fill start" value="808190ff"/>
|
||||
<Option name="monitor section invert fill end" value="5f606bff"/>
|
||||
<Option name="monitor section invert fill start active" value="808290ff"/>
|
||||
<Option name="monitor section invert fill end active" value="5f616bff"/>
|
||||
<Option name="monitor section invert fill start mid" value="00000000"/>
|
||||
<Option name="monitor section invert fill end mid" value="00000000"/>
|
||||
<Option name="monitor section invert led" value="473812ff"/>
|
||||
<Option name="monitor section invert led active" value="78cb4eff"/>
|
||||
<Option name="monitor section invert led mid" value="00000000"/>
|
||||
<Option name="monitor section invert text" value="00000000"/>
|
||||
<Option name="monitor section invert text active" value="00000000"/>
|
||||
<Option name="monitor section invert text mid" value="00000000"/>
|
||||
<Option name="monitor section mono border start" value="cfd1e8ff"/>
|
||||
<Option name="monitor section mono border end" value="797a87ff"/>
|
||||
<Option name="monitor section mono border start selected" value="00000000"/>
|
||||
<Option name="monitor section mono border end selected" value="00000000"/>
|
||||
<Option name="monitor section mono fill start" value="808190ff"/>
|
||||
<Option name="monitor section mono fill end" value="5f606bff"/>
|
||||
<Option name="monitor section mono fill start active" value="808290ff"/>
|
||||
<Option name="monitor section mono fill end active" value="5f616bff"/>
|
||||
<Option name="monitor section mono fill start mid" value="00000000"/>
|
||||
<Option name="monitor section mono fill end mid" value="00000000"/>
|
||||
<Option name="monitor section mono led" value="473812ff"/>
|
||||
<Option name="monitor section mono led active" value="78cb4eff"/>
|
||||
<Option name="monitor section mono led mid" value="00000000"/>
|
||||
<Option name="monitor section mono text" value="c7c7d8ff"/>
|
||||
<Option name="monitor section mono text active" value="c8c8d9ff"/>
|
||||
<Option name="monitor section mono text mid" value="00000000"/>
|
||||
<Option name="monitor solo override border start" value="cfd1e8ff"/>
|
||||
<Option name="monitor solo override border end" value="797a87ff"/>
|
||||
<Option name="monitor solo override border start selected" value="00000000"/>
|
||||
<Option name="monitor solo override border end selected" value="00000000"/>
|
||||
<Option name="monitor solo override fill start" value="808190ff"/>
|
||||
<Option name="monitor solo override fill end" value="5f606bff"/>
|
||||
<Option name="monitor solo override fill start active" value="808290ff"/>
|
||||
<Option name="monitor solo override fill end active" value="5f616bff"/>
|
||||
<Option name="monitor solo override fill start mid" value="00000000"/>
|
||||
<Option name="monitor solo override fill end mid" value="00000000"/>
|
||||
<Option name="monitor solo override led" value="473812ff"/>
|
||||
<Option name="monitor solo override led active" value="78cb4eff"/>
|
||||
<Option name="monitor solo override led mid" value="00000000"/>
|
||||
<Option name="monitor solo override text" value="c7c7d8ff"/>
|
||||
<Option name="monitor solo override text active" value="c8c8d9ff"/>
|
||||
<Option name="monitor solo override text mid" value="00000000"/>
|
||||
<Option name="monitor solo exclusive border start" value="cfd1e8ff"/>
|
||||
<Option name="monitor solo exclusive border end" value="797a87ff"/>
|
||||
<Option name="monitor solo exclusive border start selected" value="00000000"/>
|
||||
<Option name="monitor solo exclusive border end selected" value="00000000"/>
|
||||
<Option name="monitor solo exclusive fill start" value="808190ff"/>
|
||||
<Option name="monitor solo exclusive fill end" value="5f606bff"/>
|
||||
<Option name="monitor solo exclusive fill start active" value="808290ff"/>
|
||||
<Option name="monitor solo exclusive fill end active" value="5f616bff"/>
|
||||
<Option name="monitor solo exclusive fill start mid" value="00000000"/>
|
||||
<Option name="monitor solo exclusive fill end mid" value="00000000"/>
|
||||
<Option name="monitor solo exclusive led" value="473812ff"/>
|
||||
<Option name="monitor solo exclusive led active" value="78cb4eff"/>
|
||||
<Option name="monitor solo exclusive led mid" value="00000000"/>
|
||||
<Option name="monitor solo exclusive text" value="c7c7d8ff"/>
|
||||
<Option name="monitor solo exclusive text active" value="c8c8d9ff"/>
|
||||
<Option name="monitor solo exclusive text mid" value="00000000"/>
|
||||
<Option name="rude solo border start" value="a50303ff"/>
|
||||
<Option name="rude solo border end" value="684d4dff"/>
|
||||
<Option name="rude solo border start selected" value="00000000"/>
|
||||
<Option name="rude solo border end selected" value="00000000"/>
|
||||
<Option name="rude solo fill start" value="684d4dff"/>
|
||||
<Option name="rude solo fill end" value="513c3cff"/>
|
||||
<Option name="rude solo fill start active" value="ff1f1fff"/>
|
||||
<Option name="rude solo fill end active" value="e21b1bff"/>
|
||||
<Option name="rude solo fill start mid" value="00000000"/>
|
||||
<Option name="rude solo fill end mid" value="00000000"/>
|
||||
<Option name="rude solo led" value="00000000"/>
|
||||
<Option name="rude solo led active" value="00000000"/>
|
||||
<Option name="rude solo led mid" value="00000000"/>
|
||||
<Option name="rude solo text" value="969696ff"/>
|
||||
<Option name="rude solo text active" value="ffffffff"/>
|
||||
<Option name="rude solo text mid" value="00000000"/>
|
||||
<Option name="rude isolate border start" value="395d6dff"/>
|
||||
<Option name="rude isolate border end" value="2a4551ff"/>
|
||||
<Option name="rude isolate border start selected" value="00000000"/>
|
||||
<Option name="rude isolate border end selected" value="00000000"/>
|
||||
<Option name="rude isolate fill start" value="21414fff"/>
|
||||
<Option name="rude isolate fill end" value="192930ff"/>
|
||||
<Option name="rude isolate fill start active" value="e5f7ffff"/>
|
||||
<Option name="rude isolate fill end active" value="b6e5fdff"/>
|
||||
<Option name="rude isolate fill start mid" value="00000000"/>
|
||||
<Option name="rude isolate fill end mid" value="00000000"/>
|
||||
<Option name="rude isolate led" value="00000000"/>
|
||||
<Option name="rude isolate led active" value="000000ff"/>
|
||||
<Option name="rude isolate led mid" value="00000000"/>
|
||||
<Option name="rude isolate text" value="979797ff"/>
|
||||
<Option name="rude isolate text active" value="000000ff"/>
|
||||
<Option name="rude isolate text mid" value="00000000"/>
|
||||
<Option name="rude audition border start" value="a50303ff"/>
|
||||
<Option name="rude audition border end" value="684d4dff"/>
|
||||
<Option name="rude audition border start selected" value="00000000"/>
|
||||
<Option name="rude audition border end selected" value="00000000"/>
|
||||
<Option name="rude audition fill start" value="684d4dff"/>
|
||||
<Option name="rude audition fill end" value="513c3cff"/>
|
||||
<Option name="rude audition fill start active" value="ff1f1fff"/>
|
||||
<Option name="rude audition fill end active" value="e21b1bff"/>
|
||||
<Option name="rude audition fill start mid" value="00000000"/>
|
||||
<Option name="rude audition fill end mid" value="00000000"/>
|
||||
<Option name="rude audition led" value="00000000"/>
|
||||
<Option name="rude audition led active" value="00000000"/>
|
||||
<Option name="rude audition led mid" value="00000000"/>
|
||||
<Option name="rude audition text" value="979797ff"/>
|
||||
<Option name="rude audition text active" value="ffffffff"/>
|
||||
<Option name="rude audition text mid" value="00000000"/>
|
||||
</Canvas>
|
||||
</Ardour>
|
||||
|
|
|
@ -276,18 +276,10 @@ widget "*MixerStripSelectedFrame" style:highest "selected_strip_frame"
|
|||
widget "*MixerStripFrame" style:highest "base_frame"
|
||||
widget "*HWMonitorButton" style:highest "bright_when_active"
|
||||
widget "*HWMonitorButton*" style:highest "bright_when_active"
|
||||
widget "*MonitorInvertButton" style:highest "monitor_invert_button"
|
||||
widget "*MonitorInvertButton*" style:highest "monitor_invert_button"
|
||||
widget "*MonitorMuteButton" style:highest "monitor_mute_button"
|
||||
widget "*MonitorMuteButton*" style:highest "monitor_mute_button"
|
||||
widget "*MonitorDimButton" style:highest "monitor_dim_button"
|
||||
widget "*MonitorDimButton*" style:highest "monitor_dim_button"
|
||||
widget "*MonitorMonoButton" style:highest "monitor_mono_button"
|
||||
widget "*MonitorMonoButton*" style:highest "monitor_mono_button"
|
||||
widget "*MonitorInvertButton" style:highest "monitor_invert_button"
|
||||
widget "*MonitorInvertButton*" style:highest "monitor_invert_button"
|
||||
widget "*MonitorOptButton" style:highest "monitor_opt_button"
|
||||
widget "*MonitorOptButton*" style:highest "monitor_opt_button"
|
||||
widget "*monitor section invert" style:highest "monitor_invert_button"
|
||||
widget "*monitor section cut" style:highest "monitor_mute_button"
|
||||
widget "*monitor section dim" style:highest "monitor_dim_button"
|
||||
widget "*monitor section mono" style:highest "monitor_mono_button"
|
||||
widget "*MonitorIsoAlert" style:highest "monitor_iso_button"
|
||||
widget "*MonitorIsoAlert*" style:highest "monitor_iso_button"
|
||||
widget "*BypassButton" style:highest "bright_when_active"
|
||||
|
|
|
@ -24,36 +24,44 @@
|
|||
#include <pangomm/layout.h>
|
||||
|
||||
#include "pbd/compose.h"
|
||||
#include "pbd/error.h"
|
||||
|
||||
#include "gtkmm2ext/utils.h"
|
||||
#include "gtkmm2ext/rgb_macros.h"
|
||||
#include "gtkmm2ext/gui_thread.h"
|
||||
|
||||
#include "ardour_button.h"
|
||||
#include "ardour_ui.h"
|
||||
#include "global_signals.h"
|
||||
|
||||
#include "i18n.h"
|
||||
|
||||
using namespace Gdk;
|
||||
using namespace Gtk;
|
||||
using namespace Glib;
|
||||
using namespace PBD;
|
||||
using std::max;
|
||||
using std::min;
|
||||
using namespace std;
|
||||
|
||||
ArdourButton::Element ArdourButton::default_elements = ArdourButton::Element (ArdourButton::Edge|ArdourButton::Body|ArdourButton::Text);
|
||||
ArdourButton::Element ArdourButton::led_default_elements = ArdourButton::Element (ArdourButton::default_elements|ArdourButton::Indicator);
|
||||
ArdourButton::Element ArdourButton::just_led_default_elements = ArdourButton::Element (ArdourButton::Edge|ArdourButton::Body|ArdourButton::Indicator);
|
||||
|
||||
ArdourButton::ArdourButton (Element e)
|
||||
: _elements (e)
|
||||
, _act_on_release (true)
|
||||
, _text_width (0)
|
||||
, _text_height (0)
|
||||
, _diameter (0.0)
|
||||
, _corner_radius (9)
|
||||
, _diameter (11.0)
|
||||
, _corner_radius (9.0)
|
||||
, edge_pattern (0)
|
||||
, fill_pattern (0)
|
||||
, led_inset_pattern (0)
|
||||
, reflection_pattern (0)
|
||||
, _led_left (false)
|
||||
, _fixed_diameter (false)
|
||||
, _distinct_led_click (true)
|
||||
, _fixed_diameter (true)
|
||||
, _distinct_led_click (false)
|
||||
{
|
||||
ColorsChanged.connect (sigc::mem_fun (*this, &ArdourButton::color_handler));
|
||||
StateChanged.connect (sigc::mem_fun (*this, &ArdourButton::state_handler));
|
||||
|
@ -115,9 +123,9 @@ ArdourButton::render (cairo_t* cr)
|
|||
|
||||
if (_elements & Body) {
|
||||
if (_elements & Edge) {
|
||||
Gtkmm2ext::rounded_rectangle (cr, 1, 1, _width-2, _height-2, _corner_radius);
|
||||
Gtkmm2ext::rounded_rectangle (cr, 1, 1, _width-2, _height-2, _corner_radius - 1.0);
|
||||
} else {
|
||||
Gtkmm2ext::rounded_rectangle (cr, 0, 0, _width, _height, _corner_radius);
|
||||
Gtkmm2ext::rounded_rectangle (cr, 0, 0, _width, _height, _corner_radius - 1.0);
|
||||
}
|
||||
cairo_set_source (cr, fill_pattern);
|
||||
cairo_fill (cr);
|
||||
|
@ -145,11 +153,17 @@ ArdourButton::render (cairo_t* cr)
|
|||
if (_elements & Indicator) {
|
||||
|
||||
/* move to the center of the indicator/led */
|
||||
|
||||
if (_led_left) {
|
||||
cairo_translate (cr, 3 + (_diameter/2.0), _height/2.0);
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
if (_elements & Text) {
|
||||
if (_led_left) {
|
||||
cairo_translate (cr, 3 + (_diameter/2.0), _height/2.0);
|
||||
} else {
|
||||
cairo_translate (cr, _width - ((_diameter/2.0) + 4.0), _height/2.0);
|
||||
}
|
||||
} else {
|
||||
cairo_translate (cr, _width - ((_diameter/2.0) + 4.0), _height/2.0);
|
||||
cairo_translate (cr, _width/2.0, _height/2.0);
|
||||
}
|
||||
|
||||
//inset
|
||||
|
@ -172,6 +186,17 @@ ArdourButton::render (cairo_t* cr)
|
|||
cairo_arc (cr, 0, 0, _diameter/2-3, 0, 2 * M_PI);
|
||||
cairo_set_source (cr, reflection_pattern);
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_restore (cr);
|
||||
|
||||
}
|
||||
|
||||
/* a partially transparent gray layer to indicate insensitivity */
|
||||
|
||||
if ((visual_state() & Insensitive)) {
|
||||
cairo_rectangle (cr, 0, 0, _width, _height);
|
||||
cairo_set_source_rgba (cr, 0.905, 0.917, 0.925, 0.5);
|
||||
cairo_fill (cr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -206,16 +231,22 @@ ArdourButton::on_size_request (Gtk::Requisition* req)
|
|||
int xpad = 0;
|
||||
int ypad = 6;
|
||||
|
||||
if (!_text.empty()) {
|
||||
CairoWidget::on_size_request (req);
|
||||
|
||||
if ((_elements & Text) && !_text.empty()) {
|
||||
_layout->get_pixel_size (_text_width, _text_height);
|
||||
xpad += 6;
|
||||
} else {
|
||||
_text_width = 0;
|
||||
_text_height = 0;
|
||||
}
|
||||
|
||||
if (_fixed_diameter) {
|
||||
req->width = _text_width + (int) _diameter + xpad;
|
||||
req->height = max (_text_height, (int) _diameter) + ypad;
|
||||
} else {
|
||||
CairoWidget::on_size_request (req);
|
||||
if ((_elements & Indicator) && _fixed_diameter) {
|
||||
req->width = _text_width + lrint (_diameter) + xpad;
|
||||
req->height = max (_text_height, (int) lrint (_diameter)) + ypad;
|
||||
} else {
|
||||
req->width = _text_width + xpad;
|
||||
req->height = _text_height + ypad;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -341,12 +372,17 @@ ArdourButton::on_button_press_event (GdkEventButton *ev)
|
|||
int left;
|
||||
int right;
|
||||
|
||||
if (_led_left) {
|
||||
left = 4;
|
||||
right = left + _diameter;
|
||||
if (_elements & Text) {
|
||||
if (_led_left) {
|
||||
left = 4;
|
||||
right = left + _diameter;
|
||||
} else {
|
||||
left = lrint (_width - 4 - _diameter/2.0);
|
||||
right = left + _diameter;
|
||||
}
|
||||
} else {
|
||||
left = lrint (_width - 4 - _diameter/2.0);
|
||||
right = left + _diameter;
|
||||
left = _width/2.0 - (_diameter/2.0);
|
||||
right = _width/2.0 + (_diameter/2.0);
|
||||
}
|
||||
|
||||
if (ev->x >= left && ev->x <= right && ev->y <= bottom && ev->y >= top) {
|
||||
|
@ -354,13 +390,23 @@ ArdourButton::on_button_press_event (GdkEventButton *ev)
|
|||
}
|
||||
}
|
||||
|
||||
if (binding_proxy.button_press_handler (ev)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!_act_on_release) {
|
||||
if (_action) {
|
||||
_action->activate ();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
ArdourButton::on_button_release_event (GdkEventButton *ev)
|
||||
{
|
||||
|
||||
if ((_elements & Indicator) && _distinct_led_click) {
|
||||
|
||||
/* if within LED, emit signal */
|
||||
|
@ -383,6 +429,13 @@ ArdourButton::on_button_release_event (GdkEventButton *ev)
|
|||
}
|
||||
}
|
||||
|
||||
if (_act_on_release) {
|
||||
if (_action) {
|
||||
_action->activate ();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -405,3 +458,60 @@ ArdourButton::on_size_allocate (Allocation& alloc)
|
|||
CairoWidget::on_size_allocate (alloc);
|
||||
set_colors ();
|
||||
}
|
||||
|
||||
void
|
||||
ArdourButton::set_controllable (boost::shared_ptr<Controllable> c)
|
||||
{
|
||||
watch_connection.disconnect ();
|
||||
binding_proxy.set_controllable (c);
|
||||
}
|
||||
|
||||
void
|
||||
ArdourButton::watch ()
|
||||
{
|
||||
boost::shared_ptr<Controllable> c (binding_proxy.get_controllable ());
|
||||
|
||||
if (!c) {
|
||||
warning << _("button cannot watch state of non-existing Controllable\n") << endmsg;
|
||||
return;
|
||||
}
|
||||
|
||||
c->Changed.connect (watch_connection, invalidator(*this), boost::bind (&ArdourButton::controllable_changed, this), gui_context());
|
||||
}
|
||||
|
||||
void
|
||||
ArdourButton::controllable_changed ()
|
||||
{
|
||||
float val = binding_proxy.get_controllable()->get_value();
|
||||
|
||||
if (fabs (val) >= 0.5f) {
|
||||
set_active_state (CairoWidget::Active);
|
||||
} else {
|
||||
unset_active_state ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ArdourButton::set_related_action (RefPtr<Action> act)
|
||||
{
|
||||
_action = act;
|
||||
|
||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (_action);
|
||||
if (tact) {
|
||||
tact->signal_toggled().connect (sigc::mem_fun (*this, &ArdourButton::action_toggled));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ArdourButton::action_toggled ()
|
||||
{
|
||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (_action);
|
||||
|
||||
if (tact) {
|
||||
if (tact->get_active()) {
|
||||
set_active_state (CairoWidget::Active);
|
||||
} else {
|
||||
unset_active_state ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,11 +22,14 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <gtkmm/activatable.h>
|
||||
#include <gtkmm/action.h>
|
||||
|
||||
#include "pbd/signals.h"
|
||||
#include "gtkmm2ext/binding_proxy.h"
|
||||
|
||||
#include "cairo_widget.h"
|
||||
|
||||
class ArdourButton : public CairoWidget, Gtk::Activatable
|
||||
class ArdourButton : public CairoWidget
|
||||
{
|
||||
public:
|
||||
enum Element {
|
||||
|
@ -39,6 +42,7 @@ class ArdourButton : public CairoWidget, Gtk::Activatable
|
|||
|
||||
static Element default_elements;
|
||||
static Element led_default_elements;
|
||||
static Element just_led_default_elements;
|
||||
|
||||
ArdourButton (Element e = default_elements);
|
||||
virtual ~ArdourButton ();
|
||||
|
@ -57,6 +61,12 @@ class ArdourButton : public CairoWidget, Gtk::Activatable
|
|||
|
||||
sigc::signal<void> signal_led_clicked;
|
||||
|
||||
boost::shared_ptr<PBD::Controllable> get_controllable() { return binding_proxy.get_controllable(); }
|
||||
void set_controllable (boost::shared_ptr<PBD::Controllable> c);
|
||||
void watch ();
|
||||
|
||||
void set_related_action (Glib::RefPtr<Gtk::Action>);
|
||||
|
||||
protected:
|
||||
void render (cairo_t *);
|
||||
void on_size_request (Gtk::Requisition* req);
|
||||
|
@ -64,10 +74,15 @@ class ArdourButton : public CairoWidget, Gtk::Activatable
|
|||
bool on_button_press_event (GdkEventButton*);
|
||||
bool on_button_release_event (GdkEventButton*);
|
||||
|
||||
void controllable_changed ();
|
||||
PBD::ScopedConnection watch_connection;
|
||||
|
||||
private:
|
||||
Glib::RefPtr<Pango::Layout> _layout;
|
||||
std::string _text;
|
||||
Element _elements;
|
||||
BindingProxy binding_proxy;
|
||||
bool _act_on_release;
|
||||
|
||||
int _text_width;
|
||||
int _text_height;
|
||||
|
@ -96,6 +111,10 @@ class ArdourButton : public CairoWidget, Gtk::Activatable
|
|||
void set_colors ();
|
||||
void color_handler ();
|
||||
void state_handler ();
|
||||
|
||||
Glib::RefPtr<Gtk::Action> _action;
|
||||
void action_activated ();
|
||||
void action_toggled ();
|
||||
};
|
||||
|
||||
#endif /* __gtk2_ardour_ardour_button_h__ */
|
||||
|
|
|
@ -136,6 +136,7 @@ CANVAS_VARIABLE(canvasvar_WaveFormClip, "clipped waveform")
|
|||
CANVAS_VARIABLE(canvasvar_WaveFormFill, "waveform fill")
|
||||
CANVAS_VARIABLE(canvasvar_ZeroLine, "zero line")
|
||||
CANVAS_VARIABLE(canvasvar_ZoomRect, "zoom rect")
|
||||
CANVAS_VARIABLE(canvasvar_MonitorSectionKnob, "monitor knob")
|
||||
|
||||
#define BUTTON_VARS(root,name) \
|
||||
CANVAS_VARIABLE(canvasvar_ ## root ## BorderStart, name " border start") \
|
||||
|
@ -161,3 +162,14 @@ BUTTON_VARS(ProcessorPostFader, "processor postfader")
|
|||
BUTTON_VARS(MonitorButton, "monitor")
|
||||
BUTTON_VARS(SoloIsolateButton, "solo isolate")
|
||||
BUTTON_VARS(SoloSafeButton, "solo safe")
|
||||
BUTTON_VARS(MonitorSectionCutButton, "monitor section cut")
|
||||
BUTTON_VARS(MonitorSectionDimButton, "monitor section dim")
|
||||
BUTTON_VARS(MonitorSectionSoloButton, "monitor section solo")
|
||||
BUTTON_VARS(MonitorSectionInvertButton, "monitor section invert")
|
||||
BUTTON_VARS(MonitorSectionMonoButton, "monitor section mono")
|
||||
BUTTON_VARS(MonitorSectionSoloOverrideButton, "monitor solo override")
|
||||
BUTTON_VARS(MonitorSectionSoloExclusiveButton, "monitor solo exclusive")
|
||||
BUTTON_VARS(RudeSolo, "rude solo")
|
||||
BUTTON_VARS(RudeIsolate, "rude isolate")
|
||||
BUTTON_VARS(RudeAudition, "rude audition")
|
||||
|
||||
|
|
|
@ -44,14 +44,11 @@ MonitorSection::MonitorSection (Session* s)
|
|||
, solo_in_place_button (solo_model_group, _("SiP"))
|
||||
, afl_button (solo_model_group, _("AFL"))
|
||||
, pfl_button (solo_model_group, _("PFL"))
|
||||
, cut_all_button (_("MUTE"))
|
||||
, dim_all_button (_("dim"))
|
||||
, mono_button (_("mono"))
|
||||
, rude_solo_button (_("soloing"))
|
||||
, rude_iso_button (_("isolated"))
|
||||
, rude_audition_button (_("auditioning"))
|
||||
, exclusive_solo_button (_("Exclusive"))
|
||||
, solo_mute_override_button (_("Solo/Mute"))
|
||||
, cut_all_button (ArdourButton::led_default_elements)
|
||||
, dim_all_button (ArdourButton::led_default_elements)
|
||||
, mono_button (ArdourButton::led_default_elements)
|
||||
, exclusive_solo_button (ArdourButton::led_default_elements)
|
||||
, solo_mute_override_button (ArdourButton::led_default_elements)
|
||||
{
|
||||
Glib::RefPtr<Action> act;
|
||||
|
||||
|
@ -87,24 +84,27 @@ MonitorSection::MonitorSection (Session* s)
|
|||
|
||||
/* Rude Solo */
|
||||
|
||||
rude_solo_button.set_name ("TransportSoloAlert");
|
||||
rude_solo_button.set_text (_("soloing"));
|
||||
rude_solo_button.set_name ("rude solo");
|
||||
rude_solo_button.show ();
|
||||
|
||||
rude_iso_button.set_name ("MonitorIsoAlert");
|
||||
rude_iso_button.set_text (_("isolated"));
|
||||
rude_iso_button.set_name ("rude isolate");
|
||||
rude_iso_button.show ();
|
||||
|
||||
rude_audition_button.set_name ("TransportAuditioningAlert");
|
||||
rude_audition_button.set_text (_("auditioning"));
|
||||
rude_audition_button.set_name ("rude audition");
|
||||
rude_audition_button.show ();
|
||||
|
||||
ARDOUR_UI::Blink.connect (sigc::mem_fun (*this, &MonitorSection::do_blink));
|
||||
|
||||
rude_solo_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_solo), false);
|
||||
rude_solo_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_solo));
|
||||
UI::instance()->set_tip (rude_solo_button, _("When active, something is soloed.\nClick to de-solo everything"));
|
||||
|
||||
rude_iso_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_isolate), false);
|
||||
rude_iso_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_isolate));
|
||||
UI::instance()->set_tip (rude_iso_button, _("When active, something is solo-isolated.\nClick to de-isolate everything"));
|
||||
|
||||
rude_audition_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_audition), false);
|
||||
rude_audition_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_audition));
|
||||
UI::instance()->set_tip (rude_audition_button, _("When active, auditioning is active.\nClick to stop the audition"));
|
||||
|
||||
solo_model_box.set_spacing (6);
|
||||
|
@ -162,20 +162,22 @@ MonitorSection::MonitorSection (Session* s)
|
|||
|
||||
solo_packer->pack_start (*spin_packer, false, true);
|
||||
|
||||
exclusive_solo_button.set_name (X_("MonitorOptButton"));
|
||||
exclusive_solo_button.set_text (_("Exclusive"));
|
||||
exclusive_solo_button.set_name (X_("monitor solo exclusive"));
|
||||
ARDOUR_UI::instance()->set_tip (&exclusive_solo_button, _("Exclusive solo means that only 1 solo is active at a time"));
|
||||
|
||||
act = ActionManager::get_action (X_("Monitor"), X_("toggle-exclusive-solo"));
|
||||
if (act) {
|
||||
act->connect_proxy (exclusive_solo_button);
|
||||
exclusive_solo_button.set_related_action (act);
|
||||
}
|
||||
|
||||
solo_mute_override_button.set_name (X_("MonitorOptButton"));
|
||||
solo_mute_override_button.set_text (_("Solo/Mute"));
|
||||
solo_mute_override_button.set_name (X_("monitor solo override"));
|
||||
ARDOUR_UI::instance()->set_tip (&solo_mute_override_button, _("If enabled, solo will override mute\n(a soloed & muted track or bus will be audible)"));
|
||||
|
||||
act = ActionManager::get_action (X_("Monitor"), X_("toggle-mute-overrides-solo"));
|
||||
if (act) {
|
||||
act->connect_proxy (solo_mute_override_button);
|
||||
solo_mute_override_button.set_related_action (act);
|
||||
}
|
||||
|
||||
HBox* solo_opt_box = manage (new HBox);
|
||||
|
@ -197,37 +199,39 @@ MonitorSection::MonitorSection (Session* s)
|
|||
upper_packer.pack_start (*solo_opt_box, false, false);
|
||||
upper_packer.pack_start (*solo_packer, false, false);
|
||||
|
||||
act = ActionManager::get_action (X_("Monitor"), X_("monitor-cut-all"));
|
||||
if (act) {
|
||||
act->connect_proxy (cut_all_button);
|
||||
}
|
||||
|
||||
act = ActionManager::get_action (X_("Monitor"), X_("monitor-dim-all"));
|
||||
if (act) {
|
||||
act->connect_proxy (dim_all_button);
|
||||
}
|
||||
|
||||
act = ActionManager::get_action (X_("Monitor"), X_("monitor-mono"));
|
||||
if (act) {
|
||||
act->connect_proxy (mono_button);
|
||||
}
|
||||
|
||||
cut_all_button.set_name (X_("MonitorMuteButton"));
|
||||
cut_all_button.unset_flags (Gtk::CAN_FOCUS);
|
||||
cut_all_button.set_text (_("MUTE"));
|
||||
cut_all_button.set_name ("monitor section cut");
|
||||
cut_all_button.set_name (X_("monitor section cut"));
|
||||
cut_all_button.set_size_request (50,50);
|
||||
cut_all_button.show ();
|
||||
|
||||
act = ActionManager::get_action (X_("Monitor"), X_("monitor-cut-all"));
|
||||
if (act) {
|
||||
cut_all_button.set_related_action (act);
|
||||
}
|
||||
|
||||
dim_all_button.set_text (_("dim"));
|
||||
dim_all_button.set_name ("monitor section dim");
|
||||
// dim_all_button.set_size_request (50,50);
|
||||
act = ActionManager::get_action (X_("Monitor"), X_("monitor-dim-all"));
|
||||
if (act) {
|
||||
dim_all_button.set_related_action (act);
|
||||
}
|
||||
|
||||
mono_button.set_text (_("mono"));
|
||||
mono_button.set_name ("monitor section mono");
|
||||
// mono_button.set_size_request (50,50);
|
||||
act = ActionManager::get_action (X_("Monitor"), X_("monitor-mono"));
|
||||
if (act) {
|
||||
mono_button.set_related_action (act);
|
||||
}
|
||||
|
||||
HBox* bbox = manage (new HBox);
|
||||
|
||||
bbox->set_spacing (12);
|
||||
bbox->pack_start (mono_button, true, true);
|
||||
bbox->pack_start (dim_all_button, true, true);
|
||||
|
||||
dim_all_button.set_name (X_("MonitorDimButton"));
|
||||
dim_all_button.unset_flags (Gtk::CAN_FOCUS);
|
||||
mono_button.set_name (X_("MonitorMonoButton"));
|
||||
mono_button.unset_flags (Gtk::CAN_FOCUS);
|
||||
|
||||
lower_packer.set_spacing (12);
|
||||
lower_packer.pack_start (*bbox, false, false);
|
||||
lower_packer.pack_start (cut_all_button, false, false);
|
||||
|
@ -245,11 +249,17 @@ MonitorSection::MonitorSection (Session* s)
|
|||
|
||||
lower_packer.pack_start (*spin_packer, true, true);
|
||||
|
||||
main_table_scroller.add (main_table);
|
||||
main_table_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
|
||||
main_table_scroller.set_size_request (-1, 150);
|
||||
main_table_scroller.set_shadow_type (Gtk::SHADOW_NONE);
|
||||
main_table_scroller.show ();
|
||||
|
||||
vpacker.set_border_width (12);
|
||||
vpacker.set_spacing (12);
|
||||
vpacker.pack_start (upper_packer, false, false);
|
||||
vpacker.pack_start (*dim_packer, false, false);
|
||||
vpacker.pack_start (main_table, false, false);
|
||||
vpacker.pack_start (main_table_scroller, false, false);
|
||||
vpacker.pack_start (lower_packer, false, false);
|
||||
|
||||
hpacker.set_border_width (12);
|
||||
|
@ -321,28 +331,28 @@ MonitorSection::set_session (Session* s)
|
|||
_monitor.reset ();
|
||||
_route.reset ();
|
||||
control_connections.drop_connections ();
|
||||
rude_iso_button.set_active (false);
|
||||
rude_solo_button.set_active (false);
|
||||
rude_iso_button.unset_active_state ();
|
||||
rude_solo_button.unset_active_state ();
|
||||
|
||||
assign_controllables ();
|
||||
}
|
||||
}
|
||||
|
||||
MonitorSection::ChannelButtonSet::ChannelButtonSet ()
|
||||
: cut (X_(""))
|
||||
, dim (X_(""))
|
||||
, solo (X_(""))
|
||||
, invert (X_(""))
|
||||
: cut (ArdourButton::just_led_default_elements)
|
||||
, dim (ArdourButton::just_led_default_elements)
|
||||
, solo (ArdourButton::just_led_default_elements)
|
||||
, invert (ArdourButton::just_led_default_elements)
|
||||
{
|
||||
cut.set_name (X_("MonitorMuteButton"));
|
||||
dim.set_name (X_("MonitorDimButton"));
|
||||
solo.set_name (X_("MixerSoloButton"));
|
||||
invert.set_name (X_("MonitorInvertButton"));
|
||||
cut.set_diameter (3);
|
||||
dim.set_diameter (3);
|
||||
solo.set_diameter (3);
|
||||
invert.set_diameter (3);
|
||||
|
||||
gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (cut.gobj()), false);
|
||||
gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (dim.gobj()), false);
|
||||
gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (invert.gobj()), false);
|
||||
gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (solo.gobj()), false);
|
||||
cut.set_name (X_("monitor section cut"));
|
||||
dim.set_name (X_("monitor section dim"));
|
||||
solo.set_name (X_("monitor section solo"));
|
||||
invert.set_name (X_("monitor section invert"));
|
||||
|
||||
cut.unset_flags (Gtk::CAN_FOCUS);
|
||||
dim.unset_flags (Gtk::CAN_FOCUS);
|
||||
|
@ -410,25 +420,25 @@ MonitorSection::populate_buttons ()
|
|||
snprintf (buf, sizeof (buf), "monitor-cut-%u", i+1);
|
||||
act = ActionManager::get_action (X_("Monitor"), buf);
|
||||
if (act) {
|
||||
act->connect_proxy (cbs->cut);
|
||||
cbs->cut.set_related_action (act);
|
||||
}
|
||||
|
||||
snprintf (buf, sizeof (buf), "monitor-dim-%u", i+1);
|
||||
act = ActionManager::get_action (X_("Monitor"), buf);
|
||||
if (act) {
|
||||
act->connect_proxy (cbs->dim);
|
||||
cbs->dim.set_related_action (act);
|
||||
}
|
||||
|
||||
snprintf (buf, sizeof (buf), "monitor-solo-%u", i+1);
|
||||
act = ActionManager::get_action (X_("Monitor"), buf);
|
||||
if (act) {
|
||||
act->connect_proxy (cbs->solo);
|
||||
cbs->solo.set_related_action (act);
|
||||
}
|
||||
|
||||
snprintf (buf, sizeof (buf), "monitor-invert-%u", i+1);
|
||||
act = ActionManager::get_action (X_("Monitor"), buf);
|
||||
if (act) {
|
||||
act->connect_proxy (cbs->invert);
|
||||
cbs->invert.set_related_action (act);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -727,8 +737,13 @@ MonitorSection::solo_use_pfl ()
|
|||
void
|
||||
MonitorSection::setup_knob_images ()
|
||||
{
|
||||
|
||||
try {
|
||||
|
||||
uint32_t c = ARDOUR_UI::config()->color_by_name ("monitor knob");
|
||||
char buf[16];
|
||||
snprintf (buf, 16, "#%x", (c >> 8));
|
||||
cerr << "Motion feedback using " << buf << endl;
|
||||
MotionFeedback::set_lamp_color (buf);
|
||||
big_knob_pixbuf = MotionFeedback::render_pixbuf (80);
|
||||
|
||||
} catch (...) {
|
||||
|
@ -884,13 +899,12 @@ MonitorSection::audition_blink (bool onoff)
|
|||
|
||||
if (_session->is_auditioning()) {
|
||||
if (onoff) {
|
||||
rude_audition_button.set_state (STATE_ACTIVE);
|
||||
rude_audition_button.set_active_state (CairoWidget::Active);
|
||||
} else {
|
||||
rude_audition_button.set_state (STATE_NORMAL);
|
||||
rude_audition_button.unset_active_state ();
|
||||
}
|
||||
} else {
|
||||
rude_audition_button.set_active (false);
|
||||
rude_audition_button.set_state (STATE_NORMAL);
|
||||
rude_audition_button.unset_active_state ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -903,19 +917,21 @@ MonitorSection::solo_blink (bool onoff)
|
|||
|
||||
if (_session->soloing() || _session->listening()) {
|
||||
if (onoff) {
|
||||
rude_solo_button.set_state (STATE_ACTIVE);
|
||||
rude_solo_button.set_active_state (CairoWidget::Active);
|
||||
} else {
|
||||
rude_solo_button.set_state (STATE_NORMAL);
|
||||
rude_solo_button.unset_active_state ();
|
||||
}
|
||||
|
||||
if (_session->soloing()) {
|
||||
rude_iso_button.set_active (_session->solo_isolated());
|
||||
if (_session->solo_isolated()) {
|
||||
rude_iso_button.set_active_state (CairoWidget::Active);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// rude_solo_button.set_active (false);
|
||||
rude_solo_button.set_state (STATE_NORMAL);
|
||||
rude_iso_button.set_active (false);
|
||||
rude_solo_button.unset_active_state ();
|
||||
rude_iso_button.unset_active_state ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "gtkmm2ext/bindable_button.h"
|
||||
|
||||
#include "ardour_button.h"
|
||||
#include "axis_view.h"
|
||||
#include "level_meter.h"
|
||||
#include "route_ui.h"
|
||||
|
@ -50,15 +51,16 @@ class MonitorSection : public RouteUI
|
|||
Gtk::VBox vpacker;
|
||||
Gtk::HBox hpacker;
|
||||
Gtk::Table main_table;
|
||||
Gtk::ScrolledWindow main_table_scroller;
|
||||
Gtk::VBox upper_packer;
|
||||
Gtk::VBox lower_packer;
|
||||
Gtkmm2ext::TearOff* _tearoff;
|
||||
|
||||
struct ChannelButtonSet {
|
||||
BindableToggleButton cut;
|
||||
BindableToggleButton dim;
|
||||
BindableToggleButton solo;
|
||||
BindableToggleButton invert;
|
||||
ArdourButton cut;
|
||||
ArdourButton dim;
|
||||
ArdourButton solo;
|
||||
ArdourButton invert;
|
||||
|
||||
ChannelButtonSet ();
|
||||
};
|
||||
|
@ -107,14 +109,14 @@ class MonitorSection : public RouteUI
|
|||
void solo_use_afl ();
|
||||
void solo_use_pfl ();
|
||||
|
||||
BindableToggleButton cut_all_button;
|
||||
BindableToggleButton dim_all_button;
|
||||
BindableToggleButton mono_button;
|
||||
BindableToggleButton rude_solo_button;
|
||||
BindableToggleButton rude_iso_button;
|
||||
BindableToggleButton rude_audition_button;
|
||||
BindableToggleButton exclusive_solo_button;
|
||||
BindableToggleButton solo_mute_override_button;
|
||||
ArdourButton cut_all_button;
|
||||
ArdourButton dim_all_button;
|
||||
ArdourButton mono_button;
|
||||
ArdourButton rude_solo_button;
|
||||
ArdourButton rude_iso_button;
|
||||
ArdourButton rude_audition_button;
|
||||
ArdourButton exclusive_solo_button;
|
||||
ArdourButton solo_mute_override_button;
|
||||
|
||||
void do_blink (bool);
|
||||
void solo_blink (bool);
|
||||
|
|
Loading…
Reference in New Issue