diff options
author | David Robillard <d@drobilla.net> | 2019-12-08 18:03:43 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-12-08 20:59:06 +0100 |
commit | c35cbf038d0992887b8d4bcf5d4ff83c323ec60c (patch) | |
tree | 02384c6a8671e866a54cbd9f6002a3dd145116b9 /src/gui | |
parent | 8215246d12f49573f7ebcdc62ddae84185c22bfe (diff) | |
download | ingen-c35cbf038d0992887b8d4bcf5d4ff83c323ec60c.tar.gz ingen-c35cbf038d0992887b8d4bcf5d4ff83c323ec60c.tar.bz2 ingen-c35cbf038d0992887b8d4bcf5d4ff83c323ec60c.zip |
Cleanup: Avoid parameter copying overhead
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/GraphCanvas.cpp | 16 | ||||
-rw-r--r-- | src/gui/GraphCanvas.hpp | 16 | ||||
-rw-r--r-- | src/gui/GraphPortModule.cpp | 7 | ||||
-rw-r--r-- | src/gui/GraphPortModule.hpp | 9 | ||||
-rw-r--r-- | src/gui/GraphTreeWindow.cpp | 18 | ||||
-rw-r--r-- | src/gui/GraphTreeWindow.hpp | 16 | ||||
-rw-r--r-- | src/gui/GraphView.cpp | 4 | ||||
-rw-r--r-- | src/gui/GraphView.hpp | 6 | ||||
-rw-r--r-- | src/gui/LoadGraphWindow.cpp | 8 | ||||
-rw-r--r-- | src/gui/LoadGraphWindow.hpp | 8 |
10 files changed, 53 insertions, 55 deletions
diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp index 0c33072f..13b17bdf 100644 --- a/src/gui/GraphCanvas.cpp +++ b/src/gui/GraphCanvas.cpp @@ -307,7 +307,7 @@ GraphCanvas::show_port_names(bool b) } void -GraphCanvas::add_plugin(SPtr<PluginModel> p) +GraphCanvas::add_plugin(const SPtr<PluginModel>& p) { if (_internal_menu && _app.uris().ingen_Internal == p->type()) { _internal_menu->items().push_back( @@ -327,7 +327,7 @@ GraphCanvas::remove_plugin(const URI& uri) } void -GraphCanvas::add_block(SPtr<const BlockModel> bm) +GraphCanvas::add_block(const SPtr<const BlockModel>& bm) { SPtr<const GraphModel> pm = dynamic_ptr_cast<const GraphModel>(bm); NodeModule* module; @@ -345,7 +345,7 @@ GraphCanvas::add_block(SPtr<const BlockModel> bm) } void -GraphCanvas::remove_block(SPtr<const BlockModel> bm) +GraphCanvas::remove_block(const SPtr<const BlockModel>& bm) { auto i = _views.find(bm); @@ -360,7 +360,7 @@ GraphCanvas::remove_block(SPtr<const BlockModel> bm) } void -GraphCanvas::add_port(SPtr<const PortModel> pm) +GraphCanvas::add_port(const SPtr<const PortModel>& pm) { GraphPortModule* view = GraphPortModule::create(*this, pm); _views.emplace(pm, view); @@ -368,7 +368,7 @@ GraphCanvas::add_port(SPtr<const PortModel> pm) } void -GraphCanvas::remove_port(SPtr<const PortModel> pm) +GraphCanvas::remove_port(const SPtr<const PortModel>& pm) { auto i = _views.find(pm); @@ -386,7 +386,7 @@ GraphCanvas::remove_port(SPtr<const PortModel> pm) } Ganv::Port* -GraphCanvas::get_port_view(SPtr<PortModel> port) +GraphCanvas::get_port_view(const SPtr<PortModel>& port) { Ganv::Module* module = _views[port]; @@ -413,7 +413,7 @@ GraphCanvas::get_port_view(SPtr<PortModel> port) /** Called when a connection is added to the model. */ void -GraphCanvas::connection(SPtr<const ArcModel> arc) +GraphCanvas::connection(const SPtr<const ArcModel>& arc) { Ganv::Port* const tail = get_port_view(arc->tail()); Ganv::Port* const head = get_port_view(arc->head()); @@ -428,7 +428,7 @@ GraphCanvas::connection(SPtr<const ArcModel> arc) /** Called when a connection is removed from the model. */ void -GraphCanvas::disconnection(SPtr<const ArcModel> arc) +GraphCanvas::disconnection(const SPtr<const ArcModel>& arc) { Ganv::Port* const tail = get_port_view(arc->tail()); Ganv::Port* const head = get_port_view(arc->head()); diff --git a/src/gui/GraphCanvas.hpp b/src/gui/GraphCanvas.hpp index 9047a373..7aa4bb98 100644 --- a/src/gui/GraphCanvas.hpp +++ b/src/gui/GraphCanvas.hpp @@ -61,14 +61,14 @@ public: void show_port_names(bool b); bool show_port_names() const { return _show_port_names; } - void add_plugin(SPtr<client::PluginModel> p); + void add_plugin(const SPtr<client::PluginModel>& p); void remove_plugin(const URI& uri); - void add_block(SPtr<const client::BlockModel> bm); - void remove_block(SPtr<const client::BlockModel> bm); - void add_port(SPtr<const client::PortModel> pm); - void remove_port(SPtr<const client::PortModel> pm); - void connection(SPtr<const client::ArcModel> arc); - void disconnection(SPtr<const client::ArcModel> arc); + void add_block(const SPtr<const client::BlockModel>& bm); + void remove_block(const SPtr<const client::BlockModel>& bm); + void add_port(const SPtr<const client::PortModel>& pm); + void remove_port(const SPtr<const client::PortModel>& pm); + void connection(const SPtr<const client::ArcModel>& arc); + void disconnection(const SPtr<const client::ArcModel>& arc); void get_new_module_location(double& x, double& y); @@ -106,7 +106,7 @@ private: Properties get_initial_data(Resource::Graph ctx=Resource::Graph::DEFAULT); - Ganv::Port* get_port_view(SPtr<client::PortModel> port); + Ganv::Port* get_port_view(const SPtr<client::PortModel>& port); void connect(Ganv::Node* tail, Ganv::Node* head); diff --git a/src/gui/GraphPortModule.cpp b/src/gui/GraphPortModule.cpp index ffca1834..1947f355 100644 --- a/src/gui/GraphPortModule.cpp +++ b/src/gui/GraphPortModule.cpp @@ -40,8 +40,8 @@ using namespace client; namespace gui { -GraphPortModule::GraphPortModule(GraphCanvas& canvas, - SPtr<const client::PortModel> model) +GraphPortModule::GraphPortModule(GraphCanvas& canvas, + const SPtr<const client::PortModel>& model) : Ganv::Module(canvas, "", 0, 0, false) // FIXME: coords? , _model(model) , _port(nullptr) @@ -63,8 +63,7 @@ GraphPortModule::GraphPortModule(GraphCanvas& canvas, } GraphPortModule* -GraphPortModule::create(GraphCanvas& canvas, - SPtr<const PortModel> model) +GraphPortModule::create(GraphCanvas& canvas, const SPtr<const PortModel>& model) { GraphPortModule* ret = new GraphPortModule(canvas, model); Port* port = Port::create(canvas.app(), *ret, model, true); diff --git a/src/gui/GraphPortModule.hpp b/src/gui/GraphPortModule.hpp index 6400b327..cad3bfc5 100644 --- a/src/gui/GraphPortModule.hpp +++ b/src/gui/GraphPortModule.hpp @@ -45,9 +45,8 @@ class PortMenu; class GraphPortModule : public Ganv::Module { public: - static GraphPortModule* create( - GraphCanvas& canvas, - SPtr<const client::PortModel> model); + static GraphPortModule* + create(GraphCanvas& canvas, const SPtr<const client::PortModel>& model); App& app() const; @@ -59,8 +58,8 @@ public: SPtr<const client::PortModel> port() const { return _model; } protected: - GraphPortModule(GraphCanvas& canvas, - SPtr<const client::PortModel> model); + GraphPortModule(GraphCanvas& canvas, + const SPtr<const client::PortModel>& model); bool show_menu(GdkEventButton* ev); void set_selected(gboolean b) override; diff --git a/src/gui/GraphTreeWindow.cpp b/src/gui/GraphTreeWindow.cpp index 7d00b0f5..5046eac9 100644 --- a/src/gui/GraphTreeWindow.cpp +++ b/src/gui/GraphTreeWindow.cpp @@ -73,7 +73,7 @@ GraphTreeWindow::init(App& app, ClientStore& store) } void -GraphTreeWindow::new_object(SPtr<ObjectModel> object) +GraphTreeWindow::new_object(const SPtr<ObjectModel>& object) { SPtr<GraphModel> graph = dynamic_ptr_cast<GraphModel>(object); if (graph) { @@ -82,7 +82,7 @@ GraphTreeWindow::new_object(SPtr<ObjectModel> object) } void -GraphTreeWindow::add_graph(SPtr<GraphModel> pm) +GraphTreeWindow::add_graph(const SPtr<GraphModel>& pm) { if (!pm->parent()) { Gtk::TreeModel::iterator iter = _graph_treestore->append(); @@ -123,7 +123,7 @@ GraphTreeWindow::add_graph(SPtr<GraphModel> pm) } void -GraphTreeWindow::remove_graph(SPtr<GraphModel> pm) +GraphTreeWindow::remove_graph(const SPtr<GraphModel>& pm) { Gtk::TreeModel::iterator i = find_graph(_graph_treestore->children(), pm); if (i != _graph_treestore->children().end()) { @@ -132,8 +132,8 @@ GraphTreeWindow::remove_graph(SPtr<GraphModel> pm) } Gtk::TreeModel::iterator -GraphTreeWindow::find_graph(Gtk::TreeModel::Children root, - SPtr<client::ObjectModel> graph) +GraphTreeWindow::find_graph(Gtk::TreeModel::Children root, + const SPtr<client::ObjectModel>& graph) { for (Gtk::TreeModel::iterator c = root.begin(); c != root.end(); ++c) { SPtr<GraphModel> pm = (*c)[_graph_tree_columns.graph_model_col]; @@ -193,9 +193,9 @@ GraphTreeWindow::event_graph_enabled_toggled(const Glib::ustring& path_str) } void -GraphTreeWindow::graph_property_changed(const URI& key, - const Atom& value, - SPtr<GraphModel> graph) +GraphTreeWindow::graph_property_changed(const URI& key, + const Atom& value, + const SPtr<GraphModel>& graph) { const URIs& uris = _app->uris(); _enable_signal = false; @@ -212,7 +212,7 @@ GraphTreeWindow::graph_property_changed(const URI& key, } void -GraphTreeWindow::graph_moved(SPtr<GraphModel> graph) +GraphTreeWindow::graph_moved(const SPtr<GraphModel>& graph) { _enable_signal = false; diff --git a/src/gui/GraphTreeWindow.hpp b/src/gui/GraphTreeWindow.hpp index eb5a5f78..c1ea53c2 100644 --- a/src/gui/GraphTreeWindow.hpp +++ b/src/gui/GraphTreeWindow.hpp @@ -47,16 +47,16 @@ public: void init(App& app, client::ClientStore& store); - void new_object(SPtr<client::ObjectModel> object); + void new_object(const SPtr<client::ObjectModel>& object); - void graph_property_changed(const URI& key, - const Atom& value, - SPtr<client::GraphModel> graph); + void graph_property_changed(const URI& key, + const Atom& value, + const SPtr<client::GraphModel>& graph); - void graph_moved(SPtr<client::GraphModel> graph); + void graph_moved(const SPtr<client::GraphModel>& graph); - void add_graph(SPtr<client::GraphModel> pm); - void remove_graph(SPtr<client::GraphModel> pm); + void add_graph(const SPtr<client::GraphModel>& pm); + void remove_graph(const SPtr<client::GraphModel>& pm); void show_graph_menu(GdkEventButton* ev); protected: @@ -67,7 +67,7 @@ protected: Gtk::TreeModel::iterator find_graph( Gtk::TreeModel::Children root, - SPtr<client::ObjectModel> graph); + const SPtr<client::ObjectModel>& graph); GraphTreeView* _graphs_treeview; diff --git a/src/gui/GraphView.cpp b/src/gui/GraphView.cpp index 9e39ef7c..36c6caed 100644 --- a/src/gui/GraphView.cpp +++ b/src/gui/GraphView.cpp @@ -66,7 +66,7 @@ GraphView::init(App& app) } void -GraphView::set_graph(SPtr<const GraphModel> graph) +GraphView::set_graph(const SPtr<const GraphModel>& graph) { assert(!_canvas); // FIXME: remove @@ -101,7 +101,7 @@ GraphView::set_graph(SPtr<const GraphModel> graph) } SPtr<GraphView> -GraphView::create(App& app, SPtr<const GraphModel> graph) +GraphView::create(App& app, const SPtr<const GraphModel>& graph) { GraphView* result = nullptr; Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create("warehouse_win"); diff --git a/src/gui/GraphView.hpp b/src/gui/GraphView.hpp index 8c62ba3d..457a5f76 100644 --- a/src/gui/GraphView.hpp +++ b/src/gui/GraphView.hpp @@ -69,11 +69,11 @@ public: SPtr<const client::GraphModel> graph() const { return _graph; } Gtk::ToolItem* breadcrumb_container() const { return _breadcrumb_container; } - static SPtr<GraphView> create(App& app, - SPtr<const client::GraphModel> graph); + static SPtr<GraphView> + create(App& app, const SPtr<const client::GraphModel>& graph); private: - void set_graph(SPtr<const client::GraphModel> graph); + void set_graph(const SPtr<const client::GraphModel>& graph); void process_toggled(); void poly_changed(); diff --git a/src/gui/LoadGraphWindow.cpp b/src/gui/LoadGraphWindow.cpp index fb1dc9ff..e3588ddf 100644 --- a/src/gui/LoadGraphWindow.cpp +++ b/src/gui/LoadGraphWindow.cpp @@ -97,9 +97,9 @@ LoadGraphWindow::LoadGraphWindow(BaseObjectType* cobject, } void -LoadGraphWindow::present(SPtr<const GraphModel> graph, - bool import, - Properties data) +LoadGraphWindow::present(const SPtr<const GraphModel>& graph, + bool import, + const Properties& data) { _import = import; set_graph(graph); @@ -117,7 +117,7 @@ LoadGraphWindow::present(SPtr<const GraphModel> graph, * This function MUST be called before using the window in any way! */ void -LoadGraphWindow::set_graph(SPtr<const GraphModel> graph) +LoadGraphWindow::set_graph(const SPtr<const GraphModel>& graph) { _graph = graph; _symbol_entry->set_text(""); diff --git a/src/gui/LoadGraphWindow.hpp b/src/gui/LoadGraphWindow.hpp index 32d435ad..a2217d83 100644 --- a/src/gui/LoadGraphWindow.hpp +++ b/src/gui/LoadGraphWindow.hpp @@ -50,11 +50,11 @@ public: void init(App& app) { _app = &app; } - void set_graph(SPtr<const client::GraphModel> graph); + void set_graph(const SPtr<const client::GraphModel>& graph); - void present(SPtr<const client::GraphModel> graph, - bool import, - Properties data); + void present(const SPtr<const client::GraphModel>& graph, + bool import, + const Properties& data); protected: void on_show() override; |