Index: trunk/src/extobj.h =================================================================== --- trunk/src/extobj.h (revision 28908) +++ trunk/src/extobj.h (revision 28909) @@ -61,6 +61,7 @@ void (*chg_attr)(pcb_subc_t *subc, const char *key, const char *value); /* called after an attribute changed; value == NULL means attribute is deleted */ void (*del_pre)(pcb_subc_t *subc); /* called before the extobj subcircuit is deleted - should free any internal cache, but shouldn't delete the subcircuit */ pcb_subc_t *(*conv_objs)(pcb_data_t *dst, vtp0_t *objs, pcb_subc_t *copy_from); /* called to convert objects into an extobj subc; returns NULL on error; objects should not be changed; if copy_from is not NULL, the new extobj is being created by copying copy_from (the implementation should pick up info from there, not from PCB) */ + void (*gui_propedit)(pcb_subc_t *subc); /* invoke implementation-defined GUI for editing extended object properties */ /* dynamic data - filled in by core */ int idx; Index: trunk/src/extobj_act.c =================================================================== --- trunk/src/extobj_act.c (revision 28908) +++ trunk/src/extobj_act.c (revision 28909) @@ -150,8 +150,74 @@ return 0; } + +static const char pcb_acts_ExtobjGUIPropEdit[] = "ExtobjGUIPropEdit([object, [idpath]])"; +static const char pcb_acth_ExtobjGUIPropEdit[] = "Invoke the extobj-implementation-specific GUI property editor, if available"; +fgw_error_t pcb_act_ExtobjGUIPropEdit(fgw_arg_t *res, int argc, fgw_arg_t *argv) +{ + pcb_board_t *pcb = PCB_ACT_BOARD; + pcb_extobj_t *eo; + int op = F_Object; + pcb_subc_t *obj; + + PCB_ACT_MAY_CONVARG(1, FGW_KEYWORD, ExtobjGUIPropEdit, op = fgw_keyword(&argv[1])); + + switch(op) { + case F_Object: + if (argc > 2) { /* convert by idpath */ + pcb_idpath_t *idp; + PCB_ACT_CONVARG(2, FGW_IDPATH, ExtobjGUIPropEdit, idp = fgw_idpath(&argv[2])); + if ((idp == NULL) || !fgw_ptr_in_domain(&pcb_fgw, &argv[2], PCB_PTR_DOMAIN_IDPATH)) + return FGW_ERR_PTR_DOMAIN; + obj = pcb_idpath2obj(PCB, idp); + } + else { /* interactive convert */ + void *p1, *p3; + pcb_coord_t x, y; + pcb_hid_get_coords("Click on extended object to edit", &x, &y, 0); + obj = NULL; + if (pcb_search_screen(x, y, PCB_OBJ_SUBC, &p1, &obj, &p3) == 0) { + pcb_message(PCB_MSG_ERROR, "ExtobjConvFrom: object not found (no object under the cursor)\n"); + PCB_ACT_IRES(-1); + return 0; + } + } + if ((obj == NULL) || ((obj->type & PCB_OBJ_CLASS_REAL) == 0)) { + pcb_message(PCB_MSG_ERROR, "ExtobjConvFrom: object not found\n"); + PCB_ACT_IRES(-1); + return 0; + } + break; + + default: + PCB_ACT_FAIL(ExtobjConvFrom); + } + + if ((obj == NULL) || (obj->type != PCB_OBJ_SUBC) || (obj->extobj == NULL)) { + pcb_message(PCB_MSG_ERROR, "Object is not an extended object"); + PCB_ACT_IRES(1); + return 0; + } + + eo = pcb_extobj_get(obj); + if (eo == NULL) { + pcb_message(PCB_MSG_ERROR, "Extended object '%s' is not available", obj->extobj); + PCB_ACT_IRES(1); + return 0; + } + + if (eo->gui_propedit != NULL) + eo->gui_propedit(obj); + else + pcb_message(PCB_MSG_ERROR, "Extended object '%s' does not implement GUI property editor", obj->extobj); + + PCB_ACT_IRES(0); + return 0; +} + pcb_action_t pcb_extobj_action_list[] = { - {"ExtobjConvFrom", pcb_act_ExtobjConvFrom, pcb_acth_ExtobjConvFrom, pcb_acts_ExtobjConvFrom} + {"ExtobjConvFrom", pcb_act_ExtobjConvFrom, pcb_acth_ExtobjConvFrom, pcb_acts_ExtobjConvFrom}, + {"ExtobjGUIPropEdit", pcb_act_ExtobjGUIPropEdit, pcb_acth_ExtobjGUIPropEdit, pcb_acts_ExtobjGUIPropEdit} }; PCB_REGISTER_ACTIONS_FUNC(pcb_extobj_action_list, NULL) Index: trunk/src/pcb-menu-default.lht =================================================================== --- trunk/src/pcb-menu-default.lht (revision 28908) +++ trunk/src/pcb-menu-default.lht (revision 28909) @@ -742,7 +742,8 @@ ha:popup-obj-extobj-subcircuit { li:submenu { - ha:Edit extobj properties { action=propedit(subc) } + ha:Edit extobj properties (generic) { action=propedit(subc) } + ha:Edit extobj properties (specific) { action=ExtobjGUIPropEdit(object) } ha:Edit extobj layer bindings... { action=LayerBinding() } ha:Edit extobjpadstack prototypes... { action=pstklib(object) } } Index: trunk/src_plugins/exto_std/dimension.c =================================================================== --- trunk/src_plugins/exto_std/dimension.c (revision 28908) +++ trunk/src_plugins/exto_std/dimension.c (revision 28909) @@ -389,6 +389,12 @@ } +static void pcb_dimension_gui_propedit(pcb_subc_t *subc) +{ + pcb_trace("dim: gui propedit\n"); + +} + static pcb_extobj_t pcb_dimension = { "dimension", pcb_dimension_draw_mark, @@ -398,5 +404,6 @@ pcb_dimension_float_del, pcb_dimension_chg_attr, pcb_dimension_del_pre, - pcb_dimension_conv_objs + pcb_dimension_conv_objs, + pcb_dimension_gui_propedit }; Index: trunk/src_plugins/exto_std/line_of_vias.c =================================================================== --- trunk/src_plugins/exto_std/line_of_vias.c (revision 28908) +++ trunk/src_plugins/exto_std/line_of_vias.c (revision 28909) @@ -282,6 +282,11 @@ return subc; } +static void pcb_line_of_vias_gui_propedit(pcb_subc_t *subc) +{ + pcb_trace("LoV: gui propedit\n"); +} + static pcb_extobj_t pcb_line_of_vias = { "line-of-vias", pcb_line_of_vias_draw_mark, @@ -291,5 +296,6 @@ pcb_line_of_vias_float_del, pcb_line_of_vias_chg_attr, pcb_line_of_vias_del_pre, - pcb_line_of_vias_conv_objs + pcb_line_of_vias_conv_objs, + pcb_line_of_vias_gui_propedit };