Beispiel #1
0
            static CloudsData()
            {
                BlendOps = new Dictionary <string, object> ();

                foreach (string name in UserBlendOps.GetAllBlendModeNames())
                {
                    BlendOps.Add(name, UserBlendOps.GetBlendModeByName(name));
                }
                defaultBlendOp = UserBlendOps.GetBlendModeName(Pinta.Core.BlendMode.Normal);
            }
Beispiel #2
0
        public LayerPropertiesDialog() : base(Translations.GetString("Layer Properties"),
                                              PintaCore.Chrome.MainWindow, DialogFlags.Modal,
                                              Core.GtkExtensions.DialogButtonsCancelOk())
        {
            var doc = PintaCore.Workspace.ActiveDocument;

            Build();

            IconName = Resources.Icons.LayerProperties;

            name      = doc.Layers.CurrentUserLayer.Name;
            hidden    = doc.Layers.CurrentUserLayer.Hidden;
            opacity   = doc.Layers.CurrentUserLayer.Opacity;
            blendmode = doc.Layers.CurrentUserLayer.BlendMode;

            initial_properties = new LayerProperties(
                name,
                hidden,
                opacity,
                blendmode);

            layerNameEntry.Text       = initial_properties.Name;
            visibilityCheckbox.Active = !initial_properties.Hidden;
            opacitySpinner.Value      = (int)(initial_properties.Opacity * 100);
            opacitySlider.Value       = (int)(initial_properties.Opacity * 100);

            var all_blendmodes = UserBlendOps.GetAllBlendModeNames().ToList();
            var index          = all_blendmodes.IndexOf(UserBlendOps.GetBlendModeName(blendmode));

            blendComboBox.Active = index;

            layerNameEntry.Changed      += OnLayerNameChanged;
            visibilityCheckbox.Toggled  += OnVisibilityToggled;
            opacitySpinner.ValueChanged += new EventHandler(OnOpacitySpinnerChanged);
            opacitySlider.ValueChanged  += new EventHandler(OnOpacitySliderChanged);
            blendComboBox.Changed       += OnBlendModeChanged;

            DefaultResponse = Gtk.ResponseType.Ok;

            layerNameEntry.ActivatesDefault = true;
            opacitySpinner.ActivatesDefault = true;
        }
Beispiel #3
0
        public LayerPropertiesDialog() : base(Mono.Unix.Catalog.GetString("Layer Properties"), PintaCore.Chrome.MainWindow, DialogFlags.Modal, Stock.Cancel, ResponseType.Cancel, Stock.Ok, ResponseType.Ok)
        {
            Build();

            this.Icon = PintaCore.Resources.GetIcon("Menu.Layers.LayerProperties.png");

            name      = PintaCore.Layers.CurrentLayer.Name;
            hidden    = PintaCore.Layers.CurrentLayer.Hidden;
            opacity   = PintaCore.Layers.CurrentLayer.Opacity;
            blendmode = PintaCore.Layers.CurrentLayer.BlendMode;

            initial_properties = new LayerProperties(
                name,
                hidden,
                opacity,
                blendmode);

            layerNameEntry.Text       = initial_properties.Name;
            visibilityCheckbox.Active = !initial_properties.Hidden;
            opacitySpinner.Value      = (int)(initial_properties.Opacity * 100);
            opacitySlider.Value       = (int)(initial_properties.Opacity * 100);

            var all_blendmodes = UserBlendOps.GetAllBlendModeNames().ToList();
            var index          = all_blendmodes.IndexOf(UserBlendOps.GetBlendModeName(blendmode));

            blendComboBox.Active = index;

            layerNameEntry.Changed      += OnLayerNameChanged;
            visibilityCheckbox.Toggled  += OnVisibilityToggled;
            opacitySpinner.ValueChanged += new EventHandler(OnOpacitySpinnerChanged);
            opacitySlider.ValueChanged  += new EventHandler(OnOpacitySliderChanged);
            blendComboBox.Changed       += OnBlendModeChanged;

            AlternativeButtonOrder = new int[] { (int)Gtk.ResponseType.Ok, (int)Gtk.ResponseType.Cancel };
            DefaultResponse        = Gtk.ResponseType.Ok;

            layerNameEntry.ActivatesDefault = true;
            opacitySpinner.ActivatesDefault = true;
        }
Beispiel #4
0
        private void Build()
        {
            DefaultWidth  = 349;
            DefaultHeight = 224;
            BorderWidth   = 6;
            VBox.Spacing  = 10;

            // Layer name
            var box1 = new HBox();

            box1.Spacing = 6;
            box1.PackStart(new Label(Mono.Unix.Catalog.GetString("Name:")), false, false, 0);

            layerNameEntry = new Entry();
            box1.PackStart(layerNameEntry);

            VBox.PackStart(box1, false, false, 0);

            // Visible checkbox
            visibilityCheckbox = new CheckButton(Mono.Unix.Catalog.GetString("Visible"));

            VBox.PackStart(visibilityCheckbox, false, false, 0);

            // Horizontal separator
            VBox.PackStart(new HSeparator(), false, false, 0);

            // Blend mode
            var box2 = new HBox();

            box2.Spacing = 6;
            box2.PackStart(new Label(Mono.Unix.Catalog.GetString("Blend Mode") + ":"), false, false, 0);

            blendComboBox = new ComboBox(UserBlendOps.GetAllBlendModeNames().ToArray());
            box2.PackStart(blendComboBox);

            VBox.PackStart(box2, false, false, 0);

            // Opacity
            var box3 = new HBox();

            box3.Spacing = 6;
            box3.PackStart(new Label(Mono.Unix.Catalog.GetString("Opacity:")), false, false, 0);

            opacitySpinner = new SpinButton(0, 100, 1);
            opacitySpinner.Adjustment.PageIncrement = 10;
            opacitySpinner.ClimbRate = 1;

            box3.PackStart(opacitySpinner, false, false, 0);

            opacitySlider        = new HScale(0, 100, 1);
            opacitySlider.Digits = 0;
            opacitySlider.Adjustment.PageIncrement = 10;
            box3.PackStart(opacitySlider, true, true, 0);

            VBox.PackStart(box3, false, false, 0);

            // Finish up
            VBox.ShowAll();

            AlternativeButtonOrder = new int[] { (int)ResponseType.Ok, (int)ResponseType.Cancel };
            DefaultResponse        = ResponseType.Ok;
        }
Beispiel #5
0
        private void Build()
        {
            DefaultWidth        = 349;
            DefaultHeight       = 224;
            BorderWidth         = 6;
            ContentArea.Spacing = 10;

            // Layer name
            var box1 = new HBox();

            box1.Spacing = 6;
            box1.PackStart(new Label(Translations.GetString("Name:")), false, false, 0);

            layerNameEntry = new Entry();
            box1.PackStart(layerNameEntry, true, true, 0);

            ContentArea.PackStart(box1, false, false, 0);

            // Visible checkbox
            visibilityCheckbox = new CheckButton(Translations.GetString("Visible"));

            ContentArea.PackStart(visibilityCheckbox, false, false, 0);

            // Horizontal separator
            ContentArea.PackStart(new HSeparator(), false, false, 0);

            // Blend mode
            var box2 = new HBox();

            box2.Spacing = 6;
            box2.PackStart(new Label(Translations.GetString("Blend Mode") + ":"), false, false, 0);

            blendComboBox = new ComboBoxText();
            foreach (string name in UserBlendOps.GetAllBlendModeNames())
            {
                blendComboBox.AppendText(name);
            }

            box2.PackStart(blendComboBox, true, true, 0);

            ContentArea.PackStart(box2, false, false, 0);

            // Opacity
            var box3 = new HBox();

            box3.Spacing = 6;
            box3.PackStart(new Label(Translations.GetString("Opacity:")), false, false, 0);

            opacitySpinner = new SpinButton(0, 100, 1);
            opacitySpinner.Adjustment.PageIncrement = 10;
            opacitySpinner.ClimbRate = 1;

            box3.PackStart(opacitySpinner, false, false, 0);

            opacitySlider        = new HScale(0, 100, 1);
            opacitySlider.Digits = 0;
            opacitySlider.Adjustment.PageIncrement = 10;
            box3.PackStart(opacitySlider, true, true, 0);

            ContentArea.PackStart(box3, false, false, 0);

            // Finish up
            ContentArea.ShowAll();

            DefaultResponse = ResponseType.Ok;
        }