public void Build(Selection selection) { // check visibility Visible = selection.ForAll(f => RendererDecorator.ContainsType(f.Renderer, typeof(ShadowRendererDecorator))); if (!Visible) { return; // do not build anything } // remember editing object _selection = selection; // get list of objects var shadowStyles = _selection.Select(f => (ShadowRendererDecorator)RendererDecorator.GetDecorator(f.Renderer, typeof(ShadowRendererDecorator))).ToList(); // copy properties of object to GUI _updating++; nudOpacity.Value = shadowStyles.GetProperty(f => (decimal)f.Opacity); nudOffsetX.Value = shadowStyles.GetProperty(f => (decimal)f.Offset.X); nudOffsetY.Value = shadowStyles.GetProperty(f => (decimal)f.Offset.Y); lbColor.BackColor = shadowStyles.GetProperty(f => f.Color, Color.Black); _updating--; }
/// <summary> /// Перемещение точки искажения /// </summary> /// <param name="owner">Фигура</param> /// <param name="index">Индекс точки искажения</param> /// <param name="newPosition">Смещение</param> public void MoveWarpNode(Figure owner, int index, PointF newPosition) { var warped = (WarpRendererDecorator)RendererDecorator.GetDecorator(owner.Renderer, typeof(WarpRendererDecorator)); if (warped == null) { return; // работаем только с градиентами } //get points in world coordinates var points = warped.GetWarpPoints(owner); //move point points[index] = newPosition; //push warped.SetWarpPoints(owner, points); }
private void UpdateObject() { if (_updating > 0) { return; // we are in updating mode } // fire event StartChanging(this, new ChangingEventArgs("Glow Fill Style")); // get list of objects var glowStyles = _selection.Select(f => (GlowRenderer)RendererDecorator.GetDecorator(f.Renderer, typeof(GlowRenderer))).ToList(); // send values back from GUI to object glowStyles.SetProperty(f => f.Color = lbColor.BackColor); // fire event Changed(this, EventArgs.Empty); }
public void Build(Selection selection) { // check visibility Visible = selection.ForAll(f => RendererDecorator.GetBaseRenderer(f.Renderer) is ITextBlock || RendererDecorator.GetDecorator(f.Renderer, typeof(TextBlockDecorator)) is ITextBlock); if (!Visible) { return; // do not build anything } // remember editing object _selection = selection; var textBlockStyles = from figure in _selection where RendererDecorator.GetBaseRenderer(figure.Renderer) is ITextBlock || RendererDecorator.GetDecorator(figure.Renderer, typeof(TextBlockDecorator)) is ITextBlock let decorator = RendererDecorator.GetBaseRenderer(figure.Renderer) is ITextBlock? RendererDecorator.GetBaseRenderer(figure.Renderer) as ITextBlock: RendererDecorator.GetDecorator(figure.Renderer, typeof(TextBlockDecorator)) as ITextBlock select decorator; var isBezierText = selection.ForAll(f => RendererDecorator.GetBaseRenderer(f.Renderer) is BezierTextRenderer); _updating++; cbFontName.Text = textBlockStyles.GetProperty(f => f.FontName); cbFontSize.Text = textBlockStyles.GetProperty(f => f.FontSize.ToString("0")); _fontStyle = textBlockStyles.GetProperty(f => f.FontStyle); lbText.Text = textBlockStyles.GetProperty(f => f.Text); lbText.TextAlign = textBlockStyles.GetProperty(f => f.Alignment); nudLeft.Value = textBlockStyles.GetProperty(f => f.Padding.Left); nudTop.Value = textBlockStyles.GetProperty(f => f.Padding.Top); nudRight.Value = textBlockStyles.GetProperty(f => f.Padding.Right); nudBottom.Value = textBlockStyles.GetProperty(f => f.Padding.Bottom); cbWrap.Checked = textBlockStyles.GetProperty(f => f.WordWrap); cbWrap.Enabled = nudLeft.Enabled = nudTop.Enabled = nudRight.Enabled = nudBottom.Enabled = btnTopLeftAllign.Enabled = btnMiddleLeftAllign.Enabled = btnBottomLeftAllign.Enabled = btnTopRightAllign.Enabled = btnMiddleRightAllign.Enabled = btnBottomRightAllign.Enabled = !isBezierText; _updating--; }
public void Build(Selection selection) { // check visibility Visible = selection.ForAll(f => RendererDecorator.ContainsType(f.Renderer, typeof(GlowRenderer))); if (!Visible) { return; // do not build anything } // remember editing object _selection = selection; // get list of objects var glowStyles = _selection.Select(f => (GlowRenderer)RendererDecorator.GetDecorator(f.Renderer, typeof(GlowRenderer))).ToList(); // copy properties of object to GUI _updating++; lbColor.BackColor = glowStyles.GetProperty(f => f.Color); _updating--; }
private void UpdateObject() { if (_updating > 0) { return; // we are in updating mode } // fire event StartChanging(this, new ChangingEventArgs("Shadow Fill Style")); // get list of objects var shadowStyles = _selection.Select(f => (ShadowRendererDecorator)RendererDecorator.GetDecorator(f.Renderer, typeof(ShadowRendererDecorator))).ToList(); // send values back from GUI to object shadowStyles.SetProperty(f => f.Opacity = (int)nudOpacity.Value); shadowStyles.SetProperty(f => f.Offset = new PointF((float)nudOffsetX.Value, f.Offset.Y)); shadowStyles.SetProperty(f => f.Offset = new PointF(f.Offset.X, (float)nudOffsetY.Value)); shadowStyles.SetProperty(f => f.Color = lbColor.BackColor); // fire event Changed(this, EventArgs.Empty); }
private void UpdateObject() { if (_updating > 0) { return; // we are in updating mode } // fire event StartChanging(this, new ChangingEventArgs("Arrow Style")); // get list of objects var arrowStyles = _selection.Select(f => (ArrowRendererDecorator)RendererDecorator.GetDecorator(f.Renderer, typeof(ArrowRendererDecorator))).ToList(); // send values back from GUI to object arrowStyles.SetProperty(f => f.OtherColor = lbColor.BackColor); arrowStyles.SetProperty(f => f.IsOtherColorFilled = cbColor.Checked); _arrowPosition = (ArrowPosition)cbPosition.SelectedIndex; arrowStyles.SetProperty(f => f.ArrowPosition = _arrowPosition); // fire event Changed(this, EventArgs.Empty); }
private void UpdateObject() { if (_updating > 0) { return; // we are in updating mode } // fire event StartChanging(this, new ChangingEventArgs("Text Block Style")); // get list of objects var textBlockStyles = from figure in _selection where RendererDecorator.GetBaseRenderer(figure.Renderer) is ITextBlock || RendererDecorator.GetDecorator(figure.Renderer, typeof(TextBlockDecorator)) is ITextBlock let decorator = RendererDecorator.GetBaseRenderer(figure.Renderer) is ITextBlock? RendererDecorator.GetBaseRenderer(figure.Renderer) as ITextBlock: RendererDecorator.GetDecorator(figure.Renderer, typeof(TextBlockDecorator)) as ITextBlock select decorator; // send values back from GUI to object textBlockStyles.SetProperty(f => f.FontName = cbFontName.Text); float fontSize; if (float.TryParse(cbFontSize.Text, out fontSize)) { textBlockStyles.SetProperty(f => f.FontSize = fontSize); } textBlockStyles.SetProperty(f => f.FontStyle = _fontStyle); textBlockStyles.SetProperty(f => f.Text = lbText.Text); textBlockStyles.SetProperty(f => f.Alignment = lbText.TextAlign); var padding = new Padding((int)nudLeft.Value, (int)nudTop.Value, (int)nudRight.Value, (int)nudBottom.Value); textBlockStyles.SetProperty(f => f.Padding = padding); textBlockStyles.SetProperty(f => f.WordWrap = cbWrap.Checked); // fire event Changed(this, EventArgs.Empty); }
public void Build(Selection selection) { // check visibility Visible = selection.ForAll(f => RendererDecorator.ContainsType(f.Renderer, typeof(ArrowRendererDecorator))); if (!Visible) { return; // do not build anything } // remember editing object _selection = selection; // get list of objects var arrowStyles = _selection.Select(f => (ArrowRendererDecorator)RendererDecorator.GetDecorator(f.Renderer, typeof(ArrowRendererDecorator))).ToList(); // copy properties of object to GUI _updating++; cbColor.Checked = arrowStyles.GetProperty(f => f.IsOtherColorFilled); lbColor.BackColor = arrowStyles.GetProperty(f => f.OtherColor, Color.White); cbPosition.SelectedIndex = (int)arrowStyles.GetProperty(f => f.ArrowPosition, _arrowPosition); _updating--; }