diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2007-08-16 23:17:35 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2007-08-16 23:17:35 +0000 |
commit | 327275f4c9381575021be96f2c67e23b378bd98c (patch) | |
tree | 0df7621510154ea6db6d7f53085d2686a2b602cf /libs/pbd | |
parent | f433b4e735ab5ff5f7f7d89d38d0c25de3641cfa (diff) |
support DnD in native/gtk-quartz implementation (note: multifile DnD requires a patch to GTK that is not in distribution yet, so for now, this works only with 1 file at a time, or it requires my patch/library).
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2319 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd')
-rw-r--r-- | libs/pbd/convert.cc | 47 | ||||
-rw-r--r-- | libs/pbd/pbd/convert.h | 2 |
2 files changed, 49 insertions, 0 deletions
diff --git a/libs/pbd/convert.cc b/libs/pbd/convert.cc index ff426cfb80..3c27026546 100644 --- a/libs/pbd/convert.cc +++ b/libs/pbd/convert.cc @@ -32,6 +32,7 @@ using std::string; using std::vector; +using Glib::ustring; namespace PBD { @@ -196,6 +197,52 @@ url_decode (string& url) } } +void +url_decode (ustring& url) +{ + ustring::iterator last; + ustring::iterator next; + + for (ustring::iterator i = url.begin(); i != url.end(); ++i) { + if ((*i) == '+') { + next = i; + ++next; + url.replace (i, next, 1, ' '); + } + } + + if (url.length() <= 3) { + return; + } + + last = url.end(); + + --last; /* points at last char */ + --last; /* points at last char - 1 */ + + for (ustring::iterator i = url.begin(); i != last; ) { + + if (*i == '%') { + + next = i; + + url.erase (i); + + i = next; + ++next; + + if (isxdigit (*i) && isxdigit (*next)) { + /* replace first digit with char */ + url.replace (i, next, 1, (gunichar) int_from_hex (*i,*next)); + ++i; /* points at 2nd of 2 digits */ + url.erase (i); + } + } else { + ++i; + } + } +} + #if 0 string length2string (const int32_t frames, const float sample_rate) diff --git a/libs/pbd/pbd/convert.h b/libs/pbd/pbd/convert.h index 458e4aebe9..83cd285098 100644 --- a/libs/pbd/pbd/convert.h +++ b/libs/pbd/pbd/convert.h @@ -24,6 +24,7 @@ #include <vector> #include <sstream> #include <iostream> +#include <glibmm/ustring.h> namespace PBD { @@ -32,6 +33,7 @@ std::string short_version (std::string, std::string::size_type target_length); int atoi (const std::string&); double atof (const std::string&); void url_decode (std::string&); +void url_decode (Glib::ustring&); // std::string length2string (const int32_t frames, const float sample_rate); std::string length2string (const int64_t frames, const double sample_rate); |