/// <summary>
        /// Initialize this instance.
        /// </summary>
        public void Initialize()
        {
            // Wire-up events
            GradientName.EditingEnded += (sender, e) =>
            {
                // Save undo point
                DesignSurface.SaveUndoPoint();

                // Save and validate
                SelectedGradient.Name = GradientName.StringValue;
                DesignSurface.Portfolio.EnsureGradientNameIsValid(SelectedGradient);

                // Update UI
                GradientName.StringValue = SelectedGradient.Name;
                RaiseGradientModified(SelectedGradient);
            };

            DesignBar.HandleSelected += (handle) =>
            {
                // Update color information
                ShowCurrentColor();
            };

            DesignPreview.GradientModified += () =>
            {
                // Update shape
                RaiseShapeModified();
            };
        }
Exemplo n.º 2
0
 /// <summary>
 /// Handles the skip points number changing.
 /// </summary>
 /// <param name="sender">Sender.</param>
 partial void SkipChanged(Foundation.NSObject sender)
 {
     DesignSurface.SaveUndoPoint();
     SelectedShape.SkipPoints = SkipSlider.IntValue;
     SkipValue.StringValue    = SkipSlider.IntValue.ToString();
     RaiseShapeModified();
 }
Exemplo n.º 3
0
        /// <summary>
        /// Handles the font weight changing.
        /// </summary>
        /// <param name="sender">Sender.</param>
        partial void WeightChanged(Foundation.NSObject sender)
        {
            // Save undo point
            DesignSurface.SaveUndoPoint();

            // Set new value
            switch (WeightDropdown.IndexOfSelectedItem)
            {
            case 0:
                SelectedStyle.TypefaceStyle = SKTypefaceStyle.Normal;
                break;

            case 1:
                SelectedStyle.TypefaceStyle = SKTypefaceStyle.Bold;
                break;

            case 2:
                SelectedStyle.TypefaceStyle = SKTypefaceStyle.BoldItalic;
                break;

            case 3:
                SelectedStyle.TypefaceStyle = SKTypefaceStyle.Italic;
                break;
            }
            RaiseShapeModified();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Does the canvas include a colored background?
        /// </summary>
        /// <param name="sender">Sender.</param>
        partial void HasCanvasColorChanged(Foundation.NSObject sender)
        {
            // Save undo point
            DesignSurface.SaveUndoPoint();

            SelectedSketch.DrawCanvas = (CanvasColorCheckbox.IntValue == 1);
        }
        /// <summary>
        /// Handles the tile mode changing.
        /// </summary>
        /// <param name="sender">Sender.</param>
        partial void TileChanged(Foundation.NSObject sender)
        {
            // Save undo point
            DesignSurface.SaveUndoPoint();

            // Take action based on the selected type
            switch (TileDropdown.IndexOfSelectedItem)
            {
            case 0:
                SelectedGradient.TileMode = SKShaderTileMode.Clamp;
                break;

            case 1:
                SelectedGradient.TileMode = SKShaderTileMode.Repeat;
                break;

            case 2:
                SelectedGradient.TileMode = SKShaderTileMode.Mirror;
                break;
            }

            // Update UI
            RaiseGradientModified(SelectedGradient);
            RaiseShapeModified();
        }
Exemplo n.º 6
0
 /// <summary>
 /// Handles the rotation being changed.
 /// </summary>
 /// <param name="sender">Sender.</param>
 partial void RotationChanged(Foundation.NSObject sender)
 {
     DesignSurface.SaveUndoPoint();
     SelectedShape.RotationDegrees = RotationSlider.IntValue;
     RotationValue.StringValue     = RotationSlider.IntValue.ToString();
     RaiseShapeModified();
 }
 /// <summary>
 /// Handles the number of sides changing.
 /// </summary>
 /// <param name="sender">Sender.</param>
 partial void SidesChanged(Foundation.NSObject sender)
 {
     DesignSurface.SaveUndoPoint();
     SelectedShape.NumberOfSides = SidesSlider.IntValue;
     SidesValue.StringValue      = SidesSlider.IntValue.ToString();
     RaiseShapeModified();
 }
Exemplo n.º 8
0
        /// <summary>
        /// Duplicates the point.
        /// </summary>
        /// <param name="sender">Sender.</param>
        partial void DuplicatePoint(Foundation.NSObject sender)
        {
            var pointCount = 0;

            // Save undo point
            DesignSurface.SaveUndoPoint();

            // Take action based on shape type
            if (SelectedShape is KimonoShapeVector)
            {
                var vector = SelectedShape as KimonoShapeVector;
                vector.DuplicateSelectedPoint();
                pointCount = vector.Points.Count;
            }
            else if (SelectedShape is KimonoShapeBezier)
            {
                var bezier = SelectedShape as KimonoShapeBezier;
                bezier.DuplicateSelectedPoint();
                pointCount = bezier.Points.Count;
            }

            // Update UI
            DuplicateButton.Enabled = (SelectedShape.State == KimonoShapeState.Editing && SelectedShape.HitHandle != null);
            DeleteButton.Enabled    = (DuplicateButton.Enabled && pointCount > 3);
            RaiseShapeModified();
        }
Exemplo n.º 9
0
        /// <summary>
        /// Handles the boolean operation changing.
        /// </summary>
        /// <param name="sender">Sender.</param>
        partial void OperationChanged(Foundation.NSObject sender)
        {
            // Save undo point
            DesignSurface.SaveUndoPoint();

            // Save new value
            switch (Operation.IndexOfSelectedItem)
            {
            case 0:
                SelectedGroup.BooleanOperation = SKPathOp.Union;
                break;

            case 1:
                SelectedGroup.BooleanOperation = SKPathOp.Intersect;
                break;

            case 2:
                SelectedGroup.BooleanOperation = SKPathOp.Difference;
                break;

            case 3:
                SelectedGroup.BooleanOperation = SKPathOp.ReverseDifference;
                break;

            case 4:
                SelectedGroup.BooleanOperation = SKPathOp.Xor;
                break;
            }

            // Update UI
            RaiseGroupModified(SelectedGroup);
        }
Exemplo n.º 10
0
 /// <summary>
 /// Handles the point depth value chainging.
 /// </summary>
 /// <param name="sender">Sender.</param>
 partial void DepthChanged(Foundation.NSObject sender)
 {
     DesignSurface.SaveUndoPoint();
     SelectedShape.DepthOffset = DepthSlider.IntValue;
     DepthValue.StringValue    = DepthSlider.IntValue.ToString();
     RaiseShapeModified();
 }
        /// <summary>
        /// Handles the gradient's type changing.
        /// </summary>
        /// <param name="sender">Sender.</param>
        partial void TypeChanged(Foundation.NSObject sender)
        {
            // Save undo point
            DesignSurface.SaveUndoPoint();

            // Take action based on the selected type
            switch (TypeDropdown.IndexOfSelectedItem)
            {
            case 0:
                SelectedGradient.GradientType = KimonoGradientType.LinearGradient;
                break;

            case 1:
                SelectedGradient.GradientType = KimonoGradientType.RadialGradient;
                break;

            case 2:
                SelectedGradient.GradientType = KimonoGradientType.SweepGradient;
                break;

            case 3:
                SelectedGradient.GradientType = KimonoGradientType.ConicalGradient;
                break;
            }

            // Update UI
            TileDropdown.Enabled = (SelectedGradient.GradientType != KimonoGradientType.SweepGradient);
            RadiusSlider.Enabled = (SelectedGradient.GradientType == KimonoGradientType.RadialGradient ||
                                    SelectedGradient.GradientType == KimonoGradientType.ConicalGradient);
            RaiseGradientModified(SelectedGradient);
            RaiseShapeModified();
        }
Exemplo n.º 12
0
        /// <summary>
        /// Handles the streamline value changing.
        /// </summary>
        /// <param name="sender">Sender.</param>
        partial void StreamlinedChanged(Foundation.NSObject sender)
        {
            // Save undo point
            DesignSurface.SaveUndoPoint();

            SelectedShape.IsStreamlined = (StreamlinedCheckbox.IntValue == 1);
            RaiseShapeModified();
        }
Exemplo n.º 13
0
        /// <summary>
        /// Handles the vertical text changing.
        /// </summary>
        /// <param name="sender">Sender.</param>
        partial void VerticalChanged(Foundation.NSObject sender)
        {
            // Save undo point
            DesignSurface.SaveUndoPoint();

            SelectedStyle.IsVerticalText = (VerticalCheckbox.IntValue == 1);
            RaiseShapeModified();
        }
Exemplo n.º 14
0
        /// <summary>
        /// Handles the has tail value changing.
        /// </summary>
        /// <param name="sender">Sender.</param>
        partial void TailChanged(Foundation.NSObject sender)
        {
            // Save undo point
            DesignSurface.SaveUndoPoint();

            SelectedShape.HasEndHead = (TailCheckbox.IntValue == 1);
            RaiseShapeModified();
        }
Exemplo n.º 15
0
        /// <summary>
        /// Handles the antialias changing.
        /// </summary>
        /// <param name="sender">Sender.</param>
        partial void AntialiasChanged(Foundation.NSObject sender)
        {
            // Save undo point
            DesignSurface.SaveUndoPoint();

            SelectedStyle.Frame.IsAntialias = (AntialiasCheckbox.IntValue == 1);
            RaiseShapeModified();
        }
        /// <summary>
        /// Duplicates the property.
        /// </summary>
        /// <param name="sender">Sender.</param>
        partial void DuplicateProperty(Foundation.NSObject sender)
        {
            // Save undo point
            DesignSurface.SaveUndoPoint();

            // Update the UI
            RaiseRequestDuplicateProperty();
        }
Exemplo n.º 17
0
        /// <summary>
        /// Handles the jitter deviation changing.
        /// </summary>
        /// <param name="sender">Sender.</param>
        partial void DeviationChanged(Foundation.NSObject sender)
        {
            // Save undo point
            DesignSurface.SaveUndoPoint();

            SelectedStyle.FrameJitterDeviation = DeviationSlider.FloatValue;
            DeviationValue.StringValue         = DeviationSlider.IntValue.ToString();
            RaiseShapeModified();
        }
Exemplo n.º 18
0
        /// <summary>
        /// Handles the jitter lenght changing.
        /// </summary>
        /// <param name="sender">Sender.</param>
        partial void LengthChanged(Foundation.NSObject sender)
        {
            // Save undo point
            DesignSurface.SaveUndoPoint();

            SelectedStyle.FrameJitterLength = LengthSlider.FloatValue;
            LengthValue.StringValue         = LengthSlider.IntValue.ToString();
            RaiseShapeModified();
        }
Exemplo n.º 19
0
        /// <summary>
        /// Handles the size changing.
        /// </summary>
        /// <param name="sender">Sender.</param>
        partial void SizeChanged(Foundation.NSObject sender)
        {
            // Save undo point
            DesignSurface.SaveUndoPoint();

            // Save changes
            SelectedStyle.TextSize = Size.FloatValue;
            RaiseShapeModified();
        }
Exemplo n.º 20
0
        /// <summary>
        /// Handles the skew changing.
        /// </summary>
        /// <param name="sender">Sender.</param>
        partial void SkewChanged(Foundation.NSObject sender)
        {
            // Save undo point
            DesignSurface.SaveUndoPoint();

            SelectedStyle.TextSkewX = SkewSlider.FloatValue;
            SkewValue.StringValue   = SkewSlider.FloatValue.ToString();
            RaiseShapeModified();
        }
Exemplo n.º 21
0
        /// <summary>
        /// Adjusts the saturation changed.
        /// </summary>
        /// <param name="sender">Sender.</param>
        partial void AdjustSaturationChanged(Foundation.NSObject sender)
        {
            // Save undo point
            DesignSurface.SaveUndoPoint();

            SelectedColor.AdjustsSaturation = (AdjustSaturationCheckbox.IntValue == 1);
            SetColorValues();
            RaiseColorModified(SelectedColor);
        }
Exemplo n.º 22
0
        /// <summary>
        /// Handles the opacity changing.
        /// </summary>
        /// <param name="sender">Sender.</param>
        partial void OpacityChanged(Foundation.NSObject sender)
        {
            // Save undo point
            DesignSurface.SaveUndoPoint();

            SelectedColor.AlphaAdjustment = OpacitySlider.IntValue;
            SetColorValues();
            RaiseColorModified(SelectedColor);
        }
Exemplo n.º 23
0
        /// <summary>
        /// Handles the saturation changing.
        /// </summary>
        /// <param name="sender">Sender.</param>
        partial void SaturationChanged(Foundation.NSObject sender)
        {
            // Save undo point
            DesignSurface.SaveUndoPoint();

            SelectedColor.SaturationAdjustment = SaturationSlider.FloatValue;
            SetColorValues();
            RaiseColorModified(SelectedColor);
        }
Exemplo n.º 24
0
        /// <summary>
        /// Handles the Miter changing.
        /// </summary>
        /// <param name="sender">Sender.</param>
        partial void MiterChanged(Foundation.NSObject sender)
        {
            // Save undo point
            DesignSurface.SaveUndoPoint();

            SelectedStyle.Frame.StrokeMiter = MiterSlider.FloatValue;
            MiterValue.StringValue          = MiterSlider.FloatValue.ToString();
            RaiseShapeModified();
        }
Exemplo n.º 25
0
        /// <summary>
        /// Handles the inner value changing.
        /// </summary>
        /// <param name="sender">Sender.</param>
        partial void InnerChanged(Foundation.NSObject sender)
        {
            // Save undo point
            DesignSurface.SaveUndoPoint();

            SelectedShape.HeadInnerRatio = InnerSlider.FloatValue;
            InnerValue.StringValue       = InnerSlider.FloatValue.ToString();
            RaiseShapeModified();
        }
Exemplo n.º 26
0
        /// <summary>
        /// Handles the typeface changing.
        /// </summary>
        /// <param name="sender">Sender.</param>
        partial void TypefaceChanged(Foundation.NSObject sender)
        {
            // Save undo point
            DesignSurface.SaveUndoPoint();

            // Save changes
            SelectedStyle.FontFamilyName = TypefaceDropdown.SelectedItem.Title;
            RaiseShapeModified();
        }
Exemplo n.º 27
0
        /// <summary>
        /// Handles a dash point changing.
        /// </summary>
        /// <param name="sender">Sender.</param>
        partial void DashChanged(Foundation.NSObject sender)
        {
            // Save undo point
            DesignSurface.SaveUndoPoint();

            SelectedStyle.HasFrameDash = (DashCheckbox.IntValue == 1);
            ShowDashEditor();
            RaiseShapeModified();
        }
Exemplo n.º 28
0
        /// <summary>
        /// Handles the jitter effect changing.
        /// </summary>
        /// <param name="sender">Sender.</param>
        partial void JitterChanged(Foundation.NSObject sender)
        {
            // Save undo point
            DesignSurface.SaveUndoPoint();

            SelectedStyle.HasFrameJitter = (JitterCheckbox.IntValue == 1);
            LengthSlider.Enabled         = SelectedStyle.HasFrameJitter;
            DeviationSlider.Enabled      = SelectedStyle.HasFrameJitter;
            RaiseShapeModified();
        }
Exemplo n.º 29
0
        /// <summary>
        /// Handles a dash point changing.
        /// </summary>
        /// <param name="sender">Sender.</param>
        partial void Dash16Changed(Foundation.NSObject sender)
        {
            // Save undo point
            DesignSurface.SaveUndoPoint();

            SelectedStyle.DashPattern[15] = !SelectedStyle.DashPattern[15];
            SelectedStyle.ApplyFrameEffects();
            ShowDashEditor();
            RaiseShapeModified();
        }
Exemplo n.º 30
0
        /// <summary>
        /// Handles the mask changing.
        /// </summary>
        /// <param name="sender">Sender.</param>
        partial void MaskChanged(Foundation.NSObject sender)
        {
            // Save undo point
            DesignSurface.SaveUndoPoint();

            // Save the new value
            SelectedGroup.IsMaskedGroup = (MaskCheckbox.IntValue == 1);

            // Update UI
            RaiseGroupModified(SelectedGroup);
        }