PBD::capitalize() and use it to for the XML node name of a SequenceProperty's history...
authorPaul Davis <paul@linuxaudiosystems.com>
Tue, 2 Mar 2010 01:05:14 +0000 (01:05 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 2 Mar 2010 01:05:14 +0000 (01:05 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@6719 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/playlist.cc
libs/pbd/convert.cc
libs/pbd/pbd/convert.h
libs/pbd/pbd/sequence_property.h

index 1aef4b8d922620b55271e5202d1974d0b7cb7258..6169df8f030b93451626985ca9259b5f8fdba01f 100644 (file)
@@ -25,7 +25,6 @@
 #include <string>
 #include <climits>
 
-
 #include "pbd/failed_constructor.h"
 #include "pbd/stl_delete.h"
 #include "pbd/xml++.h"
@@ -2049,7 +2048,7 @@ Playlist::property_factory (const XMLNode& history_node) const
 
                 /* XXX property name needs capitalizing */
 
-                if ((*i)->name() == regions.property_name()) {
+                if ((*i)->name() == capitalize (regions.property_name())) {
                         
                         RegionListProperty* rlp = new RegionListProperty (*const_cast<Playlist*> (this));
 
index 06105671020a255efd07aedfd6ab837337528653..bda0683910661f6f9e352fbe86e7fd8ff85c7795 100644 (file)
@@ -21,6 +21,7 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <cstdio>
+#include <ctype.h>
 #ifndef __STDC_FORMAT_MACROS
 #define __STDC_FORMAT_MACROS
 #endif
@@ -36,6 +37,17 @@ using Glib::ustring;
 
 namespace PBD {
 
+string
+capitalize (const string& str)
+{
+        string ret = str;
+        if (!str.empty()) {
+                /* XXX not unicode safe */
+                ret[0] = toupper (str[0]);
+        }
+        return ret;
+}
+
 string
 short_version (string orig, string::size_type target_length)
 {
index e6e063bf41d59858423fd40533fd7bfd3b04ced1..cbc898011d78fa2c5efaf55ce164196370798211 100644 (file)
@@ -38,6 +38,8 @@ double  atof (const std::string&);
 void    url_decode (std::string&);
 void    url_decode (Glib::ustring&);
 
+std::string capitalize (const std::string&);
+
 // std::string length2string (const int32_t frames, const float sample_rate);
 std::string length2string (const int64_t frames, const double sample_rate);
 
index 887250ab8268f3e71b4bb441b9373e7e61c18ee1..c2ad939b7c0be0826eff188c96928ac42c833e2e 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <boost/function.hpp>
 
+#include "pbd/convert.h"
 #include "pbd/id.h"
 #include "pbd/property_basics.h"
 
@@ -44,8 +45,7 @@ class SequenceProperty : public PropertyBase
 
        void add_history_state (XMLNode* history_node) const {
                 
-                /* XXX need to capitalize property name */
-                XMLNode* child = new XMLNode (property_name());
+                XMLNode* child = new XMLNode (PBD::capitalize (property_name()));
                 history_node->add_child_nocopy (*child);
                 
                /* record the change described in our change member */