• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. Adding new item to already created custom menu (for all...

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 143
  • Views 14905
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Adding new item to already created custom menu (for all Layout Editor windows)

Sheppy
Sheppy over 10 years ago

Hello,

I am working on a library that contains many macro functions to automate certain parts of the layout. Depending on the need, per project some macro's will be needed/loaded, and some won't. All these macro's must be available in a pull-down menu, which will be available in all layout editor windows. All macro's will be loaded at start-up of Virtuoso, and I want to include in that code a part that adds a menu item for that particular macro.

One menu item is always loaded, so I used that to generate the menu. I have copied the code of: http://community.cadence.com/cadence_technology_forums/f/48/p/20591/1304715#1304715 to generate the menu and this single item.

For this topic, I'd like to refer to the aforementioned topic and the code as posted by Andrew. See below:


procedure(AmitAddMenu(args)
  let( (item1 item2)
    ;; create a couple of menu items
    item1 = hiCreateMenuItem( ?name 'item1 ?itemText "My First Item"
              ?callback "AmitFunctionOne()"
            )
    item2 = hiCreateMenuItem( ?name 'item2 ?itemText "My Second Item"
              ?callback "AmitFunctionTwo()"
            )
    ;; create a menu that includes the menu items and return a list of the
    ;; pulldown menus
    list(hiCreatePulldownMenu('AmitMenu "Amit Menu" list(item1 item2)))
  );let
); procedure
;; create a userMenuTrigger trigger that automatically adds the menu
deRegUserTriggers("maskLayout" nil 'AmitAddMenu)


So lets say, I load this code and get in all layout editor windows the menu with the two options.

How do I get a third item in this pull-down menu by code loaded at start-up of Virtuoso (this code will be loaded after the code with the two options of course)?

Thank you in advance.

With kind regards,

Sjoerd

  • Cancel
Parents
  • Sheppy
    Sheppy over 10 years ago

    By the way, this is what I tried, and it kind of works:


    ;;; Procedure for the SSM Macro! This will always be there.
    procedure( sstSSMAddLayoutEditorMacroMenuItem( _args )
         let( ( item1 item2 )
            ;;; create a couple of menu items
            item1 = hiCreateMenuItem(
                    ?name 'item1
                    ?itemText "My First Item"
                    ?callback "printf( \"%L\n\" geGetWindowCellView( hiGetCurrentWindow() ) )"
                )
            item2 = hiCreateMenuItem(
                    ?name 'item2
                    ?itemText "My Second Item"
                    ?callback "printf( \"Option 2 clicked...\n\" )"
                )
            
            ;;; create a menu that includes the menu items and returns a list of the pulldown menus
            list( hiCreatePulldownMenu( 'sstMacroMenu "SST Macro Menu" list( item1 item2 ) ) )
        ) ;;; end of let
    ) ;;; end of procedure sstSSMAddLayoutEditorMacroMenuItem

    ;; create a userMenuTrigger trigger that automatically adds the menu
    deRegUserTriggers( "maskLayout" nil 'sstSSMAddLayoutEditorMacroMenuItem )

    ;;; Procedure for the STM Macro! This is for optional macro's.
    procedure( sstSTMAddLayoutEditorMacroMenuItem( _args )
         let( (    item
            item3
            ( newItemList nil ) )
            when( boundp( 'sstMacroMenu )
                ;;; Get the current items of the menu and put them in a list
                foreach( item sstMacroMenu~>_menuItemList
                    newItemList = tconc( newItemList get( sstMacroMenu item ) )
                ) ;;; end of foreach
            
                ;;; Add the new item to the back of the list.
                newItemList = tconc( newItemList hiCreateMenuItem(
                            ?name 'item3
                            ?itemText "My Third Item"
                            ?callback "printf( \"Option 3 clicked...\n\" )"
                        ) )
                
                newItemList = car( newItemList )
                
                ;;; create a menu that includes the menu items and returns a list of the pulldown menus
                list( hiCreatePulldownMenu( 'sstMacroMenu "SST Macro Menu" newItemList ) )
            ) ;;; end of when
        ) ;;; end of let
    ) ;;; end of procedure sstSTMAddLayoutEditorMacroMenuItem

    deRegUserTriggers( "maskLayout" nil 'sstSTMAddLayoutEditorMacroMenuItem )


    What is the problem with this approach?

    It generates a second pull-down menu. The first menu contains two items, and the second menu contains all three items. So the part of adding an item works, but the updating part of the existing menu does not work. How do I get this to work properly?

    Thanks in advance.

    With kind regards,

    Sjoerd

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Sheppy
    Sheppy over 10 years ago

    By the way, this is what I tried, and it kind of works:


    ;;; Procedure for the SSM Macro! This will always be there.
    procedure( sstSSMAddLayoutEditorMacroMenuItem( _args )
         let( ( item1 item2 )
            ;;; create a couple of menu items
            item1 = hiCreateMenuItem(
                    ?name 'item1
                    ?itemText "My First Item"
                    ?callback "printf( \"%L\n\" geGetWindowCellView( hiGetCurrentWindow() ) )"
                )
            item2 = hiCreateMenuItem(
                    ?name 'item2
                    ?itemText "My Second Item"
                    ?callback "printf( \"Option 2 clicked...\n\" )"
                )
            
            ;;; create a menu that includes the menu items and returns a list of the pulldown menus
            list( hiCreatePulldownMenu( 'sstMacroMenu "SST Macro Menu" list( item1 item2 ) ) )
        ) ;;; end of let
    ) ;;; end of procedure sstSSMAddLayoutEditorMacroMenuItem

    ;; create a userMenuTrigger trigger that automatically adds the menu
    deRegUserTriggers( "maskLayout" nil 'sstSSMAddLayoutEditorMacroMenuItem )

    ;;; Procedure for the STM Macro! This is for optional macro's.
    procedure( sstSTMAddLayoutEditorMacroMenuItem( _args )
         let( (    item
            item3
            ( newItemList nil ) )
            when( boundp( 'sstMacroMenu )
                ;;; Get the current items of the menu and put them in a list
                foreach( item sstMacroMenu~>_menuItemList
                    newItemList = tconc( newItemList get( sstMacroMenu item ) )
                ) ;;; end of foreach
            
                ;;; Add the new item to the back of the list.
                newItemList = tconc( newItemList hiCreateMenuItem(
                            ?name 'item3
                            ?itemText "My Third Item"
                            ?callback "printf( \"Option 3 clicked...\n\" )"
                        ) )
                
                newItemList = car( newItemList )
                
                ;;; create a menu that includes the menu items and returns a list of the pulldown menus
                list( hiCreatePulldownMenu( 'sstMacroMenu "SST Macro Menu" newItemList ) )
            ) ;;; end of when
        ) ;;; end of let
    ) ;;; end of procedure sstSTMAddLayoutEditorMacroMenuItem

    deRegUserTriggers( "maskLayout" nil 'sstSTMAddLayoutEditorMacroMenuItem )


    What is the problem with this approach?

    It generates a second pull-down menu. The first menu contains two items, and the second menu contains all three items. So the part of adding an item works, but the updating part of the existing menu does not work. How do I get this to work properly?

    Thanks in advance.

    With kind regards,

    Sjoerd

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information