예제 #1
0
        ParaBox AddPara(string[] contents, AssembledStyles styles, RootBox root)
        {
            var clientRuns = new List <IClientRun>();

            foreach (string item in contents)
            {
                var run = new StringClientRun(item, styles);
                clientRuns.Add(run);
            }
            var source = new TextSource(clientRuns, null);
            var para   = new ParaBox(styles, source);

            root.AddBox(para);
            return(para);
        }
예제 #2
0
 private void VerifyRangeSegmentDrawing(ParaBox para, StringBox stringBox, MockSegment seg, RangeSelection range, int top, int ydTop, int bottom)
 {
     Assert.AreEqual(stringBox.IchMin, seg.LastDrawRangeCall.IchBase);
     Assert.AreEqual(m_gm.VwGraphics, seg.LastDrawRangeCall.Graphics);
     Assert.AreEqual(range.Start.StringPosition, seg.LastDrawRangeCall.IchMin);
     Assert.AreEqual(range.End.StringPosition, seg.LastDrawRangeCall.IchLim);
     ParaTests.VerifySimpleRect(seg.LastDrawRangeCall.RcSrc, -2, top, 96, 100);
     ParaTests.VerifySimpleRect(seg.LastDrawRangeCall.RcDst, 0, -10, 120, 128);
     Assert.AreEqual(ydTop, seg.LastDrawRangeCall.YdTop);
     Assert.AreEqual(bottom, seg.LastDrawRangeCall.YdBottom);
     Assert.AreEqual(seg.LastDrawRangeCall.On, true, "Should currently always pass true to segment drawRange On argument");
     // The old Views code appears to always pass true for this argument, so we should too, until I figure out what it's
     // really supposed to be, if anything.
     Assert.AreEqual(true, seg.LastDrawRangeCall.IsLastLineOfSelection);
 }
예제 #3
0
        // Add to the root a text paragraph which reflects the SimpleText property.
        private void AddSimpleTextPara(AssembledStyles styles, int ws, RootBox root)
        {
            var items = new List <ClientRun>();
            var run   = new StringClientRun("This is the day that the Lord has made. We will rejoice and be glad in it",
                                            styles.WithWs(ws));

            items.Add(run);
            TextSource source = new TextSource(items);
            ParaBox    para   = new ParaBox(styles, source);
            var        hookup = new StringHookup(this, () => this.SimpleText,
                                                 hook => SimpleTextChanged += hook.StringPropChanged,
                                                 hook => SimpleTextChanged -= hook.StringPropChanged, para);

            hookup.Writer = newVal => SimpleText = newVal;
            run.Hookup    = hookup;
            root.AddBox(para);
        }
예제 #4
0
        private void InitSeveralBoxes()
        {
            AssembledStyles styles = new AssembledStyles();
            RootBox         root   = new RootBox(styles);
            var             items  = new List <ClientRun>();

            items.Add(new BlockBox(styles, Color.Red, 72000, 36000));
            items.Add(new BlockBox(styles, Color.Blue, 36000, 18000));
            items.Add(new BlockBox(styles, Color.Orange, 18000, 36000));
            items.Add(new BlockBox(styles, Color.Green, 72000, 18000));
            items.Add(new BlockBox(styles, Color.Yellow, 72000, 36000));
            TextSource source = new TextSource(items);
            ParaBox    para   = new ParaBox(styles, source);

            root.AddBox(para);
            theSharpView.Root = root;
        }
예제 #5
0
        /// <summary>
        /// This function adds a (literal) string to the group box, in the specified writing system
        /// (and returns the builder, in case we want to do more).
        /// </summary>
        public ViewBuilder AddString(string content, int ws)
        {
            var actualWs = ws;

            if (ws == 0)
            {
                var factory = Root.RendererFactory;
                if (factory != null)
                {
                    actualWs = factory.UserWs;
                }
            }
            var     run  = new StringClientRun(content, NestedBoxStyles.WithWs(actualWs));
            ParaBox para = InsertParaOrRun(run);

            return(this);
        }
예제 #6
0
        private ParaBox InsertParaOrRun(TextClientRun run)
        {
            var para = m_destination as ParaBox;

            if (para != null)
            {
                ((ParaBox)m_destination).InsertRun(m_insertRunAt, run);
                m_insertRunAt++;
            }
            else
            {
                var runs = new List <IClientRun>();
                runs.Add(run);
                var source = new TextSource(runs);
                para = new ParaBox(m_destination.Style, source);
                InsertBox(para);
            }
            return(para);
        }
예제 #7
0
        private void InitSeveralBoxes()
        {
            var     styles = new AssembledStyles();
            RootBox root   = new RootBoxFdo(styles);
            var     items  = new List <IClientRun>();

            items.Add(new BlockBox(styles, Color.Red, 72000, 36000));
            items.Add(new BlockBox(styles, Color.Blue, 36000, 18000));
            items.Add(new BlockBox(styles, Color.Orange, 18000, 36000));
            items.Add(new BlockBox(styles, Color.Green, 72000, 18000));
            items.Add(new ImageBox(styles.WithBackColor(Color.Pink).WithBorderColor(Color.Blue)
                                   .WithBorders(new Thickness(2.0)).WithPads(new Thickness(4.0)), new Icon(SystemIcons.Shield, 40, 40).ToBitmap()));
            items.Add(new BlockBox(styles, Color.Yellow, 72000, 36000));
            var source = new TextSource(items);
            var para   = new ParaBox(styles, source);

            root.AddBox(para);
            theSharpView.Root = root;
        }
예제 #8
0
        public void SimpleString()
        {
            ParaBox        para;
            RootBox        root   = ParaBuilderTests.MakeTestParaSimpleString(m_gm.VwGraphics, ParaBuilderTests.MockBreakOption.ThreeFullLines, out para);
            PaintTransform ptrans = new PaintTransform(2, 4, 96, 100, 0, -10, 120, 128);

            root.Paint(m_gm.VwGraphics, ptrans);

            ParaBox pb = root.FirstBox as ParaBox;

            Assert.IsNotNull(pb);
            StringBox first = pb.FirstBox as StringBox;

            Assert.IsNotNull(first);
            MockSegment seg1 = first.Segment as MockSegment;

            Assert.IsNotNull(seg1);
            Assert.AreEqual(m_gm.VwGraphics, seg1.LastDrawTextCall.vg);
            Assert.AreEqual(0, seg1.LastDrawTextCall.ichBase);
            VerifySimpleRect(seg1.LastDrawTextCall.rcSrc, -2, -4, 96, 100);
            VerifySimpleRect(seg1.LastDrawTextCall.rcDst, 0, 10, 120, 128);

            StringBox second = first.Next as StringBox;

            Assert.IsNotNull(second);
            MockSegment seg2 = second.Segment as MockSegment;

            Assert.IsNotNull(seg2);
            VerifySimpleRect(seg2.LastDrawTextCall.rcSrc, -2, -14, 96, 100);
            VerifySimpleRect(seg2.LastDrawTextCall.rcDst, 0, 10, 120, 128);

            StringBox third = second.Next as StringBox;

            Assert.IsNotNull(third);
            MockSegment seg3 = third.Segment as MockSegment;

            Assert.IsNotNull(seg3);
            VerifySimpleRect(seg3.LastDrawTextCall.rcSrc, -2, -24, 96, 100);
            VerifySimpleRect(seg3.LastDrawTextCall.rcDst, 0, 10, 120, 128);

            Assert.AreEqual(root, third.Root);
        }
        private ParaBox MakePara(MockSequenceHookup hookup, AssembledStyles styles, MockData1 itemNew, string contents, RootBox root)
        {
            var newItemHookup = new ItemHookup(itemNew, null);

            hookup.InsertChildHookup(newItemHookup, 1);
            // Give that hookup a stringhookup child, connected to a paragraph and root box.
            var clientRuns = new List <IClientRun>();

            itemNew.SimpleThree = contents;
            var run = new StringClientRun(contents, styles);

            clientRuns.Add(run);
            var source = new TextSource(clientRuns, null);
            var para   = new ParaBox(styles, source);

            run.Hookup = new LiteralStringParaHookup(itemNew, para);
            newItemHookup.InsertChildHookup(run.Hookup, 0);
            root.AddBox(para);
            return(para);
        }
예제 #10
0
        public void PaintParaBox()
        {
            AssembledStyles styles     = new AssembledStyles();
            var             clientRuns = new List <IClientRun>();
            BlockBox        box0       = new BlockBox(styles, Color.Red, 72000, 36000);

            clientRuns.Add(box0);
            BlockBox box1 = new BlockBox(styles, Color.Blue, 36000, 18000);

            clientRuns.Add(box1);
            BlockBox box2 = new BlockBox(styles, Color.Red, 24000, 18000);

            clientRuns.Add(box2);
            BlockBox box3 = new BlockBox(styles, Color.Red, 72000, 36000);

            clientRuns.Add(box3);
            BlockBox box4 = new BlockBox(styles, Color.Red, 36000, 36000);

            clientRuns.Add(box4);

            TextSource source = new TextSource(clientRuns, null);
            ParaBox    para   = new ParaBox(styles, source);
            RootBox    root   = new RootBox(styles);

            root.AddBox(para);

            MockGraphics graphics   = new MockGraphics();
            LayoutInfo   layoutArgs = ParaBuilderTests.MakeLayoutInfo(100, graphics);

            root.Layout(layoutArgs);

            PaintTransform ptrans = new PaintTransform(2, 2, 96, 96, 0, 0, 96, 96);

            root.Paint(graphics, ptrans);
            Assert.AreEqual(5, graphics.RectanglesDrawn.Count);
            VerifyRect(2, 2, 96, 48, graphics, 0, Color.Red);
            VerifyRect(2, 48 + 2, 48, 24, graphics, 1, Color.Blue);
            VerifyRect(2 + 48, 48 + 2, 32, 24, graphics, 2, Color.Red);
            VerifyRect(2, 24 + 48 + 2, 96, 48, graphics, 3, Color.Red);
            VerifyRect(2, 48 + 24 + 48 + 2, 48, 48, graphics, 4, Color.Red);
        }
예제 #11
0
 protected virtual void MakeHookupForString(Func <IViewMultiString> fetcher, MlsClientRun run, string name, object target, ParaBox para)
 {
     // In this SharpViewsLight base class we have no alternate strategy. We won't get notifications of changes.
 }
예제 #12
0
        public void DragStartsOnMoveInSelection()
        {
            string contents = "This is the day.";
            var    engine   = new FakeRenderEngine()
            {
                Ws = 34, SegmentHeight = 13
            };
            var factory = new FakeRendererFactory();

            factory.SetRenderer(34, engine);
            var styles     = new AssembledStyles().WithWs(34);
            var clientRuns = new List <IClientRun>();
            var run        = new StringClientRun(contents, styles);

            clientRuns.Add(run);
            var source   = new TextSource(clientRuns, null);
            var para     = new ParaBox(styles, source);
            var extraBox = new BlockBox(styles, Color.Red, 50, 72000);             // tall, narrow spacer at top
            var root     = new RootBoxFdo(styles);

            root.AddBox(extraBox);
            root.AddBox(para);
            var layoutArgs = MakeLayoutInfo(Int32.MaxValue / 2, m_gm.VwGraphics, factory);

            root.Layout(layoutArgs);
            Assert.That(root.Height, Is.EqualTo(96 + 13));
            Assert.That(root.Width, Is.EqualTo(FakeRenderEngine.SimulatedWidth(contents)));

            var ip1   = run.SelectAt(para, 5, false);
            var ip2   = run.SelectAt(para, 7, true);
            var range = new RangeSelection(ip1, ip2);

            range.Install();
            PaintTransform ptrans = new PaintTransform(2, 2, 96, 96, 0, 0, 96, 96);
            var            sbox   = para.FirstBox as StringBox;
            MockSite       site   = new MockSite();

            site.m_transform  = ptrans;
            site.m_vwGraphics = m_gm.VwGraphics;
            root.Site         = site;
            int indent = FakeRenderEngine.SimulatedWidth("This ");

            root.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, indent + 5, 100, 0), Keys.None, m_gm.VwGraphics, ptrans);
            root.OnMouseMove(new MouseEventArgs(MouseButtons.Left, 1, indent + 5, 100, 0), Keys.None, m_gm.VwGraphics, ptrans);
            Assert.That(GetStringDropData(site), Is.EqualTo("is"));
            Assert.That(site.LastDoDragDropArgs.AllowedEffects, Is.EqualTo(DragDropEffects.Copy),
                        "editing not possible in this paragraph, we can only copy");
            Assert.That(root.Selection, Is.EqualTo(range), "selection should not be changed by drag drop");
            site.LastDoDragDropArgs = null;
            root.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 3, 100, 0), Keys.None, m_gm.VwGraphics, ptrans);
            Assert.That(site.LastDoDragDropArgs, Is.Null, "click outside selection should not initiate drag");

            // Tack on an extra check that a read-only view does not handle drop.
            var dataObj  = new DataObject(DataFormats.StringFormat, "new ");
            var dragArgs = new DragEventArgs(dataObj, (int)DragDropKeyStates.ControlKey, 10, 8,
                                             DragDropEffects.Copy | DragDropEffects.Move,
                                             DragDropEffects.None);

            root.OnDragEnter(dragArgs, new Point(14, 8), m_gm.VwGraphics, ptrans);
            Assert.That(dragArgs.Effect, Is.EqualTo(DragDropEffects.None));
            Assert.That(root.DragState, Is.EqualTo(WindowDragState.DraggingHere));
        }
예제 #13
0
 private void VerifySelLocation(ParaBox para, StringBox third, MockSegment seg3, int top)
 {
     VerifySelLocation(para, third, seg3.LastPosIpCall, top);
 }
예제 #14
0
        private void VerifyRangeSegmentDrawing(ParaBox para, StringBox stringBox, FakeSegment seg, int ichMin, int ichLim, int top, int ydTop, int bottom)
        {
            var args = seg.LastDrawRangeCall;

            VerifyRangeDrawingArgs(args, stringBox, ichMin, ichLim, top, ydTop, bottom);
        }
예제 #15
0
파일: Form1.cs 프로젝트: bbriggs/FieldWorks
		private void InitSeveralBoxes()
		{
			AssembledStyles styles = new AssembledStyles();
			RootBox root = new RootBox(styles);
			var items = new List<ClientRun>();
			items.Add(new BlockBox(styles, Color.Red, 72000, 36000));
			items.Add(new BlockBox(styles, Color.Blue, 36000, 18000));
			items.Add(new BlockBox(styles, Color.Orange, 18000, 36000));
			items.Add(new BlockBox(styles, Color.Green, 72000, 18000));
			items.Add(new BlockBox(styles, Color.Yellow, 72000, 36000));
			TextSource source = new TextSource(items);
			ParaBox para = new ParaBox(styles, source);
			root.AddBox(para);
			theSharpView.Root = root;
		}
예제 #16
0
 /// <summary>
 /// This overload fulfils the interface contract for some kinds of Box to function as ClientRun.
 /// In general a box can select at end without needing to know its containing paragraph (if any) or index within it.
 /// </summary>
 public InsertionPoint SelectAtEnd(ParaBox para)
 {
     return(SelectAtEnd());
 }
예제 #17
0
        public void FlashInsertionPoint()
        {
            AssembledStyles styles     = new AssembledStyles();
            var             clientRuns = new List <IClientRun>();
            BlockBox        box0       = new BlockBox(styles, Color.Red, 72000, 36000);

            clientRuns.Add(box0);
            TextSource source = new TextSource(clientRuns, null);
            ParaBox    para   = new ParaBox(styles, source);
            RootBox    root   = new RootBox(styles);

            root.AddBox(para);
            MockGraphics graphics   = new MockGraphics();
            LayoutInfo   layoutArgs = ParaBuilderTests.MakeLayoutInfo(100, graphics);

            root.Layout(layoutArgs);

            var sel = new DummySelection();

            root.Selection = sel;

            PaintTransform ptrans = new PaintTransform(2, 2, 96, 96, 0, 0, 96, 96);

            root.Paint(graphics, ptrans);

            Assert.AreEqual(graphics, sel.VgUsedToDraw);
            Assert.AreEqual(ptrans, sel.TransformUsedToDraw);

            sel.ClearResults();
            root.FlashInsertionPoint();

            Assert.IsFalse(sel.WasInvalidated, "flash IP should not cause range to be invalidated");

            var ip = new DummySelection();

            ip.SimulateIP  = true;
            root.Selection = ip;
            Assert.IsTrue(ip.WasInvalidated);

            // Initial paint after being installed should indeed paint the IP (so it appears at once)
            ip.ClearResults();
            root.Paint(graphics, ptrans);
            Assert.AreEqual(graphics, ip.VgUsedToDraw);
            Assert.AreEqual(ptrans, ip.TransformUsedToDraw);


            // Each flash should invalide it.
            sel.ClearResults();
            root.FlashInsertionPoint();
            Assert.IsTrue(ip.WasInvalidated);

            // The second paint should do nothing to the IP.
            ip.ClearResults();
            root.Paint(graphics, ptrans);
            Assert.AreEqual(null, ip.VgUsedToDraw);

            // One more flash
            ip.ClearResults();
            root.FlashInsertionPoint();
            Assert.IsTrue(ip.WasInvalidated);

            // And now back to drawing the IP.
            ip.ClearResults();
            root.Paint(graphics, ptrans);
            Assert.AreEqual(graphics, ip.VgUsedToDraw);
            Assert.AreEqual(ptrans, ip.TransformUsedToDraw);

            // range should get drawn even though IP was hidden.
            root.FlashInsertionPoint();       // back to hidden
            root.Selection = sel;             // back to range.
            sel.ClearResults();
            root.Paint(graphics, ptrans);
            Assert.AreEqual(graphics, sel.VgUsedToDraw);
            Assert.AreEqual(ptrans, sel.TransformUsedToDraw);
        }
예제 #18
0
        public void ValidSelections()
        {
            AssembledStyles styles     = new AssembledStyles();
            var             clientRuns = new List <IClientRun>();
            var             run0       = new StringClientRun("First run", styles);
            var             run1       = new StringClientRun("Middle run", styles);
            BlockBox        box0       = new BlockBox(styles, Color.Red, 72000, 36000);
            var             run2       = new StringClientRun("Last run", styles);

            clientRuns.Add(run0);
            clientRuns.Add(run1);
            clientRuns.Add(box0);
            clientRuns.Add(run2);
            TextSource source = new TextSource(clientRuns, null);
            ParaBox    para0  = new ParaBox(styles, source);

            run0.Hookup = new LiteralStringParaHookup(para0, para0);
            run1.Hookup = new LiteralStringParaHookup(para0, para0);
            run2.Hookup = new LiteralStringParaHookup(para0, para0);
            DivBox  div  = new DivBox(styles);
            RootBox root = new RootBox(styles);

            para0.Container = div;
            MockGraphics graphics   = new MockGraphics();
            LayoutInfo   layoutArgs = ParaBuilderTests.MakeLayoutInfo(100, graphics);

            root.Layout(layoutArgs);

            root.AddBox(div);
            var sel = para0.SelectAtStart();

            root.Selection = sel;

            Assert.That(!root.Selection.IsValid);

            div.AddBox(para0);
            root.RemoveBoxes(div, div);
            div.Container = root;

            Assert.That(!root.Selection.IsValid);

            root.AddBox(div);

            Assert.That(root.Selection.IsValid);

            (root.Selection as InsertionPoint).Hookup.ClientRunIndex = 4;

            Assert.That(!root.Selection.IsValid);

            (root.Selection as InsertionPoint).Hookup.ClientRunIndex = 2;

            Assert.That(!root.Selection.IsValid);

            (root.Selection as InsertionPoint).Hookup.ClientRunIndex = 0;
            (root.Selection as InsertionPoint).StringPosition        = 10;

            Assert.That(!root.Selection.IsValid);

            (root.Selection as InsertionPoint).StringPosition = 0;
            run0.Hookup = null;

            Assert.That(!root.Selection.IsValid);

            run0.Hookup    = new LiteralStringParaHookup(para0, para0);
            sel            = para0.SelectAtStart();
            root.Selection = sel;

            Assert.That(root.Selection.IsValid);
        }
예제 #19
0
 private void VerifySegmentDrawing(ParaBox para, StringBox third, MockSegment seg3, int top)
 {
     VerifySegmentDrawing(para, third, seg3.LastDrawIpCall, top);
 }
예제 #20
0
        private void VerifyRangeSegmentQuery(ParaBox para, StringBox stringBox, FakeSegment seg, int ichMin, int ichLim, int top, int ydTop, int bottom)
        {
            var args = seg.LastPositionOfRangeArgs;

            VerifyRangeDrawingArgs(args, stringBox, ichMin, ichLim, top, ydTop, bottom);
        }
예제 #21
0
        /// <summary>
        /// Given a function that fetches strings, a run which represents the initial value of that string
        /// already inserted into a particular paragraph box, and that we have identified the fetcher as
        /// a property with the specified name of the specified target object, but we have not been able to find
        /// a ''Name'Changed' event on the target object, this stub provides a possible place for a subclass to
        /// use an alternative strategy for hooking something up to notify the view of changes to the property.
        /// </summary>
        protected override void MakeHookupForString(Func <ITsString> fetcher, TssClientRun run, string name, object target, ParaBox para)
        {
            var cmObj = target as ICmObject;

            if (cmObj != null)
            {
                // Set up for PropChanged notification.
                RootFdo.DataAccess = cmObj.Cache.DomainDataByFlid;                 // ensures hooked up to receive PropChanged.
                Tuple <int, int> key = GetPropChangedKey(name, cmObj);
                var stringHookup     = new TssHookup(target, fetcher,
                                                     hookup => RootFdo.AddHookupToPropChanged(key, hookup),
                                                     hookup => RootFdo.RemoveHookupFromPropChanged(key, hookup),
                                                     para);
                stringHookup.Tag = key.Item2;
                AddHookupToRun(run, stringHookup);
                // Enhance JohnT: consider doing this by reflection.
                stringHookup.Writer = newVal => RootFdo.DataAccess.SetString(cmObj.Hvo, key.Item2, newVal);
            }
        }
예제 #22
0
        public void InsertGrowsPara()
        {
            string contents = "This is the day.";
            var    engine   = new FakeRenderEngine()
            {
                Ws = 34, SegmentHeight = 13
            };
            var factory = new FakeRendererFactory();

            factory.SetRenderer(34, engine);
            var styles     = new AssembledStyles().WithWs(34);
            var clientRuns = new List <IClientRun>();
            var run        = new StringClientRun(contents, styles);

            clientRuns.Add(run);
            var data1 = new MockData1(34, 35);

            data1.SimpleThree = contents;
            var source = new TextSource(clientRuns, null);
            var para   = new ParaBox(styles, source);
            var hookup = new StringHookup(this, () => data1.SimpleThree, hook => data1.SimpleThreeChanged += hook.StringPropChanged,
                                          hook => data1.SimpleThreeChanged -= hook.StringPropChanged, para);

            hookup.Writer = newVal => data1.SimpleThree = newVal;
            run.Hookup    = hookup;
            var extraBox = new BlockBox(styles, Color.Red, 50, 72000);
            var root     = new RootBoxFdo(styles);

            root.SizeChanged += root_SizeChanged;
            root.AddBox(para);
            root.AddBox(extraBox);
            var layoutArgs = MakeLayoutInfo(Int32.MaxValue / 2, m_gm.VwGraphics, factory);

            root.Layout(layoutArgs);
            Assert.IsTrue(m_sizeChangedCalled);
            Assert.That(root.Height, Is.EqualTo(13 + 96));
            Assert.That(root.Width, Is.EqualTo(FakeRenderEngine.SimulatedWidth(contents)));

            int widthThisIsThe = FakeRenderEngine.SimulatedWidth("This is the");

            layoutArgs = MakeLayoutInfo(widthThisIsThe + 2, m_gm.VwGraphics, factory);
            root.Layout(layoutArgs);
            Assert.That(root.Height, Is.EqualTo(26 + 96), "two line para is twice the height");
            Assert.That(root.Width, Is.EqualTo(widthThisIsThe + 2), "two-line para occupies full available width");
            Assert.That(extraBox.Top, Is.EqualTo(26));

            PaintTransform ptrans = new PaintTransform(2, 4, 96, 100, 0, 10, 120, 128);
            MockSite       site   = new MockSite();

            site.m_transform    = ptrans;
            site.m_vwGraphics   = m_gm.VwGraphics;
            root.Site           = site;
            m_sizeChangedCalled = false;
            var ip = para.SelectAtEnd();

            ip.InsertText(" We will be");
            Assert.That(para.Height, Is.EqualTo(39), "inserted text makes para a line higher");
            Assert.That(root.Height, Is.EqualTo(39 + 96), "root grows when para does");
            Assert.That(root.Width, Is.EqualTo(widthThisIsThe + 2), "three-line para occupies full available width");
            Assert.That(extraBox.Top, Is.EqualTo(39));
            Assert.IsTrue(m_sizeChangedCalled);
        }
예제 #23
0
 /// <summary>
 /// This overload fulfils the interface contract for some kinds of Box to function as ClientRun.
 /// In general a box can select at start without needing to know its containing paragraph (if any) or index within it.
 /// </summary>
 public InsertionPoint SelectAtStart(ParaBox para)
 {
     return(SelectAtStart());
 }
예제 #24
0
파일: Form1.cs 프로젝트: bbriggs/FieldWorks
		// Add to the root a text paragraph which reflects the SimpleText property.
		private void AddSimpleTextPara(AssembledStyles styles, int ws, RootBox root)
		{
			var items = new List<ClientRun>();
			var run = new StringClientRun("This is the day that the Lord has made. We will rejoice and be glad in it",
										  styles.WithWs(ws));
			items.Add(run);
			TextSource source = new TextSource(items);
			ParaBox para = new ParaBox(styles, source);
			var hookup = new StringHookup(this, () => this.SimpleText,
										  hook => SimpleTextChanged += hook.StringPropChanged,
										  hook => SimpleTextChanged -= hook.StringPropChanged, para);
			hookup.Writer = newVal => SimpleText = newVal;
			run.Hookup = hookup;
			root.AddBox(para);
		}