Ejemplo n.º 1
0
        private void HandlePintaCoreActionsEditResizePaletteActivated(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 ();
        }
Ejemplo n.º 2
0
        private void HandlePintaCoreActionsFileNewScreenshotActivated(object sender, EventArgs e)
        {
            SpinButtonEntryDialog dialog = new SpinButtonEntryDialog (Catalog.GetString ("Take Screenshot"),
                    PintaCore.Chrome.MainWindow, Catalog.GetString ("Delay before taking a screenshot (seconds):"), 0, 300, 0);

            dialog.WindowPosition = Gtk.WindowPosition.CenterOnParent;

            if (dialog.Run () == (int) Gtk.ResponseType.Ok) {
                GLib.Timeout.Add ((uint) dialog.GetValue () * 1000, () => {
                    PintaCore.Actions.File.NewFileWithScreenshot ();

                    if (!PintaCore.Chrome.MainWindow.IsActive)
                        PintaCore.Chrome.MainWindow.UrgencyHint = true;

                    return false;
                });
            }

            dialog.Destroy ();
        }
Ejemplo n.º 3
0
        private void HandlePintaCoreActionsFileNewScreenshotActivated(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.Layers[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 ();
        }