diff options
author | Ben Loftis <ben@harrisonconsoles.com> | 2017-08-14 17:20:34 -0500 |
---|---|---|
committer | Ben Loftis <ben@harrisonconsoles.com> | 2017-08-14 17:20:34 -0500 |
commit | 8717c0d3b03a573fe12bda98d24a8e56fab402c3 (patch) | |
tree | 924f33dddfb093b5f512170408e400a4d930220a /gtk2_ardour | |
parent | 47d86cf54d64ae2f65c7ffa961ccc583d33f3382 (diff) |
Auto-select an Empty template.
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/session_dialog.cc | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/gtk2_ardour/session_dialog.cc b/gtk2_ardour/session_dialog.cc index 8d8fa54e74..2dd283e647 100644 --- a/gtk2_ardour/session_dialog.cc +++ b/gtk2_ardour/session_dialog.cc @@ -503,11 +503,7 @@ SessionDialog::populate_session_templates () template_model->clear (); -// ToDo: maybe add an explicit 'no template' item? -// TreeModel::Row row = *template_model->prepend (); -// row[session_template_columns.name] = (_("no template")); -// row[session_template_columns.path] = string(); - + //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; @@ -518,6 +514,8 @@ SessionDialog::populate_session_templates () row[session_template_columns.created_with] = _("{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; @@ -528,7 +526,19 @@ SessionDialog::populate_session_templates () row[session_template_columns.description] = (*x).description; row[session_template_columns.created_with] = (*x).created_with; } - + + //Add an explicit 'Empty Template' item + TreeModel::Row row = *template_model->prepend (); + 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}"); + + //auto-select the first item in the list + Gtk::TreeModel::Row first = template_model->children()[0]; + if(first) { + template_chooser.get_selection()->select(first); + } } void @@ -612,19 +622,19 @@ SessionDialog::setup_new_session_page () HBox* hbox4a = manage (new HBox); - hbox4a->set_spacing (6); - hbox4a->pack_start (template_chooser, false, false); - hbox4a->pack_start (template_desc, true, true); - + //if the "template override" is provided, don't give the user any template selections (?) + if ( load_template_override.empty() ) { + hbox4a->set_spacing (6); + hbox4a->pack_start (template_chooser, false, false); + hbox4a->pack_start (template_desc, true, true); + } + template_desc.set_editable (false); template_desc.set_wrap_mode (Gtk::WRAP_WORD); template_desc.set_size_request(300,400); template_desc.set_left_margin(6); template_desc.set_right_margin(6); - Gtk::CellRendererText* text_renderer = Gtk::manage (new Gtk::CellRendererText); - text_renderer->property_editable() = false; - template_chooser.set_model (template_model); template_chooser.set_size_request(300,400); template_chooser.append_column (_("Template"), session_template_columns.name); |