diff options
author | Taybin Rutkin <taybin@taybin.com> | 2006-11-03 23:07:55 +0000 |
---|---|---|
committer | Taybin Rutkin <taybin@taybin.com> | 2006-11-03 23:07:55 +0000 |
commit | a8deaab02f49cb04090a9c06fe50ab685359f940 (patch) | |
tree | 9f0ee600a2000f250fce9eb179a1c305216928ae /libs | |
parent | 975e44f92480f8ce170637d6b58b48a06e34ca7c (diff) |
Fixed template dialog annoyance.
Fixed Location saving in templates.
git-svn-id: svn://localhost/ardour2/trunk@1068 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/session.h | 2 | ||||
-rw-r--r-- | libs/ardour/session.cc | 9 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 15 |
3 files changed, 24 insertions, 2 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index c3f2dc30bf..85c0ef508c 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -928,6 +928,8 @@ class Session : public PBD::StatefulDestructible private: int create (bool& new_session, string* mix_template, nframes_t initial_length); + nframes_t compute_initial_length (); + static const char* _template_suffix; static const char* _statefile_suffix; static const char* _pending_suffix; diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index d871f5a859..59e798b5d5 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -278,7 +278,7 @@ Session::Session (AudioEngine &eng, new_session = !g_file_test (_path.c_str(), GFileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)); if (new_session) { - if (create (new_session, mix_template, _engine.frame_rate() * 60 * 5)) { + if (create (new_session, mix_template, compute_initial_length())) { cerr << "create failed\n"; throw failed_constructor (); } @@ -3768,3 +3768,10 @@ Session::add_automation_list(AutomationList *al) { automation_lists[al->id()] = al; } + +nframes_t +Session::compute_initial_length () +{ + return _engine.frame_rate() * 60 * 5; +} + diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 603d3a5c2d..763f8b9c01 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -880,7 +880,20 @@ Session::state(bool full_state) } } - node->add_child_nocopy (_locations.get_state()); + if (full_state) { + node->add_child_nocopy (_locations.get_state()); + } else { + // for a template, just create a new Locations, populate it + // with the default start and end, and get the state for that. + Locations loc; + Location* start = new Location(0, 0, _("start"), Location::Flags ((Location::IsMark|Location::IsStart))); + Location* end = new Location(0, 0, _("end"), Location::Flags ((Location::IsMark|Location::IsEnd))); + start->set_end(0); + loc.add (start); + end->set_end(compute_initial_length()); + loc.add (end); + node->add_child_nocopy (loc.get_state()); + } child = node->add_child ("Connections"); { |