Esempio n. 1
0
        public void CommentHitTestError()
        {
            string      test = "<p><!--OddPage--></p>";
            XmlDocument doc  = new XmlDocument();

            doc.LoadXml(test);

            Stylesheet s = new Stylesheet();

            s.BindStyles(doc.NameTable);

            Rectangle rc = new Rectangle(0, 0, 500, int.MaxValue);

            using (IGraphics gr = new DummyGraphics())
            {
                DrawContext  ctx          = new DrawContext(gr, Point.Empty, rc, rc, null, new DocumentType(), null);
                LayoutEngine layoutEngine = new LayoutEngine(s);

                layoutEngine.Reflow(ctx, doc.DocumentElement);

                Console.WriteLine("Bounds {0}", layoutEngine.BoundingRect);
                for (int x = 0; x < layoutEngine.BoundingRect.Width; x += 10)
                {
                    HitTestInfo    hti = layoutEngine.GetHitTestInfo(gr, new Point(x, 8));
                    SelectionPoint sp  = hti.SelectionPoint;
                    Console.WriteLine("Hit test at {0} = {1}", x, sp);
                }
            }
        }
Esempio n. 2
0
        public void WhitespaceHandling1()
        {
            string      test = "aaaa bbbb  cccc";
            XmlDocument doc  = new XmlDocument();

            doc.LoadXml("<doc>" + test + "</doc>");

            Stylesheet s = new Stylesheet();

            s.BindStyles(doc.NameTable);

//			Rectangle rc=new Rectangle(0, 0, 480, int.MaxValue);
            Rectangle rc = new Rectangle(0, 0, 110, int.MaxValue);

            using (IGraphics gr = new DummyGraphics())
            {
                DrawContext  ctx          = new DrawContext(gr, Point.Empty, rc, rc, null, new DocumentType(), null);
                LayoutEngine layoutEngine = new LayoutEngine(s);
                layoutEngine.Reflow(ctx, doc.DocumentElement);

                SelectionPoint start = new TextSelectionPoint(doc.DocumentElement.FirstChild, 11);
                Console.WriteLine("Getting caret pos for {0}", start);
                Rectangle c = layoutEngine.GetCaretPosition(gr, start, CaretDirection.None);
                Console.WriteLine("Char {0} at {1}", start.ToString(), c);
            }
        }
Esempio n. 3
0
        public void CommentHitTestError()
        {
            string test="<p><!--OddPage--></p>";
            XmlDocument doc=new XmlDocument();
            doc.LoadXml(test);

            Stylesheet s=new Stylesheet();
            s.BindStyles(doc.NameTable);

            Rectangle rc=new Rectangle(0, 0, 500, int.MaxValue);

            using ( IGraphics gr=new DummyGraphics() )
            {
                DrawContext ctx=new DrawContext(gr, Point.Empty, rc, rc, null, new DocumentType(), null);
                LayoutEngine layoutEngine=new LayoutEngine(s);

                layoutEngine.Reflow(ctx, doc.DocumentElement);

                Console.WriteLine("Bounds {0}", layoutEngine.BoundingRect);
                for (int x=0; x< layoutEngine.BoundingRect.Width; x+=10)
                {
                    HitTestInfo hti=layoutEngine.GetHitTestInfo(gr, new Point(x,8));
                    SelectionPoint sp=hti.SelectionPoint;
                    Console.WriteLine("Hit test at {0} = {1}", x, sp);
                }
            }
        }
Esempio n. 4
0
        public void HitTestHandling()
        {
            string test="<p><b>xxxxxxxxxxxxx</b></p>";
            XmlDocument doc=new XmlDocument();
            doc.LoadXml(test);

            Stylesheet s=//Stylesheet.Load("c:/tmp/website/site.style", doc.NameTable);
            new Stylesheet();
            s.BindStyles(doc.NameTable);

            Rectangle rc=new Rectangle(0, 0, 500, int.MaxValue);

            using ( IGraphics gr=new DummyGraphics() )
            {
                DrawContext ctx=new DrawContext(gr, Point.Empty, rc, rc, null, new DocumentType(), null);
                LayoutEngine layoutEngine=new LayoutEngine(s);

                layoutEngine.Reflow(ctx, doc.DocumentElement);

                layoutEngine.GetHitTestInfo(gr, new Point(141,16));
            }
        }
Esempio n. 5
0
        public void HitTestHandling()
        {
            string      test = "<p><b>xxxxxxxxxxxxx</b></p>";
            XmlDocument doc  = new XmlDocument();

            doc.LoadXml(test);

            Stylesheet s =           //Stylesheet.Load("c:/tmp/website/site.style", doc.NameTable);
                           new Stylesheet();

            s.BindStyles(doc.NameTable);

            Rectangle rc = new Rectangle(0, 0, 500, int.MaxValue);

            using (IGraphics gr = new DummyGraphics())
            {
                DrawContext  ctx          = new DrawContext(gr, Point.Empty, rc, rc, null, new DocumentType(), null);
                LayoutEngine layoutEngine = new LayoutEngine(s);

                layoutEngine.Reflow(ctx, doc.DocumentElement);

                layoutEngine.GetHitTestInfo(gr, new Point(141, 16));
            }
        }
Esempio n. 6
0
        public void WhitespaceHandling1()
        {
            string test="aaaa bbbb  cccc";
            XmlDocument doc=new XmlDocument();
            doc.LoadXml("<doc>"+test+"</doc>");

            Stylesheet s=new Stylesheet();
            s.BindStyles(doc.NameTable);

            //			Rectangle rc=new Rectangle(0, 0, 480, int.MaxValue);
            Rectangle rc=new Rectangle(0, 0, 110, int.MaxValue);

            using ( IGraphics gr=new DummyGraphics() )
            {
                DrawContext ctx=new DrawContext(gr, Point.Empty, rc, rc, null, new DocumentType(), null);
                LayoutEngine layoutEngine=new LayoutEngine(s);
                layoutEngine.Reflow(ctx, doc.DocumentElement);

                SelectionPoint start=new TextSelectionPoint(doc.DocumentElement.FirstChild, 11);
                Console.WriteLine("Getting caret pos for {0}", start);
                Rectangle c=layoutEngine.GetCaretPosition(gr, start, CaretDirection.None);
                Console.WriteLine("Char {0} at {1}", start.ToString(), c);
            }
        }