예제 #1
0
    private void method_9(Interface46 A_0, ParagraphFormat A_1, HorizontalAlignment A_2, bool A_3)
    {
        int               num        = 5;
        TextOrientation   horizontal = TextOrientation.Horizontal;
        VerticalAlignment top        = VerticalAlignment.Top;

        if (A_0 is Paragraph)
        {
            Paragraph paragraph = (Paragraph)A_0;
            if (paragraph.IsInCell)
            {
                horizontal = (TextOrientation)((TableCell)paragraph.OwnerTextBody).CellFormat.method_32(0xbea);
                top        = ((TableCell)paragraph.OwnerTextBody).CellFormat.VerticalAlignment;
            }
        }
        string str = Class922.smethod_11(A_3, A_2, horizontal, top);

        if (Class567.smethod_16(str))
        {
            this.class972_0.string_2 = str;
        }
        if ((A_1 != null) && (A_2 == HorizontalAlignment.Distribute))
        {
            this.class972_0.string_3 = BookmarkStart.b("䄪堬尮䔰娲匴丶", num);
        }
        if (!Class567.smethod_16(this.class972_0.string_2) && A_3)
        {
            this.class972_0.int_0--;
        }
        if (Class567.smethod_16(this.class972_0.string_2) && !A_3)
        {
            this.class972_0.int_0++;
        }
        this.method_10(A_0);
    }
예제 #2
0
        private void InstallDevicesOnWall(List <DeviceInfo> deviceInfos, TextOrientation orientation)
        {
            if (!deviceInfos.Any())
            {
                return;
            }

            int xPosition;

            switch (orientation)
            {
            case TextOrientation.East:
                xPosition = 0;
                break;

            case TextOrientation.West:
                xPosition = _matrix.Tiles.Count - 1;
                break;

            default:
                throw new NotImplementedException();
            }

            int phoneIndex    = 0;
            int phonePosition = 0;

            while (phoneIndex != deviceInfos.Count)
            {
                phonePosition = (phoneIndex + 1) * (_matrix.Tiles[xPosition].Count - Settings.RoomCoridorLenght) / (deviceInfos.Count + 1) + Settings.RoomCoridorLenght;

                AddDeviceToWall(xPosition, phonePosition, deviceInfos[phoneIndex].DeviceId, orientation);
                phoneIndex++;
            }
        }
예제 #3
0
 public GridWindow(Interface parentInterface, Element parent, string title, TextOrientation titleOrientation, Vector2 position, Vector2 size, int xGridCount, int yGridCount, bool hasTitleBar, bool moveable, bool minimizeable, bool closeable)
     : base(parentInterface, parent, title, titleOrientation, position, size, hasTitleBar, moveable, minimizeable, closeable)
 {
     xCount   = xGridCount;
     yCount   = yGridCount;
     tileSize = new Vector2(size.X / xCount, hasTitleBar ? (size.Y - tbSize) / yCount : size.Y / yCount);
 }
예제 #4
0
        /// <summary>
        /// 设置文字方向
        /// </summary>
        /// <param name="orientation"></param>
        private TextOrientation InitalizeTextOrientation(int orientation)
        {
            TextOrientation textOrientation = TextOrientation.Horizontal;

            switch (orientation)
            {
            case 1:
                textOrientation = TextOrientation.Downward;
                break;

            case 2:
                textOrientation = TextOrientation.Horizontal;
                break;

            case 3:
                textOrientation = TextOrientation.HorizontalRotatedFarEast;
                break;

            case 4:
                textOrientation = TextOrientation.Upward;
                break;

            case 5:
                textOrientation = TextOrientation.VerticalFarEast;
                break;

            default:
                break;
            }
            return(textOrientation);
        }
예제 #5
0
 public void AddDeviceToWall(int x, int y, string name, TextOrientation orientation)
 {
     _matrix.Tiles[x][y].Add(new Tile(TileType.Iphone)
     {
         Text        = name,
         Orientation = orientation
     });
 }
예제 #6
0
 public void AddDeviceToWall(int x, int y, string name, TextOrientation orientation)
 {
     _matrix.Tiles[x][y].Add(new Tile(TileType.Iphone)
     {
         Text = name,
         Orientation = orientation
     });
 }
        /// <summary>
        /// Renders a TextFrame to RTF.
        /// </summary>
        internal override void Render()
        {
            DocumentElements elms = DocumentRelations.GetParent(_textFrame) as DocumentElements;
            bool             renderInParagraph = RenderInParagraph();

            if (renderInParagraph)
            {
                StartDummyParagraph();
            }

            StartShapeArea();

            //Properties
            RenderNameValuePair("shapeType", "202");//202 entspr. Textrahmen.

            TranslateAsNameValuePair("MarginLeft", "dxTextLeft", RtfUnit.EMU, "0");
            TranslateAsNameValuePair("MarginTop", "dyTextTop", RtfUnit.EMU, "0");
            TranslateAsNameValuePair("MarginRight", "dxTextRight", RtfUnit.EMU, "0");
            TranslateAsNameValuePair("MarginBottom", "dyTextBottom", RtfUnit.EMU, "0");

            if (_textFrame.IsNull("Elements") ||
                !CollectionContainsObjectAssignableTo(_textFrame.Elements,
                                                      typeof(Shape), typeof(Table)))
            {
                TranslateAsNameValuePair("Orientation", "txflTextFlow", RtfUnit.Undefined, null);
            }
            else
            {
                TextOrientation orient = _textFrame.Orientation;
                if (orient != TextOrientation.Horizontal && orient != TextOrientation.HorizontalRotatedFarEast)
                {
                    Debug.WriteLine(Messages2.TextframeContentsNotTurned, "warning");
                }
            }
            _rtfWriter.StartContent();
            _rtfWriter.WriteControl("shptxt");
            _rtfWriter.StartContent();
            foreach (DocumentObject docObj in _textFrame.Elements)
            {
                RendererBase rndrr = RendererFactory.CreateRenderer(docObj, _docRenderer);
                if (rndrr != null)
                {
                    rndrr.Render();
                }
            }
            //Text fields need to close with a paragraph.
            RenderTrailingParagraph(_textFrame.Elements);

            _rtfWriter.EndContent();
            _rtfWriter.EndContent();
            EndShapeArea();
            if (renderInParagraph)
            {
                RenderLayoutPicture();
                EndDummyParagraph();
            }
        }
예제 #8
0
 public Label(Interface parent, string text, int textSize, TextOrientation orientation, Vector2 position, Vector2 size, Color textColor, Color bgColor, ButtonListSide side = ButtonListSide.LeftRight, bool addToUI = true, bool addToFront = false)
     : base(parent, side, true, addToUI, addToFront)
 {
     Orientation = orientation;
     Color       = bgColor;
     Position    = position;
     Size        = size;
     Init(text, textSize, textColor);
 }
예제 #9
0
 public void Init(string text, Vector2 pos, Color color, TextOrientation orientation, int size, float rotation)
 {
     Orientation = orientation;
     Position    = pos;
     Color       = color;
     Rotation    = rotation;
     TextSize    = size;
     SetText(text, orientation);
 }
예제 #10
0
 public Button(Interface parent, string text, int textSize, TextOrientation orientation, Vector2 position, Vector2 size, Color originColor, Color hoverColor, Color pressedColor,
               ButtonListSide side = ButtonListSide.LeftRight, bool hasBorder = true, bool addToUI = true, bool addToFront = false)
     : base(parent, side, true, addToUI, addToFront)
 {
     Position       = position;
     Size           = size;
     this.hasBorder = hasBorder;
     Init(text, textSize, orientation, originColor, hoverColor, pressedColor);
 }
예제 #11
0
 /// <summary>
 /// Data to transport for Message in 3D space
 /// </summary>
 /// <param name="messageid">Message ID, if set to 0 it will be poplulated with an ID</param>
 /// <param name="timetolive">Time to live in frames</param>
 /// <param name="scale">Scale</param>
 /// <param name="position">World Position</param>
 /// <param name="Up">Up direction of text</param>
 /// <param name="Left">Left Direction of text</param>
 /// <param name="message">Actual message you want to send.&lt;color=colorname&gt; to change the color of the text.</param>
 /// <param name="orientation">left to right (ltr), center, and right to left (rtl) determines how text is laid out relative to pos.</param>
 public SpaceMessage(long messageid, int timetolive, double scale, Vector3D position, Vector3D Up, Vector3D Left, string message, TextOrientation orientation = TextOrientation.ltr)
 {
     id            = messageid;
     ttl           = timetolive;
     this.scale    = scale;
     pos           = position;
     up            = Up;
     left          = Left;
     t_orientation = orientation;
     this.message  = message;
 }
예제 #12
0
 public ILDXSimpleTextRenderer(object device,System.Drawing.Font font) {
     m_isPrepared = false; 
     m_device = (Device)device; 
     if (font != null) {
         m_SysFont = font; 
     } else {
         m_SysFont = new System.Drawing.Font(
             System.Drawing.FontFamily.GenericSansSerif,10.0f);
     }
     m_orientation = TextOrientation.Horizontal; 
 }
예제 #13
0
        public void SetPlaceholder(string text, Color foreColor)
        {
            _placeholderForeColor   = foreColor;
            _placeholderOrientation =
                TextAlign == HorizontalAlignment.Right ? TextOrientation.RightToLeft : TextOrientation.LeftToRight;;
            _placeholderText = text;
            _foreColor       = ForeColor;
            _passwordChar    = PasswordChar;

            IsPlaceholderActive = true;
        }
예제 #14
0
 /// <summary>
 /// Data to transport Entity attached message
 /// </summary>
 /// <param name="messageid">Message ID, if set to 0 this will be populated by the Send method</param>
 /// <param name="timetolive">Time to live in frames</param>
 /// <param name="scale">Scale</param>
 /// <param name="EntityId">Entity ID to attach to</param>
 /// <param name="localposition">Position relative to the entity ID</param>
 /// <param name="Up">Up direction relative to the entity</param>
 /// <param name="Forward">Forward direction relative to the entity</param>
 /// <param name="message">Actual message you want to send.&lt;color=colorname&gt; to change the color of the text.</param>
 /// <param name="max_x">maximum in the x direction the text can fill (to the left)  0 is unlimited</param>
 /// <param name="max_y">maximum in the y direction that the text can fill (down) 0 is unlimited</param>
 /// <param name="orientation">left to right (ltr), center, and right to left (rtl) determines how text is laid out relative to the Entity.</param>
 public EntityMessage(long messageid, int timetolive, double scale, long EntityId, Vector3D localposition, Vector3D Up, Vector3D Forward, string message, double max_x = 0, double max_y = 0, TextOrientation orientation = TextOrientation.ltr)
 {
     id            = messageid;
     ttl           = timetolive;
     this.scale    = scale;
     this.entityid = EntityId;
     rel           = localposition;
     up            = Up;
     forward       = Forward;
     max           = new Vector2D(max_x, max_y);
     t_orientation = orientation;
     this.message  = message;
 }
        /// <summary>
        /// Renders a TextFrame to CSV.
        /// </summary>
        internal override void Render()
        {
            DocumentElements elms = DocumentRelations.GetParent(this.textFrame) as DocumentElements;
            bool             renderInParagraph = RenderInParagraph();

            if (renderInParagraph)
            {
                StartDummyParagraph();
            }

            StartShapeArea();

            //Properties
            RenderNameValuePair("shapeType", "202");//202 entspr. Textrahmen.

            if (this.textFrame.IsNull("Elements") ||
                !CollectionContainsObjectAssignableTo(this.textFrame.Elements,
                                                      typeof(Shape), typeof(Table)))
            {
            }
            else
            {
                TextOrientation orient = this.textFrame.Orientation;
                if (orient != TextOrientation.Horizontal && orient != TextOrientation.HorizontalRotatedFarEast)
                {
                    Trace.WriteLine(Messages.TextframeContentsNotTurned, "warning");
                }
            }
            csvWriter.StartContent();
            csvWriter.StartContent();
            foreach (DocumentObject docObj in this.textFrame.Elements)
            {
                RendererBase rndrr = RendererFactory.CreateRenderer(docObj, this.docRenderer);
                if (rndrr != null)
                {
                    rndrr.Render();
                }
            }
            //Text fields need to close with a paragraph.
            RenderTrailingParagraph(this.textFrame.Elements);

            this.csvWriter.EndContent();
            this.csvWriter.EndContent();
            EndShapeArea();
            if (renderInParagraph)
            {
                RenderLayoutPicture();
                EndDummyParagraph();
            }
        }
예제 #16
0
        private void DrawTextOnImage(string fileName, WatermarkSettings settings)
        {
            Image img;

            using (Image original = Image.FromFile(fileName))
            {
                img = (Image)original.Clone();
            }

            EXIFOrientation orientation = GetEXIFOrientation(img);
            RotateFlipType  rotateFlip  = GetRotationForExifOrientation(orientation);

            img.RotateFlip(rotateFlip);

            FontStyle fontStyle = (FontStyle)settings.FontType;

            using (Graphics g = Graphics.FromImage(img))
                using (Brush brush = new SolidBrush(settings.Color))
                    using (Font font = new Font(settings.FontName, settings.TextSize, fontStyle))
                    {
                        string text = settings.Text;

                        Size            imgSize         = img.Size;
                        SizeF           textSize        = g.MeasureString(text, font);
                        Anchor          anchor          = settings.Anchor;
                        SizeF           marginSize      = new SizeF(settings.HMargin, settings.VMargin);
                        TextOrientation textOrientation = settings.TextOrientation;

                        float textRotation = GetTextRotation(textOrientation);

                        PointF textPosition = GetTextPosition(textOrientation, anchor, imgSize, textSize, marginSize);

                        g.TranslateTransform(textPosition.X, textPosition.Y);
                        g.RotateTransform(textRotation);

                        g.DrawString(text, font, brush, PointF.Empty);
                    }

            if (settings.EraseFiles)
            {
                File.Delete(fileName);
            }

            string suffix       = !string.IsNullOrEmpty(settings.TransformedFileSuffix) ? settings.TransformedFileSuffix : "_wm";
            string saveFileName = fileName.Replace(".", $"{suffix}.");

            img.Save(saveFileName);
            img.Dispose();
        }
 public ILDXSimpleTextRenderer(object device, System.Drawing.Font font)
 {
     m_isPrepared = false;
     m_device     = (Device)device;
     if (font != null)
     {
         m_SysFont = font;
     }
     else
     {
         m_SysFont = new System.Drawing.Font(
             System.Drawing.FontFamily.GenericSansSerif, 10.0f);
     }
     m_orientation = TextOrientation.Horizontal;
 }
예제 #18
0
 public ListBox(Interface parent, int textSize, TextOrientation to, Vector2 position, Vector2 size, Color?textColor, Color?innerColor, Color?outerColor, Color?selectColor,
                ButtonListSide side = ButtonListSide.TopBottom, bool pollEvents = true, bool addToUI = true, bool isFrontElement = false)
     : base(parent, position, size, side, pollEvents, addToUI, isFrontElement)
 {
     front            = isFrontElement;
     this.textSize    = textSize;
     orientation      = to;
     items            = new List <Label>();
     selected         = new Dictionary <Label, bool>();
     this.selectColor = selectColor.HasValue ? selectColor.Value : UI.BlueHighlightColor;
     this.textColor   = textColor.HasValue ? textColor.Value : Color.Black;
     surfaceColor     = new Color[] { innerColor.HasValue?innerColor.Value : UI.BGColor };
     borderColor      = new Color[] { outerColor.HasValue?outerColor.Value : UI.SurfaceColor };
     singleHeight     = UI.Font.MeasureString(textSize, "Log").Y + 2;
 }
예제 #19
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="fontTemplate"></param>
 /// <param name="show"></param>
 /// <param name="lineColor"></param>
 /// <param name="lineDrawStyle"></param>
 /// <param name="lineWidth"></param>
 /// <param name="orientation"></param>
 /// <param name="orientationAngle"></param>
 /// <param name="flip"></param>
 /// <param name="elementPostion"></param>
 /// <param name="elementAlignment"></param>
 /// <param name="extent"></param>
 /// <param name="bgColor"></param>
 /// <param name="showLabel"></param>
 public StyleTemplateSetting(FontSetting fontTemplate, bool show, string lineColor, LineDrawStyle lineDrawStyle, int lineWidth, TextOrientation orientation, int orientationAngle, bool flip, LegendPosition elementPostion, StringAlignment elementAlignment, int extent, string bgColor, bool showLabel)
 {
     this._FontTemplate = fontTemplate;
     this._Show = show;
     this._LineColor = lineColor;
     this._LineStyle = lineDrawStyle;
     this._LineWidth = lineWidth;
     this._Orientation = orientation;
     this._OrientationAngle = orientationAngle;
     this._Flip = flip;
     this._ElementPosition = elementPostion;
     this._ElementAlignment = elementAlignment;
     this._Extent = extent;
     this._BgColor = bgColor;
     this._ShowLabel = showLabel;
 }
예제 #20
0
 /// <summary>
 /// Initialize a new window element
 /// </summary>
 /// <param name="parentInterface">is nullable</param>
 /// <param name="parent">is nullable</param>
 public Window(Interface parentInterface, Element parent, string title, TextOrientation titleorientation, Vector2 position, Vector2 size, bool hasTitleBar, bool moveable, bool minimizeable, bool closeable)
     : base(parentInterface != null ? parentInterface : parent != null ? parent.ParentInterface : UI.CurrentInterface, position, size, ButtonListSide.LeftRight, true, true, true)
 {
     if (parent != null)
     {
         this.parent = parent;
     }
     UI.windowCount++;
     lastSize         = size;
     buttonSize       = 23;
     Title            = new Text(title, Vector2.Zero, Color.Black, TextOrientation.Center, 14, 0);
     elements         = new List <Element>();
     elementPositions = new List <Vector2>();
     SetText(title);
     bgColor      = new Color[] { UI.BGColor };
     surfaceColor = new Color[] { UI.HighlightColor };
     tbColor      = new Color[] { UI.SurfaceColor };
     tbSize       = 25;
     minimize     = new Button(ParentInterface, "-", 14, TextOrientation.Center, Position + new Vector2(Size.X - 2 * (buttonSize + 1), 1),
                               new Vector2(23, 23), ButtonListSide.TopBottom, false, true, true);
     exit = new Button(ParentInterface, "X", 14, TextOrientation.Center, Position + new Vector2(Size.X - (buttonSize + 1), 1),
                       new Vector2(23, 23), new Color(200, 70, 70), new Color(200, 50, 50), new Color(150, 40, 40), ButtonListSide.TopBottom, false, true, true);
     minimize.Clicked += (sender) => { if (maximized)
                                       {
                                           Minimize();
                                       }
                                       else
                                       {
                                           Maximize(true);
                                       } };
     exit.Clicked += (sender) => { Close(); };
     minimized     = false;
     maximized     = true;
     HasTitleBar   = hasTitleBar;
     Moveable      = moveable;
     Minimizeable  = minimizeable;
     Closeable     = closeable;
     if (parent != null)
     {
         MinimizedPosition = new Vector2(5, parent.Size.Y - 30);
     }
     else
     {
         MinimizedPosition = new Vector2(5 + (UI.windowCount - 1) * 155, UI.ScreenSize.Y - 30);
     }
     Close();
 }
예제 #21
0
    private void method_2(TableCell A_0, VerticalAlignment A_1, TextOrientation A_2, bool A_3)
    {
        Paragraph paragraph = A_0.method_55();

        if (paragraph != null)
        {
            this.class86_0.string_1 = Class922.smethod_10(A_1, A_2, paragraph.Format.HorizontalAlignment, A_3);
        }
        if (!Class567.smethod_16(this.class86_0.string_1) && A_3)
        {
            this.class86_0.int_0--;
        }
        if (Class567.smethod_16(this.class86_0.string_1) && !A_3)
        {
            this.class86_0.int_0++;
        }
    }
예제 #22
0
        private static float GetTextRotation(TextOrientation textOrientation)
        {
            switch (textOrientation)
            {
            case TextOrientation.Horizontal:
                return(0.0f);

            case TextOrientation.VerticalAscending:
                return(-90.0f);

            case TextOrientation.VerticalDescending:
                return(90.0f);

            default:
                throw new InvalidOperationException($"Unexpected text orientation: {textOrientation}");
            }
        }
예제 #23
0
        /// <summary>
        /// Extern
        /// </summary>
        /// <param name="text"></param>
        /// <param name="scale"></param>
        /// <param name="orientation"></param>
        /// <returns></returns>
        public Rectangle RectangleOf(string text, int scale, TextOrientation orientation = TextOrientation.Left)
        {
            int dx           = 0;
            int dy           = 0;
            int bigWidth     = 0;
            int currentWidth = 0;
            int height       = 0;
            int i            = 0;

            if (orientation != TextOrientation.Left)
            {
                foreach (char c in text)
                {
                    i++;
                    FontChar fc;
                    if (_characterMap.TryGetValue(c, out fc))
                    {
                        var wy = fc.Height / 64f * scale;
                        var wx = wy / fc.Height * fc.Width;
                        dx           -= (int)(((int)wx + 4) * (orientation == TextOrientation.Center ? 0.5f : 1f));
                        currentWidth += (int)wx + 4;
                        bigWidth      = Math.Max(bigWidth, currentWidth);
                        height        = Math.Max(height, (int)(fc.Height / 64f * scale) + 2);
                        if (text[i] == "\n"[0])
                        {
                            currentWidth = 0;
                        }
                    }
                }
            }
            else
            {
                foreach (char c in text)
                {
                    FontChar fc;
                    if (_characterMap.TryGetValue(c, out fc))
                    {
                        var wy = fc.Height / 64f * scale;
                        var wx = wy / fc.Height * fc.Width;
                        bigWidth += (int)wx + 4;
                        height    = Math.Max(height, (int)(fc.Height / 64f * scale) + 2);
                    }
                }
            }
            return(new Rectangle(dx, dy, bigWidth, height));
        }
예제 #24
0
        public void SetText(string text, TextOrientation orientation)
        {
            String = text;
            Size   = UI.Font.MeasureString(size, text).ToVector2();

            if (orientation == TextOrientation.Center)
            {
                Origin = Size / 2.0f;
            }
            else if (orientation == TextOrientation.Left)
            {
                Origin = Vector2.Zero;
            }
            else if (orientation == TextOrientation.Right)
            {
                Origin = new Vector2(Size.X, 0);
            }
        }
예제 #25
0
        /// <summary>
        /// Converter for <see cref="TextOrientation"/> enumeration type to angle degree.
        /// </summary>
        /// <param name="orientation">Orientation style from model.</param>
        /// <returns>
        /// Orientation as angle in degrees.
        /// </returns>
        /// <exception cref="InvalidEnumArgumentException">The value specified is outside the range of valid values.</exception>
        public static float ToAngle(this TextOrientation orientation)
        {
            SentinelHelper.IsEnumValid(orientation);

            switch (orientation)
            {
            case TextOrientation.Upward:
                return(270);

            case TextOrientation.Horizontal:
                return(0);

            case TextOrientation.Vertical:
                return(0);

            default:
                return(90);
            }
        }
        /// <summary>
        ///     Parses text orientation.
        /// </summary>
        /// <param name="elem"></param>
        /// <param name="defaultValue"></param>
        /// <returns></returns>
        private TextOrientation ParseOrientation(XmlElement elem, TextOrientation defaultValue)
        {
            var orientation = new TextOrientation(defaultValue.Vertical, defaultValue.Horizontal);

            if (elem != null)
            {
                if (elem["horizontal"] != null)
                {
                    switch (elem["horizontal"].InnerText)
                    {
                    case "left":
                        orientation.Horizontal = HorizontalOrientation.Left;
                        break;

                    case "center":
                        orientation.Horizontal = HorizontalOrientation.Center;
                        break;

                    case "right":
                        orientation.Horizontal = HorizontalOrientation.Right;
                        break;
                    }
                }
                if (elem["vertical"] != null)
                {
                    switch (elem["vertical"].InnerText)
                    {
                    case "top":
                        orientation.Vertical = VerticalOrientation.Top;
                        break;

                    case "center":
                        orientation.Vertical = VerticalOrientation.Middle;
                        break;

                    case "bottom":
                        orientation.Vertical = VerticalOrientation.Bottom;
                        break;
                    }
                }
            }
            return(orientation);
        }
예제 #27
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = MainText.GetHashCode();
         hashCode = (hashCode * 397) ^ TranslationText.GetHashCode();
         hashCode = (hashCode * 397) ^ CopyrightText.GetHashCode();
         hashCode = (hashCode * 397) ^ SourceText.GetHashCode();
         hashCode = (hashCode * 397) ^ Outline.GetHashCode();
         hashCode = (hashCode * 397) ^ Shadow.GetHashCode();
         hashCode = (hashCode * 397) ^ MainLineSpacing;
         hashCode = (hashCode * 397) ^ TranslationLineSpacing;
         hashCode = (hashCode * 397) ^ (TextOrientation != null ? TextOrientation.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)TranslationPosition;
         hashCode = (hashCode * 397) ^ (int)CopyrightTextPosition;
         hashCode = (hashCode * 397) ^ (int)SourceTextPosition;
         hashCode = (hashCode * 397) ^ Borders.GetHashCode();
         return(hashCode);
     }
 }
예제 #28
0
 /// <summary>
 ///     Returns a hashcode of the song, used for example in the
 ///     editor to check if the file was changed
 /// </summary>
 /// <returns></returns>
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (int)CopyrightPosition;
         hashCode = (hashCode * 397) ^ (int)SourcePosition;
         hashCode = (hashCode * 397) ^ (MainText != null ? MainText.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TranslationText != null ? TranslationText.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CopyrightText != null ? CopyrightText.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SourceText != null ? SourceText.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ MainLineSpacing;
         hashCode = (hashCode * 397) ^ TranslationLineSpacing;
         hashCode = (hashCode * 397) ^ (TextOrientation != null ? TextOrientation.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)TranslationPosition;
         hashCode = (hashCode * 397) ^ TextOutlineEnabled.GetHashCode();
         hashCode = (hashCode * 397) ^ TextShadowEnabled.GetHashCode();
         hashCode = (hashCode * 397) ^ (TextBorders != null ? TextBorders.GetHashCode() : 0);
         return(hashCode);
     }
 }
예제 #29
0
        private void Init(string text, int textSize, TextOrientation orientation, Color originColor, Color hoverColor, Color pressedColor)
        {
            Orientation   = orientation;
            this.text     = new Text(text, Vector2.Zero, Color.Black, TextOrientation.Center, textSize, 0);
            textOffset    = Vector2.Zero;
            originTextPos = this.text.Position;
            SetText(text);
            this.originColor  = originColor;
            this.hoverColor   = hoverColor;
            this.pressedColor = pressedColor;
            drawColor         = originColor;
            btnTexArr         = new Color[] { this.originColor };
            bgTexArr          = new Color[] { new Color(btnTexArr[0].R / 2, btnTexArr[0].G / 2, btnTexArr[0].B / 2, btnTexArr[0].A) };

            Hover      += (sender) => { btnTexArr[0] = this.hoverColor; bgTexArr[0] = new Color(btnTexArr[0].R / 2, btnTexArr[0].G / 2, btnTexArr[0].B / 2, btnTexArr[0].A); };
            HoverLeft  += (sender) => { btnTexArr[0] = this.originColor; bgTexArr[0] = new Color(btnTexArr[0].R / 2, btnTexArr[0].G / 2, btnTexArr[0].B / 2, btnTexArr[0].A); };
            Pressed    += (sender) => { btnTexArr[0] = this.pressedColor; bgTexArr[0] = new Color(btnTexArr[0].R / 2, btnTexArr[0].G / 2, btnTexArr[0].B / 2, btnTexArr[0].A); };
            Clicked    += (sender) => { btnTexArr[0] = this.hoverColor; bgTexArr[0] = new Color(btnTexArr[0].R / 2, btnTexArr[0].G / 2, btnTexArr[0].B / 2, btnTexArr[0].A); };
            ResetState += (sender) => { btnTexArr[0] = this.originColor; bgTexArr[0] = new Color(btnTexArr[0].R / 2, btnTexArr[0].G / 2, btnTexArr[0].B / 2, btnTexArr[0].A); };
        }
예제 #30
0
 /// <summary>
 /// [abstract] Create a new labeling element
 /// </summary>
 /// <param name="panel">panel hosting the element</param>
 /// <param name="font">default font for the element</param>
 /// <param name="color">default color for the element</param>
 /// <param name="coordSystem">world / screen rendering method</param>
 public ILLabelingElement(ILPanel panel, Font font, Color color, CoordSystem coordSystem)
 {
     if (font != null)
     {
         m_font = font;
     }
     else
     {
         m_font = new System.Drawing.Font(
             System.Drawing.FontFamily.GenericSansSerif, 10.0f);
     }
     m_color       = color;
     m_orientation = TextOrientation.Horizontal;
     m_renderQueue = null;
     m_size        = Size.Empty;
     m_expression  = string.Empty;
     // init interpreter & renderer
     m_renderer = panel.TextRendererManager.GetDefault(coordSystem);
     m_renderer.CacheCleared += new EventHandler(m_renderer_CacheCleared);
     m_interpreter            = new ILSimpleTexInterpreter();
 }
예제 #31
0
        public TextBoxPlaceHolder(TextBox box, string text, Color foreColor, TextOrientation orientation)
        {
            Box         = box;
            Text        = text;
            ForeColor   = foreColor;
            Orientation = orientation;

            _oriForeColor = box.ForeColor;
            _passwordChar = box.PasswordChar;

            box.Text      = text;
            box.ForeColor = ForeColor;
            SetCarentAt(CaretPosition.Start);
            box.PasswordChar = '\0';

            Active = true;

            box.TextChanged += OnTextChanged;
            box.Enter       += OnEnter;
            box.MouseClick  += OnMouseClick;
            box.KeyUp       += OnKeyPressed;
        }
예제 #32
0
 public SpaceMessage(StringBuilder Message, Vector3D WorldPosition, Vector3D Up, Vector3D Left, double Scale = 1, Vector2D?Offset = null, int TimeToLive = -1, TextOrientation TxtOrientation = TextOrientation.ltr)
 {
     instance.RegisterCheck();
     BackingObject = instance.CreateMessage(MessageTypes.SpaceMessage);
     if (BackingObject != null)
     {
         this.TimeToLive     = TimeToLive;
         this.Scale          = Scale;
         this.WorldPosition  = WorldPosition;
         this.Up             = Up;
         this.Left           = Left;
         this.TxtOrientation = TxtOrientation;
         this.Message        = Message;
         if (Offset.HasValue)
         {
             this.Offset = Offset.Value;
         }
         else
         {
             this.Offset = Vector2D.Zero;
         }
     }
 }
예제 #33
0
        /// <summary>
        /// draws a fringe around the render output in fringe color
        /// </summary>
        /// <param name="m_renderer"></param>
        /// <param name="m_rendererQueue"></param>
        /// <param name="dest"></param>
        /// <param name="textOrientation"></param>
        /// <param name="m_color"></param>
        private void drawFringed(IILTextRenderer m_renderer, object m_rendererQueue, Point dest, TextOrientation textOrientation, Color m_color) {
            m_renderer.ColorOverride = m_fringeColor; 
            for (int i = 0; i < m_fringeOffsets.Dimensions[0]; i++) {
                m_renderer.Draw(m_renderQueue
                                , new Point(dest.X + m_fringeOffsets.GetValue(i,0), dest.Y + m_fringeOffsets.GetValue(i,1))
                                , TextOrientation.Horizontal, m_fringeColor);
            }
            m_renderer.ColorOverride = Color.Empty; 
            m_renderer.Draw(m_renderQueue, dest, TextOrientation.Horizontal, m_color);

        }
예제 #34
0
    private void method_1(TableCell A_0, WordAttrCollection A_1)
    {
        VerticalAlignment bottom     = VerticalAlignment.Bottom;
        TextOrientation   horizontal = TextOrientation.Horizontal;
        bool flag = false;

        for (int i = 0; i < A_1.Count; i++)
        {
            int    num3 = A_1.method_18(i);
            object obj2 = A_1.method_19(i);
            if (obj2 != null)
            {
                this.class86_0.int_0++;
                switch (num3)
                {
                case 1:
                {
                    Borders borders = obj2 as Borders;
                    if (!borders.Top.IsDefault)
                    {
                        this.class86_0.class1048_0.class411_0.border_0 = borders.Top;
                    }
                    if (!borders.Bottom.IsDefault)
                    {
                        this.class86_0.class1048_0.class411_1.border_0 = borders.Bottom;
                    }
                    if (!borders.Left.IsDefault)
                    {
                        this.class86_0.class1048_0.class411_2.border_0 = borders.Left;
                    }
                    if (!borders.Right.IsDefault)
                    {
                        this.class86_0.class1048_0.class411_3.border_0 = borders.Right;
                    }
                    this.class86_0.int_0--;
                    continue;
                }

                case 2:
                {
                    Paddings paddings = obj2 as Paddings;
                    float    top      = paddings.Top;
                    this.class86_0.class1048_0.class411_0.string_2 = Class576.smethod_42((double)paddings.Top);
                    float single2 = paddings.Bottom;
                    this.class86_0.class1048_0.class411_1.string_2 = Class576.smethod_42((double)paddings.Bottom);
                    float left = paddings.Left;
                    this.class86_0.class1048_0.class411_2.string_2 = Class576.smethod_42((double)paddings.Left);
                    float right = paddings.Right;
                    this.class86_0.class1048_0.class411_3.string_2 = Class576.smethod_42((double)paddings.Right);
                    this.class86_0.int_0--;
                    continue;
                }

                case 0xbea:
                {
                    horizontal = (TextOrientation)obj2;
                    this.class86_0.string_2 = Class922.smethod_12((TextOrientation)obj2);
                    if (this.class86_0.string_2 == null)
                    {
                        this.class86_0.int_0--;
                    }
                    continue;
                }

                case 0xbf4:
                {
                    flag   = true;
                    bottom = (VerticalAlignment)obj2;
                    continue;
                }

                case 0xc62:
                {
                    this.class86_0.string_0 = Class576.smethod_83((Class16)obj2);
                    continue;
                }

                case 0x271a:
                {
                    this.class86_0.class580_0 = (Class580)obj2;
                    continue;
                }
                }
                this.class86_0.int_0--;
            }
        }
        this.method_2(A_0, bottom, horizontal, flag);
        this.method_4(A_0);
        this.method_3(A_0, (CellFormat)A_1);
    }
예제 #35
0
 /// <summary>
 /// Data to transport for Message in 3D space
 /// </summary>
 /// <param name="messageid">Message ID, if set to 0 it will be poplulated with an ID</param>
 /// <param name="timetolive">Time to live in frames</param>
 /// <param name="scale">Scale</param>
 /// <param name="position">World Position</param>
 /// <param name="Up">Up direction of text</param>
 /// <param name="Left">Left Direction of text</param>
 /// <param name="message">Actual message you want to send.&lt;color=colorname&gt; to change the color of the text.</param>
 /// <param name="orientation">left to right (ltr), center, and right to left (rtl) determines how text is laid out relative to pos.</param>
 public SpaceMessage(long messageid, int timetolive, double scale, Vector3D position, Vector3D Up, Vector3D Left, string message, TextOrientation orientation = TextOrientation.ltr )
 {
     id = messageid;
     ttl = timetolive;
     this.scale = scale;
     pos = position;
     up = Up;
     left = Left;
     t_orientation = orientation;
     this.message = message;
 }
예제 #36
0
 /// <summary>
 /// Data to transport Entity attached message
 /// </summary>
 /// <param name="messageid">Message ID, if set to 0 this will be populated by the Send method</param>
 /// <param name="timetolive">Time to live in frames</param>
 /// <param name="scale">Scale</param>
 /// <param name="EntityId">Entity ID to attach to</param>
 /// <param name="localposition">Position relative to the entity ID</param>
 /// <param name="Up">Up direction relative to the entity</param>
 /// <param name="Forward">Forward direction relative to the entity</param>
 /// <param name="message">Actual message you want to send.&lt;color=colorname&gt; to change the color of the text.</param>
 /// <param name="max_x">maximum in the x direction the text can fill (to the left)  0 is unlimited</param>
 /// <param name="max_y">maximum in the y direction that the text can fill (down) 0 is unlimited</param>
 /// <param name="orientation">left to right (ltr), center, and right to left (rtl) determines how text is laid out relative to the Entity.</param>
 public EntityMessage(long messageid, int timetolive, double scale, long EntityId, Vector3D localposition, Vector3D Up, Vector3D Forward, string message, double max_x = 0, double max_y = 0, TextOrientation orientation = TextOrientation.ltr)
 {
     id = messageid;
     ttl = timetolive;
     this.scale = scale;
     this.entityid = EntityId;
     rel = localposition;
     up = Up;
     forward = Forward;
     max = new Vector2D(max_x, max_y);
     t_orientation = orientation;
     this.message = message;
 }
예제 #37
0
 public void Draw(ILRenderQueue renderQueue, Point position, TextOrientation orientation, Color color) {
     Draw(renderQueue,position.X,position.Y,0,position.X + renderQueue.Size.Width,position.Y+renderQueue.Size.Height,0,color); 
 }
예제 #38
0
        private void InstallDevicesOnWall(List<DeviceInfo> deviceInfos, TextOrientation orientation)
        {
            if (!deviceInfos.Any())
                return;

            int xPosition;

            switch (orientation)
            {
                case TextOrientation.East:
                    xPosition = 0;
                    break;
                case TextOrientation.West:
                    xPosition = _matrix.Tiles.Count - 1;
                    break;
                default:
                    throw new NotImplementedException();
            }

            int phoneIndex = 0;
            int phonePosition = 0;

            while (phoneIndex != deviceInfos.Count)
            {
                phonePosition = (phoneIndex + 1) * (_matrix.Tiles[xPosition].Count - Settings.RoomCoridorLenght) / (deviceInfos.Count + 1) + Settings.RoomCoridorLenght;

                AddDeviceToWall(xPosition, phonePosition, deviceInfos[phoneIndex].DeviceId, orientation);
                phoneIndex++;
            }
        }
예제 #39
0
 /// <summary>
 /// [abstract] Create a new labeling element 
 /// </summary>
 /// <param name="panel">panel hosting the element</param>
 /// <param name="font">default font for the element</param>
 /// <param name="color">default color for the element</param>
 /// <param name="coordSystem">world / screen rendering method</param>
 public ILLabelingElement (ILPanel panel, Font font, Color color, CoordSystem coordSystem) {
     if (font != null) {
         m_font = font; 
     } else {
         m_font = new System.Drawing.Font(
             System.Drawing.FontFamily.GenericSansSerif,10.0f);
     }
     m_color = color; 
     m_orientation = TextOrientation.Horizontal; 
     m_renderQueue = null; 
     m_size = Size.Empty; 
     m_expression = string.Empty; 
     // init interpreter & renderer
     m_renderer = panel.TextRendererManager.GetDefault(coordSystem);
     m_renderer.CacheCleared += new EventHandler(m_renderer_CacheCleared);
     m_interpreter = new ILSimpleTexInterpreter(); 
 }