2006-12-09 13:33:38 -08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1999-05-18 10:33:39 -07:00
|
|
|
* Copyright (C) 1995-1999 Spencer Kimball and Peter Mattis
|
|
|
|
|
*
|
2009-01-17 14:28:01 -08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
1999-05-18 10:33:39 -07:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-17 14:28:01 -08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
1999-05-18 10:33:39 -07:00
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-07-11 14:47:19 -07:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
1999-05-18 10:33:39 -07:00
|
|
|
*/
|
2000-10-26 15:02:44 -07:00
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
2003-10-15 08:30:11 -07:00
|
|
|
#include <string.h>
|
|
|
|
|
|
2008-10-09 13:24:04 -07:00
|
|
|
#include <gegl.h>
|
2000-12-16 13:37:03 -08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
2001-05-21 13:30:16 -07:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
2005-01-25 11:11:26 -08:00
|
|
|
#include "libgimpconfig/gimpconfig.h"
|
2001-01-24 14:36:18 -08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
2001-01-23 15:56:18 -08:00
|
|
|
|
2004-09-13 08:15:23 -07:00
|
|
|
#include "dialogs-types.h"
|
2000-12-29 07:22:01 -08:00
|
|
|
|
2002-11-18 12:50:31 -08:00
|
|
|
#include "config/gimpguiconfig.h"
|
|
|
|
|
|
2001-07-11 05:39:49 -07:00
|
|
|
#include "core/gimp.h"
|
2006-09-01 04:26:54 -07:00
|
|
|
#include "core/gimpcontext.h"
|
2001-10-29 03:47:11 -08:00
|
|
|
#include "core/gimpimage.h"
|
2001-07-05 08:34:26 -07:00
|
|
|
#include "core/gimpimage-new.h"
|
2003-04-03 09:50:56 -08:00
|
|
|
#include "core/gimptemplate.h"
|
2001-07-05 08:34:26 -07:00
|
|
|
|
2004-05-11 05:13:31 -07:00
|
|
|
#include "widgets/gimpcontainercombobox.h"
|
2003-08-21 08:54:47 -07:00
|
|
|
#include "widgets/gimphelp-ids.h"
|
2004-10-13 12:02:37 -07:00
|
|
|
#include "widgets/gimpmessagebox.h"
|
|
|
|
|
#include "widgets/gimpmessagedialog.h"
|
2003-04-11 06:17:23 -07:00
|
|
|
#include "widgets/gimptemplateeditor.h"
|
2014-05-02 11:20:46 -07:00
|
|
|
#include "widgets/gimpwidgets-utils.h"
|
2002-05-13 08:35:27 -07:00
|
|
|
|
2004-09-13 08:15:23 -07:00
|
|
|
#include "image-new-dialog.h"
|
1998-06-08 14:53:45 -07:00
|
|
|
|
2003-03-25 08:38:19 -08:00
|
|
|
#include "gimp-intl.h"
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-14 16:23:52 -07:00
|
|
|
|
2000-12-29 07:22:01 -08:00
|
|
|
|
2003-11-06 07:27:05 -08:00
|
|
|
#define RESPONSE_RESET 1
|
|
|
|
|
|
1999-09-27 10:58:10 -07:00
|
|
|
typedef struct
|
|
|
|
|
{
|
2003-04-03 09:50:56 -08:00
|
|
|
GtkWidget *dialog;
|
|
|
|
|
GtkWidget *confirm_dialog;
|
1999-05-18 10:33:39 -07:00
|
|
|
|
2004-05-11 05:13:31 -07:00
|
|
|
GtkWidget *combo;
|
2003-04-11 06:17:23 -07:00
|
|
|
GtkWidget *editor;
|
2001-10-29 03:47:11 -08:00
|
|
|
|
2006-09-01 04:26:54 -07:00
|
|
|
GimpContext *context;
|
2003-10-14 08:20:59 -07:00
|
|
|
GimpTemplate *template;
|
2004-09-13 08:15:23 -07:00
|
|
|
} ImageNewDialog;
|
1998-06-08 14:53:45 -07:00
|
|
|
|
2001-06-26 05:09:43 -07:00
|
|
|
|
2001-10-29 03:47:11 -08:00
|
|
|
/* local function prototypes */
|
|
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
static void image_new_dialog_free (ImageNewDialog *private);
|
2007-05-23 13:08:27 -07:00
|
|
|
static void image_new_dialog_response (GtkWidget *widget,
|
2006-09-01 09:55:37 -07:00
|
|
|
gint response_id,
|
2016-10-27 12:26:07 -07:00
|
|
|
ImageNewDialog *private);
|
2006-09-01 09:55:37 -07:00
|
|
|
static void image_new_template_changed (GimpContext *context,
|
|
|
|
|
GimpTemplate *template,
|
2016-10-27 12:26:07 -07:00
|
|
|
ImageNewDialog *private);
|
|
|
|
|
static void image_new_confirm_dialog (ImageNewDialog *private);
|
|
|
|
|
static void image_new_create_image (ImageNewDialog *private);
|
1998-06-08 14:53:45 -07:00
|
|
|
|
2001-06-26 05:09:43 -07:00
|
|
|
|
2001-10-29 03:47:11 -08:00
|
|
|
/* public functions */
|
1998-06-09 14:21:23 -07:00
|
|
|
|
2003-05-02 11:43:15 -07:00
|
|
|
GtkWidget *
|
2006-09-01 04:26:54 -07:00
|
|
|
image_new_dialog_new (GimpContext *context)
|
1999-08-25 21:39:21 -07:00
|
|
|
{
|
2016-10-27 12:26:07 -07:00
|
|
|
ImageNewDialog *private;
|
|
|
|
|
GtkWidget *dialog;
|
2004-09-13 08:15:23 -07:00
|
|
|
GtkWidget *main_vbox;
|
2012-03-12 12:12:11 -07:00
|
|
|
GtkWidget *hbox;
|
|
|
|
|
GtkWidget *label;
|
2005-02-09 08:57:18 -08:00
|
|
|
GimpSizeEntry *entry;
|
2001-07-05 08:34:26 -07:00
|
|
|
|
2006-09-01 04:26:54 -07:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
2001-10-29 03:47:11 -08:00
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
private = g_slice_new0 (ImageNewDialog);
|
2001-07-05 08:34:26 -07:00
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
private->context = gimp_context_new (context->gimp, "image-new-dialog",
|
|
|
|
|
context);
|
|
|
|
|
private->template = g_object_new (GIMP_TYPE_TEMPLATE, NULL);
|
2001-10-29 03:47:11 -08:00
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
private->dialog = dialog =
|
|
|
|
|
gimp_dialog_new (_("Create a New Image"),
|
|
|
|
|
"gimp-image-new",
|
|
|
|
|
NULL, 0,
|
|
|
|
|
gimp_standard_help_func, GIMP_HELP_FILE_NEW,
|
1999-05-31 07:11:10 -07:00
|
|
|
|
2017-02-12 07:06:34 -08:00
|
|
|
_("_Reset"), RESPONSE_RESET,
|
|
|
|
|
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
|
|
|
|
_("_OK"), GTK_RESPONSE_OK,
|
1999-09-27 10:58:10 -07:00
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
NULL);
|
2002-02-07 03:50:16 -08:00
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
2005-02-08 12:40:33 -08:00
|
|
|
RESPONSE_RESET,
|
|
|
|
|
GTK_RESPONSE_OK,
|
|
|
|
|
GTK_RESPONSE_CANCEL,
|
|
|
|
|
-1);
|
|
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
|
|
|
|
|
|
|
|
|
|
g_object_set_data_full (G_OBJECT (dialog),
|
|
|
|
|
"gimp-image-new-dialog", private,
|
|
|
|
|
(GDestroyNotify) image_new_dialog_free);
|
|
|
|
|
|
|
|
|
|
g_signal_connect (dialog, "response",
|
|
|
|
|
G_CALLBACK (image_new_dialog_response),
|
|
|
|
|
private);
|
|
|
|
|
|
2011-09-30 02:29:11 -07:00
|
|
|
main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
2004-05-03 08:37:56 -07:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
|
2016-10-27 12:26:07 -07:00
|
|
|
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
|
2006-04-12 05:49:29 -07:00
|
|
|
main_vbox, TRUE, TRUE, 0);
|
2002-09-07 09:47:39 -07:00
|
|
|
gtk_widget_show (main_vbox);
|
1999-04-02 11:46:59 -08:00
|
|
|
|
2012-03-12 12:12:11 -07:00
|
|
|
/* The template combo */
|
|
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
|
|
label = gtk_label_new_with_mnemonic (_("_Template:"));
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
|
|
|
|
gtk_widget_show (label);
|
2003-04-03 09:50:56 -08:00
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
private->combo = g_object_new (GIMP_TYPE_CONTAINER_COMBO_BOX,
|
|
|
|
|
"container", context->gimp->templates,
|
|
|
|
|
"context", private->context,
|
|
|
|
|
"view-size", 16,
|
|
|
|
|
"view-border-width", 0,
|
|
|
|
|
"ellipsize", PANGO_ELLIPSIZE_NONE,
|
|
|
|
|
"focus-on-click", FALSE,
|
|
|
|
|
NULL);
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), private->combo, TRUE, TRUE, 0);
|
|
|
|
|
gtk_widget_show (private->combo);
|
2003-04-03 09:50:56 -08:00
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), private->combo);
|
2003-04-03 09:50:56 -08:00
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
g_signal_connect (private->context, "template-changed",
|
2006-09-01 09:55:37 -07:00
|
|
|
G_CALLBACK (image_new_template_changed),
|
2016-10-27 12:26:07 -07:00
|
|
|
private);
|
2003-04-03 09:50:56 -08:00
|
|
|
|
2003-04-11 06:17:23 -07:00
|
|
|
/* Template editor */
|
2016-10-27 12:26:07 -07:00
|
|
|
private->editor = gimp_template_editor_new (private->template, context->gimp,
|
|
|
|
|
FALSE);
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (main_vbox), private->editor, FALSE, FALSE, 0);
|
|
|
|
|
gtk_widget_show (private->editor);
|
2003-04-11 06:17:23 -07:00
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
entry = GIMP_SIZE_ENTRY (gimp_template_editor_get_size_se (GIMP_TEMPLATE_EDITOR (private->editor)));
|
2005-02-09 08:57:18 -08:00
|
|
|
gimp_size_entry_set_activates_default (entry, TRUE);
|
|
|
|
|
gimp_size_entry_grab_focus (entry);
|
|
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
image_new_template_changed (private->context,
|
|
|
|
|
gimp_context_get_template (private->context),
|
|
|
|
|
private);
|
2006-09-01 09:55:37 -07:00
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
return dialog;
|
2003-05-02 11:43:15 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2016-10-27 12:26:07 -07:00
|
|
|
image_new_dialog_set (GtkWidget *dialog,
|
2006-03-28 09:08:36 -08:00
|
|
|
GimpImage *image,
|
2004-09-13 08:15:23 -07:00
|
|
|
GimpTemplate *template)
|
2003-05-02 11:43:15 -07:00
|
|
|
{
|
2016-10-27 12:26:07 -07:00
|
|
|
ImageNewDialog *private;
|
2003-05-02 11:43:15 -07:00
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
g_return_if_fail (GIMP_IS_DIALOG (dialog));
|
2006-03-28 09:08:36 -08:00
|
|
|
g_return_if_fail (image == NULL || GIMP_IS_IMAGE (image));
|
2003-05-02 11:43:15 -07:00
|
|
|
g_return_if_fail (template == NULL || GIMP_IS_TEMPLATE (template));
|
|
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
private = g_object_get_data (G_OBJECT (dialog), "gimp-image-new-dialog");
|
2003-05-02 11:43:15 -07:00
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
g_return_if_fail (private != NULL);
|
2003-05-02 11:43:15 -07:00
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
gimp_context_set_template (private->context, template);
|
2006-09-01 09:55:37 -07:00
|
|
|
|
|
|
|
|
if (! template)
|
2003-04-13 09:25:14 -07:00
|
|
|
{
|
2016-10-27 12:26:07 -07:00
|
|
|
template = gimp_image_new_get_last_template (private->context->gimp,
|
2006-09-01 04:26:54 -07:00
|
|
|
image);
|
2003-10-14 08:20:59 -07:00
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
image_new_template_changed (private->context, template, private);
|
2003-10-14 08:20:59 -07:00
|
|
|
|
2003-04-13 09:25:14 -07:00
|
|
|
g_object_unref (template);
|
|
|
|
|
}
|
1998-06-17 22:04:01 -07:00
|
|
|
}
|
2001-10-29 03:47:11 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
|
2006-09-01 09:55:37 -07:00
|
|
|
static void
|
2016-10-27 12:26:07 -07:00
|
|
|
image_new_dialog_free (ImageNewDialog *private)
|
2006-09-01 09:55:37 -07:00
|
|
|
{
|
2016-10-27 12:26:07 -07:00
|
|
|
g_object_unref (private->context);
|
|
|
|
|
g_object_unref (private->template);
|
2007-05-23 13:08:27 -07:00
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
g_slice_free (ImageNewDialog, private);
|
2006-09-01 09:55:37 -07:00
|
|
|
}
|
|
|
|
|
|
2001-10-29 03:47:11 -08:00
|
|
|
static void
|
2016-10-27 12:26:07 -07:00
|
|
|
image_new_dialog_response (GtkWidget *dialog,
|
2007-05-23 13:08:27 -07:00
|
|
|
gint response_id,
|
2016-10-27 12:26:07 -07:00
|
|
|
ImageNewDialog *private)
|
2001-10-29 03:47:11 -08:00
|
|
|
{
|
2003-11-06 07:27:05 -08:00
|
|
|
switch (response_id)
|
|
|
|
|
{
|
|
|
|
|
case RESPONSE_RESET:
|
2016-10-27 12:26:07 -07:00
|
|
|
gimp_config_sync (G_OBJECT (private->context->gimp->config->default_image),
|
|
|
|
|
G_OBJECT (private->template), 0);
|
|
|
|
|
gimp_context_set_template (private->context, NULL);
|
2003-11-06 07:27:05 -08:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GTK_RESPONSE_OK:
|
2016-10-27 12:26:07 -07:00
|
|
|
if (gimp_template_get_initial_size (private->template) >
|
|
|
|
|
GIMP_GUI_CONFIG (private->context->gimp->config)->max_new_image_size)
|
|
|
|
|
image_new_confirm_dialog (private);
|
2003-11-06 07:27:05 -08:00
|
|
|
else
|
2016-10-27 12:26:07 -07:00
|
|
|
image_new_create_image (private);
|
2003-11-06 07:27:05 -08:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
2016-10-27 12:26:07 -07:00
|
|
|
gtk_widget_destroy (dialog);
|
2003-11-06 07:27:05 -08:00
|
|
|
break;
|
|
|
|
|
}
|
2003-04-10 13:08:56 -07:00
|
|
|
}
|
|
|
|
|
|
2003-04-04 07:11:30 -08:00
|
|
|
static void
|
2006-09-01 09:55:37 -07:00
|
|
|
image_new_template_changed (GimpContext *context,
|
|
|
|
|
GimpTemplate *template,
|
2016-10-27 12:26:07 -07:00
|
|
|
ImageNewDialog *private)
|
2003-04-04 07:11:30 -08:00
|
|
|
{
|
2014-04-18 09:43:32 -07:00
|
|
|
GimpTemplateEditor *editor;
|
|
|
|
|
GtkWidget *chain;
|
|
|
|
|
gdouble xres, yres;
|
|
|
|
|
gchar *comment;
|
2003-10-15 08:30:11 -07:00
|
|
|
|
2014-04-18 09:43:32 -07:00
|
|
|
if (! template)
|
2003-10-15 08:30:11 -07:00
|
|
|
return;
|
|
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
editor = GIMP_TEMPLATE_EDITOR (private->editor);
|
2014-04-18 09:43:32 -07:00
|
|
|
chain = gimp_template_editor_get_resolution_chain (editor);
|
|
|
|
|
|
|
|
|
|
xres = gimp_template_get_resolution_x (template);
|
|
|
|
|
yres = gimp_template_get_resolution_y (template);
|
|
|
|
|
|
|
|
|
|
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chain),
|
|
|
|
|
ABS (xres - yres) < GIMP_MIN_RESOLUTION);
|
|
|
|
|
|
2011-03-02 01:16:43 -08:00
|
|
|
comment = (gchar *) gimp_template_get_comment (template);
|
|
|
|
|
|
|
|
|
|
if (! comment || ! strlen (comment))
|
2016-10-27 12:26:07 -07:00
|
|
|
comment = g_strdup (gimp_template_get_comment (private->template));
|
2011-03-02 01:16:43 -08:00
|
|
|
else
|
|
|
|
|
comment = NULL;
|
2003-10-15 08:30:11 -07:00
|
|
|
|
2008-09-30 09:06:24 -07:00
|
|
|
/* make sure the resolution values are copied first (see bug #546924) */
|
2016-10-27 12:26:07 -07:00
|
|
|
gimp_config_sync (G_OBJECT (template), G_OBJECT (private->template),
|
2008-09-30 09:06:24 -07:00
|
|
|
GIMP_TEMPLATE_PARAM_COPY_FIRST);
|
2016-10-27 12:26:07 -07:00
|
|
|
gimp_config_sync (G_OBJECT (template), G_OBJECT (private->template), 0);
|
2003-10-15 08:30:11 -07:00
|
|
|
|
|
|
|
|
if (comment)
|
|
|
|
|
{
|
2016-10-27 12:26:07 -07:00
|
|
|
g_object_set (private->template,
|
2003-10-15 08:30:11 -07:00
|
|
|
"comment", comment,
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
g_free (comment);
|
|
|
|
|
}
|
2001-10-29 03:47:11 -08:00
|
|
|
}
|
|
|
|
|
|
2003-04-04 07:11:30 -08:00
|
|
|
|
|
|
|
|
/* the confirm dialog */
|
|
|
|
|
|
2001-10-29 03:47:11 -08:00
|
|
|
static void
|
2004-10-13 12:02:37 -07:00
|
|
|
image_new_confirm_response (GtkWidget *dialog,
|
|
|
|
|
gint response_id,
|
2016-10-27 12:26:07 -07:00
|
|
|
ImageNewDialog *private)
|
2001-10-29 03:47:11 -08:00
|
|
|
{
|
2004-10-13 12:02:37 -07:00
|
|
|
gtk_widget_destroy (dialog);
|
2001-10-29 03:47:11 -08:00
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
private->confirm_dialog = NULL;
|
2001-10-29 03:47:11 -08:00
|
|
|
|
2004-10-13 12:02:37 -07:00
|
|
|
if (response_id == GTK_RESPONSE_OK)
|
2016-10-27 12:26:07 -07:00
|
|
|
image_new_create_image (private);
|
2001-10-29 03:47:11 -08:00
|
|
|
else
|
2016-10-27 12:26:07 -07:00
|
|
|
gtk_widget_set_sensitive (private->dialog, TRUE);
|
2001-10-29 03:47:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2016-10-27 12:26:07 -07:00
|
|
|
image_new_confirm_dialog (ImageNewDialog *private)
|
2001-10-29 03:47:11 -08:00
|
|
|
{
|
2004-10-13 12:02:37 -07:00
|
|
|
GimpGuiConfig *config;
|
|
|
|
|
GtkWidget *dialog;
|
|
|
|
|
gchar *size;
|
|
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
if (private->confirm_dialog)
|
2004-10-13 12:02:37 -07:00
|
|
|
{
|
2016-10-27 12:26:07 -07:00
|
|
|
gtk_window_present (GTK_WINDOW (private->confirm_dialog));
|
2004-10-13 12:02:37 -07:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
private->confirm_dialog =
|
2004-10-13 12:02:37 -07:00
|
|
|
dialog = gimp_message_dialog_new (_("Confirm Image Size"),
|
2017-03-05 07:01:59 -08:00
|
|
|
GIMP_ICON_DIALOG_WARNING,
|
2016-10-27 12:26:07 -07:00
|
|
|
private->dialog,
|
2004-10-13 12:02:37 -07:00
|
|
|
GTK_DIALOG_DESTROY_WITH_PARENT,
|
|
|
|
|
gimp_standard_help_func, NULL,
|
|
|
|
|
|
2017-02-12 07:06:34 -08:00
|
|
|
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
|
|
|
|
_("_OK"), GTK_RESPONSE_OK,
|
2004-10-13 12:02:37 -07:00
|
|
|
|
|
|
|
|
NULL);
|
|
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
gtk_dialog_set_alternative_button_order (GTK_DIALOG (private->confirm_dialog),
|
2005-02-10 03:00:46 -08:00
|
|
|
GTK_RESPONSE_OK,
|
|
|
|
|
GTK_RESPONSE_CANCEL,
|
|
|
|
|
-1);
|
|
|
|
|
|
2004-10-13 12:02:37 -07:00
|
|
|
g_signal_connect (dialog, "response",
|
|
|
|
|
G_CALLBACK (image_new_confirm_response),
|
2016-10-27 12:26:07 -07:00
|
|
|
private);
|
2004-10-13 12:02:37 -07:00
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
size = g_format_size (gimp_template_get_initial_size (private->template));
|
2004-10-13 12:02:37 -07:00
|
|
|
gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box,
|
|
|
|
|
_("You are trying to create an image "
|
|
|
|
|
"with a size of %s."), size);
|
|
|
|
|
g_free (size);
|
|
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
config = GIMP_GUI_CONFIG (private->context->gimp->config);
|
2011-09-13 02:39:24 -07:00
|
|
|
size = g_format_size (config->max_new_image_size);
|
2004-10-13 12:02:37 -07:00
|
|
|
gimp_message_box_set_text (GIMP_MESSAGE_DIALOG (dialog)->box,
|
2005-04-14 09:19:30 -07:00
|
|
|
_("An image of the chosen size will use more "
|
2004-10-13 12:02:37 -07:00
|
|
|
"memory than what is configured as "
|
|
|
|
|
"\"Maximum Image Size\" in the Preferences "
|
|
|
|
|
"dialog (currently %s)."), size);
|
|
|
|
|
g_free (size);
|
|
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
gtk_widget_set_sensitive (private->dialog, FALSE);
|
2004-10-13 12:02:37 -07:00
|
|
|
|
|
|
|
|
gtk_widget_show (dialog);
|
2001-10-29 03:47:11 -08:00
|
|
|
}
|
2003-04-11 06:17:23 -07:00
|
|
|
|
|
|
|
|
static void
|
2016-10-27 12:26:07 -07:00
|
|
|
image_new_create_image (ImageNewDialog *private)
|
2003-04-11 06:17:23 -07:00
|
|
|
{
|
2016-10-27 12:26:07 -07:00
|
|
|
GimpTemplate *template = g_object_ref (private->template);
|
|
|
|
|
Gimp *gimp = private->context->gimp;
|
2014-05-02 06:38:26 -07:00
|
|
|
GimpImage *image;
|
2003-05-02 11:43:15 -07:00
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
gtk_widget_hide (private->dialog);
|
2003-04-11 06:17:23 -07:00
|
|
|
|
2014-05-02 06:38:26 -07:00
|
|
|
image = gimp_image_new_from_template (gimp, template,
|
|
|
|
|
gimp_get_user_context (gimp));
|
2014-05-02 11:20:46 -07:00
|
|
|
gimp_create_display (gimp, image, gimp_template_get_unit (template), 1.0,
|
2016-10-27 12:26:07 -07:00
|
|
|
G_OBJECT (gtk_widget_get_screen (private->dialog)),
|
|
|
|
|
gimp_widget_get_monitor (private->dialog));
|
2014-05-02 06:38:26 -07:00
|
|
|
g_object_unref (image);
|
|
|
|
|
|
2016-10-27 12:26:07 -07:00
|
|
|
gtk_widget_destroy (private->dialog);
|
2014-05-02 11:20:46 -07:00
|
|
|
|
2003-05-02 11:43:15 -07:00
|
|
|
gimp_image_new_set_last_template (gimp, template);
|
2003-10-14 08:20:59 -07:00
|
|
|
|
2003-04-11 06:17:23 -07:00
|
|
|
g_object_unref (template);
|
|
|
|
|
}
|