summaryrefslogtreecommitdiff
path: root/dalos-textbuffer.lua
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2009-12-20 16:58:11 +0100
committerPixel <pixel@nobis-crew.org>2009-12-20 16:58:11 +0100
commite35ec05baf3d3f8d490d9f2781f602499551a350 (patch)
treea367bb518162245fd6ae80ae6f0de29d1b89b426 /dalos-textbuffer.lua
parentf2d8c3a51f11bd63547d0b6de9c16f297a17001f (diff)
Adding the textbuffer object.
Diffstat (limited to 'dalos-textbuffer.lua')
-rw-r--r--dalos-textbuffer.lua32
1 files changed, 32 insertions, 0 deletions
diff --git a/dalos-textbuffer.lua b/dalos-textbuffer.lua
new file mode 100644
index 0000000..b1e3c03
--- /dev/null
+++ b/dalos-textbuffer.lua
@@ -0,0 +1,32 @@
+dalosp.textbuffer = {
+ get_settings = function (self)
+ return { text = extra.text }
+ end,
+
+ activate = function (self)
+ local text = self.extra.text or ""
+ text = iup.GetText(self.name, text)
+ if text then
+ self.extra.text = text
+ local b = Buffer(true)
+ b:write(text)
+ self.set_houtput(b)
+ end
+ end,
+
+ create = function (d, tab, settings)
+ tab.ninputs = 0
+ tab.noutputs = 1
+ tab.otype = dalos.objtype.HANDLE
+ tab.activate = dalosp.textbuffer.activate
+ tab.default_name = "Text Buffer"
+ tab.get_settings = dalosp.textbuffer.get_settings
+ local extra = { }
+ if settings then extra.text = settings.text end
+
+ local obj = dalos.object(d, tab, extra)
+ end,
+}
+
+dalos.textbuffer = dalosp.textbuffer.create
+dalos:register_obj("Text Buffer", dalos.textbuffer)