err = lua.do_file (script_path);
} catch (luabridge::LuaException const& e) {
err = -1;
+ } catch (...) {
+ err = -1;
}
+
if (err) {
return UINT32_MAX;
}
}
LuaScriptInfo::ScriptType type = LuaScriptInfo::str2type (nfo["type"].cast<std::string>());
- if (type != LuaScriptInfo::SessionSetup) {
+ if (type != LuaScriptInfo::SessionInit) {
return UINT32_MAX;
}
bool
SessionDialog::use_session_template () const
{
+ if (!back_button->sensitive () && !new_only) {
+ /* open session -- not create a new one */
+ return false;
+ }
+
if (!load_template_override.empty()) {
return true;
}
recent_session_display.set_model (recent_session_model);
recent_session_display.append_column (_("Session Name"), recent_session_columns.visible_name);
recent_session_display.append_column (_("Sample Rate"), recent_session_columns.sample_rate);
+#ifdef MIXBUS
+ recent_session_display.append_column (_("Modified With"), recent_session_columns.modified_with);
+#else
recent_session_display.append_column (_("File Resolution"), recent_session_columns.disk_format);
+#endif
recent_session_display.append_column (_("Last Modified"), recent_session_columns.time_formatted);
recent_session_display.set_headers_visible (true);
recent_session_display.get_selection()->set_mode (SELECTION_SINGLE);
existing_session_chooser.add_filter (session_filter);
FileFilter archive_filter;
- archive_filter.add_pattern (X_("*.tar.xz"));
+ archive_filter.add_pattern (string_compose(X_("*%1"), ARDOUR::session_archive_suffix));
archive_filter.set_name (_("Session Archives"));
existing_session_chooser.add_filter (archive_filter);
return true;
}
+struct LuaScriptListSorter
+{
+ bool operator() (LuaScriptInfoPtr const a, LuaScriptInfoPtr const b) const {
+ return ARDOUR::cmp_nocase_utf8 (a->name, b->name) < 0;
+ }
+};
+
+
void
SessionDialog::populate_session_templates ()
{
template_model->clear ();
- //Add any Lua scripts (factory templates) found in the scripts folder
- LuaScriptList& ms (LuaScripting::instance ().scripts (LuaScriptInfo::SessionSetup));
- for (LuaScriptList::const_iterator s = ms.begin(); s != ms.end(); ++s) {
- TreeModel::Row row;
- row = *(template_model->append ());
- row[session_template_columns.name] = "Meta: " + (*s)->name;
+ /* Get Lua Scripts dedicated to session-setup */
+ LuaScriptList scripts (LuaScripting::instance ().scripts (LuaScriptInfo::SessionInit));
+
+ /* Add Lua Action Scripts which can also be used for session-setup */
+ LuaScriptList& as (LuaScripting::instance ().scripts (LuaScriptInfo::EditorAction));
+ for (LuaScriptList::const_iterator s = as.begin(); s != as.end(); ++s) {
+ if ((*s)->subtype & LuaScriptInfo::SessionSetup) {
+ scripts.push_back (*s);
+ }
+ }
+
+ LuaScriptListSorter cmp;
+ std::sort (scripts.begin(), scripts.end(), cmp);
+
+ for (LuaScriptList::const_iterator s = scripts.begin(); s != scripts.end(); ++s) {
+ TreeModel::Row row = *(template_model->append ());
+ row[session_template_columns.name] = (*s)->name;
row[session_template_columns.path] = "urn:ardour:" + (*s)->path;
row[session_template_columns.description] = (*s)->description;
- row[session_template_columns.created_with] = _("{Factory Template}");
+ row[session_template_columns.modified_with_short] = _("{Factory Template}");
+ row[session_template_columns.modified_with_long] = _("{Factory Template}");
}
-
//Add any "template sessions" found in the user's preferences folder
for (vector<TemplateInfo>::iterator x = templates.begin(); x != templates.end(); ++x) {
TreeModel::Row row;
row[session_template_columns.name] = (*x).name;
row[session_template_columns.path] = (*x).path;
row[session_template_columns.description] = (*x).description;
- row[session_template_columns.created_with] = (*x).created_with;
+ row[session_template_columns.modified_with_long] = (*x).modified_with;
+ row[session_template_columns.modified_with_short] = (*x).modified_with.substr(0, (*x).modified_with.find(" "));
}
//Add an explicit 'Empty Template' item
row[session_template_columns.name] = (_("Empty Template"));
row[session_template_columns.path] = string();
row[session_template_columns.description] = _("An empty session with factory default settings.");
- row[session_template_columns.created_with] = _("{Factory Template}");
+ row[session_template_columns.modified_with_short] = _("");
+ row[session_template_columns.modified_with_long] = _("");
//auto-select the first item in the list
Gtk::TreeModel::Row first = template_model->children()[0];
//if the "template override" is provided, don't give the user any template selections (?)
if ( load_template_override.empty() ) {
template_hbox->set_spacing (8);
- template_hbox->pack_start (template_chooser, true, true);
+
+ Gtk::ScrolledWindow *template_scroller = manage (new Gtk::ScrolledWindow());
+ template_scroller->set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
+ template_scroller->add (template_chooser);
+
+ Gtk::ScrolledWindow *desc_scroller = manage (new Gtk::ScrolledWindow());
+ desc_scroller->set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
+ desc_scroller->add (template_desc);
+
+ template_hbox->pack_start (*template_scroller, true, true);
+
+ template_desc_frame.set_name (X_("TextHighlightFrame"));
+ template_desc_frame.add (*desc_scroller);
template_hbox->pack_start (template_desc_frame, true, true);
}
//template_desc is the textview that displays the currently selected template's description
template_desc.set_editable (false);
template_desc.set_wrap_mode (Gtk::WRAP_WORD);
- template_desc.set_size_request(300,400);
+ template_desc.set_size_request (300,400);
template_desc.set_name (X_("TextOnBackground"));
template_desc.set_border_width (6);
- template_desc_frame.set_name (X_("TextHighlightFrame"));
- template_desc_frame.add (template_desc);
-
//template_chooser is the treeview showing available templates
template_model = TreeStore::create (session_template_columns);
template_chooser.set_model (template_model);
- template_chooser.set_size_request(300,400);
template_chooser.append_column (_("Template"), session_template_columns.name);
- template_chooser.append_column (_("Created With"), session_template_columns.created_with);
+#ifdef MIXBUS
+ template_chooser.append_column (_("Modified With"), session_template_columns.modified_with_short);
+#endif
template_chooser.set_headers_visible (true);
template_chooser.get_selection()->set_mode (SELECTION_SINGLE);
template_chooser.get_selection()->signal_changed().connect (sigc::mem_fun (*this, &SessionDialog::template_row_selected));
template_chooser.set_sensitive (true);
+ if (UIConfiguration::instance().get_use_tooltips()) {
+ template_chooser.set_tooltip_column(4); // modified_with_long
+ }
- /* --- */
-
- session_new_vbox.pack_start (*template_hbox, false, true);
+ session_new_vbox.pack_start (*template_hbox, true, true);
session_new_vbox.pack_start (*folder_box, false, true);
session_new_vbox.pack_start (*name_hbox, false, true);
session_new_vbox.show_all ();
continue;
}
- Gtk::TreeModel::Row row = *(recent_session_model->append());
-
float sr;
SampleFormat sf;
std::string program_version;
std::string s = Glib::build_filename (dirname, state_file_basename + statefile_suffix);
+ int err = Session::get_info_from_path (s, sr, sf, program_version);
+ if (err < 0) {
+ // XML cannot be parsed, or unsuppored version
+ continue;
+ }
+
GStatBuf gsb;
g_stat (s.c_str(), &gsb);
+ Gtk::TreeModel::Row row = *(recent_session_model->append());
row[recent_session_columns.fullpath] = s;
row[recent_session_columns.time_modified] = gsb.st_mtime;
- if (Session::get_info_from_path (s, sr, sf, program_version) == 0) {
+
+ if (err == 0) {
row[recent_session_columns.sample_rate] = rate_as_string (sr);
switch (sf) {
case FormatFloat:
row[recent_session_columns.tip] = Gtkmm2ext::markup_escape_text (dirname);
} else {
row[recent_session_columns.tip] = Gtkmm2ext::markup_escape_text (dirname + "\n" + string_compose (_("Last modified with: %1"), program_version));
+ row[recent_session_columns.modified_with] = program_version;
}
++session_snapshot_count;
row[recent_session_columns.time_formatted] = gdt.format ("%F %H:%M");
}
- recent_session_display.set_tooltip_column(1); // recent_session_columns.tip
+ if (UIConfiguration::instance().get_use_tooltips()) {
+ recent_session_display.set_tooltip_column(1); // recent_session_columns.tip
+ }
recent_session_display.set_model (recent_session_model);
// custom sort