Use conf.fatal for fatal configuration errors
[ardour.git] / gtk2_ardour / script_selector.cc
index ea28c414b60304b30984de2b881c6aaf0d1d0c66..ba913c1feb5443f78603f586f95cbb2f75d75050 100644 (file)
@@ -1,19 +1,19 @@
 /*
- * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
+ * Copyright (C) 2016-2018 Robin Gareus <robin@gareus.org>
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <gtkmm/frame.h>
@@ -79,7 +79,7 @@ ScriptSelector::ScriptSelector (std::string title, LuaScriptInfo::ScriptType typ
 
        setup_list ();
        show_all ();
-       
+
        script_combo_changed();
 }
 
@@ -88,27 +88,29 @@ ScriptSelector::script_separator (const Glib::RefPtr<Gtk::TreeModel> &, const Gt
 {
        _script_combo.set_active (i);
 
-       return _script_combo.get_active_text () == "separator";
+       return _script_combo.get_active_text () == "--separator--";
 }
 
 void
 ScriptSelector::setup_list ()
 {
        _combocon.block();
-       
+
        vector<string> script_names;
        for (LuaScriptList::const_iterator s = _scripts.begin(); s != _scripts.end(); ++s) {
-               if ( (*s)->name != "Shortcut" ) {
+               if ((*s)->name != "Shortcut" || _script_type != LuaScriptInfo::EditorAction) {
                        script_names.push_back ((*s)->name);
                }
        }
-       
+
        _script_combo.clear();
-       _script_combo.set_row_separator_func ( sigc::mem_fun (*this, &ScriptSelector::script_separator) );
+       _script_combo.set_row_separator_func (sigc::mem_fun (*this, &ScriptSelector::script_separator));
+
+       if (_script_type == LuaScriptInfo::EditorAction) {
+               _script_combo.append_text ("Shortcut");
+               _script_combo.append_text ("--separator--");
+       }
 
-       _script_combo.append_text ("Shortcut");
-       _script_combo.append_text ("separator");
-       
        vector<string>::const_iterator i;
        for (i = script_names.begin(); i != script_names.end(); ++i) {
                _script_combo.append_text (*i);
@@ -126,14 +128,14 @@ ScriptSelector::script_combo_changed ()
        std::string nm = _script_combo.get_active_text();
 
        for (LuaScriptList::const_iterator s = _scripts.begin(); s != _scripts.end(); ++s) {
-               if ( (*s)->name == nm ) {
+               if ((*s)->name == nm) {
                        _script = (*s);
                }
        }
 
        if (_script) {
-               
-               if (_script->name == "Shortcut" ) {
+
+               if (_script->name == "Shortcut") {
                        _type.hide();
                        _type_label.hide();
                        _author.hide();