Re: [textadept] menu.lua

From: mitchell <c....at.caladbolg.net>
Date: Thu, 11 Nov 2010 10:00:35 -0500 (Eastern Standard Time)

Hi,

> I modified menu.lua [1] to automatically create the id numbers that
> connect menu entries with their actions. This makes it easier to write
> the menus as only one table is necessary instead of three (for menu
> entries, ids, and actions) and some dynamic menu changes simpler like
> Frank's patch to show open buffers in the context menu.

THANK YOU!!! I had tried something like this in C but gave up due to
complexity concerns. This is the exactly the same idea I had but it's
implemented in Lua (infinitely better). You can count on something like
this to be committed to hg soon.

Best,
mitchell

> There is a menubar table in menu.lua that consists of tables for each dropdown.
> menubar = {
> {
> title = L('_File'),
> { L('gtk-new'), { new_buffer } },
> }
> -- ...
> }
> The create_menubar function creates numerical ids and connects them
> with the action for each menu entry and turns them into
> gtkmenus.
> By changing the menubar table and recreating the gtkmenus by calling
> create_menubar again the menu can be changed.
> Some examples that could be placed in init.lua [1]: toggle the menu
> bar visibility with alt+f10, change menu contents, dynamic context
> menu, and a Language specific menu, that is only visible when e.g.
> editing Lua files.
> I've been using this for a few days but I don't know if there might be
> problems with this approach so if anyone wants to try this out, put
> menu.lua in your ~/.textadept/modules/textadept/ and the examples in
> your init.lua.
>
> Robert
>
> [1] https://gist.github.com/672362
>
> --
> You received this message because you are subscribed to the Google Groups "textadept" group.
> To post to this group, send email to textadept.at.googlegroups.com.
> To unsubscribe from this group, send email to textadept+unsubscribe.at.googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/textadept?hl=en.
>
>

mitchell
Received on Thu 11 Nov 2010 - 10:00:35 EST

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:53:28 EST