private void Activated(object sender, EventArgs e) { // TODO - allow the layer to be zoomed in or out var data = new RotateZoomData(); var dialog = new SimpleEffectDialog(Catalog.GetString("Rotate / Zoom Layer"), PintaCore.Resources.GetIcon("Menu.Layers.RotateZoom.png"), data, new PintaLocalizer()); // When parameters are modified, update the display transform of the layer. dialog.EffectDataChanged += (o, args) => { var xform = ComputeMatrix(data); var doc = PintaCore.Workspace.ActiveDocument; doc.CurrentUserLayer.Transform.InitMatrix(xform); PintaCore.Workspace.Invalidate(); }; int response = dialog.Run(); ClearLivePreview(); if (response == (int)Gtk.ResponseType.Ok && !data.IsDefault) { ApplyTransform(data); } dialog.Destroy(); }
/// <summary> /// Helper function for the above methods. The IAddinLocalizer provides a generic way to /// get translated strings both for Pinta's effects and for effect add-ins. /// </summary> private static bool LaunchSimpleEffectDialog(BaseEffect effect, IAddinLocalizer localizer) { if (effect == null) { throw new ArgumentNullException("effect"); } if (effect.EffectData == null) { throw new ArgumentException("effect.EffectData is null."); } using (var dialog = new SimpleEffectDialog(effect.Name, PintaCore.Resources.GetIcon(effect.Icon), effect.EffectData, localizer)) { // Hookup event handling for live preview. dialog.EffectDataChanged += (o, e) => { if (effect.EffectData != null) { effect.EffectData.FirePropertyChanged(e.PropertyName); } }; int response = dialog.Run(); bool ret = false; if (response == (int)Gtk.ResponseType.Ok && effect.EffectData != null) { ret = !effect.EffectData.IsDefault; } return(ret); } }
private void Activated(object sender, EventArgs e) { // TODO - allow the layer to be zoomed in or out var data = new RotateZoomData(); Gtk.ResponseType response; using (var dialog = new SimpleEffectDialog(Translations.GetString("Rotate / Zoom Layer"), Gtk.IconTheme.Default.LoadIcon(Resources.Icons.LayerRotateZoom, 16), data, new PintaLocalizer())) { // When parameters are modified, update the display transform of the layer. dialog.EffectDataChanged += (o, args) => { var xform = ComputeMatrix(data); var doc = PintaCore.Workspace.ActiveDocument; doc.Layers.CurrentUserLayer.Transform.InitMatrix(xform); PintaCore.Workspace.Invalidate(); }; response = (Gtk.ResponseType)dialog.Run(); } ClearLivePreview(); if (response == Gtk.ResponseType.Ok && !data.IsDefault) { ApplyTransform(data); } }
private void Activated(object sender, EventArgs e) { // TODO - allow the layer to be zoomed in or out // TODO - show a live preview of the rotation var rotateZoomData = new RotateZoomData(); var dialog = new SimpleEffectDialog(Catalog.GetString("Rotate / Zoom Layer"), PintaCore.Resources.GetIcon("Menu.Layers.RotateZoom.png"), rotateZoomData); int response = dialog.Run(); if (response == (int)Gtk.ResponseType.Ok && !rotateZoomData.IsDefault) { DoRotate(rotateZoomData); } dialog.Destroy(); }
public override bool LaunchConfiguration() { using (var dialog = new SimpleEffectDialog(Name, PintaCore.Resources.GetIcon(Icon), Data, new PintaLocalizer())) { // Hookup event handling for live preview. dialog.EffectDataChanged += (o, e) => { if (EffectData != null) { op = new UnaryPixelOps.RedEyeRemove(Data.Tolerance, Data.Saturation); EffectData.FirePropertyChanged(e.PropertyName); } }; int response = dialog.Run(); bool ret = (response == (int)Gtk.ResponseType.Ok); return(ret); } }