Example #1
0
            protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel)
            {
                base.Render(canvas, graphics, channel);
                if (channel == GH_CanvasChannel.Objects)
                {
                    StringFormat format = new StringFormat();
                    format.Alignment     = StringAlignment.Center;
                    format.LineAlignment = StringAlignment.Center;
                    format.Trimming      = StringTrimming.EllipsisCharacter;

                    GH_Capsule radio = GH_Capsule.CreateCapsule(radio_rec, GH_Palette.White, 2, 0);
                    radio.Render(graphics, Selected, Owner.Locked, false); radio.Dispose();

                    GH_Capsule radio_1 = GH_Capsule.CreateCapsule(radio_rec_1, GH_Palette.Black, 5, 5);
                    radio_1.Render(graphics, Selected, Owner.Locked, false); radio_1.Dispose();
                    graphics.FillEllipse(c1, radio_rec_1);
                    graphics.DrawString("X", GH_FontServer.Standard, Brushes.Black, text_rec_1);

                    GH_Capsule radio_2 = GH_Capsule.CreateCapsule(radio_rec_2, GH_Palette.Black, 5, 5);
                    radio_2.Render(graphics, Selected, Owner.Locked, false); radio_2.Dispose();
                    graphics.FillEllipse(c2, radio_rec_2);
                    graphics.DrawString("Y", GH_FontServer.Standard, Brushes.Black, text_rec_2);

                    GH_Capsule radio_3 = GH_Capsule.CreateCapsule(radio_rec_3, GH_Palette.Black, 5, 5);
                    radio_3.Render(graphics, Selected, Owner.Locked, false); radio_3.Dispose();
                    graphics.FillEllipse(c3, radio_rec_3);
                    graphics.DrawString("Z", GH_FontServer.Standard, Brushes.Black, text_rec_3);
                }
            }
        protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel)
        {
            if (channel == GH_CanvasChannel.Objects)
            {
                GH_CapsuleRenderEngine.RenderOutputGrip(graphics, canvas.Viewport.Zoom, OutputGrip, true);

                for (int col = 0; col < 3; col++)
                {
                    for (int row = 0; row < 3; row++)
                    {
                        int       value  = Value(col, row);
                        Rectangle button = Button(col, row);

                        GH_Palette palette = GH_Palette.White;

                        if (value == Owner.Value)
                        {
                            palette = GH_Palette.Blue;
                        }

                        GH_Capsule capsule = GH_Capsule.CreateTextCapsule(button, button, palette, value.ToString(), 0, 0);
                        capsule.Render(graphics, Selected, Owner.Locked, true);
                        capsule.Dispose();
                    }
                }
            }
        }
        protected override void Render(GH_Canvas canvas, System.Drawing.Graphics graphics, GH_CanvasChannel channel)
        {
            switch (channel)
            {
            case GH_CanvasChannel.Objects:
                base.RenderComponentCapsule(canvas, graphics, true, false, false, true, true, true);

                ComponentWithDirectionLogic comp = Owner as ComponentWithDirectionLogic;

                GH_Capsule btnX = GH_Capsule.CreateCapsule(DirectionX, comp.Direction == FaceDirection.X ? GH_Palette.Black : GH_Palette.White);
                btnX.Render(graphics, this.Selected, Owner.Locked, Owner.Hidden);
                btnX.Dispose();

                GH_Capsule btnY = GH_Capsule.CreateCapsule(DirectionY, comp.Direction == FaceDirection.Y ? GH_Palette.Black : GH_Palette.White);
                btnY.Render(graphics, this.Selected, Owner.Locked, Owner.Hidden);
                btnY.Dispose();

                GH_Capsule btnZ = GH_Capsule.CreateCapsule(DirectionZ, comp.Direction == FaceDirection.Z ? GH_Palette.Black : GH_Palette.White);
                btnZ.Render(graphics, this.Selected, Owner.Locked, Owner.Hidden);
                btnZ.Dispose();

                graphics.DrawString("X", GH_FontServer.Standard, comp.Direction == FaceDirection.X ? Brushes.Gold : Brushes.Black, DirectionX, GH_TextRenderingConstants.CenterCenter);
                graphics.DrawString("Y", GH_FontServer.Standard, comp.Direction == FaceDirection.Y ? Brushes.Gold : Brushes.Black, DirectionY, GH_TextRenderingConstants.CenterCenter);
                graphics.DrawString("Z", GH_FontServer.Standard, comp.Direction == FaceDirection.Z ? Brushes.Gold : Brushes.Black, DirectionZ, GH_TextRenderingConstants.CenterCenter);

                break;

            default:
                base.Render(canvas, graphics, channel);
                break;
            }
        }
Example #4
0
        protected override void Render(GH_Canvas canvas, System.Drawing.Graphics graphics, GH_CanvasChannel channel)
        {
            base.Render(canvas, graphics, channel);

            if (channel == GH_CanvasChannel.Objects)
            {
                var component = Owner as Generator;

                // Options
                var optionTitle = GH_Capsule.CreateTextCapsule(CapsuleBounds[0], CapsuleBounds[0], GH_Palette.Grey, "Options", 0, 1);
                graphics.DrawString((component.PrintLabel ? "☒" : "☐") + " Print label", optionTitle.Font, System.Drawing.Brushes.Black, CapsuleBounds[1].Location);
                graphics.DrawString((component.Collision ? "☒" : "☐") + " Collision", optionTitle.Font, System.Drawing.Brushes.Black, CapsuleBounds[2].Location);

                optionTitle.Render(graphics, Selected, Owner.Locked, false);
                optionTitle.Dispose();

                // Annotation
                var annotationTitle = GH_Capsule.CreateTextCapsule(CapsuleBounds[3], CapsuleBounds[3], GH_Palette.Grey, "Annotation", 0, 1);
                graphics.DrawString((component.AnnotateRods ? "☒" : "☐") + " Rods", annotationTitle.Font, System.Drawing.Brushes.Black, CapsuleBounds[4].Location);
                graphics.DrawString((component.AnnotateJoints ? "☒" : "☐") + " Joints", annotationTitle.Font, System.Drawing.Brushes.Black, CapsuleBounds[5].Location);
                graphics.DrawString((component.AnnotateJointArms ? "☒" : "☐") + " Joint arms", annotationTitle.Font, System.Drawing.Brushes.Black, CapsuleBounds[6].Location);

                annotationTitle.Render(graphics, Selected, Owner.Locked, false);
                annotationTitle.Dispose();
            }
        }
        protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel)
        {
            base.Render(canvas, graphics, channel);

            if (channel == GH_CanvasChannel.Objects)
            {
                GH_Capsule buttonCapsule = GH_Capsule.CreateTextCapsule(buttonRectangle, buttonRectangle, GH_Palette.Grey, ButtonText);
                buttonCapsule.Render(graphics, Selected, attributeOwner.Locked, false);
                buttonCapsule.Dispose();

                StringFormat format = new StringFormat
                {
                    Alignment     = StringAlignment.Center,
                    LineAlignment = StringAlignment.Center,
                    Trimming      = StringTrimming.EllipsisCharacter
                };
                if (GH_FontServer.StringWidth(TextLine.Long, this.TextFont) < Bounds.Width)
                {
                    graphics.DrawString(TextLine.Long, TextFont, Brushes.Black, textRectangle, format);
                }
                else
                {
                    graphics.DrawString(TextLine.Short, TextFont, Brushes.Black, textRectangle, format);
                }
                format.Dispose();
            }
        }
        protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel)
        {
            switch (channel)
            {
            case GH_CanvasChannel.Wires:
                graphics.FillEllipse(Brushes.HotPink, Bounds);
                foreach (IModifiable mod in Owner.TargetObjects())
                {
                    if (mod == null)
                    {
                        continue;
                    }

                    IGH_DocumentObject obj = mod as IGH_DocumentObject;
                    if (obj == null)
                    {
                        continue;
                    }

                    DrawTargetArrow(graphics, obj.Attributes.Bounds);
                }
                break;

            case GH_CanvasChannel.Objects:
                GH_Capsule capsule = GH_Capsule.CreateCapsule(InnerBounds, GH_Palette.Normal, InnerRadius, 0);
                capsule.Render(graphics, Selected, Owner.Locked, true);
                capsule.Dispose();

                string text = string.Format("{0:0.00}", Owner.Factor);
                Grasshopper.GUI.GH_GraphicsUtil.RenderCenteredText(graphics, text, GH_FontServer.Large, Color.Black, Pivot);
                break;
            }
        }
Example #7
0
        protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel)
        {
            if (channel == GH_CanvasChannel.Objects)
            {
                GH_Capsule capsule = GH_Capsule.CreateCapsule(this.Bounds, GH_Palette.Normal);
                capsule.AddOutputGrip(this.OutputGrip.Y);
                capsule.Render(canvas.Graphics, this.Selected, this.Owner.Locked, this.Owner.Hidden);
                capsule.Dispose();
                int zoomFadeLow = GH_Canvas.ZoomFadeLow;
                if (zoomFadeLow > 0)
                {
                    canvas.SetSmartTextRenderingHint();
                    GH_PaletteStyle impliedStyle = GH_CapsuleRenderEngine.GetImpliedStyle(GH_Palette.Normal, this);
                    Color           color        = Color.FromArgb(zoomFadeLow, impliedStyle.Text);

                    if (this.NameBounds.Width > 0f)
                    {
                        SolidBrush brush = new SolidBrush(color);
                        graphics.DrawString(this.ownerOfThisAttribute.NickName, GH_FontServer.Standard, brush, this.NameBounds, GH_TextRenderingConstants.CenterCenter);
                        brush.Dispose();
                        int x    = Convert.ToInt32(this.NameBounds.Right);
                        int num3 = Convert.ToInt32(this.NameBounds.Top);
                        int num4 = Convert.ToInt32(this.NameBounds.Bottom);
                        GH_GraphicsUtil.EtchFadingVertical(graphics, num3, num4, x, Convert.ToInt32((double)(0.8 * zoomFadeLow)), Convert.ToInt32((double)(0.3 * zoomFadeLow)));
                    }

                    this.RenderDropDown(canvas, graphics, color);
                }
            }
        }
Example #8
0
        protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel)
        {
            base.Render(canvas, graphics, channel);

            if (channel == GH_CanvasChannel.Objects)
            {
                GH_PaletteStyle myStyle = new GH_PaletteStyle(System.Drawing.ColorTranslator.FromHtml(Base.EnableRemoteControl ? "#147DE9" : "#B3B3B3"), System.Drawing.ColorTranslator.FromHtml("#FFFFFF"), System.Drawing.ColorTranslator.FromHtml(Base.EnableRemoteControl ? "#ffffff" : "#4C4C4C"));

                GH_PaletteStyle myTransparentStyle = new GH_PaletteStyle(System.Drawing.Color.FromArgb(0, 0, 0, 0));

                var streamIdCapsule = GH_Capsule.CreateTextCapsule(box: StreamIdBounds, textbox: StreamIdBounds, palette: Base.EnableRemoteControl ? GH_Palette.Black : GH_Palette.Transparent, text: Base.EnableRemoteControl ? "Remote Controller" : "ID: " + Base.mySender.StreamId, highlight: 0, radius: 5);
                streamIdCapsule.Render(graphics, myStyle);
                streamIdCapsule.Dispose();

                var streamNameCapsule = GH_Capsule.CreateTextCapsule(box: StreamNameBounds, textbox: StreamNameBounds, palette: GH_Palette.Black, text: "(S) " + Base.NickName, highlight: 0, radius: 5);
                streamNameCapsule.Render(graphics, myStyle);
                streamNameCapsule.Dispose();

                if (Base.ManualMode)
                {
                    var pushStreamButton = GH_Capsule.CreateCapsule(PushStreamButtonRectangle, GH_Palette.Pink, 2, 0);
                    pushStreamButton.Render(graphics, true ? Properties.Resources.play25px : Properties.Resources.pause25px, myTransparentStyle);
                }
            }
        }
        protected override void Render(GH_Canvas canvas,
                                       System.Drawing.Graphics graphics,
                                       GH_CanvasChannel channel)
        {
            // Draw base component.
            base.Render(canvas, graphics, channel);
            // Add custom elements.
            if (channel == GH_CanvasChannel.Objects)
            {
                // Add button to connect/disconect.
                GH_Capsule button = GH_Capsule.CreateTextCapsule(this.BoundsButton, this.BoundsButton, GH_Palette.Black,
                                                                 this.component.status ? "Disconnect" : "Connect", 2, 0);
                button.Render(graphics, this.Selected, this.Owner.Locked, false);
                button.Dispose();

                // Add list of Found Devices.
                // IPAddress ipv4Addresse = Array.FindLast(Dns.GetHostEntry(string.Empty).AddressList,
                //                                         a => a.AddressFamily == AddressFamily.InterNetwork);
                string message = "Devices: ";
                if (HoloConnect.deviceFinder.devices.Count > 0)
                {
                    foreach (HoloDevice device in HoloConnect.deviceFinder.devices.Values)
                    {
                        message += "\n" + device.ToString();
                    }
                }
                else
                {
                    message += "(not found)";
                }
                graphics.DrawString(message, GH_FontServer.NewFont(FontFamily.GenericMonospace, 6, FontStyle.Regular),
                                    Brushes.Black, this.BoundsText, GH_TextRenderingConstants.CenterCenter);
            }
        }
Example #10
0
 protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel)
 {
     base.Render(canvas, graphics, channel);
     if (channel == GH_CanvasChannel.Objects)
     {
         GH_Capsule button = GH_Capsule.CreateTextCapsule(ButtonBounds, ButtonBounds, xColor, "X", 3, 0);
         button.Render(graphics, Selected, false, false);
         button.Dispose();
     }
     if (channel == GH_CanvasChannel.Objects)
     {
         GH_Capsule button2 = GH_Capsule.CreateTextCapsule(ButtonBounds2, ButtonBounds2, yColor, "Y", 2, 0);
         button2.Render(graphics, Selected, Owner.Locked, false);
         button2.Dispose();
     }
     if (channel == GH_CanvasChannel.Objects)
     {
         GH_Capsule button3 = GH_Capsule.CreateTextCapsule(ButtonBounds3, ButtonBounds3, zColor, "Z", 2, 0);
         button3.Render(graphics, Selected, Owner.Locked, false);
         button3.Dispose();
     }
     if (channel == GH_CanvasChannel.Objects)
     {
         GH_Capsule button4 = GH_Capsule.CreateTextCapsule(ButtonBounds4, ButtonBounds4, rxColor, "Fix Rotation", 2, 0);
         button4.Render(graphics, Selected, Owner.Locked, false);
         button4.Dispose();
     }
 }
        protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel)
        {
            base.Render(canvas, graphics, channel);
            if (channel == GH_CanvasChannel.Objects)
            {
                GH_PaletteStyle myStyle = new GH_PaletteStyle(System.Drawing.ColorTranslator.FromHtml("#B3B3B3"), System.Drawing.ColorTranslator.FromHtml("#FFFFFF"), System.Drawing.ColorTranslator.FromHtml("#4C4C4C"));

                GH_PaletteStyle myTransparentStyle = new GH_PaletteStyle(System.Drawing.Color.FromArgb(0, 0, 0, 0));

                var streamIdCapsule = GH_Capsule.CreateTextCapsule(box: StreamIdBounds, textbox: StreamIdBounds, palette: GH_Palette.Transparent, text: "ID: " + Base.StreamId, highlight: 0, radius: 5);
                streamIdCapsule.Render(graphics, myStyle);
                streamIdCapsule.Dispose();

                var streamNameCapsule = GH_Capsule.CreateTextCapsule(box: StreamNameBounds, textbox: StreamNameBounds, palette: GH_Palette.Black, text: "(R) " + Base.NickName + (Base.Paused ? " (Paused)" : ""), highlight: 0, radius: 5);
                streamNameCapsule.Render(graphics, myStyle);
                streamNameCapsule.Dispose();

                //var pauseStreamingButton = GH_Capsule.CreateTextCapsule(PauseButtonBounds, PauseButtonBounds, GH_Palette.Black, "");
                //pauseStreamingButton.Text = Base.Paused ? "Paused" : "Streaming";
                //pauseStreamingButton.Render(graphics, myStyle);

                var pauseStreamingButton = GH_Capsule.CreateCapsule(PauseButtonBounds, GH_Palette.Transparent, 30, 0);
                pauseStreamingButton.Render(graphics, Base.Paused ? Properties.Resources.play25px : Properties.Resources.pause25px, myTransparentStyle);
            }
        }
Example #12
0
        public override void Layout()
        {
            //IL_00a9: Unknown result type (might be due to invalid IL or missing references)
            //IL_012a: Unknown result type (might be due to invalid IL or missing references)
            float num  = base.CanvasPivot.Y + TopMargin + TopInnerMargin + (float)PanelRadius;
            float y    = base.CanvasPivot.Y;
            int   num2 = 0;

            foreach (GH_Attr_Widget control in _controls)
            {
                if (num2++ > 0)
                {
                    num += (float)Space;
                }
                PointF transform = new PointF(base.CanvasPivot.X + LeftMargin + LeftInnerMargin + (float)PanelRadius, num);
                control.UpdateBounds(transform, EffectiveWidth);
                control.Style   = base.Style;
                control.Palette = base.Palette;
                control.Layout();
                float height = control.Height;
                num += height;
            }
            num        += (float)PanelRadius + BottomMargin + BottomInnerMargin;
            base.Height = num - y;
            RectangleF rectangleF = GH_Attr_Widget.Shrink(base.CanvasBounds, LeftMargin, RightMargin, TopMargin, BottomMargin);

            _menu = GH_Capsule.CreateTextCapsule(rectangleF, rectangleF, base.Palette, "", new Font(new FontFamily("Arial"), 8f, FontStyle.Bold), 0, PanelRadius, 8);
        }
Example #13
0
        protected override void Render(GH_Canvas canvas, System.Drawing.Graphics graphics, GH_CanvasChannel channel)
        {
            base.Render(canvas, graphics, channel);

            if (channel == GH_CanvasChannel.Objects)
            {
/*				//okay, so let's render the background
 *              RectangleF capsuleBox = new RectangleF(this.Bounds.Location, this.Bounds.Size);
 *              GH_Capsule capsule = GH_Capsule.CreateCapsule(capsuleBox, GH_Palette.Normal);
 *                              // but when we have a warning, change colors appropriately
 *              if (Owner.RuntimeMessageLevel == GH_RuntimeMessageLevel.Error ||
 *                  Owner.RuntimeMessageLevel == GH_RuntimeMessageLevel.Warning)
 *              {
 *                  capsule.Render(graphics, this.Selected, Owner.Locked, true);
 *              }
 *              else
 *              {
 *                  capsule.Render(graphics, Color.FromArgb(188, 157, 202));
 *              }
 *                              capsule.Dispose();
 */

                button = GH_Capsule.CreateTextCapsule(ButtonBounds, ButtonBounds, GH_Palette.Pink, "(Re)load Cluster", 2, 0);
                button.Render(graphics, Selected, Owner.Locked, false);
                button.Dispose();
            }
        }
Example #14
0
        protected override void Render(GH_Canvas canvas, System.Drawing.Graphics graphics, GH_CanvasChannel channel)
        {
            if (channel == GH_CanvasChannel.Objects)
            {
                GH_Capsule capsule = GH_Capsule.CreateCapsule(this.Bounds, GH_Palette.Normal);
                capsule.AddOutputGrip(this.OutputGrip.Y);
                capsule.Render(canvas.Graphics, this.Selected, this.Owner.Locked, this.Owner.Hidden);
                capsule.Dispose();
                int alpha = GH_Canvas.ZoomFadeLow;
                if (alpha > 0)
                {
                    canvas.SetSmartTextRenderingHint();
                    GH_PaletteStyle      style = GH_CapsuleRenderEngine.GetImpliedStyle(GH_Palette.Normal, this);
                    System.Drawing.Color color = System.Drawing.Color.FromArgb(alpha, style.Text);
                    if (this.NameBounds.Width > 0f)
                    {
                        System.Drawing.SolidBrush nameFill = new System.Drawing.SolidBrush(color);
                        graphics.DrawString(this.Owner.NickName, GH_FontServer.Standard, nameFill, this.NameBounds, GH_TextRenderingConstants.CenterCenter);
                        nameFill.Dispose();
                        int x  = System.Convert.ToInt32(this.NameBounds.Right);
                        int y0 = System.Convert.ToInt32(this.NameBounds.Top);
                        int y  = System.Convert.ToInt32(this.NameBounds.Bottom);
                        GH_GraphicsUtil.EtchFadingVertical(graphics, y0, y, x, System.Convert.ToInt32(0.8 * (double)alpha), System.Convert.ToInt32(0.3 * (double)alpha));
                    }

                    // render dropdown only
                    this.RenderDropDown(canvas, graphics, color);
                }
            }
        }
        private static void doCapsule(Graphics g, RectangleF bounds, GH_Palette palette, Color color)
        {
            GH_Capsule capsule = GH_Capsule.CreateCapsule(bounds, palette, 3, 6);

            capsule.Render(g, color);
            capsule.Dispose();
            capsule = null;
        }
Example #16
0
        public static void RenderButtonIcon_Obsolete(Graphics graphics, GH_Component Owner, RectangleF bound, bool on, Bitmap onMap, Bitmap offMap, int cornerRadius = 6, GH_Palette normalPalette = GH_Palette.Normal)
        {
            GH_Palette      palette      = Owner.RuntimeMessages(GH_RuntimeMessageLevel.Error).Count > 0 ? GH_Palette.Error : Owner.RuntimeMessages(GH_RuntimeMessageLevel.Warning).Count > 0 ? GH_Palette.Warning : normalPalette;
            GH_PaletteStyle impliedStyle = GH_CapsuleRenderEngine.GetImpliedStyle(palette, Owner.Attributes.Selected, Owner.Locked, Owner.Hidden);
            GH_Capsule      cap          = GH_Capsule.CreateCapsule(bound, palette, cornerRadius, 0);

            cap.Render(graphics, on ? onMap : offMap, impliedStyle);
        }
Example #17
0
            protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel)
            {
                base.Render(canvas, graphics, channel);
                if (channel == GH_CanvasChannel.Objects)
                {
                    StringFormat format = new StringFormat();
                    format.Alignment     = StringAlignment.Center;
                    format.LineAlignment = StringAlignment.Center;
                    format.Trimming      = StringTrimming.EllipsisCharacter;

                    GH_Capsule radio = GH_Capsule.CreateCapsule(radio_rec, GH_Palette.White, 2, 0);
                    radio.Render(graphics, Selected, Owner.Locked, false); radio.Dispose();

                    GH_Capsule radio2 = GH_Capsule.CreateCapsule(radio_rec2, GH_Palette.White, 2, 0);
                    radio2.Render(graphics, Selected, Owner.Locked, false); radio2.Dispose();

                    GH_Capsule radio_1 = GH_Capsule.CreateCapsule(radio_rec_1, GH_Palette.Black, 5, 5);
                    radio_1.Render(graphics, Selected, Owner.Locked, false); radio_1.Dispose();
                    graphics.FillEllipse(c1, radio_rec_1);
                    graphics.DrawString("+X", GH_FontServer.Standard, Brushes.Black, text_rec_1);

                    GH_Capsule radio_2 = GH_Capsule.CreateCapsule(radio_rec_2, GH_Palette.Black, 5, 5);
                    radio_2.Render(graphics, Selected, Owner.Locked, false); radio_2.Dispose();
                    graphics.FillEllipse(c2, radio_rec_2);
                    graphics.DrawString("+Y", GH_FontServer.Standard, Brushes.Black, text_rec_2);

                    GH_Capsule radio_3 = GH_Capsule.CreateCapsule(radio_rec_3, GH_Palette.Black, 5, 5);
                    radio_3.Render(graphics, Selected, Owner.Locked, false); radio_3.Dispose();
                    graphics.FillEllipse(c3, radio_rec_3);
                    graphics.DrawString("+45", GH_FontServer.Standard, Brushes.Black, text_rec_3);

                    GH_Capsule radio_4 = GH_Capsule.CreateCapsule(radio_rec_4, GH_Palette.Black, 5, 5);
                    radio_4.Render(graphics, Selected, Owner.Locked, false); radio_4.Dispose();
                    graphics.FillEllipse(c4, radio_rec_4);
                    graphics.DrawString("+135", GH_FontServer.Standard, Brushes.Black, text_rec_4);

                    GH_Capsule radio_5 = GH_Capsule.CreateCapsule(radio_rec_5, GH_Palette.Black, 5, 5);
                    radio_5.Render(graphics, Selected, Owner.Locked, false); radio_5.Dispose();
                    graphics.FillEllipse(c5, radio_rec_5);
                    graphics.DrawString("-X", GH_FontServer.Standard, Brushes.Black, text_rec_5);

                    GH_Capsule radio_6 = GH_Capsule.CreateCapsule(radio_rec_6, GH_Palette.Black, 5, 5);
                    radio_6.Render(graphics, Selected, Owner.Locked, false); radio_6.Dispose();
                    graphics.FillEllipse(c6, radio_rec_6);
                    graphics.DrawString("-Y", GH_FontServer.Standard, Brushes.Black, text_rec_6);

                    GH_Capsule radio_7 = GH_Capsule.CreateCapsule(radio_rec_7, GH_Palette.Black, 5, 5);
                    radio_7.Render(graphics, Selected, Owner.Locked, false); radio_7.Dispose();
                    graphics.FillEllipse(c7, radio_rec_7);
                    graphics.DrawString("-45", GH_FontServer.Standard, Brushes.Black, text_rec_7);

                    GH_Capsule radio_8 = GH_Capsule.CreateCapsule(radio_rec_8, GH_Palette.Black, 5, 5);
                    radio_8.Render(graphics, Selected, Owner.Locked, false); radio_8.Dispose();
                    graphics.FillEllipse(c8, radio_rec_8);
                    graphics.DrawString("-135", GH_FontServer.Standard, Brushes.Black, text_rec_8);
                }
            }
        private void DrawIcon(Graphics g)
        {
            RectangleF Bounds  = this.ParamComponent.Attributes.Bounds;
            GH_Capsule Capsule = GH_Capsule.CreateCapsule(Bounds, GH_Palette.Normal);

            Bitmap Bitmap = this.ParamComponent.Locked ? this.ParamComponent.Icon_24x24_Locked : this.ParamComponent.Icon_24x24;

            Capsule.RenderEngine.RenderIcon(g, Bitmap, 0, 0);
        }
            protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel)
            {
                GH_Capsule capsule = GH_Capsule.CreateCapsule(Bounds, GH_Palette.Normal, 100, 0);

                capsule.AddOutputGrip(OutputGrip.Y);
                capsule.Render(graphics, Selected, Owner.Locked, true);
                capsule.Dispose();
                capsule = null;
            }
Example #20
0
            protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel)
            {
                base.Render(canvas, graphics, channel);
                if (channel == GH_CanvasChannel.Objects)
                {
                    StringFormat format = new StringFormat();
                    format.Alignment     = StringAlignment.Center;
                    format.LineAlignment = StringAlignment.Center;
                    format.Trimming      = StringTrimming.EllipsisCharacter;

                    GH_Capsule title = GH_Capsule.CreateCapsule(title_rec, GH_Palette.Pink, 2, 0);
                    title.Render(graphics, Selected, Owner.Locked, false);
                    title.Dispose();

                    RectangleF textRectangle = title_rec;
                    textRectangle.Height = 20;
                    graphics.DrawString("Display Option", GH_FontServer.Standard, Brushes.White, textRectangle, format);

                    GH_Capsule radio = GH_Capsule.CreateCapsule(radio_rec, GH_Palette.White, 2, 0);
                    radio.Render(graphics, Selected, Owner.Locked, false); radio.Dispose();

                    GH_Capsule radio_11 = GH_Capsule.CreateCapsule(radio_rec_11, GH_Palette.Black, 5, 5);
                    radio_11.Render(graphics, Selected, Owner.Locked, false); radio_11.Dispose();
                    graphics.FillEllipse(c11, radio_rec_11);
                    graphics.DrawString("BaseShape", GH_FontServer.Standard, Brushes.Black, text_rec_11);

                    GH_Capsule radio_13 = GH_Capsule.CreateCapsule(radio_rec_13, GH_Palette.Black, 5, 5);
                    radio_13.Render(graphics, Selected, Owner.Locked, false); radio_13.Dispose();
                    graphics.FillEllipse(c13, radio_rec_13);
                    graphics.DrawString("No", GH_FontServer.Standard, Brushes.Black, text_rec_13);

                    GH_Capsule radio_21 = GH_Capsule.CreateCapsule(radio_rec_21, GH_Palette.Black, 5, 5);
                    radio_21.Render(graphics, Selected, Owner.Locked, false); radio_21.Dispose();
                    graphics.FillEllipse(c21, radio_rec_21);
                    graphics.DrawString("Width", GH_FontServer.Standard, Brushes.Black, text_rec_21);

                    GH_Capsule radio_22 = GH_Capsule.CreateCapsule(radio_rec_22, GH_Palette.Black, 5, 5);
                    radio_22.Render(graphics, Selected, Owner.Locked, false); radio_22.Dispose();
                    graphics.FillEllipse(c22, radio_rec_22);
                    graphics.DrawString("Thick", GH_FontServer.Standard, Brushes.Black, text_rec_22);

                    GH_Capsule radio_23 = GH_Capsule.CreateCapsule(radio_rec_23, GH_Palette.Black, 5, 5);
                    radio_23.Render(graphics, Selected, Owner.Locked, false); radio_23.Dispose();
                    graphics.FillEllipse(c23, radio_rec_23);
                    graphics.DrawString("N/A", GH_FontServer.Standard, Brushes.Black, text_rec_23);

                    GH_Capsule radio2 = GH_Capsule.CreateCapsule(radio_rec2, GH_Palette.White, 2, 0);
                    radio2.Render(graphics, Selected, Owner.Locked, false); radio2.Dispose();

                    GH_Capsule radio2_1 = GH_Capsule.CreateCapsule(radio_rec2_1, GH_Palette.Black, 5, 5);
                    radio2_1.Render(graphics, Selected, Owner.Locked, false); radio2_1.Dispose();
                    graphics.FillEllipse(c2, radio_rec2_1);
                    graphics.DrawString("PDF OUTPUT", GH_FontServer.Standard, Brushes.Black, text_rec2_1);
                    ///******************************************************************************************
                }
            }
Example #21
0
        public RoomInstanceAttributes(RoomInstance param) : base(param)
        {
            if (RoomArea == null)
            {
                RoomArea = GH_Capsule.CreateTextCapsule(new Rectangle(), new Rectangle(), GH_Palette.Black, param.RoomArea.ToString());
            }
            RoomName = GH_Capsule.CreateTextCapsule(new Rectangle(), new Rectangle(), GH_Palette.Black, param.RoomName);

            roomBrush = Brushes.Gray;
        }
Example #22
0
        public static void RenderButtonText_Obsolete(Graphics graphics, GH_Component Owner, RectangleF bound, bool on, string text, Color onColor, Color offColor, Font font, int cornerRadius = 6, GH_Palette normalPalette = GH_Palette.Normal)
        {
            GH_Palette      palette      = Owner.RuntimeMessages(GH_RuntimeMessageLevel.Error).Count > 0 ? GH_Palette.Error : Owner.RuntimeMessages(GH_RuntimeMessageLevel.Warning).Count > 0 ? GH_Palette.Warning : normalPalette;
            GH_PaletteStyle impliedStyle = GH_CapsuleRenderEngine.GetImpliedStyle(palette, Owner.Attributes.Selected, Owner.Locked, Owner.Hidden);
            GH_Capsule      cap          = GH_Capsule.CreateCapsule(bound, palette, cornerRadius, 0);

            cap.Render(graphics, impliedStyle);
            Brush brush = new SolidBrush(on ? onColor : offColor);

            graphics.DrawString(text, font, brush, bound);
        }
 protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel)
 {
     //flag = Math.Pow(this.Bounds.X + this.Bounds.Width / 2, 2) + Math.Pow(this.Bounds.Y + this.Bounds.Height / 2, 2) > Math.Pow(3, 2);
     if (channel == GH_CanvasChannel.Groups && IsNotFirstRender)
     {
         GH_Capsule gH_Capsule = GH_Capsule.CreateCapsule(this.Bounds, GH_Palette.Pink, this.Radius, 0);
         gH_Capsule.Render(graphics, this.Color);
         gH_Capsule.Dispose();
     }
     IsNotFirstRender = true;
 }
Example #24
0
        protected override void Render(GH_Canvas canvas, System.Drawing.Graphics graphics, GH_CanvasChannel channel)
        {
            base.Render(canvas, graphics, channel);

            if (channel == GH_CanvasChannel.Objects)
            {
                GH_Capsule button = GH_Capsule.CreateTextCapsule(ButtonBounds, ButtonBounds, GH_Palette.Black, "Generate!", 2, 0);
                button.Render(graphics, Selected, Owner.Locked, false);
                button.Dispose();
            }
        }
Example #25
0
        public static void HighLightCom(Graphics graphics, GH_Component com, int rowsCount)
        {
            Rectangle relayrect = GH_Convert.ToRectangle(com.Attributes.Bounds);

            relayrect.Inflate(ShareData.FrameWidthGraph, ShareData.FrameWidthGraph);
            Rectangle  rect       = new Rectangle(relayrect.X, relayrect.Y, relayrect.Width, relayrect.Height + rowsCount * 15);
            GH_Capsule gH_Capsule = GH_Capsule.CreateCapsule(rect, GH_Palette.Pink, ShareData.FrameWidth, 5);

            gH_Capsule.Render(graphics, ShareData.ThemeColor);
            gH_Capsule.Dispose();
        }
        protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel)
        {
            base.Render(canvas, graphics, channel);

            var demBounds =
                (RectangleF)
                GH_Convert.ToRectangle(new RectangleF(new PointF(this.Pivot.X + 60, this.Pivot.Y),
                                                      (SizeF) new Size(W - 60 - 80, H)));

            GH_Palette palette = GH_Palette.White;
            GH_Capsule capsule = GH_Capsule.CreateCapsule(demBounds, palette);

            capsule.Render(graphics, Selected, Owner.Locked, true);

            capsule.Dispose();
            capsule = null;

            StringFormat format = new StringFormat();

            format.Alignment     = StringAlignment.Near;
            format.LineAlignment = StringAlignment.Center;
            format.Trimming      = StringTrimming.EllipsisCharacter;

            // Content rectangle
            RectangleF textRectangle = demBounds;

            textRectangle.Height = 20;
            for (int i = 0; i < BimVisualiserData.Instance.NameList.Count; i++)
            {
                _boundingBoxes.Insert(i, textRectangle);

                // Max entries value (it would be nice extending the Bounds if more)
                if (i == 25)
                {
                    break;
                }
                if (i == BimVisualiserData.Instance.Selected)
                {
                    graphics.DrawString(BimVisualiserData.Instance.NameList[i], GH_FontServer.Standard,
                                        Brushes.DodgerBlue, textRectangle, format);
                }
                else
                {
                    graphics.DrawString(BimVisualiserData.Instance.NameList[i], GH_FontServer.Standard, Brushes.Black,
                                        textRectangle, format);
                }
                format.Alignment = StringAlignment.Near;
                //textRectangle.Inflate(-5, 0);
                textRectangle.Y += 20;
            }
            // Always dispose of any GDI+ object that implement IDisposable.
            format.Dispose();
        }
Example #27
0
        public static void ButtonIconRender(Graphics graphics, GH_CanvasChannel channel, IButtonIcon button)
        {
            if (channel == GH_CanvasChannel.Objects)
            {
                graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                GH_Palette      palette      = button.RenderSet.normalPalette;
                GH_PaletteStyle impliedStyle = GetPaletteStype(button, out palette);

                GH_Capsule cap = GH_Capsule.CreateCapsule(button.Bounds, palette, button.RenderSet.CornerRadius, button.RenderSet.HighLight);
                cap.Render(graphics, button.Icon, impliedStyle);
            }
        }
Example #28
0
        protected override void Render(GH_Canvas canvas, System.Drawing.Graphics graphics, GH_CanvasChannel channel)
        {
            base.Render(canvas, graphics, channel);
            SlimeComponent comp = Owner as SlimeComponent;

            if (channel == GH_CanvasChannel.Objects)
            {
                GH_Capsule button = GH_Capsule.CreateTextCapsule(ButtonBounds, ButtonBounds, comp.Run == true ? GH_Palette.Grey : GH_Palette.Transparent, "RESET", 2, 0);
                button.Render(graphics, Selected, Owner.Locked, false);
                button.Dispose();
            }
        }
Example #29
0
            protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel)
            {
                base.Render(canvas, graphics, channel);
                Print comp = Owner as Print;

                if (channel == GH_CanvasChannel.Objects)
                {
                    GH_Capsule button = GH_Capsule.CreateTextCapsule(ButtonBounds, ButtonBounds, comp.toggle ? GH_Palette.Grey : GH_Palette.Black, "Print", 2, 0);
                    button.Render(graphics, Selected, Owner.Locked, false);
                    button.Dispose();
                }
            }
Example #30
0
        protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel)
        {
            base.Render(canvas, graphics, channel);

            if (channel == GH_CanvasChannel.Wires)
            {
                var component = (Boa_AlgorithmComponent)Owner;

                if (component.Algorithm.IsBase)
                {
                    RectangleF inflatedBounds = new RectangleF(Bounds.Location, Bounds.Size);
                    //inflatedBounds.Inflate(1, 1);
                    GH_Capsule highlightCapsule = GH_Capsule.CreateCapsule(inflatedBounds, GH_Palette.White);
                    var        outline          = highlightCapsule.OutlineShape;
                    graphics.DrawPath(outlinePen, outline);

                    //inflatedBounds.Inflate(1, 1);
                    highlightCapsule = GH_Capsule.CreateCapsule(inflatedBounds, GH_Palette.White);
                    outline          = highlightCapsule.OutlineShape;
                    graphics.DrawPath(highlightPen, outline);


                    //graphics.DrawRectangle(highlightPen, new Rectangle(
                    //    (int)inflatedBounds.X,
                    //    (int)inflatedBounds.Y,
                    //    (int)inflatedBounds.Width,
                    //    (int)inflatedBounds.Height
                    //    )
                    //    );
                }
            }

            if (channel == GH_CanvasChannel.Objects)
            {
                var    component       = (Boa_AlgorithmComponent)Owner;
                string dimensionString = component.Algorithm.GetDimensionsString();

                StringFormat format = new StringFormat();
                format.Alignment     = StringAlignment.Center;
                format.LineAlignment = StringAlignment.Center;
                format.Trimming      = StringTrimming.EllipsisCharacter;

                RectangleF textRectangle = new RectangleF(Bounds.X, Bounds.Y - 20, Bounds.Width, Bounds.Height);
                textRectangle.Height = 20;

                // Draw the Algorithm dimensions in a Standard Grasshopper font.
                graphics.DrawString(dimensionString, GH_FontServer.StandardBold, Brushes.Black, textRectangle, format);

                format.Dispose();
                format = null;
            }
        }
        protected override void Render(GH_Canvas canvas, System.Drawing.Graphics graphics, GH_CanvasChannel channel)
        {
            base.Render(canvas, graphics, channel);

            if (channel == GH_CanvasChannel.Objects)
            {
            /*				//okay, so let's render the background
                RectangleF capsuleBox = new RectangleF(this.Bounds.Location, this.Bounds.Size);
                GH_Capsule capsule = GH_Capsule.CreateCapsule(capsuleBox, GH_Palette.Normal);
                // but when we have a warning, change colors appropriately
                if (Owner.RuntimeMessageLevel == GH_RuntimeMessageLevel.Error ||
                    Owner.RuntimeMessageLevel == GH_RuntimeMessageLevel.Warning)
                {
                    capsule.Render(graphics, this.Selected, Owner.Locked, true);
                }
                else
                {
                    capsule.Render(graphics, Color.FromArgb(188, 157, 202));
                }
                capsule.Dispose();
            */

                button = GH_Capsule.CreateTextCapsule(ButtonBounds, ButtonBounds, GH_Palette.Pink, "(Re)load Cluster", 2, 0);
                button.Render(graphics, Selected, Owner.Locked, false);
                button.Dispose();
            }
        }