summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-10-22 03:53:44 +0000
committerDavid Robillard <d@drobilla.net>2011-10-22 03:53:44 +0000
commitd3c91af24a76bf999f18eab5cb5136857c93125a (patch)
treea38a0d205d1477390fc6c3fcdf2bdfab8daf08ba
parent0cfeb9f3a3a6098e1e2ea6edf07633af7a7d7eaa (diff)
downloadingen-d3c91af24a76bf999f18eab5cb5136857c93125a.tar.gz
ingen-d3c91af24a76bf999f18eab5cb5136857c93125a.tar.bz2
ingen-d3c91af24a76bf999f18eab5cb5136857c93125a.zip
Move basic URI map and unmap implementation to URIs.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3588 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--include/ingen/shared/URIs.hpp3
-rw-r--r--src/gui/PortMenu.cpp12
-rw-r--r--src/shared/LV2URIMap.cpp6
-rw-r--r--src/shared/URIs.cpp12
4 files changed, 24 insertions, 9 deletions
diff --git a/include/ingen/shared/URIs.hpp b/include/ingen/shared/URIs.hpp
index 7083507e..ba68f9eb 100644
--- a/include/ingen/shared/URIs.hpp
+++ b/include/ingen/shared/URIs.hpp
@@ -29,6 +29,9 @@ class URIs : public boost::noncopyable {
public:
URIs();
+ uint32_t map_uri(const char* uri);
+ const char* unmap_uri(uint32_t urid);
+
struct Quark : public Raul::URI {
Quark(const char* str);
const char* c_str() const;
diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp
index b779fe25..3656a97d 100644
--- a/src/gui/PortMenu.cpp
+++ b/src/gui/PortMenu.cpp
@@ -48,14 +48,14 @@ PortMenu::init(App& app, SharedPtr<const PortModel> port, bool patch_port)
ObjectMenu::init(app, port);
_patch_port = patch_port;
- _set_min_menuitem->signal_activate().connect(sigc::mem_fun(this,
- &PortMenu::on_menu_set_min));
+ _set_min_menuitem->signal_activate().connect(
+ sigc::mem_fun(this, &PortMenu::on_menu_set_min));
- _set_max_menuitem->signal_activate().connect(sigc::mem_fun(this,
- &PortMenu::on_menu_set_max));
+ _set_max_menuitem->signal_activate().connect(
+ sigc::mem_fun(this, &PortMenu::on_menu_set_max));
- _reset_range_menuitem->signal_activate().connect(sigc::mem_fun(this,
- &PortMenu::on_menu_reset_range));
+ _reset_range_menuitem->signal_activate().connect(
+ sigc::mem_fun(this, &PortMenu::on_menu_reset_range));
if ( ! PtrCast<PatchModel>(port->parent()) ) {
_polyphonic_menuitem->set_sensitive(false);
diff --git a/src/shared/LV2URIMap.cpp b/src/shared/LV2URIMap.cpp
index f87fdfce..d39f0b88 100644
--- a/src/shared/LV2URIMap.cpp
+++ b/src/shared/LV2URIMap.cpp
@@ -48,7 +48,7 @@ uint32_t
LV2URIMap::uri_to_id(const char* map,
const char* uri)
{
- const uint32_t id = static_cast<uint32_t>(g_quark_from_string(uri));
+ const uint32_t id = _uris.map_uri(uri);
if (map && !strcmp(map, LV2_EVENT_URI)) {
GlobalToEvent::iterator i = _global_to_event.find(id);
if (i != _global_to_event.end()) {
@@ -79,9 +79,9 @@ LV2URIMap::id_to_uri(const char* map,
error << "Failed to unmap event URI " << id << endl;
return NULL;
}
- return g_quark_to_string(i->second);
+ return _uris.unmap_uri(i->second);
} else {
- return g_quark_to_string(id);
+ return _uris.unmap_uri(id);
}
}
diff --git a/src/shared/URIs.cpp b/src/shared/URIs.cpp
index b6f1d0f4..c0753d5d 100644
--- a/src/shared/URIs.cpp
+++ b/src/shared/URIs.cpp
@@ -119,5 +119,17 @@ URIs::URIs()
{
}
+uint32_t
+URIs::map_uri(const char* uri)
+{
+ return static_cast<uint32_t>(g_quark_from_string(uri));
+}
+
+const char*
+URIs::unmap_uri(uint32_t urid)
+{
+ return g_quark_to_string(urid);
+}
+
} // namespace Shared
} // namespace Ingen