summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-06-10 01:45:19 +0000
committerDavid Robillard <d@drobilla.net>2011-06-10 01:45:19 +0000
commit15611d1f9d7a6aba34b70ccaf63f564d565b55f3 (patch)
tree28b1e5ecb67fb5807d607a2e38e691884c121c56 /src/gui
parent49bd2b972d10cfab035805d7ffae77e056569c66 (diff)
downloadingen-15611d1f9d7a6aba34b70ccaf63f564d565b55f3.tar.gz
ingen-15611d1f9d7a6aba34b70ccaf63f564d565b55f3.tar.bz2
ingen-15611d1f9d7a6aba34b70ccaf63f564d565b55f3.zip
Avoid resizing entirely when adding a port and new size/etc is simple to compute.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3382 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/NodeModule.cpp8
-rw-r--r--src/gui/NodeModule.hpp2
-rw-r--r--src/gui/PatchCanvas.cpp19
-rw-r--r--src/gui/PatchCanvas.hpp2
-rw-r--r--src/gui/PatchPortModule.cpp6
-rw-r--r--src/gui/PatchPortModule.hpp6
-rw-r--r--src/gui/Port.cpp4
-rw-r--r--src/gui/Port.hpp10
8 files changed, 30 insertions, 27 deletions
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index e634793c..07d759c5 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -86,18 +86,18 @@ NodeModule::create_menu()
set_menu(_menu);
}
-boost::shared_ptr<NodeModule>
+NodeModule*
NodeModule::create(PatchCanvas& canvas,
SharedPtr<const NodeModel> node,
bool human)
{
- boost::shared_ptr<NodeModule> ret;
+ NodeModule* ret;
SharedPtr<const PatchModel> patch = PtrCast<const PatchModel>(node);
if (patch)
- ret = boost::shared_ptr<NodeModule>(new SubpatchModule(canvas, patch));
+ ret = new SubpatchModule(canvas, patch);
else
- ret = boost::shared_ptr<NodeModule>(new NodeModule(canvas, node));
+ ret = new NodeModule(canvas, node);
for (GraphObject::Properties::const_iterator m = node->properties().begin();
m != node->properties().end(); ++m)
diff --git a/src/gui/NodeModule.hpp b/src/gui/NodeModule.hpp
index db6fb274..d275b648 100644
--- a/src/gui/NodeModule.hpp
+++ b/src/gui/NodeModule.hpp
@@ -49,7 +49,7 @@ class NodeMenu;
class NodeModule : public FlowCanvas::Module
{
public:
- static boost::shared_ptr<NodeModule> create(
+ static NodeModule* create(
PatchCanvas& canvas,
SharedPtr<const NodeModel> node,
bool human_names);
diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp
index 0b5d4056..13836154 100644
--- a/src/gui/PatchCanvas.cpp
+++ b/src/gui/PatchCanvas.cpp
@@ -380,7 +380,7 @@ void
PatchCanvas::add_node(SharedPtr<const NodeModel> nm)
{
SharedPtr<const PatchModel> pm = PtrCast<const PatchModel>(nm);
- SharedPtr<NodeModule> module;
+ NodeModule* module;
if (pm) {
module = SubpatchModule::create(*this, pm, _human_names);
} else {
@@ -400,6 +400,7 @@ PatchCanvas::remove_node(SharedPtr<const NodeModel> nm)
Views::iterator i = _views.find(nm);
if (i != _views.end()) {
+ delete i->second;
_views.erase(i);
}
}
@@ -407,7 +408,7 @@ PatchCanvas::remove_node(SharedPtr<const NodeModel> nm)
void
PatchCanvas::add_port(SharedPtr<const PortModel> pm)
{
- SharedPtr<PatchPortModule> view = PatchPortModule::create(*this, pm, _human_names);
+ PatchPortModule* view = PatchPortModule::create(*this, pm, _human_names);
_views.insert(std::make_pair(pm, view));
view->show();
}
@@ -419,10 +420,11 @@ PatchCanvas::remove_port(SharedPtr<const PortModel> pm)
// Port on this patch
if (i != _views.end()) {
+ delete i->second;
_views.erase(i);
} else {
- SharedPtr<NodeModule> module = PtrCast<NodeModule>(_views[pm->parent()]);
+ NodeModule* module = dynamic_cast<NodeModule*>(_views[pm->parent()]);
module->delete_port_view(pm);
}
@@ -432,15 +434,16 @@ PatchCanvas::remove_port(SharedPtr<const PortModel> pm)
FlowCanvas::Port*
PatchCanvas::get_port_view(SharedPtr<PortModel> port)
{
- SharedPtr<FlowCanvas::Module> module = _views[port];
+ FlowCanvas::Module* module = _views[port];
// Port on this patch
if (module) {
- return (dynamic_cast<PatchPortModule*>(module.get()))
- ? *(dynamic_cast<PatchPortModule*>(module.get())->ports().begin())
- : dynamic_cast<FlowCanvas::Port*>(module.get());
+ PatchPortModule* ppm = dynamic_cast<PatchPortModule*>(module);
+ return ppm
+ ? *ppm->ports().begin()
+ : dynamic_cast<FlowCanvas::Port*>(module);
} else {
- module = PtrCast<NodeModule>(_views[port->parent()]);
+ module = dynamic_cast<NodeModule*>(_views[port->parent()]);
if (module) {
for (Module::Ports::const_iterator p = module->ports().begin();
p != module->ports().end(); ++p) {
diff --git a/src/gui/PatchCanvas.hpp b/src/gui/PatchCanvas.hpp
index 243f76ae..e20aa96b 100644
--- a/src/gui/PatchCanvas.hpp
+++ b/src/gui/PatchCanvas.hpp
@@ -135,7 +135,7 @@ private:
SharedPtr<const PatchModel> _patch;
typedef std::map<SharedPtr<const ObjectModel>,
- SharedPtr<FlowCanvas::Module>
+ FlowCanvas::Module*
> Views;
Views _views;
diff --git a/src/gui/PatchPortModule.cpp b/src/gui/PatchPortModule.cpp
index 49dc4925..08889d8d 100644
--- a/src/gui/PatchPortModule.cpp
+++ b/src/gui/PatchPortModule.cpp
@@ -53,13 +53,13 @@ PatchPortModule::PatchPortModule(PatchCanvas& canvas,
sigc::mem_fun(this, &PatchPortModule::property_changed));
}
-boost::shared_ptr<PatchPortModule>
+PatchPortModule*
PatchPortModule::create(PatchCanvas& canvas,
SharedPtr<const PortModel> model,
bool human)
{
- boost::shared_ptr<PatchPortModule> ret(new PatchPortModule(canvas, model));
- boost::shared_ptr<Port> port(Port::create(*ret, model, human, true));
+ PatchPortModule* ret = new PatchPortModule(canvas, model);
+ Port* port = Port::create(*ret, model, human, true);
ret->set_port(port);
ret->set_menu(port->menu());
diff --git a/src/gui/PatchPortModule.hpp b/src/gui/PatchPortModule.hpp
index 9334c48f..42607315 100644
--- a/src/gui/PatchPortModule.hpp
+++ b/src/gui/PatchPortModule.hpp
@@ -49,7 +49,7 @@ class PortMenu;
class PatchPortModule : public FlowCanvas::Module
{
public:
- static boost::shared_ptr<PatchPortModule> create(
+ static PatchPortModule* create(
PatchCanvas& canvas,
SharedPtr<const PortModel> model,
bool human);
@@ -68,12 +68,12 @@ protected:
void create_menu();
void set_selected(bool b);
- void set_port(SharedPtr<Port> port) { _port = port; }
+ void set_port(Port* port) { _port = port; }
void property_changed(const Raul::URI& predicate, const Raul::Atom& value);
SharedPtr<const PortModel> _model;
- SharedPtr<Port> _port;
+ Port* _port;
PortMenu* _menu;
};
diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp
index 72c37b12..bc623950 100644
--- a/src/gui/Port.cpp
+++ b/src/gui/Port.cpp
@@ -40,7 +40,7 @@ namespace GUI {
ArtVpathDash* Port::_dash;
-SharedPtr<Port>
+Port*
Port::create(FlowCanvas::Module& module,
SharedPtr<const PortModel> pm,
bool human_name,
@@ -57,7 +57,7 @@ Port::create(FlowCanvas::Module& module,
label = parent->plugin_model()->port_human_name(pm->index());
}
}
- return SharedPtr<Port>(new Port(module, pm, label, flip));
+ return new Port(module, pm, label, flip);
}
/** @a flip Make an input port appear as an output port, and vice versa.
diff --git a/src/gui/Port.hpp b/src/gui/Port.hpp
index 17b1c37b..3bc66cd3 100644
--- a/src/gui/Port.hpp
+++ b/src/gui/Port.hpp
@@ -40,11 +40,11 @@ namespace GUI {
class Port : public FlowCanvas::Port
{
public:
- static SharedPtr<Port> create(
- FlowCanvas::Module& module,
- SharedPtr<const PortModel> pm,
- bool human_name,
- bool flip = false);
+ static Port* create(
+ FlowCanvas::Module& module,
+ SharedPtr<const PortModel> pm,
+ bool human_name,
+ bool flip = false);
~Port();