summaryrefslogtreecommitdiff
path: root/dalos-textbuffer.lua
blob: 2bda77f61c2bf36be78ca8ffc6e1dc9679b54780 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
dalosp.textbuffer = {   
    get_settings = function (self)
        return { text = self.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.ntype = "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)
        
        return obj
    end,
}

dalos.textbuffer = dalosp.textbuffer.create
dalos:register_obj("Text Buffer", dalos.textbuffer, "Basic Inputs")