From 775500b709be0d14ad89f63970bf971d68c89407 Mon Sep 17 00:00:00 2001 From: Pixel Date: Sun, 20 Dec 2009 16:38:06 +0100 Subject: Introducing serialization / deserialization mechanism. --- dalos-hexview.lua | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'dalos-hexview.lua') diff --git a/dalos-hexview.lua b/dalos-hexview.lua index 381ffd4..f3111d7 100644 --- a/dalos-hexview.lua +++ b/dalos-hexview.lua @@ -34,6 +34,22 @@ dalosp.hexview = { configure = function (self) end, + get_settings = function (self) + local hv = extra.hv + local r = { + mcursor = hv.mcursor + 0, + kcursor = hv.kcursor + 0, + markers = {}, + filecursor = hv.filecursor + 0, + nbbytes = hv.nbbytes + 0, + nblines = hv.nblines + 0, + } + for i = 1, 10 do + rmarkers[i] = hv.markers[i] + 0 + end + return r + end, + output_change = function (self, ind) self.watchees[ind] = self.outputs[ind] and true or false end, @@ -87,12 +103,13 @@ dalosp.hexview = { end end, - create = function (d, tab) + create = function (d, tab, settings) 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.get_settings = dalosp.get_settings tab.ninputs = 1 tab.noutputs = 12 tab.default_name = "Hexview" @@ -114,6 +131,19 @@ dalosp.hexview = { obj.update_houtput = dalosp.hexview.update_houtput for i = 1, 12 do obj.oldcursors[i] = -1 end + if settings then + if settings.markers then + for i = 1, 10 do + hv.markers[i] = settings.markers[i] + end + end + hv.mcursor = settings.mcursor + hv.kcursor = settings.kcursor + hv.filecursor = settings.filecursor + hv.nbbytes = settings.nbbytes + hv.nblines = settings.nblines + end + hv:registercb(dalosp.hexview.dalos_hv_cb, obj) return obj -- cgit v1.2.3