private void Activated(object sender, EventArgs e) { using var dialog = new SpinButtonEntryDialog(Translations.GetString("Resize Palette"), PintaCore.Chrome.MainWindow, Translations.GetString("New palette size:"), 1, 96, PintaCore.Palette.CurrentPalette.Count); if (dialog.Run() == (int)ResponseType.Ok) { PintaCore.Palette.CurrentPalette.Resize(dialog.GetValue()); } }
private void Activated (object sender, EventArgs e) { SpinButtonEntryDialog dialog = new SpinButtonEntryDialog (Catalog.GetString ("Resize Palette"), PintaCore.Chrome.MainWindow, Catalog.GetString ("New palette size:"), 1, 96, PintaCore.Palette.CurrentPalette.Count); if (dialog.Run () == (int)ResponseType.Ok) { PintaCore.Palette.CurrentPalette.Resize (dialog.GetValue ()); } dialog.Destroy (); }
private void Activated(object sender, EventArgs e) { int delay = PintaCore.Settings.GetSetting <int> ("screenshot-delay", 0); using var dialog = new SpinButtonEntryDialog(Translations.GetString("Take Screenshot"), PintaCore.Chrome.MainWindow, Translations.GetString("Delay before taking a screenshot (seconds):"), 0, 300, delay); if (dialog.Run() == (int)Gtk.ResponseType.Ok) { delay = dialog.GetValue(); PintaCore.Settings.PutSetting("screenshot-delay", delay); GLib.Timeout.Add((uint)delay * 1000, () => { Screen screen = Screen.Default; var root_window = screen.RootWindow; int width = root_window.Width; int height = root_window.Height; if (width == 0 || height == 0) { // Something went wrong... // This might happen when running under wayland, see bug 1923241 PintaCore.Chrome.ShowErrorDialog(PintaCore.Chrome.MainWindow, Translations.GetString("Failed to take screenshot"), Translations.GetString("Could not obtain the size of display '{0}'", screen.Display.Name)); return(false); } Document doc = PintaCore.Workspace.NewDocument(new Size(width, height), new Cairo.Color(1, 1, 1)); using (var pb = new Pixbuf(root_window, 0, 0, width, height)) { using (Cairo.Context g = new Cairo.Context(doc.Layers.UserLayers[0].Surface)) { CairoHelper.SetSourcePixbuf(g, pb, 0, 0); g.Paint(); } } doc.IsDirty = true; if (!PintaCore.Chrome.MainWindow.IsActive) { PintaCore.Chrome.MainWindow.UrgencyHint = true; // Don't flash forever GLib.Timeout.Add(3 * 1000, () => PintaCore.Chrome.MainWindow.UrgencyHint = false); } return(false); }); } }
private void Activated(object sender, EventArgs e) { int delay = PintaCore.Settings.GetSetting <int> ("screenshot-delay", 0); SpinButtonEntryDialog dialog = new SpinButtonEntryDialog(Catalog.GetString("Take Screenshot"), PintaCore.Chrome.MainWindow, Catalog.GetString("Delay before taking a screenshot (seconds):"), 0, 300, delay); if (dialog.Run() == (int)Gtk.ResponseType.Ok) { delay = dialog.GetValue(); PintaCore.Settings.PutSetting("screenshot-delay", delay); PintaCore.Settings.SaveSettings(); GLib.Timeout.Add((uint)delay * 1000, () => { Screen screen = Screen.Default; Document doc = PintaCore.Workspace.NewDocument(new Size(screen.Width, screen.Height), new Cairo.Color(1, 1, 1)); using (Pixbuf pb = Pixbuf.FromDrawable(screen.RootWindow, screen.RootWindow.Colormap, 0, 0, 0, 0, screen.Width, screen.Height)) { using (Cairo.Context g = new Cairo.Context(doc.UserLayers[0].Surface)) { CairoHelper.SetSourcePixbuf(g, pb, 0, 0); g.Paint(); } } doc.IsDirty = true; if (!PintaCore.Chrome.MainWindow.IsActive) { PintaCore.Chrome.MainWindow.UrgencyHint = true; // Don't flash forever GLib.Timeout.Add(3 * 1000, () => PintaCore.Chrome.MainWindow.UrgencyHint = false); } return(false); }); } dialog.Destroy(); }
private void Activated(object sender, EventArgs e) { int delay = PintaCore.Settings.GetSetting<int> ("screenshot-delay", 0); SpinButtonEntryDialog dialog = new SpinButtonEntryDialog (Catalog.GetString ("Take Screenshot"), PintaCore.Chrome.MainWindow, Catalog.GetString ("Delay before taking a screenshot (seconds):"), 0, 300, delay); if (dialog.Run () == (int)Gtk.ResponseType.Ok) { delay = dialog.GetValue (); PintaCore.Settings.PutSetting ("screenshot-delay", delay); PintaCore.Settings.SaveSettings (); GLib.Timeout.Add ((uint)delay * 1000, () => { Screen screen = Screen.Default; Document doc = PintaCore.Workspace.NewDocument (new Size (screen.Width, screen.Height), false); using (Pixbuf pb = Pixbuf.FromDrawable (screen.RootWindow, screen.RootWindow.Colormap, 0, 0, 0, 0, screen.Width, screen.Height)) { using (Cairo.Context g = new Cairo.Context (doc.UserLayers[0].Surface)) { CairoHelper.SetSourcePixbuf (g, pb, 0, 0); g.Paint (); } } doc.IsDirty = true; if (!PintaCore.Chrome.MainWindow.IsActive) { PintaCore.Chrome.MainWindow.UrgencyHint = true; // Don't flash forever GLib.Timeout.Add (3 * 1000, () => PintaCore.Chrome.MainWindow.UrgencyHint = false); } return false; }); } dialog.Destroy (); }