public static void DoNppDocumentSwitched(bool initiating = false) { // update current file info IsPreviousFileProgress = IsCurrentFileProgress; IsCurrentFileProgress = Abl.IsCurrentProgressFile; CurrentFilePath = Npp.GetCurrentFilePath(); CurrentFileObject = FilesInfo.GetFileInfo(CurrentFilePath); // accept advanced notifications only if the current file is a progress file CurrentFileAllowed = IsCurrentFileProgress; // update current scintilla Npp.UpdateScintilla(); // Apply options to npp and scintilla depending if we are on a progress file or not ApplyOptionsForScintilla(); // close popups.. ClosePopups(); // Update info on the current file FilesInfo.UpdateErrorsInScintilla(); // refresh file explorer currently opened file FileExplorer.RedrawFileExplorerList(); if (!initiating) { if (Config.Instance.CodeExplorerAutoHideOnNonProgressFile) { CodeExplorer.Toggle(IsCurrentFileProgress); } if (Config.Instance.FileExplorerAutoHideOnNonProgressFile) { FileExplorer.Toggle(IsCurrentFileProgress); } } else { // make sure to use the ProEnvironment and colorize the error counter FilesInfo.UpdateFileStatus(); ProEnvironment.Current.ReComputeProPath(); } if (IsCurrentFileProgress) { // Need to compute the propath again, because we take into account relative path ProEnvironment.Current.ReComputeProPath(); // rebuild lines info (MANDATORY) Npp.RebuildLinesInfo(); } // Parse the document ParserHandler.ParseCurrentDocument(true); // publish the event if (OnDocumentChangedEnd != null) { OnDocumentChangedEnd(); } }
/// <summary> /// Called on npp ready /// </summary> internal static bool DoNppReady() { try { // need to set some values in the yamuiThemeManager ThemeManager.OnStartUp(); // init an empty form, this gives us a Form to hook onto if we want to do stuff on the UI thread // from a back groundthread with BeginInvoke() // once this method is done, we are able to publish notifications UserCommunication.Init(); // if the UDL is not installed if (!Style.InstallUdl(true)) { Style.InstallUdl(); } else { // first use message? if (Config.Instance.UserFirstUse) { UserCommunication.NotifyUnique("welcome", "<div>Dear user,<br><br>Thank you for installing 3P, you are awesome!<br><br>If this is your first look at 3P I invite you to read the <b>Getting started</b> section of the home page by clicking <a href='go'>on this link right here</a>.<br><br></div><div align='right'>Enjoy!</div>", MessageImg.MsgInfo, "Information", "Hello and welcome aboard!", args => { Appli.ToggleView(); UserCommunication.CloseUniqueNotif("welcome"); args.Handled = true; }); Config.Instance.UserFirstUse = false; } } // check Npp version, 3P requires version 6.8 or higher if (!String.IsNullOrEmpty(Npp.GetNppVersion) && !Npp.GetNppVersion.IsHigherVersionThan("6.7")) { UserCommunication.Notify("Dear user,<br><br>Your version of notepad++ (" + Npp.GetNppVersion + ") is outdated.<br>3P <b>requires</b> the version <b>6.8</b> or above, <b>there are known issues with inferior versions</b>. Please upgrade to an up-to-date version of Notepad++ or use 3P at your own risks.<br><br><a href='https://notepad-plus-plus.org/download/'>Download the lastest version of Notepad++ here</a>", MessageImg.MsgError, "Outdated version", "3P requirements are not met"); } // Check if an update has been done and start checking for new updates UpdateHandler.CheckForUpdateDone(); UpdateHandler.StartCheckingForUpdate(); // async // Try to update the configuration from the distant shared folder ShareExportConf.StartCheckingForUpdates(); // ReSharper disable once ObjectCreationAsStatement new ReccurentAction(User.Ping, 1000 * 60 * 120); // code explorer if (Config.Instance.CodeExplorerAutoHideOnNonProgressFile) { CodeExplorer.Toggle(Abl.IsCurrentProgressFile); } else if (Config.Instance.CodeExplorerVisible) { CodeExplorer.Toggle(); } // File explorer if (Config.Instance.FileExplorerAutoHideOnNonProgressFile) { FileExplorer.Toggle(Abl.IsCurrentProgressFile); } else if (Config.Instance.FileExplorerVisible) { FileExplorer.Toggle(); } return(true); } catch (Exception e) { ErrorHandler.ShowErrors(e, "Plugin startup"); } return(false); }