2010-11-30 15:22:43 -05:00
|
|
|
/*
|
|
|
|
Copyright (C) 2010 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_stereo_panner_h__
|
|
|
|
#define __gtk_ardour_stereo_panner_h__
|
|
|
|
|
|
|
|
#include "pbd/signals.h"
|
|
|
|
|
|
|
|
#include <gtkmm/drawingarea.h>
|
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
|
2010-12-30 15:17:44 -05:00
|
|
|
#include "gtkmm2ext/binding_proxy.h"
|
|
|
|
|
2010-11-30 15:22:43 -05:00
|
|
|
namespace PBD {
|
|
|
|
class Controllable;
|
|
|
|
}
|
|
|
|
|
|
|
|
class StereoPanner : public Gtk::DrawingArea
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
StereoPanner (boost::shared_ptr<PBD::Controllable> pos, boost::shared_ptr<PBD::Controllable> width);
|
|
|
|
~StereoPanner ();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool on_expose_event (GdkEventExpose*);
|
|
|
|
bool on_button_press_event (GdkEventButton*);
|
|
|
|
bool on_button_release_event (GdkEventButton*);
|
|
|
|
bool on_motion_notify_event (GdkEventMotion*);
|
2010-12-01 16:24:57 -05:00
|
|
|
bool on_scroll_event (GdkEventScroll*);
|
2010-12-01 18:29:44 -05:00
|
|
|
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);
|
2010-11-30 15:22:43 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
boost::shared_ptr<PBD::Controllable> position_control;
|
|
|
|
boost::shared_ptr<PBD::Controllable> width_control;
|
|
|
|
PBD::ScopedConnectionList connections;
|
|
|
|
bool dragging;
|
|
|
|
bool dragging_position;
|
2010-12-29 22:14:13 -05:00
|
|
|
bool dragging_left;
|
|
|
|
bool dragging_right;
|
2010-11-30 15:22:43 -05:00
|
|
|
int drag_start_x;
|
|
|
|
int last_drag_x;
|
2010-12-29 22:14:13 -05:00
|
|
|
double accumulated_delta;
|
2010-12-30 14:32:33 -05:00
|
|
|
bool detented;
|
2010-12-01 11:12:04 -05:00
|
|
|
|
2010-12-30 09:37:40 -05:00
|
|
|
Gtk::Window* drag_data_window;
|
|
|
|
Gtk::Label* drag_data_label;
|
|
|
|
|
2010-12-30 15:17:44 -05:00
|
|
|
BindingProxy position_binder;
|
|
|
|
BindingProxy width_binder;
|
|
|
|
|
2010-12-01 11:12:04 -05:00
|
|
|
void value_change ();
|
2010-12-30 09:37:40 -05:00
|
|
|
void set_drag_data ();
|
|
|
|
|
2010-12-02 10:51:42 -05:00
|
|
|
struct ColorScheme {
|
|
|
|
uint32_t outline;
|
|
|
|
uint32_t fill;
|
|
|
|
uint32_t text;
|
|
|
|
uint32_t background;
|
2011-01-07 12:36:01 -05:00
|
|
|
uint32_t rule;
|
2010-12-02 10:51:42 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
enum State {
|
|
|
|
Normal,
|
|
|
|
Mono,
|
|
|
|
Inverted
|
|
|
|
};
|
|
|
|
|
|
|
|
static ColorScheme colors[3];
|
|
|
|
static void set_colors ();
|
|
|
|
static bool have_colors;
|
2011-01-07 12:36:01 -05:00
|
|
|
void color_handler ();
|
2010-11-30 15:22:43 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __gtk_ardour_stereo_panner_h__ */
|