public InvertHistoryItem(InvertType type) { this.type = type; switch (type) { // Invert is disabled because it creates a new history item //case InvertType.InvertColors: // Text = Mono.Unix.Translations.GetString ("Invert Colors"); // Icon = "Menu.Adjustments.InvertColors.png"; // break; case InvertType.Rotate180: Text = Translations.GetString("Rotate 180°"); Icon = Resources.Icons.ImageRotate180; break; case InvertType.FlipHorizontal: Text = Translations.GetString("Flip Image Horizontal"); Icon = Resources.Icons.ImageFlipHorizontal; break; case InvertType.FlipVertical: Text = Translations.GetString("Flip Image Vertical"); Icon = Resources.Icons.ImageFlipVertical; break; case InvertType.Rotate90CW: Text = Translations.GetString("Rotate 90° Clockwise"); Icon = Resources.Icons.ImageRotate90CW; break; case InvertType.Rotate90CCW: Text = Translations.GetString("Rotate 90° Counter-Clockwise"); Icon = Resources.Icons.ImageRotate90CCW; break; } }
private void HandlePintaCoreActionsImageFlattenActivated(object sender, EventArgs e) { Document doc = PintaCore.Workspace.ActiveDocument; PintaCore.Tools.Commit(); var oldBottomSurface = doc.Layers.UserLayers[0].Surface.Clone(); CompoundHistoryItem hist = new CompoundHistoryItem(Resources.Icons.ImageFlatten, Translations.GetString("Flatten")); for (int i = doc.Layers.UserLayers.Count - 1; i >= 1; i--) { hist.Push(new DeleteLayerHistoryItem(string.Empty, string.Empty, doc.Layers.UserLayers[i], i)); } doc.Layers.FlattenLayers(); hist.Push(new SimpleHistoryItem(string.Empty, string.Empty, oldBottomSurface, 0)); doc.History.PushNewItem(hist); }
public AddinActions() { AddinManager = new Command("AddinManager", Translations.GetString("Add-in Manager"), null, Resources.Icons.AddinsManage); }
private void HandlePintaCoreActionsLayersAddNewLayerActivated(object sender, EventArgs e) { Document doc = PintaCore.Workspace.ActiveDocument; PintaCore.Tools.Commit(); UserLayer l = doc.Layers.AddNewLayer(string.Empty); // Make new layer the current layer doc.Layers.SetCurrentUserLayer(l); AddLayerHistoryItem hist = new AddLayerHistoryItem(Resources.Icons.LayerNew, Translations.GetString("Add New Layer"), doc.Layers.IndexOf(l)); doc.History.PushNewItem(hist); }
private void HandlePintaCoreActionsLayersDeleteLayerActivated(object sender, EventArgs e) { Document doc = PintaCore.Workspace.ActiveDocument; PintaCore.Tools.Commit(); DeleteLayerHistoryItem hist = new DeleteLayerHistoryItem(Resources.Icons.LayerDelete, Translations.GetString("Delete Layer"), doc.Layers.CurrentUserLayer, doc.Layers.CurrentUserLayerIndex); doc.Layers.DeleteLayer(doc.Layers.CurrentUserLayerIndex, false); doc.History.PushNewItem(hist); }
private void HandlePintaCoreActionsLayersMergeLayerDownActivated(object sender, EventArgs e) { Document doc = PintaCore.Workspace.ActiveDocument; PintaCore.Tools.Commit(); int bottomLayerIndex = doc.Layers.CurrentUserLayerIndex - 1; var oldBottomSurface = doc.Layers.UserLayers[bottomLayerIndex].Surface.Clone(); CompoundHistoryItem hist = new CompoundHistoryItem(Resources.Icons.LayerMergeDown, Translations.GetString("Merge Layer Down")); DeleteLayerHistoryItem h1 = new DeleteLayerHistoryItem(string.Empty, string.Empty, doc.Layers.CurrentUserLayer, doc.Layers.CurrentUserLayerIndex); doc.Layers.MergeCurrentLayerDown(); SimpleHistoryItem h2 = new SimpleHistoryItem(string.Empty, string.Empty, oldBottomSurface, bottomLayerIndex); hist.Push(h1); hist.Push(h2); doc.History.PushNewItem(hist); }
private void HandlePintaCoreActionsLayersMoveLayerDownActivated(object sender, EventArgs e) { Document doc = PintaCore.Workspace.ActiveDocument; PintaCore.Tools.Commit(); SwapLayersHistoryItem hist = new SwapLayersHistoryItem(Resources.Icons.LayerMoveDown, Translations.GetString("Move Layer Down"), doc.Layers.CurrentUserLayerIndex, doc.Layers.CurrentUserLayerIndex - 1); doc.Layers.MoveCurrentLayerDown(); doc.History.PushNewItem(hist); }
private void HandlePintaCoreActionsLayersImportFromFileActivated(object sender, EventArgs e) { Document doc = PintaCore.Workspace.ActiveDocument; PintaCore.Tools.Commit(); using var fcd = new FileChooserNative( Translations.GetString("Open Image File"), PintaCore.Chrome.MainWindow, FileChooserAction.Open, Translations.GetString("Open"), Translations.GetString("Cancel")); fcd.SetCurrentFolder(PintaCore.System.GetDialogDirectory()); // Add image files filter var ff = new FileFilter(); foreach (var format in PintaCore.System.ImageFormats.Formats) { if (!format.IsWriteOnly()) { foreach (var ext in format.Extensions) { ff.AddPattern(string.Format("*.{0}", ext)); } } } ff.Name = Translations.GetString("Image files"); fcd.AddFilter(ff); var response = (ResponseType)fcd.Run(); if (response == ResponseType.Accept) { string file = fcd.Filename; string?directory = Path.GetDirectoryName(file); if (directory is not null) { PintaCore.System.LastDialogDirectory = directory; } // Open the image and add it to the layers UserLayer layer = doc.Layers.AddNewLayer(System.IO.Path.GetFileName(file)); using (var fs = new FileStream(file, FileMode.Open)) using (var bg = new Pixbuf(fs)) using (var g = new Cairo.Context(layer.Surface)) { Gdk.CairoHelper.SetSourcePixbuf(g, bg, 0, 0); g.Paint(); } doc.Layers.SetCurrentUserLayer(layer); AddLayerHistoryItem hist = new AddLayerHistoryItem(Resources.Icons.LayerImport, Translations.GetString("Import From File"), doc.Layers.IndexOf(layer)); doc.History.PushNewItem(hist); doc.Workspace.Invalidate(); } }