Exemple #1
0
        /// <summary>
        /// Aligment text in current document
        /// </summary>
        /// <param name="alig"></param>
        public static void TextAligmentAction(Aligment alig)
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Database db  = doc.Database;
            Editor   ed  = doc.Editor;

            // Select DBText and MText
            List <string> oTp = new List <string>
            {
                "TEXT",
                "MTEXT"
            };
            ObjectIdCollection objIdColl = Utils.SelectionFilter(oTp, ed);

            if (objIdColl != null)
            {
                // Get base point
                Point3d            bPoint = new Point3d();
                PromptPointResult  pPtRes;
                PromptPointOptions pPtOpts = new PromptPointOptions("");
                pPtOpts.Message = "\nSpecify aligment point: ";
                pPtRes          = ed.GetPoint(pPtOpts);

                // Perform aligment
                if (pPtRes.Status == PromptStatus.OK)
                {
                    bPoint = pPtRes.Value;
                    Utils.AligmentText(db, objIdColl, alig, bPoint);
                }
            }
            else
            {
                ed.WriteMessage("\nNot found any text!\n");
            }
        }
Exemple #2
0
 public Label(string text, Rectangle rec, SpriteFont font, Aligment aligment)
 {
     base.areaRectangle = rec;
     base.zOrder        = 0;
     this.text          = text;
     base.fontId        = font;
     this.aligment      = aligment;
 }
Exemple #3
0
 public Label(Function function, Rectangle rec, SpriteFont font, Aligment aligment)
 {
     myFunction         = function;
     base.areaRectangle = rec;
     base.zOrder        = 0;
     this.text          = "";
     base.fontId        = font;
     this.aligment      = aligment;
 }
Exemple #4
0
 public Panel(Rectangle rectangle, string texture, Aligment aligment)
 {
     base.zOrder        = 1;
     base.areaRectangle = rectangle;
     if (aligment == Aligment.Center)
     {
         areaRectangle.X = Globals.ScreenWidthOver2 - areaRectangle.Width / 2;
     }
     this.texture = ContentManager.GetTextureByName(texture);
 }
Exemple #5
0
 public Panel(Rectangle rectangle, Color color, Aligment aligment)
 {
     base.zOrder        = 1;
     base.areaRectangle = rectangle;
     this.color         = color;
     if (aligment == Aligment.Center)
     {
         areaRectangle.X = Globals.ScreenWidthOver2 - areaRectangle.Width / 2;
     }
 }
Exemple #6
0
 public Label(string text, Rectangle rec, IntPtr font, Aligment aligment)
 {
     this.rectangle = rec;
     base.zOrder    = 0;
     this.textData  = text;
     base.textFont  = font;
     this.aligment  = aligment;
     this.pos.X     = rec.X;
     this.pos.Y     = rec.Y;
 }
Exemple #7
0
 public Label(FunctionParameter func, object objeto, Rectangle rec, SpriteFont font, Aligment aligment)
 {
     functionParameter  = func;
     this.objeto        = objeto;
     base.areaRectangle = rec;
     base.zOrder        = 0;
     this.text          = "";
     base.fontId        = font;
     this.aligment      = aligment;
 }
Exemple #8
0
 public IconMenuCell(int row, int column, Aligment aligment, Texture2D texture, Rectangle sourceRect, int width, int?height = null, bool shadow = false) : base(row, column, aligment)
 {
     Width  = width;
     Height = height ?? width;
     Draw   = r => Game1.spriteBatch.Draw(
         texture,
         r,
         sourceRect,
         shadow? (Color.Black * 0.3f) : Color.White);
 }
Exemple #9
0
 public Label(Function function, Rectangle rec, IntPtr font, Aligment aligment)
 {
     myFunction     = function;
     this.rectangle = rec;
     base.zOrder    = 0;
     this.textData  = "";
     base.textFont  = font;
     this.aligment  = aligment;
     this.pos.X     = rec.X;
     this.pos.Y     = rec.Y;
 }
Exemple #10
0
 public Label(FunctionParameter func, object objeto, Rectangle rec, IntPtr font, Aligment aligment)
 {
     functionParameter = func;
     this.objeto       = objeto;
     this.rectangle    = rec;
     base.zOrder       = 0;
     this.textData     = "";
     base.textFont     = font;
     this.aligment     = aligment;
     this.pos.X        = rec.X;
     this.pos.Y        = rec.Y;
 }
Exemple #11
0
 public Label(Function function, Rectangle rec, int font, Aligment aligment, bool bold)
 {
     myFunction     = function;
     this.rectangle = rec;
     base.zOrder    = 0;
     this.textData  = "";
     base.fontId    = font;
     this.aligment  = aligment;
     this.pos.X     = rec.X;
     this.pos.Y     = rec.Y;
     this.bold      = bold;
 }
Exemple #12
0
 public Style Clone(int textRotation, Aligment horizontalAlignment)
 {
     return(new Style
     {
         FillId = FillId,
         BorderId = BorderId,
         FontId = FontId,
         HorizontalAlignment = textRotation == 90 ? RotationAligment90(VerticalAlignment) : horizontalAlignment,
         TextRotation = textRotation,
         VerticalAlignment = textRotation == 90 ? RotationAligment90(horizontalAlignment) : VerticalAlignment,
         WrapText = WrapText,
     });
 }
Exemple #13
0
        public TextMenuCell(int row, int column, Aligment aligment, string text) : base(row, column, aligment)
        {
            var measure = Game1.smallFont.MeasureString(text);

            Width  = (int)measure.X;
            Height = (int)measure.Y;
            Draw   = r => Utility.drawTextWithShadow(
                Game1.spriteBatch,
                text,
                Game1.smallFont,
                new Vector2(r.X, r.Y),
                Game1.textColor);
        }
Exemple #14
0
 public Style Clone(Aligment horizontalAlignment)
 {
     return(new Style
     {
         FillId = FillId,
         BorderId = BorderId,
         FontId = FontId,
         HorizontalAlignment = horizontalAlignment,
         TextRotation = TextRotation,
         VerticalAlignment = VerticalAlignment,
         WrapText = WrapText,
     });
 }
Exemple #15
0
        private Aligment RotationAligment90(Aligment aligment)
        {
            switch (aligment)
            {
            case Aligment.Left:
                return(Aligment.Bottom);

            case Aligment.Right:
                return(Aligment.Top);

            case Aligment.Top:
                return(Aligment.Left);

            case Aligment.Bottom:
                return(Aligment.Right);

            case Aligment.Center:
                return(Aligment.Center);

            default:
                throw new ArgumentOutOfRangeException("aligment");
            }
        }
 public ItemMenuCell(int row, int column, Aligment aligment, Item o)
     : base(row, column, aligment, Game1.tileSize, Game1.tileSize, r => o.drawInMenu(Game1.spriteBatch, new Vector2(r.X, r.Y), 1))
 {
 }
Exemple #17
0
        private void AddStyle(string styleId, string styleName, Aligment horizontal, Aligment vertical, bool isBold, bool isItalic, float size,
                              bool fullBorder, int weightBorder, string borderLineStyle, int Rotate)
        {
            _writer.WriteStartElement("Style");
            _writer.WriteAttributeString("ss:ID", styleId);
            if (!string.IsNullOrEmpty(styleName))
            {
                _writer.WriteAttributeString("ss:Name", styleName);
            }

            #region Alignment
            _writer.WriteStartElement("Alignment");
            _writer.WriteAttributeString("ss:Horizontal", horizontal.ToString());
            _writer.WriteAttributeString("ss:Vertical", vertical.ToString());
            _writer.WriteAttributeString("ss:WrapText", "1");
            if (Rotate != 0)
            {
                _writer.WriteAttributeString("ss:Rotate", Rotate.ToString());
            }
            _writer.WriteEndElement();
            #endregion

            #region Borders

            _writer.WriteStartElement("Borders");
            if (fullBorder)
            {
                #region Bottom
                _writer.WriteStartElement("Border");
                _writer.WriteAttributeString("ss:Position", "Bottom");
                _writer.WriteAttributeString("ss:LineStyle", borderLineStyle);
                _writer.WriteAttributeString("ss:Weight", weightBorder.ToString());
                _writer.WriteEndElement();
                #endregion
                #region Left
                _writer.WriteStartElement("Border");
                _writer.WriteAttributeString("ss:Position", "Left");
                _writer.WriteAttributeString("ss:LineStyle", borderLineStyle);
                _writer.WriteAttributeString("ss:Weight", weightBorder.ToString());
                _writer.WriteEndElement();
                #endregion
                #region Right
                _writer.WriteStartElement("Border");
                _writer.WriteAttributeString("ss:Position", "Right");
                _writer.WriteAttributeString("ss:LineStyle", borderLineStyle);
                _writer.WriteAttributeString("ss:Weight", weightBorder.ToString());
                _writer.WriteEndElement();
                #endregion
                #region Top
                _writer.WriteStartElement("Border");
                _writer.WriteAttributeString("ss:Position", "Top");
                _writer.WriteAttributeString("ss:LineStyle", borderLineStyle);
                _writer.WriteAttributeString("ss:Weight", weightBorder.ToString());
                _writer.WriteEndElement();
                #endregion
            }
            _writer.WriteEndElement();
            #endregion

            #region Font
            _writer.WriteStartElement("Font");
            _writer.WriteAttributeString("ss:FontName", "Times New Roman");
            _writer.WriteAttributeString("x:CharSet", "204");
            _writer.WriteAttributeString("x:Family", "Roman");
            _writer.WriteAttributeString("ss:Size", size.ToString());
            _writer.WriteAttributeString("ss:Color", "#000000");
            if (isBold)
            {
                _writer.WriteAttributeString("ss:Bold", "1");
            }
            _writer.WriteEndElement();
            #endregion

            _writer.WriteEndElement();
        }
Exemple #18
0
 public MenuCell(int row, int column, Aligment aligment, int width, int height, Action<Rectangle> draw) : this(row, column, aligment)
 {
     Width = width;
     Height = height;
     Draw = draw;
 }
Exemple #19
0
 protected MenuCell(int row, int column, Aligment aligment)
 {
     Row = row;
     Column = column;
     Aligment = aligment;
 }