Inheritance: MonoBehaviour
コード例 #1
1
ファイル: RtfTableCell.cs プロジェクト: peterson1/ErrH
		internal RtfTableCell(float width, int rowIndex, int colIndex, RtfTable parentTable)
			: base(true, false)
		{
			_width = width;
			_halign = Align.None;
			_valign = AlignVertical.Top;
			_borders = new Borders();
			_mergeInfo = null;
			_rowIndex = rowIndex;
			_colIndex = colIndex;
			BackgroundColour = null;
			ParentTable = parentTable;
		}
コード例 #2
0
ファイル: AlignContainer.cs プロジェクト: alexcmd/OpenTKGUI
 public AlignContainer(Control Client, Point ClientSize, Align HorizontalAlign, Align VerticalAlign)
 {
     this._Client = Client;
     this._ClientSize = ClientSize;
     this._VerticalAlign = VerticalAlign;
     this._HorizontalAlign = HorizontalAlign;
 }
コード例 #3
0
ファイル: RtfTable.cs プロジェクト: Karousos/EYE_Sampling
		public RtfTable(int rowCount, int colCount, float horizontalWidth, float fontSize)
		{
			_fontSize = fontSize;
			_alignment = Align.None;
			_margins = new Margins();
			_rowCount = rowCount;
			_colCount = colCount;
			_representativeList = new List<RtfTableCell>();
			_startNewPage = false;
			_titleRowCount = 0;
			_cellPadding = new Margins[_rowCount];
			if (_rowCount < 1 || _colCount < 1) {
				throw new Exception("The number of rows or columns is less than 1.");
			}
			
			// Set cell default width according to paper width
			_defaultCellWidth = horizontalWidth / (float)colCount;
			_cells = new RtfTableCell[_rowCount][];
			_rowHeight = new float[_rowCount];
			_rowKeepInSamePage = new bool[_rowCount];
			for (int i = 0; i < _rowCount; i++) {
				_cells[i] = new RtfTableCell[_colCount];
				_rowHeight[i] = 0F;
				_rowKeepInSamePage[i] = false;
				_cellPadding[i] = new Margins();
				for (int j = 0; j < _colCount; j++) {
					_cells[i][j] = new RtfTableCell(_defaultCellWidth, i, j, this);
				}
			}
		}
コード例 #4
0
 public MarkdownTableBlockToken(IMarkdownRule rule, string[] header, Align[] align, string[][] cells)
 {
     Rule = rule;
     Header = header;
     Align = align;
     Cells = cells;
 }
コード例 #5
0
        /// <summary>
        /// Parse slide parameters
        /// </summary>
        /// <param name="parameters"></param>
        private void ParseParams(string parameters)
        {
            if (parameters == null || parameters.Trim().Length == 0)
                return;

            // "shrink,squeeze,c" -> ["shrink","squeeze","c"]
            string[] parts = parameters.Replace(" ", "").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string part in parts)
            {
                switch (part)
                {
                    case "t":
                        ContentAlign = Align.TOP;
                        break;
                    case "c":
                        ContentAlign = Align.CENTER;
                        break;
                    case "b":
                        ContentAlign = Align.BOTTOM;
                        break;
                    default:
                        break;
                }
            }
        }
コード例 #6
0
		public override void Clear()
		{
			_memoized_size = _b0 = 0;
			_id = 0;
			_name = null;
			_align = Align.Left;
			_weights.Clear();
		}
コード例 #7
0
	void Start()
	{
		ResetVelocities ();
		alignScript = GetComponent<Align> ();
		behaviour = GetComponents<SteeringBehavior> ();
		creature = GetComponent<Creature> ();
//		defaultY = transform.position.y;
	}
コード例 #8
0
ファイル: Label.cs プロジェクト: maesse/CubeHags
 public Label(string text, float fontSize, System.Drawing.Color fontColor, Window window)
     : base(window)
 {
     this.Name = "Label";
     Text = text;
     Alignment = Align.LEFT;
     Color = fontColor;
 }
コード例 #9
0
ファイル: Text.cs プロジェクト: Aaron-Durant/Asteroids2
 /// <summary>
 /// Creates a new Text object
 /// </summary>
 /// <param name="font"> The font to use for the Text </param>
 /// <param name="text"> The text to display </param>
 /// <param name="position"> The position of the Text </param>
 /// <param name="color"> The color of the Text </param>
 /// <param name="alignment"> The alignment of the Text </param>
 public Text(SpriteFont font, String text, Vector2 position, Color color, Align alignment)
 {
     Font = font;
     this.text = text;
     Position = position;
     TextColor = color;
     Alignment = alignment;
 }
コード例 #10
0
ファイル: Header.cs プロジェクト: txdv/sharpmod
 public Header(string name, Align alignment, Align cellAlignment, int minimumLength, int maximumLength)
 {
     Name = name;
     Alignment = alignment;
     CellAlignment = cellAlignment;
     MinimumLength = minimumLength;
     MaximumLength = maximumLength;
 }
コード例 #11
0
 public LogicText(string text, float fontSize, PointF location, SizeF size, Align alignment, Color color)
 {
     this.text = text;
     this.font = new Font(DefaultFamily, fontSize);
     this.Location = location;
     this.Size = size;
     this.alignment = alignment;
     this.ForeColor = color;
 }
コード例 #12
0
ファイル: Label.cs プロジェクト: Layoric/xWinFormsLib
 //bool wordwrap = false;
 public Label(string name, Vector2 position, string text, Color backColor, Color foreColor, int width, Align alignment)
     : base(name, position)
 {
     this.Text = text;
     this.BackColor = backColor;
     this.ForeColor = foreColor;
     this.alignment = alignment;
     this.Width = width;
 }
コード例 #13
0
ファイル: HorizontalAlign.cs プロジェクト: Fedorm/core-master
        public override Style FromString(string s)
        {
            Align result;
            if (!Enum.TryParse<Align>(s, true, out result))
                throw new Exception("Invalid horizontal-align value");

            this.Value = result;
            return this;
        }
コード例 #14
0
ファイル: RtfSection.cs プロジェクト: Karousos/EYE_Sampling
		internal RtfSection(SectionStartEnd startEnd, RtfDocument doc)
		{
			ParentDocument = doc;
			_align = Align.None;
			PageOrientation = PaperOrientation.Portrait;
			StartEnd = startEnd;
			FooterPositionFromPageBottom = 720;
			_sectionFooter = null;
			_margins = new Margins();
		}
コード例 #15
0
		internal RtfTableCell(float width, int rowIndex, int colIndex)
			: base(true, true, false, true, false)
		{
			_width = width;
			_halign = Align.None;
			_valign = AlignVertical.Top;
			_borders = new Borders();
			_mergeInfo = null;
			_rowIndex = rowIndex;
			_colIndex = colIndex;
		}
コード例 #16
0
 /// <summary>Creates a new StringBlock</summary>
 /// <param name="text">Text to render</param>
 /// <param name="textBox">Text box to constrain text</param>
 /// <param name="alignment">Font alignment</param>
 /// <param name="size">Font size in pixels(max height of line)</param>
 /// <param name="color">Color</param>
 /// <param name="kerning">true to use kerning, false otherwise.</param>
 public StringBlock(string text, RectangleF textRect, Align alignment,
     float size, ColorValue color, bool kerning)
 {
     Text = text;
     TextRect = textRect;
     ViewportRect = textRect;
     Alignment = alignment;
     Size = size;
     Color = color;
     Kerning = kerning;
 }
コード例 #17
0
ファイル: TextAlign.cs プロジェクト: Fedorm/core-master
        public override Style FromString(string s)
        {
            s = s.Trim();

            Align result;
            if (!Enum.TryParse<Align>(s, true, out result))
                throw new Exception("Invalid text-align value: " + s);
            
            this.Value = result;
            return this;
        }
コード例 #18
0
ファイル: Menu.cs プロジェクト: Aaron-Durant/Asteroids2
 /// <summary>
 /// Creates a new Menu Object
 /// </summary>
 /// <param name="position"> The postion of the first item in the menu </param>
 /// <param name="spacing"> The spacing betweeen each item in the menu </param>
 /// <param name="isVerticle"> Set to true for Verticle menu, false for Horizontal menu </param>
 /// <param name="font"> The font to be used in the menu </param>
 /// <param name="menuColor"> The default color of the menu items </param>
 /// <param name="scale"> The default scale of the menu items </param>
 /// <param name="alignment"> The alignment of items in the menu </param>
 /// <param name="onBack"> The delegate to call when going back from this menu </param>
 public Menu(Vector2 position, int spacing, bool isVerticle, SpriteFont font, Color menuColor, Vector2 scale, Align alignment, TextSelect onBack)
 {
     MenuItems = new List<Text>();
     StartPosition = position;
     Spacing = spacing;
     VerticalMenu = isVerticle;
     Font = font;
     MenuColor = menuColor;
     Alignment = alignment;
     Scale = scale;
     OnBack = onBack;
 }
コード例 #19
0
 /// <summary>
 /// 构造方法
 /// </summary>
 /// <param name="text">文本内容</param>
 /// <param name="fontSize">字号</param>
 /// <param name="fontFamily">字体</param>
 /// <param name="location">位置坐标</param>
 /// <param name="alignment">对齐方式</param>
 /// <param name="angle">旋转角度</param>
 /// <param name="color">颜色</param>
 /// <param name="dynamics">动态属性</param>
 public LogicText(string text, float fontSize, FontFamily fontFamily, PointF location, SizeF size,
     Align alignment, float angle, Color color, params string[] dynamics)
     : base(dynamics)
 {
     this.text = text;
     this.font = new Font(fontFamily, fontSize);
     this.Location = location;
     this.Size = size;
     this.alignment = alignment;
     this.angle = angle;
     this.ForeColor = color;
 }
コード例 #20
0
ファイル: TagCol.cs プロジェクト: bzure/BSA.Net
        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            int? span = null,
            MultiLength width = null,
            string id = null,
            string @class = null,
            string style = null,
            string title = null,
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null,
            string onclick = null,
            string ondblclick = null,
            string onmousedown = null,
            string onmouseup = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout = null,
            string onkeypress = null,
            string onkeydown = null,
            string onkeyup = null,
            Align? align = null,
            char? @char = null,
            Length charoff = null,
            Valign? valign = null
        )
        {
            Span = span;
            Width = width;
            Id = id;
            Class = @class;
            Style = style;
            Title = title;
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;
            OnClick = onclick;
            OnDblClick = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut = onmouseout;
            OnKeyPress = onkeypress;
            OnKeyDown = onkeydown;
            OnKeyUp = onkeyup;
            Align = align;
            Char = @char;
            CharOff = charoff;
            Valign = valign;

            return this;
        }
コード例 #21
0
ファイル: TextGraphics.cs プロジェクト: hgabor/kfirpgcreator
        /// <summary>
        /// Creates a new text to be shown on screen.
        /// </summary>
        /// <param name="text">The text to be shown.</param>
        /// <param name="align">The alignment of the text.</param>
        /// <param name="dialogs"></param>
        /// <param name="game"></param>
        /// <remarks>Use to Coords property to set the location.</remarks>
        public TextGraphics(string text, Align align, Dialogs dialogs, Game game)
        {
            this.game = game;
            this.dialogs = dialogs;
            this.align = align;
            SdlDotNet.Graphics.Font font = dialogs.Font;

            //HACK: Font.Render only returns a Surface with transparent background when called
            //      with textWidth=0 and maxLines=0, and when the text contains no newline characters.
            //      Otherwise it renders on a black background.
            //      So we need to break up the string into lines by hand.
            List<string> lines = SplitAndRejoin(text, font);
            textSurfaces = lines.ConvertAll<Surface>(s => font.Render(s, Color.White, true, 0, 0));
        }
コード例 #22
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="rect">Control's size and position</param>
        /// <param name="text">Control's text</param>
        /// <param name="fontSize">Font size in pixels(max line height). 0 for default</param>
        /// <param name="font">Font, "" for default to current style</param>
        /// <param name="alignment">Text alignment</param>
        /// <param name="color">Text color</param>
        public GuiTextLabel(string text, RectangleF rect, float fontSize,
            string fontName, Align alignment, Color color)
            : base(rect, GM.GetUniqueName())
        {
            m_text = text;

            ProcessStyle(GM.GUIStyleManager.GetCurrentStyle());
            if (fontSize != 0) m_fontSize = fontSize;
            m_alignment = alignment;
            m_color = color;
            //StringBlock b = new StringBlock(m_text, new RectangleF(m_position, m_size), m_alignment, m_fontSize, ColorValue.FromColor(Color.Black), true);
            //m_textQuads = GM.FontManager.GetFont(m_fontName, m_fontSize).GetProcessedQuads(b);
            BuildTextQuads();
        }
コード例 #23
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="rect">Control's size and position</param>
        /// <param name="text">Control's text</param>
        /// <param name="fontSize">Font size in pixels(max line height). 0 for default</param>
        /// <param name="fontName">Font</param>
        /// <param name="alignment">Text alignment</param>
        /// <param name="color">Text color</param>
        public GuiEditBox(string text, Rectangle rect, float fontSize,
            string fontName, Align alignment, Color color)
            : base(rect, GM.GetUniqueName())
        {
            m_text = "";
            m_fontSize = (fontSize == 0) ? DefaultValues.TextSize : fontSize;
            FontName = fontName;
            m_alignment = alignment;
            m_color = color;

            ProcessStyle(GM.GUIStyleManager.GetCurrentStyle());

            BuildTextQuads();
        }
コード例 #24
0
	public Renderer(float size,
		float width,
		float height,
		Style style,
		Align align = Align.LEFT,
		VerticalAlign verticalAlign = VerticalAlign.TOP,
		float lineSpacing = 1.0f,
		float letterSpacing = 0.0f,
		float leftMargin = 0.0f,
		float rightMargin = 0.0f)
	{
		Init(size, width, height, style, align, verticalAlign,
			lineSpacing, letterSpacing, leftMargin, rightMargin);
	}
コード例 #25
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="rect">Control's size and position</param>
        /// <param name="text">Control's text</param>
        /// <param name="fontSize">Font size in pixels(max line height). 0 for default</param>
        public GuiEditBox(string text, RectangleF rect, float fontSize)
            : base(rect, GM.GetUniqueName())
        {
            m_text = "";
            m_fontSize = (fontSize == 0) ? DefaultValues.TextSize : fontSize;
            FontName = "Default";
            m_alignment = Align.Left;
            m_color = Color.Black;

            ProcessStyle(GM.GUIStyleManager.GetCurrentStyle());

            Text = text;
            BuildTextQuads();
        }
コード例 #26
0
                public Parameter(float size, float width, float height, Style style,
			Align align, VerticalAlign verticalAlign, float lineSpacing,
			float letterSpacing, float leftMargin, float rightMargin)
                {
                    mSize = size;
                    mWidth = width;
                    mHeight = height;
                    mStyle = style;
                    mAlign = align;
                    mVerticalAlign = verticalAlign;
                    mLineSpacing = lineSpacing;
                    mLetterSpacing = letterSpacing;
                    mLeftMargin = leftMargin;
                    mRightMargin = rightMargin;
                }
コード例 #27
0
ファイル: RtfImage.cs プロジェクト: peterson1/ErrH
		internal RtfImage(string fileName, ImageFileType type)
		{
			_imgFname = fileName;
			_imgType = type;
			_alignment = Align.None;
			_margins = new Margins();
			_keepAspectRatio = true;
			_blockHead = @"{\pard";
			_blockTail = @"\par}";
			_startNewPage = false;
			
			Image image = Image.FromFile(fileName);
			_width = (image.Width / image.HorizontalResolution) * 72;
			_height = (image.Height / image.VerticalResolution) * 72;
		}
コード例 #28
0
ファイル: RtfPrinter.cs プロジェクト: ondister/Recog
        protected void TypeCellParagraph(RtfTableCell cell, int fontsize, Align align, string text)
        {
            if (doc != null)
            {
                FontDescriptor times = doc.createFont("Times New Roman");
                RtfCharFormat fmt;
                RtfParagraph par;

                par = cell.addParagraph();
                par.Alignment = align;
                fmt = par.addCharFormat();
                fmt.Font = times;
                fmt.FontSize = fontsize;
                par.setText(text);
            }
        }
コード例 #29
0
ファイル: RtfParagraph.cs プロジェクト: peterson1/ErrH
		public RtfParagraph(bool allowFootnote, bool allowControlWord)
		{
			_text = new StringBuilder();
			_linespacing = -1;
			_margins = new Margins();
			_align = Align.None;
			_charFormats = new List<RtfCharFormat>();
			_allowFootnote = allowFootnote;
			_allowControlWord = allowControlWord;
			_footnotes = new List<RtfFootnote>();
			_controlWords = new List<RtfFieldControlWord>();
			_blockHead = @"{\pard";
			_blockTail = @"\par}";
			_startNewPage = false;
			_firstLineIndent = 0;
			_defaultCharFormat = null;
		}
コード例 #30
0
ファイル: UKUIHelper.cs プロジェクト: hagish/tektix
    public void SetPosition( Transform trans,  Vector2 pos, Align align=Align.LeftTop )
    {
        if( cameraHud == null ) {
            Debug.LogError( "Call UKUIHelper.Instance.Init( Camera cam ); first!" );
            return;
        }
        if( trans.root.rotation != Quaternion.identity ) {
            Debug.LogError ( "UKUIHelper: Set your HUD rotation to 0!" );
            return;
        }

        UpdateInformation ui = new UpdateInformation(){
            transform = trans,
            position = pos,
            align = align
        };

        autoUpdateList.Add( ui );
        positionTransform( ui );
    }
コード例 #31
0
        // update the view
        public void preview(object sender, EventArgs e)
        {
            QuoteForm quoteForm = (QuoteForm)((Button)sender).FindForm();

            try
            {
                //start creating the PDF

                //Create a Catalog Dictionary
                CatalogDict catalogDict = new CatalogDict();

                //Create a Page Tree Dictionary
                PageTreeDict pageTreeDict = new PageTreeDict();

                //Create a Font Dictionary - Only the standard fonts Time, Helvetica and courier etc can be created by this method.
                //See Adobe doco for more info on other fonts
                FontDict TimesRoman  = new FontDict();
                FontDict TimesItalic = new FontDict();
                FontDict TimesBold   = new FontDict();
                FontDict Courier     = new FontDict();

                //Create the info Dictionary
                InfoDict infoDict = new InfoDict();
                //Create the font called Times Roman
                TimesRoman.CreateFontDict("T1", "Times-Roman");

                //Create the font called Times Italic
                TimesItalic.CreateFontDict("T2", "Times-Italic");

                //Create the font called Times Bold
                TimesBold.CreateFontDict("T3", "Times-Bold");

                //Create the font called Courier
                Courier.CreateFontDict("T4", "Courier");

                //Set the info Dictionary. xxx will be the invoice number
                infoDict.SetInfo("Quote xxx" /*+ quoteForm.getID()*/, "System Generated", "Fire-Alert");

                //Create a utility object
                Utility pdfUtility = new Utility();
                String  FilePath   = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory) + "\\Resources\\Quote.pdf";

                //Open a file specifying the file name as the output pdf file
                //String FilePath = @"C:\Users\Hassan\Desktop\Preview.pdf";

                FileStream file = new FileStream(FilePath, FileMode.Create);
                int        size = 0;
                file.Write(pdfUtility.GetHeader("1.5", out size), 0, size);
                file.Close();

                //Finished the first step



                //Create a Page Dictionary , this represents a visible page
                PageDict    page    = new PageDict();
                ContentDict content = new ContentDict();

                //The page size object will hold all the page size information
                //also holds the dictionary objects for font, images etc.
                //A4 595,842
                //Letter 612,792
                PageSize pSize = new PageSize(612, 792); //A4 paper portrait in 1/72" measurements
                pSize.SetMargins(10, 10, 10, 10);

                //create the page main details
                page.CreatePage(pageTreeDict.objectNum, pSize);

                //add a page
                pageTreeDict.AddPage(page.objectNum);

                //add the fonts to this page
                page.AddResource(TimesRoman, content.objectNum);
                page.AddResource(TimesItalic, content.objectNum);
                page.AddResource(TimesBold, content.objectNum);
                page.AddResource(Courier, content.objectNum);

                //Create a Text And Table Object that presents the text elements in the page
                TextAndTables textAndtable = new TextAndTables(pSize);

                //create the reference to an image and the data that represents it
                String    ImagePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory) + "\\Resources\\logo.jpg"; //file path to image source
                ImageDict I1        = new ImageDict();                                                                         //new image dictionary object
                I1.CreateImageDict("I1", ImagePath);                                                                           //create the object which describes the image
                page.AddImageResource(I1.PDFImageName, I1, content.objectNum);                                                 //create a reference where the PDF can identify which object
                //describes the image when we want to draw it on the page

                /*
                 * draw the image to page (add the instruction to the content stream which says draw the image called I1 starting
                 * at X = 269, Y = 20 and with an ACTUAL image size on the page of w = 144 and h = 100)
                 */
                PageImages pi = new PageImages();
                content.SetStream(pi.ShowImage("I1", 400, 680, 155, 85));   //tell the PDF we want to draw an image called 'I1', where and what size

                String[] sAd = new String[6];
                sAd = new ServiceAddress().get(quoteForm.getServiceAddressId()).Split(',');

                String[] client = new String[9];
                client = new Client().get(new ClientContract().getClient(quoteForm.getServiceAddressId())).Split(',');

                String[] franchisee = new String[6];
                franchisee = new Franchisee().get(new ClientContract().getFranchisee(quoteForm.getServiceAddressId())).Split(',');

                String[] user = new String[4];
                user = new Users().get(franchiseeUserId).Split(',');

                //Add text to the page
                textAndtable.AddText(50, 50, "Quote: " + ((type == 2) ? quoteForm.getId() : "To Be Created"), 10, "T3", Align.LeftAlign);
                textAndtable.AddText(50, 60, "Date Issued: " /* + quoteForm.getDateIssued()*/, 10, "T3", Align.LeftAlign);


                textAndtable.AddText(50, 100, "To: " + client[0], 10, "T3", Align.LeftAlign);
                textAndtable.AddText(50, 110, client[4], 10, "T1", Align.LeftAlign);
                textAndtable.AddText(50, 120, client[6] + ", " + client[7] + ", " + client[8] + " " + client[2], 10, "T1", Align.LeftAlign);
                textAndtable.AddText(50, 130, "Primary Contact: " + client[5], 10, "T1", Align.LeftAlign);
                textAndtable.AddText(50, 140, "Ph: " + client[3], 10, "T1", Align.LeftAlign);

                textAndtable.AddText(300, 100, "Prepared By: ", 10, "T3", Align.LeftAlign);
                textAndtable.AddText(300, 110, franchisee[5], 10, "T3", Align.LeftAlign);
                textAndtable.AddText(300, 120, franchisee[0], 10, "T1", Align.LeftAlign);
                textAndtable.AddText(300, 130, franchisee[2] + ", " + franchisee[3] + ", " + franchisee[4] + " " + franchisee[1], 10, "T1", Align.LeftAlign);
                textAndtable.AddText(300, 140, "Contact: " + user[0] + " " + user[1], 10, "T1", Align.LeftAlign);
                textAndtable.AddText(300, 150, "Ph: " + user[2], 10, "T1", Align.LeftAlign);
                textAndtable.AddText(300, 160, "Email: " + user[3], 10, "T1", Align.LeftAlign);
                textAndtable.AddText(300, 170, "Web: http://www.fire-alert.ca", 10, "T1", Align.LeftAlign);

                textAndtable.AddText(50, 160, "Service Location: ", 10, "T3", Align.LeftAlign);
                textAndtable.AddText(50, 170, sAd[0], 10, "T1", Align.LeftAlign);
                textAndtable.AddText(50, 180, sAd[3] + ", " + sAd[4] + ", " + sAd[5] + " " + sAd[1], 10, "T1", Align.LeftAlign);

                //Add table to the page
                Align[] alignC = new Align[4];
                alignC[0] = Align.CenterAlign;
                alignC[1] = Align.CenterAlign;
                alignC[2] = Align.CenterAlign;
                alignC[3] = Align.CenterAlign;

                Align[] alignR = new Align[4];
                alignR[0] = Align.LeftAlign;
                alignR[1] = Align.LeftAlign;
                alignR[2] = Align.LeftAlign;
                alignR[3] = Align.LeftAlign;

                //Specify the color for the cell and the line
                ColorSpec cellColor = new ColorSpec(196, 34, 34);
                ColorSpec lineColor = new ColorSpec(1, 1, 1);

                //Fill in the parameters for the table
                TableParams table = new TableParams(2, 235, 90, 75, 75);
                table.yPos      = 550;
                table.xPos      = 50;
                table.rowHeight = 15;

                //Set the parameters of this table
                textAndtable.SetParams(table, cellColor, Align.CenterAlign, 3);
                textAndtable.AddRow(false, 8, "T3", alignC, true, "Service Rep.", "Valid Until");
                //After drawing table and text add them to the page
                content.SetStream(textAndtable.EndTable(lineColor, true));

                TextAndTables textAndtable2 = new TextAndTables(pSize);
                //Specify the color for the cell and the line
                ColorSpec   cell1  = new ColorSpec(255, 255, 255);
                ColorSpec   line1  = new ColorSpec(1, 1, 1);
                TableParams table2 = new TableParams(2, 235, 90, 75, 75);
                table2.yPos      = 535;
                table2.xPos      = 50;
                table2.rowHeight = 15;
                textAndtable2.SetParams(table2, cell1, Align.CenterAlign, 3);
                textAndtable2.AddRow(false, 8, "T3", alignR, false, "", "");
                content.SetStream(textAndtable2.EndTable(line1, true));

                Align[] alignC2 = new Align[7];
                alignC2[0] = Align.CenterAlign;
                alignC2[1] = Align.CenterAlign;
                alignC2[2] = Align.CenterAlign;
                alignC2[3] = Align.CenterAlign;
                alignC2[4] = Align.CenterAlign;
                alignC2[5] = Align.CenterAlign;
                alignC2[6] = Align.CenterAlign;


                Align[] alignR2 = new Align[7];
                alignR2[0] = Align.LeftAlign;
                alignR2[1] = Align.LeftAlign;
                alignR2[2] = Align.LeftAlign;
                alignR2[3] = Align.LeftAlign;
                alignR2[4] = Align.RightAlign;
                alignR2[5] = Align.RightAlign;
                alignR2[6] = Align.RightAlign;

                TextAndTables textAndtable3 = new TextAndTables(pSize);
                //Specify the color for the cell and the line
                ColorSpec   cell2  = new ColorSpec(196, 34, 34);
                ColorSpec   line2  = new ColorSpec(1, 1, 1);
                TableParams table3 = new TableParams(7, 15, 100, 160, 40, 40, 60, 60);
                table3.yPos      = 510;
                table3.xPos      = 50;
                table3.rowHeight = 15;
                textAndtable3.SetParams(table3, cell2, Align.CenterAlign, 3);
                textAndtable3.AddRow(false, 8, "T3", alignC2, true, "#", "Charge", "Description", "Hours", "Qty", "Price", "Line Total");
                content.SetStream(textAndtable3.EndTable(line2, true));


                TextAndTables textAndtable4 = new TextAndTables(pSize);
                //Specify the color for the cell and the line
                ColorSpec   cell3  = new ColorSpec(255, 255, 255);
                ColorSpec   line3  = new ColorSpec(1, 1, 1);
                TableParams table4 = new TableParams(7, 15, 100, 160, 40, 40, 60, 60);
                table4.yPos      = 495;
                table4.xPos      = 50;
                table4.rowHeight = 15;
                textAndtable4.SetParams(table4, cell3, Align.CenterAlign, 3);
                DataGridView dgvSalesOrder = quoteForm.getQuoteItems();
                for (int i = 0; i < dgvSalesOrder.Rows.Count - 1; i++)
                {
                    textAndtable4.AddRow(false, 8, "T3", alignR2, false, dgvSalesOrder.Rows[i].Cells[0].Value.ToString(),
                                         dgvSalesOrder.Rows[i].Cells[1].FormattedValue.ToString(), dgvSalesOrder.Rows[i].Cells[2].Value.ToString(),
                                         (dgvSalesOrder.Rows[i].Cells[3].Value == null || dgvSalesOrder.Rows[i].Cells[3].Value.ToString() == "") ? "-" : dgvSalesOrder.Rows[i].Cells[3].Value.ToString(),
                                         (dgvSalesOrder.Rows[i].Cells[4].Value == null || dgvSalesOrder.Rows[i].Cells[4].Value.ToString() == "") ? "-" : dgvSalesOrder.Rows[i].Cells[4].Value.ToString(),
                                         dgvSalesOrder.Rows[i].Cells[5].Value.ToString(), dgvSalesOrder.Rows[i].Cells[6].Value.ToString());
                }
                content.SetStream(textAndtable4.EndTable(line3, true));



                textAndtable.AddText(400, 650, "Subtotal ", 10, "T1", Align.LeftAlign);
                textAndtable.AddText(400, 665, "HST ", 10, "T1", Align.LeftAlign);
                textAndtable.AddText(400, 680, "Total ", 10, "T1", Align.LeftAlign);


                TextAndTables textAndtable5 = new TextAndTables(pSize);
                Align[]       align         = new Align[1];
                align[0] = Align.RightAlign;
                //Specify the color for the cell and the line
                TableParams table5 = new TableParams(1, 60);
                table5.yPos      = 152;
                table5.xPos      = 100;
                table5.rowHeight = 15;
                textAndtable5.SetParams(table5, cell3, Align.RightAlign, 3);
                textAndtable5.AddRow(false, 10, "T3", align, false, quoteForm.getSubtotal());
                textAndtable5.AddRow(false, 10, "T3", align, false, quoteForm.getHST());
                content.SetStream(textAndtable5.EndTable(line3, true));

                TextAndTables textAndtable6 = new TextAndTables(pSize);
                //Specify the color for the cell and the line
                TableParams table6 = new TableParams(1, 60);
                table6.yPos      = 122;
                table6.xPos      = 100;
                table6.rowHeight = 15;
                textAndtable6.SetParams(table6, cell2, Align.RightAlign, 3);
                textAndtable6.AddRow(false, 10, "T3", align, true, "$" + quoteForm.getTotal());


                content.SetStream(textAndtable.EndText());


                //All done - send the information to the PDF file

                size = 0;
                file = new FileStream(FilePath, FileMode.Append);
                file.Write(page.GetPageDict(file.Length, out size), 0, size);
                file.Write(content.GetContentDict(file.Length, out size), 0, size);
                file.Close();

                file = new FileStream(FilePath, FileMode.Append);
                file.Write(catalogDict.GetCatalogDict(pageTreeDict.objectNum, file.Length, out size), 0, size);
                file.Write(pageTreeDict.GetPageTree(file.Length, out size), 0, size);
                file.Write(TimesRoman.GetFontDict(file.Length, out size), 0, size);
                file.Write(TimesItalic.GetFontDict(file.Length, out size), 0, size);
                file.Write(TimesBold.GetFontDict(file.Length, out size), 0, size);
                file.Write(Courier.GetFontDict(file.Length, out size), 0, size);

                //write image dict
                file.Write(I1.GetImageDict(file.Length, out size), 0, size);

                file.Write(infoDict.GetInfoDict(file.Length, out size), 0, size);
                file.Write(pdfUtility.CreateXrefTable(file.Length, out size), 0, size);
                file.Write(pdfUtility.GetTrailer(catalogDict.objectNum, infoDict.objectNum, out size), 0, size);
                file.Close();

                //Messages.Visible = true;
                Preview testDialog = new Preview(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory) + "\\Resources\\Quote.pdf");
                testDialog.ShowDialog(quoteForm);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Could not display the document because " + ex.ToString());
            }
        }
コード例 #32
0
        public override Widget build(BuildContext context)
        {
            D.assert(MaterialD.debugCheckHasMaterialLocalizations(context));
            ThemeData     themeData   = Theme.of(context);
            ScaffoldState scaffold    = Scaffold.of(context, nullOk: true);
            ModalRoute    parentRoute = ModalRoute.of(context);

            bool hasDrawer      = scaffold?.hasDrawer ?? false;
            bool hasEndDrawer   = scaffold?.hasEndDrawer ?? false;
            bool canPop         = parentRoute?.canPop ?? false;
            bool useCloseButton = parentRoute is PageRoute && ((PageRoute)parentRoute).fullscreenDialog;

            IconThemeData appBarIconTheme = this.widget.iconTheme ?? themeData.primaryIconTheme;
            TextStyle     centerStyle     = this.widget.textTheme?.title ?? themeData.primaryTextTheme.title;
            TextStyle     sideStyle       = this.widget.textTheme?.body1 ?? themeData.primaryTextTheme.body1;

            if (this.widget.toolbarOpacity != 1.0f)
            {
                float opacity =
                    new Interval(0.25f, 1.0f, curve: Curves.fastOutSlowIn).transform(this.widget.toolbarOpacity);
                if (centerStyle?.color != null)
                {
                    centerStyle = centerStyle.copyWith(color: centerStyle.color.withOpacity(opacity));
                }

                if (sideStyle?.color != null)
                {
                    sideStyle = sideStyle.copyWith(color: sideStyle.color.withOpacity(opacity));
                }

                appBarIconTheme = appBarIconTheme.copyWith(
                    opacity: opacity * (appBarIconTheme.opacity ?? 1.0f)
                    );
            }

            Widget leading = this.widget.leading;

            if (leading == null && this.widget.automaticallyImplyLeading)
            {
                if (hasDrawer)
                {
                    leading = new IconButton(
                        icon: new Icon(Icons.menu),
                        onPressed: this._handleDrawerButton,
                        tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip);
                }
                else
                {
                    if (canPop)
                    {
                        leading = useCloseButton ? (Widget) new CloseButton() : new BackButton();
                    }
                }
            }

            if (leading != null)
            {
                leading = new ConstrainedBox(
                    constraints: BoxConstraints.tightFor(width: AppBarUtils._kLeadingWidth),
                    child: leading);
            }

            Widget title = this.widget.title;

            if (title != null)
            {
                bool namesRoute = false;
                switch (Application.platform)
                {
                case RuntimePlatform.IPhonePlayer:
                    break;

                default:
                    namesRoute = true;
                    break;
                }

                title = new DefaultTextStyle(
                    style: centerStyle,
                    softWrap: false,
                    overflow: TextOverflow.ellipsis,
                    child: title);
            }

            Widget actions = null;

            if (this.widget.actions != null && this.widget.actions.isNotEmpty())
            {
                actions = new Row(
                    mainAxisSize: MainAxisSize.min,
                    crossAxisAlignment: CrossAxisAlignment.stretch,
                    children: this.widget.actions);
            }
            else if (hasEndDrawer)
            {
                actions = new IconButton(
                    icon: new Icon(Icons.menu),
                    onPressed: this._handleDrawerButtonEnd,
                    tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip);
            }

            Widget toolbar = new NavigationToolbar(
                leading: leading,
                middle: title,
                trailing: actions,
                centerMiddle: this.widget._getEffectiveCenterTitle(themeData).Value,
                middleSpacing: this.widget.titleSpacing);

            Widget appBar = new ClipRect(
                child: new CustomSingleChildLayout(
                    layoutDelegate: new _ToolbarContainerLayout(),
                    child: IconTheme.merge(
                        data: appBarIconTheme,
                        child: new DefaultTextStyle(
                            style: sideStyle,
                            child: toolbar)
                        )
                    )
                );

            if (this.widget.bottom != null)
            {
                appBar = new Column(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: new List <Widget> {
                    new Flexible(
                        child: new ConstrainedBox(
                            constraints: new BoxConstraints(maxHeight: Constants.kToolbarHeight),
                            child: appBar
                            )
                        ),
                    this.widget.bottomOpacity == 1.0f
                            ? (Widget)this.widget.bottom
                            : new Opacity(
                        opacity: new Interval(0.25f, 1.0f, curve: Curves.fastOutSlowIn).transform(this.widget
                                                                                                  .bottomOpacity),
                        child: this.widget.bottom
                        )
                }
                    );
            }

            if (this.widget.primary)
            {
                appBar = new SafeArea(
                    top: true,
                    child: appBar);
            }

            appBar = new Align(
                alignment: Alignment.topCenter,
                child: appBar);

            if (this.widget.flexibleSpace != null)
            {
                appBar = new Stack(
                    fit: StackFit.passthrough,
                    children: new List <Widget> {
                    this.widget.flexibleSpace,
                    appBar
                }
                    );
            }

            Brightness           brightness   = this.widget.brightness ?? themeData.primaryColorBrightness;
            SystemUiOverlayStyle overlayStyle = brightness == Brightness.dark
                ? SystemUiOverlayStyle.light
                : SystemUiOverlayStyle.dark;

            return(new AnnotatedRegion <SystemUiOverlayStyle>(
                       value: overlayStyle,
                       child: new Material(
                           color: this.widget.backgroundColor ?? themeData.primaryColor,
                           elevation: this.widget.elevation,
                           child: appBar
                           )));
        }
コード例 #33
0
    void MainSteeringBehaviors()
    {
        ResetOrientation();

        switch (choiceOfBehavior)
        {
        case steeringBehaviors.Seek:
            Seek seek = new Seek();
            seek.character = this;
            seek.target    = newTarget;
            SteeringOutput seeking = seek.getSteering();
            if (seeking != null)
            {
                linearVelocity  += seeking.linearVelocity * Time.deltaTime;
                angularVelocity += seeking.angularVelocity * Time.deltaTime;
            }
            break;

        case steeringBehaviors.Flee:
            Flee flee = new Flee();
            flee.character = this;
            flee.target    = newTarget;
            SteeringOutput fleeing = flee.getSteering();
            if (fleeing != null)
            {
                linearVelocity  += fleeing.linearVelocity * Time.deltaTime;
                angularVelocity += fleeing.angularVelocity * Time.deltaTime;
            }
            break;

        case steeringBehaviors.Align:
            Align align = new Align();
            align.character = this;
            align.target    = newTarget;
            SteeringOutput aligning = align.getSteering();
            if (aligning != null)
            {
                linearVelocity  += aligning.linearVelocity * Time.deltaTime;
                angularVelocity += aligning.angularVelocity * Time.deltaTime;
            }
            break;

        case steeringBehaviors.Face:
            Face face = new Face();
            face.character = this;
            face.target    = newTarget;
            SteeringOutput facing = face.getSteering();
            if (facing != null)
            {
                linearVelocity  += facing.linearVelocity * Time.deltaTime;
                angularVelocity += facing.angularVelocity * Time.deltaTime;
            }
            break;

        case steeringBehaviors.LookWhereGoing:
            LookWhereGoing look = new LookWhereGoing();
            look.character = this;
            look.target    = newTarget;
            SteeringOutput looking = look.getSteering();
            if (looking != null)
            {
                linearVelocity  += looking.linearVelocity * Time.deltaTime;
                angularVelocity += looking.angularVelocity * Time.deltaTime;
            }
            break;

        case steeringBehaviors.Arrive:
            Arrive arrive = new Arrive();
            arrive.character = this;
            arrive.target    = newTarget;
            SteeringOutput arriving = arrive.getSteering();
            if (arriving != null)
            {
                linearVelocity  += arriving.linearVelocity * Time.deltaTime;
                angularVelocity += arriving.angularVelocity * Time.deltaTime;
            }
            break;
        }
    }
 public static void DrawStar(SpriteBatch spriteBatch, Vector2 position, int color, Align align = null, ViewController view = null)
 {
     if (align == null)
     {
         spriteBatch.Draw(Assets.SystemTextures[color], position, Color.White);
     }
     else if (align != null && view != null)
     {
         spriteBatch.Draw(Assets.SystemTextures[color], align.GetRect(view), Color.White);
     }
 }
 public static void DrawPlanet(SpriteBatch spriteBatch, Vector2 position, int texture, Align align = null, ViewController view = null)
 {
     if (align == null)
     {
         spriteBatch.Draw(Assets.PlanetTextures[texture], position, Color.White);
     }
     else if (align != null && view != null)
     {
         spriteBatch.Draw(Assets.PlanetTextures[texture], align.GetRect(view), Color.White);
     }
 }
コード例 #36
0
 internal EditBox(IntPtr _parent, WidgetStyle _style, string _skin, IntCoord _coord, Align _align, string _layer, string _name)
     : base(_parent, _style, _skin, _coord, _align, _layer, _name)
 {
 }
コード例 #37
0
    // Update is called once per frame
    void Update()
    {
        transform.position += linearVelocity * Time.deltaTime;
        // adding angular velocity to current transform rotation y component
        if (float.IsNaN(angularVelocity))
        {
            angularVelocity = 0;
        }
        transform.eulerAngles += new Vector3(0, angularVelocity * Time.deltaTime, 0);
        //dynamicSteering steering = new Seek();
        // control to switch to proper steering behavior
        if (!arrive)
        {
            Seek mySeek = new Seek();
            mySeek.ai = this;
            // if seek is false set seek property on class to false to activate flee
            if (!seek)
            {
                mySeek.seek = false;
            }
            else
            {
                mySeek.seek = true;
            }
            mySeek.target = target;
            SteeringOutput steering = mySeek.GetSteering();
            linearVelocity  += steering.linear * Time.deltaTime;
            angularVelocity += steering.angular * Time.deltaTime;
            if (linearVelocity.magnitude > maxSpeed)
            {
                linearVelocity.Normalize();
                linearVelocity *= maxSpeed;
            }
        }
        else
        {
            Arrive myArrive = new Arrive();
            myArrive.ai     = this;
            myArrive.target = target;
            SteeringOutput steering = myArrive.GetSteering();

            linearVelocity  += steering.linear * Time.deltaTime;
            angularVelocity += steering.angular * Time.deltaTime;
        }
        if (align)
        {
            Align myAlign = new Align();
            myAlign.ai     = this;
            myAlign.target = target;
            SteeringOutput steering = myAlign.GetSteering();
            if (steering != null)
            {
                linearVelocity  += steering.linear * Time.deltaTime;
                angularVelocity += steering.angular * Time.deltaTime;
            }
        }
        if (lookWhereGoing && !align && !face)
        {
            LookWhereGoing myLook = new LookWhereGoing();
            myLook.ai     = this;
            myLook.target = target;
            SteeringOutput steering = myLook.GetSteering();
            if (steering != null)
            {
                linearVelocity  += steering.linear * Time.deltaTime;
                angularVelocity += steering.angular * Time.deltaTime;
            }
            else
            {
                Debug.Log("Returning Null");
            }
        }
        if (!lookWhereGoing && !align && face)
        {
            Face myFace = new Face();
            myFace.ai     = this;
            myFace.target = target;
            SteeringOutput steering = myFace.GetSteering();
            if (steering != null)
            {
                linearVelocity  += steering.linear * Time.deltaTime;
                angularVelocity += steering.angular * Time.deltaTime;
            }
        }
    }
コード例 #38
0
        internal static BaseWidget RequestCreateMultiListItem(BaseWidget _parent, WidgetStyle _style, string _skin, IntCoord _coord, Align _align, string _layer, string _name)
        {
            MultiListItem widget = new MultiListItem();

            widget.CreateWidget(_parent, _style, _skin, _coord, _align, _layer, _name);
            return(widget);
        }
コード例 #39
0
        /// <summary>
        /// 生成图片的Html代码
        /// </summary>
        /// <param name="name">名称</param>
        /// <param name="path">路径</param>
        /// <param name="width">宽</param>
        /// <param name="widthUnit">宽单位</param>
        /// <param name="height">高</param>
        /// <param name="heightUnit">高单位</param>
        /// <param name="align">图片显示方式</param>
        /// <param name="border">边框</param>
        /// <param name="vspace"></param>
        /// <param name="hspace"></param>
        /// <param name="alt">说明文字</param>
        /// <param name="linkUrl">链接的URL</param>
        /// <param name="pic2Path">替换图片的路径</param>
        /// <param name="linkTarget">目标</param>
        /// <param name="linkTitle">标题</param>
        /// <param name="linkAccesskey">访问键</param>
        /// <returns></returns>
        public string ImageHtml(
            InsertMode insertMode,
            string name,
            string path,
            string width,
            string widthUnit,
            string height,
            string heightUnit,
            Align align,
            string border,
            string vspace,
            string hspace,
            string alt,
            string linkUrl,
            string pic2Path,
            string linkTarget,
            string linkTitle,
            string linkAccesskey,
            string mediaID
            )
        {
            string picMouseOut  = "";
            string picMouseOver = "";
            string picCode      = "";

            if (path == "")
            {
                return("");
            }

            //图片设置*/
            string imgHtml = "";

            switch (insertMode)
            {
            case InsertMode.File:
                imgHtml += "<img src=\"" + mediaID + "\"";
                break;

            case InsertMode.Id:
                imgHtml += "<img src=\"[src:" + path + "]\" ";
                break;
            }
            imgHtml += "style = \"WIDTH:" + width + widthUnit + "; HEIGHT:" + height + heightUnit + "\" ";
            imgHtml += "border=\"" + border + "\" vspace=\"" + vspace + "\" ";
            imgHtml += "hspace=\"" + hspace + "\" alt=\"" + alt + "\" ";
            imgHtml += "name=\"" + name + "\" align=\"" + align.ToString().ToLower() + "\" />";

            //链接设置*/
            string linkHtml = "";

            if (linkUrl != "" || pic2Path != "")
            {
                if (linkUrl != "")
                {
                    linkHtml  = "<a href=\"" + linkUrl + "\" ";
                    linkHtml += "target=\"" + linkTarget + "\" ";
                    linkHtml += "title=\"" + linkTitle + "\" ";
                    linkHtml += "accesskey=\"" + linkAccesskey + "\"";
                }
                else
                {
                    linkHtml = "<a href=\"#\"";
                }
                //图片替换
                if (pic2Path != "")
                {
                    picMouseOut  = " na_restore_img_src('" + name + "', 'document')";
                    linkHtml    += "OnMouseOut=\"" + picMouseOut + "\"";
                    picMouseOver = "na_change_img_src('" + name + "', 'document'," + pic2Path + ",true)";
                    linkHtml    += "OnMouseOver=\"" + picMouseOver + "\"";
                }

                linkHtml += ">";
                picCode   = linkHtml + imgHtml + @"</a>";
                return(picCode);
            }
            else
            {
                picCode = picCode = imgHtml;
                return(picCode);
            }
        }
コード例 #40
0
ファイル: Button.cs プロジェクト: TheMightyNose/Seihou
 public Button(Vector2 pos, Vector2 size, SpriteBatch sb, ButtonCallBack onClicked, string text, int index = 0, Align align = Align.left, string font = "DefaultFont") : base(sb)
 {
     textColor      = new Color(100, 100, 100);
     this.font      = font;
     this.align     = align;
     this.onClicked = onClicked;
     this.pos       = pos - size / 2;
     this.size      = size;
     this.sb        = sb;
     this.text      = text;
     this.index     = index;
 }
コード例 #41
0
ファイル: TextGui.cs プロジェクト: zy1911/JxqyHD
        public bool Caculate()
        {
            _drawInfo.Clear();
            try
            {
                if (TextStream == null ||
                    _endIndex >= TextStream.Length)
                {
                    return(false);
                }

                _startIndex = _endIndex;
                var x        = 0f;
                var y        = 0f;
                var endIndex = TextStream.Length;
                _drawInfoLineBegin = _drawInfo.Count;
                while (_endIndex < endIndex)
                {
                    var drawText = TextStream[_endIndex].ToString();
                    if (drawText == "<")
                    {
                        var text = new StringBuilder();
                        while (TextStream[++_endIndex] != '>')
                        {
                            text.Append(TextStream[_endIndex]);
                        }

                        var textStr = text.ToString();
                        switch (textStr)
                        {
                        case "color=Red":
                            CurrentColor = Color.Red * (ActiveDefaultColor.A / 255f);
                            break;

                        case "color=Black":
                            CurrentColor = Color.Black * (ActiveDefaultColor.A / 255f);
                            break;

                        case "color=Default":
                            CurrentColor = ActiveDefaultColor;
                            break;

                        case "color=BeginRangeDefault":
                            //Use current color as default color in this range.
                            _isInRangeDefaultColor = true;
                            _rangeDefaultColor     = CurrentColor;
                            break;

                        case "color=EndRangeDefault":
                            //Range end
                            _isInRangeDefaultColor = false;
                            break;

                        case "AlignLeft":
                            _isInRangeAlign = true;
                            _rangeAlign     = Align.Left;
                            break;

                        case "AlignCenter":
                            _isInRangeAlign = true;
                            _rangeAlign     = Align.Center;
                            break;

                        case "AlignRight":
                            _isInRangeAlign = true;
                            _rangeAlign     = Align.Right;
                            break;

                        case "EndAlign":
                            AlignLineText(x);
                            _isInRangeAlign = false;
                            break;

                        case "enter":
                            AlignLineText(x);
                            AddLinespace(ref y);
                            x = 0;
                            if (IsReachBottom(y))
                            {
                                RealHeight = (int)y;
                                _endIndex++;
                                return(true);
                            }
                            break;

                        default:
                            if (RegColorWithAlpha.IsMatch(textStr))
                            {
                                var matchs = RegColorWithAlpha.Match(textStr);
                                var r = matchs.Groups[1].Value;
                                var g = matchs.Groups[2].Value;
                                var b = matchs.Groups[3].Value;
                                var a = matchs.Groups[4].Value;
                                int rv = 0, gv = 0, bv = 0, av = 0;
                                int.TryParse(r, out rv);
                                int.TryParse(g, out gv);
                                int.TryParse(b, out bv);
                                int.TryParse(a, out av);
                                CurrentColor = new Color(rv, gv, bv) * (av / 255f);
                            }
                            else if (RegColor.IsMatch(textStr))
                            {
                                var matchs = RegColor.Match(textStr);
                                var r = matchs.Groups[1].Value;
                                var g = matchs.Groups[2].Value;
                                var b = matchs.Groups[3].Value;
                                int rv = 0, gv = 0, bv = 0;
                                int.TryParse(r, out rv);
                                int.TryParse(g, out gv);
                                int.TryParse(b, out bv);
                                CurrentColor = new Color(rv, gv, bv) * (ActiveDefaultColor.A / 255f);
                            }
                            break;
                        }
                    }
                    else if (drawText == "\n")
                    {
                        AlignLineText(x);
                        AddLinespace(ref y);
                        x = 0;
                        if (IsReachBottom(y))
                        {
                            RealHeight = (int)y;
                            _endIndex++;
                            return(true);
                        }
                    }
                    else
                    {
                        var stringWidth = Font.MeasureString(drawText).X;
                        //Make space width correct
                        if (drawText == " ")
                        {
                            if (_endIndex + 1 < endIndex &&
                                TextStream[_endIndex + 1] == ' ')
                            {
                                stringWidth = 2 * Font.MeasureString("0").X;
                                _endIndex++;
                            }
                            else
                            {
                                stringWidth = Font.MeasureString("0").X;
                            }
                        }
                        if (IsReachRight(x, stringWidth))
                        {
                            RealWidth = Math.Max(RealWidth, (int)x);
                            AlignLineText(x);
                            AddLinespace(ref y);
                            if (IsReachBottom(y))
                            {
                                RealHeight = (int)y;
                                return(true);
                            }
                            x = 0f;
                        }
                        _drawInfo.Add(new Info(
                                          drawText,
                                          new Vector2(x, y),
                                          CurrentColor));
                        AddWdith(ref x, stringWidth);
                    }
                    _endIndex++;
                }
                AlignLineText(x);
                if (x > 0)
                {
                    AddLinespace(ref y);
                }
                RealHeight = (int)y;
            }
            catch (Exception)
            {
                _drawInfo.Clear();
                _endIndex = TextStream.Length;
                Log.LogMessage("String [" + TextStream + "] format is bad!");
                return(false);
            }
            return(true);
        }
コード例 #42
0
 public Widget CreateWidgetT(Widget _parent, WidgetStyle _style, string _type, string _skin, IntCoord _coord, Align _align, string _layer, string _name)
 {
     return((Widget)mMapCreator[_type](_parent, _style, _skin, _coord, _align, _layer, _name));
 }
コード例 #43
0
        private void ParseWidget(List <Widget> _widgets, XmlNode _node, Widget _parent, Widget _root, string _prefix)
        {
            string style = "", type = "", skin = "", name = "", layer = "", align = "", position = "";

            foreach (XmlAttribute attribute in _node.Attributes)
            {
                switch (attribute.Name)
                {
                case "style": style = attribute.Value; break;

                case "type": type = attribute.Value; break;

                case "skin": skin = attribute.Value; break;

                case "name": name = attribute.Value; break;

                case "layer": layer = attribute.Value; break;

                case "align": align = attribute.Value; break;

                case "position": position = attribute.Value; break;
                }

                if (type == "Sheet")
                {
                    type = "TabItem";
                }
            }

            if ((0 == type.Length) || (0 == skin.Length))
            {
                return;
            }

            if ((0 != name.Length) && (0 != _prefix.Length))
            {
                name = _prefix + name;
            }

            string[] coord = position.Split();

            WidgetStyle wstyle = WidgetStyle.Overlapped;

            if (_parent != null)
            {
                layer  = "";
                wstyle = (style != string.Empty) ? (WidgetStyle)Enum.Parse(typeof(WidgetStyle), style) : WidgetStyle.Child;
            }

            Align walign = Align.Default;

            if (align != string.Empty)
            {
                walign = Align.Center;
                string[] mass = align.Split();
                foreach (string item in mass)
                {
                    walign |= (Align)Enum.Parse(typeof(Align), item);
                }
            }

            Widget widget = (Widget)mMapCreator[type](
                _parent,
                wstyle,
                skin,
                ((coord.Length == 4) ? new IntCoord(int.Parse(coord[0]), int.Parse(coord[1]), int.Parse(coord[2]), int.Parse(coord[3])) : new IntCoord()),
                walign,
                layer,
                name);

            if (null == _root)
            {
                _root = widget;
                _widgets.Add(_root);
            }

            foreach (XmlNode node in _node)
            {
                if ("Widget" == node.Name)
                {
                    ParseWidget(_widgets, node, widget, _root, _prefix);
                }
                else if ("Property" == node.Name)
                {
                    string key = "", value = "";
                    foreach (XmlAttribute attribute in node.Attributes)
                    {
                        if ("key" == attribute.Name)
                        {
                            key = attribute.Value;
                        }
                        else if ("value" == attribute.Name)
                        {
                            value = attribute.Value;
                        }
                    }
                    if ((0 == key.Length) || (0 == value.Length))
                    {
                        continue;
                    }

                    SetProperty(widget, key, value);
                }
                else if ("UserString" == node.Name)
                {
                    string key = "", value = "";
                    foreach (XmlAttribute attribute in node.Attributes)
                    {
                        if ("key" == attribute.Name)
                        {
                            key = attribute.Value;
                        }
                        else if ("value" == attribute.Name)
                        {
                            value = attribute.Value;
                        }
                    }
                    if ((0 == key.Length) || (0 == value.Length))
                    {
                        continue;
                    }
                    widget.SetUserString(key, value);

                    if (EventParserUserData != null)
                    {
                        EventParserUserData(widget, key, value);
                    }
                }
            }
        }
コード例 #44
0
ファイル: TagTfootExtension.cs プロジェクト: bzure/BSA.Net
 public static TagTfoot align(this TagTfoot tag, Align value)
 {
     tag.Align = value; return(tag);
 }
コード例 #45
0
        /// <inheritdoc />
        public bool Equals([AllowNull] HoverLabel other)
        {
            if (other == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     BgColor == other.BgColor ||
                     BgColor != null &&
                     BgColor.Equals(other.BgColor)
                     ) &&
                 (
                     Equals(BgColorArray, other.BgColorArray) ||
                     BgColorArray != null && other.BgColorArray != null &&
                     BgColorArray.SequenceEqual(other.BgColorArray)
                 ) &&
                 (
                     BorderColor == other.BorderColor ||
                     BorderColor != null &&
                     BorderColor.Equals(other.BorderColor)
                 ) &&
                 (
                     Equals(BorderColorArray, other.BorderColorArray) ||
                     BorderColorArray != null && other.BorderColorArray != null &&
                     BorderColorArray.SequenceEqual(other.BorderColorArray)
                 ) &&
                 (
                     Font == other.Font ||
                     Font != null &&
                     Font.Equals(other.Font)
                 ) &&
                 (
                     Align == other.Align ||
                     Align != null &&
                     Align.Equals(other.Align)
                 ) &&
                 (
                     Equals(AlignArray, other.AlignArray) ||
                     AlignArray != null && other.AlignArray != null &&
                     AlignArray.SequenceEqual(other.AlignArray)
                 ) &&
                 (
                     NameLength == other.NameLength ||
                     NameLength != null &&
                     NameLength.Equals(other.NameLength)
                 ) &&
                 (
                     Equals(NameLengthArray, other.NameLengthArray) ||
                     NameLengthArray != null && other.NameLengthArray != null &&
                     NameLengthArray.SequenceEqual(other.NameLengthArray)
                 ) &&
                 (
                     BgColorSrc == other.BgColorSrc ||
                     BgColorSrc != null &&
                     BgColorSrc.Equals(other.BgColorSrc)
                 ) &&
                 (
                     BorderColorSrc == other.BorderColorSrc ||
                     BorderColorSrc != null &&
                     BorderColorSrc.Equals(other.BorderColorSrc)
                 ) &&
                 (
                     AlignSrc == other.AlignSrc ||
                     AlignSrc != null &&
                     AlignSrc.Equals(other.AlignSrc)
                 ) &&
                 (
                     NameLengthSrc == other.NameLengthSrc ||
                     NameLengthSrc != null &&
                     NameLengthSrc.Equals(other.NameLengthSrc)
                 ));
        }
コード例 #46
0
ファイル: TextField.cs プロジェクト: Taikatou/Nez
 /// <summary>
 /// Sets text horizontal alignment (left, center or right).
 /// </summary>
 /// <param name="alignment">Alignment.</param>
 public TextField setAlignment(Align alignment)
 {
     this.textHAlign = (int)alignment;
     return(this);
 }
コード例 #47
0
 internal static BaseWidget RequestCreateEditBox(IntPtr _parent, WidgetStyle _style, string _skin, IntCoord _coord, Align _align, string _layer, string _name)
 {
     return(new EditBox(_parent, _style, _skin, _coord, _align, _layer, _name));
 }
コード例 #48
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="alignment">Alignment.</param>
 public Image SetAlignment(Align alignment)
 {
     _align = (int)alignment;
     return(this);
 }
コード例 #49
0
ファイル: Paragraph.cs プロジェクト: wbj2008/DocXPlus
        /// <summary>
        /// Sets the paragraph alignment
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public Paragraph SetAlignment(Align value)
        {
            Alignment = value;

            return(this);
        }
コード例 #50
0
        public Tabular(RangeConvert tb_dataset)
        {
            // 初期化
            colnum = tb_dataset.colnum;
            rownum = tb_dataset.rownum;
            // 内部のコンテンツリスト
            contents = new List <string> [rownum];
            for (int i = 0; i < tb_dataset.rownum; i++)
            {
                contents[i] = new List <string>();
            }
            // 列の水平罫線リスト
            hrule_lines = new string[rownum];
            LineType[] hrule_linetypes = new LineType[colnum];


            // 表の上の罫線をチェック
            for (int j = 0; j < colnum; j++)
            {
                hrule_linetypes[j] = tb_dataset.hrule_map[0, j];
            }
            hrule_top = hrule_str(hrule_linetypes);

            // フォーマットの作成
            LineType[] vrule_linetypes = new LineType[colnum + 1];
            Align[]    valign_types    = new Align[colnum];
            vrule_linetypes[0] = tb_dataset.vrule_map[0, 0];
            for (int j = 0; j < colnum; j++)
            {
                vrule_linetypes[j + 1] = tb_dataset.vrule_map[0, j + 1];
                valign_types[j]        = tb_dataset.align_map[0, j];
            }
            format = tabular_format(vrule_linetypes, valign_types);


            // 中身のコンテンツ行を作成
            for (int i = 0; i < rownum; i++)
            {
                for (int j = 0; j < colnum; j++)
                {
                    // セルの水平方向罫線を生成するための配列を作る。
                    hrule_linetypes[j] = tb_dataset.hrule_map[i + 1, j];

                    // フォーマット
                    CellSize cell_size = tb_dataset.cellsize_map[i, j];

                    // 先頭列の文字装飾
                    LineType lvrule_top     = tb_dataset.vrule_map[0, j];                 // left vrule
                    LineType rvrule_top     = tb_dataset.vrule_map[0, j + cell_size.col]; // right vrule +1をmulticol分増やす?
                    Align    cell_align_top = tb_dataset.align_map[0, j];

                    // 文字装飾
                    LineType lvrule     = tb_dataset.vrule_map[i, j];                 // left vrule
                    LineType rvrule     = tb_dataset.vrule_map[i, j + cell_size.col]; // right vrule +1をmulticol分増やす?
                    Align    cell_align = tb_dataset.align_map[i, j];

                    MergeType cell_mergeType = tb_dataset.merge_map[i, j];
                    // コンテンツ
                    string cell_content = tb_dataset.contents[i, j];


                    // マージセルの左上
                    if (cell_mergeType == MergeType.lefttop)
                    {
                        contents[i].Add(multicell(cell_size, cell_content, lvrule, cell_align, rvrule, lvrule_top, cell_align_top, rvrule_top));
                    }
                    // マージセルの一番上の行 -> 一番左以外はまとめられるのでスキップ
                    else if (cell_mergeType == MergeType.top)
                    {
                        continue;
                    }
                    // マージセルの一番上以外の行
                    else if (cell_mergeType == MergeType.nottop)
                    {
                        // 基本結合されるので空白の行だが、罫線はmulticolumnなどで反映する必要がある場合もある。
                        contents[i].Add(multicell(cell_size, "", lvrule, cell_align, rvrule, lvrule_top, cell_align_top, rvrule_top));
                    }
                    // 結合セルではない。
                    else
                    {
                        contents[i].Add(multicell(cell_size, cell_content, lvrule, cell_align, rvrule, lvrule_top, cell_align_top, rvrule_top));
                    }
                }

                // セルの下水平方向罫線を出力
                hrule_lines[i] = hrule_str(hrule_linetypes);
            }
        }
コード例 #51
0
    // Update is called once per frame
    void Update()
    {
        // update my position and rotation
        this.transform.position += linearVelocity * Time.deltaTime;
        Vector3 v = new Vector3(0, angularVelocity, 0); // TODO - don't make a new Vector3 every update you silly person

        this.transform.eulerAngles += v * Time.deltaTime;

        // update linear and angular velocities
        SteeringOutput steering = new SteeringOutput();

        if (behaviorType == "Seek" || behaviorType == "seek")
        {
            Seek mySeek = new Seek();
            mySeek.character = this;
            mySeek.target    = myTarget;
            steering         = mySeek.getSteering();
            linearVelocity  += steering.linear * Time.deltaTime;
            angularVelocity += steering.angular * Time.deltaTime;
        }
        else if (behaviorType == "Flee" || behaviorType == "flee")
        {
            Flee myFlee = new Flee();
            myFlee.character = this;
            myFlee.target    = myTarget;
            steering         = myFlee.getSteering();
            linearVelocity  += steering.linear * Time.deltaTime;
            angularVelocity += steering.angular * Time.deltaTime;
        }
        else if (behaviorType == "Arrive" || behaviorType == "arrive")
        {
            Arrive myArrive = new Arrive();
            myArrive.character = this;
            myArrive.target    = myTarget;
            steering           = myArrive.getSteering();
            if (steering != null)
            {
                linearVelocity  += steering.linear * Time.deltaTime;
                angularVelocity += steering.angular * Time.deltaTime;
            }
            else
            {
                linearVelocity = Vector3.zero;
            }
        }
        else if (behaviorType == "Align" || behaviorType == "align")
        {
            Align myAlign = new Align();
            myAlign.character = this;
            myAlign.target    = myTarget;
            steering          = myAlign.getSteering();
            if (steering != null)
            {
                linearVelocity  += steering.linear * Time.deltaTime;
                angularVelocity += steering.angular * Time.deltaTime;
            }
        }
        else if (behaviorType == "Face" || behaviorType == "face")
        {
            Face myFace = new Face();
            myFace.character = this;
            myFace.target    = myTarget;
            steering         = myFace.getSteering();
            if (steering != null)
            {
                linearVelocity  += steering.linear * Time.deltaTime;
                angularVelocity += steering.angular * Time.deltaTime;
            }
        }
        else if (behaviorType == "LWYG" || behaviorType == "lwyg" || behaviorType == "Lwyg")
        {
            LWYG myLook = new LWYG();
            myLook.character = this;
            steering         = myLook.getSteering();
            if (steering != null)
            {
                linearVelocity  += steering.linear * Time.deltaTime;
                angularVelocity += steering.angular * Time.deltaTime;
            }
        }
    }
コード例 #52
0
ファイル: SelectPoints.cs プロジェクト: 15831944/EM
        SelectPntsByAlign()
        {
            bool byAlign = false;

            ObjectIdCollection idsAlign = Align.getAlignmentIDs();
            bool     exists             = false;
            ObjectId idDict             = Dict.getNamedDictionary("STAKE_PNTS", out exists);

            if (!exists)
            {
                return(false);
            }

            List <StakedPnt>         stakedPnts = new List <StakedPnt>();
            List <DBDictionaryEntry> entries    = Dict.getEntries(idDict);

            foreach (DBDictionaryEntry entry in entries)
            {
                if (entry.GetType() == typeof(Xrecord))
                {
                    Xrecord      xRec = Dict.getXRec(idDict, entry);
                    ResultBuffer rb   = xRec.Data;
                    if (rb == null)
                    {
                        continue;
                    }

                    TypedValue[] tvs       = rb.AsArray();
                    StakedPnt    stakedPnt = new StakedPnt
                    {
                        hAlign = tvs[0].Value.ToString().stringToHandle(),
                        Number = uint.Parse(tvs[1].Value.ToString())
                    };
                    stakedPnts.Add(stakedPnt);
                }
            }

            var sortPnts = from p in stakedPnts
                           orderby p.Number ascending
                           group p by p.hAlign
                           into grpAlign
                           orderby grpAlign.Key
                           select grpAlign;

            //List<StakePntSum> stakedPntSum = new List<StakePntSum>();   //align handle and list of points
            List <DataSet> dataSet = new List <DataSet>();

            foreach (var p in sortPnts)
            {
                Handle    hAlign = p.Key;
                Alignment align  = (Alignment)hAlign.getEnt();

                if (align != null)
                {
                    List <uint> nums = new List <uint>();
                    foreach (var n in p)
                    {
                        nums.Add(n.Number);
                    }

                    var sortNums = from a in nums
                                   orderby a ascending
                                   select a;

                    ResultBuffer rb = align.GetXDataForApplication("STAKE");
                    if (rb == null)
                    {
                        continue;
                    }
                    TypedValue[] tvs = rb.AsArray();

                    DataSet dSet = new DataSet
                    {
                        Layer      = tvs[3].Value.ToString(),
                        ObjectName = align.Name,
                        Lower      = (uint)sortNums.Min(),
                        Upper      = (uint)sortNums.Max(),
                        COUNT      = (int)sortNums.Count(),
                        Nums       = nums
                    };
                    dataSet.Add(dSet);
                    byAlign = true;
                }
                else
                {
                    byAlign = false;
                }
            }
            return(byAlign);
        }
 public static void DrawStar(SpriteBatch spriteBatch, Rectangle rect, int color, Align align = null, ViewController view = null)
 {
     spriteBatch.Draw(Assets.SystemTextures[color], rect, Color.White);
 }
コード例 #54
0
        internal void RenderColumn(RenderContext context, Int32 colIndex)
        {
            CheckValid();
            var column = new TagBuilder("data-grid-column");

            MergeBindingAttribute(context, column, "header", nameof(Header), Header);

            MergeBindingAttributeBool(column, context, "v-if", nameof(If), If);

            MergeBoolAttribute(column, context, nameof(Editable), Editable);
            if (_noPadding)
            {
                column.MergeAttribute(":no-padding", "true");
            }
            if (Sort != null)
            {
                column.MergeAttribute(":sort", Sort.Value.ToString().ToLowerInvariant());
            }
            if (SortProperty != null)
            {
                column.MergeAttribute("sort-prop", SortProperty);
            }
            if (Small != null)
            {
                column.MergeAttribute(":small", Small.Value.ToString().ToLowerInvariant());
            }

            var boldBind = GetBinding(nameof(Bold));

            if (boldBind != null)
            {
                column.MergeAttribute("bold", $"{{{boldBind.GetPath(context)}}}");
            }
            else if (Bold != null)
            {
                column.MergeAttribute("bold", Bold.Value.ToString().ToLowerInvariant());
            }

            MergeBoolAttribute(column, context, nameof(Fit), Fit);
            if (Width != null)
            {
                column.MergeAttribute("width", Width.Value);
            }
            var iconBind = GetBinding(nameof(Icon));

            if (iconBind != null)
            {
                column.MergeAttribute("bind-icon", iconBind.Path /*without context*/);
            }
            else if (Icon != Icon.NoIcon)
            {
                column.MergeAttribute("icon", Icon.ToString().ToKebabCase());
            }
            if (Wrap != WrapMode.Default)
            {
                column.MergeAttribute("wrap", Wrap.ToString().ToKebabCase());
            }

            var markBind = GetBinding(nameof(Mark));

            if (markBind != null)
            {
                column.MergeAttribute("mark", markBind.Path /*!without context!*/);
            }
            else if (Mark != null)
            {
                throw new XamlException("The Mark property must be a binding");
            }

            CreateEditable();

            Boolean isTemplate = Content is UIElementBase;
            String  tmlId      = null;

            if (!isTemplate)
            {
                // always content without a SEMICOLON!
                var bindProp = GetBinding(nameof(Content));
                if (bindProp != null)
                {
                    column.MergeAttribute("content", bindProp.Path /*!without context!*/);
                    if (bindProp.DataType != DataType.String)
                    {
                        column.MergeAttribute("data-type", bindProp.DataType.ToString());
                    }
                    if (bindProp.HideZeros)
                    {
                        column.MergeAttribute(":hide-zeros", "true");
                    }
                    if (!String.IsNullOrEmpty(bindProp.Format))
                    {
                        column.MergeAttribute("format", bindProp.Format);
                    }
                }
                else if (Content != null)
                {
                    throw new XamlException($"The Content property must be a binding ({Content})");
                }
            }

            Bind ctBind = GetBinding(nameof(ControlType));

            if (ctBind != null)
            {
                column.MergeAttribute(":control-type", ctBind.Path /*!without context!*/);
            }
            else if (ControlType != ColumnControlType.Default)
            {
                column.MergeAttribute("control-type", ControlType.ToString().ToLowerInvariant());
            }

            var alignProp = GetBinding(nameof(Align));

            if (alignProp != null)
            {
                column.MergeAttribute(":align", alignProp.Path /*!without context!*/);
            }
            else if (Align != TextAlign.Default)
            {
                column.MergeAttribute("align", Align.ToString().ToLowerInvariant());
            }

            if (isTemplate)
            {
                tmlId = $"col{colIndex}";
                column.MergeAttribute("id", tmlId);
            }

            var cmdBind = GetBindingCommand(nameof(Command));

            if (cmdBind != null)
            {
                column.MergeAttribute(":command", cmdBind.GetCommand(context, indirect: true));
            }
            column.RenderStart(context);
            column.RenderEnd(context);
            if (isTemplate)
            {
                var templ = new TagBuilder("template");
                templ.MergeAttribute("slot", tmlId);
                templ.MergeAttribute("slot-scope", "cell");
                templ.RenderStart(context);
                using (var ctx = new ScopeContext(context, "cell.row"))
                {
                    (Content as UIElementBase).RenderElement(context);
                }
                templ.RenderEnd(context);
            }
        }
コード例 #55
0
        private void _myWindow_BeforeDraw(Base sender, EventArgs arguments)
        {
            if (!mInitialized)
            {
                mMyWindow.LoadJsonUi(_uiStage, Graphics.Renderer.GetResolutionString(), true);
                var text = Interface.WrapText(mPrompt, mPromptLabel.Width, mPromptLabel.Font);
                var y    = mPromptLabel.Y;
                foreach (var s in text)
                {
                    var label = new Label(mMyWindow)
                    {
                        Text = s,
                        TextColorOverride = mPromptLabel.TextColor,
                        Font = mPromptLabel.Font
                    };

                    label.SetPosition(mPromptLabel.X, y);
                    y += label.Height;
                    Align.CenterHorizontally(label);
                }

                switch (mInputType)
                {
                case InputType.YesNo:
                    mYesButton.Text = Strings.InputBox.yes;
                    mNoButton.Text  = Strings.InputBox.no;
                    mOkayButton.Hide();
                    mYesButton.Show();
                    mNoButton.Show();
                    mNumericTextboxBg.Hide();
                    mTextboxBg.Hide();

                    break;

                case InputType.OkayOnly:
                    mOkayButton.Show();
                    mYesButton.Hide();
                    mNoButton.Hide();
                    mNumericTextboxBg.Hide();
                    mTextboxBg.Hide();

                    break;

                case InputType.NumericInput:
                    mOkayButton.Hide();
                    mYesButton.Show();
                    mNoButton.Show();
                    mNumericTextboxBg.Show();
                    mTextboxBg.Hide();

                    break;

                case InputType.TextInput:
                    mOkayButton.Hide();
                    mYesButton.Show();
                    mNoButton.Show();
                    mNumericTextboxBg.Hide();
                    mTextboxBg.Show();

                    break;
                }

                mMyWindow.Show();
                mMyWindow.Focus();
                mInitialized = true;
            }
        }
コード例 #56
0
        public NativeInput(Rectangle position, TextInputType keyboardContext, string text, int textSize, Align align, ITextEdit controller)
        {
            if (CurrentFocus != null)
            {
                CurrentFocus.Unfocus();
            }

            _controller  = controller;
            CurrentFocus = this;

            if (_textField == null)
            {
                InitTextField();
            }

            text = text.Replace('\n', '\r');

            Bottom      = position.Bottom + (int)Platform.PointsToPixels(10);
            position.Y += AppMain.Current.SetFocus(this);

            float x      = Platform.PixelsToPoints(position.X) + 1;
            float y      = Platform.PixelsToPoints(position.Y) + 2;
            float width  = Platform.PixelsToPoints(position.Width) - 2;
            float height = Platform.PixelsToPoints(position.Height) - 4;

            if (keyboardContext.HasFlag(TextInputType.PasswordClass))
            {
                keyboardContext &= ~(TextInputType.NoSuggestions);
            }

            if (keyboardContext.HasFlag(TextInputType.MultilineText))
            {
                _useTextView = true;

                _textView.Frame                  = new System.Drawing.RectangleF(x, y, width, height);
                _textView.BackgroundColor        = new UIColor(255, 255, 255, 255);
                _textView.TextColor              = new UIColor(0, 0, 0, 255);
                _textView.Opaque                 = true;
                _textView.KeyboardType           = TypeFromContext(keyboardContext);
                _textView.AutocapitalizationType = AutoCapitalizationFromContext(keyboardContext);

                _textView.KeyboardType = UIKeyboardType.Default;

                _textView.AutocorrectionType = keyboardContext.HasFlag(TextInputType.NoSuggestions) ?  UITextAutocorrectionType.No :  UITextAutocorrectionType.Default;

                _textView.SecureTextEntry = keyboardContext.HasFlag(TextInputType.PasswordClass);

                _textView.Font = UIFont.FromName("Helvetica", textSize);
                SetText(text);

                _textView.Ended += HandleEnded;
                _textView.BecomeFirstResponder();
            }
            else
            {
                _textField.Frame                  = new System.Drawing.RectangleF(x, y, width, height);
                _textField.BackgroundColor        = new UIColor(255, 255, 255, 255);
                _textField.TextColor              = new UIColor(0, 0, 0, 255);
                _textField.Opaque                 = true;
                _textField.KeyboardType           = TypeFromContext(keyboardContext);
                _textField.AutocapitalizationType = AutoCapitalizationFromContext(keyboardContext);

                _textField.ResignFirstResponder();

                _textField.AutocorrectionType = keyboardContext.HasFlag(TextInputType.NoSuggestions) ?  UITextAutocorrectionType.No :  UITextAutocorrectionType.Default;
                _textField.SecureTextEntry    = keyboardContext.HasFlag(TextInputType.PasswordClass);

                _textField.ClearsOnBeginEditing = false;

                _textField.Font = UIFont.FromName("Helvetica", textSize);

                switch (align & Align.Horz)
                {
                case Align.Center:
                    _textField.TextAlignment = UITextAlignment.Center;
                    break;

                case Align.Left:
                    _textField.TextAlignment = UITextAlignment.Left;
                    break;

                case Align.Right:
                    _textField.TextAlignment = UITextAlignment.Right;
                    break;
                }

                SetText(text);
                _textField.EditingChanged += HandleEditingChanged;
                _textField.EditingDidEnd  += HandleEditingDidEnd;


                _textField.ShouldReturn = delegate
                {
                    if ((keyboardContext & TextInputType.TypeFilter) != TextInputType.MultilineText)
                    {
                        _controller.Return();
                        return(true);
                    }

                    return(false);
                };

                _textField.BecomeFirstResponder();
            }
        }
コード例 #57
0
        internal static BaseWidget RequestCreateImageBox(BaseWidget _parent, WidgetStyle _style, string _skin, IntCoord _coord, Align _align, string _layer, string _name)
        {
			ImageBox widget = new ImageBox();
			widget.CreateWidgetImpl(_parent, _style, _skin, _coord, _align, _layer, _name);
            return widget;
        }
コード例 #58
0
        private void button1_Click(object sender, EventArgs e)
        {
            // sprawdzenie poprawności danych
            string id = textBox1.Text.Trim();

            textBox1.Text = id;
            if (id.Length == 0)
            {
                MessageBox.Show(this, "Identyfikator nie może być pusty.", "Uwaga", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                textBox1.Focus();
                return;
            }
            string description = textBox2.Text.Trim();

            textBox2.Text = description;

            if (comboBox1.SelectedIndex == -1)
            {
                MessageBox.Show(this, "Nie wybrano rodzaju wyrównania.", "Uwaga", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                comboBox1.Focus();
                return;
            }
            Align align = Utils.StringToAlign(comboBox1.SelectedItem.ToString());

            if (comboBox2.SelectedIndex == -1)
            {
                MessageBox.Show(this, "Nie wybrano rodzaju przycięcia.", "Uwaga", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                comboBox2.Focus();
                return;
            }
            Trim trim = Utils.StringToTrim(comboBox2.SelectedItem.ToString());

            if (comboBox3.SelectedIndex == -1)
            {
                MessageBox.Show(this, "Nie wybrano rodzaju dołączenia.", "Uwaga", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                comboBox3.Focus();
                return;
            }
            Append append       = Utils.StringToAppend(comboBox3.SelectedItem.ToString());
            string appendString = textBox3.Text;

            if (append != Append.None && appendString.Length == 0)
            {
                MessageBox.Show(this, "Nie wpisano ciągu dołączanego.", "Uwaga", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                textBox3.Focus();
                return;
            }

            // sprawdzenie czy istnieje już obszar o takim id
            for (int i = 0; i < _configuration.Areas.Length; i++)
            {
                if (i == _areaIndex)
                {
                    continue;
                }
                if (_configuration.Areas[i].ID == id)
                {
                    MessageBox.Show(this, string.Format("Istnieje już obszar o identyfikatorze '{0}'.", id), "Uwaga", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    textBox1.Focus();
                    return;
                }
            }

            LPTLCDArea          area       = null;
            List <LCDCharacter> characters = new List <LCDCharacter>();

            if (_areaIndex > -1)
            {
                area = _configuration.Areas[_areaIndex];
                characters.AddRange(_configuration.Areas[_areaIndex].Characters);
            }
            else
            {
                area = new LPTLCDArea();
                List <LPTLCDArea> areas = new List <LPTLCDArea>();
                areas.AddRange(_configuration.Areas);
                areas.Add(area);
                _configuration.Areas = areas.ToArray();
                characters.AddRange(Array.ConvertAll <LPTLCDCharacter, LCDCharacter>(_characters.ToArray(), new Converter <LPTLCDCharacter, LCDCharacter>(LPTLCDCharacter.Convert)));
            }
            if (characters.Count == 0)
            {
                MessageBox.Show(this, "Obszar musi składać się co najmniej z jednego znaku.", "Uwaga", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            area.Set(id, description, align, trim, append, appendString);

            area.Set(characters.ToArray());
            area.ArrangeCharacters();

            DialogResult = DialogResult.OK;
        }
コード例 #59
0
ファイル: Docking.cs プロジェクト: slagusev/gwen-dotnet
        ControlBase CreateControls(Control.ControlBase subject, int dock_idx, string name, int x, int y)
        {
            Control.GroupBox gb = new Control.GroupBox(this);
            gb.SetBounds(x, y, 200, 150);
            gb.Text = name;

            Control.Label l_width = new Control.Label(gb);
            l_width.SetSize(35, 15);
            l_width.Text = "Width:";

            Control.HorizontalSlider width = new HorizontalSlider(gb);
            width.Name     = "Width";
            width.UserData = subject;
            width.Min      = 50;
            width.Max      = 350;
            width.Value    = 100;
            width.SetSize(55, 15);
            width.ValueChanged += WidthChanged;
            Align.PlaceRightBottom(width, l_width);

            Control.Label l_height = new Control.Label(gb);
            l_height.SetSize(35, 15);
            l_height.Text = "Height:";
            Align.PlaceRightBottom(l_height, width, 10);

            Control.HorizontalSlider height = new Control.HorizontalSlider(gb);
            height.Name     = "Height";
            height.UserData = subject;
            height.Min      = 50;
            height.Max      = 350;
            height.Value    = 100;
            height.SetSize(55, 15);
            height.ValueChanged += HeightChanged;
            Align.PlaceRightBottom(height, l_height);

            Control.RadioButtonGroup dock = new RadioButtonGroup(gb);
            dock.Text     = "Dock";
            dock.UserData = subject; // store control that we are controlling
            dock.AddOption("Left");
            dock.AddOption("Top");
            dock.AddOption("Right");
            dock.AddOption("Bottom");
            dock.AddOption("Fill");
            dock.SetSelection(dock_idx);
            Align.PlaceDownLeft(dock, l_width, 5);
            //dock.DrawDebugOutlines = true;
            dock.Invalidate();

            Control.Label l_margin = new Control.Label(gb);
            l_margin.Text = "Margin:";
            l_margin.SetBounds(75, 20, 35, 15);
            //Align.PlaceRightBottom(l_margin, dock);
            // can't use Align to anchor with 'dock' because radio group is resized only after layout ~_~
            // this is become really cumbersome
            //l_margin.DrawDebugOutlines = true;

            Control.HorizontalSlider margin = new HorizontalSlider(gb);
            margin.Name     = "Margin";
            margin.UserData = subject;
            margin.Min      = 0;
            margin.Max      = 50;
            margin.Value    = 10;
            margin.SetSize(55, 15);
            margin.ValueChanged += MarginChanged;
            Align.PlaceRightBottom(margin, l_margin);

            dock.SelectionChanged += DockChanged;

            return(gb);
        }
コード例 #60
0
        private void CreateBasicTab(TabControl tcontainer)
        {
            var container = tcontainer.AddPage("Basic").Page;

            tcontainer.Dock = Gwen.Pos.Fill;
            //modes
            GroupBox gb      = new GroupBox(container);
            var      modesgb = gb;

            gb.Text   = "Modes";
            gb.Width  = 180;
            gb.Height = 200;
            var marg = tcontainer.Margin;

            marg.Bottom       = 5;
            tcontainer.Margin = marg;
            marg        = gb.Margin;
            marg.Bottom = 15;
            marg.Right  = 5;
            gb.Margin   = marg;
            RecurseLayout(Skin);
            Gwen.Align.AlignBottom(gb);
            Gwen.Align.AlignRight(gb);
            LabeledCheckBox lcb = new LabeledCheckBox(gb);

            marg              = lcb.Margin;
            marg.Top         += 5;
            lcb.Margin        = marg;
            lcb.Text          = "Recording Mode";
            lcb.Dock          = Pos.Top;
            lcb.IsChecked     = Settings.Local.RecordingMode;
            lcb.CheckChanged += (o, e) => { Settings.Local.RecordingMode = ((LabeledCheckBox)o).IsChecked; };
            lcb.SetToolTipText(@"Disables many editor features
and changes the client so it can be 
recorded with a specific aesthetic");
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Color Playback";
            lcb.IsChecked     = Settings.Local.ColorPlayback;
            lcb.CheckChanged += (o, e) => { Settings.Local.ColorPlayback = ((LabeledCheckBox)o).IsChecked; };
            lcb.SetToolTipText(@"During playback the lines will no
longer turn black by default, and 
will stay as they are in editor mode");
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Hit Test";
            lcb.IsChecked     = Settings.Local.HitTest;
            lcb.CheckChanged += (o, e) => { Settings.Local.HitTest = ((LabeledCheckBox)o).IsChecked; };
            lcb.SetToolTipText(@"During playback, hitting a line will turn it 
the color of the original line.");
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Preview Mode";
            lcb.IsChecked     = Settings.Local.PreviewMode;
            lcb.CheckChanged += (o, e) => { Settings.Local.PreviewMode = ((LabeledCheckBox)o).IsChecked; };
            lcb.Dock          = Pos.Top;
            lcb.SetToolTipText(@"The opposite of Color Playback. The editor will
show the lines as black instead");
            //

            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Zero Start";
            lcb.IsChecked     = game.Track.ZeroStart;
            lcb.CheckChanged += (o, e) => { game.Track.ZeroStart = ((LabeledCheckBox)o).IsChecked; };
            lcb.Dock          = Pos.Top;
            lcb.SetToolTipText(@"Starts the track with 0 momentum");

            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Smooth Camera";
            lcb.IsChecked     = Settings.SmoothCamera;
            lcb.CheckChanged += (o, e) =>
            {
                Settings.SmoothCamera = ((LabeledCheckBox)o).IsChecked;
                Settings.Save();
                game.Track.Stop();
                game.Track.InitCamera();
                var round = FindChildByName("roundlegacycamera", true);
                foreach (var c in round.Children)
                {
                    c.IsDisabled = Settings.SmoothCamera;
                }
            };
            lcb.Dock = Pos.Top;
            lcb.SetToolTipText("Enables a smooth predictive camera.\r\nExperimental and subject to change.");

            lcb               = new LabeledCheckBox(gb);
            lcb.Name          = "roundlegacycamera";
            lcb.Text          = "Round Legacy Camera";
            lcb.IsChecked     = Settings.RoundLegacyCamera;
            lcb.CheckChanged += (o, e) =>
            {
                Settings.RoundLegacyCamera = ((LabeledCheckBox)o).IsChecked;
                Settings.Save();
                game.Track.Stop();
                game.Track.InitCamera();
            };
            lcb.Dock = Pos.Top;
            lcb.SetToolTipText("If the new camera is disabled\r\nmakes the camera bounds round\r\ninstead of rectangle");

            foreach (var c in lcb.Children)
            {
                c.IsDisabled = Settings.SmoothCamera;
            }
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Smooth Playback";
            lcb.IsChecked     = Settings.SmoothPlayback;
            lcb.CheckChanged += (o, e) =>
            {
                Settings.SmoothPlayback = ((LabeledCheckBox)o).IsChecked;
                Settings.Save();
            };
            lcb.SetToolTipText("Interpolates frames for a smooth 60+ fps.");
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Onion Skinning";
            lcb.IsChecked     = Settings.Local.OnionSkinning;
            lcb.CheckChanged += (o, e) =>
            {
                Settings.Local.OnionSkinning = ((LabeledCheckBox)o).IsChecked;
                game.Invalidate();
            };
            lcb.Dock = Pos.Top;
            //
            gb          = new GroupBox(container);
            gb.Text     = "Editor View";
            gb.Width    = 180;
            gb.Height   = 100;
            marg        = gb.Margin;
            marg.Bottom = 15;
            marg.Right  = 5;
            gb.Margin   = marg;
            Gwen.Align.AlignTop(gb);
            Gwen.Align.AlignRight(gb);
            Align.PlaceDownLeft(modesgb, gb);
            lcb               = new LabeledCheckBox(gb);
            marg              = lcb.Margin;
            marg.Top         += 5;
            lcb.Margin        = marg;
            lcb.Text          = "Contact Lines";
            lcb.IsChecked     = Settings.Local.DrawContactPoints;
            lcb.CheckChanged += (o, e) => { Settings.Local.DrawContactPoints = ((LabeledCheckBox)o).IsChecked; };
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Momentum Vectors";
            lcb.IsChecked     = Settings.Local.MomentumVectors;
            lcb.CheckChanged += (o, e) => { Settings.Local.MomentumVectors = ((LabeledCheckBox)o).IsChecked; };
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Gravity Wells";
            lcb.IsChecked     = Settings.Local.RenderGravityWells;
            lcb.CheckChanged += (o, e) => { Settings.Local.RenderGravityWells = ((LabeledCheckBox)o).IsChecked; game.Track.Invalidate(); };
            lcb.Dock          = Pos.Top;
            //playback
            gb          = new GroupBox(container);
            gb.Text     = "Playback";
            gb.Width    = 180;
            gb.Height   = 150;
            marg        = gb.Margin;
            marg.Bottom = 5;
            marg.Right  = 5;
            gb.Margin   = marg;
            Gwen.Align.AlignTop(gb);
            Gwen.Align.AlignLeft(gb);
            RadioButtonGroup rbg = new RadioButtonGroup(gb);

            rbg.Text = "Playback Zoom";
            rbg.AddOption("Current Zoom");
            rbg.AddOption("Default Zoom");
            rbg.AddOption("Specific Zoom");
            rbg.SetSelection(Settings.PlaybackZoomType);
            rbg.SelectionChanged += (o, e) =>
            {
                Settings.PlaybackZoomType = ((RadioButtonGroup)o).SelectedIndex;
                Settings.Save();
            };
            rbg.Dock = Pos.Top;
            rbg.AutoSizeToContents = false;
            rbg.Height             = 90;
            var nud = new NumericUpDown(rbg);

            nud.Value         = Settings.PlaybackZoomValue;
            nud.Max           = 24;
            nud.Min           = 1;
            nud.Dock          = Pos.Bottom;
            nud.ValueChanged += (o, e) =>
            {
                Settings.PlaybackZoomValue = ((NumericUpDown)o).Value;
                Settings.Save();
            };
            var cbplayback = new ComboBox(gb);

            cbplayback.Dock = Pos.Top;
            for (var i = 0; i < Constants.MotionArray.Length; i++)
            {
                var f = (Constants.MotionArray[i] / (float)Constants.PhysicsRate);
                cbplayback.AddItem("Playback: " + f + "x", f.ToString(CultureInfo.InvariantCulture), f);
            }
            cbplayback.SelectByName(Settings.Local.DefaultPlayback.ToString(CultureInfo.InvariantCulture));
            cbplayback.ItemSelected += (o, e) =>
            {
                Settings.Local.DefaultPlayback = (float)e.SelectedItem.UserData;
            };
            var cbslowmo = new ComboBox(gb);

            cbslowmo.Dock = Pos.Top;
            var fpsarray = new[] { 1, 2, 5, 10, 20 };

            for (var i = 0; i < fpsarray.Length; i++)
            {
                cbslowmo.AddItem("Slowmo FPS: " + fpsarray[i], fpsarray[i].ToString(CultureInfo.InvariantCulture),
                                 fpsarray[i]);
            }
            cbslowmo.SelectByName(Settings.Local.SlowmoSpeed.ToString(CultureInfo.InvariantCulture));
            cbslowmo.ItemSelected += (o, e) =>
            {
                Settings.Local.SlowmoSpeed = (int)e.SelectedItem.UserData;
            };
            //editor
            var backup = gb;

            gb          = new GroupBox(container);
            gb.Text     = "Editor";
            gb.Width    = 180;
            gb.Height   = 170;
            marg        = gb.Margin;
            marg.Bottom = 5;
            marg.Right  = 5;
            gb.Margin   = marg;
            Gwen.Align.PlaceDownLeft(gb, backup);
            //Gwen.Align.AlignRight(gb);
            lcb        = new LabeledCheckBox(gb);
            marg       = lcb.Margin;
            marg.Top  += 5;
            lcb.Margin = marg;
            lcb.Text   = "All Pink Lifelock";
            lcb.SetToolTipText(@"I hope you know where the manual is.");
            lcb.IsChecked     = Settings.PinkLifelock;
            lcb.CheckChanged += (o, e) => { Settings.PinkLifelock = ((LabeledCheckBox)o).IsChecked; Settings.Save(); };
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Disable Line Snap";
            lcb.IsChecked     = Settings.Local.DisableSnap;
            lcb.CheckChanged += (o, e) => { Settings.Local.DisableSnap = ((LabeledCheckBox)o).IsChecked; };
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Force XY Snap";
            lcb.IsChecked     = Settings.Local.ForceXySnap;
            lcb.CheckChanged += (o, e) => { Settings.Local.ForceXySnap = ((LabeledCheckBox)o).IsChecked; };
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Superzoom";
            lcb.IsChecked     = Settings.SuperZoom;
            lcb.CheckChanged += (o, e) => { Settings.SuperZoom = ((LabeledCheckBox)o).IsChecked; Settings.Save(); };
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "White BG";
            lcb.IsChecked     = Settings.WhiteBG;
            lcb.CheckChanged += (o, e) =>
            {
                Settings.WhiteBG = ((LabeledCheckBox)o).IsChecked;
                Settings.Save();
            };
            lcb.Dock          = Pos.Top;
            lcb               = new LabeledCheckBox(gb);
            lcb.Text          = "Night Mode";
            lcb.IsChecked     = Settings.NightMode;
            lcb.CheckChanged += (o, e) =>
            {
                Settings.NightMode = ((LabeledCheckBox)o).IsChecked;
                Settings.Save();
                game.Invalidate();
                game.Canvas.ButtonsToggleNightmode();
            };
            lcb.Dock = Pos.Top;
            ComboBox scroll = new ComboBox(gb);

            scroll.Margin = new Margin(0, 0, 0, 0);
            scroll.Dock   = Pos.Top;
            scroll.AddItem("Scroll Sensitivity: 0.25x").Name = "0.25";
            scroll.AddItem("Scroll Sensitivity: 0.5x").Name  = "0.5";
            scroll.AddItem("Scroll Sensitivity: 0.75x").Name = "0.75";
            scroll.AddItem("Scroll Sensitivity: 1x").Name    = "1";
            scroll.AddItem("Scroll Sensitivity: 2x").Name    = "2";
            scroll.AddItem("Scroll Sensitivity: 3x").Name    = "3";
            scroll.SelectByName("1");//default if user setting fails.
            scroll.SelectByName(Settings.ScrollSensitivity.ToString(Program.Culture));
            scroll.ItemSelected += (o, e) =>
            {
                if (e.SelectedItem != null)
                {
                    Settings.ScrollSensitivity = float.Parse(e.SelectedItem.Name, Program.Culture);
                    Settings.Save();
                }
            };
            lcb               = new LabeledCheckBox(container);
            lcb.Text          = "Check for Updates";
            lcb.IsChecked     = Settings.CheckForUpdates;
            lcb.CheckChanged += (o, e) => { Settings.CheckForUpdates = ((LabeledCheckBox)o).IsChecked; Settings.Save(); };
            lcb.Dock          = Pos.Bottom;
        }