Author Topic: Per-extension menus?  (Read 4104 times)

Phileosophos

  • Community Member
  • Posts: 37
  • Hero Points: 0
Per-extension menus?
« on: August 21, 2008, 01:06:56 AM »
I am trying (unsuccessfully thus far) to find some way to customize SlickEdit to add certain items to the context menu that appears when right clicking in an open editing window. To be more specific, I would like to add an "Edit Code" option to *.aspx files and a corresponding "Edit Source" option to *.aspx.cs files, to allow quick switching between ASP.NET pages and their underlying C# code. Can anyone advise me as to how I might do this? Thanks in advance.

Graeme

  • Senior Community Member
  • Posts: 2793
  • Hero Points: 347
Re: Per-extension menus?
« Reply #1 on: August 21, 2008, 03:13:32 AM »
Do you know about the edit_associated_file function  - it's designed for switching between associated files like aspx cs.  In slick 13.0.0, it doesn't handle aspx.  On the slick cmd line, type fp edit-associated-file and press RETURN.  You'll be taken to the source for the macro in stdcmds.e.  You can see there is already special handling for cs and xaml, resx.  You can probably see how to add aspx capability.

To modify the macro, copy the code into your vusrmacs.e file (in your config folder) and edit how you like - then use the load command on the macro menu.  Your version of edit-associated-file now replaces the slick version  - however, if you load a hotfix that includes a new stdcmds.e, you will then have to reload your vusrcmds.e file  - after checking whether edit-associated-file changed.

You can find edit-associated-file in the contetx menu and also in the Document menu.

To customise the context menu, choose the "edit this menu" item from the context menu, or use macro -> menus and edit the _ext_menu_default menu.  To see how to use the menu editor press F1 or click help in that dialog.

In stdcmds.e, just below the edit-associated-file function, youi'll see the _OnUpdate_edit_associated_file function  - this function determines when the "edit-associated-file" option in the context menu is greyed out.

Graeme

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Per-extension menus?
« Reply #2 on: August 21, 2008, 10:06:52 AM »
In addition you can also specify a specific context menu per language (Options>Language>General).

Edit: Here is a loosely related example of a macro command which can be added to a context menu.
HS2
« Last Edit: August 21, 2008, 10:12:19 AM by hs2 »

Phileosophos

  • Community Member
  • Posts: 37
  • Hero Points: 0
Re: Per-extension menus?
« Reply #3 on: August 21, 2008, 09:38:09 PM »
That information was very helpful. Many thanks! I'll see if I can get it working.