示例#1
0
        public void GenerateSensibleArea(int startPos,int[] positions, ScintillaControl sci)
        {
            if (isMonitoring)
                DeactiveMonitorWords();

            //if (sci.CodePage == 65001 && startPos!=0)
            //{

            //    int strLen = Encoding.UTF8.GetByteCount(
            //        sci.Text.Substring(0,startPos)
            //        );
            //    startPos = strLen;
            //}

             //startPos = sci.MBSafePosition(startPos);
             WordRegionBase last=null;
               WordRegionBase wr=null;
            for (int i = 0; i < positions.Length; i+=2)
            {

                if (i == positions.Length-2)
                {
                    wr = new LastWordRegion();
                }
                else
                {
                    wr = new WordRegion();
                }

                wr.type = WordRegionBase.kind.place;

                wr.startWord = startPos + positions[i];
                wr.endWord = startPos + positions[i + 1];

                if (last != null)
                {
                    last.NextWord = wr;
                }

                last = wr;
                Words.Add(wr);
            }

            firstWord = Words[0];

            lastWord = wr;
            fileName = ASContext.Context.CurrentClass.Name;

            if (MonitorOnWordsActive != null)
                MonitorOnWordsActive(this);

            ActiveMonitorWords();

            MoveNextWord();
        }
示例#2
0
        public string MakeTextFromSnippet(ScintillaControl sci, AbbrevationSnippet abbrSnippet)
        {
            StringBuilder sbSnippet = new StringBuilder(abbrSnippet.Snippet);

            if (isMonitoring)
                DeactiveMonitorWords();

            if(abbrSnippet.HasImport)
            imports = new List<string>();
            if (abbrSnippet.HasEventHandler)
            eventsHandler = new List<int>();
            if (abbrSnippet.HasAfterCurrentMember)
            AfterCurrentMember = new List<string>();

            _dictCustomList = _setting.customList;

            int pos = sci.CurrentPos;
            int CodePage = sci.CodePage;

            string nl = ASCompletion.Completion.ASComplete.GetNewLineMarker(sci.EOLMode);
            int curLine = sci.LineFromPosition(pos);
            int startLine = sci.PositionFromLine(curLine);

            char ch = (char) sci.CharAt(startLine);
            string tabString = String.Empty;
            while ( Char.IsWhiteSpace( ch))
            {
                if(ch=='\n' || ch=='\r') break;
                tabString += ch;

                ch = (char)sci.CharAt(++startLine);
            }

             sbSnippet.Replace("\r","");
             sbSnippet.Replace("\n", nl + tabString);

             if (abbrSnippet.Arguments == null) return sbSnippet.ToString();

                previousLenPlace = 0;
                indexArgument = 0;
                numCursors = 0;

             MatchCollection mtc = _vocabularyArgument.regArguments.Matches(sbSnippet.ToString());
             int lenght = mtc.Count;
             Match m =null;
             Match var;

             string textClipBoard = "";
             int valueTextClipBoard = 0;

             char[] chars = null;
             int previousPos=0;
             for (int i = 0; i < lenght; i++)
             {
                  m = mtc[i];

                  /// if CodePage is 65001... pos= is position in scintilla text
                  /// and previousLen is position on abbrSnippet
                  if (indexArgument == abbrSnippet.Arguments.Length)
                  {
                      indexArgument = 0;

                          lsVar.Clear();

                  }

                  switch (abbrSnippet.Arguments[indexArgument])
                  {
                      #region Place
                      case WordTypes.place:
                          var = _vocabularyArgument.regPlace.Match(m.Value);
                          if (var.Success)
                          {
                              WordRegion wr = new WordRegion();

                              int correctPosString = m.Index - previousLenPlace;

                              int count = correctPosString - previousPos;
                              chars = new char[count];

                              sbSnippet.CopyTo(previousPos, chars, 0, count);
                              previousLenPlace += m.Length - var.Length;
                              sbSnippet.Remove(correctPosString, m.Length);
                              sbSnippet.Insert(correctPosString, var.Value);

                              previousPos = correctPosString + var.Length;

                              if (CodePage != 65001)
                              {
                                  wr.startWord = pos + chars.Length;
                                  wr.endWord = wr.startWord + var.Length;
                                  pos += chars.Length + var.Length;
                              }
                              else
                              {

                                  int strLen = Encoding.UTF8.GetByteCount(
                                      chars
                                      );
                                  int valueLen = Encoding.UTF8.GetByteCount(var.Value);
                                  wr.startWord = pos + strLen;
                                  wr.endWord = wr.startWord + valueLen;
                                  pos += strLen + valueLen;
                              }

                              wr.type = WordRegion.kind.place;

                              if (curWord != null)
                              {
                                  curWord.NextWord = wr;
                                  secondLastWord = curWord;
                              }

                              Words.Add(wr);

                              curWord = wr;
                              curIndWord++;
                              numCursors++;
                              indexArgument++;

                            //  sb.Append(var.Value);
                          }
                          break;
                      #endregion
                      #region cursor
                      case WordTypes.SafeZone:

                          if (m.Value == VocabularyArgument.SafeZone)
                          {
                              WordRegion wr = new WordRegion();
                              wr.type = WordRegionBase.kind.cursor;

                              //string previousTest = textSnippet.Substring(previousLenPlace, m.Index - previousLenPlace);
                              //sb.Append(previousTest);

                              int correctPosString = m.Index - previousLenPlace;

                              int count = correctPosString - previousPos;
                              chars = new char[count];

                              sbSnippet.CopyTo(previousPos, chars, 0, count);
                              previousLenPlace += m.Length;
                              sbSnippet.Remove(correctPosString, m.Length);

                              previousPos = correctPosString;

                              if (CodePage != 65001)
                              {
                                  wr.startWord = pos + chars.Length;
                                  wr.endWord = wr.startWord;
                                  pos += chars.Length;
                              }
                              else
                              {

                                  int strLen = Encoding.UTF8.GetByteCount(
                                      chars
                                      );
                                 // int valueLen = Encoding.UTF8.GetByteCount(var.Value);
                                  wr.startWord = pos + strLen;
                                  wr.endWord = wr.startWord ;
                                  pos += strLen ;
                              }

                              if (curWord != null)
                              {
                                  curWord.NextWord = wr;
                                  secondLastWord = curWord;
                              }

                              Words.Add(wr);
                              curWord = wr;
                              curIndWord++;
                              numCursors++;
                              indexArgument++;

                          }

                          break;
                      #endregion
                      #region createParameters
                      case WordTypes.createParameters:

                          if (m.Value == VocabularyArgument.CREATEPARAMATERS)
                          {
                              WordRegion wr = new WordRegion();
                              wr.type = WordRegionBase.kind.createParameters;

                              int correctPosString = m.Index - previousLenPlace;

                              int count = correctPosString - previousPos;
                              chars = new char[count];

                              sbSnippet.CopyTo(previousPos, chars, 0, count);
                              previousLenPlace += m.Length;
                              sbSnippet.Remove(correctPosString, m.Length);

                              previousPos = correctPosString;

                              if (CodePage != 65001)
                              {
                                  wr.startWord = pos + chars.Length;
                                  wr.endWord = wr.startWord;
                                  pos += chars.Length;
                              }
                              else
                              {

                                  int strLen = Encoding.UTF8.GetByteCount(
                                      chars
                                      );
                                  wr.startWord = pos + strLen;
                                  wr.endWord = wr.startWord;
                                  pos += strLen;
                              }

                              if (curWord != null)
                              {
                                  curWord.NextWord = wr;
                                  secondLastWord = curWord;
                              }

                              Words.Add(wr);
                              curWord = wr;
                              curIndWord++;
                              numCursors++;
                              indexArgument++;

                          }

                          break;
                      #endregion
                      #region clipboard
                      case WordTypes.Clipboard:
                          if (m.Value == VocabularyArgument.CLIPBOARD)
                          {

                              if (textClipBoard.Length==0)
                              {
                                  textClipBoard = System.Windows.Forms.Clipboard.GetText().Trim();
                                  valueTextClipBoard = Encoding.UTF8.GetByteCount(textClipBoard);
                              }

                              int correctPosString = m.Index - previousLenPlace;

                              previousLenPlace += m.Length - textClipBoard.Length;
                              sbSnippet.Remove(correctPosString, m.Length);
                              sbSnippet.Insert(correctPosString, textClipBoard);

                              if (CodePage != 65001)
                              {
                                  pos += chars.Length + textClipBoard.Length;
                              }
                              else
                              {

                                  int count = correctPosString - previousPos;
                                  chars = new char[count];
                                  sbSnippet.CopyTo(previousPos, chars, 0, count);
                                  int strLen = Encoding.UTF8.GetByteCount(
                                      chars
                                      );

                                  pos += strLen + valueTextClipBoard;
                              }

                              previousPos = correctPosString + textClipBoard.Length;

                              indexArgument++;

                          }

                          break;
                      #endregion
                      #region showcomp
                      case WordTypes.cmp:

                          var = _vocabularyArgument.regCompType.Match(m.Value);

                          //if (var.Value.Length!=0)
                          if(var.Success)
                          {
                              WordRegion wr = new WordRegion();
                              wr.type = WordRegion.kind.showCompType;

                              int correctPosString = m.Index - previousLenPlace;

                              int count = correctPosString - previousPos;
                              chars = new char[count];

                              sbSnippet.CopyTo(previousPos, chars, 0, count);
                              previousLenPlace += m.Length - var.Length;
                              sbSnippet.Remove(correctPosString, m.Length);
                              sbSnippet.Insert(correctPosString, var.Value);

                              previousPos = correctPosString + var.Length;

                              if (CodePage != 65001)
                              {
                                  wr.startWord = pos + chars.Length;
                                  wr.endWord = wr.startWord + var.Length;
                                  pos += chars.Length + var.Length;
                              }
                              else
                              {

                                  int strLen = Encoding.UTF8.GetByteCount(
                                      chars
                                      );
                                  int valueLen = Encoding.UTF8.GetByteCount(var.Value);
                                  wr.startWord = pos + strLen;
                                  wr.endWord = wr.startWord + valueLen;
                                  pos += strLen + valueLen;
                              }

                              if (curWord != null)
                              {
                                  curWord.NextWord = wr;
                                  secondLastWord = curWord;
                              }

                              Words.Add(wr);
                              curWord = wr;

                              curIndWord++;
                              numCursors++;
                              indexArgument++;

                          }

                          break;
                      #endregion
                      #region variable link
                      case WordTypes.var:

                          var = _vocabularyArgument.regVar.Match(m.Value);

                          if (var.Value.Length!=0)
                          {
                              VarWordRegion varRootWR = null;
                              VarDuplicateWordRegion vdwr = null;
                              VarWordRegion vwr = null;
                              WordRegionBase wr;

                              // there is a root?
                              if (lsVar.TryGetValue(var.Value, out varRootWR))
                              {
                                  vdwr = new VarDuplicateWordRegion();
                                  wr = vdwr;
                                  vdwr.type = WordRegionBase.kind.VarLink;
                              }
                              else
                              {

                                  vwr = new VarWordRegion();
                                  vwr.ValueVar = var.Value;
                                  curIndWord++;

                                  string option = m.Value.Substring(var.Index + var.Length);
                                  Match mc = _vocabularyArgument.regList.Match(option);

                                  if (mc.Value.Length!=0)
                                  {
                                      vwr.indList = mc.Value;
                                      vwr.type = WordRegionBase.kind.customList;
                                  }
                                  else if (option.IndexOf("showCmp") != -1)
                                      vwr.type = WordRegion.kind.VarLinkAndComp;
                                  else
                                      vwr.type = WordRegionBase.kind.VarLink;

                                  wr = vwr;

                                  vwr.ChangeVarWord += new VarWordRegion.ChangeVarEventHandler(vwr_ChangeVarWord);
                              }

                              //string previousTest = textSnippet.Substring(previousLenPlace, m.Index - previousLenPlace);
                              //sb.Append(previousTest);

                              // questo serve per cancellare index
                              int correctPosString = m.Index - previousLenPlace;

                              int count = correctPosString - previousPos;
                              chars = new char[count];

                              sbSnippet.CopyTo(previousPos, chars, 0, count);
                              previousLenPlace += m.Length - var.Length;
                              sbSnippet.Remove(correctPosString, m.Length);
                              sbSnippet.Insert(correctPosString, var.Value);

                              previousPos = correctPosString +  var.Length;

                              if (CodePage != 65001)
                              {
                                  wr.startWord = pos + chars.Length;
                                  wr.endWord = wr.startWord + var.Length;
                                  pos += chars.Length + var.Length;
                              }
                              else
                              {

                                  int strLen = Encoding.UTF8.GetByteCount(
                                      chars
                                      );
                                  int valueLen = Encoding.UTF8.GetByteCount(var.Value);
                                  wr.startWord = pos + strLen;
                                  wr.endWord = wr.startWord + valueLen;
                                  pos += strLen + valueLen;
                              }

                              if (curWord != null)
                              {
                                  curWord.NextWord = wr;
                                  secondLastWord = curWord;
                              }

                              curWord = wr;

                              if (varRootWR != null)
                              {
                                  varRootWR.InsertVarDuplicate(vdwr);
                                  //varRootWR.lstWords.Add(vdwr);
                              }
                              else
                              {
                                  lsVar.Add(var.Value, vwr);
                                  Words.Add(wr);
                              }
                              indexArgument++;

                              numCursors++;

                           //   sb.Append(var.Value);
                          }

                          break;
                      #endregion
                      #region mbrname
                      case WordTypes.mbrname:
                          if (m.Value == VocabularyArgument.MbrName)
                          {

                              string strMbrName = "";

                              if (ASContext.Context.CurrentMember != null)
                              {
                                  strMbrName = ASContext.Context.CurrentMember.Name;
                              }

                              int correctPosString = m.Index - previousLenPlace;

                              previousLenPlace += m.Length - strMbrName.Length;
                              sbSnippet.Remove(correctPosString, m.Length);
                              sbSnippet.Insert(correctPosString, strMbrName);

                              if (CodePage != 65001)
                              {
                                  pos += chars.Length + strMbrName.Length;
                              }
                              else
                              {

                                  int count = correctPosString - previousPos;
                                  chars = new char[count];
                                  sbSnippet.CopyTo(previousPos, chars, 0, count);
                                  int strLen = Encoding.UTF8.GetByteCount(
                                      chars
                                      );

                                  pos += strLen + strMbrName.Length;
                              }

                              previousPos = correctPosString + strMbrName.Length;

                              indexArgument++;
                          }
                          break;
                      #endregion
                      #region "Browser"
                      case WordTypes.browser:
                          // --------------  browser
                          if (m.Value == VocabularyArgument.BROWSER)
                          {
                              WordRegion wr = new WordRegion();
                              wr.type = WordRegion.kind.browser;

                              int correctPosString = m.Index - previousLenPlace;

                              int count = correctPosString - previousPos;
                              chars = new char[count];

                              sbSnippet.CopyTo(previousPos, chars, 0, count);
                              previousLenPlace += m.Length;
                              sbSnippet.Remove(correctPosString, m.Length);

                              previousPos = correctPosString;

                              if (CodePage != 65001)
                              {
                                  wr.startWord = pos + chars.Length;
                                  wr.endWord = wr.startWord;
                                  pos += chars.Length;
                              }
                              else
                              {

                                  int strLen = Encoding.UTF8.GetByteCount(
                                      chars
                                      );
                                  wr.startWord = pos + strLen;
                                  wr.endWord = wr.startWord;
                                  pos += strLen ;
                              }

                              //  wr.lineNumber = lineNumber;

                              if (curWord != null)
                              {
                                  curWord.NextWord = wr;
                                  secondLastWord = curWord;
                              }

                              Words.Add(wr);
                              curWord = wr;
                              curIndWord++;
                              //  wr.index = curIndWord;
                              numCursors++;
                              indexArgument++;

                          }
                          break;
                      #endregion
                      #region AfterCurrentMember
                      case WordTypes.AfterCurrentMember:

                          var = _vocabularyArgument.regAfterCurrentMember.Match(m.Value);
                          if (var.Value.Length!=0)
                          {

                              if (ASContext.Context.CurrentMember != null)
                              {
                                  if (!AfterCurrentMember.Contains(var.Value))
                                  {
                                      AfterCurrentMember.Add(var.Value);
                                      dontCreateLastWord = true;
                                  }
                                  //strMbrName = ASContext.Context.CurrentMember.Name;
                              }

                              int correctPosString = m.Index - previousLenPlace;

                              int count = correctPosString - previousPos;
                              chars = new char[count];

                              sbSnippet.CopyTo(previousPos, chars, 0, count);
                              previousLenPlace += m.Length;
                              sbSnippet.Remove(correctPosString, m.Length);

                              previousPos = correctPosString;

                              if (CodePage != 65001)
                              {

                                  pos += chars.Length;
                              }
                              else
                              {
                                  int strLen = Encoding.UTF8.GetByteCount(
                                      chars
                                      );

                                  pos += strLen;
                              }

                              indexArgument++;

                          }
                          break;
                      #endregion
                      #region Custom list
                      case WordTypes.list:
                          //-------- CUSTOM LIST COMPLETITION

                          var = _vocabularyArgument.regList.Match(m.Value);

                          if (var.Value.Length!=0)
                          {
                              WordCustomList wr = new WordCustomList();
                              wr.type = WordRegion.kind.customList;
                              string value = "";
                              List<string> ls;
                              if (_dictCustomList.TryGetValue(var.Value, out ls))
                              {

                                  if(ls.Count>0)
                                  value = ls[0];
                              }

                              int correctPosString = m.Index - previousLenPlace;

                              int count = correctPosString - previousPos;
                              chars = new char[count];

                              sbSnippet.CopyTo(previousPos, chars, 0, count);
                              previousLenPlace += m.Length - value.Length;
                              sbSnippet.Remove(correctPosString, m.Length);
                              sbSnippet.Insert(correctPosString, value);

                              previousPos = correctPosString + value.Length;

                              if (CodePage != 65001)
                              {
                                  wr.startWord = pos + chars.Length;
                                  wr.endWord = wr.startWord + value.Length;
                                  pos += chars.Length + value.Length;
                              }
                              else
                              {

                                  int strLen = Encoding.UTF8.GetByteCount(
                                      chars
                                      );
                                  int valueLen = Encoding.UTF8.GetByteCount(value);
                                  wr.startWord = pos + strLen;
                                  wr.endWord = wr.startWord + valueLen;
                                  pos += strLen + valueLen;
                              }

                              //  wr.lineNumber = lineNumber;
                              wr.indList = var.Value;
                              if (curWord != null)
                              {
                                  curWord.NextWord = wr;
                                  secondLastWord = curWord;
                              }

                              Words.Add(wr);
                              curWord = wr;
                              curIndWord++;
                              //   wr.index = curIndWord;
                              numCursors++;
                              indexArgument++;

                          }

                          break;
                      #endregion
                      #region import
                      case WordTypes.import:
                          var = _vocabularyArgument.regImport.Match(m.Value);

                          if (var.Value.Length!=0)
                          {

                              int correctPosString = m.Index - previousLenPlace;

                              previousLenPlace += m.Length - var.Length;
                              sbSnippet.Remove(correctPosString, m.Length);
                              sbSnippet.Insert(correctPosString, var.Value);

                              if (CodePage != 65001)
                              {
                                  pos += chars.Length + var.Length;
                              }
                              else
                              {

                                  int count = correctPosString - previousPos + var.Value.Length;
                                  chars = new char[count];
                                  sbSnippet.CopyTo(previousPos, chars, 0, count);
                                  int strLen = Encoding.UTF8.GetByteCount(
                                      chars
                                      );

                                  pos += strLen ;
                              }

                              previousPos = correctPosString + var.Length;

                              if (!imports.Contains(var.Value))
                                  imports.Add(var.Value);

                              indexArgument++;

                          }
                          break;
                      #endregion
                      #region EventHandler
                      case WordTypes.EventHandler:
                          var = _vocabularyArgument.regEventHandler.Match(m.Value);

                          if (var.Value.Length!=0)
                          {

                              int correctPosString = m.Index - previousLenPlace;

                              previousLenPlace += m.Length - var.Length;
                              sbSnippet.Remove(correctPosString, m.Length);
                              sbSnippet.Insert(correctPosString, var.Value);

                              if (CodePage != 65001)
                              {
                                  pos += chars.Length + var.Length;
                              }
                              else
                              {

                                  int count = correctPosString - previousPos + var.Value.Length;
                                  chars = new char[count];
                                  sbSnippet.CopyTo(previousPos, chars, 0, count);
                                  int strLen = Encoding.UTF8.GetByteCount(
                                      chars
                                      );

                                  pos += strLen;

                              }
                              eventsHandler.Add(pos);
                              previousPos = correctPosString + var.Length;

                              indexArgument++;

                          }
                          break;
                      #endregion
                  }

             }

            if (!dontCreateLastWord)
            ConvertLastWord();

            return sbSnippet.ToString();
        }
示例#3
0
        public void CreateTemporaryVar()
        {
            sciMonitor = ASContext.CurSciControl;

            if (Words.Count == 0)
            {
                LastWordRegion wb = new LastWordRegion();
                wb.startWord = wb.endWord = sciMonitor.CurrentPos;
                Words.Add(wb);
                firstWord = wb;
                numCursors = 1;
            }

                declarationWord = new WordRegion();

                sciMonitor.TextInserted += new TextInsertedHandler(insertTemporaryText);
                sciMonitor.TextDeleted += new TextDeletedHandler(deleteTemporaryText);
            // it became firstword in the list

                declarationWord.startWord = declarationWord.endWord = firstWord.startWord;
                declarationWord.NextWord = firstWord;
                firstWord = declarationWord;
        }
示例#4
0
        public void Dispose()
        {
            if (declarationWord != null)
            {
                declarationWord.Dispose();
                declarationWord = null;
            }
            _vocabularyArgument = null;

            if (sciMonitor != null)
            {
                DeactiveMonitorWords();
            }

            _setting = null;

            if (Words == null ) return;

            foreach (WordRegion item in Words)
            {
                item.Dispose();
            }

            if (highlightWord != null)
            {
                highlightWord.Stop();
                highlightWord.Dispose();
                highlightWord = null;

            }

            Words.Clear();

            Words = null;
            imports = null;

            AfterCurrentMember = null;
        }
示例#5
0
        void sciMonitor_TextInserted(ScintillaControl sender, int position, int length, int linesAdded)
        {
            if (linesAdded > 0)
            {

                // Control import/declaration generator

                    if (length > 4)
                    {

                        // only a unique temporary world

                        string strControl = sciMonitor.GetLine(sciMonitor.LineFromPosition(position));
                        // is a snippet ,FlashDevelop has generated code

                        int indexImport = -1;

                        // FlashDevelop generate snippet
                        if (strControl.IndexOf("$(Boundary)") == -1 && (indexImport= strControl.IndexOf("import")) == -1)
                        {
                            DeactiveMonitorWords();
                            return;
                        }

                        WordRegion newStatmentWord = new WordRegion();

                            newStatmentWord.endWord = newStatmentWord.startWord = position;
                        // is import
                            if (indexImport != -1)
                            {
                                newStatmentWord.type = WordRegionBase.kind.Import;

                                if (importWord != null)
                                    RemoveDeclarationWord(sender, importWord);

                                importWord = newStatmentWord;

                            }
                            else
                            {

                                newStatmentWord.type = WordRegion.kind.temporary;
                                if (declarationWord != null)
                                    RemoveDeclarationWord(sender, declarationWord);

                                declarationWord = newStatmentWord;
                            }

                            newStatmentWord.NextWord = firstWord;
                            firstWord = newStatmentWord;

                            sender.TextInserted += new TextInsertedHandler(DeclarationWordTextChange);
                            sender.TextDeleted += new TextDeletedHandler(DeclarationWordTextChange);

                            if (indexImport == -1)
                            {
                                int posInsert = curIndWord;
                                if (posInsert >= Words.Count)
                                { posInsert = Words.Count - 1; }
                                else if (posInsert < 0) posInsert = 0;

                                Words.Insert(posInsert, newStatmentWord);
                            }

                            wrTested = newStatmentWord;
                            newStatmentWord.addCharactersToRegion(length);

                            if (highlightWord != null)
                            {
                                highlightWord.Stop();
                                highlightWord.Start();
                            }

                            return;

                    }

                    DeactiveMonitorWords();
                    return;

            }

            // Write before abbreviation
            if (position > lastWord.endWord) { DeactiveMonitorWords(); return; }

            WordsInsertChange(position, length);

            if (highlightWord != null)
            {
                highlightWord.Stop();
                highlightWord.Start();
            }
        }
示例#6
0
 private void RemoveDeclarationWord(ScintillaControl sender, WordRegion wordToDelete)
 {
     firstWord = wordToDelete.NextWord;
     if (wordToDelete.type != WordRegionBase.kind.Import)
         Words.Remove(wordToDelete);
     wordToDelete.NextWord = null;
     wordToDelete = null;
     sender.TextInserted -= new TextInsertedHandler(DeclarationWordTextChange);
     sender.TextDeleted -= new TextDeletedHandler(DeclarationWordTextChange);
 }
示例#7
0
        void DeclarationWordTextChange(ScintillaControl sender, int position, int length, int linesAdded)
        {
            if(wrTested!=null && isMonitoring)
            if ( wrTested.type != WordRegionBase.kind.Import)
                {
                    if (importWord != null)
                    {
                        RemoveDeclarationWord(sender, importWord);

                        importWord = null;
                        if (isList>-1)
                        {
                            //curIndWord--;
                            curIndWord = isList;
                           // MoveNextWord();
                        }
                    }

                    if (declarationWord != null && wrTested.type!= WordRegionBase.kind.temporary)
                    {
                        RemoveDeclarationWord(sender, declarationWord);
                        declarationWord = null;
                    }
                }
        }
示例#8
0
        private void DeactiveMonitorWords()
        {
            if (isList>-1)
            {
                CompletionList.OnInsert -= new InsertedTextHandler(CompletionList_OnInsert);
                isList = -1;
            }

            if (highlightWord != null)
            {
                QuickGenerator.CustomCompletionList.ExplorerProject.RemoveHighlights(sciMonitor);
                highlightWord.Stop();

                if (!_setting._showHighLight)
                {
                    highlightWord.Tick -= new EventHandler(highlightWord_Tick);
                    highlightWord = null;
                }
            }

            alreadyInvoke = false;

            ASContext.CommonSettings.DisableCodeReformat = reformater;

            if (declarationWord != null)
            {
                sciMonitor.TextInserted -= new TextInsertedHandler(DeclarationWordTextChange);
                sciMonitor.TextDeleted -= new TextDeletedHandler(DeclarationWordTextChange);
                declarationWord.NextWord = null;
                declarationWord = null;
            }

            if (importWord != null)
            {
                sciMonitor.TextInserted -= new TextInsertedHandler(DeclarationWordTextChange);
                sciMonitor.TextDeleted -= new TextDeletedHandler(DeclarationWordTextChange);
                importWord.NextWord = null;
                importWord = null;
            }

            if (sciMonitor != null)
            {

                sciMonitor.TextInserted -= new TextInsertedHandler(sciMonitor_TextInserted);
                sciMonitor.TextDeleted -= new TextDeletedHandler(sciMonitor_TextDeleted);
                sciMonitor.CharAdded -= new CharAddedHandler(sciMonitor_CharAdded);
                sciMonitor.FocusChanged -= new FocusHandler(sciMonitor_FocusChanged);
            //    sciMonitor.FocusChanged -= new FocusHandler(sciMonitor_FocusChanged);

                sciMonitor = null;

            }
            //if (tmChangeWordText != null)
            //{
            //    tmChangeWordText.Stop();
            //    tmChangeWordText.Tick -= new EventHandler(tmChangeWordText_Tick);
            //    tmChangeWordText = null;
            //}

            lastWord = null;
            curWord = null;
            secondLastWord = null;

            WordRegionBase wb = firstWord;

            WordRegionBase disp = null;

            while (wb != null)
            {

                disp = wb;
                wb = wb.NextWord;
                disp.Dispose();
            }

            Words.Clear();

            if(imports!=null)
            imports.Clear();
            if (eventsHandler != null)
            eventsHandler.Clear();

            if (AfterCurrentMember != null)
            AfterCurrentMember.Clear();

            lsVar.Clear();
            isMonitoring = false;
            firstWord = null;

            numCursors = 0;

            curIndWord = -1;

            if(currentForm!=null)
            {
                currentForm.FormClosed -= new System.Windows.Forms.FormClosedEventHandler(currentForm_FormClosed);
                currentForm=null;
            }
            if (MonitorOnWordsDeactive != null)
                MonitorOnWordsDeactive(this);
            return;
        }
示例#9
0
        public void RemoveTemporaryVar()
        {
            if (declarationWord != null)
            {
                firstWord = declarationWord.NextWord;
                sciMonitor.TextInserted -= new TextInsertedHandler(insertTemporaryText);
                sciMonitor.TextDeleted -= new TextDeletedHandler(deleteTemporaryText);
                declarationWord.Dispose();
                declarationWord = null;

            }
        }