4 * PCB, interactive printed circuit board design
5 * Copyright (C) 1994,1995,1996 Thomas Nau
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * Contact addresses for paper mail and Email:
22 * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany
23 * Thomas.Nau@rz.uni-ulm.de
47 #include <sys/types.h>
56 #ifdef HAVE_LIBDMALLOC
60 /* ---------------------------------------------------------------------------
61 * toggles the selection of any kind of object
62 * the different types are defined by search.h
67 void *ptr1
, *ptr2
, *ptr3
;
73 type
= SearchScreen (Crosshair
.X
, Crosshair
.Y
, SELECT_TYPES
,
75 if (type
== NO_TYPE
|| TEST_FLAG (LOCKFLAG
, (PinType
*) ptr2
))
80 AddObjectToFlagUndoList (VIA_TYPE
, ptr1
, ptr1
, ptr1
);
81 TOGGLE_FLAG (SELECTEDFLAG
, (PinType
*) ptr1
);
82 DrawVia ((PinType
*) ptr1
);
87 LineType
*line
= (LineType
*) ptr2
;
89 layer
= (LayerType
*) ptr1
;
90 AddObjectToFlagUndoList (LINE_TYPE
, ptr1
, ptr2
, ptr2
);
91 TOGGLE_FLAG (SELECTEDFLAG
, line
);
92 DrawLine (layer
, line
);
98 RatType
*rat
= (RatType
*) ptr2
;
100 AddObjectToFlagUndoList (RATLINE_TYPE
, ptr1
, ptr1
, ptr1
);
101 TOGGLE_FLAG (SELECTEDFLAG
, rat
);
108 ArcType
*arc
= (ArcType
*) ptr2
;
110 layer
= (LayerType
*) ptr1
;
111 AddObjectToFlagUndoList (ARC_TYPE
, ptr1
, ptr2
, ptr2
);
112 TOGGLE_FLAG (SELECTEDFLAG
, arc
);
113 DrawArc (layer
, arc
);
119 TextType
*text
= (TextType
*) ptr2
;
121 layer
= (LayerType
*) ptr1
;
122 AddObjectToFlagUndoList (TEXT_TYPE
, ptr1
, ptr2
, ptr2
);
123 TOGGLE_FLAG (SELECTEDFLAG
, text
);
124 DrawText (layer
, text
);
130 PolygonType
*poly
= (PolygonType
*) ptr2
;
132 layer
= (LayerType
*) ptr1
;
133 AddObjectToFlagUndoList (POLYGON_TYPE
, ptr1
, ptr2
, ptr2
);
134 TOGGLE_FLAG (SELECTEDFLAG
, poly
);
135 DrawPolygon (layer
, poly
);
136 /* changing memory order no longer effects draw order */
141 AddObjectToFlagUndoList (PIN_TYPE
, ptr1
, ptr2
, ptr2
);
142 TOGGLE_FLAG (SELECTEDFLAG
, (PinType
*) ptr2
);
143 DrawPin ((PinType
*) ptr2
);
147 AddObjectToFlagUndoList (PAD_TYPE
, ptr1
, ptr2
, ptr2
);
148 TOGGLE_FLAG (SELECTEDFLAG
, (PadType
*) ptr2
);
149 DrawPad ((PadType
*) ptr2
);
152 case ELEMENTNAME_TYPE
:
154 ElementType
*element
= (ElementType
*) ptr1
;
156 /* select all names of the element */
157 ELEMENTTEXT_LOOP (element
);
159 AddObjectToFlagUndoList (ELEMENTNAME_TYPE
, element
, text
, text
);
160 TOGGLE_FLAG (SELECTEDFLAG
, text
);
163 DrawElementName (element
);
169 ElementType
*element
= (ElementType
*) ptr1
;
171 /* select all pins and names of the element */
174 AddObjectToFlagUndoList (PIN_TYPE
, element
, pin
, pin
);
175 TOGGLE_FLAG (SELECTEDFLAG
, pin
);
180 AddObjectToFlagUndoList (PAD_TYPE
, element
, pad
, pad
);
181 TOGGLE_FLAG (SELECTEDFLAG
, pad
);
184 ELEMENTTEXT_LOOP (element
);
186 AddObjectToFlagUndoList (ELEMENTNAME_TYPE
, element
, text
, text
);
187 TOGGLE_FLAG (SELECTEDFLAG
, text
);
190 AddObjectToFlagUndoList (ELEMENT_TYPE
, element
, element
, element
);
191 TOGGLE_FLAG (SELECTEDFLAG
, element
);
192 if (PCB
->ElementOn
&&
193 ((TEST_FLAG (ONSOLDERFLAG
, element
) != 0) == SWAP_IDENT
||
194 PCB
->InvisibleObjectsOn
))
197 DrawElementName (element
);
198 DrawElementPackage (element
);
201 DrawElementPinsAndPads (element
);
206 IncrementUndoSerialNumber ();
210 /* ----------------------------------------------------------------------
211 * selects/unselects all visible objects within the passed box
212 * "select" determines if the block is to be selected or unselected
213 * returns true if the state of any object has changed
216 SelectBlock (BoxType
*Box
, bool select
)
218 bool changed
= false;
220 if (PCB
->RatOn
|| !select
)
221 RAT_LOOP (PCB
->Data
);
223 if (LINE_IN_BOX ((LineType
*) line
, Box
) &&
224 !TEST_FLAG (LOCKFLAG
, line
) && TEST_FLAG (SELECTEDFLAG
, line
) != select
)
226 AddObjectToFlagUndoList (RATLINE_TYPE
, line
, line
, line
);
227 ASSIGN_FLAG (SELECTEDFLAG
, select
, line
);
236 LAYER_LOOP(PCB
->Data
, max_copper_layer
+ 2);
238 if (layer
== & PCB
->Data
->SILKLAYER
)
240 if (! (PCB
->ElementOn
|| !select
))
243 else if (layer
== & PCB
->Data
->BACKSILKLAYER
)
245 if (! (PCB
->InvisibleObjectsOn
|| !select
))
249 if (! (layer
->On
|| !select
))
254 if (LINE_IN_BOX (line
, Box
)
255 && !TEST_FLAG (LOCKFLAG
, line
)
256 && TEST_FLAG (SELECTEDFLAG
, line
) != select
)
258 AddObjectToFlagUndoList (LINE_TYPE
, layer
, line
, line
);
259 ASSIGN_FLAG (SELECTEDFLAG
, select
, line
);
261 DrawLine (layer
, line
);
268 if (ARC_IN_BOX (arc
, Box
)
269 && !TEST_FLAG (LOCKFLAG
, arc
)
270 && TEST_FLAG (SELECTEDFLAG
, arc
) != select
)
272 AddObjectToFlagUndoList (ARC_TYPE
, layer
, arc
, arc
);
273 ASSIGN_FLAG (SELECTEDFLAG
, select
, arc
);
275 DrawArc (layer
, arc
);
282 if (!select
|| TEXT_IS_VISIBLE(PCB
, layer
, text
))
284 if (TEXT_IN_BOX (text
, Box
)
285 && !TEST_FLAG (LOCKFLAG
, text
)
286 && TEST_FLAG (SELECTEDFLAG
, text
) != select
)
288 AddObjectToFlagUndoList (TEXT_TYPE
, layer
, text
, text
);
289 ASSIGN_FLAG (SELECTEDFLAG
, select
, text
);
290 if (TEXT_IS_VISIBLE(PCB
, layer
, text
))
291 DrawText (layer
, text
);
297 POLYGON_LOOP (layer
);
299 if (POLYGON_IN_BOX (polygon
, Box
)
300 && !TEST_FLAG (LOCKFLAG
, polygon
)
301 && TEST_FLAG (SELECTEDFLAG
, polygon
) != select
)
303 AddObjectToFlagUndoList (POLYGON_TYPE
, layer
, polygon
, polygon
);
304 ASSIGN_FLAG (SELECTEDFLAG
, select
, polygon
);
306 DrawPolygon (layer
, polygon
);
315 ELEMENT_LOOP (PCB
->Data
);
318 bool gotElement
= false;
319 if ((PCB
->ElementOn
|| !select
)
320 && !TEST_FLAG (LOCKFLAG
, element
)
321 && ((TEST_FLAG (ONSOLDERFLAG
, element
) != 0) == SWAP_IDENT
322 || PCB
->InvisibleObjectsOn
))
325 (&ELEMENT_TEXT (PCB
, element
).BoundingBox
, Box
)
326 && !TEST_FLAG (LOCKFLAG
, &ELEMENT_TEXT (PCB
, element
))
327 && TEST_FLAG (SELECTEDFLAG
,
328 &ELEMENT_TEXT (PCB
, element
)) != select
)
330 /* select all names of element */
331 ELEMENTTEXT_LOOP (element
);
333 AddObjectToFlagUndoList (ELEMENTNAME_TYPE
,
334 element
, text
, text
);
335 ASSIGN_FLAG (SELECTEDFLAG
, select
, text
);
339 DrawElementName (element
);
342 if ((PCB
->PinOn
|| !select
) && ELEMENT_IN_BOX (element
, Box
))
343 if (TEST_FLAG (SELECTEDFLAG
, element
) != select
)
345 AddObjectToFlagUndoList (ELEMENT_TYPE
,
346 element
, element
, element
);
347 ASSIGN_FLAG (SELECTEDFLAG
, select
, element
);
350 if (TEST_FLAG (SELECTEDFLAG
, pin
) != select
)
352 AddObjectToFlagUndoList (PIN_TYPE
, element
, pin
, pin
);
353 ASSIGN_FLAG (SELECTEDFLAG
, select
, pin
);
362 if (TEST_FLAG (SELECTEDFLAG
, pad
) != select
)
364 AddObjectToFlagUndoList (PAD_TYPE
, element
, pad
, pad
);
365 ASSIGN_FLAG (SELECTEDFLAG
, select
, pad
);
373 DrawElement (element
);
378 if ((PCB
->PinOn
|| !select
) && !TEST_FLAG (LOCKFLAG
, element
) && !gotElement
)
382 if ((VIA_OR_PIN_IN_BOX (pin
, Box
)
383 && TEST_FLAG (SELECTEDFLAG
, pin
) != select
))
385 AddObjectToFlagUndoList (PIN_TYPE
, element
, pin
, pin
);
386 ASSIGN_FLAG (SELECTEDFLAG
, select
, pin
);
395 if (PAD_IN_BOX (pad
, Box
)
396 && TEST_FLAG (SELECTEDFLAG
, pad
) != select
397 && (TEST_FLAG (ONSOLDERFLAG
, pad
) == SWAP_IDENT
398 || PCB
->InvisibleObjectsOn
401 AddObjectToFlagUndoList (PAD_TYPE
, element
, pad
, pad
);
402 ASSIGN_FLAG (SELECTEDFLAG
, select
, pad
);
414 if (PCB
->ViaOn
|| !select
)
415 VIA_LOOP (PCB
->Data
);
417 if (VIA_OR_PIN_IN_BOX (via
, Box
)
418 && !TEST_FLAG (LOCKFLAG
, via
)
419 && TEST_FLAG (SELECTEDFLAG
, via
) != select
)
421 AddObjectToFlagUndoList (VIA_TYPE
, via
, via
, via
);
422 ASSIGN_FLAG (SELECTEDFLAG
, select
, via
);
432 IncrementUndoSerialNumber ();
437 /* ----------------------------------------------------------------------
438 * performs several operations on the passed object
441 ObjectOperation (ObjectFunctionType
*F
,
442 int Type
, void *Ptr1
, void *Ptr2
, void *Ptr3
)
448 return (F
->Line ((LayerType
*) Ptr1
, (LineType
*) Ptr2
));
453 return (F
->Arc ((LayerType
*) Ptr1
, (ArcType
*) Ptr2
));
458 return (F
->LinePoint ((LayerType
*) Ptr1
, (LineType
*) Ptr2
,
459 (PointType
*) Ptr3
));
464 return (F
->Text ((LayerType
*) Ptr1
, (TextType
*) Ptr2
));
469 return (F
->Polygon ((LayerType
*) Ptr1
, (PolygonType
*) Ptr2
));
472 case POLYGONPOINT_TYPE
:
474 return (F
->Point ((LayerType
*) Ptr1
, (PolygonType
*) Ptr2
,
475 (PointType
*) Ptr3
));
480 return (F
->Via ((PinType
*) Ptr1
));
485 return (F
->Element ((ElementType
*) Ptr1
));
490 return (F
->Pin ((ElementType
*) Ptr1
, (PinType
*) Ptr2
));
495 return (F
->Pad ((ElementType
*) Ptr1
, (PadType
*) Ptr2
));
498 case ELEMENTNAME_TYPE
:
500 return (F
->ElementName ((ElementType
*) Ptr1
));
505 return (F
->Rat ((RatType
*) Ptr1
));
511 /* ----------------------------------------------------------------------
512 * performs several operations on selected objects which are also visible
513 * The lowlevel procedures are passed together with additional information
514 * resets the selected flag if requested
515 * returns true if anything has changed
518 SelectedOperation (ObjectFunctionType
*F
, bool Reset
, int type
)
520 bool changed
= false;
523 if (type
& LINE_TYPE
&& F
->Line
)
524 VISIBLELINE_LOOP (PCB
->Data
);
526 if (TEST_FLAG (SELECTEDFLAG
, line
))
530 AddObjectToFlagUndoList (LINE_TYPE
, layer
, line
, line
);
531 CLEAR_FLAG (SELECTEDFLAG
, line
);
533 F
->Line (layer
, line
);
540 if (type
& ARC_TYPE
&& F
->Arc
)
541 VISIBLEARC_LOOP (PCB
->Data
);
543 if (TEST_FLAG (SELECTEDFLAG
, arc
))
547 AddObjectToFlagUndoList (ARC_TYPE
, layer
, arc
, arc
);
548 CLEAR_FLAG (SELECTEDFLAG
, arc
);
557 if (type
& TEXT_TYPE
&& F
->Text
)
558 ALLTEXT_LOOP (PCB
->Data
);
560 if (TEST_FLAG (SELECTEDFLAG
, text
) && TEXT_IS_VISIBLE (PCB
, layer
, text
))
564 AddObjectToFlagUndoList (TEXT_TYPE
, layer
, text
, text
);
565 CLEAR_FLAG (SELECTEDFLAG
, text
);
567 F
->Text (layer
, text
);
574 if (type
& POLYGON_TYPE
&& F
->Polygon
)
575 VISIBLEPOLYGON_LOOP (PCB
->Data
);
577 if (TEST_FLAG (SELECTEDFLAG
, polygon
))
581 AddObjectToFlagUndoList (POLYGON_TYPE
, layer
, polygon
, polygon
);
582 CLEAR_FLAG (SELECTEDFLAG
, polygon
);
584 F
->Polygon (layer
, polygon
);
590 /* elements silkscreen */
591 if (type
& ELEMENT_TYPE
&& PCB
->ElementOn
&& F
->Element
)
592 ELEMENT_LOOP (PCB
->Data
);
594 if (TEST_FLAG (SELECTEDFLAG
, element
))
598 AddObjectToFlagUndoList (ELEMENT_TYPE
, element
, element
, element
);
599 CLEAR_FLAG (SELECTEDFLAG
, element
);
601 F
->Element (element
);
606 if (type
& ELEMENTNAME_TYPE
&& PCB
->ElementOn
&& F
->ElementName
)
607 ELEMENT_LOOP (PCB
->Data
);
609 if (TEST_FLAG (SELECTEDFLAG
, &ELEMENT_TEXT (PCB
, element
)))
613 AddObjectToFlagUndoList (ELEMENTNAME_TYPE
,
615 &ELEMENT_TEXT (PCB
, element
),
616 &ELEMENT_TEXT (PCB
, element
));
617 CLEAR_FLAG (SELECTEDFLAG
, &ELEMENT_TEXT (PCB
, element
));
619 F
->ElementName (element
);
625 if (type
& PIN_TYPE
&& PCB
->PinOn
&& F
->Pin
)
626 ELEMENT_LOOP (PCB
->Data
);
630 if (TEST_FLAG (SELECTEDFLAG
, pin
))
634 AddObjectToFlagUndoList (PIN_TYPE
, element
, pin
, pin
);
635 CLEAR_FLAG (SELECTEDFLAG
, pin
);
637 F
->Pin (element
, pin
);
645 if (type
& PAD_TYPE
&& PCB
->PinOn
&& F
->Pad
)
646 ELEMENT_LOOP (PCB
->Data
);
650 if (TEST_FLAG (SELECTEDFLAG
, pad
))
654 AddObjectToFlagUndoList (PAD_TYPE
, element
, pad
, pad
);
655 CLEAR_FLAG (SELECTEDFLAG
, pad
);
657 F
->Pad (element
, pad
);
666 if (type
& VIA_TYPE
&& PCB
->ViaOn
&& F
->Via
)
667 VIA_LOOP (PCB
->Data
);
669 if (TEST_FLAG (SELECTEDFLAG
, via
))
673 AddObjectToFlagUndoList (VIA_TYPE
, via
, via
, via
);
674 CLEAR_FLAG (SELECTEDFLAG
, via
);
682 if (type
& RATLINE_TYPE
&& PCB
->RatOn
&& F
->Rat
)
683 RAT_LOOP (PCB
->Data
);
685 if (TEST_FLAG (SELECTEDFLAG
, line
))
689 AddObjectToFlagUndoList (RATLINE_TYPE
, line
, line
, line
);
690 CLEAR_FLAG (SELECTEDFLAG
, line
);
697 if (Reset
&& changed
)
698 IncrementUndoSerialNumber ();
702 /* ----------------------------------------------------------------------
703 * selects/unselects all objects which have (any of) the specified flag(s)
704 * set. (Typically the FOUNDFLAG, assigned during a connection scan).
705 * "select" determines if they are to be selected or unselected
707 * returns true if the state of any object has changed
709 * text objects and elements cannot be selected by this routine
712 SelectByFlag (int flag
, bool select
)
714 bool changed
= false;
717 RAT_LOOP (PCB
->Data
);
719 if (TEST_FLAG (flag
, line
))
721 AddObjectToFlagUndoList (RATLINE_TYPE
, line
, line
, line
);
722 ASSIGN_FLAG (SELECTEDFLAG
, select
, line
);
729 VISIBLELINE_LOOP (PCB
->Data
);
731 if (TEST_FLAG (flag
, line
) && !TEST_FLAG (LOCKFLAG
, line
))
733 AddObjectToFlagUndoList (LINE_TYPE
, layer
, line
, line
);
734 ASSIGN_FLAG (SELECTEDFLAG
, select
, line
);
735 DrawLine (layer
, line
);
740 VISIBLEARC_LOOP (PCB
->Data
);
742 if (TEST_FLAG (flag
, arc
) && !TEST_FLAG (LOCKFLAG
, arc
))
744 AddObjectToFlagUndoList (ARC_TYPE
, layer
, arc
, arc
);
745 ASSIGN_FLAG (SELECTEDFLAG
, select
, arc
);
746 DrawArc (layer
, arc
);
751 VISIBLEPOLYGON_LOOP (PCB
->Data
);
753 if (TEST_FLAG (flag
, polygon
) && !TEST_FLAG (LOCKFLAG
, polygon
))
755 AddObjectToFlagUndoList (POLYGON_TYPE
, layer
, polygon
, polygon
);
756 ASSIGN_FLAG (SELECTEDFLAG
, select
, polygon
);
757 DrawPolygon (layer
, polygon
);
763 if (PCB
->PinOn
&& PCB
->ElementOn
)
765 ALLPIN_LOOP (PCB
->Data
);
767 if (!TEST_FLAG (LOCKFLAG
, element
) && TEST_FLAG (flag
, pin
))
769 AddObjectToFlagUndoList (PIN_TYPE
, element
, pin
, pin
);
770 ASSIGN_FLAG (SELECTEDFLAG
, select
, pin
);
776 ALLPAD_LOOP (PCB
->Data
);
778 if (!TEST_FLAG (LOCKFLAG
, element
) && TEST_FLAG (flag
, pad
))
780 AddObjectToFlagUndoList (PAD_TYPE
, element
, pad
, pad
);
781 ASSIGN_FLAG (SELECTEDFLAG
, select
, pad
);
790 VIA_LOOP (PCB
->Data
);
792 if (TEST_FLAG (flag
, via
) && !TEST_FLAG (LOCKFLAG
, via
))
794 AddObjectToFlagUndoList (VIA_TYPE
, via
, via
, via
);
795 ASSIGN_FLAG (SELECTEDFLAG
, select
, via
);
804 #if defined(HAVE_REGCOMP) || defined(HAVE_RE_COMP)
805 /* ---------------------------------------------------------------------------
806 * selects objects as defined by Type by name;
807 * it's a case insensitive match
808 * returns true if any object has been selected
811 #if defined (HAVE_REGCOMP)
813 regexec_match_all (const regex_t
*preg
, const char *string
)
817 if (regexec (preg
, string
, 1, &match
, 0) != 0)
819 if (match
.rm_so
!= 0)
821 if (match
.rm_eo
!= strlen(string
))
828 SelectObjectByName (int Type
, char *Pattern
, bool select
)
830 bool changed
= false;
832 #if defined(HAVE_REGCOMP)
833 #define REGEXEC(arg) (regexec_match_all(&compiled, (arg)))
838 /* compile the regular expression */
839 result
= regcomp (&compiled
, Pattern
, REG_EXTENDED
| REG_ICASE
);
842 char errorstring
[128];
844 regerror (result
, &compiled
, errorstring
, 128);
845 Message (_("regexp error: %s\n"), errorstring
);
850 #define REGEXEC(arg) (re_exec((arg)) == 1)
854 /* compile the regular expression */
855 if ((compiled
= re_comp (Pattern
)) != NULL
)
857 Message (_("re_comp error: %s\n"), compiled
);
862 /* loop over all visible objects with names */
863 if (Type
& TEXT_TYPE
)
864 ALLTEXT_LOOP (PCB
->Data
);
866 if (!TEST_FLAG (LOCKFLAG
, text
)
867 && TEXT_IS_VISIBLE (PCB
, layer
, text
)
869 && REGEXEC (text
->TextString
)
870 && TEST_FLAG (SELECTEDFLAG
, text
) != select
)
872 AddObjectToFlagUndoList (TEXT_TYPE
, layer
, text
, text
);
873 ASSIGN_FLAG (SELECTEDFLAG
, select
, text
);
874 DrawText (layer
, text
);
880 if (PCB
->ElementOn
&& (Type
& ELEMENT_TYPE
))
881 ELEMENT_LOOP (PCB
->Data
);
883 if (!TEST_FLAG (LOCKFLAG
, element
)
884 && ((TEST_FLAG (ONSOLDERFLAG
, element
) != 0) == SWAP_IDENT
885 || PCB
->InvisibleObjectsOn
)
886 && TEST_FLAG (SELECTEDFLAG
, element
) != select
)
888 String name
= ELEMENT_NAME (PCB
, element
);
889 if (name
&& REGEXEC (name
))
891 AddObjectToFlagUndoList (ELEMENT_TYPE
, element
, element
, element
);
892 ASSIGN_FLAG (SELECTEDFLAG
, select
, element
);
895 AddObjectToFlagUndoList (PIN_TYPE
, element
, pin
, pin
);
896 ASSIGN_FLAG (SELECTEDFLAG
, select
, pin
);
901 AddObjectToFlagUndoList (PAD_TYPE
, element
, pad
, pad
);
902 ASSIGN_FLAG (SELECTEDFLAG
, select
, pad
);
905 ELEMENTTEXT_LOOP (element
);
907 AddObjectToFlagUndoList (ELEMENTNAME_TYPE
, element
, text
, text
);
908 ASSIGN_FLAG (SELECTEDFLAG
, select
, text
);
911 DrawElementName (element
);
912 DrawElement (element
);
918 if (PCB
->PinOn
&& (Type
& PIN_TYPE
))
919 ALLPIN_LOOP (PCB
->Data
);
921 if (!TEST_FLAG (LOCKFLAG
, element
)
922 && pin
->Name
&& REGEXEC (pin
->Name
)
923 && TEST_FLAG (SELECTEDFLAG
, pin
) != select
)
925 AddObjectToFlagUndoList (PIN_TYPE
, element
, pin
, pin
);
926 ASSIGN_FLAG (SELECTEDFLAG
, select
, pin
);
932 if (PCB
->PinOn
&& (Type
& PAD_TYPE
))
933 ALLPAD_LOOP (PCB
->Data
);
935 if (!TEST_FLAG (LOCKFLAG
, element
)
936 && ((TEST_FLAG (ONSOLDERFLAG
, pad
) != 0) == SWAP_IDENT
937 || PCB
->InvisibleObjectsOn
)
938 && TEST_FLAG (SELECTEDFLAG
, pad
) != select
)
939 if (pad
->Name
&& REGEXEC (pad
->Name
))
941 AddObjectToFlagUndoList (PAD_TYPE
, element
, pad
, pad
);
942 ASSIGN_FLAG (SELECTEDFLAG
, select
, pad
);
948 if (PCB
->ViaOn
&& (Type
& VIA_TYPE
))
949 VIA_LOOP (PCB
->Data
);
951 if (!TEST_FLAG (LOCKFLAG
, via
)
953 && REGEXEC (via
->Name
) && TEST_FLAG (SELECTEDFLAG
, via
) != select
)
955 AddObjectToFlagUndoList (VIA_TYPE
, via
, via
, via
);
956 ASSIGN_FLAG (SELECTEDFLAG
, select
, via
);
964 InitConnectionLookup ();
965 changed
= ClearFlagOnAllObjects (true, FOUNDFLAG
) || changed
;
967 MENU_LOOP (&PCB
->NetlistLib
);
970 LibraryEntryType
*entry
;
973 /* Name[0] and Name[1] are special purpose, not the actual name*/
974 if (menu
->Name
&& menu
->Name
[0] != '\0' && menu
->Name
[1] != '\0' &&
975 REGEXEC (menu
->Name
+ 2))
977 for (i
= menu
->EntryN
, entry
= menu
->Entry
; i
; i
--, entry
++)
978 if (SeekPad (entry
, &conn
, false))
979 RatFindHook (conn
.type
, conn
.ptr1
, conn
.ptr2
, conn
.ptr2
,
980 true, FOUNDFLAG
, true);
985 changed
= SelectByFlag (FOUNDFLAG
, select
) || changed
;
986 changed
= ClearFlagOnAllObjects (false, FOUNDFLAG
) || changed
;
987 FreeConnectionLookupMemory ();
990 #if defined(HAVE_REGCOMP)
998 IncrementUndoSerialNumber ();
1003 #endif /* defined(HAVE_REGCOMP) || defined(HAVE_RE_COMP) */