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); } } }
protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel) { if (channel == GH_CanvasChannel.Objects && !Owner.Locked && Owner is TransactionalComponent component) { if (component.Status != DB.TransactionStatus.RolledBack && component.Status != DB.TransactionStatus.Uninitialized) { var palette = GH_CapsuleRenderEngine.GetImpliedPalette(Owner); if (palette == GH_Palette.Normal && !Owner.IsPreviewCapable) { palette = GH_Palette.Hidden; } // Errors and warnings should be refelected in Canvas if (palette == GH_Palette.Normal || palette == GH_Palette.Hidden) { var style = GH_CapsuleRenderEngine.GetImpliedStyle(palette, Selected, Owner.Locked, Owner.Hidden); var fill = style.Fill; var edge = style.Edge; var text = style.Text; switch (component.Status) { case DB.TransactionStatus.Uninitialized: palette = GH_Palette.Grey; break; case DB.TransactionStatus.Started: palette = GH_Palette.White; break; case DB.TransactionStatus.RolledBack: /*palette = GH_Palette.Normal;*/ break; case DB.TransactionStatus.Committed: palette = GH_Palette.Black; break; case DB.TransactionStatus.Pending: palette = GH_Palette.Blue; break; case DB.TransactionStatus.Error: palette = GH_Palette.Pink; break; case DB.TransactionStatus.Proceed: palette = GH_Palette.Brown; break; } var replacement = GH_CapsuleRenderEngine.GetImpliedStyle(palette, Selected, Owner.Locked, Owner.Hidden); try { style.Edge = replacement.Edge; style.Fill = replacement.Fill; style.Text = replacement.Text; base.Render(canvas, graphics, channel); } finally { style.Fill = fill; style.Edge = edge; style.Text = text; } return; } } } base.Render(canvas, graphics, channel); }
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); } } }
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); }
private void LayoutMenuCollection() { GH_Palette impliedPalette = GH_CapsuleRenderEngine.GetImpliedPalette(base.Owner); GH_PaletteStyle impliedStyle = GH_CapsuleRenderEngine.GetImpliedStyle(impliedPalette, this.Selected, base.Owner.Locked, base.Owner.Hidden); composedCollection.Style = impliedStyle; composedCollection.Palette = impliedPalette; composedCollection.Layout(); }
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) { 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); } } } }
/*******************************************/ private void MessageLabelColours(out Color fill, out Color text, out Color edge) { try { // Define the colour of the render to match the component's borders GH_Palette palette = GH_CapsuleRenderEngine.GetImpliedPalette(this.Owner); if (palette == GH_Palette.Normal && !this.Owner.IsPreviewCapable) { palette = GH_Palette.Hidden; } GH_PaletteStyle style = GH_CapsuleRenderEngine.GetImpliedStyle(palette, this.Selected, this.Owner.Locked, this.Owner.Hidden); edge = style.Edge; fill = style.Edge; if (!Visible) { //If message is warning message, set fill to GH wraning colour. //This is only done if the Prototype label is not already on the component, as extra warning colour is then not needed. CallerValueList owner = (this.Owner as CallerValueList); if (owner != null && owner.IsWarningMessage && !Visible) { if (this.Selected) { fill = Color.FromArgb(210, 230, 25); } else { fill = Color.FromArgb(241, 175, 29); } } } //Set text colour to contrast background colour text = GH_GraphicsUtil.ForegroundColour(fill, 200); } catch { fill = Color.Black; text = Color.White; edge = Color.Black; } }
/// <summary> /// Render the component each time after the canvas got invalid. /// The custom button will be rendered according the mouse position and events. /// </summary> protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel) { base.Render(canvas, graphics, channel); if (channel != GH_CanvasChannel.Objects) { return; } var impliedStyle = GH_CapsuleRenderEngine.GetImpliedStyle(GH_Palette.Transparent, Selected, Owner.Locked, true); var textCapsule = GH_Capsule.CreateTextCapsule(_buttonRectangleF, _buttonRectangleF, GH_Palette.Normal, _buttonName, GH_FontServer.Small, 1, 9); //Define 2 colors that are the background for the color depending if the mouse hovers over or not. textCapsule.RenderEngine.RenderBackground_Alternative(graphics, _mouseHoverInside ? Color.FromArgb(100, Color.DarkOrange) : Color.FromArgb(100, Color.DarkCyan), false); if (_mouseClickInside) { textCapsule.RenderEngine.RenderHighlight(graphics); } textCapsule.RenderEngine.RenderOutlines(graphics, canvas.Viewport.Zoom, impliedStyle); textCapsule.RenderEngine.RenderText(graphics, Color.DarkSlateGray); textCapsule.Dispose(); }
protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel) { if (channel == GH_CanvasChannel.Objects) { bool num = !string.IsNullOrEmpty(base.Owner.NickName); GH_Capsule gH_Capsule = (!num) ? GH_Capsule.CreateCapsule(Bounds, GH_Palette.White, 3, 0) : GH_Capsule.CreateTextCapsule(Bounds, TextBound, GH_Palette.White, base.Owner.NickName, 3, 0); GH_PaletteStyle impliedStyle = GH_CapsuleRenderEngine.GetImpliedStyle(GH_Palette.White, Selected, base.Owner.Locked, hidden: true); gH_Capsule.RenderEngine.RenderOutlines(graphics, canvas.Viewport.Zoom, impliedStyle); GH_CapsuleRenderEngine.RenderOutputGrip(graphics, canvas.Viewport.Zoom, OutputGrip, full: true); if (num) { gH_Capsule.RenderEngine.RenderText(graphics, impliedStyle.Text); } gH_Capsule.Dispose(); GH_Capsule gH_Capsule2 = GH_Capsule.CreateCapsule(m_button, GH_Palette.Black, 3, 0); gH_Capsule2.TextOrientation = GH_Orientation.horizontal_center; gH_Capsule2.Font = GH_FontServer.ConsoleAdjusted; gH_Capsule2.Text = "Get"; gH_Capsule2.Render(graphics, Color.LightGray); gH_Capsule2.Dispose(); } }
/***************************************************/ /**** Public Methods ****/ /***************************************************/ public static void RenderPrototypeLabel <T>(this GH_Attributes <T> attributes, Graphics graphics, RectangleF labelBounds, bool jaggedLeft, bool jaggedRight, bool drawStrips = true) where T : IGH_ActiveObject, IGH_PreviewObject { Color colour; GH_Palette palette; GH_PaletteStyle style; try { // Define the colour of the render to match teh component's borders palette = GH_CapsuleRenderEngine.GetImpliedPalette(attributes.Owner); if (palette == GH_Palette.Normal && !attributes.Owner.IsPreviewCapable) { palette = GH_Palette.Hidden; } style = GH_CapsuleRenderEngine.GetImpliedStyle(palette, attributes.Selected, attributes.Owner.Locked, attributes.Owner.Hidden); colour = style.Edge; } catch (Exception) { //Fallback to using black if the above crashes for any reason colour = Color.Black; palette = GH_Palette.Normal; style = new GH_PaletteStyle(colour, colour); } // Define render parameters Font font = GH_FontServer.StandardBold; Pen linePen = new Pen(colour); linePen.Width = labelBounds.Height / 2; string labelText = "Prototype"; SizeF stringSize = GH_FontServer.MeasureString(labelText, font); stringSize.Height -= 4; Color yellowBackground = Color.FromArgb(255, 209, 2); // Decide if we render strips or a simple line around the label if (drawStrips) { //Base capsule GH_Capsule capsule = GH_Capsule.CreateCapsule(attributes.Bounds, palette); capsule.SetJaggedEdges(jaggedLeft, jaggedRight); float extraWidthBotRect = 10; // Define region to draw into Region clip = new Region(capsule.OutlineShape); //Outline of the base capsule RectangleF botRectangle = new RectangleF(labelBounds.Location.X - extraWidthBotRect / 2, labelBounds.Y, labelBounds.Width + extraWidthBotRect, labelBounds.Height); clip.Intersect(botRectangle); //Intersect base capsule region with bottom rectangle graphics.SetClip(clip, CombineMode.Replace); //Draw the yellow background graphics.FillRectangle(new SolidBrush(yellowBackground), botRectangle); //Define the box around the text to cull int zoomFadeMedium = GH_Canvas.ZoomFadeLow; float textHeight = stringSize.Height; float textWidth = stringSize.Width; stringSize.Width = Math.Max(textWidth, textHeight * 6.1f); //To exactly hit the corners of the box, for 45degree angle, box should have aspectratio 1:6 stringSize.Height = Math.Max(textHeight, textWidth / 6.1f); //To give a slight breathingspace, a aspectratio of 1:6.1 is set here RectangleF textBox = new RectangleF( new PointF(labelBounds.X + (labelBounds.Width - stringSize.Width) / 2, labelBounds.Y + (labelBounds.Height - stringSize.Height ) / 2), stringSize); if (zoomFadeMedium > 5) { clip.Exclude(textBox); } graphics.SetClip(clip, CombineMode.Replace); //Set up parameters for stripes float width = textBox.Width / 6; float sqrt2 = (float)Math.Sqrt(2); Pen stripPen = new Pen(colour, width / sqrt2); //45degree stripes int additionalSpace = (int)linePen.Width; float textBoxCentre = textBox.X + textBox.Width / 2; float y1 = labelBounds.Y + labelBounds.Height + additionalSpace; float y2 = labelBounds.Y - additionalSpace; float deltaY = y1 - y2; //Draw stripes to the right for (float dx = -deltaY / 2; dx < botRectangle.Width; dx += width * 2) { graphics.DrawLine(stripPen, textBoxCentre + dx, y1, textBoxCentre + dx + deltaY, y2); } //Draw stripes to the left for (float dx = -deltaY / 2 - width * 2; dx > -botRectangle.Width; dx -= width * 2) { graphics.DrawLine(stripPen, textBoxCentre + dx, y1, textBoxCentre + dx + deltaY, y2); } // Clear the region filter graphics.ResetClip(); if (zoomFadeMedium > 5) { RectangleF textRenderBounds = labelBounds; textRenderBounds.Y -= 1; // Draw the label graphics.DrawString("Prototype", font, new SolidBrush(Color.FromArgb(zoomFadeMedium, colour)), textRenderBounds, GH_TextRenderingConstants.CenterCenter); } float zoom = graphics.Transform.Elements[0]; capsule.RenderEngine.RenderOutlines(graphics, zoom, style); } else { // Draw the lines aroudn the label float y = labelBounds.Y + labelBounds.Height / 2; graphics.DrawLine(linePen, labelBounds.X + 1, y, labelBounds.X + (labelBounds.Width - stringSize.Width) / 2 - 4, y); graphics.DrawLine(linePen, labelBounds.X + (labelBounds.Width - stringSize.Width) / 2 + stringSize.Width + 4, y, labelBounds.X + labelBounds.Width - 1, y); // Draw the label graphics.DrawString("Prototype", font, new SolidBrush(colour), labelBounds, GH_TextRenderingConstants.CenterCenter); } }
protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel) { switch (channel) { case GH_CanvasChannel.Wires: { if (Owner.SourceCount > 0) { RenderIncomingWires(canvas.Painter, Owner.Sources, Owner.WireDisplay); } break; } case GH_CanvasChannel.Objects: { var palette = GH_CapsuleRenderEngine.GetImpliedPalette(Owner); using (var capsule = GH_Capsule.CreateCapsule(Bounds, palette)) { capsule.AddInputGrip(InputGrip.Y); capsule.AddOutputGrip(OutputGrip.Y); capsule.Render(canvas.Graphics, Selected, Owner.Locked, false); } var bounds = Bounds; if (!canvas.Viewport.IsVisible(ref bounds, 10)) { return; } var alpha = GH_Canvas.ZoomFadeLow; if (alpha > 0) { canvas.SetSmartTextRenderingHint(); var style = GH_CapsuleRenderEngine.GetImpliedStyle(palette, this); var textColor = System.Drawing.Color.FromArgb(alpha, style.Text); var captionColor = string.IsNullOrEmpty(Owner.NickName) || !Owner.MutableNickName ? System.Drawing.Color.FromArgb(alpha / 2, style.Text) : textColor; using (var nameFill = new SolidBrush(captionColor)) graphics.DrawString(string.IsNullOrEmpty(Owner.NickName) ? "Filter mask…" : Owner.NickName, GH_FontServer.LargeAdjusted, nameFill, Bounds, GH_TextRenderingConstants.StringFormat(StringAlignment.Center, StringAlignment.Near)); { var clip = ListBounds; clip.Inflate(-2, 0); Brush alternateBrush = null; if (GH_Canvas.ZoomFadeMedium > 0 && Owner.DataType == GH_ParamData.remote) { graphics.FillRectangle(Brushes.White, clip); alternateBrush = Brushes.WhiteSmoke; } else { alternateBrush = new SolidBrush(System.Drawing.Color.FromArgb(70, style.Fill)); } graphics.SetClip(clip); var transform = graphics.Transform; if (!ScrollerBounds.IsEmpty) { graphics.TranslateTransform(0.0f, -((Owner.ListItems.Count * ItemHeight) - clip.Height) * ScrollRatio); } var format = new StringFormat(StringFormatFlags.NoWrap) { LineAlignment = StringAlignment.Center }; var itemBounds = new System.Drawing.Rectangle((int)clip.X, (int)clip.Y, (int)clip.Width, (int)18); int index = 0; foreach (var item in Owner.ListItems) { if (index++ % 2 != 0) { graphics.FillRectangle(alternateBrush, itemBounds); } if (item.Selected) { if (Owner.DataType == GH_ParamData.remote && GH_Canvas.ZoomFadeMedium > 0) { var highlightBounds = itemBounds; highlightBounds.Inflate(-1, -1); GH_GraphicsUtil.RenderHighlightBox(graphics, highlightBounds, 2, true, true); } var markBounds = new RectangleF(itemBounds.X, itemBounds.Y, 22, itemBounds.Height); RenderCheckMark(graphics, markBounds, textColor); } var nameBounds = new RectangleF(itemBounds.X + 22, itemBounds.Y, itemBounds.Width - 22, itemBounds.Height); graphics.DrawString(item.Name, GH_FontServer.StandardAdjusted, Brushes.Black, nameBounds, format); itemBounds.Y += itemBounds.Height; } graphics.Transform = transform; RenderScrollBar(canvas, graphics, style.Text); graphics.ResetClip(); if (GH_Canvas.ZoomFadeMedium > 0 && Owner.DataType == GH_ParamData.remote) { graphics.DrawRectangle(Pens.Black, clip); GH_GraphicsUtil.ShadowHorizontal(graphics, clip.Left, clip.Right, clip.Top); } else { GH_GraphicsUtil.EtchFadingHorizontal(graphics, (int)bounds.Left, (int)bounds.Right, (int)(bounds.Top + 20), (int)(0.8 * alpha), (int)(0.3 * alpha)); GH_GraphicsUtil.EtchFadingHorizontal(graphics, (int)bounds.Left, (int)bounds.Right, (int)(bounds.Bottom - 16), (int)(0.8 * alpha), (int)(0.3 * alpha)); } var footnoteBounds = new RectangleF(bounds.Left, bounds.Bottom - 17, bounds.Width - 3, 17); graphics.DrawString($"{Owner.ListItems.Count} items, {Owner.VolatileDataCount} selected", GH_FontServer.StandardAdjusted, Brushes.Gray, footnoteBounds, GH_TextRenderingConstants.FarCenter); } } return; } } base.Render(canvas, graphics, channel); }
protected void RenderComponentCapsule2(GH_Canvas canvas, Graphics graphics, bool drawComponentBaseBox, bool drawComponentNameBox, bool drawJaggedEdges, bool drawParameterGrips, bool drawParameterNames, bool drawZuiElements) { GH_SwitcherComponent gH_SwitcherComponent = (GH_SwitcherComponent)base.Owner; RectangleF bounds = this.Bounds; this.Bounds = (bounds); if (!canvas.Viewport.IsVisible(ref bounds, 10f)) { return; } GH_Palette val = GH_CapsuleRenderEngine.GetImpliedPalette(base.Owner); if ((int)val == 0 && !base.Owner.IsPreviewCapable) { val = GH_Palette.Hidden; } GH_Capsule val2 = GH_Capsule.CreateCapsule(this.Bounds, val); bool flag = base.Owner.Params.Input .Count == 0; bool flag2 = base.Owner.Params.Output .Count == 0; val2.SetJaggedEdges(flag, flag2); GH_PaletteStyle impliedStyle = GH_CapsuleRenderEngine.GetImpliedStyle(val, this.Selected, base.Owner.Locked, base.Owner.Hidden); if (drawParameterGrips) { foreach (IGH_Param staticInput in gH_SwitcherComponent.StaticData.StaticInputs) { val2.AddInputGrip(staticInput.Attributes.InputGrip.Y); } foreach (IGH_Param dynamicInput in gH_SwitcherComponent.StaticData.DynamicInputs) { val2.AddInputGrip(dynamicInput.Attributes.InputGrip.Y); } foreach (IGH_Param staticOutput in gH_SwitcherComponent.StaticData.StaticOutputs) { val2.AddOutputGrip(staticOutput.Attributes.OutputGrip.Y); } foreach (IGH_Param dynamicOutput in gH_SwitcherComponent.StaticData.DynamicOutputs) { val2.AddOutputGrip(dynamicOutput.Attributes.OutputGrip.Y); } } graphics.SmoothingMode = SmoothingMode.HighQuality; canvas.SetSmartTextRenderingHint(); if (GH_Attributes <IGH_Component> .IsIconMode(base.Owner.IconDisplayMode)) { if (drawComponentBaseBox) { if (base.Owner.Message != null) { val2.RenderEngine.RenderMessage(graphics, base.Owner.Message, impliedStyle); } val2.Render(graphics, impliedStyle); } if (drawComponentNameBox && base.Owner.Icon_24x24 != null) { if (base.Owner.Locked) { val2.RenderEngine.RenderIcon(graphics, (Image)base.Owner.Icon_24x24_Locked, base.m_innerBounds, 0, 0); } else { val2.RenderEngine.RenderIcon(graphics, (Image)base.Owner.Icon_24x24, base.m_innerBounds, 0, 0); } } } else { if (drawComponentBaseBox) { if (base.Owner.Message != null) { val2.RenderEngine.RenderMessage(graphics, base.Owner.Message, impliedStyle); } val2.Render(graphics, impliedStyle); } if (drawComponentNameBox) { GH_Capsule obj = GH_Capsule.CreateTextCapsule(base.m_innerBounds, base.m_innerBounds, GH_Palette.Black, base.Owner.NickName, StandardFont.largeFont(), GH_Orientation.vertical_center, 3, 6); obj.Render(graphics, this.Selected, base.Owner.Locked, false); obj.Dispose(); } } if (drawComponentNameBox && base.Owner.Obsolete && Grasshopper.CentralSettings.CanvasObsoleteTags && (int)canvas.DrawingMode == 0) { GH_GraphicsUtil.RenderObjectOverlay(graphics, Owner, base.m_innerBounds); } if (drawParameterNames) { RenderComponentParameters2(canvas, graphics, base.Owner, impliedStyle); } if (drawZuiElements) { this.RenderVariableParameterUI(canvas, graphics); } val2.Dispose(); }
protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel) { if (channel == GH_CanvasChannel.Wires) { this.RenderIncomingWires(canvas.Painter, (IEnumerable <IGH_Param>)Owner.Sources, Owner.WireDisplay); } if (channel != GH_CanvasChannel.Objects) { return; } GH_Capsule capsule = GH_Capsule.CreateCapsule(Bounds, GH_Palette.White); GH_Capsule ghCapsule1 = capsule; PointF pointF = OutputGrip; double y1 = (double)pointF.Y; ghCapsule1.AddOutputGrip((float)y1); GH_Capsule ghCapsule2 = capsule; pointF = InputGrip; double y2 = (double)pointF.Y; ghCapsule2.AddInputGrip((float)y2); capsule.Render(canvas.Graphics, Selected, Owner.Locked, Owner.Hidden); capsule.Dispose(); int zoomFadeLow = GH_Canvas.ZoomFadeLow; if (zoomFadeLow > 0) { canvas.SetSmartTextRenderingHint(); GH_PaletteStyle impliedStyle = GH_CapsuleRenderEngine.GetImpliedStyle(GH_Palette.White, (IGH_Attributes)this); Color color = Color.FromArgb(zoomFadeLow, impliedStyle.Text); if (NameBounds.Width > 0.0) { SolidBrush solidBrush = new SolidBrush(color); graphics.DrawString(Owner.NickName, GH_FontServer.Standard, (Brush)solidBrush, NameBounds, GH_TextRenderingConstants.CenterCenter); solidBrush.Dispose(); RectangleF nameBounds = NameBounds; int int32_1 = Convert.ToInt32(nameBounds.Right); nameBounds = NameBounds; int int32_2 = Convert.ToInt32(nameBounds.Top); nameBounds = NameBounds; int int32_3 = Convert.ToInt32(nameBounds.Bottom); GH_GraphicsUtil.EtchFadingVertical(graphics, int32_2, int32_3, int32_1, Convert.ToInt32(0.8 * (double)zoomFadeLow), Convert.ToInt32(0.3 * (double)zoomFadeLow)); } switch (Owner.ListMode) { case GH_ValueListMode.CheckList: RenderCheckList(canvas, graphics, color); break; case GH_ValueListMode.DropDown: RenderDropDown(canvas, graphics, color); break; case GH_ValueListMode.Sequence: case GH_ValueListMode.Cycle: RenderSequence(canvas, graphics, color); break; } } }
public static GH_PaletteStyle GetPaletteStype(ControllableComponent Owner, bool enable, GH_Palette normal, out GH_Palette palette) { palette = Owner.RuntimeMessages(GH_RuntimeMessageLevel.Error).Count > 0 ? GH_Palette.Error : Owner.RuntimeMessages(GH_RuntimeMessageLevel.Warning).Count > 0 ? GH_Palette.Warning : normal; return(GH_CapsuleRenderEngine.GetImpliedStyle(palette, Owner.Attributes.Selected, Owner.Locked || !enable, Owner.Hidden)); }
private void LayoutStyle() { _collection.Palette = GH_CapsuleRenderEngine.GetImpliedPalette(base.Owner); _collection.Style = GH_CapsuleRenderEngine.GetImpliedStyle(_collection.Palette, this.Selected, base.Owner.Locked, base.Owner.Hidden); _collection.Layout(); }