private void UpdateColor() { operatorContent.Background = new SolidColorBrush(UIHelper.ColorFromType(OperatorPart.Type)); operatorContent.Background.Freeze(); NameLabel.Foreground = new SolidColorBrush(UIHelper.BrightColorFromType(OperatorPart.Type)); NameLabel.Foreground.Freeze(); }
internal void UpdateColors() { XOperatorContent.Background = new SolidColorBrush(UIHelper.ColorFromType(Type)) { Opacity = 0.6 }; XOperatorContent.Background.Freeze(); XOperatorLabel.Foreground = new SolidColorBrush(UIHelper.BrightColorFromType(Type)); XOperatorLabel.Foreground.Freeze(); }
private void MouseEnterOutputNoseHandler(object sender, MouseEventArgs e) { int outputIdx = FindIndexOfNoseThumb((Thumb)e.Source); if (outputIdx < 0) { return; } Path nosePath = XOutputThumbGrid.Children.OfType <Path>().ToArray()[outputIdx]; nosePath.Fill = new SolidColorBrush(UIHelper.BrightColorFromType(Operator.Outputs[outputIdx].Type)); nosePath.Fill.Freeze(); }
public InputWidget(OperatorPart opPart) { InitializeComponent(); OperatorPart = opPart; m_MoveHandler = new MoveHandler(this); Height = CompositionGraphView.GRID_SIZE; Width = CompositionGraphView.GRID_SIZE * 3; operatorContent.Background = new SolidColorBrush(UIHelper.ColorFromType(OperatorPart.Type)); operatorContent.Background.Freeze(); NameLabel.Foreground = new SolidColorBrush(UIHelper.BrightColorFromType(OperatorPart.Type)); NameLabel.Foreground.Freeze(); }
public OperatorTypeButton(MetaOperator metaOp, bool namespaceVisible = true) { InitializeComponent(); _namespaceVisible = namespaceVisible; MetaOp = metaOp; var nameBinding = new Binding { UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Source = metaOp, Path = new PropertyPath("Name") }; var combinedBinding = new MultiBinding { Converter = new BindingConverter() }; combinedBinding.Bindings.Add(nameBinding); SetBinding(ContentProperty, combinedBinding); ToolTip = metaOp.Namespace; Click += OperatorButton_ClickHandler; MouseUp += OperatorButton_MouseUpHandler; if (metaOp.Outputs.Count > 0) { Background = new SolidColorBrush(UIHelper.ColorFromType(metaOp.Outputs[0].OpPart.Type)) { Opacity = 0.6 }; Background.Freeze(); Foreground = new SolidColorBrush(UIHelper.BrightColorFromType(metaOp.Outputs[0].OpPart.Type)); Foreground.Freeze(); } }
public void UpdateInputZonesUIFromDescription(IEnumerable <OperatorWidgetInputZone> inputZones) { XInputZoneIndicators.Children.Clear(); foreach (var zone in inputZones) { // Required but missing inputs if (zone.MetaInput.Relevance == MetaInput.RelevanceType.Required && !zone.Input.Connections.Any()) { var inputBg = new Rectangle(); Canvas.SetLeft(inputBg, zone.LeftPosition + 1); Canvas.SetBottom(inputBg, -2); inputBg.Height = 2; inputBg.Width = zone.Width - 1; // don't overlap range separator inputBg.Fill = zone.IsBelowMouse ? new SolidColorBrush(UIHelper.BrightColorFromType(zone.Input.Type)) : new SolidColorBrush(UIHelper.ColorFromType(zone.Input.Type)); inputBg.Fill.Freeze(); XInputZoneIndicators.Children.Add(inputBg); } else if (zone.IsBelowMouse) { var inputBg = new Rectangle(); Canvas.SetLeft(inputBg, zone.LeftPosition + 1); Canvas.SetBottom(inputBg, 1); inputBg.Height = 3; inputBg.Width = zone.Width - 1; // don't overlap range separator inputBg.Fill = zone.IsBelowMouse ? new SolidColorBrush(UIHelper.BrightColorFromType(zone.Input.Type)) : new SolidColorBrush(UIHelper.ColorFromType(zone.Input.Type)); inputBg.Fill.Freeze(); XInputZoneIndicators.Children.Add(inputBg); } } }
private void OnMouseEnterOutputNose(object sender, MouseEventArgs e) { MyOutputNose.Fill = new SolidColorBrush(UIHelper.BrightColorFromType(Type)); MyOutputNose.Fill.Freeze(); }
private void CreateLineGeometry() { //GradientPath = new GradientPath(); //GradientStop s2= new GradientStop(Colors.BrightColorFromType(Source.Type), offset:0.95); //GradientStop s1= new GradientStop(Colors.ColorFromType(Source.Type), offset: 0.8); //GradientPath.GradientStops.Add(s1); //GradientPath.GradientStops.Add(s2); //GradientPath.GradientMode = GradientMode.Parallel; //GradientPath.StrokeThickness = 0.5; //GradientPath.Tolerance= 0.2; //GradientPath.IsHitTestVisible= false; ConnectionPath = new Path(); //ConnectionPath.IsHitTestVisible = false; ConnectionPath.Stroke = new SolidColorBrush(UIHelper.BrightColorFromType(Output.Type)); ConnectionPath.Stroke.Freeze(); ConnectionPath.StrokeThickness = 3; ConnectionPath.StrokeEndLineCap = PenLineCap.Triangle; this.Children.Add(ConnectionPath); ConnectionPath2 = new Path(); //ConnectionPath2.IsHitTestVisible = false; ConnectionPath2.Stroke = new SolidColorBrush(UIHelper.ColorFromType(Output.Type)); ConnectionPath2.Stroke.Freeze(); ConnectionPath2.StrokeThickness = 2.0; ConnectionPath2.StrokeEndLineCap = PenLineCap.Triangle; this.Children.Add(ConnectionPath2); //this.Children.Add(GradientPath); PathGeometry pathGeometry = new PathGeometry(); pathGeometry.FillRule = FillRule.Nonzero; // Spline curve m_PathFigure = new PathFigure(); m_PathFigure.StartPoint = new Point(10, 10); pathGeometry.Figures.Add(m_PathFigure); m_CurveSegment = new BezierSegment(); m_CurveSegment.Point1 = new Point(10, 10); m_CurveSegment.Point2 = new Point(10, 10); m_CurveSegment.Point3 = new Point(10, 10); m_PathFigure.Segments.Add(m_CurveSegment); ConnectionPath.Data = pathGeometry; ConnectionPath2.Data = pathGeometry; //GradientPath.Data = pathGeometry; // ArrowHead m_ArrowHeadPath = new Path(); m_ArrowHeadPath.IsHitTestVisible = false; m_ArrowHeadPath.Stroke = new SolidColorBrush(UIHelper.BrightColorFromType(Output.Type)); m_ArrowHeadPath.Stroke.Freeze(); m_ArrowHeadPath.StrokeThickness = 14; m_ArrowHeadPath.StrokeEndLineCap = PenLineCap.Triangle; this.Children.Add(m_ArrowHeadPath); PathGeometry ArrowHeadPathGeometry = new PathGeometry(); ArrowHeadPathGeometry.FillRule = FillRule.Nonzero; m_ArrowHeadPathFigure = new PathFigure(); m_ArrowHeadPathFigure.StartPoint = new Point(10, 10); ArrowHeadPathGeometry.Figures.Add(m_ArrowHeadPathFigure); m_ArrowHeadLineSegment = new LineSegment(); m_ArrowHeadLineSegment.Point = new Point(10, -10); m_ArrowHeadPathFigure.Segments.Add(m_ArrowHeadLineSegment); m_ArrowHeadPath.Data = ArrowHeadPathGeometry; // Head thumb _thumb = new Thumb(); _thumb.Opacity = 0; this.Children.Add(_thumb); Canvas.SetTop(_thumb, -0.5 * CONNECTION_ARROW_THUMB_SIZE); _thumb.Width = CONNECTION_ARROW_THUMB_SIZE; Canvas.SetLeft(_thumb, -0.5 * CONNECTION_ARROW_THUMB_SIZE); _thumb.Height = CONNECTION_ARROW_THUMB_SIZE; _thumb.Loaded += Thumb_LoadedHandler; this.Unloaded += Thumb_UnloadEventHandler; }