[EMAIL PROTECTED] wrote:
Codes related to 'how not to clutter tools menu' appeared in small
packets. As I did not understand these codes, I did not take part in
the discussion even if the thread was generated in response to my
query. I request that April posts final string of codes generated by
this discussion on this mailing list so that cut-and-paste users like
me also can be benefitted.
My code is pretty complete and self-contained, here it is again.
For your usage, I remove the example how to manage several user-defined
lists.
-- User Defined Lists
local udl_Separator = "~"
local udl_ListTools = 15
-- April White's (& PhiLho's) tool menu generator
-- Syntax: ["Name to appear in menu"] = { order, FunctionToCall }
local tools =
{
["Normalize line"] = { 1, Normalize },
["Sort all lines"] = { 2, SortLines },
["Add XML Tag"] = { 3, AddXMLTag },
["Super Abbreviations"] = { 4, SuperAbbr },
}
local function udl_Initialize()
local tl = {}
for title, tool in pairs(tools) do
tl[tool[1]] = title
end
toolList = table.concat(tl, udl_Separator)
-- editor.AutoCMaxHeight = 10
end
function LuaTools()
editor:GrabFocus()
editorACS = editor.AutoCSeparator
editor.AutoCSeparator = string.byte(udl_Separator)
editor:UserListShow(udl_ListTools, toolList)
editor.AutoCSeparator = editorACS
end
function OnClear()
udl_Initialize()
return false
end
function OnUserListSelection(lt, choice)
if lt == udl_ListTools then
local tool = tools[choice]
-- Call the chosen function
tool[2]()
return true
else
return false
end
end
----
command.name.10.*=Lua &Tools
command.10.*=LuaTools
command.shortcut.10.*=Ctrl+Alt+L
command.subsystem.10.*=3
command.save.before.10.*=2
--
Philippe Lhoste
-- (near) Paris -- France
-- http://Phi.Lho.free.fr
-- -- -- -- -- -- -- -- -- -- -- -- -- --
_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest