Product Documentation
Virtuoso Studio Design Environment SKILL Reference
Product Version IC23.1, November 2023

Extended Design Editor Example

This section contains an extended example of how the various Design Editor routines are used. Included is an example implementation of a typical data trigger, exDataTrigger, and application trigger, exAppTrigger. These procedures are included as a guide for developing your own data and application triggers. However, the installation of an application into a window requires C-code access to provide the implementation of the window interface. The standard triggers for applications, geDataTrigger and geAppTrigger, have been withdrawn from public use. See your Cadence representative if this is a problem.

The first example routine is a data trigger. This routine uses the information in the argument list to open up a data file, and should return the database ID of the result. It is also used to close or change the data file associated with a window.

The second example routine is an application trigger. This routine expects the data trigger to have returned successfully and has the job of managing the data while it is in the window. It must be able to install the data for the first time, save it while another file is stacked on top of it, restore it when that file is removed, remove itself, and copy itself. Sample menu and enable triggers are given showing you how to create menus for your application and to control its availability.

Normally you will not implement these routines yourself. They will be defined as part of a Cadence application, and you will use the user triggers to do your customization. The final example shows how you may customize an existing application with some sample user triggers.

If your application integration needs require special data and/or application triggers, see your Cadence representative for help in developing these.

;******************************************************************
; exDataTrigger(args)
;
; FUNCTION
;    This is an example data trigger. It opens the appropriate
;    cellView as specified by the input arguments.
;******************************************************************
procedure(exDataTrigger(args)    prog((s cellViewId mode viewType)
caseq(args->action
(open ;open the data file
s = args->viewNameList || args->viewName

                    if(args->accessMode != "w" then
if(args->accessMode != "r" then
mode = strcat(args->accessMode "n")
viewType = args->rootType
else
mode = args->accessMode
viewType = ""
)
cellViewId = dbOpenCellViewByType(args->
libName
args->cellName s viewType mode)
unless(cellViewId
when(args->accessMode == "a"
; the cellview could not be opened
for edit.
; Open it for read.
cellViewId = dbOpenCellViewByType(args->libName
args->cellName s viewType "r")
)
)
)
else
cellViewId = dbOpenCellViewByType(args->libName
args->cellName s args->rootType "r")
if(cellViewId then
dbReopen(cellViewId "w")
)
else
getWarn()
cellViewId = dbOpenCellViewByType(args->libName
args->cellName s args->rootType "wn")
/* if it's a new cellview, do a save to force it
to create an empty file, for discard edits */
when(cellViewId
dbSave(cellViewId)
)
)
)
return(cellViewId)
)
(close
cellViewId = deGetCellView(args->window)
when(cellViewId~>superMaster
return(t)
)
return(dbClose(cellViewId))
)
(swap
s = args->viewNameList || args->viewName

                 if(args->accessMode != "w" then
if(args->accessMode == "r" then
mode = args->accessMode
else
mode = strcat(args->accessMode "n")
)

                     cellViewId = dbOpenCellViewByType(args->libName
args->cellName s args->rootType mode)
else
cellViewId = dbOpenCellViewByType(args->libName
args->cellName s args->rootType "r")
if(cellViewId then
dbReopen(cellViewId "w")
else
getWarn()
cellViewId = dbOpenCellViewByType(args->libName
args->cellName s args->rootType "wn")
)
)
return(cellViewId)
)
)
return()
)
)
; Here we remove the first
; standard menu and add a window property
procedure( exCustomPostInstallTrigger( args )
    ; remove one of the default menus
    hiDeleteBannerMenu(args->window 0)
    ; set a special window property
    window->pathWidth = 10.0
    )
; Now, register the example user triggers 
deRegUserTriggers( "example" 'exCustomAppTrigger 'exCustomMenuTrigger 
'exCustomPostInstallTrigger )
; finally, we list the app info for "example" and see that the
; custom triggers have been added to the list.
deGetAppInfo( "example" )
( nil viewType "example" parentType "" appName "Example Application" help "Example Application Help" widgetType "graphics" dataTrigger exDataTrigger appTrigger exAppTrigger enableTrigger exEnableTrigger menuTrigger exMenuTrigger userAppTrigger exCustomAppTrigger userMenuTrigger exCustomMenuTrigger postInstallTrigger exCustomPostInstallTrigger inheritMenus nil inheritEnabling nil subtypes nil )
; This is a basic application trigger that can serve many
; applications
procedure( exAppTrigger(args)
prog( (w ctx cv)
w = args->window
cv = deGetCellView(w)
caseq( args->action
(install
            ctx = <create your application context data structure
install your application context data structure in
the window, and initialize the window interface to
contain drawing and other procedures>
            return( ctx )
)
(push
ctx = deGetContext( w )
        < update ctx to reflect the fact that this stack element is
no longer current.>
             return( ctx )
)
(pop
ctx = deGetContext( w )
             <update ctx to reflect the fact that this stack element
will now be current again>
             < install your application context data structure in the
window, and initialize the window interface to
contain the proper drawing and other procedures.>
return( ctx )
)
(copy
             ctx = <make a copy of your application data structure>
return( ctx )
)
(close
ctx = deGetContext( w )
             ctx = <result of attempting to destroy the current
application data context >
             return( ctx )
)
(swap
ctx = deGetContext( w )
             ctx = <re-initialize application data structure with a
new data file)
             return( ctx )
)
(copyInstall
ctx = deGetContext( w )
             <install your application context data structure in the
window, and initialize the window interface to contain
the proper drawing and other procedures>
             return( ctx )
)
(t return(t))
)
return(t)
))
; define the default menus
exMenu1 = hiCreateMenu(...)
exMenu2 = hiCreateMenu(...)
procedure( exMenuTrigger(args)
; return a list of menus
list( exMenu1 exMenu2 )
)
; define the conditions for allowing the user to use your application
procedure( exEnableTrigger(@optional args)
if( !args then
<check root data security>
else
<check example application security> )
)
; Now, register the example application 
deRegApp( ?viewType "example" ?appName "Example Application" ?help "Example Application Help" ?dataTrigger 'exDataTrigger ?appTrigger 'exAppTrigger ?menuTrigger 'exMenuTrigger ?enableTrigger ’exEnableTrigger )
deGetAppInfo( "example" )
( nil viewType "example" parentType "" appName "Example Application" help "Example Application Help" widgetType "graphics" dataTrigger exDataTrigger appTrigger exAppTrigger enableTrigger exEnableTrigger menuTrigger exMenuTrigger userAppTrigger nil userMenuTrigger nil postInstallTrigger nil inheritMenus nil inheritEnabling nil subtypes nil )
;***************************************************************************
; Here we show how to customize an existing application using user triggers.
;***************************************************************************
; Custom app trigger.
; This is called immediately after (or before, as determined by the ; situation)the standard app trigger. It installs a custom popup menu ; and selection form procedure( exCustomAppTrigger( args )
    caseq( args->action
((install pop copyInstall)
< create your own selection form >
< install your own popup menu >
)
((push close)
< remove your own selection form in case the
new application doesn’t have one of its own >
< remove your own popup menu - same reason >
)
; in all other cases, we don’t do anything special
)
t
)
; the user menu trigger will add a menu to the banner
exCustomMenu = hiCreateMenu(...)
procedure( exCustomMenuTrigger( args )
list( exCustomMenu )
)
; the user post install trigger can customize the application
; in any way desired. Here we remove the first
; standard menu and add a window property
procedure( exCustomPostInstallTrigger( args )
; remove one of the default menus
hiDeleteBannerMenu(args->window 0)
; set a special window property
window->pathWidth = 10.0
)
; Now, register the example user triggers 
deRegUserTriggers( "example" 'exCustomAppTrigger 'exCustomMenuTrigger ’exCustomPostInstallTrigger )
; finally, we list the app info for "example" and see that the
; custom triggers have been added to the list.
deGetAppInfo( "example" )
( nil viewType "example" parentType "" appName "Example Application" help "Example Application Help" widgetType "graphics" dataTrigger exDataTrigger appTrigger exAppTrigger enableTrigger exEnableTrigger menuTrigger exMenuTrigger userAppTrigger exCustomAppTrigger userMenuTrigger exCustomMenuTrigger postInstallTrigger exCustomPostInstallTrigger inheritMenus nil inheritEnabling nil subtypes nil )


Return to top
 ⠀
X