/// <summary> /// Called on Npp shutdown /// </summary> internal static void DoNppShutDown() { try { if (OnShutDown != null) { OnShutDown(); } // clean up timers ReccurentAction.CleanAll(); DelayedAction.CleanAll(); // export modified conf FileTag.Export(); // save config (should be done but just in case) CodeExplorer.UpdateMenuItemChecked(); FileExplorer.UpdateMenuItemChecked(); Config.Save(); // remember the most used keywords Keywords.SaveRanking(); // close every form AutoComplete.ForceClose(); InfoToolTip.ForceClose(); Appli.ForceClose(); FileExplorer.ForceClose(); CodeExplorer.ForceClose(); UserCommunication.ForceClose(); AppliMenu.ForceCloseMenu(); } catch (Exception e) { ErrorHandler.ShowErrors(e, "Stop"); } }
/// <summary> /// Called on Npp shutdown /// </summary> internal static void DoNppShutDown() { try { if (OnShutDown != null) { OnShutDown(); } // clean up timers RecurentAction.CleanAll(); DelayedAction.CleanAll(); AsapButDelayableAction.CleanAll(); // Triggered when the resolution of an assembly fails, gives us the opportunity to feed the required assembly AppDomain.CurrentDomain.AssemblyResolve -= LibLoader.AssemblyResolver; // catch unhandled errors to log them AppDomain.CurrentDomain.UnhandledException -= ErrorHandler.UnhandledErrorHandler; Application.ThreadException -= ErrorHandler.ThreadErrorHandler; TaskScheduler.UnobservedTaskException -= ErrorHandler.UnobservedErrorHandler; // unsubscribe to static events ProEnvironment.OnEnvironmentChange -= FileExplorer.Instance.RebuildFileList; ProEnvironment.OnEnvironmentChange -= DataBase.Instance.UpdateDatabaseInfo; ProEnvironment.OnEnvironmentChange -= ParserHandler.ClearStaticData; Keywords.Instance.OnImport -= AutoCompletion.SetStaticItems; DataBase.Instance.OnDatabaseUpdate -= AutoCompletion.SetStaticItems; AutoCompletion.OnUpdateStaticItems -= ParserHandler.UpdateKnownStaticItems; ParserHandler.OnEndSendCompletionItems -= AutoCompletion.SetDynamicItems; ParserHandler.OnStart -= CodeExplorer.Instance.OnStart; ParserHandler.OnEndSendParserItems -= CodeExplorer.Instance.OnParseEndParserItems; ParserHandler.OnEndSendCodeExplorerItems -= CodeExplorer.Instance.OnParseEndCodeExplorerItems; ParserHandler.OnEnd -= CodeExplorer.Instance.OnParseEnd; ProExecutionHandleCompilation.OnEachCompilationOk -= FilesInfo.ProExecutionHandleCompilationOnEachCompilationOk; // export modified conf FileTag.Export(); // save config (should be done but just in case) Config.Save(); // remember the most used keywords Keywords.Instance.SaveRanking(); // close every form FileExplorer.Instance.ForceClose(); CodeExplorer.Instance.ForceClose(); AutoCompletion.ForceClose(); InfoToolTip.ForceClose(); Appli.ForceClose(); UserCommunication.ForceClose(); AppliMenu.ForceClose(); } catch (Exception e) { ErrorHandler.ShowErrors(e, "Stop"); } }
/// <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); }
private void BtEnvListOnButtonPressed(object sender, EventArgs eventArgs) { AppliMenu.ShowEnvMenuAtCursor(); }
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); }
public DoDeployPage() { InitializeComponent(); // browse btBrowse.BackGrndImage = ImageResources.SelectFile; btBrowse.ButtonPressed += BtBrowseOnButtonPressed; tooltip.SetToolTip(btBrowse, "Click to <b>select</b> a folder"); // open btOpen.BackGrndImage = ImageResources.OpenInExplorer; btOpen.ButtonPressed += BtOpenOnButtonPressed; tooltip.SetToolTip(btOpen, "Click to <b>open</b> this folder in the explorer"); // historic btHistoric.BackGrndImage = ImageResources.Historic; btHistoric.ButtonPressed += BtHistoricOnButtonPressed; tooltip.SetToolTip(btHistoric, "Click to <b>browse</b> the previous folders"); if (string.IsNullOrEmpty(Config.Instance.CompileDirectoriesHistoric)) { btHistoric.Visible = false; } tooltip.SetToolTip(toggleRecurs, "Toggle this option on to explore recursively the selected folder<br>Toggle off and you will only compile/deploy the files directly under the selected folder"); tooltip.SetToolTip(toggleAutoUpdateSourceDir, "Automatically update the above directory when you switch environment<br>(it then takes the source directory of the environment)"); tooltip.SetToolTip(toggleMono, "Toggle on to only use a single process when compiling during the deployment<br>Obviously, this will slow down the process by a lot!<br>The only reason to use this option is if you want to limit the number of connections made to your database during compilation..."); tooltip.SetToolTip(toggleOnlyGenerateRcode, "Override the environment settings and only generated R-code during the deployement<br>(i.e. dont deploy debug-list or xref)"); tooltip.SetToolTip(fl_nbProcess, "This parameter is used when compiling multiple files, it determines how many<br>Prowin processes can be started to handle compilation<br>The total number of processes started is actually multiplied by your number of cores<br><br>Be aware that as you increase the number or processes for the compilation, you<br>decrease the potential time of compilation but you also increase the number of connection<br>needed to your database (if you have one defined!)<br>You might have an error on certain processes that can't connect to the database<br>if you try to increase this number too much<br><br><i>This value can't be superior to 15</i>"); // Open hook btOpenHook.BackGrndImage = ImageResources.Edit; btOpenHook.ButtonPressed += (sender, args) => { if (!File.Exists(Config.FileDeploymentHook)) { Utils.FileWriteAllBytes(Config.FileDeploymentHook, DataResources.DeploymentHook); } Npp.OpenFile(Config.FileDeploymentHook); }; // diretory from env btUndo.BackGrndImage = ImageResources.UndoUserAction; btUndo.ButtonPressed += BtUndoOnButtonPressed; tooltip.SetToolTip(btUndo, "Click to <b>select</b> the base local path (your source directory)<br>for the current environment"); // start btStart.BackGrndImage = ImageResources.Deploy; tooltip.SetToolTip(btStart, "Click to <b>start</b> deploying your application"); btStart.ButtonPressed += BtStartOnButtonPressed; // Test btTest.BackGrndImage = ImageResources.Tests; tooltip.SetToolTip(btTest, "Click to <b>test</b> the deployment your application (this is safe)"); btTest.ButtonPressed += BtTestOnButtonPressed; // cancel btCancel.BackGrndImage = ImageResources.Cancel; tooltip.SetToolTip(btCancel, "Click to <b>cancel</b> the current deployement"); btCancel.ButtonPressed += BtCancelOnButtonPressed; btCancel.Visible = false; // progress bar progressBar.Style = ProgressStyle.Normal; progressBar.CenterText = CenterElement.Text; progressBar.Visible = false; // report btReport.BackGrndImage = ImageResources.Report; btReport.Visible = false; btReport.ButtonPressed += BtReportOnButtonPressed; lbl_report.Visible = false; lbl_report.LinkClicked += Utils.OpenPathClickHandler; // reset btReset.BackGrndImage = ImageResources.Default; tooltip.SetToolTip(btReset, "Click to reset the options to their default values"); btReset.ButtonPressed += (sender, args) => { ResetFields(); }; // help kink linkurl.Text = @"<img src='Help'><a href='" + Config.UrlHelpDeploy + @"'>Learn more about this feature?</a>"; // switch link lblCurEnv.LinkClicked += (sender, args) => { AppliMenu.ShowEnvMenu(true); }; // save tooltip.SetToolTip(btSave, "Save the settings for the currently selected profile"); btSave.BackGrndImage = ImageResources.Save; btSave.ButtonPressed += (sender, args) => { if (string.IsNullOrEmpty(DeploymentProfile.Current.Name) && !ChooseName()) { return; } SetDataFromFields(); SaveProfilesList(); }; // save as... tooltip.SetToolTip(btSaveAs, "Save the settings in a new profile that you will name"); btSaveAs.BackGrndImage = ImageResources.Save; btSaveAs.ButtonPressed += (sender, args) => { var cur = DeploymentProfile.Current; DeploymentProfile.List.Add(new DeploymentProfile()); DeploymentProfile.Current = DeploymentProfile.List.Last(); if (ChooseName()) { SetDataFromFields(); SaveProfilesList(); } else { DeploymentProfile.List.RemoveAt(DeploymentProfile.List.Count - 1); DeploymentProfile.Current = cur; } btDelete.Visible = DeploymentProfile.List.Count > 1; }; // delete tooltip.SetToolTip(btDelete, "Delete the current profile"); btDelete.BackGrndImage = ImageResources.Delete; btDelete.ButtonPressed += (sender, args) => { if (UserCommunication.Message("Do you really want to delete this profile?", MessageImg.MsgQuestion, "Delete", "Deployment profile", new List <string> { "Yes", "Cancel" }) == 0) { DeploymentProfile.List.Remove(DeploymentProfile.Current); DeploymentProfile.Current = null; SaveProfilesList(); SetFieldsFromData(); if (DeploymentProfile.List.Count == 1) { btDelete.Hide(); } } }; // cb tooltip.SetToolTip(cbName, "Browse and select the available profiles, each profile hold deployment settings"); cbName.SelectedIndexChangedByUser += CbNameOnSelectedIndexChanged; // modify rules tooltip.SetToolTip(btRules, "Click to modify the rules"); btRules.BackGrndImage = ImageResources.Rules; btRules.ButtonPressed += (sender, args) => DeploymentRules.EditRules(); // view rules tooltip.SetToolTip(btRules, "Click to view the rules filtered for the current environment<br><i>The rules are also sorted!</i>"); btSeeRules.BackGrndImage = ImageResources.ViewFile; btSeeRules.ButtonPressed += (sender, args) => { UserCommunication.Message(DeploymentRules.BuildHtmlTableForRules(ProEnvironment.Current.Deployer.DeployRules), MessageImg.MsgInfo, "List of deployment rules", "Sorted and filtered for the current environment"); }; DeploymentProfile.OnDeployProfilesUpdate += () => { UpdateCombo(); SetFieldsFromData(); btDelete.Visible = DeploymentProfile.List.Count > 1; }; // subscribe ProEnvironment.OnEnvironmentChange += OnShow; DeploymentRules.OnDeployConfigurationUpdate += OnShow; // dynamically reorder the controls for a correct tab order on notepad++ SetTabOrder.RemoveAndAddForTabOrder(scrollPanel); }