Index: Plug.tmpasm =================================================================== --- Plug.tmpasm (revision 32215) +++ Plug.tmpasm (revision 32216) @@ -2,6 +2,8 @@ put /local/pcb/mod/CONF {$(PLUGDIR)/order/order_conf.h} put /local/pcb/mod/CONFFILE {order.conf} put /local/pcb/mod/CONFVAR {order_conf_internal} +put /local/pcb/mod/MENUFILE {order-menu.lht} +put /local/pcb/mod/MENUVAR {order_menu} put /local/pcb/mod/OBJS [@ $(PLUGDIR)/order/order.o @] Index: order-menu.lht =================================================================== --- order-menu.lht (nonexistent) +++ order-menu.lht (revision 32216) @@ -0,0 +1,9 @@ +ha:rnd-menu-v1 { + li:anchored { + ha:@feature_plugins { + li:submenu { + ha:Order PCB = { a={f;x;o}; action=OrderPCB(gui); tip={Order your PCB from a fab\nusing a dialog box} } + } + } + } +} \ No newline at end of file Index: order.c =================================================================== --- order.c (revision 32215) +++ order.c (revision 32216) @@ -35,6 +35,7 @@ #include #include #include +#include #include "layer.h" #include #include "order_conf.h" @@ -42,13 +43,13 @@ #include "order.h" +#include "menu_internal.c" + static const char *order_cookie = "order plugin"; conf_order_t conf_order; #define ORDER_CONF_FN "order.conf" -#define ANCH "@feature_plugins" - vtp0_t pcb_order_imps; void pcb_order_reg(const pcb_order_imp_t *imp) @@ -81,26 +82,6 @@ {"OrderPCB", pcb_act_OrderPCB, pcb_acth_OrderPCB, pcb_acts_OrderPCB} }; -static void order_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.tip = "Order your PCB from a fab\nusing a dialog box"; - props.accel = "f;x;o"; - props.cookie = ANCH; - - /* prepare for appending the strings at the end of the path, "under" the anchor */ - *end = '/'; - end++; - - strcpy(end, "Order PCB"); strcpy(act, "OrderPCB(gui)"); - rnd_gui->create_menu(rnd_gui, path, &props); -} - void pcb_order_free_field_data(order_ctx_t *octx, pcb_order_field_t *f) { if (f->enum_vals != NULL) { @@ -193,19 +174,14 @@ } -static void order_menu_init(rnd_hidlib_t *hidlib, void *user_data, int argc, rnd_event_arg_t argv[]) -{ - rnd_hid_cfg_map_anchor_menus(ANCH, order_install_menu, NULL); -} - int pplg_check_ver_order(int ver_needed) { return 0; } void pplg_uninit_order(void) { rnd_remove_actions_by_cookie(order_cookie); - rnd_event_unbind_allcookie(order_cookie); rnd_conf_unreg_file(ORDER_CONF_FN, order_conf_internal); rnd_conf_unreg_fields("plugins/order/"); + rnd_hid_menu_unload(rnd_gui, order_cookie); } int pplg_init_order(void) @@ -218,6 +194,6 @@ #include "order_conf_fields.h" RND_REGISTER_ACTIONS(order_action_list, order_cookie) - rnd_event_bind(RND_EVENT_GUI_INIT, order_menu_init, NULL, order_cookie); + rnd_hid_menu_load(rnd_gui, NULL, order_cookie, 110, NULL, 0, order_menu, "plugin: order pcb"); return 0; }