diff options
-rw-r--r-- | dalos-binaryops.lua | 2 | ||||
-rw-r--r-- | dalos-buffer.lua | 2 | ||||
-rw-r--r-- | dalos-hexview.lua | 2 | ||||
-rw-r--r-- | dalos-input.lua | 2 | ||||
-rw-r--r-- | dalos-limiter.lua | 2 | ||||
-rw-r--r-- | dalos-luafilter.lua | 2 | ||||
-rw-r--r-- | dalos-tee.lua | 2 | ||||
-rw-r--r-- | dalos-textbuffer.lua | 2 | ||||
-rw-r--r-- | dalos.lua | 49 |
9 files changed, 51 insertions, 14 deletions
diff --git a/dalos-binaryops.lua b/dalos-binaryops.lua index 59e8361..c739450 100644 --- a/dalos-binaryops.lua +++ b/dalos-binaryops.lua @@ -111,4 +111,4 @@ Maximize: %b[No,Yes]{Check if you want to maximize the output} } dalos.binaryops = dalosp.binaryops.create -dalos:register_obj("Binary Ops", dalos.binaryops) +dalos:register_obj("Binary Ops", dalos.binaryops, "Basic Filters") diff --git a/dalos-buffer.lua b/dalos-buffer.lua index 8abcadc..3743f46 100644 --- a/dalos-buffer.lua +++ b/dalos-buffer.lua @@ -27,4 +27,4 @@ dalosp.buffer = { } dalos.buffer = dalosp.buffer.create -dalos:register_obj("Buffer", dalos.buffer) +dalos:register_obj("Buffer", dalos.buffer, "Basic Filters") diff --git a/dalos-hexview.lua b/dalos-hexview.lua index cfd8652..79f2a08 100644 --- a/dalos-hexview.lua +++ b/dalos-hexview.lua @@ -157,4 +157,4 @@ dalosp.hexview = { } dalos.hexview = dalosp.hexview.create -dalos:register_obj("Hexview", dalos.hexview) +dalos:register_obj("Hexview", dalos.hexview, "Basic Viewers") diff --git a/dalos-input.lua b/dalos-input.lua index 625dcab..bf37b9d 100644 --- a/dalos-input.lua +++ b/dalos-input.lua @@ -41,4 +41,4 @@ dalosp.input = { } dalos.input = dalosp.input.create -dalos:register_obj("Input", dalos.input) +dalos:register_obj("Input", dalos.input, "Basic Inputs") diff --git a/dalos-limiter.lua b/dalos-limiter.lua index 5badfbb..5643f30 100644 --- a/dalos-limiter.lua +++ b/dalos-limiter.lua @@ -57,4 +57,4 @@ Limit: %i{The actual size this limiter is going to produce} } dalos.limiter = dalosp.limiter.create -dalos:register_obj("Limiter", dalos.limiter) +dalos:register_obj("Limiter", dalos.limiter, "Basic Filters") diff --git a/dalos-luafilter.lua b/dalos-luafilter.lua index 20f4f99..8181442 100644 --- a/dalos-luafilter.lua +++ b/dalos-luafilter.lua @@ -135,4 +135,4 @@ end } dalos.luafilter = dalosp.luafilter.create -dalos:register_obj("Lua Filter", dalos.luafilter) +dalos:register_obj("Lua Filter", dalos.luafilter, "Programmable") diff --git a/dalos-tee.lua b/dalos-tee.lua index 1d75fb2..b5193c0 100644 --- a/dalos-tee.lua +++ b/dalos-tee.lua @@ -47,4 +47,4 @@ dalosp.tee = { } dalos.tee = dalosp.tee.create -dalos:register_obj("Tee", dalos.tee) +dalos:register_obj("Tee", dalos.tee, "Basic Filters") diff --git a/dalos-textbuffer.lua b/dalos-textbuffer.lua index a5a4f40..2bda77f 100644 --- a/dalos-textbuffer.lua +++ b/dalos-textbuffer.lua @@ -32,4 +32,4 @@ dalosp.textbuffer = { } dalos.textbuffer = dalosp.textbuffer.create -dalos:register_obj("Text Buffer", dalos.textbuffer) +dalos:register_obj("Text Buffer", dalos.textbuffer, "Basic Inputs") @@ -38,7 +38,7 @@ function dalos:register_obj(name, constructor, category) if self.objectstypes_by_name[name] then error("An object type of that name already exists: " .. name) end - table.insert(self.objectstypes, { name = name, constructor = constructor, counter = 1, category = category or "Basic" }) + table.insert(self.objectstypes, { name = name, constructor = constructor, counter = 1, category = category }) self.objectstypes_by_name[name] = #self.objectstypes if self.activemenu then self.activemenu:update_objects() @@ -677,22 +677,59 @@ dalosp.menu = { local west_menu = { radio = "1" } local south_menu = { radio = "1" } local item + local add_submenus = { } + local north_submenus = { } + local east_submenus = { } + local west_submenus = { } + local south_submenus = { } + local category + local add_smenu, north_smenu, east_smenu, west_smenu, south_smenu + local categories = {} for k, v in ipairs(dalos.objectstypes) do + category = v.category + if category then + if not add_submenus[category] then + add_submenus[category] = { } + north_submenus[category] = { } + south_submenus[category] = { } + east_submenus[category] = { } + west_submenus[category] = { } + table.insert(categories, 1, category) + end + add_smenu = add_submenus[category] + north_smenu = north_submenus[category] + east_smenu = east_submenus[category] + west_smenu = west_submenus[category] + south_smenu = south_submenus[category] + else + add_smenu = add_menu + north_smenu = north_menu + east_smenu = east_menu + west_smenu = west_menu + south_smenu = south_menu + end item = iup.item { title = v.name } item.action = function (self) dalosp.menu.add_object(canvas, v) end - table.insert(add_menu, item) + table.insert(add_smenu, item) item = iup.item { title = v.name } item.action = function (self) dalosp.menu.set_cross(canvas, v, dalosp.NORTH) end - table.insert(north_menu, item) + table.insert(north_smenu, item) item = iup.item { title = v.name } item.action = function (self) dalosp.menu.set_cross(canvas, v, dalosp.EAST) end - table.insert(east_menu, item) + table.insert(east_smenu, item) item = iup.item { title = v.name } item.action = function (self) dalosp.menu.set_cross(canvas, v, dalosp.WEST) end - table.insert(west_menu, item) + table.insert(west_smenu, item) item = iup.item { title = v.name } item.action = function (self) dalosp.menu.set_cross(canvas, v, dalosp.SOUTH) end - table.insert(south_menu, item) + table.insert(south_smenu, item) + end + for i, v in ipairs(categories) do + table.insert(add_menu, 1, iup.submenu { iup.menu(add_submenus[v]), title = v }) + table.insert(north_menu, 1, iup.submenu { iup.menu(north_submenus[v]), title = v }) + table.insert(south_menu, 1, iup.submenu { iup.menu(south_submenus[v]), title = v }) + table.insert(east_menu, 1, iup.submenu { iup.menu(east_submenus[v]), title = v }) + table.insert(west_menu, 1, iup.submenu { iup.menu(west_submenus[v]), title = v }) end local menu_file = iup.submenu { iup.menu { item_load, item_save, iup.separator {}, item_import, item_reload, iup.separator {}, item_exit }, title = "File" } local menu_add = iup.submenu { iup.menu(add_menu), title = "Add" } |