summaryrefslogtreecommitdiffstats
path: root/src/PatchageModule.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-06-03 18:14:32 +0000
committerDavid Robillard <d@drobilla.net>2011-06-03 18:14:32 +0000
commit48eff0da05d4203013835ed500bade593f842557 (patch)
treec9d6f863b8105faee0a1a02e4bf1fb447e105ac6 /src/PatchageModule.cpp
parent352137726820a7313a6a64fa0a8e276b490ad932 (diff)
downloadpatchage-48eff0da05d4203013835ed500bade593f842557.tar.gz
patchage-48eff0da05d4203013835ed500bade593f842557.tar.bz2
patchage-48eff0da05d4203013835ed500bade593f842557.zip
Remove use of boost::enable_shared_from_this<Canvas>.
Instead, just store a pointer to the containing canvas in Items, since it should not be possible for an Item to outlive its containing Canvas anyway. Shrinks Item memory overhead a tad and gives a minor performance boost as an added bonus. git-svn-id: http://svn.drobilla.net/lad/trunk/patchage@3354 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/PatchageModule.cpp')
-rw-r--r--src/PatchageModule.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/PatchageModule.cpp b/src/PatchageModule.cpp
index f88dd7c..813a45d 100644
--- a/src/PatchageModule.cpp
+++ b/src/PatchageModule.cpp
@@ -22,7 +22,7 @@
PatchageModule::PatchageModule(
Patchage* app, const std::string& name, ModuleType type, double x, double y)
- : Module(app->canvas(), name, x, y)
+ : Module(*app->canvas().get(), name, x, y)
, _app(app)
, _type(type)
{
@@ -79,17 +79,13 @@ PatchageModule::create_menu()
void
PatchageModule::load_location()
{
- boost::shared_ptr<FlowCanvas::Canvas> canvas = _canvas.lock();
- if (!canvas)
- return;
-
Coord loc;
if (_app->state_manager()->get_module_location(_name, _type, loc))
move_to(loc.x, loc.y);
else
- move_to((canvas->width()/2) - 100 + rand() % 400,
- (canvas->height()/2) - 100 + rand() % 400);
+ move_to((_canvas->width()/2) - 100 + rand() % 400,
+ (_canvas->height()/2) - 100 + rand() % 400);
}
void