예제 #1
0
 /// <summary>
 /// Extends OnDwellStart to provide DwellOnIdentifier event
 /// </summary>
 /// <param name="e"></param>
 protected override void OnDwellStart(DwellEventArgs e) {
     bool isDebug = false;
     System.Diagnostics.Debug.Assert(isDebug = true);
     if (DwellOnIdentifier != null || isDebug) {
         var index = CharPositionFromPointClose(e.X, e.Y);
         if (index >= 0) {
             if (isDebug) System.Diagnostics.Debug.Print("Lexer style @{0}: {1}", index, GetStyleAt(index));
             if (DwellOnIdentifier == null) return;
             string identifier = null;
             var identifierRange = default(CharacterRange);
             var visibleRange = default(CharacterRange);
             string visibleText = null;
             if (index >= 0) identifier = FindIdentifierAt(index, out identifierRange, out visibleRange, out visibleText);
             if (identifier != null) {
                 var eventArgs = new DwellOnIdentifierEventArgs(identifier, identifierRange, visibleRange, visibleText);
                 OnDwellOnIdentifier(eventArgs);
                 if (!String.IsNullOrEmpty(eventArgs.CallTipText))
                     CallTipShow(identifierRange.First, eventArgs.CallTipText);
                 else CallTipCancel();
             } else CallTipCancel();
         } else CallTipCancel();
     }
     base.OnDwellStart(e);
 }
예제 #2
0
  /// <summary>
  /// Quick test of new DwellOnIdentifier event
  /// </summary>
  /// <param name="sender"></param>
  /// <param name="e"></param>
  private void Ed_DwellOnIdentifier(object sender, DwellOnIdentifierEventArgs e) {
      e.CallTipText = String.Format(
          "Identifier: {0}\r\nIndex: {1}\r\nLength: {2}",
          e.Identifier, e.IdentifierRange.First, e.IdentifierRange.Length
      );
      var s = sender as CodeEditor;
 }
예제 #3
0
 /// <summary>
 /// Provides DwellOnIdentifier event
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnDwellOnIdentifier(DwellOnIdentifierEventArgs e) {
     if (DwellOnIdentifier != null) DwellOnIdentifier.Invoke(this, e);
 }