summaryrefslogtreecommitdiff
path: root/dalos.lua
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2009-12-15 10:58:06 -0800
committerPixel <pixel@nobis-crew.org>2009-12-15 10:58:06 -0800
commitee3cefaba5a2e5225ebbba855ecdcf1c668037de (patch)
tree3d7e2993da9a1fcc85fec9900cd6baf44be130a9 /dalos.lua
parent8f9b63e51203ffd78cd68e12833e1c74467ffa71 (diff)
Adding some text being displayed, and adding the About box.
Diffstat (limited to 'dalos.lua')
-rw-r--r--dalos.lua26
1 files changed, 24 insertions, 2 deletions
diff --git a/dalos.lua b/dalos.lua
index b9af1f5..b7f58a0 100644
--- a/dalos.lua
+++ b/dalos.lua
@@ -170,10 +170,23 @@ dalosp.menu = {
return iup.CLOSE
end,
+ action_about = function (self)
+ local dlg = iup.messagedlg {
+ DialogType = "Information",
+ ButtonDefault = "1",
+ Buttons = "OK",
+ Title = "About",
+ Value = 'DALOS (c) 2009-2010 Nicolas "Pixel" Noble.\nThis is free software with ABSOLUTELY NO WARRANTY.\nPlease look at the COPYRIGHT file for details.',
+ }
+ dlg:popup()
+ return iup.DEFAULT
+ end,
+
create = function (tab)
local item_exit = iup.item { title = "Exit" }
item_exit.action = dalosp.menu.action_exit
local item_about = iup.item { title = "About" }
+ item_about.action = dalosp.menu.action_about
local menu_file = iup.submenu { iup.menu { item_exit }, title = "File" }
local menu_help = iup.submenu { iup.menu { item_about }, title = "Help" }
return iup.menu { menu_file, menu_help }
@@ -182,9 +195,16 @@ dalosp.menu = {
dalosp.object = {
default_draw = function (self, cv, x, y, w, h )
- cv:Foreground(self.color)
local x1, x2, y1, y2 = x, x + w, y, y + h
- cv:Box(x1, x2, cv:InvertYAxis(y2), cv:InvertYAxis(y1))
+ y1, y2 = cv:InvertYAxis(y2), cv:InvertYAxis(y1)
+ local cx, cy = (x1 + x2) / 2, (y1 + y2) / 2
+ cv:Foreground(self.color)
+ cv:Box(x1, x2, y1, y2)
+ cv:Foreground(cd.BLACK)
+ cv:TextAlignment(cd.SOUTH) cv:Text(cx, y2, self.name)
+ cv:TextAlignment(cd.NORTH_EAST) cv:Text(x1, y1, self.inputs)
+ cv:TextAlignment(cd.NORTH_WEST) cv:Text(x2, y1, self.outputs)
+ cv:TextAlignment(cd.NORTH) cv:Text(cx, y1, self.quicksetting)
end,
default_activate = function (self)
@@ -199,9 +219,11 @@ dalosp.object = {
if not tab then tab = {} end
local obj = {
draw = dalosp.object.default_draw,
+ name = tab.name or "NoName",
color = tab.color or cd.GRAY,
inputs = tab.inpus or 0,
outputs = tab.outputs or 0,
+ quicksetting = 0,
otype = tab.otype or dalos.objtype.DUMMY,
activate = tab.activate or dalosp.object.default_activate,
configure = tab.configure or dalosp.object.default_configure,