Index: trunk/src/buffer.c =================================================================== --- trunk/src/buffer.c (revision 28833) +++ trunk/src/buffer.c (revision 28834) @@ -95,28 +95,14 @@ static void move_buffer_pre(pcb_opctx_t *ctx, pcb_any_obj_t *obj, void *ptr3) { - pcb_subc_t *subc; - if (obj->type == PCB_OBJ_SUBC) - return; - subc = pcb_extobj_get_subcobj_by_attr(obj); - if (subc == NULL) - return; - + TODO("extobj floater: move the whole subc instead"); /* when an edit-object is moved to buffer, the corresponding subc obj needs to be moved too */ - pcb_subcop_move_buffer(ctx, subc); +/* pcb_subcop_move_buffer(ctx, subc);*/ } static void add_buffer_pre(pcb_opctx_t *ctx, pcb_any_obj_t *obj, void *ptr3) { - pcb_subc_t *subc; - if (obj->type == PCB_OBJ_SUBC) - return; - subc = pcb_extobj_get_subcobj_by_attr(obj); - if (subc == NULL) - return; - - /* when an edit-object is moved to buffer, the corresponding subc obj needs to be moved too */ - pcb_subcop_add_to_buffer(ctx, subc); + TODO("extobj floater: move the whole subc instead"); } int pcb_set_buffer_bbox(pcb_buffer_t *Buffer) Index: trunk/src/extobj.c =================================================================== --- trunk/src/extobj.c (revision 28833) +++ trunk/src/extobj.c (revision 28834) @@ -86,49 +86,15 @@ vtp0_uninit(&pcb_extobj_i2o); } -pcb_any_obj_t *pcb_extobj_get_editobj_by_attr(pcb_subc_t *obj) +PCB_INLINE pcb_data_t *pcb_extobj_parent_data(pcb_any_obj_t *obj) { - pcb_data_t *data = obj->parent.data; - const char *s; - char *end; - long id; - - assert(obj->parent_type == PCB_PARENT_DATA); - - s = pcb_attribute_get(&obj->Attributes, "extobj::editobj"); - if (s == NULL) - return NULL; - - id = strtol(s, &end, 10); - if (*end != '\0') - return NULL; - - return htip_get(&data->id2obj, id); + if (obj->parent_type == PCB_PARENT_DATA) + return obj->parent.data; + if (obj->parent_type == PCB_PARENT_LAYER) + return obj->parent.layer->parent.data; + return NULL; } -pcb_subc_t *pcb_extobj_get_subcobj_by_attr(pcb_any_obj_t *obj) -{ - pcb_subc_t *res; - pcb_data_t *data = pcb_extobj_parent_data(obj); - const char *s; - char *end; - long id; - - s = pcb_attribute_get(&obj->Attributes, "extobj::subcobj"); - if (s == NULL) - return NULL; - - id = strtol(s, &end, 10); - if (*end != '\0') - return NULL; - - res = htip_get(&data->id2obj, id); - if ((res == NULL) || (res->type != PCB_OBJ_SUBC)) - return NULL; - - return res; -} - void pcb_extobj_new_subc(pcb_any_obj_t *edit_obj, pcb_subc_t *subc_copy_from) { pcb_data_t *data = pcb_extobj_parent_data(edit_obj); @@ -151,10 +117,7 @@ pcb_undo_add_obj_to_create(PCB_OBJ_SUBC, sc, sc, sc); - sprintf(tmp, "%ld", sc->ID); - pcb_attribute_put(&edit_obj->Attributes, "extobj::subcobj", tmp); - sprintf(tmp, "%ld", edit_obj->ID); - pcb_attribute_put(&sc->Attributes, "extobj::editobj", tmp); +TODO("put edit_obj within the new subc, set subc attributes"); pcb_extobj_float_pre(edit_obj); pcb_extobj_float_geo(edit_obj); @@ -168,9 +131,5 @@ if ((eo != NULL) && (eo->del_pre != NULL)) eo->del_pre(sc); - edit_obj = pcb_extobj_get_editobj(eo, sc); - if (edit_obj != NULL) - pcb_attribute_remove(&edit_obj->Attributes, "extobj::subcobj"); - pcb_attribute_remove(&sc->Attributes, "extobj::editobj"); } Index: trunk/src/extobj.h =================================================================== --- trunk/src/extobj.h (revision 28833) +++ trunk/src/extobj.h (revision 28834) @@ -43,7 +43,6 @@ /* static data - filled in by the extobj code */ const char *name; void (*draw_mark)(pcb_draw_info_t *info, pcb_subc_t *obj); /* called when drawing the subc marks (instead of drawing the dashed outline and diamond origin) */ - pcb_any_obj_t *(*get_editobj)(pcb_subc_t *subc); /* resolve the edit object from the subc; if NULL, use the extobj::editobj attribute */ void (*float_pre)(pcb_subc_t *subc, pcb_any_obj_t *floater); /* called before an extobj floater is edited in any way - must not free() the floater */ void (*float_geo)(pcb_subc_t *subc, pcb_any_obj_t *floater); /* called after the geometry of an extobj floater is changed - must not free() the floater */ void (*float_new)(pcb_subc_t *subc, pcb_any_obj_t *floater); /* called when a floater object is split so a new floater is created */ @@ -61,10 +60,6 @@ void pcb_extobj_unreg(pcb_extobj_t *o); void pcb_extobj_reg(pcb_extobj_t *o); -/* given an extobj subc, resolve the corresponding edit-object, or return - NULL if there's none */ -pcb_any_obj_t *pcb_extobj_get_editobj_by_attr(pcb_subc_t *extobj); - /* given an edit-object, resolve the corresponding extobj's subc, or return NULL if there's none */ pcb_subc_t *pcb_extobj_get_subcobj_by_attr(pcb_any_obj_t *editobj); @@ -73,8 +68,8 @@ copy all data from there (including objects). */ void pcb_extobj_new_subc(pcb_any_obj_t *edit_obj, pcb_subc_t *subc_copy_from); -/* Called to remove the subc of an edit object */ -PCB_INLINE void pcb_extobj_del_subc(pcb_any_obj_t *edit_obj); +/* Called to remove the subc of an edit object floater */ +PCB_INLINE void pcb_extobj_del_floater(pcb_any_obj_t *edit_obj); /* called (by the subc code) before an edit-obj is removed */ @@ -86,15 +81,6 @@ extern int pcb_extobj_invalid; /* this changes upon each new extobj reg, forcing the caches to be invalidated eventually */ extern vtp0_t pcb_extobj_i2o; /* extobj_idx -> (pcb_ext_obj_t *) */ -PCB_INLINE pcb_data_t *pcb_extobj_parent_data(pcb_any_obj_t *obj) -{ - if (obj->parent_type == PCB_PARENT_DATA) - return obj->parent.data; - if (obj->parent_type == PCB_PARENT_LAYER) - return obj->parent.layer->parent.data; - return NULL; -} - PCB_INLINE pcb_extobj_t *pcb_extobj_get(pcb_subc_t *obj) { pcb_extobj_t **eo; @@ -116,72 +102,31 @@ return *eo; } -PCB_INLINE pcb_any_obj_t *pcb_extobj_get_editobj(pcb_extobj_t *eo, pcb_subc_t *obj) -{ - if ((eo != NULL) && (eo->get_editobj != NULL)) - return eo->get_editobj(obj); - - return pcb_extobj_get_editobj_by_attr(obj); -} - -/* For internal use, do not call directly */ -PCB_INLINE pcb_extobj_t *pcb_extobj_edit_common_(pcb_any_obj_t *edit_obj, pcb_subc_t **sc, int *is_floater) -{ - pcb_data_t *data = pcb_extobj_parent_data(edit_obj); - - if (data == NULL) - return NULL; - - if (data->parent_type != PCB_PARENT_BOARD) { /* don't do anything with edit objects in the buffer */ - /* NOTE: this will break for subc-in-subc */ - *sc = NULL; - return NULL; - } - - *sc = pcb_extobj_get_subcobj_by_attr(edit_obj); - - *is_floater = 0; - if (*sc == NULL) { - if (PCB_FLAG_TEST(PCB_FLAG_FLOATER, edit_obj)) { - *sc = pcb_obj_parent_subc(edit_obj); - *is_floater = 1; - } - else - return NULL; - } - - if (*sc == NULL) - return NULL; - - return pcb_extobj_get(*sc); -} - PCB_INLINE void pcb_extobj_chg_attr(pcb_any_obj_t *obj, const char *key, const char *value) { - pcb_subc_t *subc; + pcb_subc_t *subc = (pcb_subc_t *)obj; pcb_extobj_t *eo; - if (obj->type == PCB_OBJ_SUBC) - subc = (pcb_subc_t *)obj; - else - subc = pcb_extobj_get_subcobj_by_attr(obj); - - if (subc == NULL) + if ((obj->type != PCB_OBJ_SUBC) || (PCB_FLAG_TEST(PCB_FLAG_FLOATER, obj))) return; eo = pcb_extobj_get(subc); - if ((eo != NULL) && (eo->chg_attr != NULL)) eo->chg_attr(subc, key, value); } -PCB_INLINE void pcb_extobj_del_subc(pcb_any_obj_t *edit_obj) +PCB_INLINE void pcb_extobj_del_floater(pcb_any_obj_t *flt) { - pcb_subc_t *sc = pcb_extobj_get_subcobj_by_attr(edit_obj); - if (sc == NULL) + pcb_subc_t *subc; + + if (!PCB_FLAG_TEST(PCB_FLAG_FLOATER, flt)) return; - pcb_subc_remove(sc); + subc = pcb_obj_parent_subc(flt); + if (subc == NULL) + return; + + pcb_subc_remove(subc); } PCB_INLINE void pcb_extobj_float_new(pcb_any_obj_t *flt) Index: trunk/src/remove.c =================================================================== --- trunk/src/remove.c (revision 28833) +++ trunk/src/remove.c (revision 28834) @@ -76,12 +76,8 @@ static void remove_pre(pcb_opctx_t *ctx, pcb_any_obj_t *obj, void *ptr3) { - pcb_subc_t *subc; - if ((obj->type == PCB_OBJ_SUBC) || ((subc = pcb_extobj_get_subcobj_by_attr(obj)) == NULL)) - return; - /* when an edit-object is removed, the corresponding subc obj needs to be removed */ - pcb_extobj_del_subc(obj); + pcb_extobj_del_floater(obj); } Index: trunk/src_plugins/exto_std/dimension.c =================================================================== --- trunk/src_plugins/exto_std/dimension.c (revision 28833) +++ trunk/src_plugins/exto_std/dimension.c (revision 28834) @@ -89,9 +89,12 @@ if (dim->fmt == NULL) dim->fmt = "%.03$mm"; +TODO("iterate over all edit roled objects"); +/* edit = pcb_extobj_get_editobj_by_attr(obj); if (edit != NULL) dimension_update_src(dim, edit); +*/ } /* remove all existing graphics from the subc */ @@ -227,16 +230,6 @@ { } -pcb_any_obj_t *pcb_dimension_get_edit_obj(pcb_subc_t *obj) -{ - pcb_any_obj_t *edit = pcb_extobj_get_editobj_by_attr(obj); - - if (edit->type != PCB_OBJ_LINE) - return NULL; - - return edit; -} - static void pcb_dimension_float_pre(pcb_subc_t *subc, pcb_any_obj_t *edit_obj) { dimension_clear(subc); @@ -280,8 +273,9 @@ pcb_trace("let's do it!\n"); - edit_obj = pcb_extobj_get_editobj_by_attr(subc); - if (edit_obj == NULL) +TODO("iterate over all edit roled objects"); +/* edit_obj = pcb_extobj_get_editobj_by_attr(subc); + if (edit_obj == NULL)*/ return; dimension_clear(subc); dim->displace = d; @@ -304,10 +298,11 @@ { pcb_trace("dim chg_attr\n"); if (strncmp(key, "extobj::", 8) == 0) { - pcb_any_obj_t *edit_obj = pcb_extobj_get_editobj_by_attr(subc); +TODO("iterate over all edit roled objects"); +/* pcb_any_obj_t *edit_obj = pcb_extobj_get_editobj_by_attr(subc); dimension_clear(subc); dimension_unpack(subc); - dimension_gen(subc, edit_obj); + dimension_gen(subc, edit_obj);*/ } } @@ -314,7 +309,6 @@ static pcb_extobj_t pcb_dimension = { "dimension", pcb_dimension_draw_mark, - pcb_dimension_get_edit_obj, pcb_dimension_float_pre, pcb_dimension_float_geo, pcb_dimension_float_new, Index: trunk/src_plugins/exto_std/line_of_vias.c =================================================================== --- trunk/src_plugins/exto_std/line_of_vias.c (revision 28833) +++ trunk/src_plugins/exto_std/line_of_vias.c (revision 28834) @@ -65,9 +65,12 @@ pcb_extobj_unpack_coord(obj, &lov->pitch, "extobj::pitch"); pcb_extobj_unpack_coord(obj, &lov->clearance, "extobj::clearance"); +TODO("iterate over all edit roled objects"); +/* edit = pcb_extobj_get_editobj_by_attr(obj); if ((edit != NULL) && (edit->type == PCB_OBJ_LINE)) line_of_vias_udpate_line(lov, (pcb_line_t *)edit); +*/ } /* remove all existing padstacks from the subc */ @@ -162,18 +165,7 @@ pcb_render->draw_line(pcb_draw_out.fgGC, ax2, ay2, ax, ay); } -pcb_any_obj_t *pcb_line_of_vias_get_edit_obj(pcb_subc_t *obj) -{ - pcb_any_obj_t *edit = pcb_extobj_get_editobj_by_attr(obj); - if (edit->type != PCB_OBJ_LINE) - return NULL; - - return edit; -} - - - static void pcb_line_of_vias_float_pre(pcb_subc_t *subc, pcb_any_obj_t *edit_obj) { pcb_trace("LoV: edit pre %ld %ld\n", subc->ID, edit_obj->ID); @@ -196,8 +188,9 @@ { pcb_trace("LoV chg_attr\n"); if (strncmp(key, "extobj::", 8) == 0) { - pcb_any_obj_t *edit_obj = pcb_extobj_get_editobj_by_attr(subc); - if (edit_obj == NULL) +TODO("iterate over all edit roled objects"); + pcb_any_obj_t *edit_obj;/* = pcb_extobj_get_editobj_by_attr(subc); + if (edit_obj == NULL)*/ return; line_of_vias_clear(subc); line_of_vias_unpack(subc); @@ -209,7 +202,6 @@ static pcb_extobj_t pcb_line_of_vias = { "line-of-vias", pcb_line_of_vias_draw_mark, - pcb_line_of_vias_get_edit_obj, pcb_line_of_vias_float_pre, pcb_line_of_vias_float_geo, pcb_line_of_vias_float_new,