diff options
Diffstat (limited to 'dalos-textview.lua')
| -rw-r--r-- | dalos-textview.lua | 52 | 
1 files changed, 52 insertions, 0 deletions
diff --git a/dalos-textview.lua b/dalos-textview.lua new file mode 100644 index 0000000..496fd26 --- /dev/null +++ b/dalos-textview.lua @@ -0,0 +1,52 @@ +dalosp.textview = {    +    get_settings = function (self) +        return { } +    end, +     +    input_change = function (self) +        local h = self:get_linked_input(1) +         +        if h then +            self.extra.txt.value = h:readfile() +        else +            self.extra.txt.value = "" +        end +    end, +     +    activate = function (self) +        self.extra.dlg:show() +    end, +     +    create = function (d, tab, settings) +        tab.ninputs = 1 +        tab.noutputs = 0 +        tab.otype = dalos.objtype.LUA_VIEWER +        tab.activate = dalosp.textview.activate +        tab.input_change = dalosp.textview.input_change +        tab.default_name = "Text View" +        tab.ntype = "Text View" +        tab.get_settings = dalosp.textview.get_settings +        local extra = { } +         +        local obj = dalos.object(d, tab, extra) + +        local txt = iup.text { +            multiline = "Yes", +            readonly = "Yes", +            expand = "Yes", +            font = "Courier, 8" +        } +        local dlg = iup.dialog { +            txt, +            size = "320x200", +            title = obj.name +        } +        extra.dlg = dlg +        extra.txt = txt +         +        return obj +    end, +} + +dalos.textview = dalosp.textview.create +dalos:register_obj("Text View", dalos.textview, "Basic Viewers")  | 
