protected override bool OnMotionNotifyEvent (EventMotion evnt) { if (button != 0) MouseMove (evnt.Y); int h = Allocation.Height - Allocation.Width - 3; if (TextEditor.HighlightSearchPattern) { if (evnt.Y > h) this.TooltipText = string.Format (GettextCatalog.GetPluralString ("{0} match", "{0} matches", TextEditor.TextViewMargin.SearchResultMatchCount), TextEditor.TextViewMargin.SearchResultMatchCount); } else { if (evnt.Y > h) { int errors = 0, warnings = 0; foreach (var task in AllTasks) { switch (task.Severity) { case QuickTaskSeverity.Error: errors++; break; case QuickTaskSeverity.Warning: warnings++; break; } } string text = null; if (errors == 0 && warnings == 0) { text = GettextCatalog.GetString ("No errors or warnings"); } else if (errors == 0) { text = string.Format (GettextCatalog.GetPluralString ("{0} warning", "{0} warnings", warnings), warnings); } else if (warnings == 0) { text = string.Format (GettextCatalog.GetPluralString ("{0} error", "{0} errors", errors), errors); } else { text = string.Format (GettextCatalog.GetString ("{0} errors and {1} warnings"), errors, warnings); } this.TooltipText = text; } else { TextEditorData editorData = TextEditor.GetTextEditorData (); foreach (var tasks in providerTasks.Values) { foreach (var task in tasks) { double y = h * TextEditor.LineToY (task.Location.Line) / Math.Max (TextEditor.EditorLineThreshold * editorData.LineHeight + editorData.TotalHeight, TextEditor.Allocation.Height); if (Math.Abs (y - evnt.Y) < 3) { hoverTask = task; } } } base.TooltipText = hoverTask != null ? hoverTask.Description : null; } } return base.OnMotionNotifyEvent (evnt); }
void UpdateQuickTasks () { tasks.Clear (); foreach (var result in GetResults ()) { var newTask = new QuickTask (result.Message, result.Region.Start, result.Level); tasks.Add (newTask); } OnTasksUpdated (EventArgs.Empty); }
void UpdateQuickTasks (ParsedDocument doc) { tasks.Clear (); foreach (var cmt in doc.TagComments) { QuickTask newTask = new QuickTask (cmt.Text, cmt.Region.Start, QuickTaskSeverity.Hint); tasks.Add (newTask); } foreach (var error in doc.Errors) { QuickTask newTask = new QuickTask (error.Message, error.Region.Start, error.ErrorType == ErrorType.Error ? QuickTaskSeverity.Error : QuickTaskSeverity.Warning); tasks.Add (newTask); } OnTasksUpdated (EventArgs.Empty); }