#include <pbd/pthread_utils.h>
#include <pbd/basename.h>
+#include <pbd/shortpath.h>
#include <gtkmm2ext/choice.h>
#include <gtkmm2ext/window_title.h>
boost::shared_ptr<Source> s;
if ((s = session->source_by_path_and_channel (path, n)) == 0) {
- cerr << "source doesn't exist yet\n";
source = boost::dynamic_pointer_cast<AudioFileSource> (SourceFactory::createReadable
(*session, path, n,
(mode == ImportAsTapeTrack ?
boost::shared_ptr<Playlist> to_playlist = rv->region()->playlist();
+ assert (to_playlist);
+
/* add the undo */
session->add_command (new MementoCommand<Playlist>(*to_playlist, &to_playlist->get_state(), 0));
#include <algorithm>
#include <sigc++/bind.h>
#include <pbd/error.h>
+#include <pbd/stacktrace.h>
#include <ardour/playlist.h>
}
-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;
-
- }
-}
const char* const *get_xpm_data (std::string path);
std::string longest (std::vector<std::string>&);
bool key_is_legal_for_numeric_entry (guint keyval);
-Glib::ustring short_path (Glib::ustring, uint32_t target_characters);
#endif /* __ardour_gtk_utils_h__ */
bool save_on_thaw;
string last_save_reason;
uint32_t in_set_state;
+ bool first_set_state;
bool _hidden;
bool _splicing;
bool _nudging;
#include <pbd/pathscanner.h>
#include <pbd/stl_delete.h>
#include <pbd/strsplit.h>
+#include <pbd/shortpath.h>
#include <pbd/enumwriter.h>
#include <sndfile.h>
#include <glibmm/miscutils.h>
+#include <glibmm/fileutils.h>
#include <ardour/audiofilesource.h>
#include <ardour/sndfile_helpers.h>
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] != '/') {
: _session (sess)
{
init (hide);
+ first_set_state = false;
_name = nom;
}
_edit_mode = other->_edit_mode;
in_set_state = 0;
+ first_set_state = false;
in_flush = false;
in_partition = false;
subcnt = 0;
}
in_set_state--;
+ first_set_state = false;
/* this constructor does NOT notify others (session) */
}
g_atomic_int_set (&ignore_state_changes, 0);
pending_modified = false;
pending_length = false;
+ first_set_state = true;
_refcnt = 0;
_hidden = hide;
_splicing = false;
old_length = _get_maximum_extent();
}
- if (!in_set_state) {
+ if (!first_set_state) {
boost::shared_ptr<Playlist> foo (shared_from_this());
region->set_playlist (boost::weak_ptr<Playlist>(foo));
- }
+ }
region->set_position (position, this);
}
in_set_state--;
-
+ first_set_state = false;
return 0;
}
#include <ardour/timestamps.h>
#include <pbd/error.h>
+#include <pbd/enumwriter.h>
#include <pbd/stacktrace.h>
#include <ardour/ardour.h>
pool.cc
pthread_utils.cc
receiver.cc
+shortpath.cc
stacktrace.cc
stateful.cc
strreplace.cc