13
0

give monitor section its own bindings

This commit is contained in:
Paul Davis 2016-03-15 12:41:14 -04:00
parent 09e193c097
commit d46b0f5548
2 changed files with 58 additions and 19 deletions

View File

@ -94,6 +94,7 @@ MonitorSection::MonitorSection (Session* s)
if (!monitor_actions) {
register_actions ();
load_bindings ();
set_data ("ardour-bindings", bindings);
}
_plugin_selector = new PluginSelector (PluginManager::instance());
@ -429,6 +430,8 @@ MonitorSection::MonitorSection (Session* s)
hpacker.set_spacing (0);
hpacker.pack_start (vpacker, true, true);
add (hpacker);
gain_control->show_all ();
gain_display->show_all ();
dim_control->show_all ();
@ -457,7 +460,11 @@ MonitorSection::MonitorSection (Session* s)
output_button->signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::output_press), false);
output_button->signal_button_release_event().connect (sigc::mem_fun(*this, &MonitorSection::output_release), false);
_tearoff = new TearOff (hpacker);
signal_enter_notify_event().connect (sigc::mem_fun (*this, &MonitorSection::enter_handler));
signal_leave_notify_event().connect (sigc::mem_fun (*this, &MonitorSection::leave_handler));
set_flags (CAN_FOCUS);
_tearoff = new TearOff (*this);
if (!UIConfiguration::instance().get_floating_monitor_section()) {
/* if torn off, make this a normal window
@ -503,6 +510,36 @@ MonitorSection::~MonitorSection ()
_output_selector = 0;
}
bool
MonitorSection::enter_handler (GdkEventCrossing* ev)
{
grab_focus ();
return false;
}
bool
MonitorSection::leave_handler (GdkEventCrossing* ev)
{
switch (ev->detail) {
case GDK_NOTIFY_INFERIOR:
return false;
default:
break;
}
/* cancel focus if we're not torn off. With X11 WM's that do
* focus-follows-mouse, focus will be taken from us anyway.
*/
Widget* top = get_toplevel();
if (top->is_toplevel() && top != &_tearoff->tearoff_window()) {
Window* win = dynamic_cast<Window*> (top);
gtk_window_set_focus (win->gobj(), 0);
}
return false;
}
void
MonitorSection::update_processor_box ()
@ -1630,7 +1667,7 @@ MonitorSection::port_connected_or_disconnected (boost::weak_ptr<Port> wa, boost:
void
MonitorSection::load_bindings ()
{
bindings = Bindings::get_bindings (X_("monitor-section"), myactions);
bindings = Bindings::get_bindings (X_("monitor section"), myactions);
}
void

View File

@ -19,6 +19,7 @@
#include <gtkmm/box.h>
#include <gtkmm/table.h>
#include <gtkmm/eventbox.h>
#include "gtkmm2ext/bindable_button.h"
#include "gtkmm2ext/bindings.h"
@ -26,7 +27,6 @@
#include "ardour_button.h"
#include "ardour_knob.h"
#include "ardour_display.h"
#include "axis_view.h"
#include "level_meter.h"
#include "route_ui.h"
#include "monitor_selector.h"
@ -39,7 +39,7 @@ namespace Gtkmm2ext {
class TearOff;
}
class MonitorSection : public RouteUI
class MonitorSection : public RouteUI, public Gtk::EventBox
{
public:
MonitorSection (ARDOUR::Session*);
@ -182,4 +182,6 @@ class MonitorSection : public RouteUI
Gtkmm2ext::Bindings* bindings;
void load_bindings ();
bool enter_handler (GdkEventCrossing*);
bool leave_handler (GdkEventCrossing*);
};