Merge branch 'master' into cairocanvas
[ardour.git] / gtk2_ardour / editor_selection.cc
index 3f88ddbce57f7b74951f75b7c6859332fee4de18..065cfdbcba42fb323049b0b5cf4dd8f0e8a692d6 100644 (file)
@@ -364,7 +364,7 @@ void
 Editor::get_onscreen_tracks (TrackViewList& tvl)
 {
        for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
-               if ((*i)->y_position() < _canvas_height) {
+               if ((*i)->y_position() < _visible_canvas_height) {
                        tvl.push_back (*i);
                }
        }
@@ -880,7 +880,7 @@ Editor::set_selected_regionview_from_region_list (boost::shared_ptr<Region> regi
 {
        vector<RegionView*> all_equivalent_regions;
 
-       get_regions_corresponding_to (region, all_equivalent_regions);
+       get_regions_corresponding_to (region, all_equivalent_regions, region->whole_file());
 
        if (all_equivalent_regions.empty()) {
                return;
@@ -1047,6 +1047,8 @@ Editor::sensitize_the_right_region_actions ()
        bool have_midi = false;
        bool have_locked = false;
        bool have_unlocked = false;
+       bool have_video_locked = false;
+       bool have_video_unlocked = false;
        bool have_position_lock_style_audio = false;
        bool have_position_lock_style_music = false;
        bool have_muted = false;
@@ -1089,6 +1091,12 @@ Editor::sensitize_the_right_region_actions ()
                        have_unlocked = true;
                }
 
+               if (r->video_locked()) {
+                       have_video_locked = true;
+               } else {
+                       have_video_unlocked = true;
+               }
+
                if (r->position_lock_style() == MusicTime) {
                        have_position_lock_style_music = true;
                } else {
@@ -1141,6 +1149,9 @@ Editor::sensitize_the_right_region_actions ()
                _region_actions->get_action("show-region-properties")->set_sensitive (false);
                _region_actions->get_action("rename-region")->set_sensitive (false);
                if (have_audio) {
+                       /* XXX need to check whether there is than 1 per
+                          playlist, because otherwise this makes no sense.
+                       */
                        _region_actions->get_action("combine-regions")->set_sensitive (true);
                } else {
                        _region_actions->get_action("combine-regions")->set_sensitive (false);
@@ -1209,6 +1220,12 @@ Editor::sensitize_the_right_region_actions ()
                // a->set_inconsistent ();
        }
 
+       a = Glib::RefPtr<ToggleAction>::cast_dynamic (_region_actions->get_action("toggle-region-video-lock"));
+       a->set_active (have_video_locked && !have_video_unlocked);
+       if (have_video_locked && have_video_unlocked) {
+               // a->set_inconsistent ();
+       }
+
        a = Glib::RefPtr<ToggleAction>::cast_dynamic (_region_actions->get_action("toggle-region-lock-style"));
        a->set_active (have_position_lock_style_music && !have_position_lock_style_audio);
 
@@ -1660,12 +1677,12 @@ Editor::select_all_selectables_using_cursor (EditorCursor *cursor, bool after)
        list<Selectable *> touched;
 
        if (after) {
-               start = cursor->current_frame;
+               start = cursor->current_frame();
                end = _session->current_end_frame();
        } else {
-               if (cursor->current_frame > 0) {
+               if (cursor->current_frame() > 0) {
                        start = 0;
-                       end = cursor->current_frame - 1;
+                       end = cursor->current_frame() - 1;
                } else {
                        return;
                }
@@ -1817,9 +1834,9 @@ Editor::get_edit_op_range (framepos_t& start, framepos_t& end) const
        framepos_t m;
        bool ignored;
 
-       /* in range mode, use any existing selection */
+       /* if an explicit range exists, use it */
 
-       if (mouse_mode == MouseRange && !selection->time.empty()) {
+       if (!selection->time.empty()) {
                /* we know that these are ordered */
                start = selection->time.start();
                end = selection->time.end_frame();