avoid .h pollution in last commit
[ardour.git] / gtk2_ardour / editor_mouse.cc
index bb414471847e63473f61828ef21ebaa245a8c9fd..52105155417dd9fd90336da1f529f40fed3261af 100644 (file)
@@ -67,6 +67,7 @@
 #include "ardour/utils.h"
 #include "ardour/region_factory.h"
 #include "ardour/source_factory.h"
+#include "ardour/session.h"
 
 #include <bitset>
 
@@ -504,6 +505,8 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
 {
        if (_drag) {
                _drag->item()->ungrab (event->button.time);
+               delete _drag;
+               _drag = 0;
        }
 
        /* single mouse clicks on any of these item types operate
@@ -1242,7 +1245,6 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                                        atv->add_automation_event (item, event, where, event->button.y);
                                }
                                return true;
-
                                break;
 
                        default:
@@ -1293,7 +1295,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                        } else {
                                /* make sure we stop */
                                session->request_transport_speed (0.0);
-                       }
+                       }
                        break;
 
                default:
@@ -1912,7 +1914,7 @@ void
 Editor::show_verbose_time_cursor (nframes64_t frame, double offset, double xpos, double ypos)
 {
        char buf[128];
-       SMPTE::Time smpte;
+       Timecode::Time timecode;
        BBT_Time bbt;
        int hours, mins;
        nframes64_t frame_rate;
@@ -1936,9 +1938,9 @@ Editor::show_verbose_time_cursor (nframes64_t frame, double offset, double xpos,
                snprintf (buf, sizeof (buf), "%02" PRIu32 "|%02" PRIu32 "|%02" PRIu32, bbt.bars, bbt.beats, bbt.ticks);
                break;
 
-       case AudioClock::SMPTE:
-               session->smpte_time (frame, smpte);
-               snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%02" PRId32 ":%02" PRId32, smpte.hours, smpte.minutes, smpte.seconds, smpte.frames);
+       case AudioClock::Timecode:
+               session->timecode_time (frame, timecode);
+               snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%02" PRId32 ":%02" PRId32, timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
                break;
 
        case AudioClock::MinSec:
@@ -1959,8 +1961,7 @@ Editor::show_verbose_time_cursor (nframes64_t frame, double offset, double xpos,
 
        if (xpos >= 0 && ypos >=0) {
                set_verbose_canvas_cursor (buf, xpos + offset, ypos + offset);
-       }
-       else {
+       } else {
                set_verbose_canvas_cursor (buf, _drag->current_pointer_x() + offset - horizontal_adjustment.get_value(), _drag->current_pointer_y() + offset - vertical_adjustment.get_value() + canvas_timebars_vsize);
        }
        show_verbose_canvas_cursor ();
@@ -1970,7 +1971,7 @@ void
 Editor::show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double offset, double xpos, double ypos)
 {
        char buf[128];
-       SMPTE::Time smpte;
+       Timecode::Time timecode;
        BBT_Time sbbt;
        BBT_Time ebbt;
        int hours, mins;
@@ -2017,9 +2018,9 @@ Editor::show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double
                snprintf (buf, sizeof (buf), "%02" PRIu32 "|%02" PRIu32 "|%02" PRIu32, ebbt.bars, ebbt.beats, ebbt.ticks);
                break;
 
-       case AudioClock::SMPTE:
-               session->smpte_duration (end - start, smpte);
-               snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%02" PRId32 ":%02" PRId32, smpte.hours, smpte.minutes, smpte.seconds, smpte.frames);
+       case AudioClock::Timecode:
+               session->timecode_duration (end - start, timecode);
+               snprintf (buf, sizeof (buf), "%02" PRId32 ":%02" PRId32 ":%02" PRId32 ":%02" PRId32, timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
                break;
 
        case AudioClock::MinSec:
@@ -2389,14 +2390,14 @@ Editor::mouse_brush_insert_region (RegionView* rv, nframes64_t pos)
 {
        /* no brushing without a useful snap setting */
 
-       switch (snap_mode) {
+       switch (_snap_mode) {
        case SnapMagnetic:
                return; /* can't work because it allows region to be placed anywhere */
        default:
                break; /* OK */
        }
 
-       switch (snap_type) {
+       switch (_snap_type) {
        case SnapToMark:
                return;