From ee3cefaba5a2e5225ebbba855ecdcf1c668037de Mon Sep 17 00:00:00 2001 From: Pixel Date: Tue, 15 Dec 2009 10:58:06 -0800 Subject: Adding some text being displayed, and adding the About box. --- dalos.lua | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'dalos.lua') 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, -- cgit v1.2.3