/* TBDVSCM (SCM) -- SCM Toolbar Design View Maintenance */ /* TBDVSCM (SCM) -- SCM Entwurfsansichten in Toolbar verwalten */ /* -- INTENDED FOR CALL BY *_TOOL FUNCTION -- */ /* // Copyright (c) 1997-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 (091203) ENHANCEMENT: // Added text property controls to text input box. // rl (091021) RELEASED FOR BAE V7.4. // rl (081014) RELEASED FOR BAE V7.2. // rl (071029) RELEASED FOR BAE V7.0. // rl (070109) ENHANCEMENT: // Added $rpname initial name transfer support to symbol copy. // rl (060929) RELEASED FOR BAE V6.8. // rl (060410) ENHANCMENT: // Added design view display to birds eye view on info. // rl (050906) RELEASED FOR BAE V6.6. // rl (041117) ENHANCMENT: // Added group attribute set function to symbol attribute windows. // rl (041108) ENHANCMENT: // Added text selection list to toolbar add text functions. // rl (040826) RELEASED FOR BAE V6.4. // rl (040331) ENHANCMENT: // Added rule transfer to attribute/symbol copy. // rl (030909) RELEASED FOR BAE V6.2. // rl (030909) BUGFIX: // Fixed problem with unset attributes in symbol copy. // rl (030512) ENHANCEMENT: // Added inverted color palette correction. // rl (030317) ENHANCEMENT: // Changed overview window action from zoom last to // pan to pick position. // rl (030220) ENHANCEMENT: // Increased design view window drawing performance. // rl (030128) ENHANCEMENT: // Added text move preservation option for symbol clones. // Added label clone support. // rl (021209) RELEASED FOR BAE V6.0. // rl (020618) RELEASED FOR BAE V5.4. // rl (011211) ENHANCEMENT: // Added symbol macro consistency check for attribute setting. // rl (011122) BUGFIX: // Fixed problems with missing design view display after load. // rl (010626) RELEASED FOR BAE V5.0. // rl (010320) ENHANCEMENT: // Added symbol clone support. // rl (000504) RELEASED FOR BAE V4.6. // rl (990625) RELEASED FOR BAE V4.4. // rl (990415) ENHANCEMENT: // Added multiple attribute window support. // rl (981002) RELEASED FOR BAE V4.2. // mb (980714) CHANGE: // Do not issue invalid plan class error message // (to avoid confusion when implicitely called). // mb (980710) ENHANCEMENT: // Dynamic multi-language support introduced. // mb (980512) BUGFIX: // Bug in viewinfo() fixed (local variables // fname, ename, and ddbcl deleted for correct // access to global variables. // mb (980420) CHANGE: // Inline documentation changed. // rl (980324) ENHANCEMENT: // Added symbol attribute get/set window. // rl (971125) RELEASED FOR BAE V4.0. // rl (970603) ORIGINAL CODING. // // DESCRIPTION // // The tbdvscm User Language program handles SCM toolbar design // view update requests and provides features for automatic // template part attribute settings. */ // Includes #include "baeparam.ulh" // User Language BAE param. access #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 UPRRCORNER1 = M("Fenster-Startpunkt waehlen!", "Select first window corner!"); string UPRRCORNER2 = M("Fenster-Endpunkt waehlen!", "Select second window corner!"); string UPRSYMBOL = M("Symbol selektieren!","Select Symbol!"); string UPRTEXT = M("Text ? ","Text ?"); string UPRVDDCONF = M("Variantenabhaengige Attribute und/oder Plotsichtbarkeiten gefunden. Uebernehmen?", "Found variant dependant attributes/plot visibilities. Copy ?"); string REPNEWCON = M("Neue Verbindung","Add Connection"); string REPNEW2CON = M("Punkt zu Punkt Verbindung", "Point to Point Connection"); string REPNEWLINE = M("Neue Grafiklinie","Add Graphic Line"); string REPDOTLINE = M("Neue Punktlinie","Add Dot Line"); string REPNEWAREA = M("Neue Grafikflaeche","Add Graphic Area"); string REPNEWSTEXT = M("Neuer Standardtext '%s'", "Add Standardtext '%s'"); string REPNEWCTEXT = M("Neuer Kommentartext '%s'", "Add Commentary Text '%s'"); string REPSYMPLACE = M("Hinterlegtes Symbol platzieren:\n", "Place buffered symbol:\n"); string REPWINRESTORE = M("Hinterlegten Bildausschnitt wiederherstellen:\n\n", "Restore buffered zoom window:\n\n"); string REPNEWSYM = M("Symbol aus Toolbarbuffer %d platzieren", "Toolbar Symbol Buffer %d Placement"); string REPNEWLAB = M("Toolbar Neuer Label '%s'", "Toolbar Add Label '%s'"); string REPSYMDAT = M("Toolbar Symboldaten aus Buffer %d setzen", "Toolbar Symbol Buffer 1 Data Transfer"); string UPRHEIGHT = M("Hoehe :","Height :"); string UPRANG = M("Winkel :","Angle :"); string UPRMIRROR = M("Spiegelung","Mirror"); string UPRSTANDARD = M("Standardtext","Standard Text"); string UPRCOMMENT = M("Kommentartext","Commentary Text"); string UPRNOROT = M("Keine Rotation","No Rotation"); string UPRCENTER = M("Zentriert :","Centered :"); string UPRCENTN = M("nein","no"); string UPRCENTH = M("Breite","Width"); string UPRCENTV = M("Hoehe","Height"); string UPRCENTHV = M("Breite+Hoehe","Width+Height"); string UPRFRAME = M("Rahmen :","Frame :"); string UPRFRAME1 = M("1","1"); string UPRFRAME2 = M("2","2"); string UPRFRAMEO = M("links offen","left hand open"); string UPRPWIDTH = M("Stiftbreite :","Pen Width :"); string WRNDIFFMAC = M("Symbol '%s' Makro '%s' <> Quellmakro '%s'! Attribute setzen?", "Symbol '%s' Macro '%s' <> Source Macro '%s'! Set Attributes?"); string ERRSETATT = M("Fehler beim Eintragen der Attribute!", "Error setting attributes!"); string ERRSETRUL = M("Fehler beim Eintragen der Regeln!", "Error setting rules!"); string ERRDELRUL = M("Fehler beim Loeschen der Regeln!", "Error deleting rules!"); string REPNOSYM = M("Keine Symboldaten gespeichert!", "No symbol data stored!"); string REPNILATT = M("!nicht_gesetzt!","!not_set!"); #define PAR_DEFTEXTLST "DEFTEXTLST_SCM" // Default text list #define PAR_NAMEPROMPT "NAMEPROMPT_SCM" // Name prompt mode #define PAR_VARATTRCHK "VARATTRCHK_SCM"// Variant attribute check flag // Input definitions (must comply with button definitions from toolbar.ulc!) #define UINVIEWCLEAR 'c' #define UINVIEWREDISP 'd' #define UINVIEWGET 'g' #define UINVIEWINFO 'i' #define UINVIEWPOSTO 'p' #define UINVIEWRESTORE 'r' #define UINVIEWSET 's' #define UINVIEWTEXT 't' #define UINVIEWLINE 'u' #define UINVIEWZOOM 'w' // Global design view variable name patterns #define GV_VIEW_FN "VIEW_FN" // File name variable name pattern #define GV_VIEW_CL "VIEW_CL" // DDB class variable name pattern #define GV_VIEW_EN "VIEW_EN" // Element name variable name pattern #define GV_VIEW_LX "VIEW_LX" // Lower X variable name pattern #define GV_VIEW_LY "VIEW_LY" // Lower Y variable name pattern #define GV_VIEW_UX "VIEW_UX" // Upper X variable name pattern #define GV_VIEW_UY "VIEW_UY" // Upper Y variable name pattern #define GV_VIEW_DF "VIEW_DF" // View drawn variable name pattern #define GV_VIEW_CO "VIEW_CO" // Color table name var. name pattern #define GV_ATTR_N "ATTR_N" // Attribute count #define GV_ATTR_NL "ATTR_NL" // Attribute name list #define GV_ATTR_VL "ATTR_VL" // Attribute value list #define GV_ATTR_SR "ATTR_SR" // Attribute symbol rotation #define GV_ATTR_SM "ATTR_SM" // Attribute symbol mirror flag #define GV_ATTR_SL "ATTR_SL" // Attribute symbol library name #define GV_ATTR_SN "ATTR_SN" // Attribute symbol net name #define GV_ATTR_SS "ATTR_SS" // Attribute symbol flag #define GV_RULE_N "RULE_N" // Rule count #define GV_RULE_L "RULE_L" // Rule list #define GV_RMOD_N "RMOD_N" // Reference text modifier count #define GV_RMOD_T "RMOD_T" // Reference text modifier text #define GV_RMOD_X "RMOD_X" // Reference text modifier x coord. #define GV_RMOD_Y "RMOD_Y" // Reference text modifier y coord. #define GV_RMOD_S "RMOD_S" // Reference text modifier size #define GV_RMOD_A "RMOD_A" // Reference text modifier angle #define GV_RMOD_M "RMOD_M" // Reference text modifier mirror flag // User Language program names #define UL_BAE_ZOOM "bae_zoom" // ULP: BAE Zoom Action // Globals #define MAXCMDSTRLEN 1024 // Max. input/command string length static double dvx /* Design view area X coordinate */; static double dvy /* Design view area Y coordinate */; static double dvw /* Design view area width */; static double dvh /* Design view area height */; static double tbcols /* Toolbar columns count */; static double tbrows /* Toolbar rows count */; static double xscale /* X scaling factor */; static double yscale /* Y scaling factor */; static int color /* Current color */; static double wslx,wsly /* Workspace lower corner */; static double wsux,wsuy /* Workspace upper corner */; static int drawflag /* View drawn flag */; static string coltname /* Color table name */; static string fname /* DDB file name */; static string ename /* DDB element name */; static int ddbcl /* DDB class */; static index C_FIGURE dfig /* Display element index */; static int dflag = 0 /* Display element flag */; static string netarea /* Net area name */; static STRINGS attnl /* Attribute name list */; static STRINGS attvl /* Attribute value list */; static int attrn /* Attribute count */; static STRINGS rulel /* Rule list */; static int rulen /* Rule count */; struct textdef { /* Text selection definition */ string txt /* Text string */; int efield /* Text environment field */; }; struct textdef DEFTEXTL[] = { // Default texts { M("$ - Physikalischer/Layoutbauteilname","$ - Physical/Layout part name"), 2 }, { M("$ - Physikalischer/Layoutpinname","$ - Physical/Layout pin name"), 4 }, { M("$ - Label Netzname","$ - Label net name"), 8 }, { M("$$ - Logischer/Schaltplansymbolname","$$ - Logical/Schematic symbol name"), 2 }, { M("$$ - Logischer/Schaltplanpinname","$$ - Logical/Schematic pin name"), 4 }, { M("$gp - Gate Pin/Gatterauswahl","$gp - Gate Pin/Gate selection"), 2 }, { M("$llname - Logical Library Name/Symbolmakroname", "$llname - Logical Library Name/Symbol macro name"), 2 }, { M("$noplc - Plazierungstatus","$noplc - Placement status"), 2 }, { M("$pageref - Blattreferenzanzeige bei Labels", "$pageref - Page Reference display for labels"), 8 }, { M("$plname - Physical Library/Layoutbauteilmakroname", "$plname - Physical Library Name/Layout part macro name"), 2 }, { M("$pltecomment - Elementkommentar","$pltecomment - Element comment"), 15 }, { M("$pltename - Elementname/Planname in Kleinschreibung", "$pltename - Element/plan name lower case"), 15 }, { M("$Pltename - Elementname/Planname in Grossschreibung", "$Pltename - Element/plan name upper case"), 15 }, { M("$pltpagecnt - Gesamtanzahl Projektschaltplanblaetter", "$pltpagecnt - Total count of project schematic sheets"), 15 }, { M("$pltdatede - Aktuelles Datum, Jahr 4-stellig", "$pltdateus - Current date, year 4 digits"), 15 }, { M("$pltdate2de - Aktuelles Datum, Jahr 2-stellig", "$pltdate2us - Current date, year 2 digits"), 15 }, { M("$plttime - Aktuelle Zeit","$plttime - Current time"), 15 }, { M("$pltfbname - Projektdateiname mit Pfad, ohne DDB-Extension", "$pltfbname - Project file name with path, without DDB extension"), 15 }, { M("$Pltfbname - Projektdateiname mit Pfad, ohne DDB-Extension in Grossschreibung", "$Pltfbname - Project file name with path, without DDB extension upper case"), 15 }, { M("$pltfbsname - Projektdateiname ohne Pfad und DDB-Extension", "$pltfbsname - Project file name without path, without DDB extension"), 15 }, { M("$Pltfbsname - Projektdateiname ohne Pfad und DDB-Extension in Grossschreibung", "$Pltfbsname - Project file name without path, without DDB extension upper case"), 15 }, { M("$pltfname - Projektdateiname mit Pfad und DDB-Extension", "$pltfname - Project file name with path and DDB extension"), 15 }, { M("$Pltfname - Projektdateiname mit Pfad und DDB-Extension in Grossschreibung", "$Pltfname - Project file name with path and DDB extension upper case"), 15 }, { M("$pltfsname - Projektdateiname ohne Pfad, mit DDB-Extension", "$pltfsname - Project file name without path, with DDB extension"), 15 }, { M("$Pltfsname - Projektdateiname ohne Pfad, mit DDB-Extension in Grossschreibung", "$Pltfsname - Project file name without path, with DDB extension upper case"), 15 }, { M("$pltsdatede - Speicherdatum, Jahr 4-stellig", "$pltsdateus - Save date, year 4 digits"), 15 }, { M("$pltsdate2de - Speicherdatum, Jahr 2-stellig", "$pltsdate2us - Save date, year 2 digits"), 15 }, { M("$pltstime - Speicherzeit","$pltstime - Save time"), 15 }, { M("$pltpname - Letzte vom Packager erzeugte Netzliste in Kleinschreibung", "$pltpname - Packager last netlist name lower case"), 15 }, { M("$Pltpname - Letzte vom Packager erzeugte Netzliste in Grossschreibung", "$Pltpname - Packager last netlist name upper case"), 15 }, { M("$pltpdatede - Packagerdatum, Jahr 4-stellig", "$pltpdateus - Packager date, year 4 digits"), 15 }, { M("$pltpdate2de - Packagerdatum, Jahr 2-stellig", "$pltpdate2us - Packager date, year 2 digits"), 15 }, { M("$pltptime - Packagerzeit","$pltptime - Packager time"), 15 }, { M("$rbname - Requested Backannotated Part Name/Layoutbauteilnamen", "$rbname - Requested Backannotated Part Name/Layoutpart name"), 2 }, { M("$rlext - Requested Library Extension/Namenserweiterung f. logische Definition", "$rlext - Requested Library Extension/Name extension for logical definition"), 2 }, { M("$rlname - Requested Library/Name der logischen Definition", "$rlname - Requested Library/Name of logical definition"), 2 }, { M("$rpname - Requested Part Name/Layoutbauteilnamen", "$rpname - Requested Part Name/Layoutpart name"), 2 }, { M("$ulname - Used Library Name/verwendetes Layoutbauteilmakro", "$upname - Used Library Name/Layout part macro"), 2 }, { M("$?s:variant_name - Name der akitven Variante", "$?s:variant_name - Name of active variant"), 15 }, { M("$vgrp - Variant Group/Layoutbauteilname f. Variantenbauteil", "$vgrp - Variant Group/Layout part name for variant part"), 2} }; struct textdef TEXTL[] /* Text list */; int TEXTN /* Text count */; // Main program void main() { index C_FIGURE lastfig /* Last figure list element */; string msg /* Message string */; string cmdstr /* Command string */; string textstr /* Text string */; int viewidx /* Design view index */; int dvn /* Design view window count */; int clrflag /* Clear window flag */; double wscx,wscy /* Workspace middle point */; double wsxdim,wsydim /* Workspace dimensions */; double xoff,yoff /* Offsets */; double xscale, yscale /* Scale factors */; double t /* Temporary coordinate buffer */; double textsize /* Text size */; double textw /* Text width */; double textang /* Text angle */; int textmirr /* Text mirror flag */; int textmode /* Text mode */; int frame1 /* Text 1st frame */; int frame2 /* Text 2nd frame */; int openframe /* Text open frame */; int norot /* Text no rotation */; int texthcent /* Text horizontal center alignment */; int textvcent /* Text vertical center alignment */; int abortflag = 0 /* Function abort flag */; int rmb /* Right mouse button pressed flag */; int i /* Loop control variable */; // Get the command string if ((cmdstr=askstr("",MAXCMDSTRLEN))==UINPOPABORT) error_abort(); // Get the zoom window index from the parameter string viewidx=atoi(strextract(cmdstr,1,strlen(cmdstr))); // Get right mouse button state rmb= cmdstr[strlen(cmdstr)-1]=='!' ? 1 : 0 ; // Get the toolbar dimensions bae_tbsize(tbcols,tbrows); // Handle the command request switch (cmdstr[0]) { // View restore request case UINVIEWRESTORE : // Abort if no valid toolbar defined if (tbcols==0.0 || tbrows==0.0) return; // Test if special attribute window if (viewidxwsux) { t=wslx; wslx=wsux; wsux=t; } if (wsly>wsuy) { t=wsly; wsly=wsuy; wsuy=t; } // Store the workspace data viewstorewsdata(viewidx); // Display the workspace scm_dispws(viewidx); // Update the the design view tooltip viewinfo(viewidx,1); break; // View set request case UINVIEWSET : // Abort if no valid toolbar defined if (tbcols==0.0 || tbrows==0.0) return; // Test if special attribute window if (viewidx44 ? len-44 : 0,len-5); do { cap_vecttext(0.0,cury,0.0,0,0.7,0, strextract(namestr,0,7),tlinefunc); namestr=strextract(namestr,8,len); cury-=0.7; } while (namestr!=""); // Restore the toolbar clipping area bae_popcliparea(1,0.0,0.0,tbrows,tbcols); bae_popcliparea(0,0.0,0.0,tbrows,tbcols); // Reactivate the standard popup drawing area bae_popsetarea(0); } } static void getattributes(int viewidx) /* // Get the attributes from mouse selectable part // Parameters : // int viewidx : Design view index */ { index C_FIGURE fig /* Figure list element */; index C_NREF nref /* Named reference index */; index C_REFTEXT rmod /* Ref. text modifier index */; index C_ATTRIBUTE att /* Attribute index */; string viewid = itoa(viewidx) /* Design view id */; string pprefix /* Plot visibility rule prefix */; int plen /* Plot vis. rule prefix length */; int varafound = 0 /* Variant attribute data found flag */; int varpfound = 0 /* Variant plot vis. data found flag */; int i /* Loop control variable */; // Abort if invalid plan class if (bae_planddbclass()!=DDBCLSCM) return; // Pick symbol bae_promptdialog(UPRSYMBOL); if (scm_pickelem(fig,C_FIGNREF)==0) { // Get symbol data nref=fig.NREF; // Init. attribute name list attrn=0; // Scan the attributes forall (att of nref where scm_chkattrname(att.NAME)==0 && att.NAME!="$spname") { // Store attribute to list attnl[attrn]=att.NAME; attvl[attrn++]=att.VALUE; } // Scan unset attributes if (cap_scanfelem(fig,0.0,0.0,0.0,1, amacfunc,NULL,NULL,atextfunc)!=0) error_scan(); // Store the attribute data varset(GV_ATTR_N+viewid,attrn); // Get the attributes for (i=0;i=0 ? rsc_getfigrules(fig,rulel) : 0 ; for (i=0;i=0;i--) if ( strextract(rulel[i],0,plen-1)==pprefix && rulel[i][plen]!='0') { varset(GV_RULE_L+viewid+"_"+itoa(i),""); rulen--; } if (rulen==0) varset(GV_RULE_N+viewid,0); } } // Store symbol placement data varset(GV_ATTR_SR+viewid,fig.ANGLE); varset(GV_ATTR_SM+viewid,fig.MIRROR); varset(GV_ATTR_SL+viewid,fig.NREF.MACRO.NAME); varset(GV_ATTR_SS+viewid, fig.NREF.MACRO.CLASS==DDBCLSSYM ? 1 : 0); varset(GV_ATTR_SN+viewid,fig.NAME); // Transfer name moves attrn=0; forall (rmod of nref) { // Store the text position varset(GV_RMOD_T+viewid+"_"+itoa(attrn),rmod.STR); varset(GV_RMOD_X+viewid+"_"+itoa(attrn),rmod.X); varset(GV_RMOD_Y+viewid+"_"+itoa(attrn),rmod.Y); varset(GV_RMOD_A+viewid+"_"+itoa(attrn),rmod.ANGLE); varset(GV_RMOD_S+viewid+"_"+itoa(attrn),rmod.SIZE); varset(GV_RMOD_M+viewid+"_"+itoa(attrn),rmod.MIRROR); attrn++; } varset(GV_RMOD_N+viewid,attrn); // Store the view window data wslx=fig.RLX; wsly=fig.RLY; wsux=fig.RUX; wsuy=fig.RUY; dfig=fig; dflag=1; // Store the workspace data viewstorewsdata(viewidx); // Display the workspace scm_dispws(viewidx); dflag=0; // Update the the design view tooltip viewinfo(viewidx,1); } else error_abort(); } static void setattributes(int viewidx,int grpmode) /* // Transfer the stored attributes to mouse selectible or group parts // Parameters : // int viewidx : Design view index // int grpmode : Group process flag */ { index C_FIGURE fig /* Figure list element */; string viewid = itoa(viewidx) /* Design view id */; string symmacro /* Symbol macro name */; string lastname = "" /* Last symbol name */; string msg /* Message buffer */; int prompted = 0 /* Replacement prompt flag */; int answer /* Replacement answer */; int lastidx /* Last used attribute index */; int first /* First attribute set flag */; int firstsym = 1 /* First symbol flag */; int i /* Loop control variable */; // Abort if invalid plan class if (bae_planddbclass()!=DDBCLSCM) return; // Get the attribute count if (varget(GV_ATTR_SL+viewid,symmacro) || varget(GV_ATTR_N+viewid,attrn) || varget(GV_RULE_N+viewid,rulen) || (attrn+rulen)<=0) // No attributes/rules stored return; // Get the attributes for (i=0;iwsxdim) { yscale=dvh/wsydim; xscale=yscale*pop_aspectratio(); wsxdim=wsydim; wslx=wscx-0.5*wsxdim; wsux=wscx+0.5*wsxdim; } else { xscale=dvw/wsxdim; yscale=xscale/pop_aspectratio(); wsydim=wsxdim; wsly=wscy-0.5*wsydim; wsuy=wscy+0.5*wsydim; } // Activate the toolbar drawing area bae_popsetarea(1); // Set the dsign view clipping area bae_popcliparea(1,dvy,dvx,dvy+dvh,dvx+dvw); // Draw the window background pop_drawrect(dvx,dvy,dvw,dvh,COLOR_BLACK,COLOR_NONE); // Display the schematic design view scm_view(wslx,wsly,wsux,wsuy); // Restore the toolbar clipping area bae_popcliparea(1,0.0,0.0,tbrows,tbcols); bae_popcliparea(0,0.0,0.0,tbrows,tbcols); // Reactivate the standard popup drawing area bae_popsetarea(0); varset(GV_VIEW_DF+itoa(viewidx),1); } void scm_view(double wlx,double wly,double wux,double wuy) /* // Display the schematic design view // Parameters : // double wlx : Design view window lower X coordinate // double wly : Design view window lower Y coordinate // double wux : Design view window upper X coordinate // double wuy : Design view window upper Y coordinate */ { index C_FIGURE fig /* Figure list index */; int i /* Loop control variable */; // Select clipping window lowx=wlx; lowy=wly; // Get the junction point macro pool index junct=cap_pointpoolidx(); // Loop for all display objects for (i=0;icurclass && curobj!=CON) return(0); // Check on symbol outline draw request if (COLOR_SCMBRD>0 && macro.CLASS==DDBCLSSYM) { // Get the macro coordinates cap_maccoords(x,y,r,m); // Avoid display if rotated and/or mirrored if (r!=0.0 || m) return(1); // Draw the macro outline pop_drawrect( dvx+(x-macro.MNX+macro.MLX)*xscale, dvy+dvh-(y-macro.MNY+macro.MUY)*yscale, fabs(macro.MUX-macro.MLX)*xscale, fabs(macro.MUY-macro.MLY)*yscale, COLOR_NONE,COLOR_SCMBRD); } // Continue scan return(1); } int polyfunc(index C_POLY poly,int polyinws, index C_LEVEL level,int macclass,int bustapidx) /* // Design window drawing polygon function // Return value : // zero if done or (-1) on file error // Parameters : // index C_POLY poly : Polygon // int polyinws : Poly in workspace flag // index C_LEVEL level : Polygon level // int macclass : Polygon macro class // int bustapidx : Polygon bustap index */ { index C_POINT point /* Polygon point */; int fillmode /* Popup polygon fill mode */; // Abort if out of class if (macclass!=curclass && !scanjunct) return(0); // Init the color color=COLOR_NONE; // Test if the polygon type is requested for output switch (poly.TYP) { // Documentary line case C_POLYDOCLINE : // Dotted documentary line case C_POLYDOTLINE : // Documentary area case C_POLYDOCAREA : fillmode= poly.TYP==C_POLYDOCAREA ? (netarea=="" ? 1 : 0) : 2; switch (macclass) { case bae_planddbclass() : color=COLOR_SCMDOC; break; case DDBCLSSYM : case DDBCLSLAB : color=COLOR_SCMSYM; break; case DDBCLSMRK : color=COLOR_SCMMRK; break; default : color=COLOR_SCMDOC; break; } if (curobj!=DOC && !scanjunct) return(0); break; // Contact area case C_POLYCONAREA : color=COLOR_SCMCAR; fillmode=1; if ((curobj!=CONA || level>=0) && !scanjunct) return(0); break; // Internal case 2 : color=15; fillmode=1; break; case 3 : color=13; fillmode=1; if (!scanjunct) return(0); break; // No output area default : return(0); } // Abort if invisible if (color<=0) return(0); // Display the polygon bae_clearpoints(); forall (point of poly) bae_storepoint( dvx+point.X*xscale,dvy+dvh-point.Y*yscale, point.TYP ? 3-point.TYP : 0); bae_popdrawpoly(color,DM_SET,fillmode); // Return without errors return(0); } int confunc(index C_CONBASE conbase,int segidx, int contyp,double lx,double ly,double ux,double uy, int busconflag,int coninws,index C_LEVEL level) /* // Design window drawing connection function // 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 */ { // Abort if not connection output if (curobj!=CON) return(0); // Check if connection crosspoint if (contyp==1) { // Check if junction defined if (junct!=(-1)) { // Set the junction scan flag scanjunct=1; // Scan cross marker if (cap_scanpool(junct,lowx-lx,lowy-ly, 0.0,coninws,macfunc,confunc,polyfunc,textfunc)) return(-1); // Reset the junction scan flag scanjunct=0; } // Return without errors return(0); } // Check if bus segment if (busconflag) { // Draw bus segment bae_clearpoints(); bae_storepoint( dvx+(lx-BUSLWH-lowx)*xscale, dvy+dvh-(ly-BUSLWH-lowy)*yscale,0); bae_storepoint( dvx+(ux+BUSLWH-lowx)*xscale, dvy+dvh-(ly-BUSLWH-lowy)*yscale,0); bae_storepoint( dvx+(ux+BUSLWH-lowx)*xscale, dvy+dvh-(uy+BUSLWH-lowy)*yscale,0); bae_storepoint( dvx+(lx-BUSLWH-lowx)*xscale, dvy+dvh-(uy+BUSLWH-lowy)*yscale,0); bae_popdrawpoly(COLOR_SCMCON,DM_SET,PPFM_CLINE); } else { // Draw normal segment bae_clearpoints(); bae_storepoint( dvx+(lx-lowx)*xscale,dvy+dvh-(ly-lowy)*yscale,0); bae_storepoint( dvx+(ux-lowx)*xscale,dvy+dvh-(uy-lowy)*yscale,0); bae_popdrawpoly(COLOR_SCMCON,DM_SET,PPFM_LINE); } // Return without errors return(0); } int textfunc(index C_TEXT textp,double tx,double ty,double tangle, int mirrflag,double tsize,string tstr,int textinws,int macclass,int varattr) /* // Vectorize a text data block // Return value : // zero if done or (-1) on error // index C_TEXT textp : Text index // double tx : Text X coordinate // double ty : Text Y coordinate // double tangle : Text rotation angle // int mirrflag : Text mirror flag // double tsize : Text size // string tstr : Text string // int textinws : Text in workspace flag // int macclass : Text macro class // int varattr : Text variant attribute flag */ { double len /* Text base line length */; double vx,vy /* Text angle vector */; // Abort scan if out of class or empty string if (macclass!=curclass || curobj!=TEXT || tstr=="" || tsize<=0.0) return(0); // Get the text color if (textp.MODE&TEXTCOMM) { // Comment text color=COLOR_SCMCTX; } else { // Standard text // Set color according to macro class switch (macclass) { case DDBCLSSYM : case DDBCLSLAB : color=COLOR_SCMSYM; break; case DDBCLSMRK : color=COLOR_SCMMRK; break; default : color=COLOR_SCMDOC; break; } } // Ignore if not visible if (color<=0) return(0); if (tsize*yscale