Example #1
0
 /// <summary>
 /// Raises the property modified event.
 /// </summary>
 /// <param name="property">The `KimonoProperty` that was modified.</param>
 internal void RaisePropertyModified(KimonoProperty property)
 {
     // Inform caller of event
     if (PropertyModified != null)
     {
         PropertyModified(property);
     }
 }
Example #2
0
        /// <summary>
        /// Makes the connection between a given connection point and a property.
        /// </summary>
        /// <param name="point">The `KimonoPropertyConnectionPoint` to connect to.</param>
        /// <param name="property">The `KimonoProperty` to connect to the point.</param>
        private void MakeConnection(KimonoPropertyConnectionPoint point, KimonoProperty property)
        {
            var connection = FindConnection(point);

            // Found?
            if (connection == null)
            {
                // No, build new connection
                PropertyConsumer.PropertyConnections.Add(new KimonoPropertyConnection(point, property));
            }
            else
            {
                // Yes, update existing connection
                connection.ConnectedProperty = property;
            }
        }
Example #3
0
        /// <summary>
        /// Updates the available properties list.
        /// </summary>
        /// <param name="point">The connection point to update the list for.</param>
        private void UpdateAvailableProperties(KimonoPropertyConnectionPoint point)
        {
            // Empty property list
            AvailableProperties.Clear();
            PropertyDropdown.RemoveAllItems();
            PropertyDropdown.AddItem("None");

            // Find existing connection
            KimonoProperty connectedProperty = null;
            var            connection        = FindConnection(point);

            // Connected?
            if (connection != null)
            {
                // Yes, get connected property
                connectedProperty = connection.ConnectedProperty;
            }

            // Scan available properties to see if any are valid for the current point
            var n = 0;

            foreach (KimonoProperty property in DesignSurface.Portfolio.Properties)
            {
                // Take action based on the connection point type
                switch (point)
                {
                case KimonoPropertyConnectionPoint.AdjustsAlpha:
                case KimonoPropertyConnectionPoint.AdjustsBrightness:
                case KimonoPropertyConnectionPoint.AdjustsHue:
                case KimonoPropertyConnectionPoint.AdjustsSaturation:
                case KimonoPropertyConnectionPoint.HasFill:
                case KimonoPropertyConnectionPoint.HasEndHead:
                case KimonoPropertyConnectionPoint.HasFillBlur:
                case KimonoPropertyConnectionPoint.HasFillJitter:
                case KimonoPropertyConnectionPoint.HasFillShadow:
                case KimonoPropertyConnectionPoint.HasFrame:
                case KimonoPropertyConnectionPoint.HasFrameBlur:
                case KimonoPropertyConnectionPoint.HasFrameDash:
                case KimonoPropertyConnectionPoint.HasFrameJitter:
                case KimonoPropertyConnectionPoint.HasFrameShadow:
                case KimonoPropertyConnectionPoint.HasStartHead:
                case KimonoPropertyConnectionPoint.IsStreamlined:
                case KimonoPropertyConnectionPoint.IsVerticalText:
                case KimonoPropertyConnectionPoint.StrikeThruText:
                case KimonoPropertyConnectionPoint.UnderlineText:
                case KimonoPropertyConnectionPoint.Visible:
                    // Is boolean property?
                    if (property is KimonoPropertyBoolean)
                    {
                        // Yes, add it to list
                        AvailableProperties.Add(property);
                        PropertyDropdown.AddItem(property.Name);
                        ++n;
                    }
                    break;

                case KimonoPropertyConnectionPoint.AlphaAdjustment:
                case KimonoPropertyConnectionPoint.Bottom:
                case KimonoPropertyConnectionPoint.BrightnessAdjustment:
                case KimonoPropertyConnectionPoint.CornerRadius:
                case KimonoPropertyConnectionPoint.DepthOffset:
                case KimonoPropertyConnectionPoint.FillHorizontalBlurAmount:
                case KimonoPropertyConnectionPoint.FillJitterDeviation:
                case KimonoPropertyConnectionPoint.FillJitterLength:
                case KimonoPropertyConnectionPoint.FillShadowHorizontalBlurAmount:
                case KimonoPropertyConnectionPoint.FillShadowHorizontalOffset:
                case KimonoPropertyConnectionPoint.FillShadowVerticalBlurAmount:
                case KimonoPropertyConnectionPoint.FillShadowVerticalOffset:
                case KimonoPropertyConnectionPoint.FillVerticalBlurAmount:
                case KimonoPropertyConnectionPoint.FrameHorizontalBlurAmount:
                case KimonoPropertyConnectionPoint.FrameJitterDeviation:
                case KimonoPropertyConnectionPoint.FrameJitterLength:
                case KimonoPropertyConnectionPoint.FrameShadowHorizontalBlurAmount:
                case KimonoPropertyConnectionPoint.FrameShadowHorizontalOffset:
                case KimonoPropertyConnectionPoint.FrameShadowVerticalBlurAmount:
                case KimonoPropertyConnectionPoint.FrameShadowVerticalOffset:
                case KimonoPropertyConnectionPoint.FrameVerticalBlurAmount:
                case KimonoPropertyConnectionPoint.HeadInnerRatio:
                case KimonoPropertyConnectionPoint.HeadOuterRatio:
                case KimonoPropertyConnectionPoint.Height:
                case KimonoPropertyConnectionPoint.HueAdjustment:
                case KimonoPropertyConnectionPoint.Left:
                case KimonoPropertyConnectionPoint.NumberOfPoints:
                case KimonoPropertyConnectionPoint.NumberOfSides:
                case KimonoPropertyConnectionPoint.Right:
                case KimonoPropertyConnectionPoint.RotationDegrees:
                case KimonoPropertyConnectionPoint.SaturationAdjustment:
                case KimonoPropertyConnectionPoint.SkipPoints:
                case KimonoPropertyConnectionPoint.TextScaleX:
                case KimonoPropertyConnectionPoint.TextSize:
                case KimonoPropertyConnectionPoint.TextSkewX:
                case KimonoPropertyConnectionPoint.Top:
                case KimonoPropertyConnectionPoint.Width:
                    // Is number property?
                    if (property is KimonoPropertyNumber)
                    {
                        // Yes, add it to list
                        AvailableProperties.Add(property);
                        PropertyDropdown.AddItem(property.Name);
                        ++n;
                    }
                    break;

                case KimonoPropertyConnectionPoint.BaseColor:
                case KimonoPropertyConnectionPoint.FillColor:
                case KimonoPropertyConnectionPoint.FillShadowLinkedColor:
                case KimonoPropertyConnectionPoint.FrameColor:
                case KimonoPropertyConnectionPoint.FrameShadowLinkedColor:
                    // Is color property?
                    if (property is KimonoPropertyColor)
                    {
                        // Yes, add it to list
                        AvailableProperties.Add(property);
                        PropertyDropdown.AddItem(property.Name);
                        ++n;
                    }
                    break;

                case KimonoPropertyConnectionPoint.FillGradient:
                case KimonoPropertyConnectionPoint.FrameGradient:
                    // Is gradient property?
                    if (property is KimonoPropertyGradient)
                    {
                        // Yes, add it to list
                        AvailableProperties.Add(property);
                        PropertyDropdown.AddItem(property.Name);
                        ++n;
                    }
                    break;

                case KimonoPropertyConnectionPoint.FontFamilyName:
                case KimonoPropertyConnectionPoint.Text:
                    // Is text property?
                    if (property is KimonoPropertyText)
                    {
                        // Yes, add it to list
                        AvailableProperties.Add(property);
                        PropertyDropdown.AddItem(property.Name);
                        ++n;
                    }
                    break;

                case KimonoPropertyConnectionPoint.Rect:
                    // Is rectangle property?
                    if (property is KimonoPropertyRect)
                    {
                        // Yes, add it to list
                        AvailableProperties.Add(property);
                        PropertyDropdown.AddItem(property.Name);
                        ++n;
                    }
                    break;

                case KimonoPropertyConnectionPoint.Style:
                    // Is style property?
                    if (property is KimonoPropertyStyle)
                    {
                        // Yes, add it to list
                        AvailableProperties.Add(property);
                        PropertyDropdown.AddItem(property.Name);
                        ++n;
                    }
                    break;
                }

                // Is this the connected property?
                if (property == connectedProperty)
                {
                    // Yes, select it in the list
                    PropertyDropdown.SelectItem(n);
                }
            }

            // Update UI
            PropertyDropdown.Enabled = (AvailableProperties.Count > 0);
        }