various fixes to named selection mgmt and display, plus fixes for xfade mgmt and...
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 11 Jan 2007 21:45:21 +0000 (21:45 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 11 Jan 2007 21:45:21 +0000 (21:45 +0000)
git-svn-id: svn://localhost/ardour2/trunk@1313 d708f5d6-7413-0410-9779-e7cbd77b26cf

13 files changed:
gtk2_ardour/ardour2_ui.rc
gtk2_ardour/editor.cc
gtk2_ardour/editor.h
gtk2_ardour/editor_mixer.cc
gtk2_ardour/editor_region_list.cc
gtk2_ardour/editor_selection_list.cc
gtk2_ardour/playlist_selector.cc
gtk2_ardour/route_ui.cc
libs/ardour/audio_playlist.cc
libs/ardour/crossfade.cc
libs/ardour/named_selection.cc
libs/ardour/playlist.cc
libs/ardour/session.cc

index b66ef42b59fd91f2aade44373bed85ca29283a99..f14dd9aecf2fff9378875bc0d3271cbd7851284c 100644 (file)
@@ -656,18 +656,35 @@ style "edit_group_3"
        bg[SELECTED] = { 0.93, 0.34, 0.08 }
 }
 
-style "region_list_display" = "small_bold_text"
+style "treeview_parent_node"
 {
-       fg[NORMAL] = { 0.80, 0.80, 0.80 }
-       fg[ACTIVE] = { 0.80, 0.80, 0.80 }
-       fg[SELECTED] = { 0.70, 0.70, 0.70 }
-       bg[NORMAL] = { 0, 0, 0 }
-       bg[ACTIVE] = { 0, 0, 0 }
-       bg[SELECTED] = { 0, 0, 0 }
-       base[NORMAL] = { 0, 0, 0 }
-       base[ACTIVE] = { 0, 1, 0 }
-       base[INSENSITIVE] = { 0, 0, 0 }
-       base[SELECTED] = { 0.80, 0.80, 0.80 }
+       # specifies *just* the color used for whole file rows when not selected
+       fg[NORMAL] = { 0.0, 0.6, 0.85 }
+}
+
+style "treeview_display" = "small_bold_text"
+
+       # expander arrow border and DnD "icon" text
+       fg[NORMAL] = { 0.8, 0.8, 0.8 } 
+
+       # background with no rows or no selection, plus
+       # expander arrow core and DnD "icon" background
+       base[NORMAL] = { 0.20, 0.20, 0.25 }
+
+       # selected row bg when window does not have focus (including during DnD)
+       base[ACTIVE] = { 0.0, 0.60, 0.60 }    
+
+       # selected row bg when window has focus
+       base[SELECTED] = { 0, 0.75, 0.75 }
+
+       # row text when in normal state and not a parent
+       text[NORMAL] = { 0.80, 0.80, 0.80 }
+
+       # selected row text with window focus
+       text[SELECTED] = { 0, 1.0, 1.0 }  
+
+       # selected row text without window focus (including during DnD)
+       text[ACTIVE] = { 0, 1.0, 1.0 }  
 }
 
 style "main_canvas_area"
@@ -979,11 +996,6 @@ style "pan_slider"
 
 }
 
-style "region_list_whole_file"
-{
-       fg[NORMAL] = { 0.4, 0.4, 0.9 }
-}
-
 style "ardour_button" ="default_buttons_menus"
 {
        xthickness = 1
@@ -1160,7 +1172,6 @@ widget "*EditorTrackNameDisplay" style "track_name_display"
 widget "*EditorTrackNameDisplay*" style "track_name_display"
 widget "*EditorActiveTrackNameDisplay" style "active_track_name_display"
 widget "*EditorActiveTrackNameDisplay*" style "active_track_name_display"
-widget "*EditorRegionList" style "region_list_display"
 widget "*CrossfadeEditAuditionButton" style "red_when_active"
 widget "*CrossfadeEditAuditionButton*" style "red_when_active"
 widget "*CrossfadeEditCurveButton" style "red_when_active"
@@ -1195,19 +1206,19 @@ widget "*ParameterValueDisplay" style "medium_bold_entry"
 widget "*PluginUIClickBox" style "medium_bold_entry"
 widget "*PluginUIClickBox*" style "medium_bold_entry"
 widget "*PluginSlider" style "plugin_slider"
-widget "*TrackListDisplay" style "track_list_display"
-widget "*TrackListDisplay.*" style "small_bold_text"
-widget "*EditGroupList" style "track_list_display"
-widget "*RegionListDisplay" style "small_bold_entry"
-widget "*RegionListDisplay.*" style "small_bold_text"
 widget "*RedirectSelector" style "redirect_list_display"
 widget "*RedirectSelector.*" style "redirect_list_display"
+widget "*EditGroupDisplay" style "treeview_display"
+widget "*TrackListDisplay" style "treeview_display"
+widget "*RegionListDisplay" style "treeview_display"
+widget "*NamedSelectionDisplay" style "treeview_display"
+widget "*SnapshotDisplay" style "treeview_display"
 widget "*MixerTrackCommentArea" style "option_entry"
 widget "*MixerPanZone" style "pan_zone"
-widget "*MixerTrackDisplayList" style "track_list_display"
-widget "*MixerSnapshotDisplayList" style "track_list_display"
-widget "*MixerAuxDisplayList" style "track_list_display"
-widget "*MixerGroupList" style "track_list_display"
+widget "*MixerTrackDisplayList" style "treeview_display"
+widget "*MixerSnapshotDisplayList" style "treeview_display"
+widget "*MixerAuxDisplayList" style "treeview_display"
+widget "*MixerGroupList" style "treeview_display"
 widget "*RegionEditorLabel" style "medium_text"
 widget "*RegionEditorSmallLabel" style "small_text"
 widget "*RegionEditorEntry" style "medium_entry"
@@ -1334,7 +1345,7 @@ widget "*PanningLinkDirectionButton" style "very_small_button"
 widget "*PanningLinkDirectionButton.*" style "very_small_button"
 widget "*ChannelCountSelector" style "medium_bold_entry"
 widget "*ChannelCountSelector.GtkArrow" style "default_buttons_menus"
-widget "*RegionListWholeFile" style "region_list_whole_file"
+widget "*RegionListWholeFile" style "treeview_parent_node"
 
 class "GtkWidget" style "default_base"
 class "GtkScrollbar" style "ardour_adjusters"
index 2fdbb5c7fb0b2ba15bc193a02f0315145204ada3..cd1e9f3f6125402b20ca4da7637c0f8ed6421285 100644 (file)
@@ -503,12 +503,11 @@ Editor::Editor (AudioEngine& eng)
        active_cell->property_activatable() = true;
        active_cell->property_radio() = false;
 
-       edit_group_display.set_name ("EditGroupList");
-
        group_model->signal_row_changed().connect (mem_fun (*this, &Editor::edit_group_row_change));
 
        edit_group_display.set_name ("EditGroupList");
        edit_group_display.get_selection()->set_mode (SELECTION_SINGLE);
+       edit_group_display.set_headers_visible (false);
        edit_group_display.set_reorderable (false);
        edit_group_display.set_rules_hint (true);
        edit_group_display.set_size_request (75, -1);
@@ -594,11 +593,12 @@ Editor::Editor (AudioEngine& eng)
        named_selection_display.append_column (_("Chunks"), named_selection_columns.text);
        named_selection_display.set_headers_visible (false);
        named_selection_display.set_size_request (100, -1);
-       named_selection_display.set_name ("RegionListDisplay");
+       named_selection_display.set_name ("NamedSelectionDisplay");
        
        named_selection_display.get_selection()->set_mode (SELECTION_SINGLE);
        named_selection_display.set_size_request (100, -1);
-       named_selection_display.signal_button_release_event().connect (mem_fun(*this, &Editor::named_selection_display_button_press), false);
+       named_selection_display.signal_button_release_event().connect (mem_fun(*this, &Editor::named_selection_display_button_release), false);
+       named_selection_display.signal_key_release_event().connect (mem_fun(*this, &Editor::named_selection_display_key_release), false);
        named_selection_display.get_selection()->signal_changed().connect (mem_fun (*this, &Editor::named_selection_display_selection_changed));
 
        /* SNAPSHOTS */
@@ -606,7 +606,7 @@ Editor::Editor (AudioEngine& eng)
        snapshot_display_model = ListStore::create (snapshot_display_columns);
        snapshot_display.set_model (snapshot_display_model);
        snapshot_display.append_column (X_("snapshot"), snapshot_display_columns.visible_name);
-       snapshot_display.set_name ("SnapshotDisplayList");
+       snapshot_display.set_name ("SnapshotDisplay");
        snapshot_display.set_size_request (75, -1);
        snapshot_display.set_headers_visible (false);
        snapshot_display.set_reorderable (false);
@@ -1772,7 +1772,7 @@ Editor::add_selection_context_items (Menu_Helpers::MenuList& edit_items)
        items.push_back (MenuElem (_("Crop region to range"), mem_fun(*this, &Editor::crop_region_to_selection)));
        items.push_back (MenuElem (_("Fill range with region"), mem_fun(*this, &Editor::region_fill_selection)));
        items.push_back (MenuElem (_("Duplicate range"), bind (mem_fun(*this, &Editor::duplicate_dialog), false)));
-       items.push_back (MenuElem (_("Create chunk from range"), mem_fun(*this, &Editor::name_selection)));
+       items.push_back (MenuElem (_("Create chunk from range"), mem_fun(*this, &Editor::create_named_selection)));
        items.push_back (SeparatorElem());
        items.push_back (MenuElem (_("Bounce range"), mem_fun(*this, &Editor::bounce_range_selection)));
        items.push_back (MenuElem (_("Export range"), mem_fun(*this, &Editor::export_selection)));
@@ -4019,15 +4019,16 @@ Editor::redisplay_snapshots ()
                string statename = *(*i);
                TreeModel::Row row = *(snapshot_display_model->append());
                
-               // we don't have a way of changing the rendering in just one TreeView 
-               // cell so just put an asterisk on each side of the name for now.
+               /* this lingers on in case we ever want to change the visible
+                  name of the snapshot.
+               */
+               
                string display_name;
+               display_name = statename;
+
                if (statename == session->snap_name()) {
-                       display_name = "*"+statename+"*";
                        snapshot_display.get_selection()->select(row);
-               } else {
-                       display_name = statename;
-               }
+               } 
                
                row[snapshot_display_columns.visible_name] = display_name;
                row[snapshot_display_columns.real_name] = statename;
index 82f60e8d3d74e42a2dd6a5931e0daaac684a0baa..241ce808ff7828e321145dfd2b5ab7232edfbcc7 100644 (file)
@@ -788,16 +788,16 @@ class Editor : public PublicEditor
        Gtkmm2ext::DnDTreeView<ARDOUR::NamedSelection*> named_selection_display;
        Gtk::ScrolledWindow    named_selection_scroller;
 
-       void name_selection();
-       void named_selection_name_chosen ();
-       void create_named_selection (const string &);
+       void create_named_selection ();
        void paste_named_selection (float times);
+       void remove_selected_named_selections ();
 
        void handle_new_named_selection ();
        void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&);
        void redisplay_named_selections ();
 
-       gint named_selection_display_button_press (GdkEventButton *ev);
+       bool named_selection_display_button_release (GdkEventButton *ev);
+       bool named_selection_display_key_release (GdkEventKey *ev);
        void named_selection_display_selection_changed ();
 
        /* track views */
index bfbb5104b240e613e07039dd5a8471157dd2c794..2d8d04e94a4e066797b0c103c81764a1dd885099 100644 (file)
@@ -272,11 +272,21 @@ Editor::session_going_away ()
 
        /* rip everything out of the list displays */
 
-       region_list_clear (); // no clear() method in gtkmm 1.2 
+       region_list_display.set_model (Glib::RefPtr<Gtk::TreeStore>(0));
+       route_list_display.set_model (Glib::RefPtr<Gtk::TreeStore>(0));
+       named_selection_display.set_model (Glib::RefPtr<Gtk::TreeStore>(0));
+       edit_group_display.set_model (Glib::RefPtr<Gtk::TreeStore>(0));
+
+       region_list_model->clear ();
        route_display_model->clear ();
        named_selection_model->clear ();
        group_model->clear ();
 
+       region_list_display.set_model (region_list_model);
+       route_list_display.set_model (route_display_model);
+       named_selection_display.set_model (named_selection_model);
+       edit_group_display.set_model (group_model);
+
        edit_cursor_clock.set_session (0);
        zoom_range_clock.set_session (0);
        nudge_clock.set_session (0);
index 2f2aea7b7d6703f31e7dfd08b330e62aa622e543..d2bcf5931d935d3d3a62e09a14f8b9da7920941e 100644 (file)
@@ -50,7 +50,8 @@ using namespace Editing;
 void
 Editor::handle_audio_region_removed (boost::weak_ptr<AudioRegion> wregion)
 {
-       ENSURE_GUI_THREAD (bind (mem_fun (*this, &Editor::handle_audio_region_removed), wregion));
+       cerr << "removed region\n";
+       ENSURE_GUI_THREAD (mem_fun (*this, &Editor::redisplay_regions));
        redisplay_regions ();
 }
 
@@ -255,12 +256,6 @@ Editor::redisplay_regions ()
        }
 }
 
-void
-Editor::region_list_clear ()
-{
-       region_list_model->clear();
-}
-
 void
 Editor::build_region_list_menu ()
 {
@@ -562,6 +557,7 @@ Editor::hide_a_region (boost::shared_ptr<Region> r)
 void
 Editor::remove_a_region (boost::shared_ptr<Region> r)
 {
+       cerr << "remove " << r->name();
        session->remove_region_from_region_list (r);
 }
 
@@ -580,6 +576,7 @@ Editor::hide_region_from_region_list ()
 void
 Editor::remove_region_from_region_list ()
 {
+       cerr << "Mapping remove over region selection\n";
        region_list_selection_mapover (mem_fun (*this, &Editor::remove_a_region));
 }
 
index 8e88ee497bbb9a74bd7fb8dbd878b101b0e5cf64..864e527b595d408fe6a25028b390b43caf4948c5 100644 (file)
@@ -65,10 +65,48 @@ Editor::redisplay_named_selections ()
        session->foreach_named_selection (*this, &Editor::add_named_selection_to_named_selection_display);
 }
 
-gint
-Editor::named_selection_display_button_press (GdkEventButton *ev)
+bool
+Editor::named_selection_display_key_release (GdkEventKey* ev)
 {
+       if (session == 0) {
+               return true;
+       }
+
+       switch (ev->keyval) {
+       case GDK_Delete:
+               remove_selected_named_selections ();
+               return true;
+               break;
+       default:
+               return false;
+               break;
+       }
+
+}
+
+void
+Editor::remove_selected_named_selections ()
+{
+       Glib::RefPtr<TreeSelection> selection = named_selection_display.get_selection();
+       TreeView::Selection::ListHandle_Path rows = selection->get_selected_rows ();
+
+       if (selection->count_selected_rows() == 0) {
+               return;
+       }
+
+       for (TreeView::Selection::ListHandle_Path::iterator i = rows.begin(); i != rows.end(); ++i) {
+
+               TreeIter iter;
 
+               if ((iter = named_selection_model->get_iter (*i))) {
+                       session->remove_named_selection ((*iter)[named_selection_columns.selection]);
+               }
+       }
+}
+
+bool
+Editor::named_selection_display_button_release (GdkEventButton *ev)
+{
        TreeModel::Children rows = named_selection_model->children();
        TreeModel::Children::iterator i;
        Glib::RefPtr<TreeSelection> selection = named_selection_display.get_selection();
@@ -91,7 +129,8 @@ Editor::named_selection_display_button_press (GdkEventButton *ev)
                        }
                }
        }
-       return FALSE;
+
+       return false;
 }
 
 
@@ -101,37 +140,10 @@ Editor::named_selection_display_selection_changed ()
 }
 
 void
-Editor::name_selection ()
+Editor::create_named_selection ()
 {
-       ArdourPrompter p;
-
-       p.set_prompt (_("Name for Chunk:"));
-       p.add_button (Gtk::Stock::NEW, Gtk::RESPONSE_ACCEPT);
-       p.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false);
-       p.change_labels (_("Create Chunk"), _("Forget it"));
-       p.show_all ();
-
-       switch (p.run ()) {
-       case Gtk::RESPONSE_ACCEPT:
-         string name;
-               p.get_result (name);
-               if (name.length()) {
-                 create_named_selection (name);
-               }       
-               break;
-       }
+       string name;
 
-}
-
-void
-Editor::named_selection_name_chosen ()
-{
-       Gtk::Main::quit ();
-}
-
-void
-Editor::create_named_selection (const string & name)
-{
        if (session == 0) {
                return;
        }
@@ -141,7 +153,6 @@ Editor::create_named_selection (const string & name)
        if (selection->time.empty()) {
                return;
        }
-
        
        TrackViewList *views = get_valid_views (selection->time.track, selection->time.group);
 
@@ -157,25 +168,42 @@ Editor::create_named_selection (const string & name)
                
                boost::shared_ptr<Playlist> pl = (*i)->playlist();
                
-               if (pl) {
-                       
-                       if ((what_we_found = pl->copy (selection->time, false)) != 0) {
-
-                               thelist.push_back (what_we_found);
-                       }
+               if (pl && (what_we_found = pl->copy (selection->time, false)) != 0) {
+                       thelist.push_back (what_we_found);
                }
        }
 
-       NamedSelection* ns;
-       TreeModel::Row row = *(named_selection_model->append());
-
-       ns = new NamedSelection (name, thelist);
-       row[named_selection_columns.selection] = ns;
-       row[named_selection_columns.text] = name;
+       if (!thelist.empty()) {
 
-       /* make the one we just added be selected */
+               ArdourPrompter p;
+               
+               p.set_prompt (_("Name for Chunk:"));
+               p.add_button (Gtk::Stock::NEW, Gtk::RESPONSE_ACCEPT);
+               p.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false);
+               p.change_labels (_("Create Chunk"), _("Forget it"));
+               p.show_all ();
+               
+               switch (p.run ()) {
+                       
+               case Gtk::RESPONSE_ACCEPT:
+                       p.get_result (name);
+                       if (name.empty()) {
+                               return;
+                       }       
+                       break;
+               default:
+                       return;
+               }
 
-       named_selection_display.get_selection()->select (row);
+               new NamedSelection (name, thelist); // creation will add it to the model
 
+               /* make the one we just added be selected */
+               
+               TreeModel::Children::iterator added = named_selection_model->children().end();
+               --added;
+               named_selection_display.get_selection()->select (*added);
+       } else {
+               error << _("No selectable material found in the currently selected time range") << endmsg;
+       }
 }
 
index d02c5a88de7d941f57634e38927e136004e0504e..ddb771bb1841b5a75238bb6ad07a1b0b13f7bf73 100644 (file)
@@ -88,7 +88,6 @@ PlaylistSelector::clear_map ()
 bool
 PlaylistSelector::on_unmap_event (GdkEventAny* ev)
 {
-       cerr << "PLselector unmapped\n";
        clear_map ();
        if (model) {
                model->clear ();
index 70f5b9e2d440f603b0aafe1e9b9ba01297e1ac5d..08b6c657a519a57880747d13dd8aaf6b42716217 100644 (file)
@@ -444,7 +444,7 @@ RouteUI::refresh_remote_control_menu ()
 
        RadioMenuItem::Group rc_group;
        CheckMenuItem* rc_active;
-       uint32_t limit = _session.ntracks();
+       uint32_t limit = _session.ntracks() + _session.nbusses();
        char buf[32];
 
        MenuList& rc_items = remote_control_menu->items();
index 06060061e0599f76629f5bf3b12a65e318842329..f3e71d320b6c164f3be65603db044710e729958f 100644 (file)
@@ -405,6 +405,7 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
                                xfade_length = min ((nframes_t) 720, top->length());
                                
                                xfade = boost::shared_ptr<Crossfade> (new Crossfade (top, bottom, xfade_length, top->first_frame(), StartOfIn));
+                               cerr << "StartOfIn is " << xfade << endl;
                                add_crossfade (xfade);
                                
                                if (top_region_at (top->last_frame() - 1) == top) {
@@ -414,6 +415,7 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
                                        */
                                        
                                        xfade = boost::shared_ptr<Crossfade> (new Crossfade (bottom, top, xfade_length, top->last_frame() - xfade_length, EndOfOut));
+                                       cerr << "EndofOut is " << xfade << endl;
                                        add_crossfade (xfade);
                                }
                                break;
index d2d04f8dc7de1ea79e98b004a5911719f1f31f1e..69f3cb32c1d577954b1c87a3a02a75c97eb55660 100644 (file)
@@ -87,13 +87,9 @@ Crossfade::Crossfade (boost::shared_ptr<AudioRegion> in, boost::shared_ptr<Audio
        _position = position;
        _anchor_point = ap;
 
-       switch (Config->get_xfade_model()) {
-       case ShortCrossfade:
-               _follow_overlap = false;
-               break;
-       default:
-               _follow_overlap = true;
-       }
+       _follow_overlap = false;
+
+       cerr << "A: follow overlap = " << _follow_overlap << endl;
 
        _active = Config->get_xfades_active ();
        _fixed = true;
@@ -116,6 +112,7 @@ Crossfade::Crossfade (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioR
 
        initialize ();
 
+       cerr << "K: follow overlap = " << _follow_overlap << endl;
 }
 
 Crossfade::Crossfade (const Playlist& playlist, XMLNode& node)
@@ -170,6 +167,9 @@ Crossfade::Crossfade (const Playlist& playlist, XMLNode& node)
        if (set_state (node)) {
                throw failed_constructor();
        }
+
+       cerr << "D: follow overlap = " << _follow_overlap << endl;
+
 }
 
 Crossfade::Crossfade (const Crossfade &orig, boost::shared_ptr<AudioRegion> newin, boost::shared_ptr<AudioRegion> newout)
@@ -197,12 +197,15 @@ Crossfade::Crossfade (const Crossfade &orig, boost::shared_ptr<AudioRegion> newi
 
        // Let's make sure the fade isn't too long
        set_length(_length);
+
+       cerr << "B: follow overlap = " << _follow_overlap << endl;
+
 }
 
 
 Crossfade::~Crossfade ()
 {
-       cerr << "Crossfade deleted\n";
+       cerr << this << " Crossfade deleted\n";
        notify_callbacks ();
 }
 
@@ -261,8 +264,6 @@ Crossfade::compute (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioReg
        
        if (top->first_frame() == bottom->first_frame()) {
 
-               cerr << "same start\n";
-               
                /* Both regions start at the same point */
                
                if (top->last_frame() < bottom->last_frame()) {
@@ -303,8 +304,6 @@ Crossfade::compute (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioReg
                
        } else if (top->last_frame() == bottom->last_frame()) {
                
-               cerr << "same end\n";
-
                /* Both regions end at the same point */
                
                if (top->first_frame() > bottom->first_frame()) {
@@ -343,21 +342,17 @@ Crossfade::compute (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioReg
 
                OverlapType ot = top->coverage (bottom->first_frame(), bottom->last_frame());
 
-               cerr << "ot = " << ot << endl;
-
                switch (ot) {
                case OverlapNone:
                        /* should be NOTREACHED as a precondition of creating
                           a new crossfade, but we need to handle it here.
                        */
-                       cerr << "no sir\n";
                        throw NoCrossfadeHere();
                        break;
                        
                case OverlapInternal:
                case OverlapExternal:
                        /* should be NOTREACHED because of tests above */
-                       cerr << "nu-uh\n";
                        throw NoCrossfadeHere();
                        break;
                        
@@ -516,11 +511,11 @@ Crossfade::refresh ()
                return false;
        }
 
-       if (_in->layer() < _out->layer()) {
-               cerr << "layer change, invalidated\n";
-               Invalidated (shared_from_this());
-               return false;
-       }
+//     if (_in->layer() < _out->layer()) {
+//             cerr << this << " layer change, invalidated, in on " << _in->layer() << " out on " << _out->layer() << endl;
+//             Invalidated (shared_from_this());
+//             return false;
+//     }
 
        /* overlap type must be Start, End or External */
 
@@ -528,19 +523,10 @@ Crossfade::refresh ()
        
        ot = _in->coverage (_out->first_frame(), _out->last_frame());
 
-       switch (ot) {
-       case OverlapNone:
-       case OverlapInternal:
-               Invalidated (shared_from_this());
-               return false;
-               
-       default:
-               break;
-       }
-               
        /* overlap type must not have altered */
        
        if (ot != overlap_type) {
+               cerr << this << " Invalid B\n";
                Invalidated (shared_from_this());
                return false;
        } 
@@ -555,13 +541,17 @@ Crossfade::update (bool force)
 {
        nframes_t newlen;
 
+       cerr << this << " update, " << _in->name() << " + " << _out->name() << " length = " << _length << endl;
+
        if (_follow_overlap) {
                newlen = _out->first_frame() + _out->length() - _in->first_frame();
+               cerr << "\tmodify length\n";
        } else {
                newlen = _length;
        }
 
        if (newlen == 0) {
+               cerr << this << " Invalid C\n";
                Invalidated (shared_from_this());
                return false;
        }
@@ -579,29 +569,19 @@ Crossfade::update (bool force)
 
        } 
 
+       cerr << "\tFover = " << _follow_overlap << endl;
+
        switch (_anchor_point) {
        case StartOfIn:
-               if (_position != _in->first_frame()) {
-                       if (_length > _short_xfade_length) {
-                               /* assume FullCrossfade */
-                               _position = _in->first_frame();
-                       } else {
-                               /* assume short xfade */
-                               _position = _out->last_frame() - _length;
-                       }
-               }
+               _position = _in->first_frame();
                break;
 
        case EndOfIn:
-               if (_position != _in->last_frame() - _length) {
-                       _position = _in->last_frame() - _length;
-               }
+               _position = _in->last_frame() - _length;
                break;
 
        case EndOfOut:
-               if (_position != _out->last_frame() - _length) {
-                       _position = _out->last_frame() - _length;
-               }
+               _position = _out->last_frame() - _length;
        }
 
        /* UI's may need to know that the overlap changed even 
index ecce09692f20ccc8d7a224247688775ba46fd08e..b5a71f6403a3cc2453f279c828a9630d812d7155 100644 (file)
@@ -40,8 +40,18 @@ NamedSelection::NamedSelection (string n, PlaylistList& l)
 {
        playlists = l;
        for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); ++i) {
+               string new_name;
+
+               /* rename playlists to reflect our ownership */
+
+               new_name = name;
+               new_name += '/';
+               new_name += (*i)->name();
+
+               (*i)->set_name (new_name);
                (*i)->use();
        }
+
        NamedSelectionCreated (this);
 }
 
@@ -90,7 +100,8 @@ NamedSelection::NamedSelection (Session& session, const XMLNode& node)
 NamedSelection::~NamedSelection ()
 {
        for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); ++i) {
-               (*i)->release();
+               (*i)->release ();
+               (*i)->GoingAway ();
        }
 }
 
index bdaa33f0aa20ba87622350c9f047787189756da4..019c00835368a3037fef8f975b7c7cdea1bb8773 100644 (file)
@@ -204,7 +204,6 @@ Playlist::release ()
        }
 }
 
-
 void
 Playlist::copy_regions (RegionList& newlist) const
 {
index 15758ea4dad7477420a514bc48ec31762c5de619..d49fb2c1164c1f4efac3e5d32bedf434525b0127 100644 (file)
@@ -352,23 +352,34 @@ Session::Session (AudioEngine &eng,
                }
        }
 
-       if (control_out_channels) {
-               shared_ptr<Route> r (new Route (*this, _("monitor"), -1, control_out_channels, -1, control_out_channels, Route::ControlOut));
-               RouteList rl;
-               rl.push_back (r);
-               add_routes (rl);
-               _control_out = r;
-       }
-
-       if (master_out_channels) {
-               shared_ptr<Route> r (new Route (*this, _("master"), -1, master_out_channels, -1, master_out_channels, Route::MasterOut));
+       {
+               /* set up Master Out and Control Out if necessary */
+               
                RouteList rl;
-               rl.push_back (r);
-               add_routes (rl);
-               _master_out = r;
-       } else {
-               /* prohibit auto-connect to master, because there isn't one */
-               output_ac = AutoConnectOption (output_ac & ~AutoConnectMaster);
+               int control_id = 1;
+               
+               if (control_out_channels) {
+                       shared_ptr<Route> r (new Route (*this, _("monitor"), -1, control_out_channels, -1, control_out_channels, Route::ControlOut));
+                       r->set_remote_control_id (control_id++);
+                       
+                       rl.push_back (r);
+               }
+               
+               if (master_out_channels) {
+                       shared_ptr<Route> r (new Route (*this, _("master"), -1, master_out_channels, -1, master_out_channels, Route::MasterOut));
+                       r->set_remote_control_id (control_id);
+                       cerr << "master bus has remote control ID " << r->remote_control_id() << endl;
+                        
+                       rl.push_back (r);
+               } else {
+                       /* prohibit auto-connect to master, because there isn't one */
+                       output_ac = AutoConnectOption (output_ac & ~AutoConnectMaster);
+               }
+               
+               if (!rl.empty()) {
+                       add_routes (rl);
+               }
+               
        }
 
        Config->set_input_auto_connect (input_ac);
@@ -1639,7 +1650,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod
 
        _engine.get_physical_outputs (physoutputs);
        _engine.get_physical_inputs (physinputs);
-       control_id = 0;
+       control_id = ntracks() + nbusses() + 1;
 
        while (how_many) {
 
@@ -1728,7 +1739,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod
                        }
                        
                        track->DiskstreamChanged.connect (mem_fun (this, &Session::resort_routes));
-                       track->set_remote_control_id (ntracks() + control_id + 1);
+                       track->set_remote_control_id (control_id);
                        ++control_id;
 
                        new_routes.push_back (track);
@@ -1761,6 +1772,7 @@ Session::new_audio_route (int input_channels, int output_channels, uint32_t how_
        uint32_t n = 0;
        string port;
        RouteList ret;
+       uint32_t control_id;
 
        /* count existing audio busses */
 
@@ -1781,6 +1793,7 @@ Session::new_audio_route (int input_channels, int output_channels, uint32_t how_
 
        _engine.get_physical_outputs (physoutputs);
        _engine.get_physical_inputs (physinputs);
+       control_id = ntracks() + nbusses() + 1;
 
        while (how_many) {
 
@@ -1844,6 +1857,9 @@ Session::new_audio_route (int input_channels, int output_channels, uint32_t how_
                                bus->set_control_outs (cports);
                        }
 
+                       bus->set_remote_control_id (control_id);
+                       ++control_id;
+
                        ret.push_back (bus);
                }
        
@@ -3588,9 +3604,13 @@ Session::add_named_selection (NamedSelection* named_selection)
                named_selections.insert (named_selections.begin(), named_selection);
        }
 
+       for (list<boost::shared_ptr<Playlist> >::iterator i = named_selection->playlists.begin(); i != named_selection->playlists.end(); ++i) {
+               add_playlist (*i);
+       }
+
        set_dirty();
 
-        NamedSelectionAdded (); /* EMIT SIGNAL */
+       NamedSelectionAdded (); /* EMIT SIGNAL */
 }
 
 void