/* BAE_ST (STD) -- BAE Startup */ /* BAE_ST (STD) -- BAE Startup */ /* -- EXECUTED AFTER ENTERING SOME BAE UL INTERPRETER ENVIRONMENT -- */ /* // Copyright (c) 1995-2013 Bartels System GmbH, Muenchen // Author: Manfred Baumeister // Changes History: // rl (131029) RELEASED FOR BAE V8.0. // rl (120427) RELEASED FOR BAE V7.8. // rl (101019) RELEASED FOR BAE V7.6. // rl (100708) ENHANCEMENT: // Added automatic history element load support. // rl (091028) 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 (060217) ENHANCEMENT: // Added mouse warp and mouse rectangle size options. // rl (050906) RELEASED FOR BAE V6.6. // rl (041026) ENHANCEMENT: // Added save prompt option. // rl (040811) RELEASED FOR BAE V6.4. // rl (030904) RELEASED FOR BAE V6.2. // rl (030221) ENHANCEMENT: // Added automatic plan load options. // rl (021209) RELEASED FOR BAE V6.0. // rl (020125) ENHANCEMENT: // Added user specific program call support. // rl (020618) RELEASED FOR BAE V5.4. // rl (010625) RELEASED FOR BAE V5.0. // rl (000508) RELEASED FOR BAE V4.6. // rl (990625) RELEASED FOR BAE V4.4. // rl (980910) RELEASED FOR BAE V4.2. // rl (980910) ENHANCEMENT: // Changed to V4.2 general access program. // mb (980710) ENHANCEMENT: // Dynamic multi-language support introduced. // rl (970929) RELEASED FOR BAE V4.0. // rl (970829) ENHANCEMENT: // Added job specific ULC program autorun feature. // mb (970616) ENHANCEMENT: // Applied CAM View User Language support. // mb (970113) CHANGE: // Multiple macro definitions (COLOR_PD*) removed. // mb (960917) RELEASED FOR BAE V3.4. // mb (960801) ORIGINAL CODING: // Retrieved from *_ST; to replace *_ST. // // DESCRIPTION // // The bae_st User Language program is automatically called when // entering a BAE program module. bae_st starts the uifsetup // User Language program for activating predefined menu and key // assignments within the current interpreter environment. // According to the currently active interpreter environment, // bae_st also calls one of the programs scmsetup, gedsetup, // apsetup, arsetup, camsetup, cvsetup, and/or cedsetup for setting // module-specific standard parameters such as input/display grids, // grid/angle lock, coordinate display mode, pick preference layer, // mincon function, etc. Each of these programs can be easily // customized for optimizing user-specific and/or project-specific // BAE environments. bae_st may also activate a project-specific // User Language program, with the name of that User Language program // to be derived from the first line of a project-specific file with // extension ".aut". // // REQUIRED USER LANGUAGE PROGRAMS // // uifsetup (within any BAE module) // scmsetup (within Schematic Editor) // gedsetup (within Graphic Editor) // arsetup (within Neural Autorouter) // camsetup (within CAM Processor) // cvsetup (within CAM View) // cedsetup (within Chip Editor) */ // Includes #include "pop.ulh" // User Language popup utilites // Enforce standard caller type #pragma ULCALLERSTD // INI file parameter name definitions #define PAR_USER1PROG "USER1PROG_STD" // User defined setup program name #define PAR_AUTOLOADLM "AUTOLOADLM_STD"// Automatic layout load mode #define PAR_AUTOLOADSM "AUTOLOADSM_STD"// Automatic schematic load mode #define PAR_AUTOLOADIM "AUTOLOADIM_STD"// Automatic IC design load mode #define PAR_AUTOLOADLN "AUTOLOADLN_STD"// Automatic load layout name #define PAR_AUTOLOADSN "AUTOLOADSN_STD"// Automatic load schematic name #define PAR_AUTOLOADIN "AUTOLOADLI_STD"// Automatic load IC design name #define PAR_LOADLAST "LOADLAST_STD" // Automatic last element load flag #define PAR_SAVEPROMPT "SAVEPROMPT_STD"// Save prompt mode #define PAR_AUTORAISE "AUTORAISE_STD" // BAE window autoraise flag #define PAR_DIALPOSMODE "DIALPOSMODE_STD"// Dialog box position store mode #define PAR_MOUSEWARP "MOUSEWARP_STD" // Menu mouse warp mode #define PAR_MOUSERECT "MOUSERECT_STD" // Minimum mouse rectangle size #define PAR_MOUSEINFO "MOUSEINFO_STD" // Menu mouse info display mode #define PAR_MOUSEREP "MOUSEREP_STD" // Mouse function repeat mode #define PAR_MMBDIS "MMBDISABLE_STD"// Middle mouse button disable flag #define PAR_LMDBLMODE "PLOOPDBLM_STD" // Mouse pick loop double click mode #define PAR_CKEYSTEP "CKEYSTEP_STD" // Mouse cursor key grid mode #define PAR_IGRIDDISP "INPGRIDDISP_STD"// Input grid display flag #define PAR_GRIDLINES "GRIDLINES_STD" // Grid line matrix display flag #define PAR_PICKPMARK "PICKPMARKER_STD"// Pick point marker display mode #define PAR_PICKAPER "PICKAPERTURE_STD"// Pick aperture #define PAR_TOPPREVIEW "TOPELPREVIEW_STD"// Top level element preview mode #define PAR_PREVIEWRNG "PREVIEWRANGE_STD"// Element selection preview range #define PAR_FERRDISP "FILEERRDISP_STD"// File error display mode #define PAR_PROGBDISP "PROGRESSBAR_STD"// Progress bar display mode #define PAR_ALTCONFPATH "ALTCONFPATH_STD"// Alternate configuration file path #define PAR_ALTCONFPRIO "ALTCONFPRIO_STD"// Alternate configuration file prio. #define PAR_CONF1COL "CONF1COL_STD" // 1st config. selection column name #define PAR_CONF2COL "CONF2COL_STD" // 2nd config. selection column name // Globals #define UL_BAE_LOAD "bae_load" // BAE element load done program #define UL_UIFSETUP "uifsetup" // BAE user interface setup program #define UL_SETUPPAT "setup" // Setup program name pattern #define GV_MODID "MODULEID" // Module instance ID static string BAEPARAMDB = strgetconffilename(PARAMVNAME,PARAMFNAME,1); static string BAEHISTDB = strgetconffilename(HISTVNAME,HISTFNAME,2); static string user1prog /* User definied startup prog. name */; int callertype=uliptype() /* Calling environment type */; string fname = bae_planfname() /* Project file name string */; string ename = "" /* Element name string */; int ddbcl = DDBCLUNDEF /* DDB element class */; STRINGS favbl /* Favorite box name list */; int favbn=0 /* Favorite box count */; static int histidx=(-1) /* History start index */; // SQL definitions #define B_SELECT "select name from favboxes where ptyp=%d AND (autostart=1 OR autostart=3);" #define I_SELECT "select sidx from historyindex where ptyp=%d;" #define H_SELECT1 "select class,ename,fname from historyinfo where " #define H_SELECT2 "ptyp=%d AND modidx=%d;" string sqlcommand /* SQL command string */; // Main program void main() { string UL_IPSETUP /* UL interpreter setup program */; string ctrl /* Control string */; int ctrlend /* Control string end */; int pver /* UL program version */; int ptyp /* UL program caller type */; string modid /* Module instance id */; int year,month,day /* Date */; int hour,min,sec /* Time */; int fh /* File handle */; int i /* Loop control variable */; // Create module instance ID if (varget(GV_MODID,modid)!=0) { // Get date and time get_date(day,month,year); get_time(hour,min,sec); // Build the module ID sprintf(modid,"%04d%02d%02d%02d%02d%02d", year+1900,month+1,day,hour,min,sec); varset(GV_MODID,modid); } // Get the current UL interpreter's UL setup program name switch (callertype) { // Interpreter environments with setup program case ULIPSCM : case ULIPGED : case ULIPAR : case ULIPCAM : case ULIPCV : case ULIPCED : UL_IPSETUP=bae_moduleid()+UL_SETUPPAT; break; // UL interpreter type unknown default : exit(0); } // Test if setup program available if (ulproginfo(UL_IPSETUP,pver,ptyp) || pver>ulipversion() || pverulipversion() || pver=ULCOMPVERSION) bae_setintpar(5,1); bae_setintpar(12,bae_iniintval(PAR_MOUSEWARP,0)); bae_setintpar(15,bae_iniintval(PAR_MOUSEINFO,2)); bae_setintpar(14,bae_iniintval(PAR_MOUSERECT,5)); bae_setintpar(26,bae_iniintval(PAR_MOUSEREP,0)); bae_setintpar(44,bae_iniintval(PAR_MMBDIS,0)); bae_setintpar(20,bae_iniintval(PAR_CKEYSTEP,0)); bae_setintpar(23,bae_iniintval(PAR_GRIDLINES,0)); bae_setintpar(25,bae_iniintval(PAR_IGRIDDISP,0)); bae_setintpar(32,bae_iniintval(PAR_PICKPMARK,0)); bae_setdblpar(10,bae_inidblval(PAR_PICKAPER,0.003)); bae_setintpar(36,bae_iniintval(PAR_TOPPREVIEW,0)); bae_setintpar(37,bae_iniintval(PAR_FERRDISP,0)); bae_setintpar(40,bae_iniintval(PAR_LMDBLMODE,0)); bae_setintpar(42,bae_iniintval(PAR_PROGBDISP,1)); bae_setintpar(47,bae_iniintval(PAR_AUTORAISE,1)); bae_setintpar(51,bae_iniintval(PAR_DIALPOSMODE,0)); bae_setdblpar(11,0.01*bae_inidblval(PAR_PREVIEWRNG,25.0)); bae_setstrpar(20,bae_inistrval(PAR_CONF1COL,M("lokal","local"))); bae_setstrpar(21,bae_inistrval(PAR_CONF2COL,M("global","global"))); // Run the interpreter-specific setup program runulprog(UL_IPSETUP); // Check if extra user specific ULC program call requested if ((user1prog=bae_inistrval(PAR_USER1PROG,""))!="") ulsystem(user1prog,0); // Set the error mode fseterrmode(0); if (fname!="" && (fh=fopen(convstring(fname,0)+AUTEXT,0))!=(-1)) { fseterrmode(1); // Get the control script name fgets(ctrl,240,fh); fclose(fh); ctrlend=strlen(ctrl)-1; if (ctrl[ctrlend]=='\n') ctrl[ctrlend]='\0'; // Run the control script ulsystem(ctrl,0); fname=bae_planfname(); } // Get autostart dialog boxes sprintf(sqlcommand,B_SELECT,callertype); sqlcmd(BAEPARAMDB,sqlcommand,boxselfunc); for (i=0;i=0) switch (callertype) { case ULIPSCM : sprintf(sqlcommand,H_SELECT1+H_SELECT2,ULIPSCM,histidx); sqlcmd(BAEHISTDB,sqlcommand,histselfunc); if (ddbcl==DDBCLUNDEF) break; bae_clriactqueue(); bae_storemenuiact(1,ddbcl==DDBCLSCM ? 0 : (ddbcl==DDBCLSSYM ? 1 : (ddbcl==DDBCLSLAB ? 2 : 3)), LMB); bae_storetextiact(1,fname); bae_storetextiact(1,ename); bae_callmenu(200); break; case ULIPGED : sprintf(sqlcommand,H_SELECT1+H_SELECT2,ULIPGED,histidx); sqlcmd(BAEHISTDB,sqlcommand,histselfunc); if (ddbcl==DDBCLUNDEF) break; bae_clriactqueue(); bae_storemenuiact(1,ddbcl-DDBCLLAY,LMB); bae_storetextiact(1,fname); bae_storetextiact(1,ename); bae_callmenu(200); break; case ULIPCAM : sprintf(sqlcommand,H_SELECT1+H_SELECT2,ULIPGED,histidx); sqlcmd(BAEHISTDB,sqlcommand,histselfunc); if (ddbcl==DDBCLUNDEF) break; bae_clriactqueue(); bae_storemenuiact(1,ddbcl-DDBCLLAY,LMB); bae_storetextiact(1,fname); bae_storetextiact(1,ename); bae_callmenu(603); break; case ULIPAR : sprintf(sqlcommand,H_SELECT1+H_SELECT2,ULIPGED,histidx); sqlcmd(BAEHISTDB,sqlcommand,histselfunc); if (ddbcl!=DDBCLLAY && ddbcl!=DDBCLLPRT) break; bae_clriactqueue(); bae_storemenuiact(1,ddbcl-DDBCLLAY,LMB); bae_storetextiact(1,fname); bae_storetextiact(1,ename); bae_callmenu(903); break; case ULIPCED : sprintf(sqlcommand,H_SELECT1+H_SELECT2,ULIPCED,histidx); sqlcmd(BAEHISTDB,sqlcommand,histselfunc); if (ddbcl==DDBCLUNDEF) break; bae_clriactqueue(); bae_storemenuiact(1,ddbcl-DDBCLILAY,LMB); bae_storetextiact(1,fname); bae_storetextiact(1,ename); bae_callmenu(200); break; case ULIPCV : default : } } // Reset the error mode fseterrmode(1); } /*________________________________________________________________*/ // Help functions static void hlp_ulprogs() /* // Provide help info on User Language programs */ { STRINGS info_de = { // German UL programs help info "Wichtiger Hinweis zu User Language-Programmen", "_____________________________________________", "", "Die mit der BAE-Software ausgelieferten User", "Language-Programme sind nicht verfuegbar.", "", "Wir empfehlen dringendst, die User Language-", "Programme zu installieren und zu kompilieren,", "da dadurch der Funktionsumfang der Software", "erheblich erweitert wird (Menuedefinitionen,", "Tastaturbelegung, Toolbar, erweiterte Report-", "und Editierfunktionen, Bibliotheksmanagement,", "Ein-/Ausgabe-Schnittstellen, usw.).", "", "Die User Language-Programme koennen mit der", "Batchdatei CPLSLL.BAT im BAEULC-Verzeichnis", "automatisch kompiliert werden.", "", "Kapitel 1 des BAE Benutzerhandbuchs enthaelt", "eine ausfuehrlichere Installationsanleitung.", "" }; STRINGS info_en = { // English UL programs help info "Important Note on User Language Programs", "________________________________________", "", "The User Language programs supplied with", "the BAE software are not available.", "", "We strongly recommended to install and", "compile the User Language programs since", "these provide a series of additional BAE", "features such as menu definitions, key", "assignments, toolbars, advanced report", "functions and edit utilities, data I/O", "filters, library management tools, etc.", "", "For automatic compilation simply run the", "CPLSLL batch file from within the BAEULC", "directory created during BAE software", "installation.", "", "See the installation guide provided with", "chapter 1 of the BAE User Manual for", "more details.", "" }; #if UILANGDEF==UILANG_DE // Default language German // Display the messages in info popup popupinfo(bae_uilanguage()==UILANG_EN ? info_en : info_de); #else // Assume default language English // Display the messages in info popup popupinfo(bae_uilanguage()==UILANG_DE ? info_de : info_en); #endif } /*________________________________________________________________*/ // Popup routines #define UPRPOPOK "[OK]" // OK popup menu button #define COLOR_MSG 15 // Standard info display color static void popupinfo(STRINGS msg) /* // Display given messages in an info popup // Parameters : // STRINGS msg : Message strings */ { int row /* Popup start row count */; int col /* Popup start column count */; double width /* Popup percentage width */; double height /* Popup percentage height */; double mlx,mly /* Popup window lower percentage */; double mux,muy /* Popup window upper percentage */; int maxlen = 0 /* Maximum message length */; int msgn = arylength(msg) /* Message strings count */; int i /* Loop control variable */; // Get the maximum message length for (i=msgn-1;i>=0;i--) maxlen=maxint(maxlen,strlen(msg[i])); // Done if no message defined if (maxlen==0) return; // Enlarge maximum message length for OK button fit maxlen=maxint(maxlen,strlen(UPRPOPOK)); // Get popup rows count row=maxint(msgn+1,7); // Get popup columns count col=maxlen+7; // Calculate the popup width and height width=calcpopwidth(col); height=calcpopheight(row); // Set popup menu lower boundaries for center alignment mlx=(1.0-width)/2.0; mly=(1.0-height)/2.0; // Set the upper popup menu boundaries mux=mlx+width; muy=mly+height; // Display the popup menu bae_popshow(row,col,mlx,mly,mux,muy); // Display the message type denoter bae_popcolbar(0,0,6,4,COLOR_PDBACK); // Issue standard info (draw 'i') bae_popcolbar(1,2,1,2,COLOR_MSG); bae_popcolbar(3,1,3,1,COLOR_MSG); bae_popcolbar(3,2,5,2,COLOR_MSG); bae_popcolbar(5,3,5,3,COLOR_MSG); // Display the messages for (i=0;iMAXKEYLEN) name[MAXKEYLEN]='\0'; // Convert to valid name strlower(name); for (i=0;(c=name[i])!='\0';i++) if (c==' ' || iscntrl(c)) name[i]='_'; // Return converted name return(name); } string icddefelemname(string fn) /* // Get default IC design element name for given file // Return value : // Element name string // Parameter : // string fn : Project file name */ { string name /* Name string */; char c /* Character buffer */; int i /* Loop control variable */; // Check if fix element name if (icd_defelemname()!="*") return(icd_defelemname()); // Get file base name name=convstring(fn,2); // Restrict name length if (strlen(name)>MAXKEYLEN) name[MAXKEYLEN]='\0'; // Convert to valid name strlower(name); for (i=0;(c=name[i])!='\0';i++) if (c==' ' || iscntrl(c)) name[i]='_'; // Return converted name return(name); } // User Language program end