25 #include <gtkmm/window.h>
26 #include <pangomm/layout.h>
64 , position_control (_panner->pannable()->pan_azimuth_control)
67 , accumulated_delta (0)
69 , position_binder (position_control)
77 Pango::FontDescription font;
78 Pango::AttrFontDesc* font_attr;
79 font = Pango::FontDescription (
ARDOUR_UI::config()->get_SmallBoldMonospaceFont());
80 font_attr =
new Pango::AttrFontDesc (Pango::Attribute::create_attr_font_desc (font));
118 snprintf (buf,
sizeof (buf),
_(
"L:%3d R:%3d"),
119 (
int) rint (100.0 * (1.0 - pos)),
120 (
int) rint (100.0 * pos));
127 Glib::RefPtr<Gdk::Window> win (get_window());
128 Glib::RefPtr<Gdk::GC> gc (get_style()->get_base_gc (get_state()));
129 Cairo::RefPtr<Cairo::Context> context = get_window()->create_cairo_context();
133 uint32_t o,
f, t, b, pf, po;
136 height = get_height ();
138 const int step_down = rint(height / 3.5);
139 const int lr_box_size = height - 2 * step_down;
140 const int pos_box_size = (int)(rint(step_down * .8)) | 1;
141 const int top_step = step_down - pos_box_size;
165 context->rectangle (0, 0, width, height);
168 double usable_width = width - pos_box_size;
171 if (fmod (usable_width,2.0) == 0) {
174 const double half_lr_box = lr_box_size/2.0;
175 const double left = pos_box_size * .5 + half_lr_box;
176 const double right = width - pos_box_size * .5 - half_lr_box;
180 context->set_line_width (1.0);
181 context->move_to ((pos_box_size/2.0) + (usable_width/2.0), 0);
182 context->line_to ((pos_box_size/2.0) + (usable_width/2.0), height);
185 context->set_line_width (1.0);
189 left - half_lr_box + .5,
190 half_lr_box + step_down,
191 lr_box_size, lr_box_size, corner_radius);
193 context->fill_preserve ();
199 Glib::RefPtr<Pango::Layout> layout = Pango::Layout::create(get_pango_context());
202 layout->set_text (
S_(
"Panner|L"));
203 layout->get_pixel_size(tw, th);
204 context->move_to (rint(left - tw/2), rint(lr_box_size + step_down - th/2));
206 pango_cairo_show_layout (context->cobj(), layout->gobj());
210 right - half_lr_box - .5,
211 half_lr_box + step_down,
212 lr_box_size, lr_box_size, corner_radius);
214 context->fill_preserve ();
219 layout->set_text (
S_(
"Panner|R"));
220 layout->get_pixel_size(tw, th);
221 context->move_to (rint(right - tw/2), rint(lr_box_size + step_down - th/2));
223 pango_cairo_show_layout (context->cobj(), layout->gobj());
226 context->set_line_width (1.0);
230 context->move_to (left + half_lr_box, half_lr_box + step_down);
231 context->line_to (right - half_lr_box, half_lr_box + step_down);
234 context->move_to (left + half_lr_box, half_lr_box+step_down+lr_box_size);
235 context->line_to (right - half_lr_box, half_lr_box+step_down+lr_box_size);
238 context->move_to (left + half_lr_box, half_lr_box+step_down+lr_box_size);
239 context->line_to (left + half_lr_box, half_lr_box + step_down);
240 context->line_to ((pos_box_size/2.0) + (usable_width/2.0), half_lr_box+step_down+lr_box_size);
241 context->line_to (right - half_lr_box, half_lr_box + step_down);
242 context->line_to (right - half_lr_box, half_lr_box+step_down+lr_box_size);
243 context->close_path();
246 context->fill_preserve ();
252 double spos = (pos_box_size/2.0) + (usable_width * pos);
254 context->set_line_width (2.0);
255 context->move_to (spos + (pos_box_size/2.0), top_step);
256 context->rel_line_to (0.0, pos_box_size);
259 context->rel_line_to (0.0, -pos_box_size);
260 context->close_path ();
264 context->stroke_preserve ();
269 context->set_line_width (1.0);
271 context->line_to (spos, half_lr_box + step_down + lr_box_size - 1);
307 if (ev->button != 1) {
311 if (ev->type == GDK_2BUTTON_PRESS) {
312 int width = get_width();
314 if (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier)) {
320 if (ev->x <= width/3) {
323 }
else if (ev->x > 2*width/3) {
332 }
else if (ev->type == GDK_BUTTON_PRESS) {
334 if (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier)) {
354 if (ev->button != 1) {
367 if (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier)) {
379 double one_degree = 1.0/180.0;
387 if (Keyboard::modifier_state_contains (ev->state, Keyboard::PrimaryModifier)) {
390 step = one_degree * 5.0;
393 switch (ev->direction) {
395 case GDK_SCROLL_LEFT:
399 case GDK_SCROLL_DOWN:
400 case GDK_SCROLL_RIGHT:
452 double one_degree = 1.0/180.0;
460 if (Keyboard::modifier_state_contains (ev->state, Keyboard::PrimaryModifier)) {
463 step = one_degree * 5.0;
466 switch (ev->keyval) {
boost::shared_ptr< Pannable > pannable() const
ArdourCanvas::Color color(const std::string &, bool *failed=0) const
static bool equivalent(pan_t a, pan_t b)
bool on_button_release_event(GdkEventButton *)
static Pango::AttrList panner_font_attributes
sigc::signal< void > StopGesture
boost::shared_ptr< ARDOUR::PannerShell > _panner_shell
PBD::Signal0< void > PannableChanged
#define UINT_RGBA_A_FLT(x)
LIBGTKMM2EXT_API void rounded_left_half_rectangle(Cairo::RefPtr< Cairo::Context >, double x, double y, double w, double h, double r=10)
std::string panner_gui_uri() const
#define UINT_RGBA_G_FLT(x)
void set_controllable(boost::shared_ptr< PBD::Controllable >)
#define UINT_RGBA_B_FLT(x)
BindingProxy position_binder
bool on_motion_notify_event(GdkEventMotion *)
PBD::ScopedConnectionList panshell_connections
boost::shared_ptr< PBD::Controllable > position_control
bool on_button_press_event(GdkEventButton *)
virtual double get_value(void) const =0
bool on_scroll_event(GdkEventScroll *)
bool button_press_handler(GdkEventButton *)
LIBGTKMM2EXT_API void rounded_right_half_rectangle(Cairo::RefPtr< Cairo::Context >, double x, double y, double w, double h, double r=10)
sigc::signal< void > StartGesture
bool on_expose_event(GdkEventExpose *)
static ColorScheme colors
PBD::ScopedConnectionList panvalue_connections
virtual void set_value(double)=0
PBD::Signal0< void > Changed
ArdourCanvas::Color color_mod(std::string const &color, std::string const &modifier) const
static UIConfiguration * config()
PBD::Signal0< void > Changed
sigc::signal< void > ColorsChanged
MonoPanner(boost::shared_ptr< ARDOUR::PannerShell >)
bool on_button_release_event(GdkEventButton *)
boost::shared_ptr< ARDOUR::Panner > _panner
PannerPersistentTooltip _tooltip
bool on_button_press_event(GdkEventButton *)
bool on_key_press_event(GdkEventKey *)
#define UINT_RGBA_R_FLT(x)