Пример #1
0
        public override Box CreateBox()
        {
            var box = baseAtom.CreateBox();

            box.shift -= offset;
            return(HorizontalBox.Get(box));
        }
Пример #2
0
 public Page2(string name, Tab tab, HorizontalBox main, Page1 page1) : base(name)
 {
     _mainTab = tab;
     _mainBox = main;
     _page1   = page1;
     InitializeComponent();
 }
Пример #3
0
        private Box LongDivisionStyle_shortstackedrightright(TexEnvironment environment)
        {
            var texFont = environment.MathFont;
            var style   = environment.Style;
            var axis    = texFont.GetAxisHeight(style);
            var defaultLineThickness = texFont.GetDefaultLineThickness(style);

            var divisor_quotient = new VerticalBox();
            var divisorbox       = this.DivisorAtom == null ? StrutBox.Empty : this.DivisorAtom.CreateBox(environment);
            var quotientbox      = this.QuotientAtom == null ? StrutBox.Empty : this.QuotientAtom.CreateBox(environment);
            var hlineseparator   = new HorizontalRule(environment, defaultLineThickness, quotientbox.TotalWidth, 0);

            divisor_quotient.Add(divisorbox);
            divisor_quotient.Add(hlineseparator);
            divisor_quotient.Add(quotientbox);

            var dividend_other = new VerticalBox();
            var dividendbox    = this.DividendAtom == null ? StrutBox.Empty : this.DividendAtom.CreateBox(environment);
            var otherbox       = this.OtherAtom == null ? StrutBox.Empty : this.OtherAtom.CreateBox(environment);

            dividend_other.Add(dividendbox);
            dividend_other.Add(otherbox);

            //double divquotheightsum =divisor_quotient.TotalHeight;
            var vlineseparator = new VerticalRule(environment, defaultLineThickness, divisorbox.TotalHeight + defaultLineThickness, -divisorbox.TotalHeight);

            var resultBox = new HorizontalBox();

            resultBox.Add(dividend_other);
            resultBox.Add(vlineseparator);
            resultBox.Add(divisor_quotient);

            return(resultBox);
        }
Пример #4
0
        public override Box CreateBox(TexStyle style)
        {
            if (BaseAtom == null)
            {
                return(StrutBox.Empty);
            }
            else
            {
                Box box;
                if (UnderLink)
                {
                    var   baseBox = BaseAtom.CreateBox(style);
                    float margin  = TEXConfiguration.main.NegateMargin * TexUtility.SizeFactor(style) / 2;
                    float thick   = TEXConfiguration.main.LineThickness * TexUtility.SizeFactor(style) / 2;

                    box = HorizontalBox.Get(baseBox);
                    box.Add(StrutBox.Get(-box.width, 0, 0, 0));
                    box.Add(StrikeBox.Get(baseBox.height, baseBox.width, baseBox.depth,
                                          margin, thick, StrikeBox.StrikeMode.underline, 0, 0));
                    return(AttrLinkBox.Get(box, MetaKey));
                }
                else
                {
                    return(AttrLinkBox.Get(BaseAtom.CreateBox(style), MetaKey));
                }
            }
        }
Пример #5
0
        public override Box CreateBox()
        {
            if (BaseAtom == null)
            {
                return(StrutBox.Empty);
            }
            else
            {
                if (UnderLink)
                {
                    var baseBox = BaseAtom.CreateBox();
                    var box     = HorizontalBox.Get(baseBox);

                    float factor = TexContext.Scale / 2;
                    float thick  = TEXConfiguration.main.LineThickness * factor;

                    box.Add(StrutBox.Get(-box.width, 0, 0, 0));
                    box.Add(StrikeBox.Get(baseBox.height, baseBox.width, baseBox.depth,
                                          0, thick, StrikeBox.StrikeMode.underline, 0, 0));

                    return(AttrLinkBox.Get(box, MetaKey, Margin));
                }
                else
                {
                    return(AttrLinkBox.Get(BaseAtom.CreateBox(), MetaKey, Margin));
                }
            }
        }
Пример #6
0
        protected override Box CreateBoxCore(TexEnvironment environment)
        {
            // Create boxes for base, delimeter, and script atoms.
            var baseBox      = this.BaseAtom == null ? StrutBox.Empty : this.BaseAtom.CreateBox(environment);
            var delimeterBox = DelimiterFactory.CreateBox(this.Symbol.Name, baseBox.Width, environment);
            var scriptBox    = this.Script == null ? null : this.Script.CreateBox(this.Over ?
                                                                                  environment.GetSuperscriptStyle() : environment.GetSubscriptStyle());

            // Create centered horizontal box if any box is smaller than maximum width.
            var maxWidth = GetMaxWidth(baseBox, delimeterBox, scriptBox);

            if (Math.Abs(maxWidth - baseBox.Width) > TexUtilities.FloatPrecision)
            {
                baseBox = new HorizontalBox(baseBox, maxWidth, TexAlignment.Center);
            }
            if (Math.Abs(maxWidth - delimeterBox.Height - delimeterBox.Depth) > TexUtilities.FloatPrecision)
            {
                delimeterBox = new VerticalBox(delimeterBox, maxWidth, TexAlignment.Center);
            }
            if (scriptBox != null && Math.Abs(maxWidth - scriptBox.Width) > TexUtilities.FloatPrecision)
            {
                scriptBox = new HorizontalBox(scriptBox, maxWidth, TexAlignment.Center);
            }

            return(new OverUnderBox(baseBox, delimeterBox, scriptBox, this.Kern.CreateBox(environment).Height, this.Over));
        }
Пример #7
0
        private Box LongDivision__colon__right__equals__right(TexEnvironment environment)
        {
            var divisor_dividend_quotient = new HorizontalBox();

            var dividendbox = this.DividendAtom == null ? StrutBox.Empty : this.DividendAtom.CreateBox(environment);
            var leftsep     = SymbolAtom.GetAtom("colon", this.Source).CreateBox(environment);
            var divisorbox  = this.DivisorAtom == null ? StrutBox.Empty : this.DivisorAtom.CreateBox(environment);
            var rightsep    = SymbolAtom.GetAtom("equals", this.Source).CreateBox(environment);
            var quotientbox = this.QuotientAtom == null ? StrutBox.Empty : this.QuotientAtom.CreateBox(environment);

            divisor_dividend_quotient.Add(dividendbox);
            divisor_dividend_quotient.Add(leftsep);
            divisor_dividend_quotient.Add(divisorbox);
            divisor_dividend_quotient.Add(rightsep);
            divisor_dividend_quotient.Add(quotientbox);

            var otherbox = this.OtherAtom == null ? StrutBox.Empty : this.OtherAtom.CreateBox(environment);


            var resultBox = new VerticalBox();

            resultBox.Add(divisor_dividend_quotient);
            resultBox.Add(otherbox);

            return(resultBox);
        }
Пример #8
0
        private void InitializeComponent()
        {
            _mainBox   = new HorizontalBox();
            this.Child = _mainBox;

            _outerTab = new Tab();
            _mainBox.Children.Add(_outerTab, true);

            _mainTabPage = new MainTabPage("Pages 1-5", _mainBox, this);
            _outerTab.Children.Add(_mainTabPage);
        }
Пример #9
0
        public override Box CreateBox()
        {
            var box = BaseAtom.CreateBox();

            // Centre box relative to horizontal axis.
            var totalHeight = box.height + box.depth;
            var axis        = TEXConfiguration.main.AxisHeight * TexContext.Scale;

            box.shift = -(totalHeight / 2) - axis;

            return(HorizontalBox.Get(box));
        }
        public override Box CreateBox(TexStyle style)
        {
            var box = BaseAtom.CreateBox(style);

            // Centre box relative to horizontal axis.
            var totalHeight = box.height + box.depth;
            var axis        = TEXConfiguration.main.AxisHeight * TexUtility.SizeFactor(style);

            box.shift = -(totalHeight / 2) - axis;

            return(HorizontalBox.Get(box));
        }
Пример #11
0
        private void InitializeComponent()
        {
            _mainBox   = new HorizontalBox();
            this.Child = _mainBox;

            _outerTab = new Tab();
            _mainBox.Children.Add(_outerTab, true);
            var s = new Area(new Program.AHandler());

            _mainBox.Children.Add(s, true);
            //_mainTabPage = new MainTabPage("Pages 1-5", _mainBox, this);
            //_outerTab.Children.Add(_mainTabPage);
        }
Пример #12
0
        protected override Box CreateBoxCore(TexEnvironment environment)
        {
            var texFont = environment.MathFont;
            var style   = environment.Style;

            // Create box for base atom.
            var baseBox = this.BaseAtom.CreateBox(environment);

            // Create result box.
            var resultBox = new HorizontalBox();
            var axis      = texFont.GetAxisHeight(style);
            var delta     = Math.Max(baseBox.Height - axis, baseBox.Depth + axis);
            var minHeight = Math.Max((delta / 500) * delimeterFactor, 2 * delta - delimeterShortfall);

            // Create and add box for left delimeter.
            if (this.LeftDelimeter != null && this.LeftDelimeter.Name != SymbolAtom.EmptyDelimiterName)
            {
                var leftDelimeterBox = DelimiterFactory.CreateBox(this.LeftDelimeter.Name, minHeight, environment);
                leftDelimeterBox.Source = this.LeftDelimeter.Source;
                CentreBox(leftDelimeterBox, axis);
                resultBox.Add(leftDelimeterBox);
            }

            // add glueElement between left delimeter and base Atom, unless base Atom is whitespace.
            if (!(this.BaseAtom is SpaceAtom))
            {
                resultBox.Add(Glue.CreateBox(TexAtomType.Opening, this.BaseAtom.GetLeftType(), environment));
            }

            // add box for base Atom.
            resultBox.Add(baseBox);

            // add glueElement between right delimeter and base Atom, unless base Atom is whitespace.
            if (!(this.BaseAtom is SpaceAtom))
            {
                resultBox.Add(Glue.CreateBox(this.BaseAtom.GetRightType(), TexAtomType.Closing, environment));
            }

            // Create and add box for right delimeter.
            if (this.RightDelimeter != null && this.RightDelimeter.Name != SymbolAtom.EmptyDelimiterName)
            {
                var rightDelimeterBox = DelimiterFactory.CreateBox(this.RightDelimeter.Name, minHeight, environment);
                rightDelimeterBox.Source = this.RightDelimeter.Source;
                CentreBox(rightDelimeterBox, axis);
                resultBox.Add(rightDelimeterBox);
            }

            return(resultBox);
        }
Пример #13
0
        private Box Enclosure_roundedbox(TexEnvironment environment, Box morphbox)
        {
            var texFont = environment.MathFont;
            var style   = environment.Style;
            var axis    = texFont.GetAxisHeight(style);
            var defaultLineThickness = texFont.GetDefaultLineThickness(style);

            var recbox    = new RoundedRectangleBox(environment, morphbox.Height + morphbox.Depth, morphbox.TotalWidth, 0, 4, 4);
            var resultbox = new HorizontalBox();

            resultbox.Add(morphbox);
            resultbox.Add(new StrutBox(-morphbox.Width, -morphbox.Height, 0, 0));
            resultbox.Add(recbox);
            return(resultbox);
        }
Пример #14
0
        private Box Enclosure_verticalstrike(TexEnvironment environment, Box morphbox)
        {
            var texFont = environment.MathFont;
            var style   = environment.Style;
            var axis    = texFont.GetAxisHeight(style);
            var defaultLineThickness = texFont.GetDefaultLineThickness(style);

            var vrule = new VerticalRule(environment, defaultLineThickness, morphbox.Height + morphbox.Depth, -morphbox.Height);
            var resbx = new HorizontalBox();

            resbx.Add(morphbox);
            resbx.Add(new StrutBox(-morphbox.Width / 2, -morphbox.Height, 0, 0));
            resbx.Add(vrule);
            return(resbx);
        }
Пример #15
0
        private Box Enclosure_bottom(TexEnvironment environment, Box morphbox)
        {
            var texFont = environment.MathFont;
            var style   = environment.Style;
            var axis    = texFont.GetAxisHeight(style);
            var defaultLineThickness = texFont.GetDefaultLineThickness(style);

            var hrule = new HorizontalRule(environment, defaultLineThickness, morphbox.Width, 0);
            var resbx = new HorizontalBox();

            resbx.Add(morphbox);
            resbx.Add(new StrutBox(-morphbox.Width, -morphbox.Height + hrule.Height, 0, 0));
            resbx.Add(hrule);
            return(resbx);
        }
Пример #16
0
        protected override Box CreateBoxCore(TexEnvironment environment)
        {
            var resultBox   = new HorizontalBox();
            var innermatrix = this.BaseAtom == null ? StrutBox.Empty : this.BaseAtom.CreateBox(environment);
            var heightdiff  = innermatrix.Depth - innermatrix.Height;

            var leftparen = DelimiterFactory.CreateBox("lbrace", innermatrix.TotalHeight + heightdiff, environment);

            leftparen.Shift   = -innermatrix.Height;
            innermatrix.Shift = heightdiff / 2;
            resultBox.Add(leftparen);
            resultBox.Add(innermatrix);

            return(resultBox);
        }
Пример #17
0
        private Box Enclosure_downdiagonalstrike(TexEnvironment environment, Box morphbox)
        {
            var texFont = environment.MathFont;
            var style   = environment.Style;
            var axis    = texFont.GetAxisHeight(style);
            var defaultLineThickness = texFont.GetDefaultLineThickness(style);

            var ddrule = new DownDiagonalRule(environment, 1, -morphbox.TotalWidth, morphbox.TotalHeight, -morphbox.TotalHeight);
            var resbx  = new HorizontalBox();

            resbx.Add(morphbox);
            resbx.Add(new StrutBox(-morphbox.Width, -morphbox.Height, 0, 0));
            resbx.Add(ddrule);
            return(resbx);
        }
Пример #18
0
        protected override Box CreateBoxCore(TexEnvironment environment)
        {
            var texFont = environment.MathFont;
            var style   = environment.Style;
            var axis    = texFont.GetAxisHeight(style);
            var defaultLineThickness = texFont.GetDefaultLineThickness(style);

            var baseBox = this.BaseAtom == null ? StrutBox.Empty : this.BaseAtom.CreateBox(environment);

            var ddrule = new UpDiagonalRule(environment, 1.3, -baseBox.TotalWidth, baseBox.TotalHeight, 0);
            var resbx  = new HorizontalBox();

            resbx.Add(baseBox);
            resbx.Add(new StrutBox(-baseBox.Width, -baseBox.Height, 0, 0));
            resbx.Add(ddrule);
            return(resbx);
        }
Пример #19
0
        private Box Enclosure_circle(TexEnvironment environment, Box morphbox)
        {
            var texFont = environment.MathFont;
            var style   = environment.Style;
            var axis    = texFont.GetAxisHeight(style);
            var defaultLineThickness = texFont.GetDefaultLineThickness(style);

            var orule = new OvalRule(environment, morphbox.Height - morphbox.Depth, morphbox.Width, 0);
            // Create result box.
            var resultBox = new HorizontalBox();

            resultBox.Add(morphbox);
            resultBox.Add(new StrutBox(-morphbox.Width, -morphbox.Height, 0, 0));
            resultBox.Add(orule);

            return(resultBox);
        }
Пример #20
0
        protected override Box CreateBoxCore(TexEnvironment environment)
        {
            var texFont = environment.MathFont;
            var style   = environment.Style;

            // Create box for base atom.
            var baseBox = this.BaseAtom == null ? StrutBox.Empty : this.BaseAtom.CreateBox(environment);

            if (this.SubscriptAtom == null && this.SuperscriptAtom == null)
            {
                if (baseBox is CharBox)
                {
                    // This situation should only happen when CreateBox called on a temporary ScriptsAtom created from
                    // BigOperatorAtom.CreateBox. The CharBox's Shift should then be fixed up.
                    baseBox.Shift = -(baseBox.Height + baseBox.Depth) / 2
                                    - environment.MathFont.GetAxisHeight(environment.Style);
                }

                return(baseBox);
            }

            // Create result box.
            var resultBox = new HorizontalBox(baseBox);

            // Get last font used or default Mu font.
            int lastFontId = baseBox.GetLastFontId();

            if (lastFontId == TexFontUtilities.NoFontId)
            {
                lastFontId = texFont.GetMuFontId();
            }

            var subscriptStyle   = environment.GetSubscriptStyle();
            var superscriptStyle = environment.GetSuperscriptStyle();

            // Set delta value and preliminary shift-up and shift-down amounts depending on type of base atom.
            var    delta = 0d;
            double shiftUp, shiftDown;

            if (this.BaseAtom is AccentedAtom accentedAtom && accentedAtom.BaseAtom != null)
            {
                var accentedBox = accentedAtom.BaseAtom.CreateBox(environment.GetCrampedStyle());
                shiftUp   = accentedBox.Height - texFont.GetSupDrop(superscriptStyle.Style);
                shiftDown = accentedBox.Depth + texFont.GetSubDrop(subscriptStyle.Style);
            }
Пример #21
0
        public override Box CreateBox()
        {
            if (BaseAtom == null)
                return StrutBox.Empty;
            var factor = TexContext.Scale / 2;
            var margin = useMargin ? TEXConfiguration.main.NegateMargin * factor : 0;
            var thick = TEXConfiguration.main.LineThickness * factor;
            var baseBox = BaseAtom.CreateBox();
            var result = HorizontalBox.Get();

            var negateBox = StrikeBox.Get(baseBox.height, baseBox.width, baseBox.depth,
                                margin, thick, (StrikeBox.StrikeMode)mode, offsetM, offsetP);
            negateBox.shift = baseBox.shift;
            result.Add(negateBox);
            result.Add(StrutBox.Get(-baseBox.width, 0, 0, 0));
            result.Add(baseBox);
            return result;
        }
Пример #22
0
        protected override Box CreateBoxCore(TexEnvironment environment)
        {
            var texFont = environment.MathFont;
            var style   = environment.Style;
            var defaultRuleThickness = texFont.GetDefaultLineThickness(style);
            var basebox = this.BaseAtom == null ? StrutBox.Empty : this.BaseAtom.CreateBox(environment);

            var rectbox = new RectangleBox(environment, basebox.TotalHeight + 4 * defaultRuleThickness, basebox.TotalWidth + 4 * defaultRuleThickness, 0)
            {
                Shift = basebox.Depth + 2 * defaultRuleThickness
            };
            var resultbox = new HorizontalBox();

            resultbox.Add(basebox);
            resultbox.Add(new StrutBox(-rectbox.TotalWidth + 2 * defaultRuleThickness, -rectbox.TotalHeight, 0, 0));
            resultbox.Add(rectbox);
            return(resultbox);
        }
Пример #23
0
        public override Box CreateBox(TexStyle style)
        {
            if (BaseAtom == null)
            {
                return(StrutBox.Empty);
            }
            var factor  = TexUtility.SizeFactor(style) / 2;
            var margin  = useMargin ? TEXConfiguration.main.NegateMargin * factor : 0;
            var thick   = TEXConfiguration.main.LineThickness * factor;
            var baseBox = BaseAtom.CreateBox(style);
            var result  = HorizontalBox.Get();

            var negateBox = StrikeBox.Get(baseBox.height, baseBox.width, baseBox.depth,
                                          margin, thick, (StrikeBox.StrikeMode)mode, offsetM, offsetP);

            negateBox.shift = baseBox.shift;
            result.Add(negateBox);
            result.Add(StrutBox.Get(-baseBox.width, 0, 0, 0));
            result.Add(baseBox);
            return(result);
        }
Пример #24
0
        private Box LongDivisionStyle_lefttop(TexEnvironment environment)
        {
            var texFont = environment.MathFont;
            var style   = environment.Style;
            var axis    = texFont.GetAxisHeight(style);
            var defaultLineThickness = texFont.GetDefaultLineThickness(style);

            var    dividend_divisor = new HorizontalBox();
            var    divisorbox       = this.DivisorAtom == null ? StrutBox.Empty : this.DivisorAtom.CreateBox(environment);
            var    leftsep          = SymbolAtom.GetAtom("rbrack", this.Source).CreateBox(environment);
            var    dividendbox      = this.DividendAtom == null ? StrutBox.Empty : this.DividendAtom.CreateBox(environment);
            double barwidth         = leftsep.TotalWidth + dividendbox.TotalWidth;
            var    separatorbar     = new HorizontalRule(environment, defaultLineThickness, barwidth, -dividendbox.TotalHeight - defaultLineThickness);


            dividend_divisor.Add(divisorbox);
            dividend_divisor.Add(leftsep);
            dividend_divisor.Add(dividendbox);
            dividend_divisor.Add(new StrutBox(-barwidth, dividendbox.TotalHeight, 0, 0));
            dividend_divisor.Add(separatorbar);

            var quotient_pad      = new HorizontalBox();
            var quotientbox       = this.QuotientAtom == null ? StrutBox.Empty : this.QuotientAtom.CreateBox(environment);
            var leftspace         = dividend_divisor.TotalWidth - quotientbox.TotalWidth;
            var quot_leftspacebox = new StrutBox(leftspace, quotientbox.TotalHeight, 0, 0);

            quotient_pad.Add(quot_leftspacebox);
            quotient_pad.Add(quotientbox);

            var otherbox = this.OtherAtom == null ? StrutBox.Empty : this.OtherAtom.CreateBox(environment);


            var resultBox = new VerticalBox();

            resultBox.Add(quotient_pad);
            resultBox.Add(dividend_divisor);
            resultBox.Add(otherbox);

            return(resultBox);
        }
Пример #25
0
        private void InitializeComponent()
        {
            _container = new VerticalBox();
            this.Child = _container;

            _hBox = new HorizontalBox();
            _container.Children.Add(_hBox);

            _which = new ComboBox();
            DrawTests.PopulateComboboxWithTests(_which);
            _which.SelectedIndex = 0;
            _which.Selected     += (sender, args) =>
            {
                _area.QueueReDrawAll();
            };
            _hBox.Children.Add(_which);

            _area = new Area(new AreaHandler(this));
            _container.Children.Add(_area, true);

            _hBox = new HorizontalBox();
            _container.Children.Add(_hBox);

            _swallowKeys = new CheckBox("Consider key events handled");
            _hBox.Children.Add(_swallowKeys, true);

            _button        = new Button("Enable");
            _button.Click += (sender, args) =>
            {
                EnableArea(true);
            };
            _hBox.Children.Add(_button);

            _button        = new Button("Disable");
            _button.Click += (sender, args) =>
            {
                EnableArea(false);
            };
            _hBox.Children.Add(_button);
        }
Пример #26
0
        protected override Box CreateBoxCore(TexEnvironment environment)
        {
            var resultBox   = new HorizontalBox();
            var innermatrix = this.BaseAtom == null ? StrutBox.Empty : this.BaseAtom.CreateBox(environment);
            var heightdiff  = innermatrix.Depth - innermatrix.Height;

            var leftparen = DelimiterFactory.CreateBox("Vert", innermatrix.TotalHeight, environment);

            leftparen.Shift = -innermatrix.Height + heightdiff;

            var rightparen = DelimiterFactory.CreateBox("Vert", innermatrix.TotalHeight, environment);

            rightparen.Shift = -innermatrix.Height + heightdiff;

            innermatrix.Shift = -(environment.MathFont.GetAxisHeight(environment.Style) - heightdiff) / 3;

            resultBox.Add(leftparen);
            resultBox.Add(innermatrix);
            resultBox.Add(rightparen);

            return(resultBox);
        }
Пример #27
0
 private void InitializeComponent()
 {
     _verticalBox = new VerticalBox {
         AllowPadding = true
     };
     this.Child     = _verticalBox;
     _horizontalBox = new HorizontalBox {
         AllowPadding = true
     };
     _verticalBox.Children.Add(_horizontalBox);
     _button = new Button("Button");
     _horizontalBox.Children.Add(_button);
     _checkBox = new CheckBox("CheckBox");
     _horizontalBox.Children.Add(_checkBox);
     _label = new Label("This is a label. Right now, labels can only span one line.");
     _verticalBox.Children.Add(_label);
     _horizontalSeparator = new Separator();
     _verticalBox.Children.Add(_horizontalSeparator);
     _group = new Group("Entries")
     {
         AllowMargins = true
     };
     _verticalBox.Children.Add(_group, true);
     _form = new Form {
         AllowPadding = true
     };
     _group.Child = _form;
     _entry       = new Entry();
     _form.Children.Add("Entry", _entry);
     _passwordEntry = new PasswordEntry();
     _form.Children.Add("Password Entry", _passwordEntry);
     _searchEntry = new SearchEntry();
     _form.Children.Add("Search Entry", _searchEntry);
     _multilineEntry = new MultilineEntry();
     _form.Children.Add("Multiline Entry", _multilineEntry, true);
     _multilineNoWrappingEntry = new MultilineEntry(false);
     _form.Children.Add("Multiline Entry No Wrap", _multilineNoWrappingEntry, true);
 }
Пример #28
0
        protected override Box CreateBoxCore(TexEnvironment environment)
        {
            var resultBox  = new HorizontalBox();
            var leftmatrix = this.LeftBaseAtom == null ? StrutBox.Empty : this.LeftBaseAtom.CreateBox(environment);
            var heightdiff = leftmatrix.Depth - leftmatrix.Height;

            var vbarseparator = DelimiterFactory.CreateBox("vert", leftmatrix.TotalHeight, environment);

            vbarseparator.Shift = -leftmatrix.Height + heightdiff;

            var rightmatrix = this.RightBaseAtom == null ? StrutBox.Empty : this.RightBaseAtom.CreateBox(environment);
            var heightdiff1 = rightmatrix.Depth - rightmatrix.Height;//apparently, its the same as "heightdiff"

            leftmatrix.Shift  = -(environment.MathFont.GetAxisHeight(environment.Style) - heightdiff) / 3;
            rightmatrix.Shift = -(environment.MathFont.GetAxisHeight(environment.Style) - heightdiff1) / 3;

            resultBox.Add(leftmatrix);
            resultBox.Add(vbarseparator);

            resultBox.Add(rightmatrix);

            return(resultBox);
        }
Пример #29
0
        private void InitializeComponent()
        {
            _hBox = new HorizontalBox()
            {
                AllowPadding = true
            };
            this.Child = _hBox;

            _vBox = new VerticalBox()
            {
                AllowPadding = true
            };
            _hBox.Children.Add(_vBox);

            _spinBoxs = new List <SpinBox>();
            for (int i = 0; i < 10; i++)
            {
                var _spinBox = new SpinBox(0, 100);
                _spinBox.Value         = new Random(DateTime.Now.Millisecond).Next(0, 101);
                _spinBox.ValueChanged += SpinBoxOnValueChanged;
                _vBox.Children.Add(_spinBox);
                _spinBoxs.Add(_spinBox);
            }

            _colorPicker               = new ColorPicker();
            _colorPicker.Color         = (Color)Brushes.Blue;
            _colorPicker.ColorChanged += (sender, args) =>
            {
                _histogram.QueueReDrawAll();
            };

            _vBox.Children.Add(_colorPicker);

            _histogram = new Area(new AreaHandler(_colorPicker, _spinBoxs));
            _hBox.Children.Add(_histogram, true);
        }
Пример #30
0
        private Box LongDivisionStyle_righttop(TexEnvironment environment)
        {
            var texFont = environment.MathFont;
            var style   = environment.Style;
            var axis    = texFont.GetAxisHeight(style);
            var defaultLineThickness = texFont.GetDefaultLineThickness(style);

            var quotientbox = this.QuotientAtom == null ? StrutBox.Empty : this.QuotientAtom.CreateBox(environment);

            var dividend_divisor = new HorizontalBox();
            var dividendbox      = this.DividendAtom == null ? StrutBox.Empty : this.DividendAtom.CreateBox(environment);
            var divisorbox       = this.DivisorAtom == null ? StrutBox.Empty : this.DivisorAtom.CreateBox(environment);
            var divisorLpad      = new StrutBox(divisorbox.TotalWidth / 3, divisorbox.TotalHeight, 0, 0);
            var minorVsepline    = new VerticalRule(environment, defaultLineThickness, dividendbox.TotalHeight, 0);
            var minorHsepline    = new HorizontalRule(environment, defaultLineThickness, divisorbox.TotalWidth + divisorLpad.Width, 0);


            dividend_divisor.Add(dividendbox);
            dividend_divisor.Add(divisorbox);
            dividend_divisor.Add(minorVsepline);
            dividend_divisor.Add(new StrutBox(-(divisorbox.TotalWidth + divisorLpad.Width), 0, 0, 0));
            dividend_divisor.Add(minorHsepline);

            var majorsepline = new HorizontalRule(environment, defaultLineThickness, dividend_divisor.TotalWidth, 0);

            var otherbox = this.OtherAtom == null ? StrutBox.Empty : this.OtherAtom.CreateBox(environment);

            var resultBox = new VerticalBox();

            resultBox.Add(quotientbox);
            resultBox.Add(majorsepline);
            resultBox.Add(dividend_divisor);
            resultBox.Add(otherbox);

            return(resultBox);
        }