コード例 #1
0
        void OnToolTipRequest(object sender, TextEditor.ToolTipRequestEventArgs e)
        {
            if (e.InDocument && !e.ToolTipShown)
            {
                IExpressionFinder expressionFinder;
                if (MainForm.IsVisualBasic)
                {
                    expressionFinder = new VBExpressionFinder();
                }
                else
                {
                    expressionFinder = new CSharpExpressionFinder(mainForm.parseInformation);
                }
                ExpressionResult expression = expressionFinder.FindFullExpression(
                    editor.Text,
                    editor.Document.PositionToOffset(e.LogicalPosition));
                if (expression.Region.IsEmpty)
                {
                    expression.Region = new DomRegion(e.LogicalPosition.Line + 1, e.LogicalPosition.Column + 1);
                }

                TextEditor.TextArea textArea = editor.ActiveTextAreaControl.TextArea;
                NRefactoryResolver  resolver = new NRefactoryResolver(mainForm.myProjectContent.Language);
                ResolveResult       rr       = resolver.Resolve(expression,
                                                                mainForm.parseInformation,
                                                                textArea.MotherTextEditorControl.Text);
                string toolTipText = GetText(rr);
                if (toolTipText != null)
                {
                    e.ShowToolTip(toolTipText);
                }
            }
        }
コード例 #2
0
        private void OnToolTipRequest(object sender, ToolTipRequestEventArgs e)
        {
            if (e.InDocument && !e.ToolTipShown)
            {
                IExpressionFinder expressionFinder;
                if (MainForm.IsVisualBasic)
                {
                    expressionFinder = new VBExpressionFinder();
                }
                else
                {
                    expressionFinder = new CSharpExpressionFinder(mainForm.parseInformation);
                }
                ExpressionResult expression = expressionFinder.FindFullExpression(
                    editor.Text,
                    editor.Document.PositionToOffset(e.LogicalPosition));
                if (expression.Region.IsEmpty)
                {
                    expression.Region = new DomRegion(e.LogicalPosition.Line + 1, e.LogicalPosition.Column + 1);
                }

                TextArea textArea = editor.ActiveTextAreaControl.TextArea;
                NRefactoryResolver resolver = new NRefactoryResolver(mainForm.myProjectContent.Language);
                ResolveResult rr = resolver.Resolve(expression,
                                                    mainForm.parseInformation,
                                                    textArea.MotherTextEditorControl.Text);
                string toolTipText = GetText(rr);
                if (toolTipText != null)
                {
                    e.ShowToolTip(toolTipText);
                }
            }
        }
コード例 #3
0
ファイル: TextArea.cs プロジェクト: rajeshwarn/Metadrone
 protected virtual void OnToolTipRequest(ToolTipRequestEventArgs e)
 {
     if (ToolTipRequest != null)
     {
         ToolTipRequest(this, e);
     }
 }
コード例 #4
0
        protected void RequestToolTip(Point mousePos)
        {
            if (this.toolTipRectangle.Contains(mousePos))
            {
                if (!this.toolTipActive)
                {
                    base.ResetMouseEventArgs();
                }
                return;
            }
            this.toolTipRectangle = new Rectangle(mousePos.X - 4, mousePos.Y - 4, 8, 8);
            ICSharpCode.TextEditor.TextView textView = this.textView;
            int                     x = mousePos.X - this.textView.DrawingPosition.Left;
            int                     y = mousePos.Y;
            Rectangle               drawingPosition        = this.textView.DrawingPosition;
            TextLocation            logicalPosition        = textView.GetLogicalPosition(x, y - drawingPosition.Top);
            bool                    flag                   = (!this.textView.DrawingPosition.Contains(mousePos) || logicalPosition.Y < 0 ? false : logicalPosition.Y < this.Document.TotalNumberOfLines);
            ToolTipRequestEventArgs toolTipRequestEventArg = new ToolTipRequestEventArgs(mousePos, logicalPosition, flag);

            this.OnToolTipRequest(toolTipRequestEventArg);
            if (!toolTipRequestEventArg.ToolTipShown)
            {
                this.CloseToolTip();
                return;
            }
            this.toolTipActive = true;
            this.SetToolTip(toolTipRequestEventArg.toolTipText, (flag ? logicalPosition.Y + 1 : -1));
        }
コード例 #5
0
ファイル: TextArea.cs プロジェクト: rajeshwarn/Metadrone
        protected void RequestToolTip(Point mousePos)
        {
            if (toolTipRectangle.Contains(mousePos))
            {
                if (!toolTipActive)
                {
                    ResetMouseEventArgs();
                }
                return;
            }

            //Console.WriteLine("Request tooltip for " + mousePos);

            toolTipRectangle = new Rectangle(mousePos.X - 4, mousePos.Y - 4, 8, 8);

            TextLocation logicPos = textView.GetLogicalPosition(mousePos.X - textView.DrawingPosition.Left,
                                                                mousePos.Y - textView.DrawingPosition.Top);
            bool inDocument = textView.DrawingPosition.Contains(mousePos) &&
                              logicPos.Y >= 0 && logicPos.Y < Document.TotalNumberOfLines;
            ToolTipRequestEventArgs args = new ToolTipRequestEventArgs(mousePos, logicPos, inDocument);

            OnToolTipRequest(args);
            if (args.ToolTipShown)
            {
                //Console.WriteLine("Set tooltip to " + args.toolTipText);
                toolTipActive = true;
                SetToolTip(args.toolTipText, inDocument ? logicPos.Y + 1 : -1);
            }
            else
            {
                CloseToolTip();
            }
        }
コード例 #6
0
        private void OnToolTipRequest(object sender, ToolTipRequestEventArgs e)
        {
            if (e.ToolTipShown)
            {
                return;
            }

            Point      mousepos = e.MousePosition;
            FoldMarker marker   = textArea.TextView.GetFoldMarkerFromPosition(mousepos.X - textArea.TextView.DrawingPosition.X, mousepos.Y - textArea.TextView.DrawingPosition.Y);

            if (marker != null && marker.IsFolded)
            {
                StringBuilder sb = new StringBuilder(marker.InnerText);

                // max 10 lines
                int endLines = 0;

                for (int i = 0; i < sb.Length; ++i)
                {
                    if (sb[i] == '\n')
                    {
                        ++endLines;

                        if (endLines >= 10)
                        {
                            sb.Remove(i + 1, sb.Length - i - 1);
                            sb.Append(Environment.NewLine);
                            sb.Append("...");
                            break;
                        }
                    }
                }

                sb.Replace("\t", "    ");
                e.ShowToolTip(sb.ToString());
                return;
            }

            List <TextMarker> markers = textArea.Document.MarkerStrategy.GetMarkers(e.LogicalPosition);

            foreach (TextMarker tm in markers)
            {
                if (tm.ToolTip != null)
                {
                    e.ShowToolTip(tm.ToolTip.Replace("\t", "    "));
                    return;
                }
            }
        }
コード例 #7
0
		public ToolTipInfo GetToolTipInfo(TextArea textArea, ToolTipRequestEventArgs e)
		{
			TextLocation logicPos = e.LogicalPosition;
			IDocument doc = textArea.Document;
			if (logicPos.X > doc.GetLineSegment(logicPos.Y).Length - 1) {
				return null;
			}
			
			ResourceResolveResult result = ResourceResolverService.Resolve(textArea.MotherTextEditorControl.FileName, doc, logicPos.Y, logicPos.X, null);
			
			if (result != null && result.ResourceFileContent != null) {
				return new ToolTipInfo(ResourceResolverService.FormatResourceDescription(result.ResourceFileContent, result.Key));
			}
			
			return null;
		}
コード例 #8
0
        private void OnToolTipRequest(object sender, ToolTipRequestEventArgs e)
        {
            if (e.ToolTipShown)
            {
                return;
            }
            Point      mousePosition          = e.MousePosition;
            TextView   textView               = this.textArea.TextView;
            int        x                      = mousePosition.X - this.textArea.TextView.DrawingPosition.X;
            int        y                      = mousePosition.Y;
            Rectangle  drawingPosition        = this.textArea.TextView.DrawingPosition;
            FoldMarker foldMarkerFromPosition = textView.GetFoldMarkerFromPosition(x, y - drawingPosition.Y);

            if (foldMarkerFromPosition == null || !foldMarkerFromPosition.IsFolded)
            {
                foreach (TextMarker marker in this.textArea.Document.MarkerStrategy.GetMarkers(e.LogicalPosition))
                {
                    if (marker.ToolTip == null)
                    {
                        continue;
                    }
                    e.ShowToolTip(marker.ToolTip.Replace("\t", "    "));
                    return;
                }
                return;
            }
            StringBuilder stringBuilder = new StringBuilder(foldMarkerFromPosition.InnerText);
            int           num           = 0;

            for (int i = 0; i < stringBuilder.Length; i++)
            {
                if (stringBuilder[i] == '\n')
                {
                    num++;
                    if (num >= 10)
                    {
                        stringBuilder.Remove(i + 1, stringBuilder.Length - i - 1);
                        stringBuilder.Append(Environment.NewLine);
                        stringBuilder.Append("...");
                        break;
                    }
                }
            }
            stringBuilder.Replace("\t", "    ");
            e.ShowToolTip(stringBuilder.ToString());
        }
コード例 #9
0
        void OnToolTipRequest(object sender, ToolTipRequestEventArgs e)
        {
            if (e.ToolTipShown)
                return;

            Point mousepos = e.MousePosition;
            FoldMarker marker = _textArea.TextView.GetFoldMarkerFromPosition(mousepos.X - _textArea.TextView.DrawingPosition.X, mousepos.Y - _textArea.TextView.DrawingPosition.Y);
            if (marker != null && marker.IsFolded)
            {
                StringBuilder sb = new StringBuilder(marker.InnerText);

                // max 10 lines
                int endLines = 0;
                for (int i = 0; i < sb.Length; ++i)
                {
                    if (sb[i] == '\n')
                    {
                        ++endLines;
                        if (endLines >= 10)
                        {
                            sb.Remove(i + 1, sb.Length - i - 1);
                            sb.Append(Environment.NewLine);
                            sb.Append("...");
                            break;
                        }
                    }
                }

                sb.Replace("\t", "    ");
                e.ShowToolTip(sb.ToString());
                return;
            }

            foreach (TextMarker tm in _textArea.Document.MarkerStrategy.GetMarkers(e.LogicalPosition))
            {
                if (tm.ToolTip != null)
                {
                    e.ShowToolTip(tm.ToolTip.Replace("\t", "    "));
                    return;
                }
            }
        }
コード例 #10
0
 private static string GetPopupHintText(TextArea textArea, ToolTipRequestEventArgs e)
 {
     ICSharpCode.TextEditor.TextLocation logicPos = e.LogicalPosition;
     IDocument doc = textArea.Document;
     LineSegment seg = doc.GetLineSegment(logicPos.Y);
     string FileName = textArea.MotherTextEditorControl.FileName;
     PascalABCCompiler.Parsers.KeywordKind keyw = PascalABCCompiler.Parsers.KeywordKind.None;
     if (logicPos.X > seg.Length - 1)
         return null;
     //string expr = FindFullExpression(doc.TextContent, seg.Offset + logicPos.X,e.LogicalPosition.Line,e.LogicalPosition.Column);
     string expr_without_brackets = null;
     string expr = CodeCompletion.CodeCompletionController.CurrentParser.LanguageInformation.FindExpressionFromAnyPosition(seg.Offset + logicPos.X, doc.TextContent, e.LogicalPosition.Line, e.LogicalPosition.Column, out keyw, out expr_without_brackets);
     if (expr == null)
         expr = expr_without_brackets;
     if (expr_without_brackets == null)
         return null;
     List<PascalABCCompiler.Errors.Error> Errors = new List<PascalABCCompiler.Errors.Error>();
     PascalABCCompiler.SyntaxTree.expression tree = WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.StandartCompiler.ParsersController.GetExpression("test" + Path.GetExtension(FileName), expr, Errors);
     bool header = false;
     if (tree == null || Errors.Count > 0)
     {
         Errors.Clear();
         tree = WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.StandartCompiler.ParsersController.GetExpression("test" + Path.GetExtension(FileName), expr_without_brackets, Errors);
         header = true;
         if (tree == null || Errors.Count > 0)
             return null;
     }
     else
     {
         Errors.Clear();
         PascalABCCompiler.SyntaxTree.expression tree2 = WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.StandartCompiler.ParsersController.GetExpression("test" + Path.GetExtension(FileName), expr_without_brackets, Errors);
         //header = true;
         if (tree2 == null || Errors.Count > 0)
             return null;
         //if (tree is PascalABCCompiler.SyntaxTree.new_expr && (tree as PascalABCCompiler.SyntaxTree.new_expr).params_list == null)
         //	tree = tree2;
     }
     CodeCompletion.DomConverter dconv = (CodeCompletion.DomConverter)CodeCompletion.CodeCompletionController.comp_modules[FileName];
     if (dconv == null) return null;
     return dconv.GetDescription(tree, FileName, expr_without_brackets, WorkbenchServiceFactory.Workbench.VisualEnvironmentCompiler.StandartCompiler.ParsersController, e.LogicalPosition.Line, e.LogicalPosition.Column, keyw, header);
 }
コード例 #11
0
ファイル: ToolTipProvider.cs プロジェクト: zz0813/Reflexil
        private void OnToolTipRequest(object sender, TextEditor.ToolTipRequestEventArgs e)
        {
            if (!e.InDocument || e.ToolTipShown)
            {
                return;
            }

            IExpressionFinder expressionFinder;

            if (IntellisenseForm.SupportedLanguage == SupportedLanguage.VisualBasic)
            {
                expressionFinder = new VBExpressionFinder();
            }
            else
            {
                expressionFinder = new CSharpExpressionFinder(_iForm.ParseInformation);
            }

            var expression = expressionFinder.FindFullExpression(
                _editor.Text,
                _editor.Document.PositionToOffset(e.LogicalPosition));

            if (expression.Region.IsEmpty)
            {
                expression.Region = new DomRegion(e.LogicalPosition.Line + 1, e.LogicalPosition.Column + 1);
            }

            var textArea = _editor.ActiveTextAreaControl.TextArea;
            var resolver = new NRefactoryResolver(_iForm.ProjectContent.Language);
            var rr       = resolver.Resolve(expression,
                                            _iForm.ParseInformation,
                                            textArea.MotherTextEditorControl.Text);

            var toolTipText = GetText(rr);

            if (toolTipText != null)
            {
                e.ShowToolTip(toolTipText);
            }
        }
コード例 #12
0
ファイル: Debugger.cs プロジェクト: lisiynos/pascalabcnet
 private string GetVariable(ToolTipRequestEventArgs e, TextArea textArea, out int num_line, out int start_off, out int end_off)
 {
     //Point logicPos = e.LogicalPosition;
     ICSharpCode.TextEditor.TextLocation logicPos = e.LogicalPosition;
     IDocument doc = textArea.Document;
     LineSegment seg = doc.GetLineSegment(logicPos.Y);
     num_line = seg.LineNumber;
     start_off = 0;
     end_off = 0;
     if (logicPos.X > seg.Length - 1)
         return null;
     string textContent = doc.TextContent;
     string expressionResult = FindFullExpression(textContent, seg.Offset + logicPos.X,doc, out start_off, out end_off);
     return expressionResult;
 }
コード例 #13
0
ファイル: TextArea.cs プロジェクト: ChrisPea/TuningSuites
        protected void RequestToolTip(Point mousePos)
        {
            if (toolTipRectangle.Contains(mousePos)) {
                if (!toolTipActive)
                    ResetMouseEventArgs();
                return;
            }

            //Console.WriteLine("Request tooltip for " + mousePos);

            toolTipRectangle = new Rectangle(mousePos.X - 4, mousePos.Y - 4, 8, 8);

            TextLocation logicPos = textView.GetLogicalPosition(mousePos.X - textView.DrawingPosition.Left,
                                                                mousePos.Y - textView.DrawingPosition.Top);
            bool inDocument = textView.DrawingPosition.Contains(mousePos)
                && logicPos.Y >= 0 && logicPos.Y < Document.TotalNumberOfLines;
            ToolTipRequestEventArgs args = new ToolTipRequestEventArgs(mousePos, logicPos, inDocument);
            OnToolTipRequest(args);
            if (args.ToolTipShown) {
                //Console.WriteLine("Set tooltip to " + args.toolTipText);
                toolTipActive = true;
                SetToolTip(args.toolTipText, inDocument ? logicPos.Y + 1 : -1);
            } else {
                CloseToolTip();
            }
        }
コード例 #14
0
        protected override void OnToolTipRequest(object sender, ToolTipRequestEventArgs e)
        {
            if (!e.InDocument || e.LogicalPosition.IsEmpty)
                return;
         
            var text = (TextArea) sender;
            if (text.Document == null) return;

            var lineSegment = text.Document.GetLineSegment(e.LogicalPosition.Line);
            var lineText = text.Document.GetText(lineSegment);

            string word = GetWordAtColumn(lineText, e.LogicalPosition.Column);

            if (word == null)
                return;

            // register-variable?
            if (_formatter != null)
            {
                string varName = _formatter.GetVariableByRegisterName(word);
                if (varName != null)
                {
                    e.ShowToolTip(varName);
                    return;
                }
            }

            // opcode-mnemonic?
            var opcode = Opcodes.Lookup(word);
            if (opcode != null)
            {
                string toolTip = string.Format("{0}\n\n{1}\n\n{2}", opcode.Syntax, opcode.Arguments, opcode.Description);
                e.ShowToolTip(toolTip);
                return;
            }
        }
コード例 #15
0
ファイル: TextArea.cs プロジェクト: ChrisPea/TuningSuites
 protected virtual void OnToolTipRequest(ToolTipRequestEventArgs e)
 {
     if (ToolTipRequest != null) {
         ToolTipRequest(this, e);
     }
 }
コード例 #16
0
 void TextArea_ToolTipRequest(object sender, ToolTipRequestEventArgs e)
 {
     if (currentTab == null
         || currentTab.parseInfo == null
         || sender != currentTab.textEditor.ActiveTextAreaControl.TextArea
         || !e.InDocument) {
         return;
     }
     HighlightColor hc = currentTab.textEditor.Document.GetLineSegment(e.LogicalPosition.Line).GetColorForPosition(e.LogicalPosition.Column);
     if (hc == null || hc.Color == System.Drawing.Color.Green || hc.Color == System.Drawing.Color.Brown || hc.Color == System.Drawing.Color.DarkGreen)
         return;
     string word = TextUtilities.GetWordAt(currentTab.textEditor.Document, currentTab.textEditor.Document.PositionToOffset(e.LogicalPosition));
     if (currentTab.msgFileTab != null) {
         int msg;
         if (int.TryParse(word, out msg) && currentTab.messages.ContainsKey(msg)) {
             e.ShowToolTip(currentTab.messages[msg]);
             return;
         }
     }
     string lookup = currentTab.parseInfo.LookupToken(word, currentTab.filepath, e.LogicalPosition.Line + 1);
     if (lookup != null) {
         e.ShowToolTip(lookup);
         return;
     }
 }
        // was part of Tool Tip Provider        
        void OnToolTipRequest(object sender, ToolTipRequestEventArgs e)
        {
            O2Thread.mtaThread(
            () =>
            {
                try
                {
                    if (e.InDocument && !e.ToolTipShown)
                    {
                        var logicalPosition = e.LogicalPosition;

                        // parseSourceCode(CodeCompleteTargetText);
                        ResolveResult rr = resolveLocation(logicalPosition);
                        string toolTipText = GetText(rr);
                        if (toolTipText != null)
                        {
                            e.ShowToolTip(toolTipText);
                            //}
                            //if (toolTipText.valid())
                            "ToolTipText: {0}".format(toolTipText).info();
                        }

                    }
                }
                catch (Exception ex)
                {
                    ex.log("in OnToolTipRequest");
                }
            });            
        }
コード例 #18
0
		/// <summary>
		/// Gets debugger tooltip information for the specified position.
		/// A descriptive text for the element or a DebuggerGridControl
		/// showing its current value (when in debugging mode) can be returned
		/// through the ToolTipInfo object.
		/// Returns <c>null</c>, if no tooltip information is available.
		/// </summary>
		internal static ToolTipInfo GetToolTipInfo(TextArea textArea, ToolTipRequestEventArgs e)
		{
			TextLocation logicPos = e.LogicalPosition;
			IDocument doc = textArea.Document;
			IExpressionFinder expressionFinder = ParserService.GetExpressionFinder(textArea.MotherTextEditorControl.FileName);
			if (expressionFinder == null)
				return null;
			LineSegment seg = doc.GetLineSegment(logicPos.Y);
			if (logicPos.X > seg.Length - 1)
				return null;
			string textContent = doc.TextContent;
			ExpressionResult expressionResult = expressionFinder.FindFullExpression(textContent, seg.Offset + logicPos.X);
			string expression = (expressionResult.Expression ?? "").Trim();
			if (expression.Length > 0) {
				// Look if it is variable
				ResolveResult result = ParserService.Resolve(expressionResult, logicPos.Y + 1, logicPos.X + 1, textArea.MotherTextEditorControl.FileName, textContent);
				bool debuggerCanShowValue;
				string toolTipText = GetText(result, expression, out debuggerCanShowValue);
				if (Control.ModifierKeys == Keys.Control) {
					toolTipText = "expr: " + expressionResult.ToString() + "\n" + toolTipText;
					debuggerCanShowValue = false;
				}
				if (toolTipText != null) {
					if (debuggerCanShowValue && currentDebugger != null) {
						return new ToolTipInfo(currentDebugger.GetTooltipControl(expressionResult.Expression));
					}
					return new ToolTipInfo(toolTipText);
				}
			} else {
				#if DEBUG
				if (Control.ModifierKeys == Keys.Control) {
					return new ToolTipInfo("no expr: " + expressionResult.ToString());
				}
				#endif
			}
			return null;
		}
コード例 #19
0
		public ToolTipInfo GetToolTipInfo(TextArea textArea, ToolTipRequestEventArgs e)
		{
			return DebuggerService.GetToolTipInfo(textArea, e);
		}
コード例 #20
0
		/// <summary>
		/// This function shows variable values as tooltips
		/// </summary>
		static void TextAreaToolTipRequest(object sender, ToolTipRequestEventArgs e)
		{
			DebuggerGridControl toolTipControl = null;
			try {
				TextArea textArea = (TextArea)sender;
				if (e.ToolTipShown) return;
				if (oldToolTipControl != null && !oldToolTipControl.AllowClose) return;
				if (!CodeCompletionOptions.EnableCodeCompletion) return;
				if (!CodeCompletionOptions.TooltipsEnabled) return;
				
				if (CodeCompletionOptions.TooltipsOnlyWhenDebugging) {
					if (currentDebugger == null) return;
					if (!currentDebugger.IsDebugging) return;
				}
				
				if (e.InDocument) {
					// Query all registered tooltip providers using the AddInTree.
					// The first one that does not return null will be used.
					ToolTipInfo ti = null;
					foreach (ITextAreaToolTipProvider toolTipProvider in AddInTree.BuildItems<ITextAreaToolTipProvider>(ToolTipProviderAddInTreePath, null, false)) {
						if ((ti = toolTipProvider.GetToolTipInfo(textArea, e)) != null) {
							break;
						}
					}
					
					if (ti != null) {
						toolTipControl = ti.ToolTipControl as DebuggerGridControl;
						if (ti.ToolTipText != null) {
							e.ShowToolTip(ti.ToolTipText);
						}
					}
					CloseOldToolTip();
					if (toolTipControl != null) {
						toolTipControl.ShowForm(textArea, e.LogicalPosition);
					}
					oldToolTipControl = toolTipControl;
					
				}
			} catch (Exception ex) {
				ICSharpCode.Core.MessageService.ShowError(ex, "Error while requesting tooltip for location " + e.LogicalPosition);
			} finally {
				if (toolTipControl == null && CanCloseOldToolTip)
					CloseOldToolTip();
			}
		}
コード例 #21
0
ファイル: TextNode.cs プロジェクト: Xtremrules/dot42
 protected virtual void OnToolTipRequest(object sender, ToolTipRequestEventArgs e)
 {
 }
コード例 #22
0
        public static void ToolTipService_TextAreaToolTipRequest(object sender, ToolTipRequestEventArgs e)
        {
            if (!VisualPABCSingleton.MainForm.UserOptions.CodeCompletionHint)
                return;
            if (CodeCompletion.CodeCompletionController.CurrentParser == null)
                return;
            try
            {
                TextArea textArea = sender as TextArea;
                if (dvw != null && dvw.Description != null)
                {
                    hideToolTip();
                    return;
                }
                if (e.ToolTipShown && dvw != null)
                {
                    hideToolTip();
                    return;
                }
                if (e.InDocument)
                {

                    if (dvw == null)
                    {
                        dvw = new DeclarationWindow(VisualPABCSingleton.MainForm);
                        dvw.Font = new System.Drawing.Font(Constants.CompletionWindowDeclarationViewWindowFontName, dvw.Font.Size);

                        dvw.HideOnClick = true;
                        //dvw.ShowDeclarationViewWindow();
                    }
                    int ypos = (textArea.Document.GetVisibleLine(e.LogicalPosition.Y) + 1) * textArea.TextView.FontHeight - textArea.VirtualTop.Y;
                    System.Drawing.Point p = new System.Drawing.Point(0, ypos);
                    p = textArea.PointToScreen(p);
                    p.X = Control.MousePosition.X + 3;
                    p.Y += 5;
                    string txt = GetPopupHintText(textArea, e);
                    dvw.Location = choose_location(p, txt);
                    dvw.Description = txt;

                    _hint_hide_d = dvw.Font.Height / 2;
                    _mouse_hint_x = e.MousePosition.X;
                    _mouse_hint_y = e.MousePosition.Y;
                    toolTipVisible = true;
                }
            }
            catch (System.Exception ex)
            {
                //VisualPABCSingleton.MainForm.WriteToOutputBox(ex.Message);// ICSharpCode.Core.MessageService.ShowError(ex);
            }
            finally
            {

            }
        }
コード例 #23
0
ファイル: Debugger.cs プロジェクト: lisiynos/pascalabcnet
        public void TextAreaToolTipRequest(object sender, ToolTipRequestEventArgs e)
        {
            DebuggerGridControl toolTipControl = null;
            TextMarker marker = null;
            //RemoveMarker((sender as TextArea).Document);
            if (debuggedProcess == null) return;
            if (debuggedProcess.SelectedFunction == null || !debuggedProcess.IsPaused) return;
            try
            {
                TextArea textArea = (TextArea)sender;
                
                if (textArea != curTextArea) return;
                if (e.ToolTipShown) return;
                if (oldToolTipControl != null && !oldToolTipControl.AllowClose) return;
                if (!IsRunning) return;

                if (e.InDocument)
                {
                    ToolTipInfo ti = null;
                    int num_line = 0;
                    int start_off = 0;
                    int end_off = 0;
                    string var = GetVariable(e,textArea,out num_line, out start_off, out end_off);
                    if (var == null || var == "") return;
                    //if (debuggedProcess.SelectedFunction.LocalVariables.Count > 0)
                    {
                        //NamedValue nv = FindVarByName(var, num_line);
                        ListItem nv = FindVarByName(var, num_line);
                        if (nv != null)
                        {
                        	System.Threading.Thread.Sleep(50);
                        	DebuggerGridControl dgc = new DebuggerGridControl(new DynamicTreeDebuggerRow(nv));
                        	dgc.doc = textArea.Document;
                        	ti = new ToolTipInfo(dgc);
                        	ICSharpCode.TextEditor.TextLocation logicPos = e.LogicalPosition;
            				LineSegment seg = textArea.Document.GetLineSegment(logicPos.Y);
            				marker = new TextMarker(start_off, end_off-start_off+1, TextMarkerType.Cant, Color.Black, Color.White);
                        	textArea.Document.MarkerStrategy.AddMarker(marker);
                        	textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine,seg.LineNumber));
                        	textArea.Document.CommitUpdate();
                        }
                    }
                    if (ti != null)
                    {
                        toolTipControl = ti.ToolTipControl as DebuggerGridControl;
                        if (ti.ToolTipText != null)
                        {
                            e.ShowToolTip(ti.ToolTipText);
                        }
                    }
                    CloseOldToolTip();
                    if (toolTipControl != null)
                    {
                        toolTipControl.ShowForm(textArea, e.LogicalPosition);
                    }
                    oldToolTipControl = toolTipControl;
                    RemoveMarker(textArea.Document);
                    oldMarker = marker;

                }
            }
            catch (System.Exception ex)
            {
                //frm.WriteToOutputBox(ex.Message);// ICSharpCode.Core.MessageService.ShowError(ex);
            }
            finally
            {
                if (toolTipControl == null && CanCloseOldToolTip)
                {
                    CloseOldToolTip();
                    RemoveMarker((sender as TextArea).Document);
                }
            }
        }
コード例 #24
0
 protected virtual void OnToolTipRequest(ToolTipRequestEventArgs e)
 {
     ToolTipRequest?.Invoke(this, e);
 }