Fix some erroneous resizing of port matrices.
[ardour.git] / gtk2_ardour / editor_rulers.cc
index 880b6812b56afaf859a849c1a2db581a22ffe10c..873e4919583a893962a43ce9bc46892d16eac154 100644 (file)
@@ -246,9 +246,7 @@ Editor::ruler_button_press (GdkEventButton* ev)
                }
 
                /* playhead cursor */
-               assert (_drag == 0);
-               _drag = new CursorDrag (this, &playhead_cursor->canvas_item, false);
-               _drag->start_grab (reinterpret_cast<GdkEvent *> (ev));
+               _drags->set (new CursorDrag (this, &playhead_cursor->canvas_item, false), reinterpret_cast<GdkEvent *> (ev));
                _dragging_playhead = true;
        }
 
@@ -265,10 +263,8 @@ Editor::ruler_button_release (GdkEventButton* ev)
        gint x,y;
        Gdk::ModifierType state;
 
-       if (_drag) {
-               _drag->end_grab (reinterpret_cast<GdkEvent*> (ev));
-               delete _drag;
-               _drag = 0;
+       if (_drags->active ()) {
+               _drags->end_grab (reinterpret_cast<GdkEvent*> (ev));
                _dragging_playhead = false;
        }
 
@@ -312,8 +308,8 @@ Editor::ruler_mouse_motion (GdkEventMotion* ev)
                return FALSE;
        }
 
-       if (_drag) {
-               _drag->motion_handler (reinterpret_cast<GdkEvent*> (ev), false);
+       if (_drags->active ()) {
+               _drags->motion_handler (reinterpret_cast<GdkEvent*> (ev), false);
        }
 
        return TRUE;
@@ -1157,21 +1153,56 @@ Editor::compute_bbt_ruler_scale (nframes64_t lower, nframes64_t upper)
        bbt_ruler_scale =  bbt_over;
 
        switch (_snap_type) {
-       case SnapToAThirdBeat:
+       case SnapToBeatDiv2:
+               bbt_beat_subdivision = 2;
+               break;
+       case SnapToBeatDiv3:
                 bbt_beat_subdivision = 3;
                break;
-       case SnapToAQuarterBeat:
+       case SnapToBeatDiv4:
                 bbt_beat_subdivision = 4;
                break;
-       case SnapToAEighthBeat:
+       case SnapToBeatDiv5:
+                bbt_beat_subdivision = 5;
+               bbt_accent_modulo = 2; // XXX YIKES
+               break;
+       case SnapToBeatDiv6:
+                bbt_beat_subdivision = 6;
+               bbt_accent_modulo = 2; // XXX YIKES
+               break;
+       case SnapToBeatDiv7:
+                bbt_beat_subdivision = 7;
+               bbt_accent_modulo = 2; // XXX YIKES
+               break;
+       case SnapToBeatDiv8:
                 bbt_beat_subdivision = 8;
                bbt_accent_modulo = 2;
                break;
-       case SnapToASixteenthBeat:
+       case SnapToBeatDiv10:
+                bbt_beat_subdivision = 10;
+               bbt_accent_modulo = 2; // XXX YIKES
+               break;
+       case SnapToBeatDiv12:
+                bbt_beat_subdivision = 12;
+               bbt_accent_modulo = 3;
+               break;
+       case SnapToBeatDiv14:
+                bbt_beat_subdivision = 14;
+               bbt_accent_modulo = 3; // XXX YIKES!
+               break;
+       case SnapToBeatDiv16:
                 bbt_beat_subdivision = 16;
                bbt_accent_modulo = 4;
                break;
-       case SnapToAThirtysecondBeat:
+       case SnapToBeatDiv24:
+                bbt_beat_subdivision = 24;
+               bbt_accent_modulo = 6;
+               break;
+       case SnapToBeatDiv28:
+                bbt_beat_subdivision = 28;
+               bbt_accent_modulo = 7;
+               break;
+       case SnapToBeatDiv32:
                 bbt_beat_subdivision = 32;
                bbt_accent_modulo = 8;
                break;