summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-03-02 01:05:14 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-03-02 01:05:14 +0000
commita5ab2e99e19d5f5d4c1f91f38cd774fefdf257dc (patch)
treed4741f329eea4d523afe3f020e59c9b6983932a7
parentdb8b575c30845bafc34b87bacd52129c95d1c478 (diff)
PBD::capitalize() and use it to for the XML node name of a SequenceProperty's history node
git-svn-id: svn://localhost/ardour2/branches/3.0@6719 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--libs/ardour/playlist.cc3
-rw-r--r--libs/pbd/convert.cc12
-rw-r--r--libs/pbd/pbd/convert.h2
-rw-r--r--libs/pbd/pbd/sequence_property.h4
4 files changed, 17 insertions, 4 deletions
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc
index 1aef4b8d92..6169df8f03 100644
--- a/libs/ardour/playlist.cc
+++ b/libs/ardour/playlist.cc
@@ -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));
diff --git a/libs/pbd/convert.cc b/libs/pbd/convert.cc
index 0610567102..bda0683910 100644
--- a/libs/pbd/convert.cc
+++ b/libs/pbd/convert.cc
@@ -21,6 +21,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <cstdio>
+#include <ctype.h>
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif
@@ -37,6 +38,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)
{
/* this tries to create a recognizable abbreviation
diff --git a/libs/pbd/pbd/convert.h b/libs/pbd/pbd/convert.h
index e6e063bf41..cbc898011d 100644
--- a/libs/pbd/pbd/convert.h
+++ b/libs/pbd/pbd/convert.h
@@ -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);
diff --git a/libs/pbd/pbd/sequence_property.h b/libs/pbd/pbd/sequence_property.h
index 887250ab82..c2ad939b7c 100644
--- a/libs/pbd/pbd/sequence_property.h
+++ b/libs/pbd/pbd/sequence_property.h
@@ -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 */