Index: trunk/src/actions.h =================================================================== --- trunk/src/actions.h (revision 28043) +++ trunk/src/actions.h (revision 28044) @@ -158,6 +158,9 @@ return res->val.nat_int; } +/* Retrieve the (pcb_hidli_t *) context from argv[0] within an action */ +#define PCB_ACT_HIDLIB ((pcb_hidlib_t *)argv[0].val.argv0.user_call_ctx) + /* Call an action function directly, bypassing fungw; evaluates to an int that is 0 on success */ #define PCB_ACT_CALL_C(func, res, argc, argv) \ Index: trunk/src/buffer.c =================================================================== --- trunk/src/buffer.c (revision 28043) +++ trunk/src/buffer.c (revision 28044) @@ -383,7 +383,7 @@ PCB_ACT_IRES(0); if (angle_s == NULL) - angle_s = pcb_hid_prompt_for(argv[0].val.argv0.user_call_ctx, "Enter Rotation (degrees, CCW):", "0", "Rotation angle"); + angle_s = pcb_hid_prompt_for(PCB_ACT_HIDLIB, "Enter Rotation (degrees, CCW):", "0", "Rotation angle"); if ((angle_s == NULL) || (*angle_s == '\0')) { free(angle_s); @@ -427,7 +427,7 @@ PCB_ACT_MAY_CONVARG(1, FGW_STR, ScaleBuffer, sx = pcb_strdup(argv[1].val.str)); if (sx == NULL) - sx = pcb_hid_prompt_for(argv[0].val.argv0.user_call_ctx, "Enter scaling factor (unitless multiplier):", "1.0", "scaling factor"); + sx = pcb_hid_prompt_for(PCB_ACT_HIDLIB, "Enter scaling factor (unitless multiplier):", "1.0", "scaling factor"); if ((sx == NULL) || (*sx == '\0')) { free(sx); PCB_ACT_IRES(-1); @@ -849,7 +849,7 @@ pcb_message(PCB_MSG_WARNING, "Nothing buffer-movable is selected, nothing moved to the paste buffer\n"); goto error; } - pcb_actionva(argv[0].val.argv0.user_call_ctx, "RemoveSelected", NULL); + pcb_actionva(PCB_ACT_HIDLIB, "RemoveSelected", NULL); break; /* converts buffer contents into a subcircuit */ @@ -941,7 +941,7 @@ case F_Save: name = sbufnum; - rv = pcb_actionva(argv[0].val.argv0.user_call_ctx, "SaveTo", "PasteBuffer", name, fmt, NULL); + rv = pcb_actionva(PCB_ACT_HIDLIB, "SaveTo", "PasteBuffer", name, fmt, NULL); pcb_notify_crosshair_change(pcb_true); return rv; Index: trunk/src/change_act.c =================================================================== --- trunk/src/change_act.c (revision 28043) +++ trunk/src/change_act.c (revision 28044) @@ -510,7 +510,7 @@ if (pcb_chg_obj_name_query(ptr2)) { pcb_hid_redraw(PCB); pcb_board_set_changed_flag(pcb_true); - pcb_actionva(argv[0].val.argv0.user_call_ctx, "DeleteRats", "AllRats", NULL); + pcb_actionva(PCB_ACT_HIDLIB, "DeleteRats", "AllRats", NULL); } } break; @@ -518,7 +518,7 @@ /* change the layout's name */ case F_Layout: - name = pcb_hid_prompt_for(argv[0].val.argv0.user_call_ctx, "Enter the layout name:", PCB_EMPTY(PCB->hidlib.name), "Layout name"); + name = pcb_hid_prompt_for(PCB_ACT_HIDLIB, "Enter the layout name:", PCB_EMPTY(PCB->hidlib.name), "Layout name"); /* NB: ChangeLayoutName takes ownership of the passed memory */ if (name && pcb_board_change_name(name)) pcb_board_set_changed_flag(pcb_true); @@ -526,7 +526,7 @@ /* change the name of the active layer */ case F_Layer: - name = pcb_hid_prompt_for(argv[0].val.argv0.user_call_ctx, "Enter the layer name:", PCB_EMPTY(CURRENT->name), "Layer name"); + name = pcb_hid_prompt_for(PCB_ACT_HIDLIB, "Enter the layer name:", PCB_EMPTY(CURRENT->name), "Layer name"); /* NB: pcb_layer_rename_ takes ownership of the passed memory */ if (name && (pcb_layer_rename_(CURRENT, name) == 0)) pcb_board_set_changed_flag(pcb_true); Index: trunk/src/drc.c =================================================================== --- trunk/src/drc.c (revision 28043) +++ trunk/src/drc.c (revision 28044) @@ -60,7 +60,7 @@ if (pcb_strcasecmp(dlg_type, "list") == 0) { if (PCB_HAVE_GUI_ATTR_DLG) { args[1].val.str = "list"; - return pcb_actionv_bin(argv[0].val.argv0.user_call_ctx, dlgact, res, 2, args); + return pcb_actionv_bin(PCB_ACT_HIDLIB, dlgact, res, 2, args); } dlg_type = "print"; } @@ -68,7 +68,7 @@ if (pcb_strcasecmp(dlg_type, "simple") == 0) { if (PCB_HAVE_GUI_ATTR_DLG) { args[1].val.str = "simple"; - return pcb_actionv_bin(argv[0].val.argv0.user_call_ctx, dlgact, res, 2, args); + return pcb_actionv_bin(PCB_ACT_HIDLIB, dlgact, res, 2, args); } dlg_type = "print"; } Index: trunk/src/file_act.c =================================================================== --- trunk/src/file_act.c (revision 28043) +++ trunk/src/file_act.c (revision 28044) @@ -134,11 +134,11 @@ PCB_ACT_MAY_CONVARG(1, FGW_STR, New, argument_name = argv[1].val.str); - if (!PCB->Changed || (pcb_hid_message_box(argv[0].val.argv0.user_call_ctx, "warning", "New pcb", "OK to clear layout data?", "cancel", 0, "yes", 1, NULL) == 1)) { + if (!PCB->Changed || (pcb_hid_message_box(PCB_ACT_HIDLIB, "warning", "New pcb", "OK to clear layout data?", "cancel", 0, "yes", 1, NULL) == 1)) { if (argument_name) name = pcb_strdup(argument_name); else - name = pcb_hid_prompt_for(argv[0].val.argv0.user_call_ctx, "Enter the layout name:", "", "Layout name"); + name = pcb_hid_prompt_for(PCB_ACT_HIDLIB, "Enter the layout name:", "", "Layout name"); if (!name) return 1; @@ -275,14 +275,14 @@ /* shorthand kept only for compatibility reasons - do not use */ case F_AllConnections: pcb_message(PCB_MSG_WARNING, "Please use action ExportOldConn() instead of SaveTo() for connections.\n"); - return pcb_actionva(argv[0].val.argv0.user_call_ctx, "ExportOldConn", "AllConnections", name, NULL); + return pcb_actionva(PCB_ACT_HIDLIB, "ExportOldConn", "AllConnections", name, NULL); case F_AllUnusedPins: pcb_message(PCB_MSG_WARNING, "Please use action ExportOldConn() instead of SaveTo() for connections.\n"); - return pcb_actionva(argv[0].val.argv0.user_call_ctx, "ExportOldConn", "AllUnusedPins", name, NULL); + return pcb_actionva(PCB_ACT_HIDLIB, "ExportOldConn", "AllUnusedPins", name, NULL); case F_ElementConnections: case F_SubcConnections: pcb_message(PCB_MSG_WARNING, "Please use action ExportOldConn() instead of SaveTo() for connections.\n"); - return pcb_actionva(argv[0].val.argv0.user_call_ctx, "ExportOldConn", "SubcConnections", name, NULL); + return pcb_actionva(PCB_ACT_HIDLIB, "ExportOldConn", "SubcConnections", name, NULL); } PCB_ACT_FAIL(SaveTo); @@ -462,7 +462,7 @@ if ((force != NULL) && (pcb_strcasecmp(force, "force") == 0)) exit(0); - if (!PCB->Changed || (pcb_hid_message_box(argv[0].val.argv0.user_call_ctx, "warning", "Close: lose data", "OK to lose data?", "cancel", 0, "ok", 1, NULL) == 1)) + if (!PCB->Changed || (pcb_hid_message_box(PCB_ACT_HIDLIB, "warning", "Close: lose data", "OK to lose data?", "cancel", 0, "ok", 1, NULL) == 1)) pcb_quit_app(); PCB_ACT_IRES(-1); return 0; Index: trunk/src/gui_act.c =================================================================== --- trunk/src/gui_act.c (revision 28043) +++ trunk/src/gui_act.c (revision 28044) @@ -143,7 +143,7 @@ /* toggle line-adjust flag */ case F_ToggleAllDirections: conf_toggle_editor(all_direction_lines); - pcb_tool_adjust_attached_objects(argv[0].val.argv0.user_call_ctx); + pcb_tool_adjust_attached_objects(PCB_ACT_HIDLIB); break; case F_CycleClip: @@ -155,7 +155,7 @@ else { pcb_conf_setf(CFR_DESIGN,"editor/line_refraction",-1,"%d",(conf_core.editor.line_refraction +1) % 3); } - pcb_tool_adjust_attached_objects(argv[0].val.argv0.user_call_ctx); + pcb_tool_adjust_attached_objects(PCB_ACT_HIDLIB); pcb_notify_crosshair_change(pcb_true); break; @@ -305,7 +305,7 @@ /* display the pinout of a subcircuit */ case F_Pinout: - return pcb_actionva(argv[0].val.argv0.user_call_ctx, "pinout", NULL); + return pcb_actionva(PCB_ACT_HIDLIB, "pinout", NULL); /* toggle displaying of terminal names */ case F_PinOrPadName: @@ -398,31 +398,31 @@ pcb_notify_crosshair_change(pcb_false); switch(fgw_keyword(&argv[1])) { case F_Arc: - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_ARC); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_ARC); break; case F_Arrow: case F_None: - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_ARROW); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_ARROW); break; case F_Copy: - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_COPY); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_COPY); break; case F_InsertPoint: - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_INSERT_POINT); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_INSERT_POINT); break; case F_Line: - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_LINE); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_LINE); break; case F_Lock: - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_LOCK); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_LOCK); break; case F_Move: - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_MOVE); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_MOVE); break; case F_Cancel: { int saved_mode = pcbhl_conf.editor.mode; - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, saved_mode); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, saved_mode); } break; case F_Escape: @@ -439,48 +439,48 @@ case PCB_MODE_RUBBERBAND_MOVE: case PCB_MODE_THERMAL: case PCB_MODE_LOCK: - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_ARROW); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_ARROW); pcb_tool_note.Hit = pcb_tool_note.Click = 0; /* if the mouse button is still pressed, don't start selecting a box */ break; case PCB_MODE_LINE: if (pcb_crosshair.AttachedLine.State == PCB_CH_STATE_FIRST) { - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_ARROW); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_ARROW); } else { - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_LINE); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_LINE); } break; case PCB_MODE_RECTANGLE: if (pcb_crosshair.AttachedBox.State == PCB_CH_STATE_FIRST) - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_ARROW); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_ARROW); else { - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_RECTANGLE); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_RECTANGLE); } break; case PCB_MODE_POLYGON: if (pcb_crosshair.AttachedLine.State == PCB_CH_STATE_FIRST) - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_ARROW); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_ARROW); else { - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_POLYGON); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_POLYGON); } break; case PCB_MODE_POLYGON_HOLE: if (pcb_crosshair.AttachedLine.State == PCB_CH_STATE_FIRST) - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_ARROW); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_ARROW); else { - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_POLYGON_HOLE); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_POLYGON_HOLE); } break; case PCB_MODE_ARC: if (pcb_crosshair.AttachedBox.State == PCB_CH_STATE_FIRST) - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_ARROW); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_ARROW); else { - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_ARC); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_ARC); } break; @@ -494,19 +494,19 @@ break; case F_Notify: - pcb_notify_mode(argv[0].val.argv0.user_call_ctx); + pcb_notify_mode(PCB_ACT_HIDLIB); break; case F_PasteBuffer: - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_PASTE_BUFFER); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_PASTE_BUFFER); break; case F_Polygon: - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_POLYGON); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_POLYGON); break; case F_PolygonHole: - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_POLYGON_HOLE); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_POLYGON_HOLE); break; case F_Release: - if ((pcb_mid_stroke) && (conf_core.editor.enable_stroke) && (pcb_stub_stroke_finish(argv[0].val.argv0.user_call_ctx) == 0)) { + if ((pcb_mid_stroke) && (conf_core.editor.enable_stroke) && (pcb_stub_stroke_finish(PCB_ACT_HIDLIB) == 0)) { /* Ugly hack: returning 1 here will break execution of the action script, so actions after this one could do things that would be executed only after non-recognized gestures */ @@ -514,16 +514,16 @@ pcb_notify_crosshair_change(pcb_true); return 1; } - pcb_release_mode(argv[0].val.argv0.user_call_ctx); + pcb_release_mode(PCB_ACT_HIDLIB); break; case F_Remove: - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_REMOVE); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_REMOVE); break; case F_Rectangle: - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_RECTANGLE); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_RECTANGLE); break; case F_Rotate: - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_ROTATE); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_ROTATE); break; case F_Stroke: if (conf_core.editor.enable_stroke) { @@ -533,36 +533,36 @@ /* Handle middle mouse button restarts of drawing mode. If not in a drawing mode, middle mouse button will select objects. */ if (pcbhl_conf.editor.mode == PCB_MODE_LINE && pcb_crosshair.AttachedLine.State != PCB_CH_STATE_FIRST) - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_LINE); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_LINE); else if (pcbhl_conf.editor.mode == PCB_MODE_ARC && pcb_crosshair.AttachedBox.State != PCB_CH_STATE_FIRST) - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_ARC); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_ARC); else if (pcbhl_conf.editor.mode == PCB_MODE_RECTANGLE && pcb_crosshair.AttachedBox.State != PCB_CH_STATE_FIRST) - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_RECTANGLE); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_RECTANGLE); else if (pcbhl_conf.editor.mode == PCB_MODE_POLYGON && pcb_crosshair.AttachedLine.State != PCB_CH_STATE_FIRST) - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_POLYGON); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_POLYGON); else { - pcb_tool_save(argv[0].val.argv0.user_call_ctx); + pcb_tool_save(PCB_ACT_HIDLIB); pcb_tool_is_saved = pcb_true; - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_ARROW); - pcb_notify_mode(argv[0].val.argv0.user_call_ctx); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_ARROW); + pcb_notify_mode(PCB_ACT_HIDLIB); } break; case F_Text: - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_TEXT); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_TEXT); break; case F_Thermal: - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_THERMAL); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_THERMAL); break; case F_Via: - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_VIA); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_VIA); break; case F_Restore: /* restore the last saved tool */ - pcb_tool_restore(argv[0].val.argv0.user_call_ctx); + pcb_tool_restore(PCB_ACT_HIDLIB); break; case F_Save: /* save currently selected tool */ - pcb_tool_save(argv[0].val.argv0.user_call_ctx); + pcb_tool_save(PCB_ACT_HIDLIB); break; } pcb_notify_crosshair_change(pcb_true); @@ -872,9 +872,9 @@ set_same_(((pcb_line_t *) ptr2)->Thickness, -1, -1, ((pcb_line_t *) ptr2)->Clearance / 2, NULL); layer = (pcb_layer_t *) ptr1; if (pcbhl_conf.editor.mode != PCB_MODE_LINE) - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_LINE); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_LINE); pcb_notify_crosshair_change(pcb_true); - pcb_event(argv[0].val.argv0.user_call_ctx, PCB_EVENT_ROUTE_STYLES_CHANGED, NULL); + pcb_event(PCB_ACT_HIDLIB, PCB_EVENT_ROUTE_STYLES_CHANGED, NULL); break; case PCB_OBJ_ARC: @@ -882,9 +882,9 @@ set_same_(((pcb_arc_t *) ptr2)->Thickness, -1, -1, ((pcb_arc_t *) ptr2)->Clearance / 2, NULL); layer = (pcb_layer_t *) ptr1; if (pcbhl_conf.editor.mode != PCB_MODE_ARC) - pcb_tool_select_by_id(argv[0].val.argv0.user_call_ctx, PCB_MODE_ARC); + pcb_tool_select_by_id(PCB_ACT_HIDLIB, PCB_MODE_ARC); pcb_notify_crosshair_change(pcb_true); - pcb_event(argv[0].val.argv0.user_call_ctx, PCB_EVENT_ROUTE_STYLES_CHANGED, NULL); + pcb_event(PCB_ACT_HIDLIB, PCB_EVENT_ROUTE_STYLES_CHANGED, NULL); break; case PCB_OBJ_POLY: Index: trunk/src/hid_dlg.c =================================================================== --- trunk/src/hid_dlg.c (revision 28043) +++ trunk/src/hid_dlg.c (revision 28044) @@ -49,11 +49,11 @@ strcpy(tmp, "gui_"); strncpy(tmp+4, act_name, sizeof(tmp)-5); if (PCB_HAVE_GUI_ATTR_DLG && (fgw_func_lookup(&pcb_fgw, tmp) != NULL)) - return pcb_actionv_bin(argv[0].val.argv0.user_call_ctx, tmp, res, argc, argv); + return pcb_actionv_bin(PCB_ACT_HIDLIB, tmp, res, argc, argv); tmp[0] = 'c'; tmp[1] = 'l'; if (fgw_func_lookup(&pcb_fgw, tmp) != NULL) - return pcb_actionv_bin(argv[0].val.argv0.user_call_ctx, tmp, res, argc, argv); + return pcb_actionv_bin(PCB_ACT_HIDLIB, tmp, res, argc, argv); return FGW_ERR_NOT_FOUND; } @@ -260,7 +260,7 @@ static fgw_error_t pcb_act_Print(fgw_arg_t *res, int argc, fgw_arg_t *argv) { if (PCB_HAVE_GUI_ATTR_DLG && (fgw_func_lookup(&pcb_fgw, "printgui") != NULL)) - return pcb_actionv_bin(argv[0].val.argv0.user_call_ctx, "printgui", res, argc, argv); + return pcb_actionv_bin(PCB_ACT_HIDLIB, "printgui", res, argc, argv); pcb_message(PCB_MSG_ERROR, "action Print() is available only under a GUI HID. Please use the lpr exporter instead.\n"); return FGW_ERR_NOT_FOUND; } Index: trunk/src/main_act.c =================================================================== --- trunk/src/main_act.c (revision 28043) +++ trunk/src/main_act.c (revision 28044) @@ -406,7 +406,7 @@ if (*sp && *sp != '#') { /*pcb_message("%s : line %-3d : \"%s\"\n", fname, n, sp); */ - pcb_parse_actions(argv[0].val.argv0.user_call_ctx, sp); + pcb_parse_actions(PCB_ACT_HIDLIB, sp); } } Index: trunk/src/netlist_act.c =================================================================== --- trunk/src/netlist_act.c (revision 28043) +++ trunk/src/netlist_act.c (revision 28044) @@ -372,7 +372,7 @@ if (a1 == NULL) PCB_ACT_FAIL(Netlist); if (a2 == NULL) { - a2 = a2free = pcb_hid_prompt_for(argv[0].val.argv0.user_call_ctx, "New name of the network", NULL, "net rename"); + a2 = a2free = pcb_hid_prompt_for(PCB_ACT_HIDLIB, "New name of the network", NULL, "net rename"); if (a2 == NULL) { PCB_ACT_IRES(1); return 0; @@ -385,7 +385,7 @@ if (a1 == NULL) PCB_ACT_FAIL(Netlist); if (a2 == NULL) { - a2 = a2free = pcb_hid_prompt_for(argv[0].val.argv0.user_call_ctx, "Network name to merge into", NULL, "net merge"); + a2 = a2free = pcb_hid_prompt_for(PCB_ACT_HIDLIB, "Network name to merge into", NULL, "net merge"); if (a2 == NULL) { PCB_ACT_IRES(1); return 0; @@ -584,7 +584,7 @@ } if (netname == NULL) { - free_netname = netname = pcb_hid_prompt_for(argv[0].val.argv0.user_call_ctx, "Name of the new network", NULL, "net name"); + free_netname = netname = pcb_hid_prompt_for(PCB_ACT_HIDLIB, "Name of the new network", NULL, "net name"); if (netname == NULL) { vtp0_uninit(&termlist); PCB_ACT_IRES(1); Index: trunk/src/object_act.c =================================================================== --- trunk/src/object_act.c (revision 28043) +++ trunk/src/object_act.c (revision 28044) @@ -460,7 +460,7 @@ args[0].type = FGW_FUNC; args[0].val.argv0.func = NULL; - args[0].val.argv0.user_call_ctx = argv[0].val.argv0.user_call_ctx; + args[0].val.argv0.user_call_ctx = PCB_ACT_HIDLIB; args[1] = argv[3]; args[2] = argv[2]; args[3] = argv[4]; Index: trunk/src/undo_act.c =================================================================== --- trunk/src/undo_act.c (revision 28043) +++ trunk/src/undo_act.c (revision 28044) @@ -104,7 +104,7 @@ PCB_ACT_MAY_CONVARG(1, FGW_STR, Undo, function = argv[1].val.str); if (!function || !*function) { pcb_notify_crosshair_change(pcb_false); - if (pcb_tool_undo_act(argv[0].val.argv0.user_call_ctx)) + if (pcb_tool_undo_act(PCB_ACT_HIDLIB)) if (pcb_undo(pcb_true) == 0) pcb_board_set_changed_flag(pcb_true); } @@ -129,7 +129,7 @@ fgw_error_t pcb_act_Redo(fgw_arg_t *res, int argc, fgw_arg_t *argv) { pcb_notify_crosshair_change(pcb_false); - if (pcb_tool_redo_act(argv[0].val.argv0.user_call_ctx)) + if (pcb_tool_redo_act(PCB_ACT_HIDLIB)) if (pcb_redo(pcb_true)) pcb_board_set_changed_flag(pcb_true); pcb_notify_crosshair_change(pcb_true); Index: trunk/src_plugins/autoplace/action.c =================================================================== --- trunk/src_plugins/autoplace/action.c (revision 28043) +++ trunk/src_plugins/autoplace/action.c (revision 28044) @@ -45,7 +45,7 @@ static fgw_error_t pcb_act_AutoPlaceSelected(fgw_arg_t *res, int argc, fgw_arg_t *argv) { pcb_hid_busy(PCB, 1); - if (pcb_hid_message_box(argv[0].val.argv0.user_call_ctx, "question", "Autoplace start", "Auto-placement can NOT be undone.\nDo you want to continue anyway?", "no", 0, "yes", 1, NULL) == 1) { + if (pcb_hid_message_box(PCB_ACT_HIDLIB, "question", "Autoplace start", "Auto-placement can NOT be undone.\nDo you want to continue anyway?", "no", 0, "yes", 1, NULL) == 1) { if (AutoPlaceSelected()) pcb_board_set_changed_flag(pcb_true); } Index: trunk/src_plugins/cam/cam.c =================================================================== --- trunk/src_plugins/cam/cam.c (revision 28043) +++ trunk/src_plugins/cam/cam.c (revision 28044) @@ -177,7 +177,7 @@ } if (pcb_strcasecmp(cmd, "gui") == 0) { - rs = cam_gui(argv[0].val.argv0.user_call_ctx, arg); + rs = cam_gui(PCB_ACT_HIDLIB, arg); } else { if (arg == NULL) { Index: trunk/src_plugins/dialogs/dlg_loadsave.c =================================================================== --- trunk/src_plugins/dialogs/dlg_loadsave.c (revision 28043) +++ trunk/src_plugins/dialogs/dlg_loadsave.c (revision 28044) @@ -87,7 +87,7 @@ if (name != NULL) { if (pcbhl_conf.rc.verbose) fprintf(stderr, "Load: Calling LoadFrom(%s, %s)\n", function, name); - pcb_actionva(argv[0].val.argv0.user_call_ctx, "LoadFrom", function, name, NULL); + pcb_actionva(PCB_ACT_HIDLIB, "LoadFrom", function, name, NULL); free(name); } @@ -414,7 +414,7 @@ if (pcb_strcasecmp(function, "Layout") == 0) if (PCB->hidlib.filename != NULL) - return pcb_actionva(argv[0].val.argv0.user_call_ctx, "SaveTo", "Layout", NULL); + return pcb_actionva(PCB_ACT_HIDLIB, "SaveTo", "Layout", NULL); if (is_dialog) { const char *siot, *sext; @@ -593,7 +593,7 @@ const char *sfmt = avail.plug[fmt]->description; if (fmt_param != NULL) sfmt = avail.plug[save.pick]->description; - pcb_actionva(argv[0].val.argv0.user_call_ctx, "PasteBuffer", "Save", final_name, sfmt, NULL); + pcb_actionva(PCB_ACT_HIDLIB, "PasteBuffer", "Save", final_name, sfmt, NULL); } else { const char *sfmt = NULL; @@ -606,9 +606,9 @@ * just obtained. */ if (pcb_strcasecmp(function, "Layout") == 0) - pcb_actionva(argv[0].val.argv0.user_call_ctx, "SaveTo", "LayoutAs", final_name, sfmt, NULL); + pcb_actionva(PCB_ACT_HIDLIB, "SaveTo", "LayoutAs", final_name, sfmt, NULL); else - pcb_actionva(argv[0].val.argv0.user_call_ctx, "SaveTo", function, final_name, sfmt, NULL); + pcb_actionva(PCB_ACT_HIDLIB, "SaveTo", function, final_name, sfmt, NULL); } free(final_name); Index: trunk/src_plugins/dialogs/dlg_netlist.c =================================================================== --- trunk/src_plugins/dialogs/dlg_netlist.c (revision 28043) +++ trunk/src_plugins/dialogs/dlg_netlist.c (revision 28044) @@ -446,7 +446,7 @@ static fgw_error_t pcb_act_NetlistDialog(fgw_arg_t *res, int argc, fgw_arg_t *argv) { if (strcmp(pcb_gui->name, "lesstif") == 0) - pcb_actionva(argv[0].val.argv0.user_call_ctx, "DoWindows", "netlist"); + pcb_actionva(PCB_ACT_HIDLIB, "DoWindows", "netlist"); else pcb_dlg_netlist(PCB); PCB_ACT_IRES(0); Index: trunk/src_plugins/fontmode/fontmode.c =================================================================== --- trunk/src_plugins/fontmode/fontmode.c (revision 28043) +++ trunk/src_plugins/fontmode/fontmode.c (revision 28044) @@ -112,7 +112,7 @@ return 1; } - if (pcb_actionva(argv[0].val.argv0.user_call_ctx, "New", "Font", 0)) + if (pcb_actionva(PCB_ACT_HIDLIB, "New", "Font", 0)) return 1; pcb_conf_set(CFR_DESIGN, "editor/grid_unit", -1, "mil", POL_OVERWRITE); @@ -338,7 +338,7 @@ } pcb_font_set_info(font); - pcb_actionva(argv[0].val.argv0.user_call_ctx, "SaveFontTo", NULL); + pcb_actionva(PCB_ACT_HIDLIB, "SaveFontTo", NULL); PCB_ACT_IRES(0); return 0; Index: trunk/src_plugins/import_ipcd356/ipcd356.c =================================================================== --- trunk/src_plugins/import_ipcd356/ipcd356.c (revision 28043) +++ trunk/src_plugins/import_ipcd356/ipcd356.c (revision 28044) @@ -403,15 +403,15 @@ } if (want_net) { - pcb_actionva(argv[0].val.argv0.user_call_ctx, "Netlist", "Freeze", NULL); - pcb_actionva(argv[0].val.argv0.user_call_ctx, "Netlist", "Clear", NULL); + pcb_actionva(PCB_ACT_HIDLIB, "Netlist", "Freeze", NULL); + pcb_actionva(PCB_ACT_HIDLIB, "Netlist", "Clear", NULL); } rs = ipc356_parse(PCB, f, fname, scs, want_net, want_pads); if (want_net) { - pcb_actionva(argv[0].val.argv0.user_call_ctx, "Netlist", "Sort", NULL); - pcb_actionva(argv[0].val.argv0.user_call_ctx, "Netlist", "Thaw", NULL); + pcb_actionva(PCB_ACT_HIDLIB, "Netlist", "Sort", NULL); + pcb_actionva(PCB_ACT_HIDLIB, "Netlist", "Thaw", NULL); } fclose(f); Index: trunk/src_plugins/import_sch/import_sch.c =================================================================== --- trunk/src_plugins/import_sch/import_sch.c (revision 28043) +++ trunk/src_plugins/import_sch/import_sch.c (revision 28044) @@ -86,7 +86,7 @@ if (!ds) { const char *as = pcb_attrib_get(PCB, "import::disperse"); - ds = pcb_hid_prompt_for(argv[0].val.argv0.user_call_ctx, "Enter dispersion:", as ? as : "0", "Import dispersion"); + ds = pcb_hid_prompt_for(PCB_ACT_HIDLIB, "Enter dispersion:", as ? as : "0", "Import dispersion"); ds_alloced = 1; } if (units) { @@ -363,7 +363,7 @@ } pcb_rats_destroy(pcb_false); - pcb_parse_actions(argv[0].val.argv0.user_call_ctx, "Atomic(Save); DeleteRats(AllRats); Atomic(Restore); AddRats(AllRats); Atomic(Block)"); + pcb_parse_actions(PCB_ACT_HIDLIB, "Atomic(Save); DeleteRats(AllRats); Atomic(Restore); AddRats(AllRats); Atomic(Block)"); if (conf_import_sch.plugins.import_sch.verbose) pcb_message(PCB_MSG_DEBUG, "pcb_act_Import: === Leaving pcb_act_Import ===\n"); Index: trunk/src_plugins/lib_hid_common/act_dad.c =================================================================== --- trunk/src_plugins/lib_hid_common/act_dad.c (revision 28043) +++ trunk/src_plugins/lib_hid_common/act_dad.c (revision 28044) @@ -214,7 +214,7 @@ PCB_ACT_CONVARG(2, FGW_STR, dad, cmd = argv[2].val.str); if (pcb_strcasecmp(cmd, "new") == 0) { - PCB_ACT_IRES(dad_new(argv[0].val.argv0.user_call_ctx, dlgname)); + PCB_ACT_IRES(dad_new(PCB_ACT_HIDLIB, dlgname)); return 0; } Index: trunk/src_plugins/lib_hid_common/dlg_comm_m.c =================================================================== --- trunk/src_plugins/lib_hid_common/dlg_comm_m.c (revision 28043) +++ trunk/src_plugins/lib_hid_common/dlg_comm_m.c (revision 28044) @@ -231,7 +231,7 @@ return 2; } - hidlib = argv[0].val.argv0.user_call_ctx; + hidlib = PCB_ACT_HIDLIB; PCB_ACT_CONVARG(1, FGW_STR, gui_MayOverwriteFile, fn = argv[1].val.str); PCB_ACT_CONVARG(2, FGW_INT, gui_MayOverwriteFile, multi = argv[2].val.nat_int); Index: trunk/src_plugins/lib_hid_common/dlg_log.c =================================================================== --- trunk/src_plugins/lib_hid_common/dlg_log.c (revision 28043) +++ trunk/src_plugins/lib_hid_common/dlg_log.c (revision 28044) @@ -185,7 +185,7 @@ const char pcb_acth_LogDialog[] = "Open the log dialog."; fgw_error_t pcb_act_LogDialog(fgw_arg_t *res, int argc, fgw_arg_t *argv) { - log_window_create(argv[0].val.argv0.user_call_ctx); + log_window_create(PCB_ACT_HIDLIB); PCB_ACT_IRES(0); return 0; } Index: trunk/src_plugins/script/live_script.c =================================================================== --- trunk/src_plugins/script/live_script.c (revision 28043) +++ trunk/src_plugins/script/live_script.c (revision 28044) @@ -450,7 +450,7 @@ PCB_ACT_IRES(1); return 0; } - lvs = pcb_dlg_live_script(argv[0].val.argv0.user_call_ctx, name); + lvs = pcb_dlg_live_script(PCB_ACT_HIDLIB, name); if (lvs != NULL) { htsp_set(&pcb_live_scripts, lvs->name, lvs); PCB_ACT_IRES(0); Index: trunk/src_plugins/shand_cmd/command.c =================================================================== --- trunk/src_plugins/shand_cmd/command.c (revision 28043) +++ trunk/src_plugins/shand_cmd/command.c (revision 28044) @@ -77,7 +77,7 @@ PCB_ACT_CONVARG(1, FGW_STR, LoadLayout, filename = argv[1].val.str); PCB_ACT_MAY_CONVARG(2, FGW_STR, LoadLayout, format = argv[2].val.str); - if (!PCB->Changed || (pcb_hid_message_box(argv[0].val.argv0.user_call_ctx, "warning", "Load data lose", "OK to override layout data?", "cancel", 0, "ok", 1, NULL) == 1)) + if (!PCB->Changed || (pcb_hid_message_box(PCB_ACT_HIDLIB, "warning", "Load data lose", "OK to override layout data?", "cancel", 0, "ok", 1, NULL) == 1)) pcb_load_pcb(filename, format, pcb_true, 0); PCB_ACT_IRES(0); @@ -122,7 +122,7 @@ /* DOC: q.html */ static fgw_error_t pcb_act_Quit(fgw_arg_t *res, int argc, fgw_arg_t *argv) { - if (!PCB->Changed || (pcb_hid_message_box(argv[0].val.argv0.user_call_ctx, "warning", "Close: lose data", "OK to lose data?", "cancel", 0, "ok", 1, NULL) == 1)) + if (!PCB->Changed || (pcb_hid_message_box(PCB_ACT_HIDLIB, "warning", "Close: lose data", "OK to lose data?", "cancel", 0, "ok", 1, NULL) == 1)) pcb_quit_app(); PCB_ACT_IRES(0); return 0; Index: trunk/src_plugins/stroke/stroke.c =================================================================== --- trunk/src_plugins/stroke/stroke.c (revision 28043) +++ trunk/src_plugins/stroke/stroke.c (revision 28044) @@ -110,7 +110,7 @@ PCB_ACT_MAY_CONVARG(2, FGW_STR, stroke, arg = argv[2].val.str); if (arg == NULL) PCB_ACT_FAIL(stroke); - pcb_stroke_exec(argv[0].val.argv0.user_call_ctx, arg); + pcb_stroke_exec(PCB_ACT_HIDLIB, arg); } else if (pcb_strcasecmp(cmd, "zoom") == 0) { fgw_arg_t args[5];