1999-05-19 01:33:39 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995-1999 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (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
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
2000-10-27 06:02:44 +08:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2003-04-04 01:50:56 +08:00
|
|
|
#include <string.h>
|
|
|
|
|
2000-12-17 05:37:03 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2001-01-24 07:56:18 +08:00
|
|
|
#include "libgimpmath/gimpmath.h"
|
2001-05-22 04:30:16 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
2001-01-25 06:36:18 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
2001-01-24 07:56:18 +08:00
|
|
|
|
2001-09-26 07:23:09 +08:00
|
|
|
#include "gui-types.h"
|
2000-12-29 23:22:01 +08:00
|
|
|
|
2003-04-04 01:50:56 +08:00
|
|
|
#include "config/gimpconfig-utils.h"
|
2002-11-19 04:50:31 +08:00
|
|
|
#include "config/gimpguiconfig.h"
|
|
|
|
|
2001-07-11 20:39:49 +08:00
|
|
|
#include "core/gimp.h"
|
2001-10-29 19:47:11 +08:00
|
|
|
#include "core/gimpimage.h"
|
2001-07-05 23:34:26 +08:00
|
|
|
#include "core/gimpimage-new.h"
|
2003-04-04 01:50:56 +08:00
|
|
|
#include "core/gimptemplate.h"
|
2001-07-05 23:34:26 +08:00
|
|
|
|
2003-04-04 01:50:56 +08:00
|
|
|
#include "widgets/gimpcontainermenuimpl.h"
|
|
|
|
#include "widgets/gimppropwidgets.h"
|
GimpViewableDialogs everywhere, cleanup:
2002-09-01 Michael Natterer <mitch@gimp.org>
GimpViewableDialogs everywhere, cleanup:
* libgimpwidgets/gimpstock.c: added texts for the RESIZE, SCALE
and CROP stock items.
* app/widgets/gimpviewabledialog.c: update the title when the
viewable's name changes.
* app/gui/color-notebook.[ch]: added color_notebook_viewable_new()
which creates a GimpViewableDialog.
* app/widgets/gimpgradienteditor.[ch]
* app/gui/colormap-editor-commands.c
* app/gui/file-new-dialog.c
* app/gui/gradient-editor-commands.c
* app/gui/palette-editor-commands.c
* app/undo_history.c: use GimpViewableDialogs and the new
color_notebook constructor.
* app/gui/convert-dialog.c: #include "widgets/gimpviewabledialog.h"
* app/gui/image-commands.c
* app/gui/info-dialog.c
* app/gui/resize-dialog.c: minor cleanups.
* app/gui/info-window.c: cleaned up the whole thing, esp. the
"Extended" page. Added HSV color display to the color picker
frame. Set the icons as frame titles, stuff...
* app/tools/gimpimagemaptool.[ch]: removed "shell_title",
"shell_name" and "stock_id" from the GimpImageMapTool struct
because they can be obtained from the tool's GimpToolInfo object.
* app/tools/gimpbrightnesscontrasttool.c
* app/tools/gimpcolorbalancetool.c
* app/tools/gimpcurvestool.c
* app/tools/gimphuesaturationtool.c
* app/tools/gimplevelstool.c
* app/tools/gimpposterizetool.c
* app/tools/gimpthresholdtool.c: changed accordingly.
* app/tools/gimphistogramtool.c: same here: take values from
tool->tool_info instead of hardcoding them.
* app/tools/gimpcroptool.[ch]: removed the static crop dialog
variables and added them to the GimpCropTool struct. Feels safer
and makes the callback code much simpler. Use stock items for the
dialog's "Resize" and "Crop" buttons.
* app/tools/gimpmeasuretool.c
* app/tools/gimprotatetool.c: for consistency don't name the tools
"Blah Tool", also the dialog titles need to match the menu
entries.
Unrelated:
* libgimpwidgets/gimpwidgets.c: the recently changed, gtk-doc
comment was correct, as gtk-doc takes the parameter names from
the header, not the .c file.
* app/tools/gimptransformtool.c: set the transform tool's state to
TRANSFORM_CREATING after changing displays, so the initial matrix
components are saved correctly for the "Reset" function.
2002-09-01 16:44:57 +08:00
|
|
|
#include "widgets/gimpviewabledialog.h"
|
2002-05-13 23:35:27 +08:00
|
|
|
|
2001-04-18 05:43:29 +08:00
|
|
|
#include "file-new-dialog.h"
|
1998-06-09 05:53:45 +08:00
|
|
|
|
2003-03-26 00: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-15 07:23:52 +08:00
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
|
2002-09-08 00:47:39 +08:00
|
|
|
#define SB_WIDTH 10
|
|
|
|
|
|
|
|
|
1999-09-28 01:58:10 +08:00
|
|
|
typedef struct
|
|
|
|
{
|
2003-04-04 01:50:56 +08:00
|
|
|
GtkWidget *dialog;
|
|
|
|
GtkWidget *confirm_dialog;
|
1999-05-19 01:33:39 +08:00
|
|
|
|
2003-04-04 23:11:30 +08:00
|
|
|
GtkWidget *template_menu;
|
1999-02-25 19:25:53 +08:00
|
|
|
|
2003-04-04 01:50:56 +08:00
|
|
|
GtkWidget *size_se;
|
|
|
|
GtkWidget *memsize_label;
|
|
|
|
GtkWidget *resolution_se;
|
1999-05-19 01:33:39 +08:00
|
|
|
|
2003-04-04 23:11:30 +08:00
|
|
|
GtkWidget *ok_button;
|
2001-10-29 19:47:11 +08:00
|
|
|
|
2003-04-04 01:50:56 +08:00
|
|
|
Gimp *gimp;
|
2003-04-04 23:11:30 +08:00
|
|
|
GimpTemplate *template;
|
|
|
|
gulong memsize;
|
1999-08-26 12:39:21 +08:00
|
|
|
} NewImageInfo;
|
1998-06-09 05:53:45 +08:00
|
|
|
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2001-10-29 19:47:11 +08:00
|
|
|
/* local function prototypes */
|
|
|
|
|
2003-04-04 01:50:56 +08:00
|
|
|
static void file_new_ok_callback (GtkWidget *widget,
|
|
|
|
NewImageInfo *info);
|
|
|
|
static void file_new_cancel_callback (GtkWidget *widget,
|
|
|
|
NewImageInfo *info);
|
|
|
|
static void file_new_reset_callback (GtkWidget *widget,
|
|
|
|
NewImageInfo *info);
|
|
|
|
static void file_new_template_notify (GimpTemplate *template,
|
|
|
|
GParamSpec *param_spec,
|
|
|
|
NewImageInfo *info);
|
|
|
|
static void file_new_template_select (GimpContainerMenu *menu,
|
2003-04-04 23:11:30 +08:00
|
|
|
GimpTemplate *template,
|
2003-04-04 01:50:56 +08:00
|
|
|
gpointer insert_data,
|
|
|
|
NewImageInfo *info);
|
2003-04-04 23:11:30 +08:00
|
|
|
static void file_new_confirm_dialog (NewImageInfo *info);
|
1998-06-09 05:53:45 +08:00
|
|
|
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2001-10-29 19:47:11 +08:00
|
|
|
/* public functions */
|
1998-06-10 05:21:23 +08:00
|
|
|
|
1999-08-26 12:39:21 +08:00
|
|
|
void
|
2001-10-29 19:47:11 +08:00
|
|
|
file_new_dialog_create (Gimp *gimp,
|
|
|
|
GimpImage *gimage)
|
1999-08-26 12:39:21 +08:00
|
|
|
{
|
2001-07-05 23:34:26 +08:00
|
|
|
NewImageInfo *info;
|
2002-09-08 00:47:39 +08:00
|
|
|
GtkWidget *main_vbox;
|
2001-07-05 23:34:26 +08:00
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *abox;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *separator;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkObject *adjustment;
|
|
|
|
GtkWidget *spinbutton;
|
|
|
|
GtkWidget *spinbutton2;
|
2003-04-04 23:11:30 +08:00
|
|
|
GtkWidget *chainbutton;
|
|
|
|
GtkWidget *optionmenu;
|
2001-07-05 23:34:26 +08:00
|
|
|
|
2001-10-29 19:47:11 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
2003-04-04 01:50:56 +08:00
|
|
|
g_return_if_fail (gimage == NULL || GIMP_IS_IMAGE (gimage));
|
2001-10-29 19:47:11 +08:00
|
|
|
|
2001-07-05 23:34:26 +08:00
|
|
|
info = g_new0 (NewImageInfo, 1);
|
|
|
|
|
2003-04-04 01:50:56 +08:00
|
|
|
info->gimp = gimp;
|
2003-04-04 23:11:30 +08:00
|
|
|
info->template = gimp_image_new_get_last_template (gimp, gimage);
|
|
|
|
info->memsize = 0;
|
2003-04-04 01:50:56 +08:00
|
|
|
|
|
|
|
g_signal_connect (info->template, "notify",
|
|
|
|
G_CALLBACK (file_new_template_notify),
|
|
|
|
info);
|
2001-10-29 19:47:11 +08:00
|
|
|
|
GimpViewableDialogs everywhere, cleanup:
2002-09-01 Michael Natterer <mitch@gimp.org>
GimpViewableDialogs everywhere, cleanup:
* libgimpwidgets/gimpstock.c: added texts for the RESIZE, SCALE
and CROP stock items.
* app/widgets/gimpviewabledialog.c: update the title when the
viewable's name changes.
* app/gui/color-notebook.[ch]: added color_notebook_viewable_new()
which creates a GimpViewableDialog.
* app/widgets/gimpgradienteditor.[ch]
* app/gui/colormap-editor-commands.c
* app/gui/file-new-dialog.c
* app/gui/gradient-editor-commands.c
* app/gui/palette-editor-commands.c
* app/undo_history.c: use GimpViewableDialogs and the new
color_notebook constructor.
* app/gui/convert-dialog.c: #include "widgets/gimpviewabledialog.h"
* app/gui/image-commands.c
* app/gui/info-dialog.c
* app/gui/resize-dialog.c: minor cleanups.
* app/gui/info-window.c: cleaned up the whole thing, esp. the
"Extended" page. Added HSV color display to the color picker
frame. Set the icons as frame titles, stuff...
* app/tools/gimpimagemaptool.[ch]: removed "shell_title",
"shell_name" and "stock_id" from the GimpImageMapTool struct
because they can be obtained from the tool's GimpToolInfo object.
* app/tools/gimpbrightnesscontrasttool.c
* app/tools/gimpcolorbalancetool.c
* app/tools/gimpcurvestool.c
* app/tools/gimphuesaturationtool.c
* app/tools/gimplevelstool.c
* app/tools/gimpposterizetool.c
* app/tools/gimpthresholdtool.c: changed accordingly.
* app/tools/gimphistogramtool.c: same here: take values from
tool->tool_info instead of hardcoding them.
* app/tools/gimpcroptool.[ch]: removed the static crop dialog
variables and added them to the GimpCropTool struct. Feels safer
and makes the callback code much simpler. Use stock items for the
dialog's "Resize" and "Crop" buttons.
* app/tools/gimpmeasuretool.c
* app/tools/gimprotatetool.c: for consistency don't name the tools
"Blah Tool", also the dialog titles need to match the menu
entries.
Unrelated:
* libgimpwidgets/gimpwidgets.c: the recently changed, gtk-doc
comment was correct, as gtk-doc takes the parameter names from
the header, not the .c file.
* app/tools/gimptransformtool.c: set the transform tool's state to
TRANSFORM_CREATING after changing displays, so the initial matrix
components are saved correctly for the "Reset" function.
2002-09-01 16:44:57 +08:00
|
|
|
info->dialog =
|
|
|
|
gimp_viewable_dialog_new (NULL,
|
|
|
|
_("New Image"), "new_image",
|
2003-03-27 22:25:18 +08:00
|
|
|
GIMP_STOCK_IMAGE,
|
GimpViewableDialogs everywhere, cleanup:
2002-09-01 Michael Natterer <mitch@gimp.org>
GimpViewableDialogs everywhere, cleanup:
* libgimpwidgets/gimpstock.c: added texts for the RESIZE, SCALE
and CROP stock items.
* app/widgets/gimpviewabledialog.c: update the title when the
viewable's name changes.
* app/gui/color-notebook.[ch]: added color_notebook_viewable_new()
which creates a GimpViewableDialog.
* app/widgets/gimpgradienteditor.[ch]
* app/gui/colormap-editor-commands.c
* app/gui/file-new-dialog.c
* app/gui/gradient-editor-commands.c
* app/gui/palette-editor-commands.c
* app/undo_history.c: use GimpViewableDialogs and the new
color_notebook constructor.
* app/gui/convert-dialog.c: #include "widgets/gimpviewabledialog.h"
* app/gui/image-commands.c
* app/gui/info-dialog.c
* app/gui/resize-dialog.c: minor cleanups.
* app/gui/info-window.c: cleaned up the whole thing, esp. the
"Extended" page. Added HSV color display to the color picker
frame. Set the icons as frame titles, stuff...
* app/tools/gimpimagemaptool.[ch]: removed "shell_title",
"shell_name" and "stock_id" from the GimpImageMapTool struct
because they can be obtained from the tool's GimpToolInfo object.
* app/tools/gimpbrightnesscontrasttool.c
* app/tools/gimpcolorbalancetool.c
* app/tools/gimpcurvestool.c
* app/tools/gimphuesaturationtool.c
* app/tools/gimplevelstool.c
* app/tools/gimpposterizetool.c
* app/tools/gimpthresholdtool.c: changed accordingly.
* app/tools/gimphistogramtool.c: same here: take values from
tool->tool_info instead of hardcoding them.
* app/tools/gimpcroptool.[ch]: removed the static crop dialog
variables and added them to the GimpCropTool struct. Feels safer
and makes the callback code much simpler. Use stock items for the
dialog's "Resize" and "Crop" buttons.
* app/tools/gimpmeasuretool.c
* app/tools/gimprotatetool.c: for consistency don't name the tools
"Blah Tool", also the dialog titles need to match the menu
entries.
Unrelated:
* libgimpwidgets/gimpwidgets.c: the recently changed, gtk-doc
comment was correct, as gtk-doc takes the parameter names from
the header, not the .c file.
* app/tools/gimptransformtool.c: set the transform tool's state to
TRANSFORM_CREATING after changing displays, so the initial matrix
components are saved correctly for the "Reset" function.
2002-09-01 16:44:57 +08:00
|
|
|
_("Create a New Image"),
|
|
|
|
gimp_standard_help_func,
|
|
|
|
"dialogs/file_new.html",
|
1999-05-31 22:11:10 +08:00
|
|
|
|
GimpViewableDialogs everywhere, cleanup:
2002-09-01 Michael Natterer <mitch@gimp.org>
GimpViewableDialogs everywhere, cleanup:
* libgimpwidgets/gimpstock.c: added texts for the RESIZE, SCALE
and CROP stock items.
* app/widgets/gimpviewabledialog.c: update the title when the
viewable's name changes.
* app/gui/color-notebook.[ch]: added color_notebook_viewable_new()
which creates a GimpViewableDialog.
* app/widgets/gimpgradienteditor.[ch]
* app/gui/colormap-editor-commands.c
* app/gui/file-new-dialog.c
* app/gui/gradient-editor-commands.c
* app/gui/palette-editor-commands.c
* app/undo_history.c: use GimpViewableDialogs and the new
color_notebook constructor.
* app/gui/convert-dialog.c: #include "widgets/gimpviewabledialog.h"
* app/gui/image-commands.c
* app/gui/info-dialog.c
* app/gui/resize-dialog.c: minor cleanups.
* app/gui/info-window.c: cleaned up the whole thing, esp. the
"Extended" page. Added HSV color display to the color picker
frame. Set the icons as frame titles, stuff...
* app/tools/gimpimagemaptool.[ch]: removed "shell_title",
"shell_name" and "stock_id" from the GimpImageMapTool struct
because they can be obtained from the tool's GimpToolInfo object.
* app/tools/gimpbrightnesscontrasttool.c
* app/tools/gimpcolorbalancetool.c
* app/tools/gimpcurvestool.c
* app/tools/gimphuesaturationtool.c
* app/tools/gimplevelstool.c
* app/tools/gimpposterizetool.c
* app/tools/gimpthresholdtool.c: changed accordingly.
* app/tools/gimphistogramtool.c: same here: take values from
tool->tool_info instead of hardcoding them.
* app/tools/gimpcroptool.[ch]: removed the static crop dialog
variables and added them to the GimpCropTool struct. Feels safer
and makes the callback code much simpler. Use stock items for the
dialog's "Resize" and "Crop" buttons.
* app/tools/gimpmeasuretool.c
* app/tools/gimprotatetool.c: for consistency don't name the tools
"Blah Tool", also the dialog titles need to match the menu
entries.
Unrelated:
* libgimpwidgets/gimpwidgets.c: the recently changed, gtk-doc
comment was correct, as gtk-doc takes the parameter names from
the header, not the .c file.
* app/tools/gimptransformtool.c: set the transform tool's state to
TRANSFORM_CREATING after changing displays, so the initial matrix
components are saved correctly for the "Reset" function.
2002-09-01 16:44:57 +08:00
|
|
|
GIMP_STOCK_RESET, file_new_reset_callback,
|
|
|
|
info, NULL, NULL, FALSE, FALSE,
|
1999-09-28 01:58:10 +08:00
|
|
|
|
2002-09-17 19:55:04 +08:00
|
|
|
GTK_STOCK_CANCEL, file_new_cancel_callback,
|
|
|
|
info, NULL, NULL, FALSE, TRUE,
|
|
|
|
|
GimpViewableDialogs everywhere, cleanup:
2002-09-01 Michael Natterer <mitch@gimp.org>
GimpViewableDialogs everywhere, cleanup:
* libgimpwidgets/gimpstock.c: added texts for the RESIZE, SCALE
and CROP stock items.
* app/widgets/gimpviewabledialog.c: update the title when the
viewable's name changes.
* app/gui/color-notebook.[ch]: added color_notebook_viewable_new()
which creates a GimpViewableDialog.
* app/widgets/gimpgradienteditor.[ch]
* app/gui/colormap-editor-commands.c
* app/gui/file-new-dialog.c
* app/gui/gradient-editor-commands.c
* app/gui/palette-editor-commands.c
* app/undo_history.c: use GimpViewableDialogs and the new
color_notebook constructor.
* app/gui/convert-dialog.c: #include "widgets/gimpviewabledialog.h"
* app/gui/image-commands.c
* app/gui/info-dialog.c
* app/gui/resize-dialog.c: minor cleanups.
* app/gui/info-window.c: cleaned up the whole thing, esp. the
"Extended" page. Added HSV color display to the color picker
frame. Set the icons as frame titles, stuff...
* app/tools/gimpimagemaptool.[ch]: removed "shell_title",
"shell_name" and "stock_id" from the GimpImageMapTool struct
because they can be obtained from the tool's GimpToolInfo object.
* app/tools/gimpbrightnesscontrasttool.c
* app/tools/gimpcolorbalancetool.c
* app/tools/gimpcurvestool.c
* app/tools/gimphuesaturationtool.c
* app/tools/gimplevelstool.c
* app/tools/gimpposterizetool.c
* app/tools/gimpthresholdtool.c: changed accordingly.
* app/tools/gimphistogramtool.c: same here: take values from
tool->tool_info instead of hardcoding them.
* app/tools/gimpcroptool.[ch]: removed the static crop dialog
variables and added them to the GimpCropTool struct. Feels safer
and makes the callback code much simpler. Use stock items for the
dialog's "Resize" and "Crop" buttons.
* app/tools/gimpmeasuretool.c
* app/tools/gimprotatetool.c: for consistency don't name the tools
"Blah Tool", also the dialog titles need to match the menu
entries.
Unrelated:
* libgimpwidgets/gimpwidgets.c: the recently changed, gtk-doc
comment was correct, as gtk-doc takes the parameter names from
the header, not the .c file.
* app/tools/gimptransformtool.c: set the transform tool's state to
TRANSFORM_CREATING after changing displays, so the initial matrix
components are saved correctly for the "Reset" function.
2002-09-01 16:44:57 +08:00
|
|
|
GTK_STOCK_OK, file_new_ok_callback,
|
2003-04-04 23:11:30 +08:00
|
|
|
info, NULL, &info->ok_button, TRUE, FALSE,
|
1999-09-28 01:58:10 +08:00
|
|
|
|
GimpViewableDialogs everywhere, cleanup:
2002-09-01 Michael Natterer <mitch@gimp.org>
GimpViewableDialogs everywhere, cleanup:
* libgimpwidgets/gimpstock.c: added texts for the RESIZE, SCALE
and CROP stock items.
* app/widgets/gimpviewabledialog.c: update the title when the
viewable's name changes.
* app/gui/color-notebook.[ch]: added color_notebook_viewable_new()
which creates a GimpViewableDialog.
* app/widgets/gimpgradienteditor.[ch]
* app/gui/colormap-editor-commands.c
* app/gui/file-new-dialog.c
* app/gui/gradient-editor-commands.c
* app/gui/palette-editor-commands.c
* app/undo_history.c: use GimpViewableDialogs and the new
color_notebook constructor.
* app/gui/convert-dialog.c: #include "widgets/gimpviewabledialog.h"
* app/gui/image-commands.c
* app/gui/info-dialog.c
* app/gui/resize-dialog.c: minor cleanups.
* app/gui/info-window.c: cleaned up the whole thing, esp. the
"Extended" page. Added HSV color display to the color picker
frame. Set the icons as frame titles, stuff...
* app/tools/gimpimagemaptool.[ch]: removed "shell_title",
"shell_name" and "stock_id" from the GimpImageMapTool struct
because they can be obtained from the tool's GimpToolInfo object.
* app/tools/gimpbrightnesscontrasttool.c
* app/tools/gimpcolorbalancetool.c
* app/tools/gimpcurvestool.c
* app/tools/gimphuesaturationtool.c
* app/tools/gimplevelstool.c
* app/tools/gimpposterizetool.c
* app/tools/gimpthresholdtool.c: changed accordingly.
* app/tools/gimphistogramtool.c: same here: take values from
tool->tool_info instead of hardcoding them.
* app/tools/gimpcroptool.[ch]: removed the static crop dialog
variables and added them to the GimpCropTool struct. Feels safer
and makes the callback code much simpler. Use stock items for the
dialog's "Resize" and "Crop" buttons.
* app/tools/gimpmeasuretool.c
* app/tools/gimprotatetool.c: for consistency don't name the tools
"Blah Tool", also the dialog titles need to match the menu
entries.
Unrelated:
* libgimpwidgets/gimpwidgets.c: the recently changed, gtk-doc
comment was correct, as gtk-doc takes the parameter names from
the header, not the .c file.
* app/tools/gimptransformtool.c: set the transform tool's state to
TRANSFORM_CREATING after changing displays, so the initial matrix
components are saved correctly for the "Reset" function.
2002-09-01 16:44:57 +08:00
|
|
|
NULL);
|
2002-02-07 19:50:16 +08:00
|
|
|
|
GimpViewableDialogs everywhere, cleanup:
2002-09-01 Michael Natterer <mitch@gimp.org>
GimpViewableDialogs everywhere, cleanup:
* libgimpwidgets/gimpstock.c: added texts for the RESIZE, SCALE
and CROP stock items.
* app/widgets/gimpviewabledialog.c: update the title when the
viewable's name changes.
* app/gui/color-notebook.[ch]: added color_notebook_viewable_new()
which creates a GimpViewableDialog.
* app/widgets/gimpgradienteditor.[ch]
* app/gui/colormap-editor-commands.c
* app/gui/file-new-dialog.c
* app/gui/gradient-editor-commands.c
* app/gui/palette-editor-commands.c
* app/undo_history.c: use GimpViewableDialogs and the new
color_notebook constructor.
* app/gui/convert-dialog.c: #include "widgets/gimpviewabledialog.h"
* app/gui/image-commands.c
* app/gui/info-dialog.c
* app/gui/resize-dialog.c: minor cleanups.
* app/gui/info-window.c: cleaned up the whole thing, esp. the
"Extended" page. Added HSV color display to the color picker
frame. Set the icons as frame titles, stuff...
* app/tools/gimpimagemaptool.[ch]: removed "shell_title",
"shell_name" and "stock_id" from the GimpImageMapTool struct
because they can be obtained from the tool's GimpToolInfo object.
* app/tools/gimpbrightnesscontrasttool.c
* app/tools/gimpcolorbalancetool.c
* app/tools/gimpcurvestool.c
* app/tools/gimphuesaturationtool.c
* app/tools/gimplevelstool.c
* app/tools/gimpposterizetool.c
* app/tools/gimpthresholdtool.c: changed accordingly.
* app/tools/gimphistogramtool.c: same here: take values from
tool->tool_info instead of hardcoding them.
* app/tools/gimpcroptool.[ch]: removed the static crop dialog
variables and added them to the GimpCropTool struct. Feels safer
and makes the callback code much simpler. Use stock items for the
dialog's "Resize" and "Crop" buttons.
* app/tools/gimpmeasuretool.c
* app/tools/gimprotatetool.c: for consistency don't name the tools
"Blah Tool", also the dialog titles need to match the menu
entries.
Unrelated:
* libgimpwidgets/gimpwidgets.c: the recently changed, gtk-doc
comment was correct, as gtk-doc takes the parameter names from
the header, not the .c file.
* app/tools/gimptransformtool.c: set the transform tool's state to
TRANSFORM_CREATING after changing displays, so the initial matrix
components are saved correctly for the "Reset" function.
2002-09-01 16:44:57 +08:00
|
|
|
gtk_window_set_resizable (GTK_WINDOW (info->dialog), FALSE);
|
1998-06-09 05:53:45 +08:00
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
/* vbox holding the rest of the dialog */
|
2002-09-08 00:47:39 +08:00
|
|
|
main_vbox = gtk_vbox_new (FALSE, 4);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 4);
|
2001-08-01 07:28:56 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (info->dialog)->vbox),
|
2002-09-08 00:47:39 +08:00
|
|
|
main_vbox, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (main_vbox);
|
1999-04-03 03:46:59 +08:00
|
|
|
|
2003-04-04 01:50:56 +08:00
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
label = gtk_label_new_with_mnemonic (_("From _Template:"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
2003-04-04 23:11:30 +08:00
|
|
|
optionmenu = gtk_option_menu_new ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), optionmenu, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (optionmenu);
|
2003-04-04 01:50:56 +08:00
|
|
|
|
2003-04-04 23:11:30 +08:00
|
|
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), optionmenu);
|
2003-04-04 01:50:56 +08:00
|
|
|
|
2003-04-05 05:16:58 +08:00
|
|
|
info->template_menu = gimp_container_menu_new (gimp->templates, NULL, 16, 0);
|
2003-04-04 23:11:30 +08:00
|
|
|
gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), info->template_menu);
|
|
|
|
gtk_widget_show (info->template_menu);
|
2003-04-04 01:50:56 +08:00
|
|
|
|
2003-04-04 23:11:30 +08:00
|
|
|
gimp_container_menu_select_item (GIMP_CONTAINER_MENU (info->template_menu),
|
2003-04-04 01:50:56 +08:00
|
|
|
NULL);
|
|
|
|
|
2003-04-04 23:11:30 +08:00
|
|
|
g_signal_connect (info->template_menu, "select_item",
|
2003-04-04 01:50:56 +08:00
|
|
|
G_CALLBACK (file_new_template_select),
|
|
|
|
info);
|
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
/* Image size frame */
|
2002-01-27 23:07:41 +08:00
|
|
|
frame = gtk_frame_new (_("Image Size"));
|
2002-09-08 00:47:39 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
|
2002-01-27 23:07:41 +08:00
|
|
|
gtk_widget_show (frame);
|
1999-05-19 01:33:39 +08:00
|
|
|
|
|
|
|
vbox = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
2002-01-27 23:07:41 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
1999-05-19 01:33:39 +08:00
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
|
|
|
table = gtk_table_new (7, 2, FALSE);
|
|
|
|
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
2002-09-08 00:47:39 +08:00
|
|
|
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
1999-05-19 01:33:39 +08:00
|
|
|
gtk_table_set_row_spacing (GTK_TABLE (table), 1, 4);
|
|
|
|
gtk_table_set_row_spacing (GTK_TABLE (table), 2, 4);
|
|
|
|
gtk_table_set_row_spacing (GTK_TABLE (table), 4, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (table);
|
|
|
|
|
|
|
|
/* the pixel size labels */
|
|
|
|
label = gtk_label_new (_("Width:"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("Height:"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
|
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
/* a separator after the pixel section */
|
|
|
|
separator = gtk_hseparator_new ();
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), separator, 0, 2, 2, 3);
|
|
|
|
gtk_widget_show (separator);
|
|
|
|
|
|
|
|
/* the unit size labels */
|
|
|
|
label = gtk_label_new (_("Width:"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4,
|
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("Height:"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 4, 5,
|
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
/* create the sizeentry which keeps it all together */
|
|
|
|
abox = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 3, 5);
|
2002-09-08 00:47:39 +08:00
|
|
|
gtk_widget_show (abox);
|
|
|
|
|
2003-04-04 01:50:56 +08:00
|
|
|
info->size_se = gimp_size_entry_new (0, info->template->unit, "%a",
|
2002-09-08 00:47:39 +08:00
|
|
|
FALSE, FALSE, TRUE, SB_WIDTH,
|
|
|
|
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
|
|
|
gtk_table_set_col_spacing (GTK_TABLE (info->size_se), 1, 4);
|
|
|
|
gtk_table_set_row_spacing (GTK_TABLE (info->size_se), 1, 2);
|
1999-08-26 12:39:21 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (abox), info->size_se);
|
|
|
|
gtk_widget_show (info->size_se);
|
1999-05-19 01:33:39 +08:00
|
|
|
|
|
|
|
/* height in units */
|
2002-09-08 00:47:39 +08:00
|
|
|
spinbutton = gimp_spin_button_new (&adjustment,
|
|
|
|
1, 1, 1, 1, 10, 0,
|
|
|
|
1, 2);
|
|
|
|
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
|
1999-05-19 01:33:39 +08:00
|
|
|
/* add the "height in units" spinbutton to the sizeentry */
|
1999-08-26 12:39:21 +08:00
|
|
|
gtk_table_attach_defaults (GTK_TABLE (info->size_se), spinbutton,
|
1999-05-19 01:33:39 +08:00
|
|
|
0, 1, 2, 3);
|
|
|
|
gtk_widget_show (spinbutton);
|
|
|
|
|
|
|
|
/* height in pixels */
|
2002-09-08 00:47:39 +08:00
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
|
|
|
|
spinbutton2 = gimp_spin_button_new (&adjustment,
|
|
|
|
1, 1, 1, 1, 10, 0,
|
|
|
|
1, 0);
|
|
|
|
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton2), SB_WIDTH);
|
1999-05-19 01:33:39 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), spinbutton2, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (spinbutton2);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("Pixels"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
2002-01-27 23:07:41 +08:00
|
|
|
info->memsize_label = gtk_label_new (NULL);
|
|
|
|
gtk_box_pack_end (GTK_BOX (hbox), info->memsize_label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (info->memsize_label);
|
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
/* add the "height in pixels" spinbutton to the main table */
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), hbox, 1, 2, 1, 2);
|
1999-04-03 03:46:59 +08:00
|
|
|
gtk_widget_show (hbox);
|
1998-06-09 05:53:45 +08:00
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
/* register the height spinbuttons with the sizeentry */
|
1999-08-26 12:39:21 +08:00
|
|
|
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (info->size_se),
|
1999-05-19 01:33:39 +08:00
|
|
|
GTK_SPIN_BUTTON (spinbutton),
|
|
|
|
GTK_SPIN_BUTTON (spinbutton2));
|
|
|
|
|
|
|
|
/* width in units */
|
2002-09-08 00:47:39 +08:00
|
|
|
spinbutton = gimp_spin_button_new (&adjustment,
|
|
|
|
1, 1, 1, 1, 10, 0,
|
|
|
|
1, 2);
|
|
|
|
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
|
1999-05-19 01:33:39 +08:00
|
|
|
/* add the "width in units" spinbutton to the sizeentry */
|
1999-08-26 12:39:21 +08:00
|
|
|
gtk_table_attach_defaults (GTK_TABLE (info->size_se), spinbutton,
|
1999-05-19 01:33:39 +08:00
|
|
|
0, 1, 1, 2);
|
|
|
|
gtk_widget_show (spinbutton);
|
|
|
|
|
|
|
|
/* width in pixels */
|
|
|
|
abox = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 0, 1);
|
2002-09-08 00:47:39 +08:00
|
|
|
gtk_widget_show (abox);
|
|
|
|
|
|
|
|
spinbutton2 = gimp_spin_button_new (&adjustment,
|
|
|
|
1, 1, 1, 1, 10, 0,
|
|
|
|
1, 0);
|
|
|
|
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton2), SB_WIDTH);
|
1999-05-19 01:33:39 +08:00
|
|
|
/* add the "width in pixels" spinbutton to the main table */
|
|
|
|
gtk_container_add (GTK_CONTAINER (abox), spinbutton2);
|
|
|
|
gtk_widget_show (spinbutton2);
|
|
|
|
|
|
|
|
/* register the width spinbuttons with the sizeentry */
|
1999-08-26 12:39:21 +08:00
|
|
|
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (info->size_se),
|
1999-05-19 01:33:39 +08:00
|
|
|
GTK_SPIN_BUTTON (spinbutton),
|
|
|
|
GTK_SPIN_BUTTON (spinbutton2));
|
|
|
|
|
|
|
|
/* initialize the sizeentry */
|
2003-04-04 01:50:56 +08:00
|
|
|
gimp_prop_size_entry_connect (G_OBJECT (info->template),
|
|
|
|
"width", "height", "unit",
|
|
|
|
info->size_se, NULL,
|
|
|
|
info->template->xresolution,
|
|
|
|
info->template->yresolution);
|
1999-05-19 01:33:39 +08:00
|
|
|
|
|
|
|
/* the resolution labels */
|
|
|
|
label = gtk_label_new (_("Resolution X:"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 5, 6,
|
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("Y:"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 6, 7,
|
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
/* the resolution sizeentry */
|
2002-09-08 00:47:39 +08:00
|
|
|
abox = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 5, 7);
|
|
|
|
gtk_widget_show (abox);
|
|
|
|
|
|
|
|
spinbutton = gimp_spin_button_new (&adjustment,
|
|
|
|
1, 1, 1, 1, 10, 0,
|
|
|
|
1, 2);
|
|
|
|
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
|
1999-05-19 01:33:39 +08:00
|
|
|
|
2003-04-04 23:11:30 +08:00
|
|
|
info->resolution_se = gimp_size_entry_new (1, info->template->resolution_unit,
|
|
|
|
_("pixels/%a"),
|
|
|
|
FALSE, FALSE, FALSE, SB_WIDTH,
|
|
|
|
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
1999-08-26 12:39:21 +08:00
|
|
|
gtk_table_set_col_spacing (GTK_TABLE (info->resolution_se), 1, 2);
|
|
|
|
gtk_table_set_col_spacing (GTK_TABLE (info->resolution_se), 2, 2);
|
2002-09-08 00:47:39 +08:00
|
|
|
gtk_table_set_row_spacing (GTK_TABLE (info->resolution_se), 0, 2);
|
|
|
|
|
1999-08-26 12:39:21 +08:00
|
|
|
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (info->resolution_se),
|
1999-05-19 01:33:39 +08:00
|
|
|
GTK_SPIN_BUTTON (spinbutton), NULL);
|
1999-08-26 12:39:21 +08:00
|
|
|
gtk_table_attach_defaults (GTK_TABLE (info->resolution_se), spinbutton,
|
1999-05-19 01:33:39 +08:00
|
|
|
1, 2, 0, 1);
|
|
|
|
gtk_widget_show (spinbutton);
|
2002-02-07 19:50:16 +08:00
|
|
|
|
2003-04-04 01:50:56 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (abox), info->resolution_se);
|
1999-08-26 12:39:21 +08:00
|
|
|
gtk_widget_show (info->resolution_se);
|
1999-05-19 01:33:39 +08:00
|
|
|
|
|
|
|
/* the resolution chainbutton */
|
2003-04-04 23:11:30 +08:00
|
|
|
chainbutton = gimp_chain_button_new (GIMP_CHAIN_RIGHT);
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (info->resolution_se), chainbutton,
|
|
|
|
2, 3, 0, 2);
|
|
|
|
gtk_widget_show (chainbutton);
|
1999-02-25 19:25:53 +08:00
|
|
|
|
2003-04-04 01:50:56 +08:00
|
|
|
gimp_prop_size_entry_connect (G_OBJECT (info->template),
|
|
|
|
"xresolution", "yresolution",
|
|
|
|
"resolution-unit",
|
2003-04-04 23:11:30 +08:00
|
|
|
info->resolution_se, chainbutton,
|
2003-04-04 01:50:56 +08:00
|
|
|
1.0, 1.0);
|
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
/* hbox containing the Image type and fill type frames */
|
2002-09-08 00:47:39 +08:00
|
|
|
hbox = gtk_hbox_new (FALSE, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0);
|
1999-05-19 01:33:39 +08:00
|
|
|
gtk_widget_show (hbox);
|
1998-06-09 05:53:45 +08:00
|
|
|
|
1999-05-31 22:11:10 +08:00
|
|
|
/* frame for Image Type */
|
2003-04-04 01:50:56 +08:00
|
|
|
frame = gimp_prop_enum_radio_frame_new (G_OBJECT (info->template),
|
|
|
|
"image-type",
|
|
|
|
_("Image Type"),
|
|
|
|
GIMP_RGB, GIMP_GRAY);
|
1998-06-09 05:53:45 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
/* frame for Fill Type */
|
2003-04-04 01:50:56 +08:00
|
|
|
frame = gimp_prop_enum_radio_frame_new (G_OBJECT (info->template),
|
|
|
|
"fill-type",
|
|
|
|
_("Fill Type"),
|
|
|
|
-1, -1);
|
1998-06-09 05:53:45 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
1999-08-26 12:39:21 +08:00
|
|
|
gimp_size_entry_grab_focus (GIMP_SIZE_ENTRY (info->size_se));
|
1998-06-09 05:53:45 +08:00
|
|
|
|
2003-04-04 23:11:30 +08:00
|
|
|
/* update the size label */
|
|
|
|
file_new_template_notify (info->template, NULL, info);
|
|
|
|
|
2001-08-01 07:28:56 +08:00
|
|
|
gtk_widget_show (info->dialog);
|
1998-06-18 13:04:01 +08:00
|
|
|
}
|
2001-10-29 19:47:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
|
|
|
static void
|
2003-04-04 01:50:56 +08:00
|
|
|
file_new_ok_callback (GtkWidget *widget,
|
|
|
|
NewImageInfo *info)
|
2001-10-29 19:47:11 +08:00
|
|
|
{
|
2003-04-04 23:11:30 +08:00
|
|
|
if (info->memsize > GIMP_GUI_CONFIG (info->gimp->config)->max_new_image_size)
|
2001-10-29 19:47:11 +08:00
|
|
|
{
|
|
|
|
file_new_confirm_dialog (info);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gtk_widget_destroy (info->dialog);
|
2003-04-04 23:11:30 +08:00
|
|
|
gimp_template_create_image (info->gimp, info->template);
|
|
|
|
gimp_image_new_set_last_template (info->gimp, info->template);
|
2003-04-04 01:50:56 +08:00
|
|
|
g_object_unref (info->template);
|
2001-10-29 19:47:11 +08:00
|
|
|
g_free (info);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-04-04 01:50:56 +08:00
|
|
|
file_new_cancel_callback (GtkWidget *widget,
|
|
|
|
NewImageInfo *info)
|
2001-10-29 19:47:11 +08:00
|
|
|
{
|
2003-04-04 01:50:56 +08:00
|
|
|
gtk_widget_destroy (info->dialog);
|
|
|
|
g_object_unref (info->template);
|
|
|
|
g_free (info);
|
2001-10-29 19:47:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-04-04 01:50:56 +08:00
|
|
|
file_new_reset_callback (GtkWidget *widget,
|
|
|
|
NewImageInfo *info)
|
2001-10-29 19:47:11 +08:00
|
|
|
{
|
2003-04-04 23:11:30 +08:00
|
|
|
g_signal_handlers_disconnect_by_func (info->template,
|
|
|
|
file_new_template_notify,
|
|
|
|
info);
|
2001-10-29 19:47:11 +08:00
|
|
|
|
2003-04-04 23:11:30 +08:00
|
|
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (info->size_se), 0,
|
|
|
|
info->gimp->config->default_xresolution,
|
|
|
|
FALSE);
|
|
|
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (info->size_se), 1,
|
|
|
|
info->gimp->config->default_yresolution,
|
|
|
|
FALSE);
|
2001-10-29 19:47:11 +08:00
|
|
|
|
2003-04-04 01:50:56 +08:00
|
|
|
gimp_template_set_from_config (info->template, info->gimp->config);
|
|
|
|
|
|
|
|
g_object_set (info->template,
|
|
|
|
"fill-type", GIMP_BACKGROUND_FILL,
|
|
|
|
NULL);
|
2003-04-04 23:11:30 +08:00
|
|
|
gimp_container_menu_select_item (GIMP_CONTAINER_MENU (info->template_menu),
|
2003-04-04 01:50:56 +08:00
|
|
|
NULL);
|
2003-04-04 23:11:30 +08:00
|
|
|
|
|
|
|
g_signal_connect (info->template, "notify",
|
|
|
|
G_CALLBACK (file_new_template_notify),
|
|
|
|
info);
|
|
|
|
file_new_template_notify (info->template, NULL, info);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
file_new_template_notify (GimpTemplate *template,
|
|
|
|
GParamSpec *param_spec,
|
|
|
|
NewImageInfo *info)
|
|
|
|
{
|
|
|
|
if (param_spec)
|
|
|
|
{
|
|
|
|
if (! strcmp (param_spec->name, "xresolution"))
|
|
|
|
{
|
|
|
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (info->size_se), 0,
|
|
|
|
template->xresolution, FALSE);
|
|
|
|
}
|
|
|
|
else if (! strcmp (param_spec->name, "yresolution"))
|
|
|
|
{
|
|
|
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (info->size_se), 1,
|
|
|
|
template->yresolution, FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (info->memsize != template->initial_size)
|
|
|
|
{
|
|
|
|
gchar *text;
|
|
|
|
|
|
|
|
info->memsize = template->initial_size;
|
|
|
|
|
|
|
|
if (template->initial_size_too_large)
|
|
|
|
text = g_strdup (_("Too large!"));
|
|
|
|
else
|
|
|
|
text = gimp_memsize_to_string (info->memsize);
|
|
|
|
|
|
|
|
gtk_label_set_text (GTK_LABEL (info->memsize_label), text);
|
|
|
|
g_free (text);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (info->ok_button,
|
|
|
|
! template->initial_size_too_large);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
file_new_template_select (GimpContainerMenu *menu,
|
|
|
|
GimpTemplate *template,
|
|
|
|
gpointer insert_data,
|
|
|
|
NewImageInfo *info)
|
|
|
|
{
|
|
|
|
if (template)
|
|
|
|
{
|
|
|
|
g_signal_handlers_disconnect_by_func (info->template,
|
|
|
|
file_new_template_notify,
|
|
|
|
info);
|
|
|
|
|
|
|
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (info->size_se), 0,
|
|
|
|
template->xresolution, FALSE);
|
|
|
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (info->size_se), 1,
|
|
|
|
template->yresolution, FALSE);
|
|
|
|
|
|
|
|
gimp_config_copy_properties (G_OBJECT (template),
|
|
|
|
G_OBJECT (info->template));
|
|
|
|
|
|
|
|
g_signal_connect (info->template, "notify",
|
|
|
|
G_CALLBACK (file_new_template_notify),
|
|
|
|
info);
|
|
|
|
file_new_template_notify (info->template, NULL, info);
|
|
|
|
}
|
2001-10-29 19:47:11 +08:00
|
|
|
}
|
|
|
|
|
2003-04-04 23:11:30 +08:00
|
|
|
|
|
|
|
/* the confirm dialog */
|
|
|
|
|
2001-10-29 19:47:11 +08:00
|
|
|
static void
|
|
|
|
file_new_confirm_dialog_callback (GtkWidget *widget,
|
|
|
|
gboolean create,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2003-04-04 01:50:56 +08:00
|
|
|
NewImageInfo *info = (NewImageInfo*) data;
|
2001-10-29 19:47:11 +08:00
|
|
|
|
|
|
|
info->confirm_dialog = NULL;
|
|
|
|
|
|
|
|
if (create)
|
|
|
|
{
|
|
|
|
gtk_widget_destroy (info->dialog);
|
2003-04-04 23:11:30 +08:00
|
|
|
gimp_template_create_image (info->gimp, info->template);
|
|
|
|
gimp_image_new_set_last_template (info->gimp, info->template);
|
2003-04-04 01:50:56 +08:00
|
|
|
g_object_unref (info->template);
|
2001-10-29 19:47:11 +08:00
|
|
|
g_free (info);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gtk_widget_set_sensitive (info->dialog, TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
file_new_confirm_dialog (NewImageInfo *info)
|
|
|
|
{
|
2003-04-04 23:11:30 +08:00
|
|
|
gchar *size_str;
|
|
|
|
gchar *max_size_str;
|
2001-10-29 19:47:11 +08:00
|
|
|
gchar *text;
|
|
|
|
|
2003-04-04 23:11:30 +08:00
|
|
|
size_str = gimp_memsize_to_string (info->memsize);
|
|
|
|
max_size_str = gimp_memsize_to_string (GIMP_GUI_CONFIG (info->gimp->config)->max_new_image_size);
|
2001-10-29 19:47:11 +08:00
|
|
|
|
2001-11-27 01:12:29 +08:00
|
|
|
text = g_strdup_printf (_("You are trying to create an image with\n"
|
|
|
|
"an initial size of %s.\n\n"
|
2001-10-29 19:47:11 +08:00
|
|
|
"Choose OK to create this image anyway.\n"
|
2001-11-27 01:12:29 +08:00
|
|
|
"Choose Cancel if you did not intend to\n"
|
2001-10-29 19:47:11 +08:00
|
|
|
"create such a large image.\n\n"
|
|
|
|
"To prevent this dialog from appearing,\n"
|
|
|
|
"increase the \"Maximum Image Size\"\n"
|
|
|
|
"setting (currently %s) in the\n"
|
2001-11-27 01:12:29 +08:00
|
|
|
"Preferences dialog."),
|
2003-04-04 23:11:30 +08:00
|
|
|
size_str, max_size_str);
|
|
|
|
|
|
|
|
g_free (size_str);
|
|
|
|
g_free (max_size_str);
|
2001-10-29 19:47:11 +08:00
|
|
|
|
|
|
|
info->confirm_dialog =
|
|
|
|
gimp_query_boolean_box (_("Confirm Image Size"),
|
|
|
|
gimp_standard_help_func,
|
|
|
|
"dialogs/file_new.html#confirm_size",
|
2003-03-07 00:47:34 +08:00
|
|
|
GIMP_STOCK_INFO,
|
2001-10-29 19:47:11 +08:00
|
|
|
text,
|
|
|
|
GTK_STOCK_OK, GTK_STOCK_CANCEL,
|
|
|
|
NULL, NULL,
|
|
|
|
file_new_confirm_dialog_callback,
|
|
|
|
info);
|
|
|
|
|
|
|
|
g_free (text);
|
|
|
|
|
2003-03-20 22:34:16 +08:00
|
|
|
gtk_window_set_transient_for (GTK_WINDOW (info->confirm_dialog),
|
|
|
|
GTK_WINDOW (info->dialog));
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (info->dialog, FALSE);
|
|
|
|
|
2001-10-29 19:47:11 +08:00
|
|
|
gtk_widget_show (info->confirm_dialog);
|
|
|
|
}
|