Exemplo n.º 1
0
        private void Activated(object sender, EventArgs e)
        {
            var dialog = new LayerPropertiesDialog ();

            int response = dialog.Run ();

            if (response == (int)Gtk.ResponseType.Ok
                && dialog.AreLayerPropertiesUpdated) {

                var historyMessage = GetLayerPropertyUpdateMessage (
                        dialog.InitialLayerProperties,
                        dialog.UpdatedLayerProperties);

                var historyItem = new UpdateLayerPropertiesHistoryItem (
                    "Menu.Layers.LayerProperties.png",
                    historyMessage,
                    PintaCore.Layers.CurrentLayerIndex,
                    dialog.InitialLayerProperties,
                    dialog.UpdatedLayerProperties);

                PintaCore.Workspace.ActiveWorkspace.History.PushNewItem (historyItem);

                PintaCore.Workspace.ActiveWorkspace.Invalidate ();

            } else {

                var layer = PintaCore.Workspace.ActiveDocument.CurrentUserLayer;
                var selectionLayer = PintaCore.Workspace.ActiveDocument.SelectionLayer;
                var initial = dialog.InitialLayerProperties;
                initial.SetProperties (layer);
                if (selectionLayer != null)
                    initial.SetProperties (selectionLayer);

                if ((layer.Opacity != initial.Opacity) || (layer.BlendMode != initial.BlendMode) || (layer.Hidden != initial.Hidden))
                    PintaCore.Workspace.ActiveWorkspace.Invalidate ();
            }

            dialog.Destroy ();
        }
Exemplo n.º 2
0
        private void SetLayerVisibility(UserLayer layer, bool visibility)
        {
            if (layer != null)
                layer.Hidden = !visibility;

            var initial = new LayerProperties(layer.Name, visibility, layer.Opacity, layer.BlendMode);
            var updated = new LayerProperties(layer.Name, !visibility, layer.Opacity, layer.BlendMode);

            var historyItem = new UpdateLayerPropertiesHistoryItem (
                "Menu.Layers.LayerProperties.png",
                (visibility) ? Catalog.GetString ("Layer Shown") : Catalog.GetString ("Layer Hidden"),
                PintaCore.Layers.IndexOf (layer),
                initial,
                updated);

            PintaCore.History.PushNewItem (historyItem);

            //TODO Call this automatically when the layer visibility changes.
            PintaCore.Workspace.Invalidate ();
        }
Exemplo n.º 3
0
        private void HandlePintaCoreActionsLayersPropertiesActivated(object sender, EventArgs e)
        {
            var dialog = new LayerPropertiesDialog ();

            int response = dialog.Run ();

            if (response == (int)Gtk.ResponseType.Ok
                && dialog.AreLayerPropertiesUpdated) {

                var historyMessage = GetLayerPropertyUpdateMessage(
                        dialog.InitialLayerProperties,
                        dialog.UpdatedLayerProperties);

                var historyItem = new UpdateLayerPropertiesHistoryItem(
                    "Menu.Layers.LayerProperties.png",
                    historyMessage,
                    PintaCore.Layers.CurrentLayerIndex,
                    dialog.InitialLayerProperties,
                    dialog.UpdatedLayerProperties);

                PintaCore.History.PushNewItem (historyItem);

                PintaCore.Workspace.Invalidate ();

            } else {

                var layer = PintaCore.Layers.CurrentLayer;
                var initial = dialog.InitialLayerProperties;
                initial.SetProperties (layer);

                if (layer.Opacity != initial.Opacity)
                    PintaCore.Workspace.Invalidate ();
            }

            dialog.Destroy ();
        }