Beispiel #1
0
 public override void CreateAttributes()
 {
     if (Properties.Settings.Default.Is_Hu_Attribute)
     {
         m_attributes = new Hu_Attribute(this);
     }
     else
     {
         m_attributes = new GH_ComponentAttributes(this);
     }
 }
Beispiel #2
0
 protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel)
 {
     if ((int)channel == 10)
     {
         foreach (IGH_Param item in Owner.Params.Input)
         {
             item.Attributes.RenderToCanvas(canvas, (GH_CanvasChannel)10);
         }
     }
     else
     {
         if ((int)channel != 20)
         {
             return;
         }
         RectangleF bounds = base.Bounds;
         bool       flag   = canvas.Viewport.IsVisible(ref bounds, 10f);
         Bounds = bounds;
         if (flag)
         {
             GH_Palette      impliedPalette = GH_CapsuleRenderEngine.GetImpliedPalette((IGH_ActiveObject)(object)base.Owner);
             GH_PaletteStyle impliedStyle   = GH_CapsuleRenderEngine.GetImpliedStyle(impliedPalette, Selected, Owner.Locked, Owner.Hidden);
             GH_Capsule      val            = GH_Capsule.CreateCapsule(base.Bounds, impliedPalette, 5, 30);
             foreach (IGH_Param item2 in Owner.Params.Input)
             {
                 val.AddInputGrip(item2.Attributes.InputGrip.Y);
             }
             val.AddOutputGrip(OutputGrip.Y);
             if (Owner.Message != null)
             {
                 val.RenderEngine.RenderMessage(graphics, Owner.Message, impliedStyle);
             }
             val.Render(graphics, Selected, Owner.Locked, true);
             val.Dispose();
             GH_ComponentAttributes.RenderComponentParameters(canvas, graphics, base.Owner, impliedStyle);
             if (base.Owner.Graph == null)
             {
                 RectangleF bounds2 = base.Bounds;
                 bounds2.X     += inputWidth;
                 bounds2.Width -= inputWidth + outputWidth;
                 bounds2.Inflate(-6f, -6f);
                 GH_GraphContainer.Render_GraphBackground(graphics, bounds2, false);
             }
             else
             {
                 base.Owner.Container.Render(graphics, DrawDomainsTags, base.Owner.Samples);
             }
         }
     }
 }
Beispiel #3
0
            protected override void Layout()
            {
                RectangleF bounds = base.Bounds;

                bounds.Location = base.Pivot;
                bounds          = GH_Convert.ToRectangle(bounds);
                Bounds          = bounds;
                GH_ComponentAttributes.LayoutInputParams(Owner, bounds);
                foreach (IGH_Param item in Owner.Params.Input)
                {
                    RectangleF bounds2 = item.Attributes.Bounds;
                    bounds2.X += bounds2.Width + 3f;
                    item.Attributes.Bounds = bounds2;
                }
                inputWidth    = (int)Owner.Params.Input[0].Attributes.Bounds.Width;
                bounds.Width -= inputWidth;
                bounds.X     += inputWidth;
                GH_ComponentAttributes.LayoutOutputParams(Owner, bounds);
                outputWidth = (int)(Owner.Params.Output[0]).Attributes.Bounds.Width;
                foreach (IGH_Param item2 in Owner.Params.Output)
                {
                    RectangleF bounds3 = item2.Attributes.Bounds;
                    bounds3.X    -= (float)outputWidth + 3f;
                    bounds3.Width = outputWidth;
                    bounds3.Inflate(0f, -30f);
                    item2.Attributes.Bounds = bounds3;
                }
                bounds.Width -= outputWidth;
                if (bounds.Width < 96f)
                {
                    bounds.Width = 96f;
                }
                if (bounds.Height < 100f)
                {
                    bounds.Height = 100f;
                }
                bounds.Inflate(-6f, -6f);
                if (base.Owner.Container != null)
                {
                    base.Owner.Container.Region = GH_Convert.ToRectangle(bounds);
                }
                Bounds = new Rectangle((int)Pivot.X, (int)Pivot.Y, (int)((float)inputWidth + bounds.Width + 12f + (float)outputWidth), (int)base.Bounds.Height);
            }
Beispiel #4
0
        private void DrawIcon(Graphics g)
        {
            GH_ComponentAttributes Com_Attributes = this.Component.Attributes as GH_ComponentAttributes;
            RectangleF             BitmapRect;

            if (IsComponent)
            {
                BitmapRect = Com_Attributes.ContentBox;
            }
            else
            {
                BitmapRect = this.Component.Attributes.Bounds;
            }

            GH_Capsule Capsule = GH_Capsule.CreateCapsule(Com_Attributes.ContentBox, GH_Palette.Normal);
            Bitmap     Bitmap  = this.Component.Locked ? this.Component.Icon_24x24_Locked : this.Component.Icon_24x24;

            Capsule.RenderEngine.RenderIcon(g, Bitmap, 0, 0);
        }
Beispiel #5
0
        public void _DrawPramGrid(Graphics g)
        {
            List <IGH_Param> Inputs  = this.Component.Params.Input;
            List <IGH_Param> Outputs = this.Component.Params.Output;

            Pen _Pen = new Pen(Color.Black, 1);

            GH_ComponentAttributes Com_Attributes = this.Component.Attributes as GH_ComponentAttributes;

            g.DrawRectangle(_Pen, GH_Convert.ToRectangle(Com_Attributes.ContentBox));
            for (int Index = 0; Index < Inputs.Count; Index++)
            {
                g.DrawRectangle(_Pen, GH_Convert.ToRectangle(Inputs[Index].Attributes.Bounds));
            }
            //Output Params
            for (int Index = 0; Index < Outputs.Count; Index++)
            {
                g.DrawRectangle(_Pen, GH_Convert.ToRectangle(Outputs[Index].Attributes.Bounds));
            }
        }