예제 #1
0
 /// <summary>Initializes a new instance of the <see cref="T:System.Windows.GridLength" /> structure and specifies what kind of value it holds. </summary>
 /// <param name="value">The initial value of this instance of <see cref="T:System.Windows.GridLength" />.</param>
 /// <param name="type">The <see cref="T:System.Windows.GridUnitType" /> held by this instance of <see cref="T:System.Windows.GridLength" />.</param>
 /// <exception cref="T:System.ArgumentException">
 ///         <paramref name="value" /> is equal to <see cref="F:System.Double.NegativeInfinity" />, <see cref="F:System.Double.PositiveInfinity" />, or <see cref="F:System.Double.NaN" />.</exception>
 // Token: 0x06000718 RID: 1816 RVA: 0x00016844 File Offset: 0x00014A44
 public GridLength(double value, GridUnitType type)
 {
     if (DoubleUtil.IsNaN(value))
     {
         throw new ArgumentException(SR.Get("InvalidCtorParameterNoNaN", new object[]
         {
             "value"
         }));
     }
     if (double.IsInfinity(value))
     {
         throw new ArgumentException(SR.Get("InvalidCtorParameterNoInfinity", new object[]
         {
             "value"
         }));
     }
     if (type != GridUnitType.Auto && type != GridUnitType.Pixel && type != GridUnitType.Star)
     {
         throw new ArgumentException(SR.Get("InvalidCtorParameterUnknownGridUnitType", new object[]
         {
             "type"
         }));
     }
     this._unitValue = ((type == GridUnitType.Auto) ? 0.0 : value);
     this._unitType  = type;
 }
예제 #2
0
        //-------------------------------------------------------------------
        //
        //  Private Methods
        //
        //-------------------------------------------------------------------

        #region Private Methods

        /// <summary>
        /// Compute size for the page.
        /// </summary>
        private Size ComputePageSize(Size constraint)
        {
            double max, min;
            Size   pageSize = new Size(_document.PageWidth, double.PositiveInfinity);

            if (DoubleUtil.IsNaN(pageSize.Width))
            {
                pageSize.Width = constraint.Width;
                max            = _document.MaxPageWidth;
                if (pageSize.Width > max)
                {
                    pageSize.Width = max;
                }
                min = _document.MinPageWidth;
                if (pageSize.Width < min)
                {
                    pageSize.Width = min;
                }
            }
            // If the width is Double.PositiveInfinity, crop it to predefined value.
            if (double.IsPositiveInfinity(pageSize.Width))
            {
                pageSize.Width = _defaultWidth;
            }
            return(pageSize);
        }
예제 #3
0
        // Token: 0x060077AE RID: 30638 RVA: 0x002225D4 File Offset: 0x002207D4
        protected override Size MeasureOverride(Size constraint)
        {
            Size availableSize = new Size(double.PositiveInfinity, double.PositiveInfinity);
            Size result        = default(Size);

            foreach (object obj in base.InternalChildren)
            {
                UIElement uielement = (UIElement)obj;
                if (uielement != null)
                {
                    uielement.Measure(availableSize);
                    double num = InkCanvas.GetLeft(uielement);
                    if (!DoubleUtil.IsNaN(num))
                    {
                        result.Width = Math.Max(result.Width, num + uielement.DesiredSize.Width);
                    }
                    else
                    {
                        result.Width = Math.Max(result.Width, uielement.DesiredSize.Width);
                    }
                    double num2 = InkCanvas.GetTop(uielement);
                    if (!DoubleUtil.IsNaN(num2))
                    {
                        result.Height = Math.Max(result.Height, num2 + uielement.DesiredSize.Height);
                    }
                    else
                    {
                        result.Height = Math.Max(result.Height, uielement.DesiredSize.Height);
                    }
                }
            }
            return(result);
        }
예제 #4
0
        //public void PushEffect(BitmapEffect effect, BitmapEffectInput effectInput);
        //public void PushGuidelineSet(GuidelineSet guidelines);

        public void PushOpacity(double opacity)
        {
            Canvas canvas = ActiveCanvas;
            if (canvas.Children.Count > 0 || !DoubleUtil.IsNaN(canvas.Opacity))
                canvas = PushCanvas();
            canvas.Opacity = opacity;
        }
 // Token: 0x06006661 RID: 26209 RVA: 0x001CC214 File Offset: 0x001CA414
 internal double CalcLineAdvanceForTextParagraph(TextParagraph textParagraph, int dcp, double lineAdvance)
 {
     if (!DoubleUtil.IsNaN(this._lineHeight))
     {
         LineStackingStrategy lineStackingStrategy = this.LineStackingStrategy;
         if (lineStackingStrategy != LineStackingStrategy.BlockLineHeight)
         {
             if (lineStackingStrategy != LineStackingStrategy.MaxHeight)
             {
             }
             if (dcp == 0 && textParagraph.HasFiguresOrFloaters() && textParagraph.GetLastDcpAttachedObjectBeforeLine(0) + textParagraph.ParagraphStartCharacterPosition == textParagraph.ParagraphEndCharacterPosition)
             {
                 lineAdvance = this._lineHeight;
             }
             else
             {
                 lineAdvance = Math.Max(lineAdvance, this._lineHeight);
             }
         }
         else
         {
             lineAdvance = this._lineHeight;
         }
     }
     return(lineAdvance);
 }
예제 #6
0
        /// <summary>
        /// Compute size for the page.
        /// </summary>
        private Size ComputePageSize()
        {
            double max, min;
            Size   pageSize = new Size(_document.PageWidth, _document.PageHeight);

            if (DoubleUtil.IsNaN(pageSize.Width))
            {
                pageSize.Width = _pageSize.Width;
                max            = _document.MaxPageWidth;
                if (pageSize.Width > max)
                {
                    pageSize.Width = max;
                }
                min = _document.MinPageWidth;
                if (pageSize.Width < min)
                {
                    pageSize.Width = min;
                }
            }
            if (DoubleUtil.IsNaN(pageSize.Height))
            {
                pageSize.Height = _pageSize.Height;
                max             = _document.MaxPageHeight;
                if (pageSize.Height > max)
                {
                    pageSize.Height = max;
                }
                min = _document.MinPageHeight;
                if (pageSize.Height < min)
                {
                    pageSize.Height = min;
                }
            }
            return(pageSize);
        }
예제 #7
0
        private TItem GetOverlapItem(TContainer rootTreeView, Point draggingPoint)
        {
            //TODO X Offset
            var result = VisualTreeHelper.HitTest(rootTreeView, new Point(rootTreeView.ActualWidth - 30, draggingPoint.Y));

            if (result == null)
            {
                return(null);
            }

            var overlapContainer = TreeUtil.FindVisualParent <TItem>(result.VisualHit);

            //overlapContainer 有可能是已经被折叠的子节点,故通过 IsVisible 来判断
            if (overlapContainer == null || !overlapContainer.IsVisible)
            {
                return(null);
            }

            TItem overlapItem = null;

            if (JustOverlapGroup)
            {
                if (overlapContainer.HasItems || IsGroup != null && IsGroup(overlapContainer))
                {
                    overlapItem = overlapContainer;
                }
                else
                {
                    overlapItem = ItemsControl.ItemsControlFromItemContainer(overlapContainer) as TItem;
                }
            }
            else
            {
                overlapItem = overlapContainer;
            }

            if (overlapItem != null)
            {
                var overlapItemPos = overlapItem.TranslatePoint(new Point(), rootTreeView);
                var checkHeight    = DoubleUtil.IsNaN(OverlapAreaCheckHeight) ? overlapItem.ActualHeight : OverlapAreaCheckHeight;

                if (DoubleUtil.GreaterThan(draggingPoint.Y, overlapItemPos.Y) && DoubleUtil.LessThanOrClose(draggingPoint.Y, overlapItemPos.Y + checkHeight / 2))
                {
                    _overDragArea  = OverlapArea.Inner;
                    _overDragArea |= OverlapArea.Up;
                }

                if (DoubleUtil.GreaterThan(draggingPoint.Y, overlapItemPos.Y + checkHeight / 2) && DoubleUtil.LessThanOrClose(draggingPoint.Y, overlapItemPos.Y + checkHeight))
                {
                    _overDragArea  = OverlapArea.Inner;
                    _overDragArea |= OverlapArea.Down;
                }
            }
            else
            {
                _overDragArea = OverlapArea.Inner;
            }

            return(overlapItem);
        }
예제 #8
0
        public override object ConvertTo(ITypeDescriptorContext typeDescriptorContext,
                                         CultureInfo cultureInfo,
                                         object value,
                                         Type destinationType)
        {
            if (destinationType == null)
            {
                throw new ArgumentNullException("destinationType");
            }

            if (value != null &&
                value is double)
            {
                double l = (double)value;
                if (destinationType == typeof(string))
                {
                    if (DoubleUtil.IsNaN(l))
                    {
                        return("Auto");
                    }
                    else
                    {
                        return(Convert.ToString(l, cultureInfo));
                    }
                }
                else if (destinationType == typeof(InstanceDescriptor))
                {
                    ConstructorInfo ci = typeof(double).GetConstructor(new Type[] { typeof(double) });
                    return(new InstanceDescriptor(ci, new object[] { l }));
                }
            }
            throw GetConvertToException(value, destinationType);
        }
        /// <summary>
        /// Attempts to convert to a GridLength from the given object.
        /// </summary>
        /// <param name="typeDescriptorContext">The ITypeDescriptorContext for this call.</param>
        /// <param name="cultureInfo">The CultureInfo which is respected when converting.</param>
        /// <param name="source">The object to convert to a GridLength.</param>
        /// <returns>
        /// The GridLength instance which was constructed.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// An ArgumentNullException is thrown if the example object is null.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// An ArgumentException is thrown if the example object is not null
        /// and is not a valid type which can be converted to a GridLength.
        /// </exception>
        public override object ConvertFrom(
            ITypeDescriptorContext typeDescriptorContext,
            CultureInfo cultureInfo,
            object source)
        {
            if (source != null)
            {
                if (source is string)
                {
                    return(FromString((string)source, cultureInfo));
                }
                else
                {
                    //  conversion from numeric type
                    double       value;
                    GridUnitType type;

                    value = Convert.ToDouble(source, cultureInfo);

                    if (DoubleUtil.IsNaN(value))
                    {
                        //  this allows for conversion from Width / Height = "Auto"
                        value = 1.0;
                        type  = GridUnitType.Auto;
                    }
                    else
                    {
                        type = GridUnitType.Pixel;
                    }

                    return(new GridLength(value, type));
                }
            }
            throw GetConvertFromException(source);
        }
예제 #10
0
        /// <summary>
        /// Calculate line advance from actual line height and the line stacking strategy.
        /// </summary>
        internal double CalcLineAdvance(double lineAdvance)
        {
            // We support MaxHeight and BlockLineHeight stacking strategies
            if (!DoubleUtil.IsNaN(_lineHeight))
            {
                switch (LineStackingStrategy)
                {
                case LineStackingStrategy.BlockLineHeight:
                    lineAdvance = _lineHeight;
                    break;

                case LineStackingStrategy.MaxHeight:
                default:
                    lineAdvance = Math.Max(lineAdvance, _lineHeight);
                    break;

                    //    case LineStackingStrategy.InlineLineHeight:
                    //        // Inline uses the height of the line just processed.
                    //        break;

                    //    case LineStackingStrategy.GridHeight:
                    //        lineAdvance = (((TextDpi.ToTextDpi(lineAdvance) - 1) / TextDpi.ToTextDpi(_lineHeight)) + 1) * _lineHeight;
                    //        break;
                    //}
                }
            }

            return(lineAdvance);
        }
예제 #11
0
        // Token: 0x06007029 RID: 28713 RVA: 0x00203950 File Offset: 0x00201B50
        private Size ComputePageSize()
        {
            Size result = new Size(this._document.PageWidth, this._document.PageHeight);

            if (DoubleUtil.IsNaN(result.Width))
            {
                result.Width = this._pageSize.Width;
                double num = this._document.MaxPageWidth;
                if (result.Width > num)
                {
                    result.Width = num;
                }
                double num2 = this._document.MinPageWidth;
                if (result.Width < num2)
                {
                    result.Width = num2;
                }
            }
            if (DoubleUtil.IsNaN(result.Height))
            {
                result.Height = this._pageSize.Height;
                double num = this._document.MaxPageHeight;
                if (result.Height > num)
                {
                    result.Height = num;
                }
                double num2 = this._document.MinPageHeight;
                if (result.Height < num2)
                {
                    result.Height = num2;
                }
            }
            return(result);
        }
예제 #12
0
        static void SetupShape(Shape shape, double x, double y, double width, double height, Brush brush, Pen pen)
        {
            if (width < 0)  // nan < 0 is false
            {
                x    += width;
                width = -width;
            }
            if (height < 0)
            {
                y     += height;
                height = -height;
            }
            Canvas.SetLeft(shape, x);
            Canvas.SetTop(shape, y);

            // Setting a double dependency property to Double.NaN is not the same
            // as simply not setting it. I consider this is a bug in the Silverlight run-time.
            if (!DoubleUtil.IsNaN(width))
            {
                shape.Width = width;
            }
            if (!DoubleUtil.IsNaN(height))
            {
                shape.Height = height;
            }
            SetupShape(shape, brush, pen);
        }
        /// <summary>
        ///   Attempts to convert to a RibbonControlLength from the given object.
        /// </summary>
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            if (value != null)
            {
                string stringValue = value as string;
                if (stringValue != null)
                {
                    return(FromString(stringValue, culture));
                }
                else
                {
                    //  conversion from numeric type
                    double doubleValue;
                    RibbonControlLengthUnitType type;

                    doubleValue = Convert.ToDouble(value, culture);

                    if (DoubleUtil.IsNaN(doubleValue))
                    {
                        //  this allows for conversion from Width / Height = "Auto"
                        doubleValue = 1.0;
                        type        = RibbonControlLengthUnitType.Auto;
                    }
                    else
                    {
                        type = RibbonControlLengthUnitType.Pixel;
                    }

                    return(new RibbonControlLength(doubleValue, type));
                }
            }

            throw GetConvertFromException(value);
        }
예제 #14
0
        /// <summary>
        /// Evaluates how complex the GlyphMapping is.
        /// </summary>
        GlyphIndicesComplexity CalcGlyphIndicesComplexity()
        {
            GlyphIndicesComplexity result = GlyphIndicesComplexity.None;
            int count = this.glyphMapping != null ? this.glyphMapping.Length : 0;

            for (int idx = 0; idx < count; idx++)
            {
                GlyphMapping gm = this.glyphMapping[idx];

                if (gm.ClusterCodeUnitCount > 1 || gm.ClusterGlyphCount > 1)
                {
                    // Max. complexity -> break
                    result = GlyphIndicesComplexity.ClusterMapping;
                    break;
                }

                if (gm.GlyphIndex != -1 && (int)result < (int)GlyphIndicesComplexity.GlyphIndicesAndDistanceOnly)
                {
                    result = GlyphIndicesComplexity.GlyphIndicesAndDistanceOnly;
                    continue;
                }
                if ((int)result < (int)GlyphIndicesComplexity.GlyphIndicesAndDistanceOnly)
                {
                    if (!DoubleUtil.IsNaN(gm.AdvanceWidth) || !DoubleUtil.IsNaN(gm.UOffset) || !DoubleUtil.IsNaN(gm.VOffset))
                    {
                        result = GlyphIndicesComplexity.DistanceOnly;
                        continue;
                    }
                }
            }
            return(result);
        }
예제 #15
0
        private void UpdateVisualBrush()
        {
            if (_referenceHeader != null && _visualBrushCanvas != null)
            {
                VisualBrush visualBrush = new VisualBrush(_referenceHeader);

                visualBrush.ViewboxUnits = BrushMappingMode.Absolute;

                double width = Width;
                if (DoubleUtil.IsNaN(width))
                {
                    width = _referenceHeader.ActualWidth;
                }
                else
                {
                    width = width - GetVisualCanvasMarginX();
                }

                double height = Height;
                if (DoubleUtil.IsNaN(height))
                {
                    height = _referenceHeader.ActualHeight;
                }
                else
                {
                    height = height - GetVisualCanvasMarginY();
                }

                Vector offset = VisualTreeHelper.GetOffset(_referenceHeader);
                visualBrush.Viewbox = new Rect(offset.X, offset.Y, width, height);

                _visualBrushCanvas.Background = visualBrush;
            }
        }
예제 #16
0
        //-------------------------------------------------------------------
        //
        //  Public Operators
        //
        //-------------------------------------------------------------------

        #region Public Operators

        /// <summary>
        /// Overloaded operator to compare two Thicknesses for equality.
        /// </summary>
        /// <param name="t1">first Thickness to compare</param>
        /// <param name="t2">second Thickness to compare</param>
        /// <returns>True if all sides of the Thickness are equal, false otherwise</returns>
        //  SEEALSO
        public static bool operator==(Thickness t1, Thickness t2)
        {
            return((t1._Left == t2._Left || (DoubleUtil.IsNaN(t1._Left) && DoubleUtil.IsNaN(t2._Left))) &&
                   (t1._Top == t2._Top || (DoubleUtil.IsNaN(t1._Top) && DoubleUtil.IsNaN(t2._Top))) &&
                   (t1._Right == t2._Right || (DoubleUtil.IsNaN(t1._Right) && DoubleUtil.IsNaN(t2._Right))) &&
                   (t1._Bottom == t2._Bottom || (DoubleUtil.IsNaN(t1._Bottom) && DoubleUtil.IsNaN(t2._Bottom)))
                   );
        }
예제 #17
0
 static internal string ToString(double l, CultureInfo cultureInfo)
 {
     if (DoubleUtil.IsNaN(l))
     {
         return("Auto");
     }
     return(Convert.ToString(l, cultureInfo));
 }
예제 #18
0
        //-------------------------------------------------------------------
        //
        //  Public Operators
        //
        //-------------------------------------------------------------------
        #region Public Operators

        /// <summary>
        /// Overloaded operator to compare two CornerRadiuses for equality.
        /// </summary>
        /// <param name="cr1">First CornerRadius to compare</param>
        /// <param name="cr2">Second CornerRadius to compare</param>
        /// <returns>True if all sides of the CornerRadius are equal, false otherwise</returns>
        //  SEEALSO
        public static bool operator==(CornerRadius cr1, CornerRadius cr2)
        {
            return((cr1._topLeft == cr2._topLeft || (DoubleUtil.IsNaN(cr1._topLeft) && DoubleUtil.IsNaN(cr2._topLeft))) &&
                   (cr1._topRight == cr2._topRight || (DoubleUtil.IsNaN(cr1._topRight) && DoubleUtil.IsNaN(cr2._topRight))) &&
                   (cr1._bottomRight == cr2._bottomRight || (DoubleUtil.IsNaN(cr1._bottomRight) && DoubleUtil.IsNaN(cr2._bottomRight))) &&
                   (cr1._bottomLeft == cr2._bottomLeft || (DoubleUtil.IsNaN(cr1._bottomLeft) && DoubleUtil.IsNaN(cr2._bottomLeft)))
                   );
        }
        // Token: 0x060067D1 RID: 26577 RVA: 0x001D1984 File Offset: 0x001CFB84
        internal static double CalculateFigureHeight(StructuralCache structuralCache, Figure figure, FigureLength figureLength, out bool isHeightAuto)
        {
            double num;

            if (figureLength.IsPage)
            {
                num = structuralCache.CurrentFormatContext.PageHeight * figureLength.Value;
            }
            else if (figureLength.IsContent)
            {
                Thickness pageMargin = structuralCache.CurrentFormatContext.PageMargin;
                num = (structuralCache.CurrentFormatContext.PageHeight - pageMargin.Top - pageMargin.Bottom) * figureLength.Value;
            }
            else if (figureLength.IsColumn)
            {
                int    num2;
                double num3;
                double num4;
                double num5;
                FigureHelper.GetColumnMetrics(structuralCache, out num2, out num3, out num4, out num5);
                double num6 = figureLength.Value;
                if (num6 > (double)num2)
                {
                    num6 = (double)num2;
                }
                int num7 = (int)num6;
                if ((double)num7 == num6 && num7 > 0)
                {
                    num7--;
                }
                num = num3 * num6 + num4 * (double)num7;
            }
            else
            {
                num = FigureHelper.CalculateFigureCommon(figureLength);
            }
            if (!DoubleUtil.IsNaN(num))
            {
                FigureVerticalAnchor verticalAnchor = figure.VerticalAnchor;
                if (FigureHelper.IsVerticalPageAnchor(verticalAnchor))
                {
                    num = Math.Max(1.0, Math.Min(num, structuralCache.CurrentFormatContext.PageHeight));
                }
                else
                {
                    Thickness pageMargin2 = structuralCache.CurrentFormatContext.PageMargin;
                    num = Math.Max(1.0, Math.Min(num, structuralCache.CurrentFormatContext.PageHeight - pageMargin2.Top - pageMargin2.Bottom));
                }
                TextDpi.EnsureValidPageWidth(ref num);
                isHeightAuto = false;
            }
            else
            {
                num          = structuralCache.CurrentFormatContext.PageHeight;
                isHeightAuto = true;
            }
            return(num);
        }
예제 #20
0
        /// <summary>
        /// Canvas computes a position for each of its children taking into account their margin and
        /// attached Canvas properties: Top, Left.
        ///
        /// Canvas will also arrange each of its children.
        /// This code is same as the Canvas'.
        /// </summary>
        /// <param name="arrangeSize">Size that Canvas will assume to position children.</param>
        protected override Size ArrangeOverride(Size arrangeSize)
        {
            //Canvas arranges children at their DesiredSize.
            //This means that Margin on children is actually respected and added
            //to the size of layout partition for a child.
            //Therefore, is Margin is 10 and Left is 20, the child's ink will start at 30.

            foreach (UIElement child in InternalChildren)
            {
                if (child == null)
                {
                    continue;
                }

                double x = 0;
                double y = 0;


                //Compute offset of the child:
                //If Left is specified, then Right is ignored
                //If Left is not specified, then Right is used
                //If both are not there, then 0
                double left = (double)InkCanvas.GetLeft(child);
                if (!DoubleUtil.IsNaN(left))
                {
                    x = left;
                }
                else
                {
                    double right = (double)InkCanvas.GetRight(child);

                    if (!DoubleUtil.IsNaN(right))
                    {
                        x = arrangeSize.Width - child.DesiredSize.Width - right;
                    }
                }

                double top = (double)InkCanvas.GetTop(child);
                if (!DoubleUtil.IsNaN(top))
                {
                    y = top;
                }
                else
                {
                    double bottom = (double)InkCanvas.GetBottom(child);

                    if (!DoubleUtil.IsNaN(bottom))
                    {
                        y = arrangeSize.Height - child.DesiredSize.Height - bottom;
                    }
                }

                child.Arrange(new Rect(new Point(x, y), child.DesiredSize));
            }

            return(arrangeSize);
        }
예제 #21
0
        /// <summary>
        /// Converts the implementation.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <param name="targetType">Type of the target.</param>
        /// <param name="parameter">The parameter.</param>
        /// <param name="culture">The culture.</param>
        /// <returns></returns>
        protected override object ConvertImpl(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var doubleValue = (double)value;

            if (DoubleUtil.IsNaN(doubleValue))
            {
                return(string.Empty);
            }

            return(parameter != null?doubleValue.ToString(parameter.ToString(), culture) : value);
        }
        // Token: 0x06005D15 RID: 23829 RVA: 0x001A3204 File Offset: 0x001A1404
        private static double GetColumnEstimatedWidth(DataGridColumn column, double averageColumnWidth)
        {
            double num = column.Width.DisplayValue;

            if (DoubleUtil.IsNaN(num))
            {
                num = Math.Max(averageColumnWidth, column.MinWidth);
                num = Math.Min(num, column.MaxWidth);
            }
            return(num);
        }
예제 #23
0
        private static object OnCoerceWidth(DependencyObject d, object baseValue)
        {
            double width = (double)baseValue;

            if (DoubleUtil.IsNaN(width))
            {
                return(2.0);
            }

            return(baseValue);
        }
예제 #24
0
        // Token: 0x06006616 RID: 26134 RVA: 0x001CB460 File Offset: 0x001C9660
        internal static double GetLineHeightValue(DependencyObject d)
        {
            double num = (double)d.GetValue(Block.LineHeightProperty);

            if (DoubleUtil.IsNaN(num))
            {
                FontFamily fontFamily = (FontFamily)d.GetValue(TextElement.FontFamilyProperty);
                double     num2       = (double)d.GetValue(TextElement.FontSizeProperty);
                num = fontFamily.LineSpacing * num2;
            }
            return(Math.Max(TextDpi.MinWidth, Math.Min(TextDpi.MaxWidth, num)));
        }
예제 #25
0
        private static object OnCoerceHeight(DependencyObject d, object baseValue)
        {
            double height = (double)baseValue;
            DataGridColumnFloatingHeader header = (DataGridColumnFloatingHeader)d;

            if (header._referenceHeader != null && DoubleUtil.IsNaN(height))
            {
                return(header._referenceHeader.ActualHeight + header.GetVisualCanvasMarginY());
            }

            return(baseValue);
        }
        // Token: 0x06006A2E RID: 27182 RVA: 0x001E3C1C File Offset: 0x001E1E1C
        public override Rect ComputeBoundingBox(bool rightToLeft, bool sideways)
        {
            Size   desiredSize = this.UIElementIsland.Root.DesiredSize;
            double num         = (!sideways) ? desiredSize.Height : desiredSize.Width;
            double num2        = (double)this.UIElementIsland.Root.GetValue(TextBlock.BaselineOffsetProperty);

            if (!sideways && !DoubleUtil.IsNaN(num2))
            {
                num = num2;
            }
            return(new Rect(0.0, -num, sideways ? desiredSize.Height : desiredSize.Width, sideways ? desiredSize.Width : desiredSize.Height));
        }
예제 #27
0
        private static object OnCoerceHeight(DependencyObject d, object baseValue)
        {
            double height = (double)baseValue;
            DataGridColumnDropSeparator separator = (DataGridColumnDropSeparator)d;

            if (separator._referenceHeader != null && DoubleUtil.IsNaN(height))
            {
                return(separator._referenceHeader.ActualHeight);
            }

            return(baseValue);
        }
예제 #28
0
        // Token: 0x06002FCF RID: 12239 RVA: 0x000D70A4 File Offset: 0x000D52A4
        private void ComputeMeasurementGlyphRunAndOrigin()
        {
            if (this._glyphRunProperties == null)
            {
                this._measurementGlyphRun = null;
                this.ParseGlyphRunProperties();
                if (this._glyphRunProperties == null)
                {
                    return;
                }
            }
            else if (this._measurementGlyphRun != null)
            {
                return;
            }
            bool flag  = (this.BidiLevel & 1) == 0;
            bool flag2 = !DoubleUtil.IsNaN(this.OriginX);
            bool flag3 = !DoubleUtil.IsNaN(this.OriginY);
            bool flag4 = false;
            Rect rect  = default(Rect);

            if (flag2 && flag3 && flag)
            {
                this._measurementGlyphRun = this._glyphRunProperties.CreateGlyphRun(new Point(this.OriginX, this.OriginY), base.Language);
                flag4 = true;
            }
            else
            {
                this._measurementGlyphRun = this._glyphRunProperties.CreateGlyphRun(default(Point), base.Language);
                rect = this._measurementGlyphRun.ComputeAlignmentBox();
            }
            if (flag2)
            {
                this._glyphRunOrigin.X = this.OriginX;
            }
            else
            {
                this._glyphRunOrigin.X = (flag ? 0.0 : rect.Width);
            }
            if (flag3)
            {
                this._glyphRunOrigin.Y = this.OriginY;
            }
            else
            {
                this._glyphRunOrigin.Y = -rect.Y;
            }
            if (!flag4)
            {
                this._measurementGlyphRun = this._glyphRunProperties.CreateGlyphRun(this._glyphRunOrigin, base.Language);
            }
        }
예제 #29
0
        // ------------------------------------------------------------------
        //
        // Misc Properties
        //
        // ------------------------------------------------------------------

        #region Misc Properties


        /// <summary>
        /// Gets actual value of LineHeight property. If LineHeight is Double.Nan, returns FontSize*FontFamily.LineSpacing
        /// </summary>
        internal static double GetLineHeightValue(DependencyObject d)
        {
            double lineHeight = (double)d.GetValue(Block.LineHeightProperty);

            // If LineHeight value is 'Auto', treat it as LineSpacing * FontSize.
            if (DoubleUtil.IsNaN(lineHeight))
            {
                FontFamily fontFamily = (FontFamily)d.GetValue(TextElement.FontFamilyProperty);
                double     fontSize   = (double)d.GetValue(TextElement.FontSizeProperty);
                lineHeight = fontFamily.LineSpacing * fontSize;
            }
            return(Math.Max(TextDpi.MinWidth, Math.Min(TextDpi.MaxWidth, lineHeight)));
        }
예제 #30
0
        /// <summary>
        /// Creates a new RepeatBehavior that represents and iteration count.
        /// </summary>
        /// <param name="count">The number of iterations specified by this RepeatBehavior.</param>
        public RepeatBehavior(double count)
        {
            if (Double.IsInfinity(count) ||
                DoubleUtil.IsNaN(count) ||
                count < 0.0)
            {
                throw new ArgumentOutOfRangeException("count", SR.Get(SRID.Timing_RepeatBehaviorInvalidIterationCount, count));
            }

            _repeatDuration = new TimeSpan(0);
            _iterationCount = count;
            _type           = RepeatBehaviorType.IterationCount;
        }