/// <summary> /// Called when the plugin menu of the plugin needs to be filled /// We can call UnmanagedExports.NppFuncItems.RefreshItems(); later on if we had stuff /// in the plugin menu via Npp.SetCommand /// </summary> internal static void DoFuncItemsNeeded() { var cmdIndex = 0; AppliMenu.MainMenuCommandIndex = cmdIndex; Npp.SetCommand(cmdIndex++, "Show main menu [Ctrl + Right click]", () => AppliMenu.ShowMainMenu(true)); CodeExplorer.Instance.DockableCommandIndex = cmdIndex; Npp.SetCommand(cmdIndex++, "Toggle code explorer", CodeExplorer.Instance.Toggle); FileExplorer.Instance.DockableCommandIndex = cmdIndex; Npp.SetCommand(cmdIndex, "Toggle file explorer", FileExplorer.Instance.Toggle); }
public static bool MouseMessageHandler(WinApi.Messages message, Win32Api.MOUSEHOOKSTRUCT mouseStruct) { switch (message) { // middle click : go to definition case WinApi.Messages.WM_MBUTTONDOWN: if (Npp.CurrentFileInfo.IsProgress) { if (KeyboardMonitor.GetModifiers.IsCtrl) { Npp.GoBackFromDefinition(); } else { ProMisc.GoToDefinition(true); } } return(true); //break; // (CTRL + ) Right click : show main menu case WinApi.Messages.WM_RBUTTONUP: if (KeyboardMonitor.GetModifiers.IsCtrl) { // we need the cursor to be in scintilla but not on the application or the autocompletion! if ((!Appli.IsVisible || !Appli.IsMouseIn()) && (!InfoToolTip.IsVisible || !InfoToolTip.IsMouseIn()) && (!AutoCompletion.IsVisible || !AutoCompletion.IsMouseIn())) { AppliMenu.ShowMainMenu(true); return(true); } } break; } return(false); }
public static bool MouseMessageHandler(WinApi.Messages message, Win32Api.MOUSEHOOKSTRUCT mouseStruct) { switch (message) { // middle click : go to definition case WinApi.Messages.WM_MBUTTONDOWN: if (Npp.CurrentFileInfo.IsProgress) { if (KeyboardMonitor.GetModifiers.IsCtrl) { Npp.GoBackFromDefinition(); } else { ProMisc.GoToDefinition(true); } } return(true); //break; // (CTRL + ) Right click : show main menu case WinApi.Messages.WM_RBUTTONUP: if (KeyboardMonitor.GetModifiers.IsCtrl) { // we need the cursor to be in scintilla but not on the application or the autocompletion! if ((!Appli.IsVisible || !Appli.IsMouseIn()) && (!InfoToolTip.IsVisible || !InfoToolTip.IsMouseIn()) && (!AutoCompletion.IsVisible || !AutoCompletion.IsMouseIn())) { AppliMenu.ShowMainMenu(true); return(true); } } break; } // HACK: The following is to handle the MOVE/RESIZE event of npp's window. // It would be cleaner to use a WndProc bypass but it costs too much... this is a cheaper solution switch (message) { case WinApi.Messages.WM_NCLBUTTONDOWN: if (!WinApi.GetWindowRect(Npp.CurrentSci.Handle).Contains(Cursor.Position)) { MouseMonitor.Instance.Add(WinApi.Messages.WM_MOUSEMOVE); } break; case WinApi.Messages.WM_LBUTTONUP: case WinApi.Messages.WM_NCLBUTTONUP: if (MouseMonitor.Instance.Remove(WinApi.Messages.WM_MOUSEMOVE)) { if (OnNppWindowsMove != null) { OnNppWindowsMove(); } } break; case WinApi.Messages.WM_MOUSEMOVE: if (OnNppWindowsMove != null) { OnNppWindowsMove(); } break; } return(false); }