Index: trunk/src/Makefile.dep =================================================================== --- trunk/src/Makefile.dep (revision 9360) +++ trunk/src/Makefile.dep (revision 9361) @@ -5901,8 +5901,8 @@ ../src_3rd/liblihata/genht/ht.h obj_text_list.h obj_rat_list.h obj_rat.h \ layer_grp.h library.h rats_patch.h crosshair.h vtonpoint.h hid.h error.h \ drc.h route.h data.h obj_subc_list.h obj_subc.h rtree.h ht_subc.h \ - obj_subc_op.h operation.h obj_text_draw.h draw.h conf_core.h conf.h \ - pcb-printf.h ../src_3rd/genvector/gds_char.h \ + obj_subc_op.h operation.h obj_text_draw.h draw.h polygon.h conf_core.h \ + conf.h pcb-printf.h ../src_3rd/genvector/gds_char.h \ ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/dom.h \ ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ ../src_3rd/liblihata/genht/htsp.h ../src_3rd/genvector/vtp0.h \ @@ -6338,7 +6338,8 @@ ../src_3rd/liblihata/genht/ht.h obj_text_list.h obj_rat_list.h obj_rat.h \ layer_grp.h library.h rats_patch.h data.h crosshair.h vtonpoint.h hid.h \ error.h drc.h route.h buffer.h obj_subc_list.h obj_subc.h rtree.h \ - ht_subc.h find.h polygon.h search.h rats.h netlist.h route_style.h + ht_subc.h find.h polygon.h search.h rats.h netlist.h route_style.h \ + obj_subc_parent.h select.o: select.c ../config.h conf_core.h conf.h global_typedefs.h \ pcb_bool.h unit.h pcb-printf.h ../src_3rd/genvector/gds_char.h \ ../src_3rd/genvector/genvector_impl.h \ Index: trunk/src/obj_subc.h =================================================================== --- trunk/src/obj_subc.h (revision 9360) +++ trunk/src/obj_subc.h (revision 9361) @@ -49,7 +49,6 @@ pcb_r_dir_t draw_subc_mark_callback(const pcb_box_t *b, void *cl); void DrawSubc(pcb_subc_t *sc); - /*** loops ***/ #define PCB_SUBC_LOOP(top) do { \ Index: trunk/src/obj_subc_parent.h =================================================================== --- trunk/src/obj_subc_parent.h (nonexistent) +++ trunk/src/obj_subc_parent.h (revision 9361) @@ -0,0 +1,60 @@ +/* + * COPYRIGHT + * + * pcb-rnd, interactive printed circuit board design + * Copyright (C) 2017 Tibor 'Igor2' Palinkas + * + * This module, rats.c, was written and is Copyright (C) 1997 by harry eaton + * this module is also subject to the GNU GPL as described below + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef PCB_OBJ_SUBC_PARENT_H +#define PCB_OBJ_SUBC_PARENT_H + +#include "data.h" +#include "data_parent.h" +#include "layer.h" + +/* Returns whether global (on-data) object is part of a subc */ +static inline PCB_FUNC_UNUSED int pcb_is_gobj_in_subc(pcb_parenttype_t pt, pcb_parent_t *p) +{ + if (pt != PCB_PARENT_DATA) + return 0; + + if (p->data == NULL) + return 0; + + return (p->data->parent_type == PCB_PARENT_SUBC); +} + +/* Returns whether layer object is part of a subc */ +static inline PCB_FUNC_UNUSED int pcb_is_lobj_in_subc(pcb_parenttype_t pt, pcb_parent_t *p) +{ + if (pt != PCB_PARENT_LAYER) + return 0; + + if (p->layer == NULL) + return 0; + + if (p->layer->parent == NULL) + return 0; + + return (p->layer->parent->parent_type == PCB_PARENT_SUBC); +} + +#endif Index: trunk/src/search.c =================================================================== --- trunk/src/search.c (revision 9360) +++ trunk/src/search.c (revision 9361) @@ -40,6 +40,7 @@ #include "find.h" #include "polygon.h" #include "search.h" +#include "obj_subc_parent.h" /* --------------------------------------------------------------------------- * some local identifiers @@ -68,33 +69,6 @@ static pcb_bool SearchElementByLocation(int, pcb_element_t **, pcb_element_t **, pcb_element_t **, pcb_bool); static pcb_bool SearchSubcByLocation(int, pcb_subc_t **, pcb_subc_t **, pcb_subc_t **, pcb_bool); -/* Returns whether global (on-data) object is part of a subc */ -static int is_gobj_in_subc(pcb_parenttype_t pt, pcb_parent_t *p) -{ - if (pt != PCB_PARENT_DATA) - return 0; - - if (p->data == NULL) - return 0; - - return (p->data->parent_type == PCB_PARENT_SUBC); -} - -/* Returns whether layer object is part of a subc */ -static int is_lobj_in_subc(pcb_parenttype_t pt, pcb_parent_t *p) -{ - if (pt != PCB_PARENT_LAYER) - return 0; - - if (p->layer == NULL) - return 0; - - if (p->layer->parent == NULL) - return 0; - - return (p->layer->parent->parent_type == PCB_PARENT_SUBC); -} - /* --------------------------------------------------------------------------- * searches a via */ @@ -111,7 +85,7 @@ pcb_pin_t *pin = (pcb_pin_t *) box; pcb_any_obj_t *ptr1 = pin->Element ? pin->Element : pin; - if (is_gobj_in_subc(pin->parent_type, &pin->parent)) + if (pcb_is_gobj_in_subc(pin->parent_type, &pin->parent)) return PCB_R_DIR_NOT_FOUND; if (PCB_FLAG_TEST(i->locked, ptr1)) @@ -220,7 +194,7 @@ struct line_info *i = (struct line_info *) cl; pcb_line_t *l = (pcb_line_t *) box; - if (is_lobj_in_subc(l->parent_type, &l->parent)) + if (pcb_is_lobj_in_subc(l->parent_type, &l->parent)) return PCB_R_DIR_NOT_FOUND; if (PCB_FLAG_TEST(i->locked, l)) @@ -299,7 +273,7 @@ struct arc_info *i = (struct arc_info *) cl; pcb_arc_t *a = (pcb_arc_t *) box; - if (is_lobj_in_subc(a->parent_type, &a->parent)) + if (pcb_is_lobj_in_subc(a->parent_type, &a->parent)) return PCB_R_DIR_NOT_FOUND; if (PCB_FLAG_TEST(i->locked, a)) @@ -332,7 +306,7 @@ pcb_text_t *text = (pcb_text_t *) box; struct ans_info *i = (struct ans_info *) cl; - if (is_lobj_in_subc(text->parent_type, &text->parent)) + if (pcb_is_lobj_in_subc(text->parent_type, &text->parent)) return PCB_R_DIR_NOT_FOUND; if (PCB_FLAG_TEST(i->locked, text)) @@ -367,7 +341,7 @@ pcb_polygon_t *polygon = (pcb_polygon_t *) box; struct ans_info *i = (struct ans_info *) cl; - if (is_lobj_in_subc(polygon->parent_type, &polygon->parent)) + if (pcb_is_lobj_in_subc(polygon->parent_type, &polygon->parent)) return PCB_R_DIR_NOT_FOUND; if (PCB_FLAG_TEST(i->locked, polygon)) @@ -405,7 +379,7 @@ pcb_r_dir_t ret_val = PCB_R_DIR_NOT_FOUND; double d; - if (is_lobj_in_subc(line->parent_type, &line->parent)) + if (pcb_is_lobj_in_subc(line->parent_type, &line->parent)) return PCB_R_DIR_NOT_FOUND; if (PCB_FLAG_TEST(i->locked, line)) @@ -438,7 +412,7 @@ pcb_r_dir_t ret_val = PCB_R_DIR_NOT_FOUND; double d; - if (is_lobj_in_subc(arc->parent_type, &arc->parent)) + if (pcb_is_lobj_in_subc(arc->parent_type, &arc->parent)) return PCB_R_DIR_NOT_FOUND; if (PCB_FLAG_TEST(i->locked, arc))