X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=mod_menu%2Fmod_menu.lua;h=368115bcfd16f9f13c2d910470230abe9e4ae356;hb=ae4260bb64817c11f9a7140324cd3e3ba113e297;hp=6375e9f76423ada9fe59e9c9f70053810b516d8f;hpb=8366314611bf30a0f31d25bf5f5023186fa87692;p=ion3.git diff --git a/mod_menu/mod_menu.lua b/mod_menu/mod_menu.lua index 6375e9f..368115b 100644 --- a/mod_menu/mod_menu.lua +++ b/mod_menu/mod_menu.lua @@ -1,12 +1,9 @@ -- -- ion/mod_menu/mod_menu.lua -- Menu opening helper routines. -- --- Copyright (c) Tuomo Valkonen 2004-2006. +-- Copyright (c) Tuomo Valkonen 2004-2007. -- --- Ion is free software; you can redistribute it and/or modify it under --- the terms of the GNU Lesser General Public License as published by --- the Free Software Foundation; either version 2.1 of the License, or --- (at your option) any later version. +-- See the included file LICENSE for details. -- -- This is a slight abuse of the package.loaded variable perhaps, but @@ -29,15 +26,15 @@ assert(mod_menu and menudb) local function menu_(reg, sub, menu_or_name, fn, check) if check then -- Check that no other menus are open in reg. - local l=reg:managed_list() - for i, r in pairs(l) do - if obj_is(r, "WMenu") then - return - end + local ok=reg:managed_i(function(r) + return not obj_is(r, "WMenu") + end) + if not ok then + return end end - menu=menudb.evalmenu(menu_or_name, {reg, sub}) + menu=menudb.evalmenu(menu_or_name, reg, sub) return fn(reg, function(e) e.func(reg, sub) end, menu) end @@ -57,17 +54,15 @@ end -- to use a bigger style by setting the field \var{big} to \code{true}. function mod_menu.menu(mplex, sub, menu_or_name, param) local function menu_stdmenu(m, s, menu) - return mod_menu.do_menu(m, s, menu, param) + return ioncore.unsqueeze(mod_menu.do_menu(m, s, menu, param)) end return menu_(mplex, sub, menu_or_name, menu_stdmenu, true) end -- Compatibility function mod_menu.bigmenu(mplex, sub, menu_or_name, initial) - local function menu_bigmenu(m, s, menu) - return mod_menu.do_menu(m, s, menu, {big=true, initial=initial}) - end - return menu_(mplex, sub, menu_or_name, menu_bigmenu, true) + local param={big=true, initial=initial} + return mod_menu.menu(mplex, sub, menu_or_name, param) end --DOC