예제 #1
0
 /// <summary>
 /// Called from CTRL + Space shortcut
 /// </summary>
 public static void OnShowCompleteSuggestionList()
 {
     ParserHandler.ParseDocumentNow();
     _openedFromShortCut     = true;
     _openedFromShortcutLine = Sci.Line.CurrentLine;
     _shownPosition          = Sci.CurrentPosition;
     UpdateAutocompletion();
 }
예제 #2
0
 private void ButtonFromIncludeOnButtonPressed(YamuiButtonImage sender, EventArgs e)
 {
     // change option and image
     Config.Instance.CodeExplorerDisplayItemsFromInclude = !Config.Instance.CodeExplorerDisplayItemsFromInclude;
     filterbox.ExtraButtonsList[4].UseGreyScale          = !Config.Instance.CodeExplorerDisplayItemsFromInclude;
     // Parse the document
     ParserHandler.ParseDocumentNow();
     Sci.GrabFocus();
 }
예제 #3
0
 private void buttonSort_Click(YamuiButtonImage sender, EventArgs e)
 {
     Config.Instance.CodeExplorerSortingType++;
     if (Config.Instance.CodeExplorerSortingType > SortingType.Alphabetical)
     {
         Config.Instance.CodeExplorerSortingType = SortingType.NaturalOrder;
     }
     filterbox.ExtraButtonsList[2].BackGrndImage = Config.Instance.CodeExplorerSortingType == SortingType.Alphabetical ? ImageResources.Alphabetical_sorting : ImageResources.Numerical_sorting;
     ParserHandler.ParseDocumentNow();
     Sci.GrabFocus();
 }
예제 #4
0
 private void buttonRefresh_Click(YamuiButtonImage sender, EventArgs e)
 {
     if (Refreshing)
     {
         return;
     }
     ParserHandler.ClearStaticData();
     Npp.CurrentSci.Lines.Reset();
     ParserHandler.ParseDocumentNow();
     Sci.GrabFocus();
 }
예제 #5
0
        /// <summary>
        /// Called when the user switches tab document
        /// You can use Npp.CurrentFile and Npp.PreviousFile in this method
        /// </summary>
        public static void DoNppBufferActivated(bool initiating = false)
        {
            // Apply options to npp and scintilla depending if we are on a progress file or not
            ApplyOptionsForScintilla();

            // if the file has just been opened
            if (!_openedFileList.Contains(Npp.CurrentFileInfo.Path))
            {
                _openedFileList.Add(Npp.CurrentFileInfo.Path);

                // need to auto change encoding?
                if (Config.Instance.AutoSwitchEncodingTo != NppEncodingFormat._Automatic_default && !string.IsNullOrEmpty(Config.Instance.AutoSwitchEncodingForFilePatterns))
                {
                    if (Npp.CurrentFileInfo.Path.TestAgainstListOfPatterns(Config.Instance.AutoSwitchEncodingForFilePatterns))
                    {
                        NppMenuCmd cmd;
                        if (Enum.TryParse(((int)Config.Instance.AutoSwitchEncodingTo).ToString(), true, out cmd))
                        {
                            Npp.RunCommand(cmd);
                        }
                    }
                }
            }

            // activate show space for conf files / deactivate if coming from a conf file
            if (ShareExportConf.IsFileExportedConf(Npp.PreviousFileInfo.Path))
            {
                if (Sci.ViewWhitespace != WhitespaceMode.Invisible && !Sci.ViewEol)
                {
                    Sci.ViewWhitespace = _whitespaceMode;
                }
            }
            if (ShareExportConf.IsFileExportedConf(Npp.CurrentFileInfo.Path))
            {
                Sci.ViewWhitespace = WhitespaceMode.VisibleAlways;
            }

            // close popups..
            ClosePopups();

            if (initiating)
            {
                // make sure to use the ProEnvironment and colorize the error counter
                OpenedFilesInfo.UpdateFileStatus();
            }
            else
            {
                if (Config.Instance.CodeExplorerAutoHideOnNonProgressFile)
                {
                    CodeExplorer.Instance.Toggle(Npp.CurrentFileInfo.IsProgress);
                }
                if (Config.Instance.FileExplorerAutoHideOnNonProgressFile)
                {
                    FileExplorer.Instance.Toggle(Npp.CurrentFileInfo.IsProgress);
                }
            }

            // Update info on the current file
            OpenedFilesInfo.UpdateErrorsInScintilla();
            ProEnvironment.Current.ReComputeProPath();

            AutoCompletion.SetStaticItems();

            // Parse the document
            ParserHandler.ParseDocumentNow();

            // publish the event
            if (OnDocumentChangedEnd != null)
            {
                OnDocumentChangedEnd();
            }
        }