Inheritance: Gtk.Dialog
Exemplo n.º 1
0
        private void HandlePintaCoreActionsFileNewActivated(object sender, EventArgs e)
        {
            NewImageDialog dialog = new NewImageDialog ();

            dialog.ParentWindow = main_window.GdkWindow;
            dialog.WindowPosition = Gtk.WindowPosition.CenterOnParent;

            int response = dialog.Run ();

            if (response == (int)Gtk.ResponseType.Ok) {
                PintaCore.Workspace.ImageSize = new Cairo.PointD (dialog.NewImageWidth, dialog.NewImageHeight);
                PintaCore.Workspace.CanvasSize = new Cairo.PointD (dialog.NewImageWidth, dialog.NewImageHeight);

                PintaCore.Layers.Clear ();
                PintaCore.History.Clear ();
                PintaCore.Layers.DestroySelectionLayer ();
                PintaCore.Layers.ResetSelectionPath ();

                // Start with an empty white layer
                Layer background = PintaCore.Layers.AddNewLayer ("Background");

                using (Cairo.Context g = new Cairo.Context (background.Surface)) {
                    g.SetSourceRGB (255, 255, 255);
                    g.Paint ();
                }

                PintaCore.Workspace.Filename = "Untitled1";
                PintaCore.Workspace.IsDirty = false;
                PintaCore.Actions.View.ZoomToWindow.Activate ();
            }

            dialog.Destroy ();
        }
Exemplo n.º 2
0
        private void HandlePintaCoreActionsFileNewActivated(object sender, EventArgs e)
        {
            NewImageDialog dialog = new NewImageDialog ();

            dialog.ParentWindow = main_window.GdkWindow;
            dialog.WindowPosition = Gtk.WindowPosition.CenterOnParent;

            int response = dialog.Run ();

            if (response == (int)Gtk.ResponseType.Ok)
                PintaCore.Actions.File.NewFile (new Gdk.Size (dialog.NewImageWidth, dialog.NewImageHeight));

            dialog.Destroy ();
        }
Exemplo n.º 3
0
        private void HandlePintaCoreActionsFileNewActivated(object sender, EventArgs e)
        {
            NewImageDialog dialog = new NewImageDialog ();

            Gtk.Clipboard cb = Gtk.Clipboard.Get (Gdk.Atom.Intern ("CLIPBOARD", false));
            Gdk.Pixbuf image = cb.WaitForImage ();
            if (image != null) {
                dialog.NewImageWidth = image.Width;
                dialog.NewImageHeight = image.Height;
            } else {
                dialog.NewImageWidth = PintaCore.Settings.GetSetting<int> ("new-image-width", 800);
                dialog.NewImageHeight = PintaCore.Settings.GetSetting<int> ("new-image-height", 600);
            }
            dialog.ParentWindow = main_window.GdkWindow;
            dialog.WindowPosition = Gtk.WindowPosition.CenterOnParent;

            int response = dialog.Run ();

            if (response == (int)Gtk.ResponseType.Ok) {
                PintaCore.Workspace.NewDocument (new Gdk.Size (dialog.NewImageWidth, dialog.NewImageHeight), false);

                PintaCore.Settings.PutSetting ("new-image-width", dialog.NewImageWidth);
                PintaCore.Settings.PutSetting ("new-image-height", dialog.NewImageHeight);
                PintaCore.Settings.SaveSettings ();
            }

            dialog.Destroy ();
        }
Exemplo n.º 4
0
        private void HandlePintaCoreActionsFileNewActivated(object sender, EventArgs e)
        {
            NewImageDialog dialog = new NewImageDialog ();

            dialog.NewImageWidth = PintaCore.Settings.GetSetting<int> ("new-image-width", 800);
            dialog.NewImageHeight = PintaCore.Settings.GetSetting<int> ("new-image-height", 600);

            dialog.ParentWindow = main_window.GdkWindow;
            dialog.WindowPosition = Gtk.WindowPosition.CenterOnParent;

            int response = dialog.Run ();

            if (response == (int)Gtk.ResponseType.Ok) {
                PintaCore.Workspace.NewDocument (new Gdk.Size (dialog.NewImageWidth, dialog.NewImageHeight), false);

                PintaCore.Settings.PutSetting ("new-image-width", dialog.NewImageWidth);
                PintaCore.Settings.PutSetting ("new-image-height", dialog.NewImageHeight);
                PintaCore.Settings.SaveSettings ();
            }

            dialog.Destroy ();
        }
Exemplo n.º 5
0
        private void HandlePintaCoreActionsFileNewActivated(object sender, EventArgs e)
        {
            bool canceled = false;

            if (PintaCore.Workspace.IsDirty) {
                var primary = Catalog.GetString ("Save the changes to image \"{0}\" before creating a new one?");
                var secondary = Catalog.GetString ("If you don't save, all changes will be permanently lost.");
                var markup = "<span weight=\"bold\" size=\"larger\">{0}</span>\n\n{1}\n";
                markup = string.Format (markup, primary, secondary);

                var md = new MessageDialog (PintaCore.Chrome.MainWindow, DialogFlags.Modal,
                                            MessageType.Question, ButtonsType.None, true,
                                            markup,
                                            System.IO.Path.GetFileName (PintaCore.Workspace.Filename));

                md.AddButton (Catalog.GetString ("Continue without saving"), ResponseType.No);
                md.AddButton (Stock.Cancel, ResponseType.Cancel);
                md.AddButton (Stock.Save, ResponseType.Yes);

                md.DefaultResponse = ResponseType.Cancel;

                ResponseType saveResponse = (ResponseType)md.Run ();
                md.Destroy ();

                if (saveResponse == ResponseType.Yes) {
                    PintaCore.Actions.File.Save.Activate ();
                }
                else {
                    canceled = saveResponse == ResponseType.Cancel;
                }
            }

            if (canceled) {
                return;
            }

            NewImageDialog dialog = new NewImageDialog ();

            dialog.ParentWindow = main_window.GdkWindow;
            dialog.WindowPosition = Gtk.WindowPosition.CenterOnParent;

            int response = dialog.Run ();

            if (response == (int)Gtk.ResponseType.Ok)
                PintaCore.Actions.File.NewFile (new Gdk.Size (dialog.NewImageWidth, dialog.NewImageHeight));

            dialog.Destroy ();
        }