F
fogh
Guest
Hi All,
I have started writing a toolbar for placing instances in a schematic. I am a
bit too busy for this now, but please contribute if you want.
I should rephrase that: contribute any change you make. Consider this code as
GPL licensed : do not distribute it encrypted or in context-file only format ;
and do send back the improvements.
/*
Frederic Oghdayan , november 2004.
generate a schematic toolbar for the current technology.
TODO:
- group by category,
- skip categories||cells with names like "obsolete" "don t use" ...
- trigger with schematic editor.
- use dlSaveDlist and dlDlistToIcon to generate readymade icons as library
owner. If speed allows, appear/disappear with instance mode.
- find&use grey std color background
- avoid empty icons: make the symbol fatter before turning it to a DL.
X- make more columns depending on available screen height
X- close all cell in scratch mode (and refresh?)
- select by menu which libraries/categories/cells should be in the bar
*/
hiSetBindKey("Schematics" "CtrlShift<Key>t" "CmTechSchIcons()")
procedure(CmTechSchIcons() ;;this proc generates globals with name "^CmTechSch"
let(
;nil
(techlibname cv dl icon iconsymname itemsymname menusymname callback cols rows
handlename w (usablescreenheigth 600) (iconwidth 32) )
usablescreenheigth=if(isCallable('getMaxScreenCoords)
round(80%*cadr(getMaxScreenCoords()))
usablescreenheigth)
;;techlibname="gpdk"
techlibname=techGetTechFile(geGetEditCellView())->libName
CmTechSchItemList=foreach(mapcar ddsym setof(cell ddGetObj(techlibname)->cells
member("symbol" cell~>views~>name))
cv=dbOpenCellViewByType(ddsym->lib->name ddsym->name "symbol")
dbReopen( cv "s" ) ;this saves specifying cellViewType.
foreach(s cv~>shapes
unless(car(s->lpp)=="device" dbDeleteObject(s))
)
dbComputeBBox(cv)
dl=geCellViewToDlist(cv)
;; do this only as library owner and make an autoload
mechanism.;;dlSaveDlist(dl strcat("CmTechSch" "_" techlibname "_" ddsym->name
".displaylist.il") strcat("CmTechSch_DL" "_" techlibname "_" ddsym->name ) )
icon=dlDlistToIcon(dl iconwidth iconwidth )
iconsymname=strcat("CmTechSchFixedMenuIcon" "_" techlibname "_" ddsym->name)
set(stringToSymbol(iconsymname) copy(icon))
itemsymname=strcat("CmTechSchFixedMenuItem" "_" techlibname "_" ddsym->name)
menusymname=strcat("CmTechSchFixedMenu" "_" techlibname "_" ddsym->name)
callback=strcat("schHiCreateInst(\"" ddsym->lib->name "\" \"" ddsym->name "\"
\"" "symbol\"" ")" )
set(
stringToSymbol(itemsymname)
hiCreateMenuItem(
?name stringToSymbol(itemsymname)
?itemText ddsym->name
?itemIcon symeval(stringToSymbol(iconsymname))
?callback callback
)
);set item
dbPurge(cv)
stringToSymbol(itemsymname) ;;mapcar return value
);foreach ddsym
cols=1.0*iconwidth*length(CmTechSchItemList)/usablescreenheigth
if( (cols-floor(cols))/cols < 17%
cols=floor(cols) ;;cram it in
cols=ceiling(cols)
)
printf("%L\n" cols)
rows=ceiling(1.0*length(CmTechSchItemList)/cols)
handlename=strcat("CmTechSchFixedMenuHandle" "_" techlibname)
set(
stringToSymbol(strcat("CmTechSchFixedMenu" "_" techlibname))
hiCreateVerticalFixedMenu(
stringToSymbol(handlename)
CmTechSchItemList
rows
cols
)
)
;; look at schEnableSchFixedMenu() in schView/schFixMenu.il
;;2- trigger in schematic editor
;;CmTechSchFixedMenu_gpdk
;;
w=(isCallable('geGetEditCellViewWindow)&&geGetEditCellViewWindow(geGetEditCellView())
)||(isCallable('geGetCellViewWindow)&&geGetCellViewWindow(geGetEditCellView()))
hiAddFixedMenu(
?window w
?fixedMenu symeval(stringToSymbol(strcat("CmTechSchFixedMenu" "_" techlibname)))
)
);let
);proc
I have started writing a toolbar for placing instances in a schematic. I am a
bit too busy for this now, but please contribute if you want.
I should rephrase that: contribute any change you make. Consider this code as
GPL licensed : do not distribute it encrypted or in context-file only format ;
and do send back the improvements.
/*
Frederic Oghdayan , november 2004.
generate a schematic toolbar for the current technology.
TODO:
- group by category,
- skip categories||cells with names like "obsolete" "don t use" ...
- trigger with schematic editor.
- use dlSaveDlist and dlDlistToIcon to generate readymade icons as library
owner. If speed allows, appear/disappear with instance mode.
- find&use grey std color background
- avoid empty icons: make the symbol fatter before turning it to a DL.
X- make more columns depending on available screen height
X- close all cell in scratch mode (and refresh?)
- select by menu which libraries/categories/cells should be in the bar
*/
hiSetBindKey("Schematics" "CtrlShift<Key>t" "CmTechSchIcons()")
procedure(CmTechSchIcons() ;;this proc generates globals with name "^CmTechSch"
let(
;nil
(techlibname cv dl icon iconsymname itemsymname menusymname callback cols rows
handlename w (usablescreenheigth 600) (iconwidth 32) )
usablescreenheigth=if(isCallable('getMaxScreenCoords)
round(80%*cadr(getMaxScreenCoords()))
usablescreenheigth)
;;techlibname="gpdk"
techlibname=techGetTechFile(geGetEditCellView())->libName
CmTechSchItemList=foreach(mapcar ddsym setof(cell ddGetObj(techlibname)->cells
member("symbol" cell~>views~>name))
cv=dbOpenCellViewByType(ddsym->lib->name ddsym->name "symbol")
dbReopen( cv "s" ) ;this saves specifying cellViewType.
foreach(s cv~>shapes
unless(car(s->lpp)=="device" dbDeleteObject(s))
)
dbComputeBBox(cv)
dl=geCellViewToDlist(cv)
;; do this only as library owner and make an autoload
mechanism.;;dlSaveDlist(dl strcat("CmTechSch" "_" techlibname "_" ddsym->name
".displaylist.il") strcat("CmTechSch_DL" "_" techlibname "_" ddsym->name ) )
icon=dlDlistToIcon(dl iconwidth iconwidth )
iconsymname=strcat("CmTechSchFixedMenuIcon" "_" techlibname "_" ddsym->name)
set(stringToSymbol(iconsymname) copy(icon))
itemsymname=strcat("CmTechSchFixedMenuItem" "_" techlibname "_" ddsym->name)
menusymname=strcat("CmTechSchFixedMenu" "_" techlibname "_" ddsym->name)
callback=strcat("schHiCreateInst(\"" ddsym->lib->name "\" \"" ddsym->name "\"
\"" "symbol\"" ")" )
set(
stringToSymbol(itemsymname)
hiCreateMenuItem(
?name stringToSymbol(itemsymname)
?itemText ddsym->name
?itemIcon symeval(stringToSymbol(iconsymname))
?callback callback
)
);set item
dbPurge(cv)
stringToSymbol(itemsymname) ;;mapcar return value
);foreach ddsym
cols=1.0*iconwidth*length(CmTechSchItemList)/usablescreenheigth
if( (cols-floor(cols))/cols < 17%
cols=floor(cols) ;;cram it in
cols=ceiling(cols)
)
printf("%L\n" cols)
rows=ceiling(1.0*length(CmTechSchItemList)/cols)
handlename=strcat("CmTechSchFixedMenuHandle" "_" techlibname)
set(
stringToSymbol(strcat("CmTechSchFixedMenu" "_" techlibname))
hiCreateVerticalFixedMenu(
stringToSymbol(handlename)
CmTechSchItemList
rows
cols
)
)
;; look at schEnableSchFixedMenu() in schView/schFixMenu.il
;;2- trigger in schematic editor
;;CmTechSchFixedMenu_gpdk
;;
w=(isCallable('geGetEditCellViewWindow)&&geGetEditCellViewWindow(geGetEditCellView())
)||(isCallable('geGetCellViewWindow)&&geGetCellViewWindow(geGetEditCellView()))
hiAddFixedMenu(
?window w
?fixedMenu symeval(stringToSymbol(strcat("CmTechSchFixedMenu" "_" techlibname)))
)
);let
);proc