diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc index cf57261aa6..df737429bd 100644 --- a/gtk2_ardour/editor_audio_import.cc +++ b/gtk2_ardour/editor_audio_import.cc @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -380,7 +381,6 @@ Editor::embed_sndfile (vector paths, bool split, bool multiple_fi boost::shared_ptr s; if ((s = session->source_by_path_and_channel (path, n)) == 0) { - cerr << "source doesn't exist yet\n"; source = boost::dynamic_pointer_cast (SourceFactory::createReadable (*session, path, n, (mode == ImportAsTapeTrack ? diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index e9b71e4e85..356504d809 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -3381,6 +3381,8 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event boost::shared_ptr to_playlist = rv->region()->playlist(); + assert (to_playlist); + /* add the undo */ session->add_command (new MementoCommand(*to_playlist, &to_playlist->get_state(), 0)); diff --git a/gtk2_ardour/selection.cc b/gtk2_ardour/selection.cc index 2b1b522d12..1e8874444c 100644 --- a/gtk2_ardour/selection.cc +++ b/gtk2_ardour/selection.cc @@ -20,6 +20,7 @@ #include #include #include +#include #include diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index 9c1ef22a88..b4d02591e9 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -576,55 +576,4 @@ key_is_legal_for_numeric_entry (guint keyval) } -ustring -short_path (ustring path, uint32_t target_characters) -{ - ustring::size_type last_sep; - ustring::size_type len = path.length(); - const char separator = '/'; - - if (len <= target_characters) { - return path; - } - - if ((last_sep = path.find_last_of (separator)) == ustring::npos) { - - /* just a filename, but its too long anyway */ - - if (target_characters > 3) { - return path.substr (0, target_characters - 3) + ustring ("..."); - } else { - /* stupid caller, just hand back the whole thing */ - return path; - } - } - - if (len - last_sep >= target_characters) { - - /* even the filename itself is too long */ - - if (target_characters > 3) { - return path.substr (last_sep+1, target_characters - 3) + ustring ("..."); - } else { - /* stupid caller, just hand back the whole thing */ - return path; - } - } - - uint32_t so_far = (len - last_sep); - uint32_t space_for = target_characters - so_far; - - if (space_for >= 3) { - ustring res = "..."; - res += path.substr (last_sep - space_for); - return res; - } else { - /* remove part of the end */ - ustring res = "..."; - res += path.substr (last_sep - space_for, len - last_sep + space_for - 3); - res += "..."; - return res; - - } -} diff --git a/gtk2_ardour/utils.h b/gtk2_ardour/utils.h index b95f09d243..7e26ba066c 100644 --- a/gtk2_ardour/utils.h +++ b/gtk2_ardour/utils.h @@ -81,6 +81,5 @@ static std::map > xpm_map; const char* const *get_xpm_data (std::string path); std::string longest (std::vector&); bool key_is_legal_for_numeric_entry (guint keyval); -Glib::ustring short_path (Glib::ustring, uint32_t target_characters); #endif /* __ardour_gtk_utils_h__ */ diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h index 103e95929e..5f33719ae7 100644 --- a/libs/ardour/ardour/playlist.h +++ b/libs/ardour/ardour/playlist.h @@ -182,6 +182,7 @@ class Playlist : public PBD::StatefulDestructible, public boost::enable_shared_f bool save_on_thaw; string last_save_reason; uint32_t in_set_state; + bool first_set_state; bool _hidden; bool _splicing; bool _nudging; diff --git a/libs/ardour/audiofilesource.cc b/libs/ardour/audiofilesource.cc index 9a3bf266ae..929cfc8083 100644 --- a/libs/ardour/audiofilesource.cc +++ b/libs/ardour/audiofilesource.cc @@ -29,11 +29,13 @@ #include #include #include +#include #include #include #include +#include #include #include @@ -366,10 +368,33 @@ AudioFileSource::find (ustring& pathstr, bool must_exist, bool& isnew) isnew = false; - /* clean up PATH:CHANNEL notation so that we are looking for the correct path */ + /* i (paul) made a nasty design error by using ':' as a special character in + Ardour 0.99 .. this hack tries to make things sort of work. + */ if ((pos = pathstr.find_last_of (':')) != ustring::npos) { - pathstr = pathstr.substr (0, pos); + if (Glib::file_test (pathstr, Glib::FILE_TEST_EXISTS)) { + /* its a real file, no problem */ + + } else { + + if (must_exist) { + + /* older session using file:channel syntax */ + + warning << string_compose (_("This older session references an embedded\n\ +non-mono audio file:\n\n%1\n\n \ +The session file may be edited or the file must be removed before it can be used."), + short_path (pathstr, 48)) + << endmsg; + return false; + + } else { + + /* new derived file (e.g. for timefx) being created in a newer session */ + + } + } } if (pathstr[0] != '/') { diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index ae9e23fcc9..807bcd23ca 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -74,6 +74,7 @@ Playlist::Playlist (Session& sess, string nom, bool hide) : _session (sess) { init (hide); + first_set_state = false; _name = nom; } @@ -108,6 +109,7 @@ Playlist::Playlist (boost::shared_ptr other, string namestr, boo _edit_mode = other->_edit_mode; in_set_state = 0; + first_set_state = false; in_flush = false; in_partition = false; subcnt = 0; @@ -180,6 +182,7 @@ Playlist::Playlist (boost::shared_ptr other, nframes_t start, nf } in_set_state--; + first_set_state = false; /* this constructor does NOT notify others (session) */ } @@ -220,6 +223,7 @@ Playlist::init (bool hide) g_atomic_int_set (&ignore_state_changes, 0); pending_modified = false; pending_length = false; + first_set_state = true; _refcnt = 0; _hidden = hide; _splicing = false; @@ -508,10 +512,10 @@ Playlist::add_region_internal (boost::shared_ptr region, nframes_t posit old_length = _get_maximum_extent(); } - if (!in_set_state) { + if (!first_set_state) { boost::shared_ptr foo (shared_from_this()); region->set_playlist (boost::weak_ptr(foo)); - } + } region->set_position (position, this); @@ -1418,7 +1422,7 @@ Playlist::set_state (const XMLNode& node) } in_set_state--; - + first_set_state = false; return 0; } diff --git a/libs/ardour/session_time.cc b/libs/ardour/session_time.cc index 2a921c3dc9..9ae3492ea7 100644 --- a/libs/ardour/session_time.cc +++ b/libs/ardour/session_time.cc @@ -25,6 +25,7 @@ #include #include +#include #include #include diff --git a/libs/pbd/SConscript b/libs/pbd/SConscript index 12664a1fca..3aaeb1bf1b 100644 --- a/libs/pbd/SConscript +++ b/libs/pbd/SConscript @@ -34,6 +34,7 @@ pathscanner.cc pool.cc pthread_utils.cc receiver.cc +shortpath.cc stacktrace.cc stateful.cc strreplace.cc