Beispiel #1
0
        private void Activated(object sender, EventArgs e)
        {
            NewImageDialog dialog = new NewImageDialog ();

            Gtk.Clipboard cb = Gtk.Clipboard.Get (Gdk.Atom.Intern ("CLIPBOARD", false));
            if (cb.WaitIsImageAvailable ()) {
                Gdk.Pixbuf image = cb.WaitForImage ();
                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.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 ();
        }
Beispiel #2
0
		private void Activated (object sender, EventArgs e)
		{
			int imgWidth = 0;
			int imgHeight = 0;
			var bg_type = NewImageDialog.BackgroundType.White;
            var using_clipboard = true;
			
			// Try to get the dimensions of an image on the clipboard
			// for the initial width and height values on the NewImageDialog
			if (!GetClipboardImageSize (out imgWidth, out imgHeight))
			{
				// An image was not on the clipboard,
				// so use saved dimensions from settings
				imgWidth = PintaCore.Settings.GetSetting<int> ("new-image-width", 800);
				imgHeight = PintaCore.Settings.GetSetting<int> ("new-image-height", 600);
				bg_type = PintaCore.Settings.GetSetting<NewImageDialog.BackgroundType> (
					"new-image-bg", NewImageDialog.BackgroundType.White);
                using_clipboard = false;
            }

			var dialog = new NewImageDialog (imgWidth, imgHeight, bg_type, using_clipboard);

			int response = dialog.Run ();

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

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

			dialog.Destroy ();
		}
Beispiel #3
0
        private void Activated(object sender, EventArgs e)
        {
            int imgWidth        = 0;
            int imgHeight       = 0;
            var bg_type         = NewImageDialog.BackgroundType.White;
            var using_clipboard = true;

            // Try to get the dimensions of an image on the clipboard
            // for the initial width and height values on the NewImageDialog
            if (!GetClipboardImageSize(out imgWidth, out imgHeight))
            {
                // An image was not on the clipboard,
                // so use saved dimensions from settings
                imgWidth  = PintaCore.Settings.GetSetting <int> ("new-image-width", 800);
                imgHeight = PintaCore.Settings.GetSetting <int> ("new-image-height", 600);
                bg_type   = PintaCore.Settings.GetSetting <NewImageDialog.BackgroundType> (
                    "new-image-bg", NewImageDialog.BackgroundType.White);
                using_clipboard = false;
            }

            using var dialog = new NewImageDialog(imgWidth, imgHeight, bg_type, using_clipboard);

            int response = dialog.Run();

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

                PintaCore.Settings.PutSetting("new-image-width", dialog.NewImageWidth);
                PintaCore.Settings.PutSetting("new-image-height", dialog.NewImageHeight);
                PintaCore.Settings.PutSetting("new-image-bg", dialog.NewImageBackgroundType);
            }
        }
Beispiel #4
0
        private void Activated(object sender, EventArgs e)
        {
            NewImageDialog dialog = new NewImageDialog();

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

            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();
        }
Beispiel #5
0
        private void Activated(object sender, EventArgs e)
        {
            NewImageDialog dialog = new NewImageDialog();

            Gtk.Clipboard cb = Gtk.Clipboard.Get(Gdk.Atom.Intern("CLIPBOARD", false));
            if (cb.WaitIsImageAvailable())
            {
                Gdk.Pixbuf image = cb.WaitForImage();
                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.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();
        }
Beispiel #6
0
        private void Activated(object sender, EventArgs e)
        {
            int imgWidth  = 0;
            int imgHeight = 0;

            // Try to get the dimensions of an image on the clipboard
            // for the initial width and height values on the NewImageDialog
            if (!GetClipboardImageSize(out imgWidth, out imgHeight))
            {
                // An image was not on the clipboard,
                // so use saved dimensions from settings
                imgWidth  = PintaCore.Settings.GetSetting <int> ("new-image-width", 800);
                imgHeight = PintaCore.Settings.GetSetting <int> ("new-image-height", 600);
            }

            NewImageDialog dialog = new NewImageDialog(imgWidth, imgHeight);

            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();
        }
Beispiel #7
0
        private void Activated(object sender, EventArgs e)
        {
            NewImageDialog dialog = new NewImageDialog ();

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

            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 ();
        }
Beispiel #8
0
        private void Activated(object sender, EventArgs e)
        {
            int imgWidth = 0;
            int imgHeight = 0;

            // Try to get the dimensions of an image on the clipboard
            // for the initial width and height values on the NewImageDialog
            if (!GetClipboardImageSize (out imgWidth, out imgHeight))
            {
                // An image was not on the clipboard,
                // so use saved dimensions from settings
                imgWidth = PintaCore.Settings.GetSetting<int> ("new-image-width", 800);
                imgHeight = PintaCore.Settings.GetSetting<int> ("new-image-height", 600);
            }

            NewImageDialog dialog = new NewImageDialog (imgWidth, imgHeight);

            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 ();
        }