mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
Move some bits from MonoPanner and StereoPanner into a
common base class. git-svn-id: svn://localhost/ardour2/branches/3.0@11071 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
0dbc0429a8
commit
6e79521e8b
7 changed files with 187 additions and 168 deletions
|
|
@ -57,15 +57,13 @@ MonoPanner::ColorScheme MonoPanner::colors;
|
||||||
bool MonoPanner::have_colors = false;
|
bool MonoPanner::have_colors = false;
|
||||||
|
|
||||||
MonoPanner::MonoPanner (boost::shared_ptr<ARDOUR::Panner> panner)
|
MonoPanner::MonoPanner (boost::shared_ptr<ARDOUR::Panner> panner)
|
||||||
: _panner (panner)
|
: PannerInterface (panner)
|
||||||
, position_control (_panner->pannable()->pan_azimuth_control)
|
, position_control (_panner->pannable()->pan_azimuth_control)
|
||||||
, dragging (false)
|
, dragging (false)
|
||||||
, drag_start_x (0)
|
, drag_start_x (0)
|
||||||
, last_drag_x (0)
|
, last_drag_x (0)
|
||||||
, accumulated_delta (0)
|
, accumulated_delta (0)
|
||||||
, detented (false)
|
, detented (false)
|
||||||
, drag_data_window (0)
|
|
||||||
, drag_data_label (0)
|
|
||||||
, position_binder (position_control)
|
, position_binder (position_control)
|
||||||
{
|
{
|
||||||
if (!have_colors) {
|
if (!have_colors) {
|
||||||
|
|
@ -75,26 +73,18 @@ MonoPanner::MonoPanner (boost::shared_ptr<ARDOUR::Panner> panner)
|
||||||
|
|
||||||
position_control->Changed.connect (connections, invalidator(*this), boost::bind (&MonoPanner::value_change, this), gui_context());
|
position_control->Changed.connect (connections, invalidator(*this), boost::bind (&MonoPanner::value_change, this), gui_context());
|
||||||
|
|
||||||
set_flags (Gtk::CAN_FOCUS);
|
ColorsChanged.connect (sigc::mem_fun (*this, &MonoPanner::color_handler));
|
||||||
|
|
||||||
add_events (Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK|
|
|
||||||
Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|
|
|
||||||
Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|
|
|
||||||
Gdk::SCROLL_MASK|
|
|
||||||
Gdk::POINTER_MOTION_MASK);
|
|
||||||
|
|
||||||
ColorsChanged.connect (sigc::mem_fun (*this, &MonoPanner::color_handler));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MonoPanner::~MonoPanner ()
|
MonoPanner::~MonoPanner ()
|
||||||
{
|
{
|
||||||
delete drag_data_window;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MonoPanner::set_drag_data ()
|
MonoPanner::set_drag_data ()
|
||||||
{
|
{
|
||||||
if (!drag_data_label) {
|
if (!_drag_data_label) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -112,14 +102,7 @@ MonoPanner::set_drag_data ()
|
||||||
snprintf (buf, sizeof (buf), "L:%3d R:%3d",
|
snprintf (buf, sizeof (buf), "L:%3d R:%3d",
|
||||||
(int) rint (100.0 * (1.0 - pos)),
|
(int) rint (100.0 * (1.0 - pos)),
|
||||||
(int) rint (100.0 * pos));
|
(int) rint (100.0 * pos));
|
||||||
drag_data_label->set_markup (buf);
|
_drag_data_label->set_markup (buf);
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
MonoPanner::value_change ()
|
|
||||||
{
|
|
||||||
set_drag_data ();
|
|
||||||
queue_draw ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
@ -330,8 +313,8 @@ MonoPanner::on_button_release_event (GdkEventButton* ev)
|
||||||
accumulated_delta = 0;
|
accumulated_delta = 0;
|
||||||
detented = false;
|
detented = false;
|
||||||
|
|
||||||
if (drag_data_window) {
|
if (_drag_data_window) {
|
||||||
drag_data_window->hide ();
|
_drag_data_window->hide ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier)) {
|
if (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier)) {
|
||||||
|
|
@ -379,32 +362,7 @@ MonoPanner::on_motion_notify_event (GdkEventMotion* ev)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!drag_data_window) {
|
show_drag_data_window ();
|
||||||
drag_data_window = new Window (WINDOW_POPUP);
|
|
||||||
drag_data_window->set_name (X_("ContrastingPopup"));
|
|
||||||
drag_data_window->set_position (WIN_POS_MOUSE);
|
|
||||||
drag_data_window->set_decorated (false);
|
|
||||||
|
|
||||||
drag_data_label = manage (new Label);
|
|
||||||
drag_data_label->set_use_markup (true);
|
|
||||||
|
|
||||||
drag_data_window->set_border_width (6);
|
|
||||||
drag_data_window->add (*drag_data_label);
|
|
||||||
drag_data_label->show ();
|
|
||||||
|
|
||||||
Window* toplevel = dynamic_cast<Window*> (get_toplevel());
|
|
||||||
if (toplevel) {
|
|
||||||
drag_data_window->set_transient_for (*toplevel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!drag_data_window->is_visible ()) {
|
|
||||||
/* move the window a little away from the mouse */
|
|
||||||
int rx, ry;
|
|
||||||
get_window()->get_origin (rx, ry);
|
|
||||||
drag_data_window->move (rx, ry+get_height());
|
|
||||||
drag_data_window->present ();
|
|
||||||
}
|
|
||||||
|
|
||||||
int w = get_width();
|
int w = get_width();
|
||||||
double delta = (ev->x - last_drag_x) / (double) w;
|
double delta = (ev->x - last_drag_x) / (double) w;
|
||||||
|
|
@ -469,27 +427,6 @@ MonoPanner::on_key_press_event (GdkEventKey* ev)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
MonoPanner::on_key_release_event (GdkEventKey*)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
MonoPanner::on_enter_notify_event (GdkEventCrossing*)
|
|
||||||
{
|
|
||||||
grab_focus ();
|
|
||||||
Keyboard::magic_widget_grab_focus ();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
MonoPanner::on_leave_notify_event (GdkEventCrossing*)
|
|
||||||
{
|
|
||||||
Keyboard::magic_widget_drop_focus ();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MonoPanner::set_colors ()
|
MonoPanner::set_colors ()
|
||||||
{
|
{
|
||||||
|
|
@ -504,6 +441,7 @@ MonoPanner::set_colors ()
|
||||||
void
|
void
|
||||||
MonoPanner::color_handler ()
|
MonoPanner::color_handler ()
|
||||||
{
|
{
|
||||||
set_colors ();
|
set_colors ();
|
||||||
queue_draw ();
|
queue_draw ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,16 +22,17 @@
|
||||||
|
|
||||||
#include "pbd/signals.h"
|
#include "pbd/signals.h"
|
||||||
|
|
||||||
#include <gtkmm/drawingarea.h>
|
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
#include "gtkmm2ext/binding_proxy.h"
|
#include "gtkmm2ext/binding_proxy.h"
|
||||||
|
|
||||||
|
#include "panner_interface.h"
|
||||||
|
|
||||||
namespace PBD {
|
namespace PBD {
|
||||||
class Controllable;
|
class Controllable;
|
||||||
}
|
}
|
||||||
|
|
||||||
class MonoPanner : public Gtk::DrawingArea
|
class MonoPanner : public PannerInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MonoPanner (boost::shared_ptr<ARDOUR::Panner>);
|
MonoPanner (boost::shared_ptr<ARDOUR::Panner>);
|
||||||
|
|
@ -49,12 +50,8 @@ class MonoPanner : public Gtk::DrawingArea
|
||||||
bool on_motion_notify_event (GdkEventMotion*);
|
bool on_motion_notify_event (GdkEventMotion*);
|
||||||
bool on_scroll_event (GdkEventScroll*);
|
bool on_scroll_event (GdkEventScroll*);
|
||||||
bool on_key_press_event (GdkEventKey*);
|
bool on_key_press_event (GdkEventKey*);
|
||||||
bool on_key_release_event (GdkEventKey*);
|
|
||||||
bool on_enter_notify_event (GdkEventCrossing* ev);
|
|
||||||
bool on_leave_notify_event (GdkEventCrossing* ev);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
boost::shared_ptr<ARDOUR::Panner> _panner;
|
|
||||||
boost::shared_ptr<PBD::Controllable> position_control;
|
boost::shared_ptr<PBD::Controllable> position_control;
|
||||||
PBD::ScopedConnectionList connections;
|
PBD::ScopedConnectionList connections;
|
||||||
bool dragging;
|
bool dragging;
|
||||||
|
|
@ -63,12 +60,8 @@ class MonoPanner : public Gtk::DrawingArea
|
||||||
double accumulated_delta;
|
double accumulated_delta;
|
||||||
bool detented;
|
bool detented;
|
||||||
|
|
||||||
Gtk::Window* drag_data_window;
|
|
||||||
Gtk::Label* drag_data_label;
|
|
||||||
|
|
||||||
BindingProxy position_binder;
|
BindingProxy position_binder;
|
||||||
|
|
||||||
void value_change ();
|
|
||||||
void set_drag_data ();
|
void set_drag_data ();
|
||||||
|
|
||||||
struct ColorScheme {
|
struct ColorScheme {
|
||||||
|
|
@ -83,7 +76,7 @@ class MonoPanner : public Gtk::DrawingArea
|
||||||
static ColorScheme colors;
|
static ColorScheme colors;
|
||||||
static void set_colors ();
|
static void set_colors ();
|
||||||
static bool have_colors;
|
static bool have_colors;
|
||||||
void color_handler ();
|
void color_handler ();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __gtk_ardour_mono_panner_h__ */
|
#endif /* __gtk_ardour_mono_panner_h__ */
|
||||||
|
|
|
||||||
109
gtk2_ardour/panner_interface.cc
Normal file
109
gtk2_ardour/panner_interface.cc
Normal file
|
|
@ -0,0 +1,109 @@
|
||||||
|
/*
|
||||||
|
Copyright (C) 2011 Paul Davis
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <gtkmm.h>
|
||||||
|
#include "gtkmm2ext/keyboard.h"
|
||||||
|
#include "panner_interface.h"
|
||||||
|
#include "global_signals.h"
|
||||||
|
|
||||||
|
#include "i18n.h"
|
||||||
|
|
||||||
|
using namespace Gtk;
|
||||||
|
using namespace ARDOUR;
|
||||||
|
using namespace Gtkmm2ext;
|
||||||
|
|
||||||
|
PannerInterface::PannerInterface (boost::shared_ptr<Panner> p)
|
||||||
|
: _panner (p)
|
||||||
|
, _drag_data_window (0)
|
||||||
|
, _drag_data_label (0)
|
||||||
|
{
|
||||||
|
set_flags (Gtk::CAN_FOCUS);
|
||||||
|
|
||||||
|
add_events (Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK|
|
||||||
|
Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|
|
||||||
|
Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|
|
||||||
|
Gdk::SCROLL_MASK|
|
||||||
|
Gdk::POINTER_MOTION_MASK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
PannerInterface::~PannerInterface ()
|
||||||
|
{
|
||||||
|
delete _drag_data_window;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PannerInterface::show_drag_data_window ()
|
||||||
|
{
|
||||||
|
if (!_drag_data_window) {
|
||||||
|
_drag_data_window = new Window (WINDOW_POPUP);
|
||||||
|
_drag_data_window->set_name (X_("ContrastingPopup"));
|
||||||
|
_drag_data_window->set_position (WIN_POS_MOUSE);
|
||||||
|
_drag_data_window->set_decorated (false);
|
||||||
|
|
||||||
|
_drag_data_label = manage (new Label);
|
||||||
|
_drag_data_label->set_use_markup (true);
|
||||||
|
|
||||||
|
_drag_data_window->set_border_width (6);
|
||||||
|
_drag_data_window->add (*_drag_data_label);
|
||||||
|
_drag_data_label->show ();
|
||||||
|
|
||||||
|
Window* toplevel = dynamic_cast<Window*> (get_toplevel());
|
||||||
|
if (toplevel) {
|
||||||
|
_drag_data_window->set_transient_for (*toplevel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_drag_data_window->is_visible ()) {
|
||||||
|
/* move the window a little away from the mouse */
|
||||||
|
int rx, ry;
|
||||||
|
get_window()->get_origin (rx, ry);
|
||||||
|
_drag_data_window->move (rx, ry + get_height());
|
||||||
|
_drag_data_window->present ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
PannerInterface::on_enter_notify_event (GdkEventCrossing *)
|
||||||
|
{
|
||||||
|
grab_focus ();
|
||||||
|
Keyboard::magic_widget_grab_focus ();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
PannerInterface::on_leave_notify_event (GdkEventCrossing *)
|
||||||
|
{
|
||||||
|
Keyboard::magic_widget_drop_focus ();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
PannerInterface::on_key_release_event (GdkEventKey*)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PannerInterface::value_change ()
|
||||||
|
{
|
||||||
|
set_drag_data ();
|
||||||
|
queue_draw ();
|
||||||
|
}
|
||||||
|
|
||||||
52
gtk2_ardour/panner_interface.h
Normal file
52
gtk2_ardour/panner_interface.h
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
Copyright (C) 2011 Paul Davis
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __gtk_ardour_panner_interface_h__
|
||||||
|
#define __gtk_ardour_panner_interface_h__
|
||||||
|
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <gtkmm/drawingarea.h>
|
||||||
|
#include <gtkmm/label.h>
|
||||||
|
|
||||||
|
namespace ARDOUR {
|
||||||
|
class Panner;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Parent class for some panner UI classes that contains some common code */
|
||||||
|
class PannerInterface : public Gtk::DrawingArea
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PannerInterface (boost::shared_ptr<ARDOUR::Panner>);
|
||||||
|
virtual ~PannerInterface ();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void set_drag_data () = 0;
|
||||||
|
|
||||||
|
void show_drag_data_window ();
|
||||||
|
void value_change ();
|
||||||
|
bool on_enter_notify_event (GdkEventCrossing *);
|
||||||
|
bool on_leave_notify_event (GdkEventCrossing *);
|
||||||
|
bool on_key_release_event (GdkEventKey *);
|
||||||
|
|
||||||
|
boost::shared_ptr<ARDOUR::Panner> _panner;
|
||||||
|
Gtk::Window* _drag_data_window;
|
||||||
|
Gtk::Label* _drag_data_label;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -57,7 +57,7 @@ bool StereoPanner::have_colors = false;
|
||||||
using namespace ARDOUR;
|
using namespace ARDOUR;
|
||||||
|
|
||||||
StereoPanner::StereoPanner (boost::shared_ptr<Panner> panner)
|
StereoPanner::StereoPanner (boost::shared_ptr<Panner> panner)
|
||||||
: _panner (panner)
|
: PannerInterface (panner)
|
||||||
, position_control (_panner->pannable()->pan_azimuth_control)
|
, position_control (_panner->pannable()->pan_azimuth_control)
|
||||||
, width_control (_panner->pannable()->pan_width_control)
|
, width_control (_panner->pannable()->pan_width_control)
|
||||||
, dragging (false)
|
, dragging (false)
|
||||||
|
|
@ -68,8 +68,6 @@ StereoPanner::StereoPanner (boost::shared_ptr<Panner> panner)
|
||||||
, last_drag_x (0)
|
, last_drag_x (0)
|
||||||
, accumulated_delta (0)
|
, accumulated_delta (0)
|
||||||
, detented (false)
|
, detented (false)
|
||||||
, drag_data_window (0)
|
|
||||||
, drag_data_label (0)
|
|
||||||
, position_binder (position_control)
|
, position_binder (position_control)
|
||||||
, width_binder (width_control)
|
, width_binder (width_control)
|
||||||
{
|
{
|
||||||
|
|
@ -81,26 +79,18 @@ StereoPanner::StereoPanner (boost::shared_ptr<Panner> panner)
|
||||||
position_control->Changed.connect (connections, invalidator(*this), boost::bind (&StereoPanner::value_change, this), gui_context());
|
position_control->Changed.connect (connections, invalidator(*this), boost::bind (&StereoPanner::value_change, this), gui_context());
|
||||||
width_control->Changed.connect (connections, invalidator(*this), boost::bind (&StereoPanner::value_change, this), gui_context());
|
width_control->Changed.connect (connections, invalidator(*this), boost::bind (&StereoPanner::value_change, this), gui_context());
|
||||||
|
|
||||||
set_flags (Gtk::CAN_FOCUS);
|
|
||||||
|
|
||||||
add_events (Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK|
|
|
||||||
Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|
|
|
||||||
Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|
|
|
||||||
Gdk::SCROLL_MASK|
|
|
||||||
Gdk::POINTER_MOTION_MASK);
|
|
||||||
|
|
||||||
ColorsChanged.connect (sigc::mem_fun (*this, &StereoPanner::color_handler));
|
ColorsChanged.connect (sigc::mem_fun (*this, &StereoPanner::color_handler));
|
||||||
}
|
}
|
||||||
|
|
||||||
StereoPanner::~StereoPanner ()
|
StereoPanner::~StereoPanner ()
|
||||||
{
|
{
|
||||||
delete drag_data_window;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StereoPanner::set_drag_data ()
|
StereoPanner::set_drag_data ()
|
||||||
{
|
{
|
||||||
if (!drag_data_label) {
|
if (!_drag_data_label) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -118,14 +108,7 @@ StereoPanner::set_drag_data ()
|
||||||
snprintf (buf, sizeof (buf), "L:%3d R:%3d Width:%d%%", (int) rint (100.0 * (1.0 - pos)),
|
snprintf (buf, sizeof (buf), "L:%3d R:%3d Width:%d%%", (int) rint (100.0 * (1.0 - pos)),
|
||||||
(int) rint (100.0 * pos),
|
(int) rint (100.0 * pos),
|
||||||
(int) floor (100.0 * width_control->get_value()));
|
(int) floor (100.0 * width_control->get_value()));
|
||||||
drag_data_label->set_markup (buf);
|
_drag_data_label->set_markup (buf);
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
StereoPanner::value_change ()
|
|
||||||
{
|
|
||||||
set_drag_data ();
|
|
||||||
queue_draw ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
@ -427,8 +410,8 @@ StereoPanner::on_button_release_event (GdkEventButton* ev)
|
||||||
accumulated_delta = 0;
|
accumulated_delta = 0;
|
||||||
detented = false;
|
detented = false;
|
||||||
|
|
||||||
if (drag_data_window) {
|
if (_drag_data_window) {
|
||||||
drag_data_window->hide ();
|
_drag_data_window->hide ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier)) {
|
if (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier)) {
|
||||||
|
|
@ -487,32 +470,7 @@ StereoPanner::on_motion_notify_event (GdkEventMotion* ev)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!drag_data_window) {
|
show_drag_data_window ();
|
||||||
drag_data_window = new Window (WINDOW_POPUP);
|
|
||||||
drag_data_window->set_name (X_("ContrastingPopup"));
|
|
||||||
drag_data_window->set_position (WIN_POS_MOUSE);
|
|
||||||
drag_data_window->set_decorated (false);
|
|
||||||
|
|
||||||
drag_data_label = manage (new Label);
|
|
||||||
drag_data_label->set_use_markup (true);
|
|
||||||
|
|
||||||
drag_data_window->set_border_width (6);
|
|
||||||
drag_data_window->add (*drag_data_label);
|
|
||||||
drag_data_label->show ();
|
|
||||||
|
|
||||||
Window* toplevel = dynamic_cast<Window*> (get_toplevel());
|
|
||||||
if (toplevel) {
|
|
||||||
drag_data_window->set_transient_for (*toplevel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!drag_data_window->is_visible ()) {
|
|
||||||
/* move the popup window vertically down from the panner display */
|
|
||||||
int rx, ry;
|
|
||||||
get_window()->get_origin (rx, ry);
|
|
||||||
drag_data_window->move (rx, ry+get_height());
|
|
||||||
drag_data_window->present ();
|
|
||||||
}
|
|
||||||
|
|
||||||
int w = get_width();
|
int w = get_width();
|
||||||
double delta = (ev->x - last_drag_x) / (double) w;
|
double delta = (ev->x - last_drag_x) / (double) w;
|
||||||
|
|
@ -616,27 +574,6 @@ StereoPanner::on_key_press_event (GdkEventKey* ev)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
StereoPanner::on_key_release_event (GdkEventKey*)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
StereoPanner::on_enter_notify_event (GdkEventCrossing*)
|
|
||||||
{
|
|
||||||
grab_focus ();
|
|
||||||
Keyboard::magic_widget_grab_focus ();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
StereoPanner::on_leave_notify_event (GdkEventCrossing*)
|
|
||||||
{
|
|
||||||
Keyboard::magic_widget_drop_focus ();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
StereoPanner::set_colors ()
|
StereoPanner::set_colors ()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,8 @@
|
||||||
#define __gtk_ardour_stereo_panner_h__
|
#define __gtk_ardour_stereo_panner_h__
|
||||||
|
|
||||||
#include "pbd/signals.h"
|
#include "pbd/signals.h"
|
||||||
|
|
||||||
#include <gtkmm/drawingarea.h>
|
|
||||||
#include <boost/shared_ptr.hpp>
|
|
||||||
|
|
||||||
#include "gtkmm2ext/binding_proxy.h"
|
#include "gtkmm2ext/binding_proxy.h"
|
||||||
|
#include "panner_interface.h"
|
||||||
|
|
||||||
namespace PBD {
|
namespace PBD {
|
||||||
class Controllable;
|
class Controllable;
|
||||||
|
|
@ -35,7 +32,7 @@ namespace ARDOUR {
|
||||||
class Panner;
|
class Panner;
|
||||||
}
|
}
|
||||||
|
|
||||||
class StereoPanner : public Gtk::DrawingArea
|
class StereoPanner : public PannerInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StereoPanner (boost::shared_ptr<ARDOUR::Panner>);
|
StereoPanner (boost::shared_ptr<ARDOUR::Panner>);
|
||||||
|
|
@ -53,12 +50,8 @@ class StereoPanner : public Gtk::DrawingArea
|
||||||
bool on_motion_notify_event (GdkEventMotion*);
|
bool on_motion_notify_event (GdkEventMotion*);
|
||||||
bool on_scroll_event (GdkEventScroll*);
|
bool on_scroll_event (GdkEventScroll*);
|
||||||
bool on_key_press_event (GdkEventKey*);
|
bool on_key_press_event (GdkEventKey*);
|
||||||
bool on_key_release_event (GdkEventKey*);
|
|
||||||
bool on_enter_notify_event (GdkEventCrossing* ev);
|
|
||||||
bool on_leave_notify_event (GdkEventCrossing* ev);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
boost::shared_ptr<ARDOUR::Panner> _panner;
|
|
||||||
boost::shared_ptr<PBD::Controllable> position_control;
|
boost::shared_ptr<PBD::Controllable> position_control;
|
||||||
boost::shared_ptr<PBD::Controllable> width_control;
|
boost::shared_ptr<PBD::Controllable> width_control;
|
||||||
PBD::ScopedConnectionList connections;
|
PBD::ScopedConnectionList connections;
|
||||||
|
|
@ -71,13 +64,9 @@ class StereoPanner : public Gtk::DrawingArea
|
||||||
double accumulated_delta;
|
double accumulated_delta;
|
||||||
bool detented;
|
bool detented;
|
||||||
|
|
||||||
Gtk::Window* drag_data_window;
|
|
||||||
Gtk::Label* drag_data_label;
|
|
||||||
|
|
||||||
BindingProxy position_binder;
|
BindingProxy position_binder;
|
||||||
BindingProxy width_binder;
|
BindingProxy width_binder;
|
||||||
|
|
||||||
void value_change ();
|
|
||||||
void set_drag_data ();
|
void set_drag_data ();
|
||||||
|
|
||||||
struct ColorScheme {
|
struct ColorScheme {
|
||||||
|
|
@ -97,7 +86,7 @@ class StereoPanner : public Gtk::DrawingArea
|
||||||
static ColorScheme colors[3];
|
static ColorScheme colors[3];
|
||||||
static void set_colors ();
|
static void set_colors ();
|
||||||
static bool have_colors;
|
static bool have_colors;
|
||||||
void color_handler ();
|
void color_handler ();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __gtk_ardour_stereo_panner_h__ */
|
#endif /* __gtk_ardour_stereo_panner_h__ */
|
||||||
|
|
|
||||||
|
|
@ -164,6 +164,7 @@ gtk2_ardour_sources = [
|
||||||
'option_editor.cc',
|
'option_editor.cc',
|
||||||
'opts.cc',
|
'opts.cc',
|
||||||
'panner2d.cc',
|
'panner2d.cc',
|
||||||
|
'panner_interface.cc',
|
||||||
'panner_ui.cc',
|
'panner_ui.cc',
|
||||||
'piano_roll_header.cc',
|
'piano_roll_header.cc',
|
||||||
'playlist_selector.cc',
|
'playlist_selector.cc',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue