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 (_("Created With"), recent_session_columns.created_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);
template_model->clear ();
- //Add any Lua scripts (factory templates) found in the scripts folder
- LuaScriptList& ms (LuaScripting::instance ().scripts (LuaScriptInfo::SessionSetup));
+ /* Add Lua Scripts dedicated to session-setup */
+ LuaScriptList& ms (LuaScripting::instance ().scripts (LuaScriptInfo::SessionInit));
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;
+ 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_short] = _("{Factory Template}");
+ row[session_template_columns.created_with_long] = _("{Factory Template}");
+ }
+
+ /* 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)) {
+ continue;
+ }
+ 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_short] = _("{Factory Template}");
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_short] = _("{Factory Template}");
- row[session_template_columns.created_with_long] = _("{Factory Template}");
+ row[session_template_columns.created_with_short] = _("");
+ row[session_template_columns.created_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);
#ifdef MIXBUS
template_chooser.append_column (_("Created With"), session_template_columns.created_with_short);
template_chooser.get_selection()->signal_changed().connect (sigc::mem_fun (*this, &SessionDialog::template_row_selected));
template_chooser.set_sensitive (true);
- /* --- */
-
- 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 ();
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.created_with] = program_version;
}
++session_snapshot_count;