6 * PCB, interactive printed circuit board design
7 * Copyright (C) 1994,1995,1996 Thomas Nau
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 * Contact addresses for paper mail and Email:
24 * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany
25 * Thomas.Nau@rz.uni-ulm.de
29 /* functions used to undo operations
32 * There are two lists which hold
33 * - information about a command
34 * - data of removed objects
35 * Both lists are organized as first-in-last-out which means that the undo
36 * list can always use the last entry of the remove list.
37 * A serial number is incremented whenever an operation is completed.
38 * An operation itself may consist of several basic instructions.
39 * E.g.: removing all selected objects is one operation with exactly one
40 * serial number even if the remove function is called several times.
42 * a lock flag ensures that no infinite loops occur
73 #ifdef HAVE_LIBDMALLOC
79 /* ---------------------------------------------------------------------------
80 * some local data types
82 typedef struct /* information about a change command */
86 ChangeNameType
, *ChangeNameTypePtr
;
88 typedef struct /* information about a move command */
90 LocationType DX
, /* movement vector */
93 MoveType
, *MoveTypePtr
;
95 typedef struct /* information about removed polygon points */
97 LocationType X
, Y
; /* data */
99 Cardinal Index
; /* index in a polygons array of points */
100 bool last_in_contour
; /* Whether the point was the last in its contour */
102 RemovedPointType
, *RemovedPointTypePtr
;
104 typedef struct /* information about rotation */
106 LocationType CenterX
, /* center of rotation */
108 BYTE Steps
; /* number of steps */
110 RotateType
, *RotateTypePtr
;
112 typedef struct /* information about moves between layers */
114 Cardinal OriginalLayer
; /* the index of the original layer */
116 MoveToLayerType
, *MoveToLayerTypePtr
;
118 typedef struct /* information about layer changes */
123 LayerChangeType
, *LayerChangeTypePtr
;
125 typedef struct /* information about poly clear/restore */
127 bool Clear
; /* true was clear, false was restore */
130 ClearPolyType
, *ClearPolyTypePtr
;
132 typedef struct /* information about netlist lib changes */
137 NetlistChangeType
, *NetlistChangeTypePtr
;
139 typedef struct /* holds information about an operation */
141 int Serial
, /* serial number of operation */
142 Type
, /* type of operation */
143 Kind
, /* type of object with given ID */
145 union /* some additional information */
147 ChangeNameType ChangeName
;
149 RemovedPointType RemovedPoint
;
151 MoveToLayerType MoveToLayer
;
154 LayerChangeType LayerChange
;
155 ClearPolyType ClearPoly
;
156 NetlistChangeType NetlistChange
;
161 UndoListType
, *UndoListTypePtr
;
163 /* ---------------------------------------------------------------------------
164 * some local variables
166 static DataTypePtr RemoveList
= NULL
; /* list of removed objects */
167 static UndoListTypePtr UndoList
= NULL
; /* list of operations */
168 static int Serial
= 1, /* serial number */
170 static size_t UndoN
, RedoN
, /* number of entries */
172 static bool Locked
= false; /* do not add entries if */
173 static bool andDraw
= true;
174 /* flag is set; prevents from */
177 /* ---------------------------------------------------------------------------
178 * some local prototypes
180 static UndoListTypePtr
GetUndoSlot (int, int, int);
181 static void DrawRecoveredObject (int, void *, void *, void *);
182 static bool UndoRotate (UndoListTypePtr
);
183 static bool UndoChangeName (UndoListTypePtr
);
184 static bool UndoCopyOrCreate (UndoListTypePtr
);
185 static bool UndoMove (UndoListTypePtr
);
186 static bool UndoRemove (UndoListTypePtr
);
187 static bool UndoRemovePoint (UndoListTypePtr
);
188 static bool UndoInsertPoint (UndoListTypePtr
);
189 static bool UndoRemoveContour (UndoListTypePtr
);
190 static bool UndoInsertContour (UndoListTypePtr
);
191 static bool UndoMoveToLayer (UndoListTypePtr
);
192 static bool UndoFlag (UndoListTypePtr
);
193 static bool UndoMirror (UndoListTypePtr
);
194 static bool UndoChangeSize (UndoListTypePtr
);
195 static bool UndoChange2ndSize (UndoListTypePtr
);
196 static bool UndoChangeAngles (UndoListTypePtr
);
197 static bool UndoChangeClearSize (UndoListTypePtr
);
198 static bool UndoChangeMaskSize (UndoListTypePtr
);
199 static bool UndoClearPoly (UndoListTypePtr
);
200 static int PerformUndo (UndoListTypePtr
);
202 /* ---------------------------------------------------------------------------
203 * adds a command plus some data to the undo list
205 static UndoListTypePtr
206 GetUndoSlot (int CommandType
, int ID
, int Kind
)
209 void *ptr1
, *ptr2
, *ptr3
;
211 static size_t limit
= UNDO_WARNING_SIZE
;
214 if (SearchObjectByID (PCB
->Data
, &ptr1
, &ptr2
, &ptr3
, ID
, Kind
) == NO_TYPE
)
215 Message ("hace: ID (%d) and Type (%x) mismatch in AddObject...\n", ID
,
219 /* allocate memory */
220 if (UndoN
>= UndoMax
)
224 UndoMax
+= STEP_UNDOLIST
;
225 size
= UndoMax
* sizeof (UndoListType
);
226 UndoList
= (UndoListTypePtr
) realloc (UndoList
, size
);
227 memset (&UndoList
[UndoN
], 0, STEP_REMOVELIST
* sizeof (UndoListType
));
229 /* ask user to flush the table because of it's size */
232 limit
= (size
/ UNDO_WARNING_SIZE
+ 1) * UNDO_WARNING_SIZE
;
233 Message (_("Size of 'undo-list' exceeds %li kb\n"),
234 (long) (size
>> 10));
238 /* free structures from the pruned redo list */
240 for (ptr
= &UndoList
[UndoN
]; RedoN
; ptr
++, RedoN
--)
243 case UNDO_CHANGENAME
:
244 free (ptr
->Data
.ChangeName
.Name
);
248 SearchObjectByID (RemoveList
, &ptr1
, &ptr2
, &ptr3
, ptr
->ID
,
252 DestroyObject (RemoveList
, type
, ptr1
, ptr2
, ptr3
);
259 /* copy typefield and serial number to the list */
260 ptr
= &UndoList
[UndoN
++];
261 ptr
->Type
= CommandType
;
264 ptr
->Serial
= Serial
;
268 /* ---------------------------------------------------------------------------
269 * redraws the recovered object
272 DrawRecoveredObject (int Type
, void *Ptr1
, void *Ptr2
, void *Ptr3
)
274 if (Type
& (LINE_TYPE
| TEXT_TYPE
| POLYGON_TYPE
| ARC_TYPE
))
278 layer
= LAYER_PTR (GetLayerNumber (RemoveList
, (LayerTypePtr
) Ptr1
));
279 DrawObject (Type
, (void *) layer
, Ptr2
, 0);
282 DrawObject (Type
, Ptr1
, Ptr2
, 0);
285 /* ---------------------------------------------------------------------------
286 * recovers an object from a 'rotate' operation
287 * returns true if anything has been recovered
290 UndoRotate (UndoListTypePtr Entry
)
292 void *ptr1
, *ptr2
, *ptr3
;
295 /* lookup entry by it's ID */
297 SearchObjectByID (PCB
->Data
, &ptr1
, &ptr2
, &ptr3
, Entry
->ID
, Entry
->Kind
);
300 if (TEST_FLAG (LOCKFLAG
, (ArcTypePtr
) ptr2
))
302 RotateObject (type
, ptr1
, ptr2
, ptr3
,
303 Entry
->Data
.Rotate
.CenterX
, Entry
->Data
.Rotate
.CenterY
,
304 (4 - Entry
->Data
.Rotate
.Steps
) & 0x03);
305 Entry
->Data
.Rotate
.Steps
= (4 - Entry
->Data
.Rotate
.Steps
) & 0x03;
311 /* ---------------------------------------------------------------------------
312 * recovers an object from a clear/restore poly operation
313 * returns true if anything has been recovered
316 UndoClearPoly (UndoListTypePtr Entry
)
318 void *ptr1
, *ptr2
, *ptr3
;
322 SearchObjectByID (PCB
->Data
, &ptr1
, &ptr2
, &ptr3
, Entry
->ID
, Entry
->Kind
);
325 if (Entry
->Data
.ClearPoly
.Clear
)
326 RestoreToPolygon (PCB
->Data
, type
, Entry
->Data
.ClearPoly
.Layer
, ptr3
);
328 ClearFromPolygon (PCB
->Data
, type
, Entry
->Data
.ClearPoly
.Layer
, ptr3
);
329 Entry
->Data
.ClearPoly
.Clear
= !Entry
->Data
.ClearPoly
.Clear
;
335 /* ---------------------------------------------------------------------------
336 * recovers an object from a 'change name' operation
337 * returns true if anything has been recovered
340 UndoChangeName (UndoListTypePtr Entry
)
342 void *ptr1
, *ptr2
, *ptr3
;
345 /* lookup entry by it's ID */
347 SearchObjectByID (PCB
->Data
, &ptr1
, &ptr2
, &ptr3
, Entry
->ID
, Entry
->Kind
);
350 if (TEST_FLAG (LOCKFLAG
, (TextTypePtr
) ptr3
))
352 Entry
->Data
.ChangeName
.Name
=
353 (ChangeObjectName (type
, ptr1
, ptr2
, ptr3
,
354 Entry
->Data
.ChangeName
.Name
));
360 /* ---------------------------------------------------------------------------
361 * recovers an object from a 2ndSize change operation
364 UndoChange2ndSize (UndoListTypePtr Entry
)
366 void *ptr1
, *ptr2
, *ptr3
;
370 /* lookup entry by ID */
372 SearchObjectByID (PCB
->Data
, &ptr1
, &ptr2
, &ptr3
, Entry
->ID
, Entry
->Kind
);
375 if (TEST_FLAG (LOCKFLAG
, (PinTypePtr
) ptr2
))
377 swap
= ((PinTypePtr
) ptr2
)->DrillingHole
;
379 EraseObject (type
, ptr1
, ptr2
);
380 ((PinTypePtr
) ptr2
)->DrillingHole
= Entry
->Data
.Size
;
381 Entry
->Data
.Size
= swap
;
382 DrawObject (type
, ptr1
, ptr2
, 0);
388 /* ---------------------------------------------------------------------------
389 * recovers an object from a ChangeAngles change operation
392 UndoChangeAngles (UndoListTypePtr Entry
)
394 void *ptr1
, *ptr2
, *ptr3
;
396 long int old_sa
, old_da
;
398 /* lookup entry by ID */
400 SearchObjectByID (PCB
->Data
, &ptr1
, &ptr2
, &ptr3
, Entry
->ID
, Entry
->Kind
);
401 if (type
== ARC_TYPE
)
403 LayerTypePtr Layer
= (LayerTypePtr
) ptr1
;
404 ArcTypePtr a
= (ArcTypePtr
) ptr2
;
405 if (TEST_FLAG (LOCKFLAG
, a
))
407 r_delete_entry (Layer
->arc_tree
, (BoxTypePtr
) a
);
408 old_sa
= a
->StartAngle
;
411 EraseObject (type
, Layer
, a
);
412 a
->StartAngle
= Entry
->Data
.Move
.DX
;
413 a
->Delta
= Entry
->Data
.Move
.DY
;
414 SetArcBoundingBox (a
);
415 r_insert_entry (Layer
->arc_tree
, (BoxTypePtr
) a
, 0);
416 Entry
->Data
.Move
.DX
= old_sa
;
417 Entry
->Data
.Move
.DY
= old_da
;;
418 DrawObject (type
, ptr1
, a
, 0);
424 /* ---------------------------------------------------------------------------
425 * recovers an object from a clearance size change operation
428 UndoChangeClearSize (UndoListTypePtr Entry
)
430 void *ptr1
, *ptr2
, *ptr3
;
434 /* lookup entry by ID */
436 SearchObjectByID (PCB
->Data
, &ptr1
, &ptr2
, &ptr3
, Entry
->ID
, Entry
->Kind
);
439 if (TEST_FLAG (LOCKFLAG
, (LineTypePtr
) ptr2
))
441 swap
= ((PinTypePtr
) ptr2
)->Clearance
;
442 RestoreToPolygon (PCB
->Data
, type
, ptr1
, ptr2
);
444 EraseObject (type
, ptr1
, ptr2
);
445 ((PinTypePtr
) ptr2
)->Clearance
= Entry
->Data
.Size
;
446 ClearFromPolygon (PCB
->Data
, type
, ptr1
, ptr2
);
447 Entry
->Data
.Size
= swap
;
449 DrawObject (type
, ptr1
, ptr2
, 0);
455 /* ---------------------------------------------------------------------------
456 * recovers an object from a mask size change operation
459 UndoChangeMaskSize (UndoListTypePtr Entry
)
461 void *ptr1
, *ptr2
, *ptr3
;
465 /* lookup entry by ID */
467 SearchObjectByID (PCB
->Data
, &ptr1
, &ptr2
, &ptr3
, Entry
->ID
, Entry
->Kind
);
468 if (type
& (VIA_TYPE
| PIN_TYPE
| PAD_TYPE
))
470 if (TEST_FLAG (LOCKFLAG
, (PinTypePtr
) ptr2
))
474 PAD_TYPE
? ((PadTypePtr
) ptr2
)->Mask
: ((PinTypePtr
) ptr2
)->Mask
);
476 EraseObject (type
, ptr1
, ptr2
);
477 if (type
== PAD_TYPE
)
478 ((PadTypePtr
) ptr2
)->Mask
= Entry
->Data
.Size
;
480 ((PinTypePtr
) ptr2
)->Mask
= Entry
->Data
.Size
;
481 Entry
->Data
.Size
= swap
;
483 DrawObject (type
, ptr1
, ptr2
, 0);
490 /* ---------------------------------------------------------------------------
491 * recovers an object from a Size change operation
494 UndoChangeSize (UndoListTypePtr Entry
)
496 void *ptr1
, *ptr2
, *ptr3
;
500 /* lookup entry by ID */
502 SearchObjectByID (PCB
->Data
, &ptr1
, &ptr2
, &ptr3
, Entry
->ID
, Entry
->Kind
);
505 if (TEST_FLAG (LOCKFLAG
, (PinTypePtr
) ptr2
))
507 /* Wow! can any object be treated as a pin type for size change?? */
508 /* pins, vias, lines, and arcs can. Text can't but it has it's own mechanism */
509 swap
= ((PinTypePtr
) ptr2
)->Thickness
;
510 RestoreToPolygon (PCB
->Data
, type
, ptr1
, ptr2
);
512 EraseObject (type
, ptr1
, ptr2
);
513 ((PinTypePtr
) ptr2
)->Thickness
= Entry
->Data
.Size
;
514 Entry
->Data
.Size
= swap
;
515 ClearFromPolygon (PCB
->Data
, type
, ptr1
, ptr2
);
517 DrawObject (type
, ptr1
, ptr2
, 0);
523 /* ---------------------------------------------------------------------------
524 * recovers an object from a FLAG change operation
527 UndoFlag (UndoListTypePtr Entry
)
529 void *ptr1
, *ptr2
, *ptr3
;
534 /* lookup entry by ID */
536 SearchObjectByID (PCB
->Data
, &ptr1
, &ptr2
, &ptr3
, Entry
->ID
, Entry
->Kind
);
540 PinTypePtr pin
= (PinTypePtr
) ptr2
;
542 if (TEST_FLAG (LOCKFLAG
, pin
))
548 f1
= MaskFlags (pin
->Flags
, ~DRAW_FLAGS
);
549 f2
= MaskFlags (Entry
->Data
.Flags
, ~DRAW_FLAGS
);
551 if (!FLAGS_EQUAL (f1
, f2
))
554 if (andDraw
&& must_redraw
)
555 EraseObject (type
, ptr1
, ptr2
);
557 pin
->Flags
= Entry
->Data
.Flags
;
559 Entry
->Data
.Flags
= swap
;
561 if (andDraw
&& must_redraw
)
562 DrawObject (type
, ptr1
, ptr2
, 0);
565 Message ("hace Internal error: Can't find ID %d type %08x\n", Entry
->ID
,
567 Message ("for UndoFlag Operation. Previous flags: %s\n",
568 flags_to_string (Entry
->Data
.Flags
, 0));
572 /* ---------------------------------------------------------------------------
573 * recovers an object from a mirror operation
574 * returns true if anything has been recovered
577 UndoMirror (UndoListTypePtr Entry
)
579 void *ptr1
, *ptr2
, *ptr3
;
582 /* lookup entry by ID */
584 SearchObjectByID (PCB
->Data
, &ptr1
, &ptr2
, &ptr3
, Entry
->ID
, Entry
->Kind
);
585 if (type
== ELEMENT_TYPE
)
587 ElementTypePtr element
= (ElementTypePtr
) ptr3
;
588 if (TEST_FLAG (LOCKFLAG
, element
))
591 EraseElement (element
);
592 MirrorElementCoordinates (PCB
->Data
, element
, Entry
->Data
.Move
.DY
);
594 DrawElement (element
, 0);
597 Message ("hace Internal error: UndoMirror on object type %d\n", type
);
601 /* ---------------------------------------------------------------------------
602 * recovers an object from a 'copy' or 'create' operation
603 * returns true if anything has been recovered
606 UndoCopyOrCreate (UndoListTypePtr Entry
)
608 void *ptr1
, *ptr2
, *ptr3
;
611 /* lookup entry by it's ID */
613 SearchObjectByID (PCB
->Data
, &ptr1
, &ptr2
, &ptr3
, Entry
->ID
, Entry
->Kind
);
616 if (TEST_FLAG (LOCKFLAG
, (PinTypePtr
) ptr2
))
619 RemoveList
= CreateNewBuffer ();
621 EraseObject (type
, ptr1
, ptr2
);
622 /* in order to make this re-doable we move it to the RemoveList */
623 MoveObjectToBuffer (RemoveList
, PCB
->Data
, type
, ptr1
, ptr2
, ptr3
);
624 Entry
->Type
= UNDO_REMOVE
;
630 /* ---------------------------------------------------------------------------
631 * recovers an object from a 'move' operation
632 * returns true if anything has been recovered
635 UndoMove (UndoListTypePtr Entry
)
637 void *ptr1
, *ptr2
, *ptr3
;
640 /* lookup entry by it's ID */
642 SearchObjectByID (PCB
->Data
, &ptr1
, &ptr2
, &ptr3
, Entry
->ID
, Entry
->Kind
);
645 if (TEST_FLAG (LOCKFLAG
, (LineTypePtr
) ptr2
))
647 MoveObject (type
, ptr1
, ptr2
, ptr3
,
648 -Entry
->Data
.Move
.DX
, -Entry
->Data
.Move
.DY
);
649 Entry
->Data
.Move
.DX
*= -1;
650 Entry
->Data
.Move
.DY
*= -1;
656 /* ----------------------------------------------------------------------
657 * recovers an object from a 'remove' operation
658 * returns true if anything has been recovered
661 UndoRemove (UndoListTypePtr Entry
)
663 void *ptr1
, *ptr2
, *ptr3
;
666 /* lookup entry by it's ID */
668 SearchObjectByID (RemoveList
, &ptr1
, &ptr2
, &ptr3
, Entry
->ID
,
673 DrawRecoveredObject (type
, ptr1
, ptr2
, ptr3
);
674 MoveObjectToBuffer (PCB
->Data
, RemoveList
, type
, ptr1
, ptr2
, ptr3
);
675 Entry
->Type
= UNDO_CREATE
;
681 /* ----------------------------------------------------------------------
682 * recovers an object from a 'move to another layer' operation
683 * returns true if anything has been recovered
686 UndoMoveToLayer (UndoListTypePtr Entry
)
688 void *ptr1
, *ptr2
, *ptr3
;
691 /* lookup entry by it's ID */
693 SearchObjectByID (PCB
->Data
, &ptr1
, &ptr2
, &ptr3
, Entry
->ID
, Entry
->Kind
);
696 if (TEST_FLAG (LOCKFLAG
, (LineTypePtr
) ptr2
))
698 swap
= GetLayerNumber (PCB
->Data
, (LayerTypePtr
) ptr1
);
699 MoveObjectToLayer (type
, ptr1
, ptr2
, ptr3
,
700 LAYER_PTR (Entry
->Data
.
701 MoveToLayer
.OriginalLayer
), true);
702 Entry
->Data
.MoveToLayer
.OriginalLayer
= swap
;
708 /* ---------------------------------------------------------------------------
709 * recovers a removed polygon point
710 * returns true on success
713 UndoRemovePoint (UndoListTypePtr Entry
)
716 PolygonTypePtr polygon
;
720 /* lookup entry (polygon not point was saved) by it's ID */
721 assert (Entry
->Kind
== POLYGON_TYPE
);
723 SearchObjectByID (PCB
->Data
, (void *) &layer
, (void *) &polygon
, &ptr3
,
724 Entry
->ID
, Entry
->Kind
);
727 case POLYGON_TYPE
: /* restore the removed point */
729 if (TEST_FLAG (LOCKFLAG
, polygon
))
731 /* recover the point */
732 if (andDraw
&& layer
->On
)
733 ErasePolygon (polygon
);
734 InsertPointIntoObject (POLYGON_TYPE
, layer
, polygon
,
735 &Entry
->Data
.RemovedPoint
.Index
,
736 Entry
->Data
.RemovedPoint
.X
,
737 Entry
->Data
.RemovedPoint
.Y
, true,
738 Entry
->Data
.RemovedPoint
.last_in_contour
);
740 polygon
->Points
[Entry
->Data
.RemovedPoint
.Index
].ID
=
741 Entry
->Data
.RemovedPoint
.ID
;
742 if (andDraw
&& layer
->On
)
743 DrawPolygon (layer
, polygon
, 0);
744 Entry
->Type
= UNDO_INSERT_POINT
;
745 Entry
->ID
= Entry
->Data
.RemovedPoint
.ID
;
746 Entry
->Kind
= POLYGONPOINT_TYPE
;
755 /* ---------------------------------------------------------------------------
756 * recovers an inserted polygon point
757 * returns true on success
760 UndoInsertPoint (UndoListTypePtr Entry
)
763 PolygonTypePtr polygon
;
768 bool last_in_contour
= false;
770 assert (Entry
->Kind
== POLYGONPOINT_TYPE
);
771 /* lookup entry by it's ID */
773 SearchObjectByID (PCB
->Data
, (void *) &layer
, (void *) &polygon
,
774 (void *) &pnt
, Entry
->ID
, Entry
->Kind
);
777 case POLYGONPOINT_TYPE
: /* removes an inserted polygon point */
779 if (TEST_FLAG (LOCKFLAG
, polygon
))
781 if (andDraw
&& layer
->On
)
782 ErasePolygon (polygon
);
784 /* Check whether this point was at the end of its contour.
785 * If so, we need to flag as such when re-adding the point
786 * so it goes back in the correct place
788 point_idx
= polygon_point_idx (polygon
, pnt
);
789 for (hole
= 0; hole
< polygon
->HoleIndexN
; hole
++)
790 if (point_idx
== polygon
->HoleIndex
[hole
] - 1)
791 last_in_contour
= true;
792 if (point_idx
== polygon
->PointN
- 1)
793 last_in_contour
= true;
794 Entry
->Data
.RemovedPoint
.last_in_contour
= last_in_contour
;
796 Entry
->Data
.RemovedPoint
.X
= pnt
->X
;
797 Entry
->Data
.RemovedPoint
.Y
= pnt
->Y
;
798 Entry
->Data
.RemovedPoint
.ID
= pnt
->ID
;
799 Entry
->ID
= polygon
->ID
;
800 Entry
->Kind
= POLYGON_TYPE
;
801 Entry
->Type
= UNDO_REMOVE_POINT
;
802 Entry
->Data
.RemovedPoint
.Index
= point_idx
;
803 DestroyObject (PCB
->Data
, POLYGONPOINT_TYPE
, layer
, polygon
, pnt
);
804 if (andDraw
&& layer
->On
)
805 DrawPolygon (layer
, polygon
, 0);
815 UndoSwapCopiedObject (UndoListTypePtr Entry
)
817 void *ptr1
, *ptr2
, *ptr3
;
818 void *ptr1b
, *ptr2b
, *ptr3b
;
819 AnyObjectType
*obj
, *obj2
;
823 /* lookup entry by it's ID */
825 SearchObjectByID (RemoveList
, &ptr1
, &ptr2
, &ptr3
, Entry
->Data
.CopyID
,
831 SearchObjectByID (PCB
->Data
, &ptr1b
, &ptr2b
, &ptr3b
, Entry
->ID
,
843 MoveObjectToBuffer (RemoveList
, PCB
->Data
, type
, ptr1b
, ptr2b
, ptr3b
);
846 DrawRecoveredObject (Entry
->Kind
, ptr1
, ptr2
, ptr3
);
848 obj
= MoveObjectToBuffer (PCB
->Data
, RemoveList
, type
, ptr1
, ptr2
, ptr3
);
849 if (Entry
->Kind
== POLYGON_TYPE
)
850 InitClip (PCB
->Data
, ptr1b
, (PolygonType
*)obj
);
854 /* ---------------------------------------------------------------------------
855 * recovers an removed polygon point
856 * returns true on success
859 UndoRemoveContour (UndoListTypePtr Entry
)
861 assert (Entry
->Kind
== POLYGON_TYPE
);
862 return UndoSwapCopiedObject (Entry
);
865 /* ---------------------------------------------------------------------------
866 * recovers an inserted polygon point
867 * returns true on success
870 UndoInsertContour (UndoListTypePtr Entry
)
872 assert (Entry
->Kind
== POLYGON_TYPE
);
873 return UndoSwapCopiedObject (Entry
);
876 /* ---------------------------------------------------------------------------
877 * undo a layer change
878 * returns true on success
881 UndoLayerChange (UndoListTypePtr Entry
)
883 LayerChangeTypePtr l
= &Entry
->Data
.LayerChange
;
887 l
->new_index
= l
->old_index
;
890 if (MoveLayer (l
->old_index
, l
->new_index
))
896 /* ---------------------------------------------------------------------------
897 * undo a netlist change
898 * returns true on success
901 UndoNetlistChange (UndoListTypePtr Entry
)
903 NetlistChangeTypePtr l
= & Entry
->Data
.NetlistChange
;
905 LibraryTypePtr lib
, saved
;
910 /* iterate over each net */
911 for (i
= 0 ; i
< lib
->MenuN
; i
++)
913 if (lib
->Menu
[i
].Name
)
914 free (lib
->Menu
[i
].Name
);
916 if (lib
->Menu
[i
].directory
)
917 free (lib
->Menu
[i
].directory
);
919 if (lib
->Menu
[i
].Style
)
920 free (lib
->Menu
[i
].Style
);
922 /* iterate over each pin on the net */
923 for (j
= 0; j
< lib
->Menu
[i
].EntryN
; j
++) {
925 if (lib
->Menu
[i
].Entry
[j
].ListEntry
)
926 free (lib
->Menu
[i
].Entry
[j
].ListEntry
);
928 if (lib
->Menu
[i
].Entry
[j
].AllocatedMemory
)
929 free (lib
->Menu
[i
].Entry
[j
].AllocatedMemory
);
931 if (lib
->Menu
[i
].Entry
[j
].Template
)
932 free (lib
->Menu
[i
].Entry
[j
].Template
);
934 if (lib
->Menu
[i
].Entry
[j
].Package
)
935 free (lib
->Menu
[i
].Entry
[j
].Package
);
937 if (lib
->Menu
[i
].Entry
[j
].Value
)
938 free (lib
->Menu
[i
].Entry
[j
].Value
);
940 if (lib
->Menu
[i
].Entry
[j
].Description
)
941 free (lib
->Menu
[i
].Entry
[j
].Description
);
955 /* ---------------------------------------------------------------------------
956 * undo of any 'hard to recover' operation
958 * returns the bitfield for the types of operations that were undone
967 unique
= TEST_FLAG (UNIQUENAMEFLAG
, PCB
);
968 CLEAR_FLAG (UNIQUENAMEFLAG
, PCB
);
977 Message (_("Nothing to undo - buffer is empty\n"));
983 /* lock undo module to prevent from loops
984 * and loop over all entries with the same serial number
986 ptr
= &UndoList
[UndoN
- 1];
987 if (ptr
->Serial
!= Serial
- 1)
989 Message (_("Undo bad serial number %d expecting %d\n"),
990 ptr
->Serial
, Serial
- 1);
991 Serial
= ptr
->Serial
+ 1;
995 Serial
= ptr
->Serial
;
996 for (; UndoN
&& ptr
->Serial
== Serial
; ptr
--, UndoN
--, RedoN
++)
997 Types
|= PerformUndo (ptr
);
1002 if (Types
&& andDraw
)
1005 /* restore the unique flag setting */
1007 SET_FLAG (UNIQUENAMEFLAG
, PCB
);
1013 PerformUndo (UndoListTypePtr ptr
)
1017 case UNDO_CHANGENAME
:
1018 if (UndoChangeName (ptr
))
1019 return (UNDO_CHANGENAME
);
1023 if (UndoCopyOrCreate (ptr
))
1024 return (UNDO_CREATE
);
1033 if (UndoRemove (ptr
))
1034 return (UNDO_REMOVE
);
1037 case UNDO_REMOVE_POINT
:
1038 if (UndoRemovePoint (ptr
))
1039 return (UNDO_REMOVE_POINT
);
1042 case UNDO_INSERT_POINT
:
1043 if (UndoInsertPoint (ptr
))
1044 return (UNDO_INSERT_POINT
);
1047 case UNDO_REMOVE_CONTOUR
:
1048 if (UndoRemoveContour (ptr
))
1049 return (UNDO_REMOVE_CONTOUR
);
1052 case UNDO_INSERT_CONTOUR
:
1053 if (UndoInsertContour (ptr
))
1054 return (UNDO_INSERT_CONTOUR
);
1058 if (UndoRotate (ptr
))
1059 return (UNDO_ROTATE
);
1063 if (UndoClearPoly (ptr
))
1064 return (UNDO_CLEAR
);
1067 case UNDO_MOVETOLAYER
:
1068 if (UndoMoveToLayer (ptr
))
1069 return (UNDO_MOVETOLAYER
);
1077 case UNDO_CHANGESIZE
:
1078 if (UndoChangeSize (ptr
))
1079 return (UNDO_CHANGESIZE
);
1082 case UNDO_CHANGECLEARSIZE
:
1083 if (UndoChangeClearSize (ptr
))
1084 return (UNDO_CHANGECLEARSIZE
);
1087 case UNDO_CHANGEMASKSIZE
:
1088 if (UndoChangeMaskSize (ptr
))
1089 return (UNDO_CHANGEMASKSIZE
);
1092 case UNDO_CHANGE2NDSIZE
:
1093 if (UndoChange2ndSize (ptr
))
1094 return (UNDO_CHANGE2NDSIZE
);
1097 case UNDO_CHANGEANGLES
:
1098 if (UndoChangeAngles (ptr
))
1099 return (UNDO_CHANGEANGLES
);
1102 case UNDO_LAYERCHANGE
:
1103 if (UndoLayerChange (ptr
))
1104 return (UNDO_LAYERCHANGE
);
1107 case UNDO_NETLISTCHANGE
:
1108 if (UndoNetlistChange (ptr
))
1109 return (UNDO_NETLISTCHANGE
);
1113 if (UndoMirror (ptr
))
1114 return (UNDO_MIRROR
);
1120 /* ---------------------------------------------------------------------------
1121 * redo of any 'hard to recover' operation
1123 * returns the number of operations redone
1128 UndoListTypePtr ptr
;
1138 ("Nothing to redo. Perhaps changes have been made since last undo\n"));
1142 /* lock undo module to prevent from loops
1143 * and loop over all entries with the same serial number
1146 ptr
= &UndoList
[UndoN
];
1147 Serial
= ptr
->Serial
;
1148 for (; RedoN
&& ptr
->Serial
== Serial
; ptr
++, UndoN
++, RedoN
--)
1149 Types
|= PerformUndo (ptr
);
1150 /* Make next serial number current in case we take a new branch */
1155 if (Types
&& andDraw
)
1160 /* ---------------------------------------------------------------------------
1161 * restores the serial number of the undo list
1164 RestoreUndoSerialNumber (void)
1166 Serial
= SavedSerial
;
1169 /* ---------------------------------------------------------------------------
1170 * saves the serial number of the undo list
1173 SaveUndoSerialNumber (void)
1176 SavedSerial
= Serial
;
1179 /* ---------------------------------------------------------------------------
1180 * increments the serial number of the undo list
1181 * it's not done automatically because some operations perform more
1182 * than one request with the same serial #
1185 IncrementUndoSerialNumber (void)
1189 /* don't increment if nothing was added */
1190 if (UndoN
== 0 || UndoList
[UndoN
- 1].Serial
!= Serial
)
1194 SetChangedFlag (true);
1198 /* ---------------------------------------------------------------------------
1199 * releases memory of the undo- and remove list
1202 ClearUndoList (bool Force
)
1204 UndoListTypePtr undo
;
1207 && (Force
|| gui
->confirm_dialog ("OK to clear 'undo' buffer?", 0)))
1209 /* release memory allocated by objects in undo list */
1210 for (undo
= UndoList
; UndoN
; undo
++, UndoN
--)
1212 if (undo
->Type
== UNDO_CHANGENAME
)
1213 free (undo
->Data
.ChangeName
.Name
);
1219 FreeDataMemory (RemoveList
);
1224 /* reset some counters */
1225 UndoN
= UndoMax
= RedoN
= 0;
1228 /* reset counter in any case */
1232 /* ---------------------------------------------------------------------------
1233 * adds an object to the list of clearpoly objects
1236 AddObjectToClearPolyUndoList (int Type
, void *Ptr1
, void *Ptr2
, void *Ptr3
,
1239 UndoListTypePtr undo
;
1243 undo
= GetUndoSlot (UNDO_CLEAR
, OBJECT_ID (Ptr3
), Type
);
1244 undo
->Data
.ClearPoly
.Clear
= clear
;
1245 undo
->Data
.ClearPoly
.Layer
= (LayerTypePtr
) Ptr1
;
1249 /* ---------------------------------------------------------------------------
1250 * adds an object to the list of mirrored objects
1253 AddObjectToMirrorUndoList (int Type
, void *Ptr1
, void *Ptr2
, void *Ptr3
,
1256 UndoListTypePtr undo
;
1260 undo
= GetUndoSlot (UNDO_MIRROR
, OBJECT_ID (Ptr3
), Type
);
1261 undo
->Data
.Move
.DY
= yoff
;
1265 /* ---------------------------------------------------------------------------
1266 * adds an object to the list of rotated objects
1269 AddObjectToRotateUndoList (int Type
, void *Ptr1
, void *Ptr2
, void *Ptr3
,
1270 LocationType CenterX
, LocationType CenterY
,
1273 UndoListTypePtr undo
;
1277 undo
= GetUndoSlot (UNDO_ROTATE
, OBJECT_ID (Ptr3
), Type
);
1278 undo
->Data
.Rotate
.CenterX
= CenterX
;
1279 undo
->Data
.Rotate
.CenterY
= CenterY
;
1280 undo
->Data
.Rotate
.Steps
= Steps
;
1284 /* ---------------------------------------------------------------------------
1285 * adds an object to the list of removed objects and removes it from
1289 MoveObjectToRemoveUndoList (int Type
, void *Ptr1
, void *Ptr2
, void *Ptr3
)
1291 UndoListTypePtr undo
;
1296 RemoveList
= CreateNewBuffer ();
1298 undo
= GetUndoSlot (UNDO_REMOVE
, OBJECT_ID (Ptr3
), Type
);
1299 MoveObjectToBuffer (RemoveList
, PCB
->Data
, Type
, Ptr1
, Ptr2
, Ptr3
);
1303 /* ---------------------------------------------------------------------------
1304 * adds an object to the list of removed polygon/... points
1307 AddObjectToRemovePointUndoList (int Type
,
1308 void *Ptr1
, void *Ptr2
, Cardinal index
)
1310 UndoListTypePtr undo
;
1311 PolygonTypePtr polygon
= (PolygonTypePtr
) Ptr2
;
1313 bool last_in_contour
= false;
1319 case POLYGONPOINT_TYPE
:
1321 /* save the ID of the parent object; else it will be
1322 * impossible to recover the point
1325 GetUndoSlot (UNDO_REMOVE_POINT
, OBJECT_ID (polygon
),
1327 undo
->Data
.RemovedPoint
.X
= polygon
->Points
[index
].X
;
1328 undo
->Data
.RemovedPoint
.Y
= polygon
->Points
[index
].Y
;
1329 undo
->Data
.RemovedPoint
.ID
= polygon
->Points
[index
].ID
;
1330 undo
->Data
.RemovedPoint
.Index
= index
;
1332 /* Check whether this point was at the end of its contour.
1333 * If so, we need to flag as such when re-adding the point
1334 * so it goes back in the correct place
1336 for (hole
= 0; hole
< polygon
->HoleIndexN
; hole
++)
1337 if (index
== polygon
->HoleIndex
[hole
] - 1)
1338 last_in_contour
= true;
1339 if (index
== polygon
->PointN
- 1)
1340 last_in_contour
= true;
1341 undo
->Data
.RemovedPoint
.last_in_contour
= last_in_contour
;
1348 /* ---------------------------------------------------------------------------
1349 * adds an object to the list of inserted polygon/... points
1352 AddObjectToInsertPointUndoList (int Type
, void *Ptr1
, void *Ptr2
, void *Ptr3
)
1354 UndoListTypePtr undo
;
1357 undo
= GetUndoSlot (UNDO_INSERT_POINT
, OBJECT_ID (Ptr3
), Type
);
1361 CopyObjectToUndoList (int undo_type
, int Type
, void *Ptr1
, void *Ptr2
, void *Ptr3
)
1363 UndoListTypePtr undo
;
1364 AnyObjectType
*copy
;
1370 RemoveList
= CreateNewBuffer ();
1372 undo
= GetUndoSlot (undo_type
, OBJECT_ID (Ptr2
), Type
);
1373 copy
= CopyObjectToBuffer (RemoveList
, PCB
->Data
, Type
, Ptr1
, Ptr2
, Ptr3
);
1374 undo
->Data
.CopyID
= copy
->ID
;
1377 /* ---------------------------------------------------------------------------
1378 * adds an object to the list of removed contours
1379 * (Actually just takes a copy of the whole polygon to restore)
1382 AddObjectToRemoveContourUndoList (int Type
,
1383 LayerType
*Layer
, PolygonType
*Polygon
)
1385 CopyObjectToUndoList (UNDO_REMOVE_CONTOUR
, Type
, Layer
, Polygon
, NULL
);
1388 /* ---------------------------------------------------------------------------
1389 * adds an object to the list of insert contours
1390 * (Actually just takes a copy of the whole polygon to restore)
1393 AddObjectToInsertContourUndoList (int Type
,
1394 LayerType
*Layer
, PolygonType
*Polygon
)
1396 CopyObjectToUndoList (UNDO_INSERT_CONTOUR
, Type
, Layer
, Polygon
, NULL
);
1399 /* ---------------------------------------------------------------------------
1400 * adds an object to the list of moved objects
1403 AddObjectToMoveUndoList (int Type
, void *Ptr1
, void *Ptr2
, void *Ptr3
,
1404 LocationType DX
, LocationType DY
)
1406 UndoListTypePtr undo
;
1410 undo
= GetUndoSlot (UNDO_MOVE
, OBJECT_ID (Ptr3
), Type
);
1411 undo
->Data
.Move
.DX
= DX
;
1412 undo
->Data
.Move
.DY
= DY
;
1416 /* ---------------------------------------------------------------------------
1417 * adds an object to the list of objects with changed names
1420 AddObjectToChangeNameUndoList (int Type
, void *Ptr1
, void *Ptr2
, void *Ptr3
,
1423 UndoListTypePtr undo
;
1427 undo
= GetUndoSlot (UNDO_CHANGENAME
, OBJECT_ID (Ptr3
), Type
);
1428 undo
->Data
.ChangeName
.Name
= OldName
;
1432 /* ---------------------------------------------------------------------------
1433 * adds an object to the list of objects moved to another layer
1436 AddObjectToMoveToLayerUndoList (int Type
, void *Ptr1
, void *Ptr2
, void *Ptr3
)
1438 UndoListTypePtr undo
;
1442 undo
= GetUndoSlot (UNDO_MOVETOLAYER
, OBJECT_ID (Ptr3
), Type
);
1443 undo
->Data
.MoveToLayer
.OriginalLayer
=
1444 GetLayerNumber (PCB
->Data
, (LayerTypePtr
) Ptr1
);
1448 /* ---------------------------------------------------------------------------
1449 * adds an object to the list of created objects
1452 AddObjectToCreateUndoList (int Type
, void *Ptr1
, void *Ptr2
, void *Ptr3
)
1454 UndoListTypePtr undo
;
1457 undo
= GetUndoSlot (UNDO_CREATE
, OBJECT_ID (Ptr3
), Type
);
1458 ClearFromPolygon (PCB
->Data
, Type
, Ptr1
, Ptr2
);
1461 /* ---------------------------------------------------------------------------
1462 * adds an object to the list of objects with flags changed
1465 AddObjectToFlagUndoList (int Type
, void *Ptr1
, void *Ptr2
, void *Ptr3
)
1467 UndoListTypePtr undo
;
1471 undo
= GetUndoSlot (UNDO_FLAG
, OBJECT_ID (Ptr2
), Type
);
1472 undo
->Data
.Flags
= ((PinTypePtr
) Ptr2
)->Flags
;
1476 /* ---------------------------------------------------------------------------
1477 * adds an object to the list of objects with Size changes
1480 AddObjectToSizeUndoList (int Type
, void *ptr1
, void *ptr2
, void *ptr3
)
1482 UndoListTypePtr undo
;
1486 undo
= GetUndoSlot (UNDO_CHANGESIZE
, OBJECT_ID (ptr2
), Type
);
1491 undo
->Data
.Size
= ((PinTypePtr
) ptr2
)->Thickness
;
1494 case ELEMENTLINE_TYPE
:
1495 undo
->Data
.Size
= ((LineTypePtr
) ptr2
)->Thickness
;
1498 case ELEMENTNAME_TYPE
:
1499 undo
->Data
.Size
= ((TextTypePtr
) ptr2
)->Scale
;
1502 undo
->Data
.Size
= ((PadTypePtr
) ptr2
)->Thickness
;
1505 case ELEMENTARC_TYPE
:
1506 undo
->Data
.Size
= ((ArcTypePtr
) ptr2
)->Thickness
;
1512 /* ---------------------------------------------------------------------------
1513 * adds an object to the list of objects with Size changes
1516 AddObjectToClearSizeUndoList (int Type
, void *ptr1
, void *ptr2
, void *ptr3
)
1518 UndoListTypePtr undo
;
1522 undo
= GetUndoSlot (UNDO_CHANGECLEARSIZE
, OBJECT_ID (ptr2
), Type
);
1527 undo
->Data
.Size
= ((PinTypePtr
) ptr2
)->Clearance
;
1530 undo
->Data
.Size
= ((LineTypePtr
) ptr2
)->Clearance
;
1533 undo
->Data
.Size
= ((PadTypePtr
) ptr2
)->Clearance
;
1536 undo
->Data
.Size
= ((ArcTypePtr
) ptr2
)->Clearance
;
1542 /* ---------------------------------------------------------------------------
1543 * adds an object to the list of objects with Size changes
1546 AddObjectToMaskSizeUndoList (int Type
, void *ptr1
, void *ptr2
, void *ptr3
)
1548 UndoListTypePtr undo
;
1552 undo
= GetUndoSlot (UNDO_CHANGEMASKSIZE
, OBJECT_ID (ptr2
), Type
);
1557 undo
->Data
.Size
= ((PinTypePtr
) ptr2
)->Mask
;
1560 undo
->Data
.Size
= ((PadTypePtr
) ptr2
)->Mask
;
1566 /* ---------------------------------------------------------------------------
1567 * adds an object to the list of objects with 2ndSize changes
1570 AddObjectTo2ndSizeUndoList (int Type
, void *ptr1
, void *ptr2
, void *ptr3
)
1572 UndoListTypePtr undo
;
1576 undo
= GetUndoSlot (UNDO_CHANGE2NDSIZE
, OBJECT_ID (ptr2
), Type
);
1577 if (Type
== PIN_TYPE
|| Type
== VIA_TYPE
)
1578 undo
->Data
.Size
= ((PinTypePtr
) ptr2
)->DrillingHole
;
1582 /* ---------------------------------------------------------------------------
1583 * adds an object to the list of changed angles. Note that you must
1584 * call this before changing the angles, passing the new start/delta.
1587 AddObjectToChangeAnglesUndoList (int Type
, void *Ptr1
, void *Ptr2
, void *Ptr3
)
1589 UndoListTypePtr undo
;
1590 ArcTypePtr a
= (ArcTypePtr
) Ptr3
;
1594 undo
= GetUndoSlot (UNDO_CHANGEANGLES
, OBJECT_ID (Ptr3
), Type
);
1595 undo
->Data
.Move
.DX
= a
->StartAngle
;
1596 undo
->Data
.Move
.DY
= a
->Delta
;
1600 /* ---------------------------------------------------------------------------
1601 * adds a layer change (new, delete, move) to the undo list.
1604 AddLayerChangeToUndoList (int old_index
, int new_index
)
1606 UndoListTypePtr undo
;
1610 undo
= GetUndoSlot (UNDO_LAYERCHANGE
, 0, 0);
1611 undo
->Data
.LayerChange
.old_index
= old_index
;
1612 undo
->Data
.LayerChange
.new_index
= new_index
;
1616 /* ---------------------------------------------------------------------------
1617 * adds a netlist change to the undo list
1620 AddNetlistLibToUndoList (LibraryTypePtr lib
)
1622 UndoListTypePtr undo
;
1628 undo
= GetUndoSlot (UNDO_NETLISTCHANGE
, 0, 0);
1629 /* keep track of where the data needs to go */
1630 undo
->Data
.NetlistChange
.lib
= lib
;
1632 /* and what the old data is that we'll need to restore */
1633 undo
->Data
.NetlistChange
.old
= malloc (sizeof (LibraryTypePtr
));
1634 old
= undo
->Data
.NetlistChange
.old
;
1635 old
->MenuN
= lib
->MenuN
;
1636 old
->MenuMax
= lib
->MenuMax
;
1637 old
->Menu
= malloc (old
->MenuMax
* sizeof (LibraryMenuType
));
1638 if (old
->Menu
== NULL
)
1640 fprintf (stderr
, "malloc() failed in %s\n", __FUNCTION__
);
1644 /* iterate over each net */
1645 for (i
= 0 ; i
< lib
->MenuN
; i
++)
1647 old
->Menu
[i
].EntryN
= lib
->Menu
[i
].EntryN
;
1648 old
->Menu
[i
].EntryMax
= lib
->Menu
[i
].EntryMax
;
1651 lib
->Menu
[i
].Name
? strdup (lib
->Menu
[i
].Name
) : NULL
;
1653 old
->Menu
[i
].directory
=
1654 lib
->Menu
[i
].directory
? strdup (lib
->Menu
[i
].directory
) : NULL
;
1656 old
->Menu
[i
].Style
=
1657 lib
->Menu
[i
].Style
? strdup (lib
->Menu
[i
].Style
) : NULL
;
1660 old
->Menu
[i
].Entry
=
1661 malloc (old
->Menu
[i
].EntryMax
* sizeof (LibraryEntryType
));
1662 if (old
->Menu
[i
].Entry
== NULL
)
1664 fprintf (stderr
, "malloc() failed in %s\n", __FUNCTION__
);
1668 /* iterate over each pin on the net */
1669 for (j
= 0; j
< lib
->Menu
[i
].EntryN
; j
++) {
1671 old
->Menu
[i
].Entry
[j
].ListEntry
=
1672 lib
->Menu
[i
].Entry
[j
].ListEntry
?
1673 strdup (lib
->Menu
[i
].Entry
[j
].ListEntry
) :
1676 old
->Menu
[i
].Entry
[j
].AllocatedMemory
=
1677 lib
->Menu
[i
].Entry
[j
].AllocatedMemory
?
1678 strdup (lib
->Menu
[i
].Entry
[j
].AllocatedMemory
) :
1681 old
->Menu
[i
].Entry
[j
].Template
=
1682 lib
->Menu
[i
].Entry
[j
].Template
?
1683 strdup (lib
->Menu
[i
].Entry
[j
].Template
) :
1686 old
->Menu
[i
].Entry
[j
].Package
=
1687 lib
->Menu
[i
].Entry
[j
].Package
?
1688 strdup (lib
->Menu
[i
].Entry
[j
].Package
) :
1691 old
->Menu
[i
].Entry
[j
].Value
=
1692 lib
->Menu
[i
].Entry
[j
].Value
?
1693 strdup (lib
->Menu
[i
].Entry
[j
].Value
) :
1696 old
->Menu
[i
].Entry
[j
].Description
=
1697 lib
->Menu
[i
].Entry
[j
].Description
?
1698 strdup (lib
->Menu
[i
].Entry
[j
].Description
) :
1708 /* ---------------------------------------------------------------------------
1717 /* ---------------------------------------------------------------------------
1726 /* ---------------------------------------------------------------------------
1727 * return undo lock state