From e35ec05baf3d3f8d490d9f2781f602499551a350 Mon Sep 17 00:00:00 2001 From: Pixel Date: Sun, 20 Dec 2009 16:58:11 +0100 Subject: Adding the textbuffer object. --- dalos-textbuffer.lua | 32 ++++++++++++++++++++++++++++++++ dalos.lua | 1 + 2 files changed, 33 insertions(+) create mode 100644 dalos-textbuffer.lua 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) diff --git a/dalos.lua b/dalos.lua index c2279db..5d13283 100644 --- a/dalos.lua +++ b/dalos.lua @@ -679,6 +679,7 @@ load "dalos-luahandle.lua" load "dalos-hexview.lua" load "dalos-binaryops.lua" load "dalos-limiter.lua" +load "dalos-textbuffer.lua" ---------------- -- cgit v1.2.3