13
0

more panner tweaks

git-svn-id: svn://localhost/ardour2/trunk@1244 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2006-12-22 01:48:20 +00:00
parent 9946e615ca
commit bfffdca239
3 changed files with 24 additions and 13 deletions

View File

@ -52,10 +52,10 @@ PannerBar::expose (GdkEventExpose* ev)
// center
points[0].x = (darea.get_width()/2 - (triangle_size/2)) - 1;
points[0].x = (darea.get_width()/2 - triangle_size);
points[0].y = 0;
points[1].x = (darea.get_width()/2 + (triangle_size/2)) - 1;
points[1].x = (darea.get_width()/2 + triangle_size) - 1;
points[1].y = 0;
points[2].x = darea.get_width()/2 - 1;
@ -65,7 +65,7 @@ PannerBar::expose (GdkEventExpose* ev)
// right
points[0].x = (darea.get_width() - triangle_size) - 1;
points[0].x = (darea.get_width() - triangle_size);
points[0].y = 0;
points[1].x = darea.get_width();
@ -99,6 +99,8 @@ PannerBar::button_press (GdkEventButton* ev)
bool
PannerBar::button_release (GdkEventButton* ev)
{
drop_grab();
if (ev->button == 1 && ev->type == GDK_BUTTON_RELEASE && ev->y < 10) {
if (ev->x < triangle_size) {
adjustment.set_value (adjustment.get_lower());

View File

@ -70,8 +70,8 @@ BarController::BarController (Gtk::Adjustment& adj,
darea.signal_expose_event().connect (mem_fun (*this, &BarController::expose));
darea.signal_motion_notify_event().connect (mem_fun (*this, &BarController::motion));
darea.signal_button_press_event().connect (mem_fun (*this, &BarController::button_press));
darea.signal_button_release_event().connect (mem_fun (*this, &BarController::button_release));
darea.signal_button_press_event().connect (mem_fun (*this, &BarController::button_press), false);
darea.signal_button_release_event().connect (mem_fun (*this, &BarController::button_release), false);
darea.signal_scroll_event().connect (mem_fun (*this, &BarController::scroll));
spinner.signal_activate().connect (mem_fun (*this, &BarController::entry_activated));
@ -82,6 +82,16 @@ BarController::BarController (Gtk::Adjustment& adj,
show_all ();
}
void
BarController::drop_grab ()
{
if (grabbed) {
grabbed = false;
darea.remove_modal_grab();
StopGesture ();
}
}
bool
BarController::button_press (GdkEventButton* ev)
{
@ -93,8 +103,7 @@ BarController::button_press (GdkEventButton* ev)
case 1:
if (ev->type == GDK_2BUTTON_PRESS) {
switch_on_release = true;
grabbed = false;
darea.remove_modal_grab();
drop_grab ();
} else {
switch_on_release = false;
darea.add_modal_grab();
@ -123,6 +132,8 @@ BarController::button_release (GdkEventButton* ev)
{
double fract;
drop_grab ();
switch (ev->button) {
case 1:
if (switch_on_release) {
@ -145,10 +156,6 @@ BarController::button_release (GdkEventButton* ev)
mouse_control (ev->x, ev->window, scale);
}
darea.remove_modal_grab();
grabbed = false;
StopGesture ();
grabbed = false;
break;
case 2:
@ -200,7 +207,7 @@ BarController::motion (GdkEventMotion* ev)
double scale;
if (!grabbed) {
return TRUE;
return true;
}
if ((ev->state & (GDK_SHIFT_MASK|GDK_CONTROL_MASK)) == GDK_SHIFT_MASK) {

View File

@ -20,7 +20,8 @@
#ifndef __gtkmm2ext_bar_controller_h__
#define __gtkmm2ext_bar_controller_h__
#include <gtkmm.h>
#include <gtkmm/frame.h>
#include <gtkmm/drawingarea.h>
#include <gtkmm2ext/binding_proxy.h>
namespace ARDOUR {
@ -90,6 +91,7 @@ class BarController : public Gtk::Frame
gint switch_to_spinner ();
void entry_activated ();
void drop_grab ();
};