13
0

locate when clicking on start/end fields in time info box

git-svn-id: svn://localhost/ardour2/branches/3.0@9683 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-06-07 18:20:22 +00:00
parent f6e67fa3dd
commit 7e2b86dc83
3 changed files with 48 additions and 29 deletions

View File

@ -889,21 +889,23 @@ AudioClock::button_press (GdkEventButton *ev, CairoCell* cell)
{ {
switch (ev->button) { switch (ev->button) {
case 1: case 1:
if (cell) { if (editable) {
editing_field = (Field) cell->id (); if (cell) {
display->start_editing (cell); editing_field = (Field) cell->id ();
display->start_editing (cell);
}
Keyboard::magic_widget_grab_focus ();
/* make absolutely sure that the pointer is grabbed */
gdk_pointer_grab(ev->window,false ,
GdkEventMask( Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK |Gdk::BUTTON_RELEASE_MASK),
NULL,NULL,ev->time);
dragging = true;
drag_accum = 0;
drag_start_y = ev->y;
drag_y = ev->y;
} }
Keyboard::magic_widget_grab_focus ();
/* make absolutely sure that the pointer is grabbed */
gdk_pointer_grab(ev->window,false ,
GdkEventMask( Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK |Gdk::BUTTON_RELEASE_MASK),
NULL,NULL,ev->time);
dragging = true;
drag_accum = 0;
drag_start_y = ev->y;
drag_y = ev->y;
break; break;
default: default:
@ -917,23 +919,17 @@ AudioClock::button_press (GdkEventButton *ev, CairoCell* cell)
bool bool
AudioClock::button_release (GdkEventButton *ev, CairoCell* cell) AudioClock::button_release (GdkEventButton *ev, CairoCell* cell)
{ {
if (dragging) { if (editable) {
gdk_pointer_ungrab (GDK_CURRENT_TIME); if (dragging) {
dragging = false; gdk_pointer_ungrab (GDK_CURRENT_TIME);
if (ev->y > drag_start_y+1 || ev->y < drag_start_y-1 || Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)){ dragging = false;
// we actually dragged so return without setting editing focus, or we shift clicked if (ev->y > drag_start_y+1 || ev->y < drag_start_y-1 || Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)){
return true; // we actually dragged so return without setting editing focus, or we shift clicked
return true;
}
} }
} }
if (!editable) {
if (ops_menu == 0) {
build_ops_menu ();
}
ops_menu->popup (1, ev->time);
return true;
}
if (Keyboard::is_context_menu_event (ev)) { if (Keyboard::is_context_menu_event (ev)) {
if (ops_menu == 0) { if (ops_menu == 0) {
build_ops_menu (); build_ops_menu ();
@ -942,7 +938,7 @@ AudioClock::button_release (GdkEventButton *ev, CairoCell* cell)
return true; return true;
} }
return true; return false;
} }
bool bool

View File

@ -125,6 +125,12 @@ TimeInfoBox::TimeInfoBox ()
punch_start->mode_changed.connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::sync_punch_mode), punch_start)); punch_start->mode_changed.connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::sync_punch_mode), punch_start));
punch_end->mode_changed.connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::sync_punch_mode), punch_end)); punch_end->mode_changed.connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::sync_punch_mode), punch_end));
selection_start->signal_button_release_event().connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::clock_button_release_event), selection_start), true);
selection_end->signal_button_release_event().connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::clock_button_release_event), selection_end), true);
punch_start->signal_button_release_event().connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::clock_button_release_event), punch_start), true);
punch_end->signal_button_release_event().connect (sigc::bind (sigc::mem_fun (*this, &TimeInfoBox::clock_button_release_event), punch_end), true);
Editor::instance().get_selection().TimeChanged.connect (sigc::mem_fun (*this, &TimeInfoBox::selection_changed)); Editor::instance().get_selection().TimeChanged.connect (sigc::mem_fun (*this, &TimeInfoBox::selection_changed));
} }
@ -138,6 +144,21 @@ TimeInfoBox::~TimeInfoBox ()
delete punch_end; delete punch_end;
} }
bool
TimeInfoBox::clock_button_release_event (GdkEventButton* ev, AudioClock* src)
{
if (!_session) {
return false;
}
if (ev->button == 1) {
_session->request_locate (src->current_time ());
return true;
}
return false;
}
void void
TimeInfoBox::sync_selection_mode (AudioClock* src) TimeInfoBox::sync_selection_mode (AudioClock* src)
{ {

View File

@ -72,6 +72,8 @@ class TimeInfoBox : public Gtk::Table, public ARDOUR::SessionHandlePtr
void sync_selection_mode (AudioClock*); void sync_selection_mode (AudioClock*);
void sync_punch_mode (AudioClock*); void sync_punch_mode (AudioClock*);
bool clock_button_release_event (GdkEventButton* ev, AudioClock* src);
}; };