mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
More fixes to ArdourButton actions.
Optionally allow events to fallthrough to parents, in particular for the DnDVBox case. Also allow the number_label to operate as a track selector.
This commit is contained in:
parent
61c11157c0
commit
7306568634
6 changed files with 26 additions and 14 deletions
|
|
@ -83,6 +83,7 @@ ArdourButton::ArdourButton (Element e)
|
||||||
, _hovering (false)
|
, _hovering (false)
|
||||||
, _focused (false)
|
, _focused (false)
|
||||||
, _fixed_colors_set (false)
|
, _fixed_colors_set (false)
|
||||||
|
, _fallthrough_to_parent (false)
|
||||||
{
|
{
|
||||||
ARDOUR_UI_UTILS::ColorsChanged.connect (sigc::mem_fun (*this, &ArdourButton::color_handler));
|
ARDOUR_UI_UTILS::ColorsChanged.connect (sigc::mem_fun (*this, &ArdourButton::color_handler));
|
||||||
}
|
}
|
||||||
|
|
@ -660,20 +661,24 @@ ArdourButton::on_button_press_event (GdkEventButton *ev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_grabbed = true;
|
|
||||||
queue_draw ();
|
|
||||||
|
|
||||||
if (binding_proxy.button_press_handler (ev)) {
|
if (binding_proxy.button_press_handler (ev)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_grabbed = true;
|
||||||
|
queue_draw ();
|
||||||
|
|
||||||
if (!_act_on_release) {
|
if (!_act_on_release) {
|
||||||
if (_action) {
|
if (_action) {
|
||||||
_action->activate ();
|
_action->activate ();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
if (_fallthrough_to_parent)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
@ -690,7 +695,6 @@ ArdourButton::on_button_release_event (GdkEventButton *ev)
|
||||||
_grabbed = false;
|
_grabbed = false;
|
||||||
queue_draw ();
|
queue_draw ();
|
||||||
|
|
||||||
|
|
||||||
if (_hovering) {
|
if (_hovering) {
|
||||||
signal_clicked ();
|
signal_clicked ();
|
||||||
if (_act_on_release) {
|
if (_act_on_release) {
|
||||||
|
|
@ -700,6 +704,9 @@ ArdourButton::on_button_release_event (GdkEventButton *ev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_fallthrough_to_parent)
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,9 @@ class ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable
|
||||||
|
|
||||||
void set_image (const Glib::RefPtr<Gdk::Pixbuf>&);
|
void set_image (const Glib::RefPtr<Gdk::Pixbuf>&);
|
||||||
|
|
||||||
void set_fixed_colors (const uint32_t active_color, const uint32_t inactive_color);
|
void set_fixed_colors (const uint32_t active_color, const uint32_t inactive_color);
|
||||||
|
|
||||||
|
void set_fallthrough_to_parent(bool fall) { _fallthrough_to_parent = fall; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void render (cairo_t *, cairo_rectangle_t *);
|
void render (cairo_t *, cairo_rectangle_t *);
|
||||||
|
|
@ -154,6 +156,8 @@ class ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable
|
||||||
bool _focused;
|
bool _focused;
|
||||||
bool _fixed_colors_set;
|
bool _fixed_colors_set;
|
||||||
|
|
||||||
|
bool _fallthrough_to_parent;
|
||||||
|
|
||||||
void setup_led_rect ();
|
void setup_led_rect ();
|
||||||
void set_colors ();
|
void set_colors ();
|
||||||
void color_handler ();
|
void color_handler ();
|
||||||
|
|
|
||||||
|
|
@ -284,6 +284,7 @@ MixerStrip::init ()
|
||||||
number_label.set_name ("tracknumber label");
|
number_label.set_name ("tracknumber label");
|
||||||
number_label.set_fixed_colors (0x80808080, 0x80808080);
|
number_label.set_fixed_colors (0x80808080, 0x80808080);
|
||||||
number_label.set_alignment (.5, .5);
|
number_label.set_alignment (.5, .5);
|
||||||
|
number_label.set_fallthrough_to_parent (true);
|
||||||
|
|
||||||
global_vpacker.set_spacing (2);
|
global_vpacker.set_spacing (2);
|
||||||
if (!ARDOUR::Profile->get_trx()) {
|
if (!ARDOUR::Profile->get_trx()) {
|
||||||
|
|
|
||||||
|
|
@ -501,6 +501,7 @@ ProcessorEntry::Control::Control (boost::shared_ptr<AutomationControl> c, string
|
||||||
{
|
{
|
||||||
_slider.set_controllable (c);
|
_slider.set_controllable (c);
|
||||||
box.set_padding(0, 0, 4, 4);
|
box.set_padding(0, 0, 4, 4);
|
||||||
|
_button.set_fallthrough_to_parent(true);
|
||||||
|
|
||||||
if (c->toggled()) {
|
if (c->toggled()) {
|
||||||
_button.set_text (_name);
|
_button.set_text (_name);
|
||||||
|
|
@ -1312,6 +1313,12 @@ ProcessorBox::processor_button_press_event (GdkEventButton *ev, ProcessorEntry*
|
||||||
|
|
||||||
ret = true;
|
ret = true;
|
||||||
|
|
||||||
|
} else if (Keyboard::is_context_menu_event (ev)) {
|
||||||
|
|
||||||
|
show_processor_menu (ev->time);
|
||||||
|
|
||||||
|
ret = true;
|
||||||
|
|
||||||
} else if (processor && ev->button == 1 && selected) {
|
} else if (processor && ev->button == 1 && selected) {
|
||||||
|
|
||||||
// this is purely informational but necessary for route params UI
|
// this is purely informational but necessary for route params UI
|
||||||
|
|
@ -1340,10 +1347,6 @@ ProcessorBox::processor_button_release_event (GdkEventButton *ev, ProcessorEntry
|
||||||
sigc::mem_fun(*this, &ProcessorBox::idle_delete_processor),
|
sigc::mem_fun(*this, &ProcessorBox::idle_delete_processor),
|
||||||
boost::weak_ptr<Processor>(processor)));
|
boost::weak_ptr<Processor>(processor)));
|
||||||
|
|
||||||
} else if (Keyboard::is_context_menu_event (ev)) {
|
|
||||||
|
|
||||||
show_processor_menu (ev->time);
|
|
||||||
|
|
||||||
} else if (processor && Keyboard::is_button2_event (ev)
|
} else if (processor && Keyboard::is_button2_event (ev)
|
||||||
#ifndef GTKOSX
|
#ifndef GTKOSX
|
||||||
&& (Keyboard::no_modifier_keys_pressed (ev) && ((ev->state & Gdk::BUTTON2_MASK) == Gdk::BUTTON2_MASK))
|
&& (Keyboard::no_modifier_keys_pressed (ev) && ((ev->state & Gdk::BUTTON2_MASK) == Gdk::BUTTON2_MASK))
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session* sess, ArdourCan
|
||||||
{
|
{
|
||||||
number_label.set_name("route button");
|
number_label.set_name("route button");
|
||||||
number_label.set_alignment(.5, .5);
|
number_label.set_alignment(.5, .5);
|
||||||
|
number_label.set_fallthrough_to_parent (true);
|
||||||
|
|
||||||
sess->config.ParameterChanged.connect (*this, invalidator (*this), boost::bind (&RouteTimeAxisView::parameter_changed, this, _1), gui_context());
|
sess->config.ParameterChanged.connect (*this, invalidator (*this), boost::bind (&RouteTimeAxisView::parameter_changed, this, _1), gui_context());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -772,28 +772,24 @@ RouteUI::update_monitoring_display ()
|
||||||
bool
|
bool
|
||||||
RouteUI::monitor_input_press(GdkEventButton*)
|
RouteUI::monitor_input_press(GdkEventButton*)
|
||||||
{
|
{
|
||||||
printf("RouteUI monitor_input_press\n");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
RouteUI::monitor_input_release(GdkEventButton* ev)
|
RouteUI::monitor_input_release(GdkEventButton* ev)
|
||||||
{
|
{
|
||||||
printf("RouteUI monitor_input_release\n");
|
|
||||||
return monitor_release (ev, MonitorInput);
|
return monitor_release (ev, MonitorInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
RouteUI::monitor_disk_press (GdkEventButton*)
|
RouteUI::monitor_disk_press (GdkEventButton*)
|
||||||
{
|
{
|
||||||
printf("RouteUI monitor_disk_press\n");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
RouteUI::monitor_disk_release (GdkEventButton* ev)
|
RouteUI::monitor_disk_release (GdkEventButton* ev)
|
||||||
{
|
{
|
||||||
printf("RouteUI monitor_disk_release\n");
|
|
||||||
monitor_release (ev, MonitorDisk);
|
monitor_release (ev, MonitorDisk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue