Index: trunk/src/gui_act.c =================================================================== --- trunk/src/gui_act.c (revision 26791) +++ trunk/src/gui_act.c (revision 26792) @@ -793,7 +793,7 @@ props.tip = (argc > 3) ? argv[3].val.str : NULL; props.cookie = (argc > 4) ? argv[4].val.str : NULL; - pcb_gui->create_menu(argv[1].val.str, &props); + pcb_gui->create_menu(pcb_gui, argv[1].val.str, &props); PCB_ACT_IRES(0); return 0; @@ -821,7 +821,7 @@ } PCB_ACT_CONVARG(1, FGW_STR, RemoveMenu, ;); - if (pcb_gui->remove_menu(argv[1].val.str) != 0) { + if (pcb_gui->remove_menu(pcb_gui, argv[1].val.str) != 0) { pcb_message(PCB_MSG_ERROR, "failed to remove some of the menu items\n"); PCB_ACT_IRES(-1); } Index: trunk/src/hid.h =================================================================== --- trunk/src/hid.h (revision 26791) +++ trunk/src/hid.h (revision 26792) @@ -445,21 +445,21 @@ * and remove menu items that are no longer needed. * If action is NULL, the menu may get submenus. */ - void (*create_menu)(const char *menu_path, const pcb_menu_prop_t *props); + void (*create_menu)(pcb_hid_t *hid, const char *menu_path, const pcb_menu_prop_t *props); /* Removes a menu recursively */ - int (*remove_menu)(const char *menu_path); - int (*remove_menu_node)(lht_node_t *nd); + int (*remove_menu)(pcb_hid_t *hid, const char *menu_path); + int (*remove_menu_node)(pcb_hid_t *hid, lht_node_t *nd); /* At the moment HIDs load the menu file. Some plugin code, like the toolbar code needs to traverse the menu tree too. This call exposes the HID-internal menu struct */ - pcb_hid_cfg_t *(*get_menu_cfg)(void); + pcb_hid_cfg_t *(*get_menu_cfg)(pcb_hid_t *hid); /* Update the state of all checkboxed menus whose luhata node cookie matches cookie (or all checkboxed menus globally if cookie is NULL) */ - void (*update_menu_checkbox)(const char *cookie); + void (*update_menu_checkbox)(pcb_hid_t *hid, const char *cookie); /* Pointer to the hid's configuration - useful for plugins and core wanting to install menus at anchors */ pcb_hid_cfg_t *hid_cfg; Index: trunk/src/hid_cfg.c =================================================================== --- trunk/src/hid_cfg.c (revision 26791) +++ trunk/src/hid_cfg.c (revision 26792) @@ -436,7 +436,7 @@ break; nxt = node->next; - pcb_gui->remove_menu_node(node); + pcb_gui->remove_menu_node(pcb_gui, node); } return 0; } Index: trunk/src/hid_nogui.c =================================================================== --- trunk/src/hid_nogui.c (revision 26791) +++ trunk/src/hid_nogui.c (revision 26792) @@ -402,7 +402,7 @@ return 0; } -static void nogui_create_menu(const char *menu_path, const pcb_menu_prop_t *props) +static void nogui_create_menu(pcb_hid_t *hid, const char *menu_path, const pcb_menu_prop_t *props) { } Index: trunk/src/object_act.c =================================================================== --- trunk/src/object_act.c (revision 26791) +++ trunk/src/object_act.c (revision 26792) @@ -936,7 +936,7 @@ } /* have to manually trigger the update as it is not a conf item */ if ((pcb_gui != NULL) && (pcb_gui->update_menu_checkbox != NULL)) - pcb_gui->update_menu_checkbox(NULL); + pcb_gui->update_menu_checkbox(pcb_gui, NULL); return 0; case F_Hash: { Index: trunk/src_plugins/hid_batch/batch.c =================================================================== --- trunk/src_plugins/hid_batch/batch.c (revision 26791) +++ trunk/src_plugins/hid_batch/batch.c (revision 26792) @@ -279,7 +279,7 @@ { } -static void batch_create_menu(const char *menu_path, const pcb_menu_prop_t *props) +static void batch_create_menu(pcb_hid_t *hid, const char *menu_path, const pcb_menu_prop_t *props) { } Index: trunk/src_plugins/hid_lesstif/lesstif.h =================================================================== --- trunk/src_plugins/hid_lesstif/lesstif.h (revision 26791) +++ trunk/src_plugins/hid_lesstif/lesstif.h (revision 26792) @@ -43,7 +43,7 @@ extern void lesstif_invalidate_all(pcb_hid_t *hid, pcb_hidlib_t *hidlib); extern void lesstif_coords_to_pcb(int, int, pcb_coord_t *, pcb_coord_t *); extern void lesstif_get_xy(const char *msg); -extern void lesstif_update_widget_flags(const char *cookie); +extern void lesstif_update_widget_flags(pcb_hid_t *hid, const char *cookie); extern int lesstif_call_action(const char *, int, char **); extern void lesstif_pan_fixup(void); extern void lesstif_show_library(void); Index: trunk/src_plugins/hid_lesstif/main.c =================================================================== --- trunk/src_plugins/hid_lesstif/main.c (revision 26791) +++ trunk/src_plugins/hid_lesstif/main.c (revision 26792) @@ -2128,7 +2128,7 @@ } TODO(": remove this, update-on should handle all cases") - lesstif_update_widget_flags(NULL); + lesstif_update_widget_flags(NULL, NULL); show_crosshair(1); idle_proc_set = 0; @@ -3014,10 +3014,10 @@ XtSetValues(appwidget, stdarg_args, stdarg_n); } -void lesstif_create_menu(const char *menu, const pcb_menu_prop_t *props); -int lesstif_remove_menu(const char *menu); -int lesstif_remove_menu_node(lht_node_t *node); -pcb_hid_cfg_t *lesstif_get_menu_cfg(void); +void lesstif_create_menu(pcb_hid_t *hid, const char *menu, const pcb_menu_prop_t *props); +int lesstif_remove_menu(pcb_hid_t *hid, const char *menu); +int lesstif_remove_menu_node(pcb_hid_t *hid, lht_node_t *node); +pcb_hid_cfg_t *lesstif_get_menu_cfg(pcb_hid_t *hid); int ltf_open_popup(const char *menupath); int pplg_check_ver_hid_lesstif(int version_we_need) { return 0; } Index: trunk/src_plugins/hid_lesstif/menu.c =================================================================== --- trunk/src_plugins/hid_lesstif/menu.c (revision 26791) +++ trunk/src_plugins/hid_lesstif/menu.c (revision 26792) @@ -92,7 +92,8 @@ return 0; } -void lesstif_update_widget_flags(const char *cookie) +/* WARNING: when call originaltes from the lesstif hid, hid==NULL for now */ +void lesstif_update_widget_flags(pcb_hid_t *hid, const char *cookie) { int i; for (i = 0; i < n_wflags; i++) { @@ -387,7 +388,7 @@ static void lesstif_confchg_checkbox(conf_native_t *cfg, int arr_idx) { - lesstif_update_widget_flags(NULL); + lesstif_update_widget_flags(NULL, NULL); } static void add_res2menu_named(Widget menu, lht_node_t *ins_after, lht_node_t *node, XtCallbackProc callback, int level) @@ -640,22 +641,22 @@ } -void lesstif_create_menu(const char *menu_path, const pcb_menu_prop_t *props) +void lesstif_create_menu(pcb_hid_t *hid, const char *menu_path, const pcb_menu_prop_t *props) { pcb_hid_cfg_create_menu(lesstif_cfg, menu_path, props, lesstif_create_menu_widget, NULL); } -int lesstif_remove_menu(const char *menu_path) +int lesstif_remove_menu(pcb_hid_t *hid, const char *menu_path) { return pcb_hid_cfg_remove_menu(lesstif_cfg, menu_path, del_menu, NULL); } -int lesstif_remove_menu_node(lht_node_t *node) +int lesstif_remove_menu_node(pcb_hid_t *hid, lht_node_t *node) { return pcb_hid_cfg_remove_menu_node(lesstif_cfg, node, del_menu, NULL); } -pcb_hid_cfg_t *lesstif_get_menu_cfg(void) +pcb_hid_cfg_t *lesstif_get_menu_cfg(pcb_hid_t *hid) { return lesstif_cfg; } Index: trunk/src_plugins/hid_remote/remote.c =================================================================== --- trunk/src_plugins/hid_remote/remote.c (revision 26791) +++ trunk/src_plugins/hid_remote/remote.c (revision 26792) @@ -368,7 +368,7 @@ { } -static void remote_create_menu(const char *menu_path, const pcb_menu_prop_t *props) +static void remote_create_menu(pcb_hid_t *hid, const char *menu_path, const pcb_menu_prop_t *props) { } Index: trunk/src_plugins/lib_gtk_common/glue_hid.c =================================================================== --- trunk/src_plugins/lib_gtk_common/glue_hid.c (revision 26791) +++ trunk/src_plugins/lib_gtk_common/glue_hid.c (revision 26792) @@ -319,7 +319,7 @@ } /* Create a new menu by path */ -static int ghid_remove_menu(const char *menu_path) +static int ghid_remove_menu(pcb_hid_t *hid, const char *menu_path) { if (ghidgui->topwin.ghid_cfg == NULL) return -1; @@ -326,23 +326,23 @@ return pcb_hid_cfg_remove_menu(ghidgui->topwin.ghid_cfg, menu_path, ghid_remove_menu_widget, ghidgui->topwin.menu.menu_bar); } -static int ghid_remove_menu_node(lht_node_t *node) +static int ghid_remove_menu_node(pcb_hid_t *hid, lht_node_t *node) { return pcb_hid_cfg_remove_menu_node(ghidgui->topwin.ghid_cfg, node, ghid_remove_menu_widget, ghidgui->topwin.menu.menu_bar); } -static void ghid_create_menu(const char *menu_path, const pcb_menu_prop_t *props) +static void ghid_create_menu(pcb_hid_t *hid, const char *menu_path, const pcb_menu_prop_t *props) { pcb_hid_cfg_create_menu(ghidgui->topwin.ghid_cfg, menu_path, props, ghid_create_menu_widget, &ghidgui->topwin.menu); } -static void ghid_update_menu_checkbox(const char *cookie) +static void ghid_update_menu_checkbox(pcb_hid_t *hid, const char *cookie) { if (ghidgui->hid_active) ghid_update_toggle_flags(&ghidgui->topwin, cookie); } -pcb_hid_cfg_t *ghid_get_menu_cfg(void) +pcb_hid_cfg_t *ghid_get_menu_cfg(pcb_hid_t *hid) { if (!ghidgui->hid_active) return NULL; Index: trunk/src_plugins/lib_hid_common/grid_menu.c =================================================================== --- trunk/src_plugins/lib_hid_common/grid_menu.c (revision 26791) +++ trunk/src_plugins/lib_hid_common/grid_menu.c (revision 26792) @@ -80,7 +80,7 @@ sprintf(act, "grid(#%d)", idx); sprintf(chk, "conf(iseq, editor/grids_idx, %d)", idx); strcpy(end, li->val.string[0]); - pcb_gui->create_menu(path, &props); + pcb_gui->create_menu(pcb_gui, path, &props); } } Index: trunk/src_plugins/lib_hid_pcbui/layer_menu.c =================================================================== --- trunk/src_plugins/lib_hid_pcbui/layer_menu.c (revision 26791) +++ trunk/src_plugins/lib_hid_pcbui/layer_menu.c (revision 26792) @@ -80,12 +80,12 @@ sprintf(chk, "ChkView(ui:%d)", idx); pcb_snprintf(end, len_avail, " %s", ly->name); - pcb_gui->create_menu(path, &props); + pcb_gui->create_menu(pcb_gui, path, &props); } props.checked = NULL; pcb_snprintf(end, len_avail, "[UI]"); - pcb_gui->create_menu(path, &props); + pcb_gui->create_menu(pcb_gui, path, &props); } /* menu-only virtual layers; have to go reverse to keep order because this will insert items */ @@ -104,12 +104,12 @@ sprintf(chk, "ChkLayer(%s)", ml->abbrev); } pcb_snprintf(end, len_avail, " %s", ml->name); - pcb_gui->create_menu(path, &props); + pcb_gui->create_menu(pcb_gui, path, &props); } props.checked = NULL; pcb_snprintf(end, len_avail, "[virtual]"); - pcb_gui->create_menu(path, &props); + pcb_gui->create_menu(pcb_gui, path, &props); /* have to go reverse to keep order because this will insert items */ @@ -121,7 +121,7 @@ props.checked = NULL; *act = '\0'; *chk = '\0'; - pcb_gui->create_menu(path, &props); + pcb_gui->create_menu(pcb_gui, path, &props); for(gid = pcb_max_group(PCB)-1; gid >= 0; gid--) { pcb_layergrp_t *g = &PCB->LayerGroups.grp[gid]; @@ -150,7 +150,7 @@ sprintf(chk, "ChkLayer(%ld)", lid+1); } pcb_snprintf(end, len_avail, " %s", l->name); - pcb_gui->create_menu(path, &props); + pcb_gui->create_menu(pcb_gui, path, &props); } props.foreground = NULL; @@ -157,7 +157,7 @@ props.background = NULL; props.checked = NULL; pcb_snprintf(end, len_avail, "[%s]", g->name); - pcb_gui->create_menu(path, &props); + pcb_gui->create_menu(pcb_gui, path, &props); } } @@ -184,12 +184,12 @@ { layer_install_menu(); if ((pcb_gui != NULL) && (pcb_gui->update_menu_checkbox != NULL)) - pcb_gui->update_menu_checkbox(NULL); + pcb_gui->update_menu_checkbox(pcb_gui, NULL); } void pcb_layer_menu_vis_update_ev(pcb_hidlib_t *hidlib, void *user_data, int argc, pcb_event_arg_t argv[]) { if ((pcb_gui != NULL) && (pcb_gui->update_menu_checkbox != NULL)) - pcb_gui->update_menu_checkbox(NULL); + pcb_gui->update_menu_checkbox(pcb_gui, NULL); } Index: trunk/src_plugins/lib_hid_pcbui/routest.c =================================================================== --- trunk/src_plugins/lib_hid_pcbui/routest.c (revision 26791) +++ trunk/src_plugins/lib_hid_pcbui/routest.c (revision 26792) @@ -75,7 +75,7 @@ sprintf(act, "RouteStyle(%d)", idx+1); /* for historical reasons this action counts from 1 */ sprintf(chk, "ChkRst(%d)", idx); strcpy(end, PCB->RouteStyle.array[idx].name); - pcb_gui->create_menu(path, &props); + pcb_gui->create_menu(pcb_gui, path, &props); } } @@ -220,7 +220,7 @@ { if ((PCB != NULL) && (pcb_gui != NULL)) { if (pcb_gui->update_menu_checkbox != NULL) - pcb_gui->update_menu_checkbox(NULL); + pcb_gui->update_menu_checkbox(pcb_gui, NULL); if (rst.sub_inited) rst_force_update_chk_and_dlg(); } Index: trunk/src_plugins/lib_hid_pcbui/toolbar.c =================================================================== --- trunk/src_plugins/lib_hid_pcbui/toolbar.c (revision 26791) +++ trunk/src_plugins/lib_hid_pcbui/toolbar.c (revision 26792) @@ -166,7 +166,7 @@ static void toolbar_create(void) { - pcb_hid_cfg_t *cfg = pcb_gui->get_menu_cfg(); + pcb_hid_cfg_t *cfg = pcb_gui->get_menu_cfg(pcb_gui); if (cfg == NULL) return; toolbar_docked_create(cfg); Index: trunk/src_plugins/order/order.c =================================================================== --- trunk/src_plugins/order/order.c (revision 26791) +++ trunk/src_plugins/order/order.c (revision 26792) @@ -91,7 +91,7 @@ end++; strcpy(end, "Order PCB"); strcpy(act, "OrderPCB(gui)"); - pcb_gui->create_menu(path, &props); + pcb_gui->create_menu(pcb_gui, path, &props); } Index: trunk/src_plugins/script/live_script.c =================================================================== --- trunk/src_plugins/script/live_script.c (revision 26791) +++ trunk/src_plugins/script/live_script.c (revision 26792) @@ -491,10 +491,10 @@ end++; strcpy(end, "Open live script dialog...."); strcpy(act, "LiveScript(new)"); - pcb_gui->create_menu(path, &props); + pcb_gui->create_menu(pcb_gui, path, &props); /* strcpy(end, "Load live script...."); strcpy(act, "LiveScript(load)"); - pcb_gui->create_menu(path, &props);*/ + pcb_gui->create_menu(pcb_gui, path, &props);*/ } @@ -518,7 +518,7 @@ } htsp_uninit(&pcb_live_scripts); if ((pcb_gui != NULL) && (pcb_gui->remove_menu != NULL)) - pcb_gui->remove_menu(lvs_cookie); + pcb_gui->remove_menu(pcb_gui, lvs_cookie); pcb_event_unbind_allcookie(lvs_cookie); } Index: trunk/src_plugins/script/script.c =================================================================== --- trunk/src_plugins/script/script.c (revision 26791) +++ trunk/src_plugins/script/script.c (revision 26792) @@ -107,7 +107,7 @@ static void script_unreg(const char *cookie) { if ((pcb_gui != NULL) && (pcb_gui->remove_menu != NULL)) - pcb_gui->remove_menu(cookie); + pcb_gui->remove_menu(pcb_gui, cookie); } /* unload a script, free all memory and remove it from all lists/hashes.