Exemplo n.º 1
0
        static public Point[] FindIndicatorRanges(this ScintillaGateway document, int indicator)
        {
            var ranges = new List <Point>();

            int testPosition = 0;

            while (true)
            {
                //finding the indicator ranges
                //For example indicator 4..6 in the doc 0..10 will have three logical regions:
                //0..4, 4..6, 6..10
                //Probing will produce following when outcome:
                //probe for 0 : 0..4
                //probe for 4 : 4..6
                //probe for 6 : 4..10

                int rangeStart = document.IndicatorStart(indicator, testPosition);
                int rangeEnd   = document.IndicatorEnd(indicator, testPosition);
                int value      = document.IndicatorValueAt(indicator, testPosition);
                if (value == 1) //indicator is present
                {
                    ranges.Add(new Point(rangeStart, rangeEnd));
                }

                if (testPosition == rangeEnd)
                {
                    break;
                }

                testPosition = rangeEnd;
            }

            return(ranges.ToArray());
        }