DrawSearchIndicator() protected method

protected DrawSearchIndicator ( Cairo cr ) : void
cr Cairo
return void
            bool RunHandler()
            {
tokenExit:
                if (token.IsCancellationRequested || mode.TextEditor.GetTextEditorData() == null)
                {
                    cr.Dispose();
                    // if the surface was newly created dispose it otherwise it'll leak.
                    if (surface != mode.swapIndicatorSurface)
                    {
                        surface.Dispose();
                    }
                    return(false);
                }
                var lineCache = new List <HashSet <int> > ();

                lineCache.Add(new HashSet <int> ());
                lineCache.Add(new HashSet <int> ());
                bool nextStep = false;

                switch (drawingStep)
                {
                case 0:
                    CachedDraw(cr, ref mode.backgroundSurface, allocation, draw: (c, o) => mode.DrawBackground(c, allocation));
                    drawingStep++;
                    return(true);

                case 1:
                    for (int i = 0; i < 10 && !nextStep; i++)
                    {
                        if (token.IsCancellationRequested)
                        {
                            goto tokenExit;
                        }
                        if (mode.TextEditor.HighlightSearchPattern)
                        {
                            mode.DrawSearchResults(cr, searchResults, ref nextStep);
                        }
                        else
                        {
                            if (!Debugger.DebuggingService.IsDebugging)
                            {
                                mode.DrawQuickTasks(cr, allUsages, allTasks, ref nextStep, ref severity, lineCache);
                            }
                            else
                            {
                                nextStep = true;
                            }
                        }
                    }
                    if (nextStep)
                    {
                        drawingStep++;
                    }
                    return(true);

                case 2:
                    if (mode.TextEditor.HighlightSearchPattern)
                    {
                        mode.DrawSearchIndicator(cr);
                    }
                    else
                    {
                        if (!Debugger.DebuggingService.IsDebugging)
                        {
                            mode.DrawIndicator(cr, severity);
                        }
                    }
                    drawingStep++;
                    return(true);

                default:
                    cr.Dispose();
                    var tmp = mode.indicatorSurface;
                    mode.indicatorSurface     = surface;
                    mode.swapIndicatorSurface = tmp;
                    mode.QueueDraw();

                    return(false);
                }
            }
Exemplo n.º 2
0
            bool RunHandler()
            {
tokenExit:
                if (token.IsCancellationRequested || mode.TextEditor.GetTextEditorData() == null)
                {
                    cr.Dispose();
                    // if the surface was newly created dispose it otherwise it'll leak.
                    if (surface != mode.swapIndicatorSurface)
                    {
                        surface.Dispose();
                    }
                    return(false);
                }
                bool nextStep = false;

                switch (drawingStep)
                {
                case 0:
                    for (int i = 0; i < 10 && !nextStep; i++)
                    {
                        if (token.IsCancellationRequested)
                        {
                            goto tokenExit;
                        }
                        if (mode.TextEditor.HighlightSearchPattern)
                        {
                            mode.GetSearchResultIndicator(state, searchResults, ref nextStep);
                        }
                        else
                        {
                            if (!Debugger.DebuggingService.IsDebugging)
                            {
                                mode.GetQuickTasks(state, allUsages, allTasks, ref nextStep);
                            }
                            else
                            {
                                nextStep = true;
                            }
                        }
                    }
                    if (nextStep)
                    {
                        drawingStep++;
                        nextStep = false;
                        if (!ForceUpdate && state.Equals(mode.currentDrawingState))
                        {
                            cr.Dispose();
                            // if the surface was newly created dispose it otherwise it'll leak.
                            if (surface != mode.swapIndicatorSurface)
                            {
                                surface.Dispose();
                            }
                            IndicatorDrawingState.Dispose(state);
                            return(false);
                        }
                    }
                    return(true);

                case 1:
                    var displayScale = Core.Platform.IsMac ? GtkWorkarounds.GetScaleFactor(mode) : 1.0;
                    mode.DrawBackground(cr, allocation);
                    drawingStep++;

                    state.taskIterator  = 0;
                    state.usageIterator = 0;
                    curIndex            = 0;
                    return(true);

                case 2:
                    for (int i = 0; i < 10 && !nextStep; i++)
                    {
                        if (token.IsCancellationRequested)
                        {
                            goto tokenExit;
                        }
                        if (mode.TextEditor.HighlightSearchPattern)
                        {
                            if (curIndex < state.SearchResultIndicators.Count)
                            {
                                mode.DrawSearchResults(cr, state, curIndex++);
                            }
                            else
                            {
                                nextStep = true;
                            }
                        }
                        else
                        {
                            if (!Debugger.DebuggingService.IsDebugging)
                            {
                                mode.DrawQuickTasks(cr, state, curIndex++, ref nextStep);
                            }
                            else
                            {
                                nextStep = true;
                            }
                        }
                    }
                    if (nextStep)
                    {
                        drawingStep++;
                    }
                    return(true);

                case 3:
                    if (mode.TextEditor.HighlightSearchPattern)
                    {
                        mode.DrawSearchIndicator(cr);
                    }
                    else
                    {
                        if (!Debugger.DebuggingService.IsDebugging)
                        {
                            mode.DrawIndicator(cr, state.Severity);
                        }
                    }
                    drawingStep++;
                    return(true);

                default:
                    mode.DrawBreakpoints(cr);
                    cr.Dispose();
                    var tmp = mode.indicatorSurface;
                    mode.indicatorSurface     = surface;
                    mode.swapIndicatorSurface = tmp;
                    IndicatorDrawingState.Dispose(mode.currentDrawingState);
                    mode.currentDrawingState = state;
                    mode.QueueDraw();

                    return(false);
                }
            }