/* SCMCON (SCM) -- SCM Connection Functions */ /* SCMCON (SCM) -- SCM-Verbindungsfunktionen */ /* -- INTENDED FOR KEY-CALL USE -- */ /* // Copyright (c) 1999-2012 Oliver Bartels F+E, Muenchen // Author: Roman Ludwig // Changes History: // rl (120427) RELEASED FOR BAE V7.8. // rl (101019) RELEASED FOR BAE V7.6. // rl (091021) RELEASED FOR BAE V7.4. // rl (081014) RELEASED FOR BAE V7.2. // rl (071029) RELEASED FOR BAE V7.0. // rl (060829) RELEASED FOR BAE V6.8. // rl (050906) RELEASED FOR BAE V6.6. // rl (050118) ENHANCEMENT: // Added $pageref shift function. // rl (041022) ENHANCEMENT: // Added net highlight with zoom functions. // Added net find function. // rl (041018) ENHANCEMENT: // Added label reference plan load function. // rl (040811) RELEASED FOR BAE V6.4. // rl (030904) RELEASED FOR BAE V6.2. // rl (030319) ENHANCEMENT: // Added connection pattern draw function. // rl (021209) RELEASED FOR BAE V6.0. // rl (020618) RELEASED FOR BAE V5.4. // rl (010625) RELEASED FOR BAE V5.0. // rl (010618) ENHANCEMENT: // Added net highlight functions. // rl (000906) RELEASED FOR BAE V4.6. // rl (000906) ENHANCEMENT: // Added bus query function. // rl (990813) ORIGINAL CODING. // // DESCRIPTION // // The scmcon User Language program provides a menu with // a series of advanced connection processing functions such // as changing the bus display mode and querying bus characteristics. */ // Includes #include "pop.ulh" // User Language popup utilities #include "popdraw.ulh" // User Language popup draw. util. #include "scm.ulh" // User Language SCM utilities // Disable undo state request #pragma ULCALLERNOUNDO // Messages string UPRABORT = M_UPRABORT(); string UPRFCT = M("Verbindungs-Funktion selektieren!", "Select Connection Function!"); string UPRFCT1 = M("&Buseinstellungen","&Bus Settings"); string UPRFCT2 = M("Bus&abfrage","Bus &Query"); string UPRFCT3 = M("%&Highlight Netze","%&Highlight Nets"); string UPRFCT4 = M("%&Muster zeichnen","%Draw &Pattern"); string UPRFCT5 = M("%&Labelplan laden ","%Load &Label Sheet"); string UPRFCT6 = M("Labelshift $&pageref","Label &Shift $pageref"); string UPRFCT7 = M("%Netz &suchen","%&Find Net"); string UPRBUSMODE = M("Busparameter","Bus Settings"); string UPRBLAB = M("Busdarstellung:","Bus Display:"); string UPRBFCT = M("Busdarstellungmodus selektieren!", "Select Bus Display Mode!"); string UPRBFCT1 = M("&Randdarstellung","&Outline Display"); string UPRBFCT2 = M("&Fuelldarstellung","&Filled Display"); string UPRBTLAB = M("Bustaps:","Bus Taps:"); string UPRBTFCT = M("Bustapmodus selektieren!","Select Bus Tap Mode!"); string UPRBTFCT1 = M("&Keine Automatik","&No Automatism"); string UPRBTFCT2 = M("Mit Verbindungen &bewegen", "&Move with Connections"); string UPRBTFCT3 = M("Mit Verbindungen &loeschen", "&Delete with Connections"); string UPRBTFCT4 = M("Mit &Verbindungen bewegen && loeschen", "Move && Delete with &Connections"); string UPRBTMFCT1 = M("&Kein Rerouting","&No Rerouting"); string UPRBTMFCT2 = M("&Rerouting","&Rerouting"); string UPRPFCT = M("Muster waehlen!","Select Pattern!"); string UPRPFCT1 = M("Verbindungs&buendel","Connection &Bunch"); string UPRPFCT2 = M("Verbindungs&kamm","Connection &Comb"); string UPRPICKBUS = M("Bus selektieren!","Select Bus!"); string UPRPICKP1 = M("Punkt 1 selektieren!","Select Point 1!"); string UPRPICKP2 = M("Punkt 2 selektieren!","Select Point 2!"); string UPRPICKP3 = M("Punkt 3 selektieren!","Select Point 3!"); string UPRPICKP4 = M("Punkt 4 selektieren!","Select Point 4!"); string UPRPDIAL = M("Verbindungsmuster","Connection Patterns"); string UPRPLAB1 = M("Muster selektieren und Mustereckpunkte", "Select connection pattern"); string UPRPLAB2 = M(" in angegebener Reihenfolge platzieren!", " and place points in given order!"); string UPRHLFCT = M("Highlight-Funktion selektieren!", "Select Net Highlight Function!"); string UPRHLALL = M("A&lle Netze","A&ll Nets"); string UPRHLNAM = M("Benannte &Netze","Named &Nets"); string UPRHLALLZ = M("%Alle Netze/&Zoom","%All Nets/&Zoom"); string UPRHLNAMZ = M("Benannte Netze/Z&oom","Named Nets/Z&oom"); string UPRCONTX = M("' (:Weiter, :Abbruch) ", "' (:Continue, :Abort) "); string UPRCONTY = M("' (:Weiter, : Abbruch mit Highlight,:Abbruch) ", "' (:Continue, : Abort with highlight, :Abort) "); string UINSTOP = M("a","x"); string UINHIGHL = M("h","h"); string UINPREV = M("-","-"); string UPRSELSHEET = M("Blattname zu '%s' ? ","Sheet name for '%s' ? "); string UPRSELLABEL = M("Label selektieren!","Select label!"); string REPSHEETLIST = M("Auswahl Blattname :","Sheet Name Selection :"); string REPHEADER = M("Schaltplan Busabfrage :","Schematic Bus Query :"); string REPFILE = M("Datei-Name .........: '%s'", "File Name ..........: '%s'"); string REPELEM = M("Element-Name .......: '%s'", "Element Name .......: '%s'"); string REPBUS = M("Busname ............: '%s'", "Bus Name ...........: '%s'"); string REPBUSTAP = M("Bustap .............: %d x '%s'", "Bus Name ...........: %d x '%s'"); string REPBUSSYMP = M("Bussymbolpin .......: '%s'", "Bus Symbol Pin .....: '%s'"); string REPNET = M("Netz : '","Net : '"); string REPNONET = M("(nicht gefunden)","(not found)"); string REPNOLABREF = M("Netz '%s' nur lokal verwendet!", "No external references to net '%s'!"); string REPNONETREF = M("Netz '%s' nicht gefunden!","Net '%s' not found!"); string ERRNOPICK = M_ERRNOPICK(); #define FMTHEADUL "%.*s" #define ITMULINE "========================================" // INI file parameter name definitions #define PAR_PAGEREFOFF "PAGEREFOFF_SCM"// $pageref relativ offset #define PAR_DEFBUSDISP "DEFBUSDISP_SCM"// Default bus display mode #define PAR_DEFBUSTMODE "DEFBUSTMODE_SCM"// Default bus tap mode // Globals #define GV_HLREQUEST "hlrequest" // Highlight request variable #define RULBUSWDISP "scm_bus_fill" // Rule Bus Filled Display #define PICBUTHEIGHT 10.0 // Picture button height #define PICBUTWIDTH 50.0 // Picture button width int PICBUTDCOL = bae_getinvcolor() ? 15 : 7 /* Picture button doc. color */; #define MAXCONSTEPS 200 // Max. connection steps double PAGEREFOFF = bae_inidblval(PAR_PAGEREFOFF,-1.0); // $pageref relativ offset #define FONTASP (2.0/3.0) // Font aspect ratio #define SMALLVAL 0.000000001 // Small compare value STRINGS tapl /* Bus tap name list */; int tapcl[] /* Bus tap count list */; int tapn /* Bus tap count */; STRINGS sympl /* Symbol pin name list */; int sympn /* Symbol pin name count */; index C_FIGURE scanfig /* Scan figure list index */; index C_FIGURE lastfig[] /* Last figure list */; int lastfign = 0 /* Last figure list count */; double pagerefsize /* $pageref text size */; index C_LEVEL conlevel /* Current connection level */; double conlx,conly /* Current con. segment lower bound. */; double conux,conuy /* Current con. segment upper bound. */; int levfound /* Level found flag */; int elemtyp /* Current top level element class */; string elemname /* Current top level element name */; string busname /* Bus name */; int netfound /* Net found flag */; int curnetnum /* Current net tree number */; STRINGS nl /* Name list */; int nn = 0 /* Name count */; // Main program void main() { // Abort if invalid plan class if (bae_planddbclass()==DDBCLUNDEF) error_class(); // Check if call inside function check_fctactive(); // Ask for connection function type bae_defmenusel(-1); bae_promptdialog(UPRFCT); switch (bae_askmenu(8, UPRFCT1,UPRFCT2,UPRFCT3,UPRFCT4,UPRFCT5,UPRFCT6,UPRFCT7,UPRABORT)) { // Set the bus display mode case 0 : setbusdispmode(); break; // Query bus case 1 : querybus(); break; // Net highlight case 2 : // Select highlight function bae_promptdialog(UPRHLFCT); switch (bae_askmenu(5,UPRHLALL,UPRHLNAM, UPRHLALLZ,UPRHLNAMZ,UPRABORT)) { // All net highlight case 0 : allnethighlight(0); break; // Named net highlight case 1 : nethighlight(0); break; // All net highlight with zoom case 2 : allnethighlight(1); break; // Named net highlight with zoom case 3 : nethighlight(1); break; } break; // Draw connection pattern case 3 : drawpattern(); break; // Load label sheet plan case 4 : loadlabelsheet(); break; // Shift $pageref on labels case 5 : pagerefshift(); break; // Find net case 6 : findnet(); break; // Abort on default default : } } /*________________________________________________________________*/ // Bus display functions void setbusdispmode() /* // Set the bus display mode */ { double cy = DIAL_TOPMARG /* Current y value */; double pcol = 14.0 /* Parameter column */; int repflag /* Dialog box repeat flag */; int res /* Dialog box selection result */; int varidx /* INI variable index */; int bfidx /* Bus fill mode control index */; int btmidx /* Bus tap move mode control index */; int btdidx /* Bus tap delete mode ctrl. index */; int btridx /* Bus tap reroute mode ctrl. index */; int dispmode /* Bus display mode */; int bustapmode /* Bus tap mode */; int modebuf /* Bus tap mode buffer */; STRINGS rl /* Rule list */; int rn /* Rule count */; int nrn /* New rule count */; int i /* Loop control variable */; // Abort if invalid plan class if (bae_planddbclass()!=DDBCLSCM) error_class(); // Query the current bus display mode if (cap_rulequery(RS_OCSCMDB,0,RS_SCMSUBJ,RS_BUSFILL,"?d",dispmode)<1) // Set default display mode dispmode=0; // Query the current bus tap mode if (cap_rulequery( RS_OCSCMDB,0,RS_SCMSUBJ,RS_BUSTAPMODE,"?d",bustapmode)<1) // Set default bus tap mode bustapmode=3; if (bae_dialclr()) { // Set the default menu selection bae_defmenusel(dispmode); // Ask for bus display mode bae_promptdialog(UPRBFCT); if ((dispmode=bae_askmenu(3,UPRBFCT1,UPRBFCT2,UPRABORT))<0 || dispmode>1) error_abort(); // Ask for bus tap mode bae_promptdialog(UPRBTFCT); if ((bustapmode=bae_askmenu(5, UPRBTFCT1,UPRBTFCT2,UPRBTFCT3,UPRBTFCT4,UPRABORT))<0 || bustapmode>3) error_abort(); bae_promptdialog(UPRBTFCT); if ((modebuf=bae_askmenu(3,UPRBTMFCT1,UPRBTMFCT2,UPRABORT))<0 || modebuf>1) error_abort(); if (!modebuf) bustapmode|=4; } else { dial_label(0.0,cy,UPRBLAB); bfidx=bae_dialaddcontrol(PA_RBF,0,0,dispmode,0.0,0.0,0.0,"", 0,DIAL_LEFTMARG+pcol,cy,0.0,UPRBFCT1); cy+=DIAL_CTRVSTEP; bae_dialaddcontrol(PA_RBN,1,0,0,0.0,0.0,0.0,"", 0,DIAL_LEFTMARG+pcol,cy,0.0,UPRBFCT2); cy+=DIAL_CTRVSTEP; dial_hsep(cy); dial_label(0.0,cy,UPRBTLAB); btmidx=bae_dialaddcontrol(PA_TOGGLE,0,0,bustapmode&1, 0.0,0.0,0.0,"",0,DIAL_LEFTMARG+pcol,cy,0.0,UPRBTFCT2); cy+=DIAL_CTRVSTEP; btdidx=bae_dialaddcontrol(PA_TOGGLE,0,0,(bustapmode&2) ? 1 : 0, 0.0,0.0,0.0,"",0,DIAL_LEFTMARG+pcol,cy,0.0,UPRBTFCT3); cy+=DIAL_CTRVSTEP; btridx=bae_dialaddcontrol(PA_TOGGLE,0,0,(bustapmode&4) ? 0 : 1, 0.0,0.0,0.0,"",0,DIAL_LEFTMARG+pcol,cy,0.0,UPRBTMFCT2); cy+=DIAL_CTRVSTEP; // Store the OK and abort button with seperator dial_hsep(cy); dial_okabortini(cy,35.0+DIAL_RIGHTSMARG,1); repflag=1; do { // Call the dialog function bae_setintpar(16,3012); switch (res=bae_dialaskparams(UPRBUSMODE, 0,DIAL_LEFTMARG+35.0+DIAL_RIGHTSMARG,cy)) { // Done case 0 : repflag=0; case 1 : bae_dialgetdata(bfidx,dispmode,0.0,""); bae_dialgetdata(btmidx,bustapmode,0.0,""); bae_dialgetdata(btdidx,modebuf,0.0,""); if (modebuf) bustapmode|=2; bae_dialgetdata(btridx,modebuf,0.0,""); if (!modebuf) bustapmode|=4; if (res==0) break; varidx=0; bae_iniintset(varidx,PAR_DEFBUSDISP,dispmode); bae_iniintset( varidx,PAR_DEFBUSTMODE,bustapmode); bae_iniwrite(varidx); break; // Fail/abort case (-1) : default : error_abort(); } // Stop if no further repeat requests } while (repflag); } // Save current state for undo bae_callmenu(MNU_BAESAVESTATE); // Get the plan rules nrn=rn=rsc_getplanrules(rl,1); // Delete old bus display rules for (i=0;i0) { if (cap_ruleplandet(1)) rsc_error(-1); } // Assign the bus tap mode predicate rule rsc_assplanintpred(1,RS_BUSTAPMODE,bustapmode,3,""); // Redraw the screen bae_callmenu(MNU_BAEREDISPL); // Done bae_prtdialog(""); } /*________________________________________________________________*/ // Bus query functions void querybus() /* // Query busses */ { index C_CONSEG conseg /* Connection segment */; int mc /* Requested popup column count */; STRINGS headl /* Header list */; int headn /* Header count */; STRINGS entryl /* Entry list */; int entryn /* Entry count */; int cnt = 0 /* Element count */; int i /* Loop control variable */; // Pick bus segment(s) while (bae_promptdialog(UPRPICKBUS),scm_pickconseg(conseg)==0 && conseg.BUSFLAG==1) { // Get connection data conlx=conseg.X1; conly=conseg.Y1; conux=conseg.X2; conuy=conseg.Y2; // Scan bus connection level levfound=sympn=tapn=0; busname=""; if (cap_scanall(0.0,0.0,0.0,1,NULL,conlev,NULL,NULL)) error_scan(); // Check if level found if (levfound) { // Scan bus taps/connections if (cap_scanall(0.0,0.0,0.0,1,tapmac,NULL,NULL,NULL)) error_scan(); // Print the bus characteristics headl[0]=REPHEADER; sprintf(headl[1],FMTHEADUL,strlen(headl[0]),ITMULINE); sprintf(headl[2],REPFILE,bae_planfname()); sprintf(headl[3],REPELEM,bae_planename()); sprintf(headl[5],REPBUS,busname=="" ? "-" : busname); headn=7; entryn=0; // List bus symbol pins for (i=0;i=0;i--) mc=maxint(mc,strlen(headl[i])+1); for (i=entryn-1;i>=0;i--) mc=maxint(mc,strlen(entryl[i])+1); // Activate the report popup menu bae_setintpar(16,3089); if (popupmenu(0,"",headl,headn,entryl,entryn, "",0,0,1,headn+entryn+2,mc,0,"")==UINPOPABORT) error_abort(); } cnt++; } // No pick if (cnt) bae_prtdialog(ERRNOPICK); else perror(ERRNOPICK); } int conlev(index C_CONBASE conbase,int segidx, int contyp,double lx,double ly,double ux,double uy, int busconflag,int coninws,index C_LEVEL level) /* // Get level of connection segment // Return value : // zero if done or (-1) on file error // Parameters : // index C_CONBASE conbase : Connection base // int segidx : Connection segment index // int contyp : Connection type // double lx : Lower X coordinate // double ly : Lower Y coordinate // double ux : Upper X coordinate // double uy : Upper Y coordinate // int busconflag : Connection bus flag // int coninws : Connection in workspace flag // index C_LEVEL level : Connection level */ { // Check if bus connection segment found if (busconflag && lx==conlx && ly==conly && ux==conux && uy==conuy) { // Store bus level levfound=1; conlevel=level; } // Return without errors return(0); } int tapmac(index C_MACRO macro,index C_POOL pool,int macinws, string refname,index C_LEVEL level,index C_LEVEL buslevel) /* // Bus tap macro function // Return value : // 0 if out of workspace, 1 if inside, 2 if unknown, or (-1) on error // Parameters : // index C_MACRO macro : Macro index // index C_POOL pool : Macro pool index // int macinws : Macro in workspace flag // string refname : Macro reference name // index C_LEVEL level : Macro level // index C_LEVEL buslevel : Macro bus level */ { int cmpres /* Compare result */; int i, j /* Loop control variables */; // Check the macro class switch (macro.CLASS) { // Symbol case DDBCLSSYM : elemtyp=DDBCLSSYM; elemname=refname; break; // Label case DDBCLSLAB : elemtyp=DDBCLSLAB; elemname=refname; // Check if requested level if (buslevel==conlevel) { // Search tap insert position cmpres=1; for (i=0;ii;j--) { tapl[j]=tapl[j-1]; tapcl[j]=tapcl[j-1]; } tapl[i]=refname; tapcl[i]=1; tapn++; } else { // Adjust tap count tapcl[i]++; } } break; case DDBCLSMRK : // Check if bus label pin if (refname!="" && level==conlevel) { if (elemtyp==DDBCLSLAB) { // Store the bus name if (busname=="") busname=elemname; else busname=busname+","+elemname; } else if (elemtyp==DDBCLSSYM) { // Store the symbol pin name sympl[sympn]=elemname+"."+refname; sympn++; } } return(0); } // Continue scan return(1); } // Net highlight routines void allnethighlight(int zoomflag) /* // Highlight all nets step by step // Parameters : // int zoomflag : Zoom to net request flag */ { index C_CNET net /* Net index */; index C_CNET netl[] /* Net list */; int netn = 0 /* Net count */; int repflag /* Repeat flag */; int i /* Loop control variable */; // Loop for all nets forall (net) { netl[netn]=net; netn++; } // Loop for all nets for (i=0;i0) i-=2; else i--; repflag=0; break; // Abort without highlight case (-1) : // Dehighlight net scm_highlnet(net.NUMBER,0); return; default : // Dehighlight net scm_highlnet(net.NUMBER,0); repflag=0; } } // Done } void nethighlight(int zoomflag) /* // Highlight Named Nets // Parameters : // int zoomflag : Zoom to net request flag */ { index C_CNET net /* Net index */; index C_CNET lnet /* Net loop index */; string netname /* Net name string */; int netfound /* Net found flag */; // Repetively select named nets while (scm_asktreename(netname)==0) { // Check if net exists netfound=0; forall (lnet where lnet.NAME==netname) { net=lnet; netfound=1; break; } if (!netfound) { // Prompt user for continue if (asknetcontinue(netname+REPNONET,0)) // Abort request ? break; continue; } // Zoom to signal on request if (zoomflag) zoomtonet(net); // Highlight net scm_highlnet(net.NUMBER,1); // Prompt user for continue switch (asknetcontinue(net.NAME,1)) { // Abort with highlight case 1 : // Done return; // Abort without highlight case (-1) : // Dehighlight net scm_highlnet(net.NUMBER,0); return; default : ; } // Dehighlight net scm_highlnet(net.NUMBER,0); } // Done } void findnet() /* // Find name specified net */ { index C_CNET net /* Net index */; index C_CNET lnet /* Net loop index */; STRINGS hl /* Popup header list */; string msg /* Message buffer */; string sheetname /* Sheet element name */; string netname /* Net name string */; int netfound /* Net found flag */; int sheetmode = 0 /* Sheet mode */; // Check interaction queue if (bae_peekiact()==2) { netname=askstr("",MAXKEYLEN); if (netname[0]=='*') { netname=strextract(netname,1,strlen(netname)); sheetmode=1; } } else { // Select named net if (scm_asktreename(netname)) error_abort(); } // Build net sheet reference list if (!sheetmode) buildnetsheetlist(netname); // Check if net exists netfound=0; forall (lnet where lnet.NAME==netname) { net=lnet; netfound=1; break; } if (netfound) { call(MNU_SCMHLRESET); // Highlight net scm_highlnet(net.NUMBER,1); // Zoom to signal zoomtonet(net); if (sheetmode || nn==0) exit(0); } else if (nn==0) { sprintf(msg,REPNONETREF,netname); bae_msgbox(1,msg,""); exit(0); } if (!netfound && nn==1) { sheetname=nl[0]; } else { // Select sheet name with popup menu hl[0]=REPSHEETLIST; hl[1]=""; sprintf(msg,UPRSELSHEET,netname); bae_setintpar(16,3090); if ((sheetname=popupmenu(1,msg,hl,2,nl,nn,UINPOPABORT, 0,-1,-1,0,0,0,UINPOPABORT))=="" || sheetname==UINPOPABORT) error_abort(); } // Save current element with verification on request verifysave(); // Try to load the sheet loadddbelem(bae_planfname(),sheetname,DDBCLSCM); if (bae_planename()==sheetname) { call(MNU_SCMHLRESET); forall (net where net.NAME==netname) { scm_highlnet(net.NUMBER,1); zoomtonet(net); break; } } } int asknetcontinue(string netname,int highlflag) /* // Prompt for continue // Return value : // zero if ok, (-1) on abort request, 1 on highlight // Parameters : // string netname : Net name // int highlflag : Highlight flag */ { string input /* Input string */; // Prompt for continue bae_setmousetext(""); input=bae_readtext(REPNET+netname+(highlflag ? UPRCONTY : UPRCONTX),1); strlower(input); // Check for abort command if (input==UINPOPABORT || input==UINSTOP) // User abort request return(-1); else if (highlflag) { if (input==UINHIGHL) // User abort with highlight request return(1); else if (input==UINPREV) // Skip to previous net return(2); } return(0); } /*________________________________________________________________*/ // Connection pattern draw functions void drawpattern() /* // Draw connection pattern */ { double butwidth /* Picture button width */; double butheight /* Picture button height */; double cy /* Current y value */; double x1, y1 /* First pattern point */; double x2, y2 /* Second pattern point */; double x3, y3 /* Third pattern point */; double x4, y4 /* Forth pattern point */; double xb, yb /* Pattern base direction vector */; double xs, ys /* Pattern step vector */; int ori /* Pattern orientation */; int pattype = (-1) /* Pattern type */; int concolor /* Connection color */; int mrkcolor /* Marker color */; int concnt /* Connection count */; // Check for dialog support if (bae_dialclr()) { // Select highlight function bae_promptdialog(UPRPFCT); pattype=bae_askmenu(3,UPRPFCT1,UPRPFCT2,UPRABORT); } else { // Get the connection colors concolor=bae_getcolor(1); mrkcolor=bae_getcolor(3); // Set the default picture button bitmap size butwidth=PICBUTWIDTH; butheight=PICBUTHEIGHT; // Create the picture button bitmaps if (bmp_setsize(0.0,0.0,12.0,12.0,butwidth,butheight,0.0,0.0) || bae_dialbmpalloc(butwidth,butheight,2,0,0)!=2 || bae_dialbmpalloc(butwidth,butheight,3,0,0)!=3) error_abort(); // Draw the picture button bitmaps bae_popsetarea(2); // Display orientation seperator line btp_drawline(PICBUTDCOL,DM_SET,6.0,0.0,6.0,12.0); // Display left connection bunch btp_drawline(concolor,DM_SET,1.0,4.0,5.0,4.0); btp_drawline(concolor,DM_SET,1.0,5.0,5.0,5.0); btp_drawline(concolor,DM_SET,1.0,6.0,5.0,6.0); btp_drawline(concolor,DM_SET,1.0,7.0,5.0,7.0); btp_drawline(concolor,DM_SET,1.0,8.0,5.0,8.0); btp_drawline(concolor,DM_SET,3.0,4.15,3.0,4.25); btp_drawline(concolor,DM_SET,3.0,4.45,3.0,4.55); btp_drawline(concolor,DM_SET,3.0,4.75,3.0,4.85); btp_drawtext(1.2,8.2,PICBUTDCOL,0,"1"); btp_drawline(PICBUTDCOL,DM_SET,1.0,8.0,1.2,8.2); btp_drawtext(5.2,8.2,PICBUTDCOL,0,"2"); btp_drawline(PICBUTDCOL,DM_SET,5.0,8.0,5.2,8.2); btp_drawtext(1.2,7.2,PICBUTDCOL,0,"3"); btp_drawline(PICBUTDCOL,DM_SET,1.0,7.0,1.2,7.2); btp_drawtext(1.2,4.2,PICBUTDCOL,0,"4"); btp_drawline(PICBUTDCOL,DM_SET,1.0,4.0,1.2,4.2); // Display right connection bunch btp_drawline(concolor,DM_SET,7.0,3.5,7.0,8.5); btp_drawline(concolor,DM_SET,8.0,3.5,8.0,8.5); btp_drawline(concolor,DM_SET,9.0,3.5,9.0,8.5); btp_drawline(concolor,DM_SET,10.0,3.5,10.0,8.5); btp_drawline(concolor,DM_SET,11.0,3.5,11.0,8.5); btp_drawline(concolor,DM_SET,10.15,6.0,10.25,6.0); btp_drawline(concolor,DM_SET,10.45,6.0,10.55,6.0); btp_drawline(concolor,DM_SET,10.75,6.0,10.85,6.0); btp_drawtext(7.2,8.7,PICBUTDCOL,0,"1"); btp_drawline(PICBUTDCOL,DM_SET,7.0,8.5,7.2,8.7); btp_drawtext(7.2,3.7,PICBUTDCOL,0,"2"); btp_drawline(PICBUTDCOL,DM_SET,7.0,3.5,7.2,3.7); btp_drawtext(8.2,8.7,PICBUTDCOL,0,"3"); btp_drawline(PICBUTDCOL,DM_SET,8.0,8.5,8.2,8.7); btp_drawtext(11.2,8.7,PICBUTDCOL,0,"4"); btp_drawline(PICBUTDCOL,DM_SET,11.0,8.5,11.2,8.7); bae_popsetarea(3); // Display orientation seperator cross btp_drawline(PICBUTDCOL,DM_SET,6.0,0.0,6.0,12.0); btp_drawline(PICBUTDCOL,DM_SET,0.0,6.0,12.0,6.0); // Display upper left comb btp_drawtext(5.2,5.2,PICBUTDCOL,0,"1"); btp_drawline(PICBUTDCOL,DM_SET,5.0,5.0,5.2,5.2); btp_drawtext(1.2,5.2,PICBUTDCOL,0,"2"); btp_drawline(PICBUTDCOL,DM_SET,1.0,5.0,1.2,5.2); btp_drawtext(5.2,4.2,PICBUTDCOL,0,"3"); btp_drawline(PICBUTDCOL,DM_SET,5.0,4.0,5.2,4.2); btp_drawtext(5.2,1.2,PICBUTDCOL,0,"4"); btp_drawline(PICBUTDCOL,DM_SET,5.0,1.0,5.2,1.2); btp_drawline(concolor,DM_SET,1.0,1.0,5.0,1.0); btp_drawline(concolor,DM_SET,1.0,2.0,5.0,2.0); btp_drawcircle(mrkcolor,DM_SET,1,1.0,2.0,0.1); btp_drawline(concolor,DM_SET,1.0,3.0,5.0,3.0); btp_drawcircle(mrkcolor,DM_SET,1,1.0,3.0,0.1); btp_drawline(concolor,DM_SET,1.0,4.0,5.0,4.0); btp_drawcircle(mrkcolor,DM_SET,1,1.0,4.0,0.1); btp_drawline(concolor,DM_SET,1.0,5.0,5.0,5.0); btp_drawline(concolor,DM_SET,1.0,2.0,1.0,5.0); btp_drawline(concolor,DM_SET,1.0,1.15,1.0,1.25); btp_drawline(concolor,DM_SET,1.0,1.45,1.0,1.55); btp_drawline(concolor,DM_SET,1.0,1.75,1.0,1.85); btp_drawline(concolor,DM_SET,3.0,1.15,3.0,1.25); btp_drawline(concolor,DM_SET,3.0,1.45,3.0,1.55); btp_drawline(concolor,DM_SET,3.0,1.75,3.0,1.85); // Display upper right comb btp_drawtext(7.2,5.2,PICBUTDCOL,0,"1"); btp_drawline(PICBUTDCOL,DM_SET,7.0,5.0,7.2,5.2); btp_drawtext(11.2,5.2,PICBUTDCOL,0,"2"); btp_drawline(PICBUTDCOL,DM_SET,11.0,5.0,11.2,5.2); btp_drawtext(7.2,4.2,PICBUTDCOL,0,"3"); btp_drawline(PICBUTDCOL,DM_SET,7.0,4.0,7.2,4.2); btp_drawtext(7.2,1.2,PICBUTDCOL,0,"4"); btp_drawline(PICBUTDCOL,DM_SET,7.0,1.0,7.2,1.2); btp_drawline(concolor,DM_SET,11.0,1.0,7.0,1.0); btp_drawline(concolor,DM_SET,11.0,2.0,7.0,2.0); btp_drawcircle(mrkcolor,DM_SET,1,11.0,2.0,0.1); btp_drawline(concolor,DM_SET,11.0,3.0,7.0,3.0); btp_drawcircle(mrkcolor,DM_SET,1,11.0,3.0,0.1); btp_drawline(concolor,DM_SET,11.0,4.0,7.0,4.0); btp_drawcircle(mrkcolor,DM_SET,1,11.0,4.0,0.1); btp_drawline(concolor,DM_SET,11.0,5.0,7.0,5.0); btp_drawline(concolor,DM_SET,11.0,2.0,11.0,5.0); btp_drawline(concolor,DM_SET,11.0,1.15,11.0,1.25); btp_drawline(concolor,DM_SET,11.0,1.45,11.0,1.55); btp_drawline(concolor,DM_SET,11.0,1.75,11.0,1.85); btp_drawline(concolor,DM_SET,9.0,1.15,9.0,1.25); btp_drawline(concolor,DM_SET,9.0,1.45,9.0,1.55); btp_drawline(concolor,DM_SET,9.0,1.75,9.0,1.85); // Display lower left comb btp_drawtext(1.2,11.2,PICBUTDCOL,0,"1"); btp_drawline(PICBUTDCOL,DM_SET,1.0,11.0,1.2,11.2); btp_drawtext(1.2,7.2,PICBUTDCOL,0,"2"); btp_drawline(PICBUTDCOL,DM_SET,1.0,7.0,1.2,7.2); btp_drawtext(2.2,11.2,PICBUTDCOL,0,"3"); btp_drawline(PICBUTDCOL,DM_SET,2.0,11.0,2.2,11.2); btp_drawtext(5.2,11.2,PICBUTDCOL,0,"4"); btp_drawline(PICBUTDCOL,DM_SET,5.0,11.0,5.2,11.2); btp_drawline(concolor,DM_SET,1.0,11.0,1.0,7.0); btp_drawline(concolor,DM_SET,2.0,11.0,2.0,7.0); btp_drawcircle(mrkcolor,DM_SET,1,2.0,7.0,0.1); btp_drawline(concolor,DM_SET,3.0,11.0,3.0,7.0); btp_drawcircle(mrkcolor,DM_SET,1,3.0,7.0,0.1); btp_drawline(concolor,DM_SET,4.0,11.0,4.0,7.0); btp_drawcircle(mrkcolor,DM_SET,1,4.0,7.0,0.1); btp_drawline(concolor,DM_SET,5.0,11.0,5.0,7.0); btp_drawline(concolor,DM_SET,1.0,7.0,4.0,7.0); btp_drawline(concolor,DM_SET,4.15,7.0,4.25,7.0); btp_drawline(concolor,DM_SET,4.45,7.0,4.55,7.0); btp_drawline(concolor,DM_SET,4.75,7.0,4.85,7.0); btp_drawline(concolor,DM_SET,4.15,9.0,4.25,9.0); btp_drawline(concolor,DM_SET,4.45,9.0,4.55,9.0); btp_drawline(concolor,DM_SET,4.75,9.0,4.85,9.0); // Display lower right comb btp_drawtext(7.2,7.2,PICBUTDCOL,0,"1"); btp_drawline(PICBUTDCOL,DM_SET,7.0,7.0,7.2,7.2); btp_drawtext(7.2,11.2,PICBUTDCOL,0,"2"); btp_drawline(PICBUTDCOL,DM_SET,7.0,11.0,7.2,11.2); btp_drawtext(8.2,7.2,PICBUTDCOL,0,"3"); btp_drawline(PICBUTDCOL,DM_SET,8.0,7.0,8.2,7.2); btp_drawtext(11.2,7.2,PICBUTDCOL,0,"4"); btp_drawline(PICBUTDCOL,DM_SET,11.0,7.0,11.2,7.2); btp_drawline(concolor,DM_SET,7.0,11.0,7.0,7.0); btp_drawline(concolor,DM_SET,8.0,11.0,8.0,7.0); btp_drawcircle(mrkcolor,DM_SET,1,8.0,11.0,0.1); btp_drawline(concolor,DM_SET,9.0,11.0,9.0,7.0); btp_drawcircle(mrkcolor,DM_SET,1,9.0,11.0,0.1); btp_drawline(concolor,DM_SET,10.0,11.0,10.0,7.0); btp_drawcircle(mrkcolor,DM_SET,1,10.0,11.0,0.1); btp_drawline(concolor,DM_SET,11.0,11.0,11.0,7.0); btp_drawline(concolor,DM_SET,7.0,11.0,10.0,11.0); btp_drawline(concolor,DM_SET,10.15,9.0,10.25,9.0); btp_drawline(concolor,DM_SET,10.45,9.0,10.55,9.0); btp_drawline(concolor,DM_SET,10.75,9.0,10.85,9.0); btp_drawline(concolor,DM_SET,10.15,11.0,10.25,11.0); btp_drawline(concolor,DM_SET,10.45,11.0,10.55,11.0); btp_drawline(concolor,DM_SET,10.75,11.0,10.85,11.0); bae_popsetarea(0); // Store the hint label cy=DIAL_TOPMARG; dial_label(0.0,cy,UPRPLAB1+UPRPLAB2); cy+=DIAL_BUTVSTEP; // Store the pattern type buttons bae_dialadvcontrol(PA_BMACT,0,0,2,0.0,0.0,0.0,"",0, DIAL_LEFTMARG,cy,butwidth+DIAL_BMPBUTHO, butheight+DIAL_BMPBUTVO,""); bae_dialadvcontrol(PA_BMACT,0,1,3,0.0,0.0,0.0,"",0, DIAL_LEFTMARG+butwidth+DIAL_BMPBUTHO+2.0,cy, butwidth+DIAL_BMPBUTHO,butheight+DIAL_BMPBUTVO,""); // Store the abort button cy+=butheight+DIAL_BMPBUTVO+DIAL_SEPVSTEP; bae_dialaddcontrol( PA_ABORT,0,0,0,0.0,0.0,0.0,"",0,DIAL_LEFTMARG,cy,0.0,""); // Call the dialog function bae_setintpar(16,3013); pattype=bae_dialaskparams(UPRPDIAL,0, DIAL_LEFTMARG+2.0*(butwidth+DIAL_BMPBUTHO)+4.0, cy+DIAL_SEPVSTEP+DIAL_BUTVSTEP); } if (pattype<0 || pattype>1) error_abort(); // Pick the pattern base direction points bae_promptdialog(UPRPICKP1); if (bae_inpoint(bae_planwsnx(),bae_planwsny(),x1,y1,0)) error_abort(); bae_promptdialog(UPRPICKP2); if (bae_inpoint(x1,y1,x2,y2,2)) error_abort(); // Check the base direction orientation if (fabs(x2-x1)>fabs(y2-y1)) { // Horizontal base direction ori=0; // Ensure orthogonal base y2=y1; } else { // Vertical base direction ori=1; // Ensure orthogonal base x2=x1; } // Get the pattern base vector xb=x2-x1; yb=y2-y1; // Check the base vector if (xb==0.0 && yb==0.0) error_abort(); // Save current state for undo bae_callmenu(MNU_BAESAVESTATE); // Draw the base line bae_clearpoints(); bae_storepoint(x1,y1,0); bae_storepoint(x2,y2,0); scm_storecon(); // Pick the pattern step direction points bae_promptdialog(UPRPICKP3); if (bae_inpoint(x1,y1,x3,y3,2)) error_abort(); // Enforce orthogonal steps if (ori) y3=y1; else x3=x1; // Get the pattern step vector xs=x3-x1; ys=y3-y1; // Check the step vector if (xs==0.0 && ys==0.0) error_abort(); // Draw the first step line bae_clearpoints(); bae_storepoint(x3,y3,0); bae_storepoint(x3+xb,y3+yb,0); if (pattype) bae_storepoint(x2,y2,0); scm_storecon(); bae_promptdialog(UPRPICKP4); if (bae_inpoint(x1,y1,x4,y4,2)) error_abort(); // Enforce orthogonal steps if (ori) y4=y1; else x4=x1; // Advance to next position x3+=xs; y3+=ys; concnt=0; // Loop for all steps while (concnt=(-SMALLVAL) && (y4-y3)*ys>=(-SMALLVAL)) { // Draw the next step line bae_clearpoints(); bae_storepoint(x3,y3,0); bae_storepoint(x3+xb,y3+yb,0); if (pattype) bae_storepoint(x3+xb-xs,y3+yb-ys,0); scm_storecon(); // Advance to next position x3+=xs; y3+=ys; concnt++; } } /*________________________________________________________________*/ // Label sheet reference functions void loadlabelsheet() /* // Load project sheet element referenced by label */ { index C_FIGURE fig /* Figure list element */; index C_CNET net /* Net index */; STRINGS hl /* Popup header list */; string sheetname /* Sheet element name */; string netname /* Net name */; string msg /* Message buffer */; int winmode = 0 /* New window mode */; // Abort if invalid plan class if (bae_planddbclass()!=DDBCLSCM) error_class(); // Check interaction queue if (bae_peekiact()==2 && askstr("",MAXKEYLEN)=="win") winmode=1; // Get label sample bae_promptdialog(UPRSELLABEL); if (scm_pickelem(fig,C_FIGLREF)) error(ERRNOPICK); // Get label sheet references netname=fig.NAME; buildnetsheetlist(netname); if (nn==0) { sprintf(msg,REPNOLABREF,netname); bae_msgbox(1,msg,""); exit(0); } // Check if single sheet reference if (nn==1) { // Autoload single sheet sheetname=nl[0]; } else { // Select sheet name with popup menu hl[0]=REPSHEETLIST; hl[1]=""; sprintf(msg,UPRSELSHEET,netname); bae_setintpar(16,3090); if ((sheetname=popupmenu(1,msg,hl,2,nl,nn,UINPOPABORT, 0,-1,-1,0,0,0,UINPOPABORT))=="" || sheetname==UINPOPABORT) error_abort(); } // Check if new window mode if (winmode) { bae_setstrpar(11,bae_planfname()); bae_setstrpar(12,sheetname); bae_setstrpar(13,"ULC:scmcon:s6:'*"+netname+"'"); ulsystem("#9022",0); } else { // Save current element with verification on request verifysave(); // Try to load the sheet loadddbelem(bae_planfname(),sheetname,DDBCLSCM); if (bae_planename()==sheetname) { call(MNU_SCMHLRESET); forall (net where net.NAME==netname) { scm_highlnet(net.NUMBER,1); zoomtonet(net); break; } } } } void buildnetsheetlist(string netname) /* // Build the external sheet reference list for a given net name // Parameters : // string netname : Net name */ { string s /* Scan string */; int sl /* String length */; int dst /* Destination string index */; int i /* Loop control variable */; // Get the reference list string if ((s=cap_getglobnetref(netname))=="") // No other sheet referenced return; // Scan the label sheet references words sl=strlen(s); for (i=dst=0;ifig.RLX) zoomlx=fig.RLX; if (zoomuxfig.RLY) zoomly=fig.RLY; if (zoomuyzoomux || zoomly-WEL>zoomuy) return; // Disable range check bae_getintpar(0,rangedis); bae_setintpar(0,1); // Zoom to calculated boundaries bae_clriactqueue(); bae_storemouseiact(1,zoomlx-WEL,zoomly-WEL,0,LMB); bae_storemouseiact(1,zoomux+WEL,zoomuy+WEL,0,LMB); call(MNU_BAEZOOMWND); // Restore old range check state bae_setintpar(0,rangedis); if (varget(GV_HLREQUEST,hlreq)) hlreq=""; // Get recursive call flag if (hlreq!=net.NAME) { // Build the highlight/zoom net request message sprintf(msg,"%d %s",MSGID_NETZOOMHL,net.NAME); // Send the highlight/zoom net command bae_sendmsg(msg,1); } vardelete(GV_HLREQUEST); // Store buffered interaction queue item if (answer!="") bae_storetextiact(1,answer); } int pinscan(index C_MACRO macro,index C_POOL pool,int macinws, string refname,index C_LEVEL level,index C_LEVEL buslevel) /* // Pin macro scan function // Return value : // 0 if out of workspace, 1 if inside, 2 if unknown, or (-1) on error // Parameters : // index C_MACRO macro : Macro index // index C_POOL pool : Macro pool index // int macinws : Macro in workspace flag // string refname : Macro reference name // index C_LEVEL level : Macro level // index C_LEVEL buslevel : Macro bus level */ { index C_CNET net /* Net index */; // Continue scan for symbol and label macros if (macro.CLASS==DDBCLSSYM || macro.CLASS==DDBCLSLAB) return(1); // Test if pin macro if (macro.CLASS==DDBCLSMRK) forall (net of level) // Test if padstack matches current net number if (net.NUMBER==curnetnum) { netfound=1; // Terminate scan return(-1); } // Abort scan return(0); } // User Language program end