Exemplo n.º 1
0
        Button EngButton(IWidget parent, string name, int x, int y)
        {
            const int   kHeight = 35;
            const float kRound  = 5f;

            var contour = VGPath.OpenVGPath(); // 33x35

            VGU.vguRoundRect(contour, 0, 0, 33, kHeight, kRound, kRound);
            var normal = new VGPath(contour, null, new VGSolidColor(Palette.LightGrey));
            var active = new VGPath(contour, null, new VGSolidColor(Palette.DarkGray));

            var btn = new Button(parent, active, normal);//, "eng");//, x, y, width, kHeight, kRound);

            var label = new TextArea(btn, 0, 0, btn.Width, btn.Height)
            {
                Text = name
            };

            label.SetAlign(Align.Center, new GfxPoint(0, 5));
            label.SetFont(22);

            btn.Move(x, y);
            btn.OnRelease = caller =>
            {
                Text          += Text.Length == 0 ? label.Text : label.Text.ToLower();
                mTextArea.Text = Text;
            };
            btn.Hide();
            mEngLayout.Add(btn);

            return(btn);
        }
Exemplo n.º 2
0
        public static TableLine InputArea(IWidget parent, string label, int x, int y, int width = 440, int height = 30)
        {
            var rv = new TableLine(parent, height);

            rv.AddColumn(width, null, Align.Left, 20, Palette.Black, new GfxPoint(5, 5));

            var outline = VGPath.OpenVGPath();

            VGU.vguRoundRect(outline, 0, 0, width, height, 5, 5);

            rv.AddVGPath(new VGPath(outline, new VGSolidColor(Palette.LightGrey), new VGSolidColor(Palette.TextArea.Background)));
            rv.Move(x, y);

            var hitLabel = new TextArea(rv, 0, 0, rv.Width, rv.Height);

            hitLabel.SetAlign(Align.Left, new GfxPoint(5, 5));
            hitLabel.SetFont(Palette.DarkSlateGray, 20);
            hitLabel.Text = label;

            rv.OnPaint += caller =>
            {
                if (string.IsNullOrEmpty(rv.Text[0].Text))
                {
                    hitLabel.Show();
                }
                else
                {
                    hitLabel.Hide();
                }
            };


            return(rv);
        }
Exemplo n.º 3
0
        private static void InitModal()
        {
            if (mModalInitialized)
            {
                return;
            }

            const int kWidth  = 90;
            const int kHeight = 35;
            const int kRound  = 10;

            mModalOutline = VGPath.OpenVGPath();

            VGU.vguRoundRect(mModalOutline, 0, 0, kWidth, kHeight, kRound, kRound);

            mModalStrokeVGPaint = new VGSolidColor(Palette.LightGrey);

            #region default color
            mModalNormalVGPaintDefault = SetPaint(Palette.DarkGray, Palette.LightGrey, kHeight);
            mModalActiveVGPaintDefault = SetPaint(Palette.LightGrey, Palette.DarkGray, kHeight);
            #endregion

            #region red color
            mModalNormalVGPaintRed = SetPaint(new Color(0x640000FF), Palette.Red, kHeight);
            mModalActiveVGPaintRed = SetPaint(Palette.Red, new Color(0x640000FF), kHeight);
            #endregion

            #region green color
            mModalNormalVGPaintGreen = SetPaint(new Color(0x006400FF), Palette.Lime, kHeight);
            mModalActiveVGPaintGreen = SetPaint(Palette.Lime, new Color(0x006400FF), kHeight);
            #endregion

            mModalInitialized = true;
        }
Exemplo n.º 4
0
        private void Init(int x)
        {
            //Width = 16;
            //Height = mCount * (Width + 5) - 5;
            //Y = (Application.Screen.Height - Height) / 2 + 10;

            Resize(16, mCount * (Width + 5) - 5);


            mPath = VGPath.OpenVGPath();

            mActivePaint = VG.vgCreatePaint();
            VG.vgSetParameterfv(mActivePaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, (new Color(0x2EBF0EFF)).Value);

            mDefaultPaint = VG.vgCreatePaint();
            VG.vgSetParameterfv(mDefaultPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, (new Color(0x3B3C3DFF)).Value);

            mText = new List <TextArea[]>();

            for (var i = 0; i < mCount; i++)
            {
                mText.Add(Text.Label(this, string.Format("{0}", i + 1), 17, -1, (i * (Width + 5)) - 3, 16, 16));
            }

            SetSpeed(0);
            mSensor.OnUpdate += sensor => SetSpeed((byte)sensor.Value);

            Move(x, (Application.Screen.Height - Height) / 2 + 10);
        }
Exemplo n.º 5
0
        internal FillMesh(GraphicsDevice device, VGPath path)
        {
            StencilVertex[] vertices;
            if (!Make(path, out vertices, out _tris))
                return;

            _vertices = new VertexBuffer(device, StencilVertex.VertexDeclaration, vertices.Length, BufferUsage.WriteOnly);
            _vertices.SetData(vertices);
        }
Exemplo n.º 6
0
        protected internal TestWidget(IWidget parent) : base(parent, 0, 0, 150, 150)
        {
            //Text.Label(this, "Hello", 50, 10, 20, Width, 50, Align.Center, Palette.DarkSlateGray);

            //mPath = new VGPath(null, new VGSolidColor(Palette.Orange));
            mPath = new VGPath(null, new VGSolidColor(new Color(0xFFA5003F)));
            mPath.Move(30, 30);
            VGU.vguRoundRect(mPath.GetPath(), 0, 0, 100, 100, 35, 35);
        }
Exemplo n.º 7
0
        internal static bool Make(VGPath path, out StencilVertex[] vertices, out int tris)
        {
            vertices = null;
            // Count triangles
            tris =
                path.GetCount(VGPath.SegmentType.CurveTo) * 2 +
                path.GetCount(VGPath.SegmentType.LineTo) +
                path.GetCount(VGPath.SegmentType._Tesselated);

            if (tris == 0)
                return false;

            // Tesselate
            vertices = new StencilVertex[tris * 3];
            StencilVertex start = new StencilVertex();
            Vector2 last = new Vector2();
            int index = 0;

            start.Set(0, 0, Constants.Coef_Solid);
            for (var s = path.FirstSegment; s != null; s = s.Next)
            {
                switch (s.Value.Type)
                {
                    case VGPath.SegmentType.CurveTo:
                        {
                            vertices[index++].Set(last.X, last.Y, Constants.Coef_Solid);
                            vertices[index++].Set(s.Value.Target.X, s.Value.Target.Y, Constants.Coef_Solid);
                            vertices[index++] = start;

                            vertices[index++].Set(last.X, last.Y, Constants.Coef_BezierStart);
                            vertices[index++].Set(s.Value.Controls[0].X, s.Value.Controls[0].Y, Constants.Coef_BezierControl);
                            vertices[index++].Set(s.Value.Target.X, s.Value.Target.Y, Constants.Coef_BezierEnd);
                        }
                        break;
                    case VGPath.SegmentType.LineTo:
                    case VGPath.SegmentType._Tesselated:
                        {
                            vertices[index++].Set(last.X, last.Y, Constants.Coef_Solid);
                            vertices[index++].Set(s.Value.Target.X, s.Value.Target.Y, Constants.Coef_Solid);
                            vertices[index++] = start;
                        }
                        break;
                    case VGPath.SegmentType.MoveTo:
                        {
                            start.Set(s.Value.Target.X, s.Value.Target.Y, Constants.Coef_Solid);
                        }
                        break;
                    default:
                        continue;
                }

                last = s.Value.Target;
            }

            return true;
        }
Exemplo n.º 8
0
 internal StaticString(VGDevice device, IEnumerable<KeyValuePair<Vector2, VGPath>> glyphs)
     : base(null)
 {
     VGPath result = new VGPath();
     foreach (var g in glyphs)
     {
         var p = g.Value.Clone();
         p.Offset(g.Key);
         result.Append(p);
     }
     _path = device.PreparePath(result, VGPaintMode.Fill);
     Extents = _path.Extents;
 }
Exemplo n.º 9
0
        private void Init(int x, int y)
        {
            InitBackground();

            mImage = new Image(this, 10, 35);
            mImage.Load("./wvga.filter.raw");

            Text.Label(this, "Фильтр\\nв системе смазки", 14, 0, 0, Width, 14);

            mPaint = VG.vgCreatePaint();
            VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, (new Color(0xEDAB18ff)).Value);


            mRollArea = new TextArea(this, Width - 50, 45, 49, 30)
            {
                Text = ""
            };
            mRollArea.SetAlign(Align.Center, new GfxPoint(0, 5));
            mRollArea.SetFont(Palette.White, 16);

            const int kLimit = 10;

            mRollArea.Text = string.Format("{0}", "Отключен");
            VG.vgSetParameterfv(mFilterPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new Color(0x2EC90Eff).Value);

            mSensor.OnUpdate += sensor =>
            {
                if (mStatus.ValueAsInt == 0)
                {
                    mRollArea.Text = string.Format("{0}", "Отключен");
                    VG.vgSetParameterfv(mFilterPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new Color(0x2EC90Eff).Value);
                }
                else
                {
                    mRollArea.Text = string.Format("{0}", sensor.Value / 10.0f);
                    //mRollArea.Text = string.Format("{0}", sensor.Value > kLimit ? "Норма" : "Авария");
                    VG.vgSetParameterfv(mFilterPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4,
                                        sensor.Value > kLimit ? (new Color(0x2EC90Eff)).Value : (new Color(0xE3AB1Fff)).Value);
                }
            };

            AddVGPath(new VGPath(mPath, null, new VGSolidColor(new Color(0x2c2d2eff))));

            Move(x, y);

            mFilterPath = VGPath.OpenVGPath();
            VGU.vguRect(mFilterPath, mImage.ScreenPosition.X + 1, mImage.ScreenPosition.Y + 1, mImage.Width - 2, mImage.Height - 2);

            mFilterPaint = VG.vgCreatePaint();
            VG.vgSetParameterfv(mFilterPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, (new Color(0xEDAB18ff)).Value);
        }
Exemplo n.º 10
0
        private void InitBackground()
        {
            if (mInitialized)
            {
                return;
            }

            const int kRound = 10;

            mPath = VGPath.OpenVGPath();
            VGU.vguRoundRect(mPath, 0, 0, Width, Height, kRound, kRound);

            mInitialized = true;
        }
Exemplo n.º 11
0
        public override ModalWindow AddModal(string name)
        {
            var modal = base.AddModal("modal-" + name);

            var modalOutline = VGPath.OpenVGPath();

            VGU.vguRoundRect(modalOutline, 0, 0, 400, 230, 20, 20);

            var fill = new VGLinearGradient(0, 0, 0, 230);

            fill.AddColor(0, Palette.DarkGray);
            fill.AddColor(25, Palette.LightGrey);
            fill.AddColor(100, Palette.LightGrey);

            var outline = new VGPath(modalOutline,
                                     new VGSolidColor(Palette.DarkSlateGray),
                                     fill)
            {
                StrokeWidth = 2.0f
            };

            outline.Move(40, 25);
            modal.AddVGPath(outline);

            var textOutline = VGPath.OpenVGPath();

            VGU.vguRect(textOutline, 0, 0, 360, 160);
            var text = new VGPath(textOutline,
                                  new VGSolidColor(Palette.DarkSlateGray),
                                  new VGSolidColor(Palette.White))
            {
                StrokeWidth = 2.0f
            };

            text.Move(60, 85);
            modal.AddVGPath(text);

            switch (name)
            {
            case "yesno":
                ConfigureModalYesNo(modal);
                break;

            case "ok":
                ConfigureModalOk(modal);
                break;
            }

            return(modal);
        }
Exemplo n.º 12
0
        private VGPath GetPanelPath()
        {
            var fill = new VGLinearGradient(0, 0, mPanel.Width, 0);

            fill.AddColor(0, Palette.LightBlue);
            fill.AddColor(25, Palette.Gainsboro);
            fill.AddColor(75, Palette.Gainsboro);
            fill.AddColor(100, Palette.LightBlue);

            var rv = new VGPath(new VGSolidColor(Palette.White), fill);

            VGU.vguRect(rv.GetPath(), 0, 0, mPanel.Width, mPanel.Height);

            return(rv);
        }
Exemplo n.º 13
0
        public static TableLine DateTime(IWidget parent, int x, int y)
        {
            const int kHeight = 40;

            var rv = new TableLine(parent, kHeight);

            rv.AddColumn(35, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // hour
            rv.AddColumn(15, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // :
            rv.AddColumn(35, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // minute
            rv.AddColumn(0, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5));  // :
            rv.AddColumn(0, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5));  // seconds
            rv.AddColumn(20, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // " - "

            rv.AddColumn(35, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // day
            rv.AddColumn(15, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // "/"
            rv.AddColumn(35, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // month
            rv.AddColumn(15, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // "/"
            rv.AddColumn(80, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // year

            //rv.AddColumn(30, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // seconds

            var outline = VGPath.OpenVGPath();

            VGU.vguRoundRect(outline, 0, 0, rv.Width, kHeight, 5, 5);

            rv.AddVGPath(new VGPath(outline, new VGSolidColor(Palette.LightGrey), new VGSolidColor(Palette.TextArea.Background)));
            rv.Move(x, y);

            {
                rv.Text[0].Text = "09";
                rv.Text[1].Text = ":";
                rv.Text[2].Text = "00";
                rv.Text[3].Text = ":";
                rv.Text[4].Text = "00";
                rv.Text[5].Text = " - ";


                rv.Text[6].Text  = "01";
                rv.Text[7].Text  = "/";
                rv.Text[8].Text  = "03";
                rv.Text[9].Text  = "/";
                rv.Text[10].Text = "2014";
                //rv.Text[0].Text = ":";
                //rv.Text[0].Text = "14";
            }

            return(rv);
        }
Exemplo n.º 14
0
        private void InitBackground()
        {
            if (mInitialized)
            {
                return;
            }

            const int kRound = 10;

            mPath = VGPath.OpenVGPath();
            VGU.vguRoundRect(mPath, 0, 0, Width, Height, kRound, kRound);

            mLinear = VG.vgCreatePath(0, VGPathDatatype.VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);

            mInitialized = true;
        }
Exemplo n.º 15
0
        private static Button Button(IWidget parent, string text, IntPtr path)
        {
            var isActivated = !(text == "резерв" || text == "");

            var contour = new VGPath(path, new VGSolidColor(new Color(0x00AEEFFF)), mClassicActiveVGPaintDefault)
            {
                StrokeWidth = 3.0f
            };

            var rv = new Button(parent, contour, new VGPath(path, null, new VGSolidColor(new Color((uint)(isActivated ? 0x3B3C3DFF : 0x3B3C3D6F)))));

            rv.Activate(isActivated);

            const int   kFontSize = 25;
            const float kBias     = 1.0f;

            SetText(rv, text, kFontSize, kBias);

            return(rv);
        }
Exemplo n.º 16
0
        public static Button DownButton(IWidget parent, string text, int x, int y, ColorStyle style = ColorStyle.Default)
        {
            InitDown();

            const int   kFontSize = 15;
            const float kBias     = 1.0f;

            var contour = new VGPath(mDownOutline, new VGSolidColor(new Color(0x00AEEFFF)), mClassicActiveVGPaintDefault)
            {
                StrokeWidth = 1.5f
            };
            var rv = new Button(parent, contour, new VGPath(mDownOutline, null, new VGSolidColor(new Color(0x3B3C3DFF))));//new Color(0x3B3C3DFF)

            SetText(rv, text, kFontSize, kBias);
            //rv.IsCached = true;

            rv.Move(x, y);

            return(rv);
        }
Exemplo n.º 17
0
        public static Button QuadButton(IWidget parent, string text, int x, int y, ColorStyle style = ColorStyle.Default)
        {
            InitQuad();

            const int   kFontSize = 15;
            const float kBias     = 1.0f;

            var contour = new VGPath(mQuadOutline, new VGSolidColor(new Color(0x00AEEFFF)), mQuadActiveVGPaintDefault)
            {
                StrokeWidth = 2.0f
            };
            var rv = new Button(parent, contour, new VGPath(mQuadOutline, new VGSolidColor(Palette.White), new VGSolidColor(new Color(0x3B3C3DFF))));

            SetText(rv, text, kFontSize, kBias);
            //rv.IsCached = true;

            rv.Move(x, y);

            return(rv);
        }
Exemplo n.º 18
0
        Button GenericButton(IWidget parent, int x, int y, int width, string text, Color color)
        {
            const int   kHeight = 35;
            const float kRound  = 5f;

            var contour = VGPath.OpenVGPath();

            VGU.vguRoundRect(contour, 0, 0, width, kHeight, kRound, kRound);
            var normal = new VGPath(contour, null, new VGSolidColor(color ?? Palette.LightGrey));

            var activeColor = Palette.DarkGray;

            if (color == Palette.Red)
            {
                activeColor = Palette.Orange;
            }
            //activeColor = new Color(0x640000FF);

            if (color == Palette.Lime)
            {
                activeColor = Palette.Orange;
            }
            //activeColor = new Color(0x006400FF);

            var active = new VGPath(contour, null, new VGSolidColor(activeColor));

            var btn = new Button(parent, active, normal);//, "generic");//, x, y, width, kHeight, kRound);

            var label = new TextArea(btn, 0, 0, btn.Width, btn.Height)
            {
                Text = text
            };

            label.SetAlign(Align.Center, new GfxPoint(0, 10));
            label.SetFont(22);

            btn.Move(x, y);
            btn.Show();

            return(btn);
        }
Exemplo n.º 19
0
        private static void InitDown()
        {
            if (mDownInitialized)
            {
                return;
            }

            const int kWidth  = 62;
            const int kHeight = 34;
            const int kRound  = 10;

            mDownOutline = VGPath.OpenVGPath();

            VGU.vguRoundRect(mDownOutline, 0, 0, kWidth, kHeight, kRound, kRound);

            #region default color
            mClassicActiveVGPaintDefault = SetPaint(Palette.Black, new Color(0x58595BFF), kHeight);
            #endregion

            mDownInitialized = true;
        }
Exemplo n.º 20
0
        private static void InitQuad()
        {
            if (mQuadInitialized)
            {
                return;
            }


            const int kButtonsWidth  = 62;
            const int kButtonsHeight = 45;

            mQuadOutline = VGPath.OpenVGPath();

            VGU.vguRect(mQuadOutline, 0, 0, kButtonsWidth, kButtonsHeight);

            #region default color
            mQuadActiveVGPaintDefault = SetPaint(Palette.Black, new Color(0x58595BFF), kButtonsHeight);
            #endregion

            mQuadInitialized = true;
        }
Exemplo n.º 21
0
        private static void InitGiant()
        {
            if (mGiantInitialized)
            {
                return;
            }

            const int kWidth  = 230;
            const int kHeight = 90;
            const int kRound  = 25;

            mGiantOutline = VGPath.OpenVGPath();

            VGU.vguRoundRect(mGiantOutline, 0, 0, kWidth, kHeight, kRound, kRound);

            mGiantStrokeVGPaint = new VGSolidColor(Palette.LightGrey);
            //mGiantNormalVGPaint = SetPaint(Palette.LightBlue, Palette.LightGrey, kHeight);
            mGiantNormalVGPaint = SetPaint(Palette.DarkGray, Palette.LightGrey, kHeight);
            mGiantActiveVGPaint = SetPaint(Palette.LightGrey, Palette.DarkGray, kHeight);

            mGiantInitialized = true;
        }
Exemplo n.º 22
0
        private static void InitClassic()
        {
            if (mClassicInitialized)
            {
                return;
            }

            const int kWidth  = 120;
            const int kHeight = 50;
            const int kRound  = 15;

            mClassicOutline = VGPath.OpenVGPath();

            VGU.vguRoundRect(mClassicOutline, 0, 0, kWidth, kHeight, kRound, kRound);

            mClassicStrokeVGPaint = new VGSolidColor(Palette.LightGrey);

            #region default color
            //mClassicNormalVGPaintDefault = SetPaint(Palette.LightBlue, Palette.LightGrey, kHeight);
            mClassicNormalVGPaintDefault = SetPaint(Palette.DarkGray, Palette.LightGrey, kHeight);
            mClassicActiveVGPaintDefault = SetPaint(Palette.LightGrey, Palette.DarkGray, kHeight);
            #endregion

            #region red color
            //mClassicNormalVGPaintRed = SetPaint(Palette.LightBlue, Palette.Red, kHeight);
            mClassicNormalVGPaintRed = SetPaint(new Color(0x640000FF), Palette.Red, kHeight);
            mClassicActiveVGPaintRed = SetPaint(Palette.Red, new Color(0x640000FF), kHeight);
            #endregion

            #region green color
            //mClassicNormalVGPaintGreen = SetPaint(Palette.LightBlue, Palette.Lime, kHeight);
            //mClassicNormalVGPaintGreen = SetPaint(new Color(0x004623FF), Palette.Lime, kHeight);
            mClassicNormalVGPaintGreen = SetPaint(new Color(0x006400FF), Palette.Lime, kHeight);
            mClassicActiveVGPaintGreen = SetPaint(Palette.Lime, new Color(0x006400FF), kHeight);
            #endregion

            mClassicInitialized = true;
        }
Exemplo n.º 23
0
        public static Button SideButton(IWidget parent, string text, int x, int y, ColorStyle style = ColorStyle.Default)
        {
            InitSide();

            const int   kFontSize = 18;
            const float kBias     = 1.0f;

            var contour = new VGPath(mClassicOutline, new VGSolidColor(new Color(0x00AEEFFF)), mClassicActiveVGPaintDefault)
            {
                StrokeWidth = 1.5f
            };
            var rv = new Button(parent, contour, new VGPath(mClassicOutline, null, new VGSolidColor(new Color(0x3B3C3DFF))));

            SetText(rv, text, kFontSize, kBias);
            if (text == "")
            {
                rv.FixState = ButtonState.Released;
            }

            rv.Move(x, y);

            return(rv);
        }
Exemplo n.º 24
0
        public static Button DownButton(IWidget parent, string text, int x, int y, ColorStyle style = ColorStyle.Default)
        {
            InitDown();

            const int   kFontSize = 25;
            const float kBias     = 1.0f;

            var contour = new VGPath(mDownOutline, new VGSolidColor(new Color(0x00AEEFFF)), mClassicActiveVGPaintDefault)
            {
                StrokeWidth = 3.0f
            };
            var rv = new Button(parent, contour, new VGPath(mDownOutline, null, new VGSolidColor(new Color(0x3B3C3DFF))));

            if (text == "резерв")
            {
                rv.Activate(false);
            }

            SetText(rv, text, kFontSize, kBias);

            rv.Move(x, y);

            return(rv);
        }
Exemplo n.º 25
0
        private void Init(int x, int y)
        {
            InitBackground();

            Text.Label(this, mDescription, 14, 0, 0, Width, 14);
            //Text.Label(this, "100%", 14, 0, 0, Width, 14);
            //Text.Label(this, "0%", 14, 0, 0, Width, 14);

            mPaint = VG.vgCreatePaint();
            VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, (new Color(0xEDAB18ff)).Value);

            Format      = "{0:0}";
            mActiveArea = new TextArea(this, Width - 40, (int)(Height * 0.45f), 40, 30);//
            SetValue(0);

            mActiveArea.SetAlign(Align.Left, new GfxPoint(0, 5));
            mActiveArea.SetFont(Palette.White, 22);

            AddVGPath(new VGPath(mPath, null, new VGSolidColor(new Color(0x2c2d2eff))));

            {
                var i = VGPath.OpenVGPath();
                VGU.vguRect(i, 0, 0, 45, 59);
                var rv = new VGPath(i, new VGSolidColor(new Color(0x6d6e71ff)), new VGSolidColor(new Color(0x414041ff)))
                {
                    StrokeWidth = 1.0f
                };
                rv.Move(X + 12, Y + 32);
                AddVGPath(rv);
            }

            mSensor.OnUpdate += sensor => SetValue(sensor.Value / 10.0f);


            Move(x, y);
        }
Exemplo n.º 26
0
        public static TableLine DateTime(IWidget parent, int x, int y)
        {
            const int kHeight = 30;

            var rv = new TableLine(parent, kHeight);

            rv.AddColumn(25, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // hour
            rv.AddColumn(10, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // :
            rv.AddColumn(25, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // minute
            rv.AddColumn(0, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5));  // :
            rv.AddColumn(0, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5));  // seconds
            rv.AddColumn(15, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // " - "

            rv.AddColumn(25, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // day
            rv.AddColumn(10, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // "/"
            rv.AddColumn(25, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // month
            rv.AddColumn(10, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // "/"
            rv.AddColumn(55, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // year

            //rv.AddColumn(30, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // seconds

            var outline = VGPath.OpenVGPath();

            VGU.vguRoundRect(outline, 0, 0, rv.Width, kHeight, 5, 5);

            rv.AddVGPath(new VGPath(outline, new VGSolidColor(Palette.LightGrey), new VGSolidColor(Palette.TextArea.Background)));
            rv.Move(x, y);

            foreach (var label in rv.Text)
            {
                label.SetFont(Palette.Black, 25);
                label.SetAlign(Align.Center);
            }

            //rv.OnShow += caller =>
            {
                rv.Text[0].Text = "09";
                rv.Text[1].Text = ":";
                rv.Text[2].Text = "00";
                rv.Text[3].Text = ":";
                rv.Text[4].Text = "00";
                rv.Text[5].Text = " - ";


                rv.Text[6].Text  = "01";
                rv.Text[7].Text  = "/";
                rv.Text[8].Text  = "03";
                rv.Text[9].Text  = "/";
                rv.Text[10].Text = "2014";
                //rv.Text[0].Text = ":";
                //rv.Text[0].Text = "14";
            }



            rv.OnPress += caller =>
            {
                var cell = caller as TextArea;
                if (cell != null)
                {
                    cell.SetFont(Palette.Red);
                }
            };

            return(rv);
        }
Exemplo n.º 27
0
        internal StrokeMesh(GraphicsDevice device, VGPath path, VGLineCap startCap, VGLineCap endCap, VGLineJoin join, float miterLimit)
        {
            int solidCount, radialCount, i, j, moves;

            // No triangles at all, don't bother...
            if (path.IsEmpty)
                return;

            // Approximate triangle counts
            moves = path.GetCount(VGPath.SegmentType.MoveTo);
            GetCapTris(startCap, out i, out j);
            solidCount = moves * i;
            radialCount = moves * j;

            GetCapTris(endCap, out i, out j);
            solidCount += moves * i;
            radialCount += moves * j;

            GetJoinTris(join, out i, out j);
            solidCount += path.Count * i;
            radialCount += path.Count * j;

            solidCount += (path.GetCount(VGPath.SegmentType.LineTo) + path.GetCount(VGPath.SegmentType._Tesselated)) * 2;

            // Initialize
            _solid = new SolidStrokeBuilder(solidCount, miterLimit);
            _radial = new RadialStrokeBuilder(radialCount);

            var startCapFunc = GetCapFunction(startCap);
            var endCapFunc = GetCapFunction(endCap);
            var joinFunc = GetJoinFunction(join);

            // Tesselate
            VGPath.Segment last = null;
            Vector2 lastNormal = Vector2.Zero;
            var lastStart = path.FirstSegment;

            for (var s = lastStart; s != null; s = s.Next)
            {
                switch (s.Value.Type)
                {
                    case VGPath.SegmentType.LineTo:
                        {
                            Vector2 n, mn;
                            VectorMath.GetLeftNormal(last.Target, s.Value.Target, out n);
                            mn = -n;

                            _solid.AddVertex(last.Target, mn);
                            _solid.AddVertex(last.Target, n);
                            _solid.AddVertex(s.Value.Target, n);
                            _solid.AddVertex(last.Target, mn);
                            _solid.AddVertex(s.Value.Target, n);
                            _solid.AddVertex(s.Value.Target, mn);
                        }
                        break;
                    case VGPath.SegmentType._Tesselated:
                        {
                            if (last.Type != VGPath.SegmentType._Tesselated)
                                VectorMath.GetLeftNormal(last.Target, s.Value.Target, out lastNormal);

                            Vector2 lastRtNormal = -lastNormal;
                            _solid.AddVertex(last.Target, lastRtNormal);
                            _solid.AddVertex(last.Target, lastNormal);
                            _solid.AddVertex(s.Value.Target, s.Value.Controls[0]);
                            _solid.AddVertex(last.Target, lastRtNormal);
                            _solid.AddVertex(s.Value.Target, s.Value.Controls[0]);
                            _solid.AddVertex(s.Value.Target, -s.Value.Controls[0]);

                            lastNormal = s.Value.Controls[0];
                        }
                        break;

                    case VGPath.SegmentType.MoveTo:
                        {
                            if (s.Previous != null && s.Previous.Value.Type != VGPath.SegmentType.Close && s.Previous.Value.Type != VGPath.SegmentType.MoveTo)
                            {
                                startCapFunc(lastStart, true);
                                endCapFunc(s.Previous, false);
                            }

                            lastStart = s;
                        }
                        break;
                    case VGPath.SegmentType.Close:
                        break;
                    default:
                        throw new InvalidOperationException("Trying to stroke non-flattened path!");
                }

                if (s.Value.MakeJoin && s.Next != null)
                    joinFunc(s);

                last = s.Value;
            }

            // Do the caps
            if (path.LastSegment.Value.Type != VGPath.SegmentType.Close && path.LastSegment.Value.Type != VGPath.SegmentType.MoveTo)
            {
                startCapFunc(lastStart, true);
                endCapFunc(path.LastSegment, false);
            }

            // Create buffer
            _vertices[0] = _solid.Build(device, out _tris[0]);
            _vertices[1] = _radial.Build(device, out _tris[1]);

            // Free builders
            _radial = null;
            _solid = null;
        }
Exemplo n.º 28
0
        private void AddChilds()
        {
            #region generic

            var window = this;

            mTextArea = new TextArea(window, 20, 207, 435, 25)
            {
                Text = ""
            };                                                               //, Size = 18, Background = true};
            mTextArea.SetFont(Palette.Black, 24);
            mTextArea.SetAlign(Align.Left, new GfxPoint(0, 5));


            var outline = VGPath.OpenVGPath();
            VGU.vguRoundRect(outline, 0, 0, mTextArea.Width + 6, mTextArea.Height + 6, 5, 5);
            var vgOutline = new VGPath(outline, new VGSolidColor(Palette.LightGrey), new VGSolidColor(Palette.White));
            vgOutline.Move(mTextArea.X - 3, mTextArea.Y - 3);
            window.AddVGPath(vgOutline);

            GenericButton(window, 15, 15, 80, "cancel", Palette.Red).OnRelease = caller =>
            {
                if (ReturnWindow == null)
                {
                    return;
                }

                mTextArea.Text = "";
                Text           = "";

                mBlink.Stop();

                mApplication.SetFocusedWindow(ReturnWindow);
            };

            GenericButton(window, 385, 15, 80, "enter", Palette.Lime).OnRelease = caller =>
            {
                if (ReturnWindow == null)
                {
                    return;
                }

                if (OnEnter != null)
                {
                    OnEnter(Text);
                }

                mTextArea.Text = "";
                Text           = "";

                mBlink.Stop();

                mApplication.SetFocusedWindow(ReturnWindow);
            };

            GenericButton(window, 110, 15, 260, "", null).OnRelease = caller =>
            {
                Text           = (Text + " ");
                mTextArea.Text = Text;
            };

            #endregion

            #region symbols

            var xPos     = 110;
            var xPosStep = 52;
            var yPos     = 150;

            #region first row

            {
                var btnRus = NumericButton(window, "rus", 20, yPos);
                btnRus.OnRelease = caller => ActivateLayout(mRusLayout);

                NumericButton(window, "0", xPos, yPos);
                xPos += xPosStep;

                NumericButton(window, "1", xPos, yPos);
                xPos += xPosStep;

                NumericButton(window, "2", xPos, yPos);
                xPos += xPosStep;

                NumericButton(window, "3", xPos, yPos);
                xPos += xPosStep;

                NumericButton(window, "4", xPos, yPos);

                xPos = 415;
                var btnDel = NumericButton(window, "del", xPos, yPos);
                btnDel.OnRelease = caller =>
                {
                    Text           = RemoveLastSymbol(Text);
                    mTextArea.Text = Text;
                };
            }

            #endregion

            #region second row
            xPos = 110;
            yPos = 107;
            {
                var btnEng = NumericButton(window, "eng", 20, yPos);
                //btnEng.PressColor = Utils.ColorPalette.Blue;
                btnEng.OnRelease = caller => ActivateLayout(mEngLayout);

                NumericButton(window, "5", xPos, yPos);
                xPos += xPosStep;

                NumericButton(window, "6", xPos, yPos);
                xPos += xPosStep;

                NumericButton(window, "7", xPos, yPos);
                xPos += xPosStep;

                NumericButton(window, "8", xPos, yPos);
                xPos += xPosStep;

                NumericButton(window, "9", xPos, yPos);
            }

            #endregion

            #region third row
            xPos = 110;
            yPos = 65;
            {
                NumericButton(window, ".", xPos, yPos);
                xPos += xPosStep;

                NumericButton(window, ",", xPos, yPos);
                xPos += xPosStep;

                NumericButton(window, "_", xPos, yPos);
                xPos += xPosStep;

                NumericButton(window, "#", xPos, yPos);
                xPos += xPosStep;

                NumericButton(window, ":", xPos, yPos);
            }

            #endregion

            #endregion

            #region russian
            xPos     = 10;
            xPosStep = 39;
            yPos     = 150;

            #region first row

            {
                RusButton(window, "É", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ö", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ó", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ê", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Å", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Í", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ã", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ø", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ù", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ç", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Õ", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ú", xPos, yPos);
            }

            #endregion

            #region second row

            xPos = 10;
            yPos = 107;
            {
                var btn123 = RusButton(window, "123", xPos, yPos);
                //btn123.PressColor = Utils.ColorPalette.Blue;
                btn123.OnRelease = caller => ActivateLayout(mSymbolLayout);
                xPos            += xPosStep;

                RusButton(window, "Ô", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Û", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Â", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "À", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ï", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ð", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Î", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ë", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ä", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Æ", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ý", xPos, yPos);
            }

            #endregion

            #region third row

            xPos = 10;
            yPos = 65;
            {
                var btnEng = RusButton(window, "eng", xPos, yPos);
                //btnEng.PressColor = Utils.ColorPalette.Blue;
                btnEng.OnRelease = caller => ActivateLayout(mEngLayout);
                xPos            += xPosStep;

                RusButton(window, "ß", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "×", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ñ", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ì", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "È", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ò", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Ü", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Á", xPos, yPos);
                xPos += xPosStep;

                RusButton(window, "Þ", xPos, yPos);
                xPos += xPosStep;

                xPos += xPosStep;
                var btnDel = RusButton(window, "del", xPos, yPos);
                btnDel.OnRelease = caller =>
                {
                    Text           = RemoveLastSymbol(Text);
                    mTextArea.Text = Text;
                };
            }

            #endregion


            #endregion

            #region english
            xPos     = 10;
            xPosStep = 39;
            yPos     = 150;

            #region first row

            {
                EngButton(window, "Q", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "W", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "E", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "R", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "T", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "Y", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "U", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "I", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "O", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "P", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "{", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "}", xPos, yPos);
            }

            #endregion

            #region second row

            xPos = 10;
            yPos = 107;
            {
                var btn123 = EngButton(window, "123", xPos, yPos);
                //btn123.PressColor = Utils.ColorPalette.Blue;
                btn123.OnRelease = caller => ActivateLayout(mSymbolLayout);
                xPos            += xPosStep;

                EngButton(window, "A", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "S", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "D", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "F", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "G", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "H", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "J", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "K", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "L", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, ";", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "\"", xPos, yPos);
            }

            #endregion

            #region third row

            xPos = 10;
            yPos = 65;
            {
                var btnRus = EngButton(window, "rus", xPos, yPos);
                //btnRus.PressColor = Utils.ColorPalette.Blue;
                btnRus.OnRelease = caller => ActivateLayout(mRusLayout);
                xPos            += xPosStep;

                EngButton(window, "Z", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "X", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "C", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "V", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "B", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "N", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "M", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, "<", xPos, yPos);
                xPos += xPosStep;

                EngButton(window, ">", xPos, yPos);
                xPos += xPosStep;

                xPos += xPosStep;
                var btnDel = EngButton(window, "del", xPos, yPos);
                btnDel.OnRelease = caller =>
                {
                    Text           = RemoveLastSymbol(Text);
                    mTextArea.Text = Text;
                };
            }

            #endregion


            #endregion
        }
Exemplo n.º 29
0
        public VagonIcon(IWidget parent, ISignal pump, ISignal uz2, ISignal uz3, ISignal uz4, ISignal uz5, ISignal conveyor, int y)
            : base(parent)
        {
            mPump = pump;
            #region насосная станция
            mPump.OnUpdate += sensor =>
            {
                switch (sensor.ValueAsInt)
                {
                case 0:    // stop
                {
                    EngineNormal(0);
                }
                break;

                case 1:    // active
                {
                    EngineActive(0);
                }
                break;

                case 2:    // fault
                {
                    EngineFault(0);
                }
                break;
                }
            };
            #endregion

            mUz2 = uz2;
            #region ПЧН 1
            mUz2.OnUpdate += sensor =>
            {
                switch (sensor.ValueAsInt)
                {
                case 0:    // stop
                {
                    EngineNormal(1);
                }
                break;

                case 1:    // active
                {
                    EngineActive(1);
                }
                break;

                case 2:    // fault
                {
                    EngineFault(1);
                }
                break;
                }
            };
            #endregion

            mUz3 = uz3;
            #region ПЧН 2
            mUz3.OnUpdate += sensor =>
            {
                switch (sensor.ValueAsInt)
                {
                case 0:    // stop
                {
                    EngineNormal(2);
                }
                break;

                case 1:    // active
                {
                    EngineActive(2);
                }
                break;

                case 2:    // fault
                {
                    EngineFault(2);
                }
                break;
                }
            };
            #endregion

            mUz4 = uz4;
            #region ПЧН 3
            mUz4.OnUpdate += sensor =>
            {
                switch (sensor.ValueAsInt)
                {
                case 0:    // stop
                {
                    EngineNormal(3);
                }
                break;

                case 1:    // active
                {
                    EngineActive(3);
                }
                break;

                case 2:    // fault
                {
                    EngineFault(3);
                }
                break;
                }
            };
            #endregion

            mUz5 = uz5;
            #region ПЧН4
            mUz5.OnUpdate += sensor =>
            {
                switch (sensor.ValueAsInt)
                {
                case 0:    // stop
                {
                    EngineNormal(4);
                }
                break;

                case 1:    // active
                {
                    EngineActive(4);
                }
                break;

                case 2:    // fault
                {
                    EngineFault(4);
                }
                break;
                }
            };
            #endregion

            mConveyor = conveyor;
            #region конвейер
            mConveyor.OnUpdate += sensor =>
            {
                switch (sensor.ValueAsInt)
                {
                case 0:    // stop
                {
                    EngineNormal(5);
                }
                break;

                case 1:    // active
                {
                    EngineActive(5);
                }
                break;

                case 2:    // fault
                {
                    EngineFault(5);
                }
                break;
                }
            };
            #endregion

            mImage = new Image(this, 0, 0);
            const float kScale = 1.0f;
            mImage.Scale(kScale, kScale);
            mImage.Load("./wvga.vagon.raw");

            //Width = (int)(mImage.Width * kScale);
            //Height = (int)(mImage.Height * kScale);
            Resize((int)(mImage.Width * kScale), (int)(mImage.Height * kScale));
            Init(y);

            for (var i = 0; i < 6; i++)
            {
                mRects.Add(new Rect {
                    Path = VGPath.OpenVGPath(), Color = mDefaultColor
                });
            }

            var pos = ScreenPosition;

            VGU.vguRect(mRects[0].Path, pos.X + 145, pos.Y + mImage.Height - 30, 35, 20);
            VGU.vguRect(mRects[1].Path, pos.X + 75, pos.Y + mImage.Height - 35, 30, 25);
            VGU.vguRect(mRects[2].Path, pos.X + 185, pos.Y + mImage.Height - 35, 30, 25);
            VGU.vguRect(mRects[3].Path, pos.X + 75, pos.Y + 10, 30, 25);
            VGU.vguRect(mRects[4].Path, pos.X + 185, pos.Y + 10, 30, 25);
            VGU.vguRect(mRects[5].Path, pos.X + 10, pos.Y + mImage.Height / 2 - 20, mImage.Width - 20, 40);

            mPaint = VG.vgCreatePaint();
        }
Exemplo n.º 30
0
        private void Init(int x, int y)
        {
            InitBackground();

            mPaint = VG.vgCreatePaint();
            VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, (new Color(0xEDAB18ff)).Value);

            AddVGPath(new VGPath(mPath, new VGSolidColor(new Color(0xD1D3D4FF)), new VGSolidColor(new Color(0x2c2d2eff)))
            {
                StrokeWidth = 0.5f
            });

            var       divideLines = VGPath.OpenVGPath();
            const int kBiasY      = 44;

            VGU.vguLine(divideLines, 0, 3 * kBiasY, Width - 30, 3 * kBiasY);
            VGU.vguLine(divideLines, 0, 2 * kBiasY, Width - 30, 2 * kBiasY);
            VGU.vguLine(divideLines, 0, kBiasY, Width - 30, kBiasY);
            VGU.vguLine(divideLines, 0, 0, Width - 30, 0);
            var lines = new VGPath(divideLines, new VGSolidColor(new Color(0xD1D3D4FF)), null)
            {
                StrokeWidth = 0.5f
            };

            lines.Move(15, kBiasY);
            AddVGPath(lines);

            const int kBiasX  = 47;
            const int kBiasX0 = 60;

            Text.Label(this, "T, ⁰C", 16, kBiasX0, kBiasY * 4, kBiasX, 18);
            Text.Label(this, "I, A", 16, kBiasX0 + kBiasX, kBiasY * 4, kBiasX, 18);
            Text.Label(this, "U, B", 16, kBiasX0 + 2 * kBiasX, kBiasY * 4, kBiasX, 18);
            Text.Label(this, "F, Гц", 16, kBiasX0 + 3 * kBiasX, kBiasY * 4, kBiasX, 18);
            Text.Label(this, "об/мин", 16, kBiasX0 + 4 * kBiasX, kBiasY * 4, kBiasX, 18);

            //Text.Label(this, "ПЧН #1\\nПЧН #2\\nПЧН #3\\nПЧН #4", 18, 15, 22, kBiasX0 - 15, kBiasY, Align.Left);

            mTable     = new Table(this);
            mTableLine = new TableLine(kBiasY / 2);
            mTableLine.AddColumn(kBiasX0 - 15, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3));
            //mTableLine.Text[0].Text = "ПЧН #4";
            mTableLine.AddColumn(kBiasX, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3));
            mTableLine.AddColumn(kBiasX, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3));
            mTableLine.AddColumn(kBiasX, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3));
            mTableLine.AddColumn(kBiasX, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3));
            mTableLine.AddColumn(kBiasX, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3));

            mTableStatusLine = new TableLine(kBiasY / 2);
            mTableStatusLine.AddColumn(kBiasX0 - 15, null, Align.Center, 16, new Color(0xD1D3D4FF), new GfxPoint(0, 5));
            mTableStatusLine.Text[0].Text = "статус:";
            mTableStatusLine.AddColumn(kBiasX * 5, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3));

            mTable.AddLine(mTableStatusLine);
            mTable.AddLine(mTableLine);

            mTable.AddLine(new TableLine(mTableStatusLine));
            mTable.AddLine(new TableLine(mTableLine));

            mTable.AddLine(new TableLine(mTableStatusLine));
            mTable.AddLine(new TableLine(mTableLine));

            mTable.AddLine(new TableLine(mTableStatusLine));
            mTable.AddLine(new TableLine(mTableLine));

            //mTable.SetBorder(1, Palette.Lime); // for debug
            mTable.Move(15, 0);

            mTable.GetCellById(7, 0).Text = "Uz 2";
            mTable.GetCellById(5, 0).Text = "Uz 3";
            mTable.GetCellById(3, 0).Text = "Uz 4";
            mTable.GetCellById(1, 0).Text = "Uz 5";


            #region temperature
            mReciever.GetSignal("uz.2.temperature").OnUpdate += sensor => mTable.GetCellById(7, 1).Text = string.Format("{0}", sensor.Value);
            mReciever.GetSignal("uz.3.temperature").OnUpdate += sensor =>
            {
                mTable.GetCellById(5, 1).Text = string.Format("{0}", sensor.Value);
            };
            mReciever.GetSignal("uz.4.temperature").OnUpdate += sensor => mTable.GetCellById(3, 1).Text = string.Format("{0}", sensor.Value);
            mReciever.GetSignal("uz.5.temperature").OnUpdate += sensor => mTable.GetCellById(1, 1).Text = string.Format("{0}", sensor.Value);
            mTable.GetCellById(7, 1).Text = "-";
            mTable.GetCellById(5, 1).Text = "-";
            mTable.GetCellById(3, 1).Text = "-";
            mTable.GetCellById(1, 1).Text = "-";
            #endregion

            #region current
            mReciever.GetSignal("uz.2.current").OnUpdate += sensor => mTable.GetCellById(7, 2).Text = string.Format("{0}", sensor.Value);
            mReciever.GetSignal("uz.3.current").OnUpdate += sensor => mTable.GetCellById(5, 2).Text = string.Format("{0}", sensor.Value);
            mReciever.GetSignal("uz.4.current").OnUpdate += sensor => mTable.GetCellById(3, 2).Text = string.Format("{0}", sensor.Value);
            mReciever.GetSignal("uz.5.current").OnUpdate += sensor => mTable.GetCellById(1, 2).Text = string.Format("{0}", sensor.Value);
            mTable.GetCellById(7, 2).Text = "-";
            mTable.GetCellById(5, 2).Text = "-";
            mTable.GetCellById(3, 2).Text = "-";
            mTable.GetCellById(1, 2).Text = "-";
            #endregion

            #region voltage
            mReciever.GetSignal("uz.2.voltage").OnUpdate += sensor => mTable.GetCellById(7, 3).Text = string.Format("{0}", sensor.Value);
            mReciever.GetSignal("uz.3.voltage").OnUpdate += sensor => mTable.GetCellById(5, 3).Text = string.Format("{0}", sensor.Value);
            mReciever.GetSignal("uz.4.voltage").OnUpdate += sensor => mTable.GetCellById(3, 3).Text = string.Format("{0}", sensor.Value);
            mReciever.GetSignal("uz.5.voltage").OnUpdate += sensor => mTable.GetCellById(1, 3).Text = string.Format("{0}", sensor.Value);
            mTable.GetCellById(7, 3).Text = "-";
            mTable.GetCellById(5, 3).Text = "-";
            mTable.GetCellById(3, 3).Text = "-";
            mTable.GetCellById(1, 3).Text = "-";
            #endregion

            // TODO: привязать к реальным значениям
            #region freq
            mReciever.GetSignal("uz.2.frequency").OnUpdate += sensor => mTable.GetCellById(7, 4).Text = string.Format("{0:F2}", sensor.Value / 100);
            mReciever.GetSignal("uz.3.frequency").OnUpdate += sensor => mTable.GetCellById(5, 4).Text = string.Format("{0:F2}", sensor.Value / 100);
            mReciever.GetSignal("uz.4.frequency").OnUpdate += sensor => mTable.GetCellById(3, 4).Text = string.Format("{0:F2}", sensor.Value / 100);
            mReciever.GetSignal("uz.5.frequency").OnUpdate += sensor => mTable.GetCellById(1, 4).Text = string.Format("{0:F2}", sensor.Value / 100);
            mTable.GetCellById(7, 4).Text = "-";
            mTable.GetCellById(5, 4).Text = "-";
            mTable.GetCellById(3, 4).Text = "-";
            mTable.GetCellById(1, 4).Text = "-";
            #endregion

            #region rpm - энкодера нет физически
            //mReciever.GetSignal("uz.2.speed").OnUpdate += sensor => mTable.GetCellById(7, 5).Text = string.Format("{0}", sensor.Value);
            //mReciever.GetSignal("uz.3.speed").OnUpdate += sensor => mTable.GetCellById(5, 5).Text = string.Format("{0}", sensor.Value);
            //mReciever.GetSignal("uz.4.speed").OnUpdate += sensor => mTable.GetCellById(3, 5).Text = string.Format("{0}", sensor.Value);
            //mReciever.GetSignal("uz.5.speed").OnUpdate += sensor => mTable.GetCellById(1, 5).Text = string.Format("{0}", sensor.Value);
            mTable.GetCellById(7, 5).Text = "-";
            mTable.GetCellById(5, 5).Text = "-";
            mTable.GetCellById(3, 5).Text = "-";
            mTable.GetCellById(1, 5).Text = "-";
            #endregion

            // TODO: по значению
            #region status

            /*
             * mReciever.GetSignal("uz.2.error").OnUpdate += sensor => mTable.GetCellById(7, 5).Text = string.Format("0x{0:X4}", sensor.Value);
             * mReciever.GetSignal("uz.3.error").OnUpdate += sensor => mTable.GetCellById(5, 5).Text = string.Format("0x{0:X4}", sensor.Value);
             * mReciever.GetSignal("uz.4.error").OnUpdate += sensor => mTable.GetCellById(3, 5).Text = string.Format("0x{0:X4}", sensor.Value);
             * mReciever.GetSignal("uz.5.error").OnUpdate += sensor => mTable.GetCellById(1, 5).Text = string.Format("0x{0:X4}", sensor.Value);
             */

            mReciever.GetSignal("uz.2.error").OnUpdate += sensor =>
            {
                mTable.GetCellById(6, 1).SetFont(sensor.Value > 0
                                                                                                            ? Palette.Red
                                                                                                            : Palette.White);
                mTable.GetCellById(6, 1).Text = string.Format("{0}", sensor.Value);
            };
            mReciever.GetSignal("uz.3.error").OnUpdate += sensor =>
            {
                mTable.GetCellById(4, 1).SetFont(sensor.Value > 0
                                                                                                            ? Palette.Red
                                                                                                            : Palette.White);
                mTable.GetCellById(4, 1).Text = string.Format("{0}", sensor.Value);
            };
            mReciever.GetSignal("uz.4.error").OnUpdate += sensor =>
            {
                mTable.GetCellById(2, 1).SetFont(sensor.Value > 0
                                                                                                            ? Palette.Red
                                                                                                            : Palette.White);
                mTable.GetCellById(2, 1).Text = string.Format("{0}", sensor.Value);
            };
            mReciever.GetSignal("uz.5.error").OnUpdate += sensor =>
            {
                mTable.GetCellById(0, 1).SetFont(sensor.Value > 0
                                                                                                            ? Palette.Red
                                                                                                            : Palette.White);
                mTable.GetCellById(0, 1).Text = string.Format("{0}", sensor.Value);
            };

            mTable.GetCellById(6, 1).Text = "6:1";
            mTable.GetCellById(4, 1).Text = "4:1";
            mTable.GetCellById(2, 1).Text = "2:1";
            mTable.GetCellById(0, 1).Text = "0:1";
            #endregion

            //mReciever.GetSignal("").OnUpdate += sensor => mTable.GetCellById(0, 0).Text = string.Format("{0}", sensor.Value);


            Move(x, y);
        }
Exemplo n.º 31
0
        public static GraphicArea ClassicArea(IWidget parent)
        {
            var rv = new GraphicArea(parent, 460, 220)
            {
                Background = Palette.TextArea.Background
            };

            #region Lines & arrows
            {
                var path = VGPath.OpenVGPath();
                VG.vgLoadIdentity();

                VGU.vguLine(path, 0, 0, rv.Width - 60, 0);  // OX
                VGU.vguLine(path, 0, 0, 0, rv.Height - 40); // OY

                const float kXBias = 5f;
                const float kYBias = 12f;

                var yArroyBias = rv.Height - 40f;

                var pathData = new float[16];
                pathData[0] = -kXBias;
                pathData[1] = yArroyBias;          //0f;
                pathData[2] = 0f;
                pathData[3] = yArroyBias + kYBias; // kYBias;
                pathData[4] = kXBias;
                pathData[5] = yArroyBias;          //0f;
                VGU.vguPolygon(path, pathData, 3, VGboolean.VG_TRUE);

                var xArroyBias = rv.Width - 60f;
                pathData[0] = xArroyBias;
                pathData[1] = -kXBias;
                pathData[2] = xArroyBias + kYBias;
                pathData[3] = 0f;
                pathData[4] = xArroyBias;
                pathData[5] = kXBias;
                VGU.vguPolygon(path, pathData, 3, VGboolean.VG_TRUE);

                var vgPath = new VGPath(path, new VGSolidColor(Palette.Black), new VGSolidColor(Palette.LightBlue));
                vgPath.Move(35, 15);
                rv.Arrows = vgPath;
            }
            #endregion

            #region Grid
            {
                var path = VGPath.OpenVGPath();

                for (var i = 1; i < 4; i++)
                {
                    VGU.vguLine(path, 0, i * 60, rv.Width - 60, i * 60);  // OX
                }
                for (var i = 1; i < 11; i++)
                {
                    VGU.vguLine(path, i * 40, 0, i * 40, rv.Height - 40); // OY
                }
                var vgPath = new VGPath(path, null, null);
                vgPath.SetStroke(new VGSolidColor(Palette.DarkSlateGray), new[] { 5.0f, 10.0f, 15.0f, 10.0f });
                vgPath.StrokeWidth = 0.5f;
                vgPath.Move(40, 20);

                rv.Grid = vgPath;
            }
            #endregion

            rv.Move(10, 10);
            return(rv);
        }
Exemplo n.º 32
0
        private void Init()
        {
            mTimer = new Timer(ProcessTimerEvent, null, Timeout.Infinite, Timeout.Infinite);

            mPath        = VG.vgCreatePath(0, VGPathDatatype.VG_PATH_DATATYPE_S_16, 1, 0, 0, 0, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);
            mFillPaint   = VG.vgCreatePaint();
            mStrokePaint = VG.vgCreatePaint();

            mGrapihcs = new List <GraphicsData>();

            var color = new VGSolidColor(new Color(0xD1D3D4FF));

            #region Lines & arrows
            {
                var path = VGPath.OpenVGPath();
                VG.vgLoadIdentity();

                const float kXBias = 3f;
                const float kYBias = 12f;

                VGU.vguLine(path, 0, 0, Width - 60, 0);          // OX
                //VGU.vguLine(path, 0, 0, 0, Height - 40); // OY
                VGU.vguLine(path, 0, 0, 0, Height - kYBias - 1); // OY



                var yArroyBias = Height - kYBias - 1;
                //var yArroyBias = Height - 40f;

                var pathData = new float[16];
                pathData[0] = -kXBias;
                pathData[1] = yArroyBias;          //0f;
                pathData[2] = 0f;
                pathData[3] = yArroyBias + kYBias; // kYBias;
                pathData[4] = kXBias;
                pathData[5] = yArroyBias;          //0f;
                VGU.vguPolygon(path, pathData, 3, VGboolean.VG_TRUE);

                var xArroyBias = Width - 60f;
                pathData[0] = xArroyBias;
                pathData[1] = -kXBias;
                pathData[2] = xArroyBias + kYBias;
                pathData[3] = 0f;
                pathData[4] = xArroyBias;
                pathData[5] = kXBias;
                VGU.vguPolygon(path, pathData, 3, VGboolean.VG_TRUE);

                var vgPath = new VGPath(path, color, color);
                vgPath.Move(35, 15);
                Arrows = vgPath;
            }

            #endregion

            #region Grid

            {
                var path = VGPath.OpenVGPath();
                VGU.vguLine(path, 0, 0, Width - 60, 0); // OX

                var vgPath = new VGPath(path, null, null);
                //vgPath.SetStroke(color);
                vgPath.SetStroke(color, new[] { 2.0f, 2.0f });
                vgPath.StrokeWidth = 0.5f;
                vgPath.Move(40, 20 + 180);

                Grid = vgPath;
            }

            #endregion

            #region childs
            mHLabels = new[]
            {
                new TextArea(this, 15, 0, 36, 18)
                {
                    Text = "1"
                },
                new TextArea(this, (int)(kOxWidht * 50 / 177), 0, 36, 18)
                {
                    Text = "50"
                },
                new TextArea(this, (int)(kOxWidht * 100 / 177), 0, 36, 18)
                {
                    Text = "100"
                },
                new TextArea(this, (int)(kOxWidht * 150 / 177), 0, 36, 18)
                {
                    Text = "150"
                }
            };

            var oyLabel = new TextArea(this, -10, Height, 60, 18)
            {
                Text = "P, бар"
            };
            mVRuntimeLabels = new[]
            {
                oyLabel,
                new TextArea(this, -10, 10, 36, 18)
                {
                    Text = "0"
                },

                new TextArea(this, -10, Height * 50 / kHeight, 36, 18)
                {
                    Text = "100"
                },
                new TextArea(this, -10, Height * 100 / kHeight, 36, 18)
                {
                    Text = "200"
                },
                new TextArea(this, -10, Height * 150 / kHeight, 36, 18)
                {
                    Text = "300"
                },
                new TextArea(this, -10, Height * 200 / kHeight, 36, 18)
                {
                    Text = "400"
                },
                new TextArea(this, -10, Height * 250 / kHeight, 36, 18)
                {
                    Text = "500"
                }
            };


            mVHistoryLabels = new[]
            {
                new TextArea(this, -15, Height * 10 / kHeight, 45, 18)
                {
                    Text = ""
                },
                new TextArea(this, -15, Height * 25 / kHeight, 45, 18)
                {
                    Text = ""
                },

                new TextArea(this, -15, Height * 60 / kHeight, 45, 18)
                {
                    Text = ""
                },
                new TextArea(this, -15, Height * 75 / kHeight, 45, 18)
                {
                    Text = ""
                },

                new TextArea(this, -15, Height * 110 / kHeight, 45, 18)
                {
                    Text = ""
                },
                new TextArea(this, -15, Height * 125 / kHeight, 45, 18)
                {
                    Text = ""
                },

                new TextArea(this, -15, Height * 160 / kHeight, 45, 18)
                {
                    Text = ""
                },
                new TextArea(this, -15, Height * 175 / kHeight, 45, 18)
                {
                    Text = ""
                },

                new TextArea(this, -15, Height * 210 / kHeight, 45, 18)
                {
                    Text = ""
                },
                new TextArea(this, -15, Height * 225 / kHeight, 45, 18)
                {
                    Text = ""
                }
            };

            foreach (var label in mHLabels)
            {
                label.SetFont(new Color(0xD1D3D4FF), 20);
                label.SetAlign(Align.Right);
            }


            foreach (var label in mVRuntimeLabels)
            {
                label.SetFont(new Color(0xD1D3D4FF), 20);
                label.SetAlign(Align.Right);
            }


            foreach (var label in mVHistoryLabels)
            {
                label.SetFont(new Color(0xD1D3D4FF), 20);
                label.SetAlign(Align.Right);
                label.Hide();
            }

            //mVRuntimeLabels[mVRuntimeLabels.Length - 2].SetFont(new Color(0x5EE82CFF), 20);// "180"

            var oxLabel = new TextArea(this, Width - 20, 0, 60, 18)
            {
                Text = "N"
            };
            oxLabel.SetFont(new Color(0xD1D3D4FF), 20);


            oyLabel.SetFont(new Color(0xD1D3D4FF), 20);
            oyLabel.SetAlign(Align.Left, new GfxPoint(0, 5));
            #endregion

            Move(170, 310);

            //ImageCacheBorder = 50; // work

            Type = VisializationType.Realtime;
        }