fix background of ArdourButtons with no Body
[ardour.git] / gtk2_ardour / editor_drag.cc
index bebc501ce752833aafb43741c5261d59f3480820..d2fd96e685f14943779812d992c706b2c228d091 100644 (file)
@@ -527,10 +527,7 @@ Drag::add_midi_region (MidiTimeAxisView* view, bool commit)
 
 struct PresentationInfoTimeAxisViewSorter {
        bool operator() (TimeAxisView* a, TimeAxisView* b) {
-               RouteTimeAxisView* ra = dynamic_cast<RouteTimeAxisView*> (a);
-               RouteTimeAxisView* rb = dynamic_cast<RouteTimeAxisView*> (b);
-               assert (ra && rb);
-               return ra->route()->presentation_info () < rb->route()->presentation_info();
+               return a->presentation_info().order() < b->presentation_info().order();
        }
 };
 
@@ -846,7 +843,7 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move)
 
                RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (tv);
                if (!rtv || !rtv->is_track()) {
-                       /* ignore busses early on. we can't move any regions on them */
+                       /* ignore non-tracks early on. we can't move any regions on them */
                } else if (_last_pointer_time_axis_view < 0) {
                        /* Was in the drop-zone, now over a track.
                         * Hence it must be an upward move (from the bottom)
@@ -3276,7 +3273,7 @@ TempoMarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
 void
 TempoMarkerDrag::setup_pointer_frame_offset ()
 {
-       _pointer_frame_offset = raw_grab_frame() - _marker->tempo().frame();
+       _pointer_frame_offset = raw_grab_frame() - _real_section->frame();
 }
 
 void
@@ -3338,42 +3335,16 @@ TempoMarkerDrag::motion (GdkEvent* event, bool first_move)
                show_verbose_cursor_text (strs.str());
 
        } else if (_movable && !_real_section->locked_to_meter()) {
-               TempoMap& map (_editor->session()->tempo_map());
-               const bool was_music = _real_section->position_lock_style() == MusicTime;
-
                const framepos_t pf = adjusted_current_frame (event);
+               TempoMap& map (_editor->session()->tempo_map());
 
-               if (!_editor->snap_musical()) {
-
-                       if (was_music) {
-                               _real_section->set_position_lock_style (AudioTime);
-                       }
-
-                       map.gui_move_tempo (_real_section, pf);
-
-                       if (was_music) {
-                               _real_section->set_position_lock_style (MusicTime);
-                       }
-
-               } else {
-
-                       if (!was_music) {
-                               _real_section->set_position_lock_style (MusicTime);
-                       }
-
-                       map.gui_move_tempo (_real_section, pf);
+               /* snap to beat is 1, snap to bar is -1 (sorry) */
+               int sub_num = _editor->get_grid_music_divisions (event->button.state);
 
-                       if (!was_music) {
-                               _real_section->set_position_lock_style (AudioTime);
-                       }
-               }
+               map.gui_move_tempo (_real_section, pf, sub_num);
 
                show_verbose_cursor_time (_real_section->frame());
        }
-
-       /* this has moved the bar lines themselves, so recalibrate the offset */
-       setup_pointer_frame_offset();
-
        _marker->set_position (adjusted_current_frame (event, false));
 }
 
@@ -5113,7 +5084,7 @@ SelectionDrag::motion (GdkEvent* event, bool first_move)
                        TrackViewList grouped_add = new_selection;
                        for (TrackViewList::const_iterator i = new_selection.begin(); i != new_selection.end(); ++i) {
                                RouteTimeAxisView *n = dynamic_cast<RouteTimeAxisView *>(*i);
-                               if ( n && n->route()->route_group() && n->route()->route_group()->is_active() && n->route()->route_group()->enabled_property (ARDOUR::Properties::select.property_id) ) {
+                               if ( n && n->route()->route_group() && n->route()->route_group()->is_active() && n->route()->route_group()->enabled_property (ARDOUR::Properties::group_select.property_id) ) {
                                        for (TrackViewList::const_iterator j = all_tracks.begin(); j != all_tracks.end(); ++j) {
                                                RouteTimeAxisView *check = dynamic_cast<RouteTimeAxisView *>(*j);
                                                if ( check && (n != check) && (check->route()->route_group() == n->route()->route_group()) )