diff options
| -rw-r--r-- | dalos.lua | 58 | 
1 files changed, 56 insertions, 2 deletions
| @@ -152,9 +152,11 @@ dalosp.canvas = {          end          if olddst then              olddst.obj.obj.outputs[olddst.ind] = nil +            olddst.obj.obj:output_change(olddst.ind)          end          src.obj.outputs[src.obj.curoutput] = { obj = dst, ind = dst.obj.curinput }          dst.obj.inputs[dst.obj.curinput] = { obj = src, ind = src.obj.curoutput } +        src.obj:output_change(src.obj.curoutput)          dst.obj:input_change(dst.obj.curinput)      end, @@ -371,9 +373,16 @@ dalosp.object = {      default_inputchange = function (self, ind)      end, +    default_outputchange = function (self, ind) +    end, +          set_houtput = function (self, h, ind)          if not ind then ind = 1 end          self.houtputs[ind] = h +        local obj = self.outputs[ind] +        if obj then +            obj.obj:input_change(obj.ind) +        end      end,      create = function (dcanvas, tab, extra) @@ -398,8 +407,8 @@ dalosp.object = {              extra = extra,              get_output = tab.getoutput or dalosp.object.default_getoutput,              input_change = tab.input_change or dalosp.object.default_inputchange, +            output_change = tab.output_change or dalosp.object.default_outputchange,              set_houtput = dalosp.object.set_houtput, -            get_outputx = nil,              houtputs = {},              get_linked_input = dalosp.object.get_linked_input,          } @@ -452,20 +461,65 @@ dalosp.hexview = {      configure = function (self)      end, +    output_change = function (self, ind) +    end, +     +    update_houtput = function (self, ind, cursor) +    end, +     +    dalos_hv_cb = function (self, hv, reset) +        if reset then +            local h, o = self.houtputs +            for i = 1, 12 do +                self.oldcursors[i] = -1 +            end +        end +         +        local m +        for i = 1, 10 do +            m = hv.markers[i] +            if self.oldcursors[i] ~= m then +                self:update_houtput(i, m) +                self.oldcursors[i] = m +            end +        end +         +        m = hv.kcursor +        if self.oldcursors[11] ~= m then +            self:update_houtput(11, m) +            self.oldcursors[11] = m +        end +         +        m = hv.mcursor +        if self.oldcursors[12] ~= m then +            self:update_houtput(12, m) +            self.oldcursors[12] = m +        end +    end, +          create = function (d, tab)          if not tab.name then tab.name = "Hexview" end          tab.otype = dalos.objtype.LUA_FILTER          tab.activate = dalosp.hexview.activate          tab.input_change = dalosp.hexview.input_change +        tab.output_change = dalosp.hexview.output_change          tab.configure = dalosp.hexview.configure          tab.ninputs = 1          tab.noutputs = 12 +                  local hv = iupe.hexview { }          local hvtb = iupe.hexview_toolbox { hexview = hv }          local hvdlg = iup.dialog { iup.hbox { iup.frame { hv }, iup.sbox { direction = "WEST", hvtb } }, title = tab.name } -        return dalos.object(d, tab, { hv = hv, hvtb = hvtb, hvdlg = hvdlg }) +        local obj = dalos.object(d, tab, { hv = hv, hvtb = hvtb, hvdlg = hvdlg }) +        obj.oldcursors = { } +        obj.update_houtput = dalosp.hexview.update_houtput +        for i = 1, 12 do obj.oldcursors[i] = -1 end +         +        hv:registercb(dalosp.hexview.dalos_hv_cb, obj) +         +        return obj      end,  } | 
