Index: trunk/scconfig/Rev.h =================================================================== --- trunk/scconfig/Rev.h (revision 32213) +++ trunk/scconfig/Rev.h (revision 32214) @@ -1 +1 @@ -static const int myrev = 32207; +static const int myrev = 32214; Index: trunk/scconfig/Rev.tab =================================================================== --- trunk/scconfig/Rev.tab (revision 32213) +++ trunk/scconfig/Rev.tab (revision 32214) @@ -1,4 +1,4 @@ -32207 configure cleanup: eahc plugin shall register its own menus +32214 configure cleanup: eahc plugin shall register its own menus 32187 configure librnd: infra for menu patching 32169 configure hid_lesstif is part of the hidlib 32120 configure removing the old drc in favor of drc_query Index: trunk/src/Makefile.dep =================================================================== --- trunk/src/Makefile.dep (revision 32213) +++ trunk/src/Makefile.dep (revision 32214) @@ -7214,6 +7214,7 @@ ../src_3rd/genvector/genvector_impl.c \ ../src_plugins/rubberband_orig/rubberband_conf_fields.h ../src_plugins/script/live_script.o: ../src_plugins/script/live_script.c \ + ../src_plugins/script/menu_internal.c \ ../config.h librnd/config.h ../src_3rd/genvector/vtp0.h \ ../src_3rd/genvector/genvector_impl.h \ ../src_3rd/genvector/genvector_undef.h ../src_3rd/genht/htsp.h \ Index: trunk/src_plugins/script/Plug.tmpasm =================================================================== --- trunk/src_plugins/script/Plug.tmpasm (revision 32213) +++ trunk/src_plugins/script/Plug.tmpasm (revision 32214) @@ -3,6 +3,8 @@ $(PLUGDIR)/script/script.o $(PLUGDIR)/script/live_script.o @] +put /local/pcb/mod/MENUFILE {script-menu.lht} +put /local/pcb/mod/MENUVAR {script_menu} # Fallback scripting: if no system installed fungw is available, static link libfawk if /local/pcb/fungw_system Index: trunk/src_plugins/script/live_script.c =================================================================== --- trunk/src_plugins/script/live_script.c (revision 32213) +++ trunk/src_plugins/script/live_script.c (revision 32214) @@ -39,6 +39,7 @@ #include #include #include +#include #include "undo.h" #include "globalconst.h" @@ -46,8 +47,9 @@ #include "live_script.h" +#include "menu_internal.c" + static const char *lvs_cookie = "live_script"; -#define ANCH "@scripts" typedef struct { @@ -511,37 +513,10 @@ return 0; } -static void lvs_install_menu(void *ctx, rnd_hid_cfg_t *cfg, lht_node_t *node, char *path) -{ - char *end = path + strlen(path); - rnd_menu_prop_t props; - char act[256]; - - memset(&props, 0,sizeof(props)); - props.action = act; - props.cookie = ANCH; - - /* prepare for appending the strings at the end of the path, "under" the anchor */ - *end = '/'; - end++; - - strcpy(end, "Open live script dialog...."); strcpy(act, "LiveScript(new)"); - rnd_gui->create_menu(rnd_gui, path, &props); - -/* strcpy(end, "Load live script...."); strcpy(act, "LiveScript(load)"); - rnd_gui->create_menu(rnd_gui, path, &props);*/ -} - - -static void lvs_menu_init(rnd_hidlib_t *hidlib, void *user_data, int argc, rnd_event_arg_t argv[]) -{ - rnd_hid_cfg_map_anchor_menus(ANCH, lvs_install_menu, NULL); -} - void pcb_live_script_init(void) { htsp_init(&pcb_live_scripts, strhash, strkeyeq); - rnd_event_bind(RND_EVENT_GUI_INIT, lvs_menu_init, NULL, lvs_cookie); + rnd_hid_menu_load(rnd_gui, NULL, lvs_cookie, 110, NULL, 0, script_menu, "plugin: live scripting"); } void pcb_live_script_uninit(void) @@ -552,8 +527,7 @@ lvs_close_cb(lvs, RND_HID_ATTR_EV_CODECLOSE); } htsp_uninit(&pcb_live_scripts); - if ((rnd_gui != NULL) && (rnd_gui->remove_menu != NULL)) - rnd_gui->remove_menu(rnd_gui, lvs_cookie); rnd_event_unbind_allcookie(lvs_cookie); + rnd_hid_menu_unload(rnd_gui, lvs_cookie); } Index: trunk/src_plugins/script/script-menu.lht =================================================================== --- trunk/src_plugins/script/script-menu.lht (nonexistent) +++ trunk/src_plugins/script/script-menu.lht (revision 32214) @@ -0,0 +1,9 @@ +ha:rnd-menu-v1 { + li:anchored { + ha:@scripts { + li:submenu { + ha:Open live script dialog... = { action = LiveScript(new) } + } + } + } +}