示例#1
0
        /// <summary>
        /// Updates the inspector.
        /// </summary>
        public void UpdateInspector()
        {
            // Set values
            FrameCheckbox.Title    = (SelectedStyle.FrameColor == null) ? "Custom Frame" : $"{SelectedStyle.FrameColor.Name} Frame";
            FrameCheckbox.IntValue = SelectedStyle.HasFrame ? 1 : 0;
            ShowCurrentColor();
            WidthSlider.FloatValue     = SelectedStyle.Frame.StrokeWidth;
            WidthValue.StringValue     = WidthSlider.FloatValue.ToString();
            MiterSlider.FloatValue     = SelectedStyle.Frame.StrokeMiter;
            MiterValue.StringValue     = MiterSlider.FloatValue.ToString();
            AntialiasCheckbox.IntValue = (SelectedStyle.Frame.IsAntialias) ? 1 : 0;
            JitterCheckbox.IntValue    = SelectedStyle.HasFrameJitter ? 1 : 0;
            LengthSlider.FloatValue    = SelectedStyle.FrameJitterLength;
            LengthValue.StringValue    = LengthSlider.IntValue.ToString();
            DeviationSlider.FloatValue = SelectedStyle.FrameJitterDeviation;
            DeviationValue.StringValue = DeviationSlider.IntValue.ToString();
            ShowDashEditor();
            BlurCheckbox.IntValue           = (SelectedStyle.HasFrameBlur) ? 1 : 0;
            HorizontalBlurSlider.FloatValue = SelectedStyle.FrameBlur.HorizontalBlurAmount;
            HorizontalBlurSlider.Enabled    = SelectedStyle.HasFrameBlur;
            HorizontalBlurValue.StringValue = HorizontalBlurSlider.IntValue.ToString();
            VerticalBlurSlider.FloatValue   = SelectedStyle.FrameBlur.VerticalBlurAmount;
            VerticalBlurSlider.Enabled      = SelectedStyle.HasFrameBlur;
            VerticalBlurValue.StringValue   = VerticalBlurSlider.IntValue.ToString();
            ShowCurrentShadowColor();
            HorizontalShadowOffsetSlider.FloatValue = SelectedStyle.FrameShadow.HorizontalOffset;
            HorizontalShadowOffsetValue.StringValue = HorizontalShadowOffsetSlider.IntValue.ToString();
            VerticalShadowOffsetSlider.FloatValue   = SelectedStyle.FrameShadow.VerticalOffset;
            VerticalShadowOffsetValue.StringValue   = VerticalShadowOffsetSlider.IntValue.ToString();
            HorizontalShadowBlurSlider.FloatValue   = SelectedStyle.FrameShadow.HorizontalBlurAmount;
            HorizontalShadowBlurValue.StringValue   = HorizontalShadowBlurSlider.IntValue.ToString();
            VerticalShadowBlurSlider.FloatValue     = SelectedStyle.FrameShadow.VerticalBlurAmount;
            VerticalShadowBlurValue.StringValue     = VerticalShadowBlurSlider.IntValue.ToString();

            // Populate the list of colors
            LinkedColorSelector.RemoveAllItems();
            LinkedColorSelector.AddItem("None");
            var n = 0;

            foreach (KimonoColor color in Portfolio.Colors)
            {
                // Add color
                LinkedColorSelector.AddItem(color.Name);
                ++n;

                // Currently selected color?
                if (SelectedStyle.FrameColor == color)
                {
                    // Yes, highlight it
                    LinkedColorSelector.SelectItem(n);
                }
            }

            // Populate the list of shadow colors
            LinkedShadowColor.RemoveAllItems();
            LinkedShadowColor.AddItem("None");
            n = 0;
            foreach (KimonoColor color in Portfolio.Colors)
            {
                // Add color
                LinkedShadowColor.AddItem(color.Name);
                ++n;

                // Currently selected color?
                if (SelectedStyle.FrameShadow.LinkedColor == color)
                {
                    // Yes, highlight it
                    LinkedShadowColor.SelectItem(n);
                }
            }

            // Populate the list of gradients
            GradientDropdown.RemoveAllItems();
            GradientDropdown.AddItem("None");
            n = 0;
            foreach (KimonoGradient gradient in Portfolio.Gradients)
            {
                // Add gradient
                GradientDropdown.AddItem(gradient.Name);
                ++n;

                // Currently selected gradient?
                if (SelectedStyle.FrameGradient == gradient)
                {
                    // Yes, highlight it
                    GradientDropdown.SelectItem(n);
                }
            }

            // Display blend mode
            switch (SelectedStyle.Frame.BlendMode)
            {
            case SKBlendMode.Clear:
                BlendMode.SelectItem(1);
                break;

            case SKBlendMode.Color:
                BlendMode.SelectItem(2);
                break;

            case SKBlendMode.ColorBurn:
                BlendMode.SelectItem(3);
                break;

            case SKBlendMode.ColorDodge:
                BlendMode.SelectItem(4);
                break;

            case SKBlendMode.Darken:
                BlendMode.SelectItem(5);
                break;

            case SKBlendMode.Difference:
                BlendMode.SelectItem(6);
                break;

            case SKBlendMode.Dst:
                BlendMode.SelectItem(7);
                break;

            case SKBlendMode.DstATop:
                BlendMode.SelectItem(8);
                break;

            case SKBlendMode.DstIn:
                BlendMode.SelectItem(9);
                break;

            case SKBlendMode.DstOut:
                BlendMode.SelectItem(10);
                break;

            case SKBlendMode.DstOver:
                BlendMode.SelectItem(11);
                break;

            case SKBlendMode.Exclusion:
                BlendMode.SelectItem(12);
                break;

            case SKBlendMode.HardLight:
                BlendMode.SelectItem(13);
                break;

            case SKBlendMode.Hue:
                BlendMode.SelectItem(14);
                break;

            case SKBlendMode.Lighten:
                BlendMode.SelectItem(15);
                break;

            case SKBlendMode.Luminosity:
                BlendMode.SelectItem(16);
                break;

            case SKBlendMode.Modulate:
                BlendMode.SelectItem(17);
                break;

            case SKBlendMode.Multiply:
                BlendMode.SelectItem(18);
                break;

            case SKBlendMode.Overlay:
                BlendMode.SelectItem(19);
                break;

            case SKBlendMode.Plus:
                BlendMode.SelectItem(20);
                break;

            case SKBlendMode.Saturation:
                BlendMode.SelectItem(21);
                break;

            case SKBlendMode.Screen:
                BlendMode.SelectItem(22);
                break;

            case SKBlendMode.SoftLight:
                BlendMode.SelectItem(23);
                break;

            case SKBlendMode.Src:
                BlendMode.SelectItem(24);
                break;

            case SKBlendMode.SrcATop:
                BlendMode.SelectItem(25);
                break;

            case SKBlendMode.SrcIn:
                BlendMode.SelectItem(26);
                break;

            case SKBlendMode.SrcOut:
                BlendMode.SelectItem(27);
                break;

            case SKBlendMode.SrcOver:
                BlendMode.SelectItem(0);
                break;

            case SKBlendMode.Xor:
                BlendMode.SelectItem(28);
                break;
            }

            // Display join type
            switch (SelectedStyle.Frame.StrokeJoin)
            {
            case SKStrokeJoin.Bevel:
                JoinType.SelectItem(0);
                break;

            case SKStrokeJoin.Miter:
                JoinType.SelectItem(1);
                break;

            case SKStrokeJoin.Round:
                JoinType.SelectItem(2);
                break;
            }

            // Display end cap type
            switch (SelectedStyle.Frame.StrokeCap)
            {
            case SKStrokeCap.Butt:
                EndCap.SelectItem(0);
                break;

            case SKStrokeCap.Round:
                EndCap.SelectItem(1);
                break;

            case SKStrokeCap.Square:
                EndCap.SelectItem(2);
                break;
            }

            // Update GUI
            FrameColor.Enabled      = (SelectedStyle.HasFrame && SelectedStyle.FrameColor == null);
            OpacitySlider.Enabled   = (SelectedStyle.HasFrame && SelectedStyle.FrameColor == null);
            OpacityValue.Enabled    = (SelectedStyle.HasFrame && SelectedStyle.FrameColor == null);
            BlendMode.Enabled       = SelectedStyle.HasFrame;
            WidthSlider.Enabled     = SelectedStyle.HasFrame;
            WidthValue.Enabled      = SelectedStyle.HasFrame;
            MiterSlider.Enabled     = SelectedStyle.HasFrame;
            MiterValue.Enabled      = SelectedStyle.HasFrame;
            JoinType.Enabled        = SelectedStyle.HasFrame;
            EndCap.Enabled          = SelectedStyle.HasFrame;
            LengthSlider.Enabled    = SelectedStyle.HasFrameJitter;
            DeviationSlider.Enabled = SelectedStyle.HasFrameJitter;
        }