private void buttonExpandRetract_Click(YamuiButtonImage sender, EventArgs e) { if (_isExpanded) { yamuiList.ForceAllToCollapse(); } else { yamuiList.ForceAllToExpand(); } _isExpanded = !_isExpanded; filterbox.ExtraButtonsList[1].BackGrndImage = _isExpanded ? ImageResources.Collapse : ImageResources.Expand; Sci.GrabFocus(); }
/// <summary> /// Switch to a document, can be already opened or not, can decide to remember the current position to jump back to it /// </summary> public static void Goto(string document, int position, int line, int column, bool saveHistoric) { if (!File.Exists(document)) { UserCommunication.Notify(@"Can't find/open the following file :<br>" + document, MessageImg.MsgHighImportance, "Warning", "File not found", 5); return; } if (saveHistoric) { _goToHistory.Push(new Tuple <string, int, Point>(CurrentFileInfo.Path, Sci.FirstVisibleLine, Sci.CurrentPoint)); } if (!String.IsNullOrEmpty(document) && !document.Equals(CurrentFileInfo.Path)) { if (GetOpenedFiles.Contains(document)) { SwitchToDocument(document); } else { OpenFile(document); } } if (position >= 0) { Sci.GoToLine(Sci.LineFromPosition(position)); Sci.SetSel(position); } else if (line >= 0) { Sci.GoToLine(line); if (column >= 0) { Sci.SetSel(Sci.GetPosFromLineColumn(line, column)); } else { Sci.SetSel(Sci.GetLine(line).Position); } } Sci.GrabFocus(); Plug.OnUpdateSelection(); }
internal static void DoPlugStart() { if (OnPlugReady != null) { OnPlugReady(); } ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; // subscribe 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.OnStart += CodeExplorer.Instance.OnStart; ParserHandler.OnEndSendCompletionItems += AutoCompletion.SetDynamicItems; ParserHandler.OnEndSendParserItems += CodeExplorer.Instance.OnParseEndParserItems; ParserHandler.OnEndSendParserItems += SyntaxFolding.OnParseEndParserItems; ParserHandler.OnEndSendCodeExplorerItems += CodeExplorer.Instance.OnParseEndCodeExplorerItems; ParserHandler.OnEnd += CodeExplorer.Instance.OnParseEnd; ProExecutionHandleCompilation.OnEachCompilationOk += OpenedFilesInfo.ProExecutionHandleCompilationOnEachCompilationOk; // Clear the %temp% directory if we didn't do it properly last time Utils.DeleteDirectory(Config.FolderTemp, true); //Snippets.Init(); FileCustomInfo.Import(); DelayedAction.StartNew(100, () => { if (Config.Instance.InstallStep == 0) { Config.Instance.InstallStep++; // we are at the first notepad++ start Npp.ConfXml.FinishPluginInstall(); // will apply npp options and restart npp return; } if (Config.Instance.InstallStep == 1) { Config.Instance.InstallStep++; // global options applied, we are at the second startup UserCommunication.NotifyUnique("welcome", "Thank you for installing 3P, you are awesome!<br><br>If this is your first look at 3P you should probably read the <b>getting started</b> section of the home page by clicking " + "go".ToHtmlLink("on this link right here") + ".<br><br><div align='right'>And as always... Enjoy!</div>", MessageImg.MsgInfo, "Fresh install", "Hello and welcome aboard!", args => { Appli.ToggleView(); UserCommunication.CloseUniqueNotif("welcome"); args.Handled = true; }); } else if (!Config.Instance.NppStoppedCorrectly) { // Npp didn't stop correctly, if the backup mode is activated, inform the user if (Npp.ConfXml.BackupMode > 0) { UserCommunication.Notify("It seems that notepad++ didn't stop correctly.<br>If you lost some modifications, don't forget that you have a backup folder here :<br><br><div>" + Npp.ConfXml.BackupDirectory.ToHtmlLink() + "</div>" + (Npp.ConfXml.BackupUseCustomDir ? "<div>" + Npp.ConfXml.CustomBackupDirectory.ToHtmlLink() + "</div>" : ""), MessageImg.MsgInfo, "Notepad++ crashed", "Backup folder location"); } } Config.Instance.NppStoppedCorrectly = false; // check if an update was done and start checking for new updates Updater <MainUpdaterWrapper> .Instance.CheckForUpdateDoneAndStartCheckingForUpdates(); if (Updater <ProlintUpdaterWrapper> .Instance.LocalVersion.IsHigherVersionThan("v0")) { Updater <ProlintUpdaterWrapper> .Instance.StartCheckingForUpdate(); } if (Updater <ProparseUpdaterWrapper> .Instance.LocalVersion.IsHigherVersionThan("v0")) { Updater <ProparseUpdaterWrapper> .Instance.StartCheckingForUpdate(); } // Try to update the configuration from the distant shared folder ShareExportConf.StartCheckingForUpdates(); }); // check if npp version is meeting current recommended version if (!string.IsNullOrEmpty(Npp.SoftwareStringVersion) && !Npp.SoftwareStringVersion.IsHigherOrEqualVersionThan(Config.RequiredNppVersion)) { if (!Config.Instance.NppOutdatedVersion) { UserCommunication.Notify("This version of 3P has been developed for Notepad++ " + Config.RequiredNppVersion + ", your version (" + Npp.SoftwareStringVersion + ") is outdated.<br><br>Using an outdated version, you might encounter bugs that would not occur otherwise.<br>Try to update your version of Notepad++ as soon as possible, or use 3P at your own risks.<br><br><a href='https://notepad-plus-plus.org/download/'>Download the latest version of Notepad++ here</a>", MessageImg.MsgHighImportance, "Outdated version", "3P requirements are not met"); Config.Instance.NppOutdatedVersion = true; } } else { Config.Instance.NppOutdatedVersion = false; } // ReSharper disable once ObjectCreationAsStatement RecurentAction.StartNew(User.Ping, 1000 * 60 * 120); // Make sure to give the focus to scintilla on startup Sci.GrabFocus(); DelayedAction.StartNew(1000, Config.Save); }
/// <summary> /// Gives focus back to the owner window /// </summary> public void GiveFocusBack() { //WinApi.SetForegroundWindow(CurrentForegroundWindow); Sci.GrabFocus(); }
private void BtClearAllErrorsOnButtonPressed(object sender, EventArgs buttonPressedEventArgs) { FilesInfo.ClearAllErrors(Npp.CurrentFile.Path); Sci.GrabFocus(); }