summaryrefslogtreecommitdiff
path: root/dalos.lua
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2009-12-15 17:45:05 -0800
committerPixel <pixel@nobis-crew.org>2009-12-15 17:45:05 -0800
commit5a1ff8177da1cba4eccc006ffb8c3ba78065ef97 (patch)
tree52f156e81821a82de2b4c1d39eada9a8f787492b /dalos.lua
parentfcaf4590ac43d559048bd92ec1e096d5d875bed8 (diff)
Adding a little bit more visibility over the objects.
Diffstat (limited to 'dalos.lua')
-rw-r--r--dalos.lua17
1 files changed, 14 insertions, 3 deletions
diff --git a/dalos.lua b/dalos.lua
index 6594e0e..cd2c849 100644
--- a/dalos.lua
+++ b/dalos.lua
@@ -162,16 +162,22 @@ dalosp.canvas = {
if self.stateful.rghtbutton then
self.stateful.panning = true
else
- self.stateful.leftclk = self:findobj(x,y)
+ local obj, ind = self:findobj(x, y)
+ self.stateful.leftclk = obj
+ table.remove(self.objects, ind)
+ table.insert(self.objects, obj)
self.ox, self.oy = x, y
self.bx, self.by = x, y
+ self:draw()
end
else
if not self.stateful.linking and self.stateful.leftclk and not self.stateful.dragging then
self.stateful.leftclk.obj:activate()
elseif self.stateful.linking then
local dest = self:findobj(x,y)
- if dest == self.stateful.linking then
+ if not dest then
+ -- just do nothing, huh...
+ elseif dest == self.stateful.linking then
self:setstatus(dalosp.canvas.stypes.ERROR, "Can't link: origin is the same as destination")
elseif dest.obj.ninputs <= 0 then
self:setstatus(dalosp.canvas.stypes.ERROR, "Can't link: destination has no input")
@@ -195,9 +201,13 @@ dalosp.canvas = {
if self.stateful.leftbutton then
self.stateful.panning = true
else
- self.stateful.rghtclk = self:findobj(x, y)
+ local obj, ind = self:findobj(x, y)
+ self.stateful.rghtclk = obj
+ table.remove(self.objects, ind)
+ table.insert(self.objects, obj)
self.ox, self.oy = x, y
self.bx, self.by = x, y
+ self:draw()
end
else
if not self.stateful.moving and self.stateful.rghtclk and not self.stateful.dragging then
@@ -297,6 +307,7 @@ dalosp.object = {
cv:Foreground(self.color)
cv:Box(x1, x2, y1, y2)
cv:Foreground(cd.BLACK)
+ cv:Rect(x1, x2, y1, y2)
cv:TextAlignment(cd.SOUTH)
cv:Text(cx, y2, self.name)
cv:TextAlignment(cd.NORTH)