Remove always-true should_show_selection code.
[ardour.git] / gtk2_ardour / editor.cc
index 0590b3a81dd007004545083d353b1fc08c079ed2..9cb680463e9cb3be426403490cddb5c1f0b91246 100644 (file)
@@ -485,7 +485,6 @@ Editor::Editor ()
 
        controls_layout.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK);
        controls_layout.signal_button_release_event().connect (sigc::mem_fun(*this, &Editor::edit_controls_button_release));
-       controls_layout_size_request_connection = controls_layout.signal_size_request().connect (sigc::mem_fun (*this, &Editor::controls_layout_size_request));
 
        _cursors = new MouseCursors;
 
@@ -1524,16 +1523,18 @@ Editor::build_track_region_context_menu ()
        region_edit_menu_split_item = 0;
        region_edit_menu_split_multichannel_item = 0;
 
+       /* we might try to use items that are currently attached to a crossfade menu,
+          so clear that, too.
+       */
+       track_crossfade_context_menu.items().clear ();
+
        RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (clicked_axisview);
 
        if (rtv) {
                boost::shared_ptr<Track> tr;
                boost::shared_ptr<Playlist> pl;
 
-               /* Don't offer a region submenu if we are in internal edit mode, as we don't select regions in this
-                  mode and so offering region context is somewhat confusing.
-               */
-               if ((tr = rtv->track()) && ((pl = tr->playlist())) && !internal_editing()) {
+               if ((tr = rtv->track()) && ((pl = tr->playlist()))) {
                        framepos_t const framepos = (framepos_t) floor ((double) get_preferred_edit_position() * tr->speed());
                        uint32_t regions_at = pl->count_regions_at (framepos);
                        add_region_context_items (edit_items, regions_at > 1);
@@ -1552,6 +1553,11 @@ Editor::build_track_crossfade_context_menu ()
        MenuList& edit_items  = track_crossfade_context_menu.items();
        edit_items.clear ();
 
+       /* we might try to use items that are currently attached to a crossfade menu,
+          so clear that, too.
+       */
+       track_region_context_menu.items().clear ();
+
        AudioTimeAxisView* atv = dynamic_cast<AudioTimeAxisView*> (clicked_axisview);
 
        if (atv) {
@@ -2107,9 +2113,9 @@ Editor::set_state (const XMLNode& node, int /*version*/)
                }
        }
 
-       set_default_size (g.base_width, g.base_height);
+       //set_default_size (g.base_width, g.base_height);
        move (x, y);
-
+        
        if (_session && (prop = node.property ("playhead"))) {
                framepos_t pos;
                sscanf (prop->value().c_str(), "%" PRIi64, &pos);
@@ -4569,7 +4575,7 @@ Editor::get_regions_after (RegionSelection& rs, framepos_t where, const TrackVie
 RegionSelection
 Editor::get_regions_from_selection ()
 {
-       return add_route_group_regions_to_selection (selection->regions);
+       return get_equivalent_regions (selection->regions, ARDOUR::Properties::edit.property_id);
 }
 
 /** Get regions using the following method:
@@ -4650,63 +4656,7 @@ Editor::get_regions_from_selection_and_entered ()
                regions.add (entered_regionview);
        }
 
-       regions = add_route_group_regions_to_selection (regions);
-
-       return regions;
-}
-
-RegionSelection
-Editor::add_route_group_regions_to_selection (RegionSelection regions)
-{
-       TrackViewList tracks;
-       
-       vector<boost::shared_ptr<Region> > equivalent_regions;
-       RegionSelection edit_group_regions;
-               
-       /* Add any other tracks that have regions that are in the same
-          edit-activated route group as one of our regions.
-        */
-       for (RegionSelection::iterator i = regions.begin (); i != regions.end(); ++i) {
-               
-               RouteGroup* g = (*i)->get_time_axis_view().route_group ();
-               
-               if (g && g->is_active() && g->is_edit()) {
-                       /* get tracks in the group */
-                       tracks.add (axis_views_from_routes (g->route_list()));
-               }
-               
-               /* iterate over the track list and get the equivalent regions for the current region */
-               for (TrackViewList::iterator tr = tracks.begin (); tr != tracks.end(); ++tr) {
-                 
-                       if ( (*tr) == &(*i)->get_time_axis_view()) {
-                               /* looking in same track as the original */
-                               continue;
-                       }
-                 
-                       boost::shared_ptr<Playlist> pl;
-                       
-                       if ((pl = (*tr)->playlist()) != 0) {
-                               pl->get_equivalent_regions ((*i)->region(), equivalent_regions);
-                       }
-                       
-                       /* convert the regions to region views */
-                       for (vector<boost::shared_ptr<Region> >::iterator r = equivalent_regions.begin(); r != equivalent_regions.end(); ++r) {
-                               
-                               RegionView* rv;
-                               
-                               if ((rv = (*tr)->view()->find_view (*r)) != 0) {
-                                       edit_group_regions.add (rv);
-                               }
-                       }
-               }
-               
-               equivalent_regions.clear();
-               tracks.clear();
-       }
-       
-       regions.merge(edit_group_regions);
-       
-       return regions;
+       return get_equivalent_regions (regions, ARDOUR::Properties::edit.property_id);
 }
 
 void
@@ -4865,6 +4815,12 @@ Editor::region_view_added (RegionView *)
        _summary->set_dirty ();
 }
 
+void
+Editor::region_view_removed ()
+{
+       _summary->set_dirty ();
+}
+
 TimeAxisView*
 Editor::axis_view_from_route (boost::shared_ptr<Route> r) const
 {
@@ -4905,6 +4861,8 @@ Editor::handle_new_route (RouteList& routes)
        RouteTimeAxisView *rtv;
        list<RouteTimeAxisView*> new_views;
 
+        cerr << "Handle new route\n";
+
        for (RouteList::iterator x = routes.begin(); x != routes.end(); ++x) {
                boost::shared_ptr<Route> route = (*x);
 
@@ -4928,6 +4886,7 @@ Editor::handle_new_route (RouteList& routes)
                rtv->effective_gain_display ();
 
                rtv->view()->RegionViewAdded.connect (sigc::mem_fun (*this, &Editor::region_view_added));
+               rtv->view()->RegionViewRemoved.connect (sigc::mem_fun (*this, &Editor::region_view_removed));
        }
 
        _routes->routes_added (new_views);
@@ -5529,3 +5488,4 @@ Editor::notebook_tab_clicked (GdkEventButton* ev, Gtk::Widget* page)
 
        return true;
 }
+