wiki:Features/RightClick
Last modified 3 years ago Last modified on 08/29/11 19:13:41

Context Sensitive Menu

A context menu can be triggered from the editor main window using the common way of platform (one or multiple ways):

  • Clicking on the right button of the mouse (All)
  • Using the Menu key of the keyboard (at least Windows, Gnome)
  • Using Shift+F10 on the keyboard (at least Windows, Gnome)

The pop-up presents a list of actions that can be executed. The exact list depends on the file type and the specific location of the mouse cursor, or if triggered by the keyboard the position of the caret.

As Padre also tries to be keyboard friendly the same pop-up can be triggerd by pressing Alt-/

Undo and Redo are always listed but they might be grayed out. They are the same as in Edit -> Undo and Redo

Open Selection is show if there is a selection

Open File in Browser will open the File Explorer of Windows or Nautilus on Ubuntu at the directory where the current file can be found

Find in Files will open that menu in Search -> Find in Files...

Copy and Cut, Paste, Select All the standard menu options

Toggle Comment, Comment and Uncomment can comment out one or more lines at a time

If the Show Code Folding is enabled and the mouse is over the folding margin on the left then you can see another two menu options to Fold All and Unfold All.

In addition each document type can add its own menu items by implementing the event_on_context_menu method. For example the Perl document class Padre::Document::Perl adds Find Variable, Rename Variable and the whole Change Variable stye submenu if the mouse is over a variable name. Find Method Declaration if the mouse is over a subroutine or method name. If something is selected then it will also show Introduce Temporary Variable and Edit with Regex Editor.

Finally the plugins can also add extra menu options. (See on_context_menu of the Plugin Manager)

Test

Implementation

Padre::Wx::Menu::RightClick

TODO

  • Describe in detail
  • Allow plug-ins to add items
  • Allow the user to configure what's in the context menu
  • The Perl document should be able to recognize when the mouse is in a regex and show the Edit with Regex Editor only if it is and be able to paste the new regex back to the same location.