PluginInfo::type added to copy constructor. But why is the copy constructor defined...
[ardour.git] / libs / ardour / utils.cc
index 948b4099869fe804ebf9064129b028ce644477cb..98b51cb5786be34d9922d65ef1ea4a724c69d9ac 100644 (file)
@@ -20,7 +20,7 @@
 #include <cstdio> /* for sprintf */
 #include <cmath>
 #include <cctype>
-#include <string>
+#include <cstring>
 #include <cerrno>
 #include <iostream>
 #include <sys/types.h>
@@ -94,25 +94,7 @@ legalize_for_path (ustring str)
        ustring::size_type pos;
        ustring legal_chars = "abcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_+=: ";
        ustring legal;
-
-       legal = str;
-       pos = 0;
-
-       while ((pos = legal.find_first_not_of (legal_chars, pos)) != string::npos) {
-               legal.replace (pos, 1, "_");
-               pos += 1;
-       }
-
-       return legal;
-}
-#if 0
-string 
-legalize_for_path (string str)
-{
-       string::size_type pos;
-       string legal_chars = "abcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_+=: ";
-       string legal;
-
+       
        legal = str;
        pos = 0;
 
@@ -123,7 +105,6 @@ legalize_for_path (string str)
 
        return legal;
 }
-#endif
 
 string bump_name_once(std::string name)
 {
@@ -359,7 +340,7 @@ compute_equal_power_fades (nframes_t nframes, float* in, float* out)
 {
        double step;
 
-       step = 1.0/nframes;
+       step = 1.0/(nframes-1);
 
        in[0] = 0.0f;
        
@@ -387,6 +368,8 @@ string_to_edit_mode (string str)
                return Splice;
        } else if (str == _("Slide Edit")) {
                return Slide;
+       } else if (str == _("Lock Edit")) {
+               return Lock;
        }
        fatal << string_compose (_("programming error: unknown edit mode string \"%1\""), str) << endmsg;
        /*NOTREACHED*/
@@ -400,6 +383,9 @@ edit_mode_to_string (EditMode mode)
        case Slide:
                return _("Slide Edit");
 
+       case Lock:
+               return _("Lock Edit");
+
        default:
        case Splice:
                return _("Splice Edit");
@@ -596,6 +582,14 @@ ARDOUR::auto_style_to_string (AutoStyle as)
        return "";
 }
 
+bool
+string_is_affirmative (const std::string& str)
+{
+       /* to be used only with XML data - not intended to handle user input */
+
+       return str == "1" || str == "y" || str == "Y" || (!g_strncasecmp(str.c_str(), "yes", str.length()));
+}
+
 extern "C" {
        void c_stacktrace() { stacktrace (cerr); }
 }