1 /*------------------------------------------------------------\
2 | |
3 | This file is part of the Alliance CAD System Copyright |
4 | (C) Laboratoire LIP6 - D�partement ASIM Universite P&M Curie|
5 | |
6 | Home page : http://www-asim.lip6.fr/alliance/ |
7 | E-mail : mailto:alliance-users@asim.lip6.fr |
8 | |
9 | This progam is free software; you can redistribute it |
10 | and/or modify it under the terms of the GNU General Public |
11 | License as published by the Free Software Foundation; |
12 | either version 2 of the License, or (at your option) any |
13 | later version. |
14 | |
15 | Alliance VLSI CAD System is distributed in the hope that |
16 | it will be useful, but WITHOUT ANY WARRANTY; |
17 | without even the implied warranty of MERCHANTABILITY or |
18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
19 | Public License for more details. |
20 | |
21 | You should have received a copy of the GNU General Public |
22 | License along with the GNU C Library; see the file COPYING. |
23 | If not, write to the Free Software Foundation, Inc., |
24 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
25 | |
26 \------------------------------------------------------------*/
27
28 /*------------------------------------------------------------\
29 | |
30 | Tool : GRAAL |
31 | |
32 | File : Modify.c |
33 | |
34 | Author : Jacomme Ludovic |
35 | |
36 | Date : 28.03.95 |
37 | |
38 \------------------------------------------------------------*/
39
40 /*------------------------------------------------------------\
41 | |
42 | Include Files |
43 | |
44 \------------------------------------------------------------*/
45
46 # include <stdio.h>
47 # include <Xm/Xm.h>
48 # include <Xm/PushBG.h>
49 # include <Xm/CascadeBG.h>
50
51 # include "mut.h"
52 # include "mph.h"
53 # include "rds.h"
54 # include "rpr.h"
55 # include "rfm.h"
56 # include "GSB.h"
57 # include "GRM.h"
58 # include "GMX.h"
59 # include "GTB.h"
60 # include "GME.h"
61 # include "GMT.h"
62 # include "GMV.h"
63
64 # include "GME_modify.h"
65 # include "GME_panel.h"
66 # include "GME_edit.h"
67 # include "GME_message.h"
68 # include "GME_dialog.h"
69
70 /*------------------------------------------------------------\
71 | |
72 | Constants |
73 | |
74 \------------------------------------------------------------*/
75 /*------------------------------------------------------------\
76 | |
77 | Types |
78 | |
79 \------------------------------------------------------------*/
80 /*------------------------------------------------------------\
81 | |
82 | Variables |
83 | |
84 \------------------------------------------------------------*/
85
86 char GraalModifyAbort = 0;
87 char GraalModifyLock = 0;
88 char GraalModifyApply = 0;
89
90 /*------------------------------------------------------------\
91 | |
92 | Segment & Wire |
93 | |
94 \------------------------------------------------------------*/
95
96 char GraalSegmentMLayer;
97 float GraalSegmentMWidth;
98 char *GraalSegmentMName;
99
100 /*------------------------------------------------------------\
101 | |
102 | Via |
103 | |
104 \------------------------------------------------------------*/
105
106 char GraalViaMType;
107 char *GraalViaMName;
108
109 /*------------------------------------------------------------\
110 | |
111 | Transistor |
112 | |
113 \------------------------------------------------------------*/
114
115 char GraalTransistorMType;
116 char *GraalTransistorMName;
117 float GraalTransistorMWidth;
118
119 /*------------------------------------------------------------\
120 | |
121 | Connector |
122 | |
123 \------------------------------------------------------------*/
124
125 char GraalConnectorMLayer;
126 float GraalConnectorMWidth;
127 char *GraalConnectorMName;
128 char GraalConnectorMOrient;
129
130 char GraalSaveConnectorMOrient;
131
132 /*------------------------------------------------------------\
133 | |
134 | Reference |
135 | |
136 \------------------------------------------------------------*/
137
138 char GraalReferenceMType;
139 char *GraalReferenceMName;
140
141 char GraalSaveReferenceMType;
142
143 /*------------------------------------------------------------\
144 | |
145 | Instance |
146 | |
147 \------------------------------------------------------------*/
148
149 char GraalInstanceMSym;
150 char *GraalInstanceMName;
151 char *GraalInstanceMModel;
152
153 /*------------------------------------------------------------\
154 | |
155 | Functions |
156 | |
157 \------------------------------------------------------------*/
158 /*------------------------------------------------------------\
159 | |
160 | Changed Functions |
161 | |
162 \------------------------------------------------------------*/
163 /*------------------------------------------------------------\
164 | |
165 | GraalTransistorChanged |
166 | |
167 \------------------------------------------------------------*/
168
GraalTransistorChanged(Transistor)169 char GraalTransistorChanged( Transistor )
170
171 phseg_list *Transistor;
172 {
173 return
174
175 ( ( Transistor->NAME != GraalTransistorMName ) ||
176 ( Transistor->LAYER != GraalTransistorMType ) ||
177 ( ( Transistor->WIDTH / (float)SCALE_X ) != GraalTransistorMWidth ) );
178 }
179
180 /*------------------------------------------------------------\
181 | |
182 | GraalSegmentChanged |
183 | |
184 \------------------------------------------------------------*/
185
GraalSegmentChanged(Segment)186 char GraalSegmentChanged( Segment )
187
188 phseg_list *Segment;
189 {
190 return
191
192 ( ( Segment->NAME != GraalSegmentMName ) ||
193 ( Segment->LAYER != GraalSegmentMLayer ) ||
194 ( ( Segment->WIDTH / (float)SCALE_X ) != GraalSegmentMWidth ) );
195 }
196
197 /*------------------------------------------------------------\
198 | |
199 | GraalViaChanged |
200 | |
201 \------------------------------------------------------------*/
202
GraalViaChanged(Via)203 char GraalViaChanged( Via )
204
205 phseg_list *Via;
206 {
207 return ( ( Via->TYPE != GraalViaMType ) ||
208 ( Via->NAME != GraalViaMName ) );
209 }
210
211 /*------------------------------------------------------------\
212 | |
213 | GraalConnectorChanged |
214 | |
215 \------------------------------------------------------------*/
216
GraalConnectorChanged(Connector)217 char GraalConnectorChanged( Connector )
218
219 phcon_list *Connector;
220 {
221 return
222
223 ( ( Connector->NAME != GraalConnectorMName ) ||
224 ( Connector->LAYER != GraalConnectorMLayer ) ||
225 ( ( Connector->WIDTH / (float)SCALE_X ) != GraalConnectorMWidth ) ||
226 ( GraalSaveConnectorMOrient != GraalConnectorMOrient ) );
227 }
228
229 /*------------------------------------------------------------\
230 | |
231 | GraalReferenceChanged |
232 | |
233 \------------------------------------------------------------*/
234
GraalReferenceChanged(Reference)235 char GraalReferenceChanged( Reference )
236
237 phref_list *Reference;
238 {
239 return
240
241 ( ( Reference->NAME != GraalReferenceMName ) ||
242 ( GraalSaveReferenceMType != GraalReferenceMType ) );
243 }
244
245 /*------------------------------------------------------------\
246 | |
247 | GraalInstanceChanged |
248 | |
249 \------------------------------------------------------------*/
250
GraalInstanceChanged(Instance)251 char GraalInstanceChanged( Instance )
252
253 phins_list *Instance;
254 {
255 return
256
257 ( ( Instance->INSNAME != GraalInstanceMName ) ||
258 ( Instance->TRANSF != GraalInstanceMSym ) ||
259 ( Instance->FIGNAME != GraalInstanceMModel ) );
260 }
261
262 /*------------------------------------------------------------\
263 | |
264 | GraalEditModify |
265 | |
266 \------------------------------------------------------------*/
267
GraalEditModify()268 void GraalEditModify()
269
270 {
271 graalselect *Select;
272 rdsrec_list *Rectangle;
273 rdsrec_list *NewRec;
274 rdsins_list *Instance;
275 phins_list *SaveInstance;
276 void *Pointer;
277 void *Element;
278 char FirstUndo;
279 char MbkLayer;
280 char MbkOrient = '-';
281
282 rdsbegin();
283
284 FirstUndo = 1;
285
286 GraalModifyAbort = 0;
287 GraalModifyApply = 0;
288 GraalModifyLock = 0;
289
290 for ( Select = GraalHeadSelect;
291 Select != (graalselect *)NULL;
292 Select = Select->NEXT )
293 {
294 Rectangle = Select->RECTANGLE;
295
296 if ( IsRdsSegment( Rectangle ) )
297 {
298 Pointer = GRAAL_MBK( Rectangle );
299
300 MbkLayer = ((phseg_list *)Pointer)->LAYER;
301
302 if ( GET_LYNX_TRANSISTOR_TYPE( MbkLayer ) != RDS_LYNX_TRANSISTOR_EMPTY )
303 {
304 GraalAcceptRectangle( Rectangle );
305 GraalDisplayRectangle( Rectangle );
306
307 GraalTransistorMWidth = (float)( ((phseg_list *)Pointer)->WIDTH / (float)SCALE_X );
308 GraalTransistorMType = ((phseg_list *)Pointer)->LAYER;
309 GraalTransistorMName = ((phseg_list *)Pointer)->NAME;
310
311 GraalPromptModifyTransistor();
312 GraalEnterPanel( &GraalModifyTransistorPanel );
313
314 GraalModifyLock = GRAAL_TRUE;
315
316 while ( GraalModifyLock )
317 {
318 GraalLimitedLoop( GraalModifyTransistorPanel.PANEL );
319 }
320
321 GraalRejectRectangle( Rectangle );
322 GraalDisplayRectangle( Rectangle );
323
324 if ( GraalModifyAbort ) break;
325
326 if ( GraalModifyApply )
327 {
328 if ( ! GraalTransistorChanged( (phseg_list *)Pointer ) )
329
330 continue;
331
332 if ( FirstUndo )
333 {
334 GraalAddUndo();
335
336 FirstUndo = 0;
337 }
338
339 GraalDeleteRectangle( Rectangle );
340 GraalAddUndoRec( Rectangle );
341
342 Element = (void *)
343
344 addphseg( GraalFigureMbk,
345 GraalTransistorMType ,
346 (long)( GraalTransistorMWidth * SCALE_X ),
347 ((phseg_list *)Pointer)->X1,
348 ((phseg_list *)Pointer)->Y1,
349 ((phseg_list *)Pointer)->X2,
350 ((phseg_list *)Pointer)->Y2,
351 GraalTransistorMName );
352
353 ((phseg_list *)Element)->TYPE = ((phseg_list *)Pointer)->TYPE;
354 ((phseg_list *)Element)->USER = (void *)(&GraalFigureMbk->PHSEG);
355
356 if ( ((phseg_list *)Element)->NEXT != (phseg_list *)NULL )
357 {
358 ((phseg_list *)Element)->NEXT->USER = (void *)(&((phseg_list *)Element)->NEXT);
359 }
360
361 NewRec = GraalAddSegment( ((phseg_list *)Element) );
362 GraalAddUndoRec( NewRec );
363
364 GraalDisplayRectangle( NewRec );
365 }
366 }
367 }
368 }
369
370 GraalExitPanel( &GraalModifyTransistorPanel );
371
372 if ( ! GraalModifyAbort )
373
374 for ( Select = GraalHeadSelect;
375 Select != (graalselect *)NULL;
376 Select = Select->NEXT )
377 {
378 Rectangle = Select->RECTANGLE;
379
380 Pointer = GRAAL_MBK( Rectangle );
381
382 if ( IsRdsSegment( Rectangle ) )
383 {
384 if ( ( ((phseg_list *)Pointer)->LAYER != NTRANS ) &&
385 ( ((phseg_list *)Pointer)->LAYER != PTRANS ) )
386 {
387 GraalAcceptRectangle( Rectangle );
388 GraalDisplayRectangle( Rectangle );
389
390 GraalSegmentMWidth = (float)( ((phseg_list *)Pointer)->WIDTH / (float)SCALE_X );
391 GraalSegmentMLayer = ((phseg_list *)Pointer)->LAYER;
392 GraalSegmentMName = ((phseg_list *)Pointer)->NAME;
393
394 GraalPromptModifySegment();
395 GraalEnterPanel( &GraalModifySegmentPanel );
396
397 GraalModifyLock = GRAAL_TRUE;
398
399 while ( GraalModifyLock )
400 {
401 GraalLimitedLoop( GraalModifySegmentPanel.PANEL );
402 }
403
404 GraalRejectRectangle( Rectangle );
405 GraalDisplayRectangle( Rectangle );
406
407 if ( GraalModifyAbort ) break;
408
409 if ( GraalModifyApply )
410 {
411 if ( ! GraalSegmentChanged( (phseg_list *)Pointer ) )
412
413 continue;
414
415 if ( FirstUndo )
416 {
417 GraalAddUndo();
418
419 FirstUndo = 0;
420 }
421
422 GraalDeleteRectangle( Rectangle );
423 GraalAddUndoRec( Rectangle );
424
425 Element = (void *)
426
427 addphseg( GraalFigureMbk,
428 GraalSegmentMLayer,
429 (long)( GraalSegmentMWidth * SCALE_X ),
430 ((phseg_list *)Pointer)->X1,
431 ((phseg_list *)Pointer)->Y1,
432 ((phseg_list *)Pointer)->X2,
433 ((phseg_list *)Pointer)->Y2,
434 GraalSegmentMName );
435
436 ((phseg_list *)Element)->TYPE = ((phseg_list *)Pointer)->TYPE;
437 ((phseg_list *)Element)->USER = (void *)(&GraalFigureMbk->PHSEG);
438
439 if ( ((phseg_list *)Element)->NEXT != (phseg_list *)NULL )
440 {
441 ((phseg_list *)Element)->NEXT->USER = (void *)(&((phseg_list *)Element)->NEXT);
442 }
443
444 NewRec = GraalAddSegment( ((phseg_list *)Element) );
445 GraalAddUndoRec( NewRec );
446
447 GraalDisplayRectangle( NewRec );
448 }
449 }
450 }
451 }
452
453 GraalExitPanel( &GraalModifySegmentPanel );
454
455 if ( ! GraalModifyAbort )
456
457 for ( Select = GraalHeadSelect;
458 Select != (graalselect *)NULL;
459 Select = Select->NEXT )
460 {
461 Rectangle = Select->RECTANGLE;
462
463 if ( IsRdsVia( Rectangle ) )
464 {
465 GraalAcceptRectangle( Rectangle );
466 GraalDisplayRectangle( Rectangle );
467
468 Pointer = GRAAL_MBK( Rectangle );
469
470 if ( ( ((phvia_list *)Pointer)->DX == 0 ) &&
471 ( ((phvia_list *)Pointer)->DY == 0 ) )
472 {
473 GraalViaMType = ((phvia_list *)Pointer)->TYPE;
474 GraalViaMName = ((phvia_list *)Pointer)->NAME;
475
476 GraalPromptModifyVia();
477 GraalEnterPanel( &GraalModifyViaPanel );
478
479 GraalModifyLock = GRAAL_TRUE;
480
481 while ( GraalModifyLock )
482 {
483 GraalLimitedLoop( GraalModifyViaPanel.PANEL );
484 }
485 }
486 else
487 {
488 GraalViaMType = ((phvia_list *)Pointer)->TYPE;
489 GraalViaMName = ((phvia_list *)Pointer)->NAME;
490
491 GraalPromptModifyBigVia();
492 GraalEnterPanel( &GraalModifyBigViaPanel );
493
494 GraalModifyLock = GRAAL_TRUE;
495
496 while ( GraalModifyLock )
497 {
498 GraalLimitedLoop( GraalModifyBigViaPanel.PANEL );
499 }
500 }
501
502 GraalRejectRectangle( Rectangle );
503 GraalDisplayRectangle( Rectangle );
504
505 if ( GraalModifyAbort ) break;
506
507 if ( GraalModifyApply )
508 {
509 if ( ! GraalViaChanged( (phvia_list *)Pointer ) )
510
511 continue;
512
513 if ( FirstUndo )
514 {
515 GraalAddUndo();
516
517 FirstUndo = 0;
518 }
519
520 GraalDeleteRectangle( Rectangle );
521 GraalAddUndoRec( Rectangle );
522
523 Element = (void *)
524
525 addphvia( GraalFigureMbk,
526 GraalViaMType,
527 ((phvia_list *)Pointer)->XVIA,
528 ((phvia_list *)Pointer)->YVIA,
529 ((phvia_list *)Pointer)->DX,
530 ((phvia_list *)Pointer)->DY, GraalViaMName );
531
532 ((phvia_list *)Element)->USER = (void *)(&GraalFigureMbk->PHVIA);
533
534 if ( ((phvia_list *)Element)->NEXT != (phvia_list *)NULL )
535 {
536 ((phvia_list *)Element)->NEXT->USER = (void *)(&((phvia_list *)Element)->NEXT);
537 }
538
539 NewRec = GraalAddVia( ((phvia_list *)Element) );
540 GraalAddUndoRec( NewRec );
541
542 GraalDisplayRectangle( NewRec );
543 }
544 }
545 }
546
547 GraalExitPanel( &GraalModifyViaPanel );
548 GraalExitPanel( &GraalModifyBigViaPanel );
549
550 if ( ! GraalModifyAbort )
551
552 for ( Select = GraalHeadSelect;
553 Select != (graalselect *)NULL;
554 Select = Select->NEXT )
555 {
556 Rectangle = Select->RECTANGLE;
557
558 if ( IsRdsReference( Rectangle ) )
559 {
560 GraalAcceptRectangle( Rectangle );
561 GraalDisplayRectangle( Rectangle );
562
563 Pointer = GRAAL_MBK( Rectangle );
564
565 GraalReferenceMName = ((phref_list *)Pointer)->NAME;
566 GraalReferenceMType =
567
568 (strcmp( ((phref_list *)Pointer)->FIGNAME, "ref_ref" )) ?
569 MBK_REF_CON : MBK_REF_REF;
570
571 GraalSaveReferenceMType = GraalReferenceMType;
572
573 GraalPromptModifyReference();
574 GraalEnterPanel( &GraalModifyReferencePanel );
575
576 GraalModifyLock = GRAAL_TRUE;
577
578 while ( GraalModifyLock )
579 {
580 GraalLimitedLoop( GraalModifyReferencePanel.PANEL );
581 }
582
583 GraalRejectRectangle( Rectangle );
584 GraalDisplayRectangle( Rectangle );
585
586 if ( GraalModifyAbort ) break;
587
588 if ( GraalModifyApply )
589 {
590 if ( ! GraalReferenceChanged( (phref_list *)Pointer ) )
591
592 continue;
593
594 if ( FirstUndo )
595 {
596 GraalAddUndo();
597
598 FirstUndo = 0;
599 }
600
601 GraalDeleteRectangle( Rectangle );
602 GraalAddUndoRec( Rectangle );
603
604 Element = (void *)
605
606 addphref( GraalFigureMbk,
607 (GraalReferenceMType == MBK_REF_REF) ? "ref_ref":"ref_con" ,
608 GraalReferenceMName,
609 ((phref_list *)Pointer)->XREF,
610 ((phref_list *)Pointer)->YREF );
611
612 ((phref_list *)Element)->USER = (void *)(&GraalFigureMbk->PHREF);
613
614 if ( ((phref_list *)Element)->NEXT != (phref_list *)NULL )
615 {
616 ((phref_list *)Element)->NEXT->USER = (void *)(&((phref_list *)Element)->NEXT);
617 }
618
619 NewRec = GraalAddReference( ((phref_list *)Element) );
620 GraalAddUndoRec( NewRec );
621
622 GraalDisplayRectangle( NewRec );
623 }
624 }
625 }
626
627 GraalExitPanel( &GraalModifyReferencePanel );
628
629 if ( ! GraalModifyAbort )
630
631 for ( Select = GraalHeadSelect;
632 Select != (graalselect *)NULL;
633 Select = Select->NEXT )
634 {
635 Rectangle = Select->RECTANGLE;
636
637 if ( IsRdsConnector( Rectangle ) )
638 {
639 GraalAcceptRectangle( Rectangle );
640 GraalDisplayRectangle( Rectangle );
641
642 Pointer = GRAAL_MBK( Rectangle );
643
644 GraalConnectorMName = ((phcon_list *)Pointer)->NAME;
645 GraalConnectorMLayer = ((phcon_list *)Pointer)->LAYER;
646 GraalConnectorMWidth = (float)( ((phcon_list *)Pointer)->WIDTH / (float)SCALE_X );
647
648 switch( ((phcon_list *)Pointer)->ORIENT )
649 {
650 case NORTH : GraalConnectorMOrient = GRAAL_NORTH; break;
651 case SOUTH : GraalConnectorMOrient = GRAAL_SOUTH; break;
652 case EAST : GraalConnectorMOrient = GRAAL_EAST; break;
653 case WEST : GraalConnectorMOrient = GRAAL_WEST; break;
654 }
655
656 GraalSaveConnectorMOrient = GraalConnectorMOrient;
657
658 GraalPromptModifyConnector();
659 GraalEnterPanel( &GraalModifyConnectorPanel );
660
661 GraalModifyLock = GRAAL_TRUE;
662
663 while ( GraalModifyLock )
664 {
665 GraalLimitedLoop( GraalModifyConnectorPanel.PANEL );
666 }
667
668 GraalRejectRectangle( Rectangle );
669 GraalDisplayRectangle( Rectangle );
670
671 if ( GraalModifyAbort ) break;
672
673 if ( GraalModifyApply )
674 {
675 if ( ! GraalConnectorChanged( (phcon_list *)Pointer ) )
676
677 continue;
678
679 if ( FirstUndo )
680 {
681 GraalAddUndo();
682
683 FirstUndo = 0;
684 }
685
686 switch( GraalConnectorMOrient )
687 {
688 case GRAAL_NORTH : MbkOrient = NORTH; break;
689 case GRAAL_SOUTH : MbkOrient = SOUTH; break;
690 case GRAAL_EAST : MbkOrient = EAST; break;
691 case GRAAL_WEST : MbkOrient = WEST; break;
692 }
693
694 GraalDeleteRectangle( Rectangle );
695 GraalAddUndoRec( Rectangle );
696
697 Element = (void *)
698
699 addphcon( GraalFigureMbk,
700 MbkOrient,
701 GraalConnectorMName,
702 ((phcon_list *)Pointer)->XCON,
703 ((phcon_list *)Pointer)->YCON,
704 GraalConnectorMLayer,
705 (long)( GraalConnectorMWidth * SCALE_X ) );
706
707 ((phcon_list *)Element)->USER = (void *)(&GraalFigureMbk->PHCON);
708
709 if ( ((phcon_list *)Element)->NEXT != (phcon_list *)NULL )
710 {
711 ((phcon_list *)Element)->NEXT->USER = (void *)(&((phcon_list *)Element)->NEXT);
712 }
713
714 NewRec = GraalAddConnector( ((phcon_list *)Element) );
715 GraalAddUndoRec( NewRec );
716
717 GraalDisplayRectangle( NewRec );
718 }
719 }
720 }
721
722 GraalExitPanel( &GraalModifyConnectorPanel );
723
724 if ( ! GraalModifyAbort )
725
726 for ( Select = GraalHeadSelect;
727 Select != (graalselect *)NULL;
728 Select = Select->NEXT )
729 {
730 Rectangle = Select->RECTANGLE;
731
732 if ( IsRdsInstance( Rectangle ) )
733 {
734 GraalAcceptRectangle( Rectangle );
735 GraalDisplayRectangle( Rectangle );
736
737 Pointer = GRAAL_MBK( Rectangle );
738
739 GraalInstanceMName = ((phins_list *)Pointer)->INSNAME;
740 GraalInstanceMModel = ((phins_list *)Pointer)->FIGNAME;
741 GraalInstanceMSym = ((phins_list *)Pointer)->TRANSF;
742
743 GraalPromptModifyInstance();
744 GraalEnterPanel( &GraalModifyInstancePanel );
745
746 GraalModifyLock = GRAAL_TRUE;
747
748 while ( GraalModifyLock )
749 {
750 GraalLimitedLoop( GraalModifyInstancePanel.PANEL );
751 }
752
753 GraalRejectRectangle( Rectangle );
754 GraalDisplayRectangle( Rectangle );
755
756 if ( GraalModifyAbort ) break;
757
758 if ( GraalModifyApply )
759 {
760 if ( ! GraalInstanceChanged( (phins_list *)Pointer ) )
761
762 continue;
763
764 GraalDeleteRectangle( Rectangle );
765
766 for ( Instance = GraalFigureRds->INSTANCE;
767 Instance != (rdsins_list *)NULL;
768 Instance = Instance->NEXT )
769 {
770 if ( Instance->INSNAME == GraalInstanceMName )
771 {
772 if ( ! IsGraalDeleted( Instance->LAYERTAB[ RDS_ABOX ] ) )
773 {
774 GraalErrorMessage( GraalMainWindow,
775 "All instances must have different names !" );
776 break;
777 }
778 }
779 }
780
781 if ( Instance == (rdsins_list *)NULL )
782 {
783 if ( FirstUndo )
784 {
785 GraalAddUndo();
786
787 FirstUndo = 0;
788 }
789
790 GraalAddUndoRec( Rectangle );
791
792 SaveInstance = GraalFigureMbk->PHINS;
793 GraalFigureMbk->PHINS = (phins_list *)NULL;
794
795 Element = (void *)
796
797 addphins( GraalFigureMbk,
798 GraalInstanceMModel,
799 GraalInstanceMName,
800 GraalInstanceMSym,
801 ((phins_list *)Pointer)->XINS,
802 ((phins_list *)Pointer)->YINS );
803
804 ((phins_list *)Element)->NEXT = SaveInstance;
805 ((phins_list *)Element)->USER = (void *)(&GraalFigureMbk->PHINS);
806
807 if ( SaveInstance != (phins_list *)NULL )
808 {
809 SaveInstance->USER = (void *)(&((phins_list *)Element)->NEXT);
810 }
811
812 Instance = GraalAddInstance( ((phins_list *)Element) );
813
814 GraalDisplayToolsMessage();
815
816 if ( Instance == (rdsins_list *)NULL )
817 {
818 GraalFigureMbk->PHINS = SaveInstance;
819 mbkfree( Element );
820
821 GraalErrorMessage( GraalMainWindow, "Unable to load instance model !" );
822 }
823 else
824 {
825 NewRec = Instance->LAYERTAB[ RDS_ABOX ];
826
827 GraalAddUndoRec( NewRec );
828 }
829
830 GraalZoomRefresh();
831 }
832 else
833 {
834 GraalUndeleteRectangle( Rectangle );
835 }
836 }
837 }
838 }
839
840 GraalExitPanel( &GraalModifyInstancePanel );
841
842 GraalDelEqui();
843 GraalDelPeek();
844 GraalDelSelect();
845 GraalZoomRefresh();
846
847
848 rdsend();
849 }
850