Beispiel #1
0
        void HandleDrawableChangedEvent(IEnumerable <IBlackboardObject> drawables)
        {
            selectedDrawable      = (drawables == null || drawables.Count() > 1) ? null : drawables.FirstOrDefault() as Drawable;
            colorbutton.Sensitive = !(selectedDrawable is Text);

            ignoreChanges = true;
            if (selectedDrawable == null)
            {
                colorbutton.Color           = Misc.ToGdkColor(blackboard.Color);
                colorbutton.Alpha           = Color.ByteToUShort(blackboard.Color.A);
                textcolorbutton.Color       = Misc.ToGdkColor(blackboard.TextColor);
                backgroundcolorbutton.Color = Misc.ToGdkColor(blackboard.TextBackgroundColor);
                backgroundcolorbutton.Alpha = Color.ByteToUShort(blackboard.TextBackgroundColor.A);
                linesizespinbutton.Value    = OriginalSize(blackboard.LineWidth);
                if (blackboard.LineStyle == LineStyle.Normal)
                {
                    stylecombobox.Active = 0;
                }
                else
                {
                    stylecombobox.Active = 1;
                }
                typecombobox.Active = (int)blackboard.LineType;
            }
            else
            {
                if (selectedDrawable is Text)
                {
                    textcolorbutton.Color       = Misc.ToGdkColor((selectedDrawable as Text).TextColor);
                    backgroundcolorbutton.Color = Misc.ToGdkColor(selectedDrawable.FillColor);
                    backgroundcolorbutton.Alpha = Color.ByteToUShort(selectedDrawable.FillColor.A);
                    textspinbutton.Value        = OriginalSize((selectedDrawable as Text).TextSize);
                }
                else
                {
                    colorbutton.Color    = Misc.ToGdkColor(selectedDrawable.StrokeColor);
                    colorbutton.UseAlpha = true;
                    colorbutton.Alpha    = Color.ByteToUShort(selectedDrawable.StrokeColor.A);
                }
                if (selectedDrawable is Line)
                {
                    typecombobox.Active = (int)(selectedDrawable as Line).Type;
                }
                linesizespinbutton.Value = OriginalSize(selectedDrawable.LineWidth);
                if (selectedDrawable.Style == LineStyle.Normal)
                {
                    stylecombobox.Active = 0;
                }
                else
                {
                    stylecombobox.Active = 1;
                }
            }

            UpdateSettingsVisibility(blackboard.Tool);
            ignoreChanges = false;
        }
Beispiel #2
0
        void HandleDrawToolChangedEvent(object sender, EventArgs e)
        {
            RadioButton button = buttonToDrawTool.GetKeyByValue(blackboard.Tool);

            if (blackboard.Tool != DrawTool.Selection)
            {
                selectedDrawable = null;
                blackboard.ClearSelection();
            }

            if (!button.Active)
            {
                button.Click();
            }
        }