From 198560d5fd499ab14eb4e130ee74e21fa86674a4 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 13 May 2011 02:57:36 +0000 Subject: Make models const in client code. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3259 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/PatchWindow.cpp | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'src/gui/PatchWindow.cpp') diff --git a/src/gui/PatchWindow.cpp b/src/gui/PatchWindow.cpp index ab8fcfd9..844cac81 100644 --- a/src/gui/PatchWindow.cpp +++ b/src/gui/PatchWindow.cpp @@ -189,7 +189,8 @@ PatchWindow::set_patch_from_path(const Path& path, SharedPtr view) assert(view->patch()->path() == path); App::instance().window_factory()->present_patch(view->patch(), this, view); } else { - SharedPtr model = PtrCast(App::instance().store()->object(path)); + SharedPtr model = PtrCast( + App::instance().store()->object(path)); if (model) App::instance().window_factory()->present_patch(model, this); } @@ -200,7 +201,8 @@ PatchWindow::set_patch_from_path(const Path& path, SharedPtr view) * If @a view is NULL, a new view will be created. */ void -PatchWindow::set_patch(SharedPtr patch, SharedPtr view) +PatchWindow::set_patch(SharedPtr patch, + SharedPtr view) { if (!patch || patch == _patch) return; @@ -271,7 +273,7 @@ PatchWindow::set_patch(SharedPtr patch, SharedPtr view) } void -PatchWindow::patch_port_added(SharedPtr port) +PatchWindow::patch_port_added(SharedPtr port) { if (port->is_input() && App::instance().can_control(port.get())) { _menu_view_control_window->property_sensitive() = true; @@ -279,7 +281,7 @@ PatchWindow::patch_port_added(SharedPtr port) } void -PatchWindow::patch_port_removed(SharedPtr port) +PatchWindow::patch_port_removed(SharedPtr port) { if (!(port->is_input() && App::instance().can_control(port.get()))) return; @@ -296,19 +298,19 @@ PatchWindow::patch_port_removed(SharedPtr port) } void -PatchWindow::show_status(ObjectModel* model) +PatchWindow::show_status(const ObjectModel* model) { std::stringstream msg; msg << model->path().chop_scheme(); - PortModel* port = 0; - NodeModel* node = 0; + const PortModel* port = 0; + const NodeModel* node = 0; - if ((port = dynamic_cast(model))) { + if ((port = dynamic_cast(model))) { show_port_status(port, port->value()); - } else if ((node = dynamic_cast(model))) { - PluginModel* plugin = dynamic_cast(node->plugin()); + } else if ((node = dynamic_cast(model))) { + const PluginModel* plugin = dynamic_cast(node->plugin()); if (plugin) msg << ((boost::format(" (%1%)") % plugin->human_name()).str()); _status_bar->push(msg.str(), STATUS_CONTEXT_HOVER); @@ -316,12 +318,12 @@ PatchWindow::show_status(ObjectModel* model) } void -PatchWindow::show_port_status(PortModel* port, const Raul::Atom& value) +PatchWindow::show_port_status(const PortModel* port, const Raul::Atom& value) { std::stringstream msg; msg << port->path().chop_scheme(); - NodeModel* parent = dynamic_cast(port->parent().get()); + const NodeModel* parent = dynamic_cast(port->parent().get()); if (parent) { const PluginModel* plugin = dynamic_cast(parent->plugin()); if (plugin) { @@ -340,13 +342,13 @@ PatchWindow::show_port_status(PortModel* port, const Raul::Atom& value) } void -PatchWindow::object_entered(ObjectModel* model) +PatchWindow::object_entered(const ObjectModel* model) { show_status(model); } void -PatchWindow::object_left(ObjectModel* model) +PatchWindow::object_left(const ObjectModel* model) { _status_bar->pop(STATUS_CONTEXT_HOVER); } @@ -462,7 +464,7 @@ PatchWindow::event_save_as() continue; } - _patch->set_property(uris.lv2_symbol, Atom(symbol.c_str())); + //_patch->set_property(uris.lv2_symbol, Atom(symbol.c_str())); bool confirm = true; if (Glib::file_test(filename, Glib::FILE_TEST_IS_DIR)) { @@ -495,7 +497,7 @@ more files and/or directories, recursively. Existing files will be overwritten. if (confirm) { const Glib::ustring uri = Glib::filename_to_uri(filename); App::instance().loader()->save_patch(_patch, uri); - _patch->set_property(uris.ingen_document, Atom(Atom::URI, uri.c_str())); + //_patch->set_property(uris.ingen_document, Atom(Atom::URI, uri.c_str())); _status_bar->push( (boost::format("Saved %1% to %2%") % _patch->path().chop_scheme() % filename).str(), -- cgit v1.2.1