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.
|
|
|
|
*/
|
1998-06-09 05:53:45 +08:00
|
|
|
#include "appenv.h"
|
|
|
|
#include "actionarea.h"
|
|
|
|
#include "commands.h"
|
1998-06-13 03:43:55 +08:00
|
|
|
#include "gimage.h"
|
1998-06-09 05:53:45 +08:00
|
|
|
#include "gimprc.h"
|
1998-06-13 03:43:55 +08:00
|
|
|
#include "global_edit.h"
|
1998-06-09 05:53:45 +08:00
|
|
|
#include "interface.h"
|
1999-06-07 01:26:51 +08:00
|
|
|
#include "lc_dialog.h"
|
1998-06-09 05:53:45 +08:00
|
|
|
#include "plug_in.h"
|
1998-06-13 03:43:55 +08:00
|
|
|
#include "tile_manager_pvt.h"
|
1998-08-16 08:34:20 +08:00
|
|
|
#include "gdisplay.h"
|
1998-06-09 05:53:45 +08:00
|
|
|
|
1999-04-03 03:46:59 +08:00
|
|
|
#include "libgimp/gimpchainbutton.h"
|
1999-05-10 00:38:05 +08:00
|
|
|
#include "libgimp/gimplimits.h"
|
1999-04-03 03:46:59 +08:00
|
|
|
#include "libgimp/gimpsizeentry.h"
|
1999-05-10 00:38:05 +08:00
|
|
|
#include "libgimp/gimpintl.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
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
typedef struct
|
|
|
|
{
|
1998-06-09 05:53:45 +08:00
|
|
|
GtkWidget *dlg;
|
1999-02-25 19:25:53 +08:00
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
GtkWidget *confirm_dlg;
|
|
|
|
|
|
|
|
GtkWidget *size_frame;
|
|
|
|
GtkWidget *size_se;
|
|
|
|
GtkWidget *resolution_se;
|
1999-03-02 08:31:39 +08:00
|
|
|
GtkWidget *couple_resolutions;
|
1999-02-25 19:25:53 +08:00
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
GtkWidget *type_w[2];
|
|
|
|
GtkWidget *fill_type_w[4];
|
|
|
|
|
|
|
|
gint width;
|
|
|
|
gint height;
|
1999-02-25 19:25:53 +08:00
|
|
|
GUnit unit;
|
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
gdouble xresolution;
|
|
|
|
gdouble yresolution;
|
1999-02-25 19:25:53 +08:00
|
|
|
GUnit res_unit;
|
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
gdouble size; /* in bytes */
|
|
|
|
|
|
|
|
gint type;
|
|
|
|
gint fill_type;
|
1998-06-09 05:53:45 +08:00
|
|
|
} NewImageValues;
|
|
|
|
|
|
|
|
/* new image local functions */
|
1999-05-19 01:33:39 +08:00
|
|
|
static void file_new_create_image (NewImageValues *);
|
|
|
|
static void file_new_confirm_dialog (NewImageValues *);
|
|
|
|
static gchar * file_new_print_size (gdouble);
|
|
|
|
|
1998-06-09 05:53:45 +08:00
|
|
|
static void file_new_ok_callback (GtkWidget *, gpointer);
|
1999-05-19 01:33:39 +08:00
|
|
|
static void file_new_reset_callback (GtkWidget *, gpointer);
|
1998-06-09 05:53:45 +08:00
|
|
|
static gint file_new_delete_callback (GtkWidget *, GdkEvent *, gpointer);
|
1999-05-19 01:33:39 +08:00
|
|
|
static void file_new_cancel_callback (GtkWidget *, gpointer);
|
1998-06-09 05:53:45 +08:00
|
|
|
static void file_new_toggle_callback (GtkWidget *, gpointer);
|
|
|
|
static void file_new_resolution_callback (GtkWidget *, gpointer);
|
1999-05-19 01:33:39 +08:00
|
|
|
static void file_new_image_size_callback (GtkWidget *, gpointer);
|
1998-06-09 05:53:45 +08:00
|
|
|
|
|
|
|
/* static variables */
|
1999-05-19 01:33:39 +08:00
|
|
|
static gint last_width = 256;
|
|
|
|
static gint last_height = 256;
|
|
|
|
static GUnit last_unit = UNIT_INCH;
|
1998-06-09 05:53:45 +08:00
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
static gdouble last_xresolution = 72.0;
|
|
|
|
static gdouble last_yresolution = 72.0;
|
|
|
|
static GUnit last_res_unit = UNIT_INCH;
|
1998-06-09 05:53:45 +08:00
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
static gint last_type = RGB;
|
|
|
|
static gint last_fill_type = BACKGROUND_FILL;
|
1998-10-19 04:38:36 +08:00
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
static gboolean last_new_image = FALSE;
|
|
|
|
static gboolean new_dialog_run = FALSE;
|
1998-06-14 04:57:23 +08:00
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
extern TileManager *global_buf;
|
1998-06-14 04:57:23 +08:00
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
/* functions */
|
|
|
|
static void
|
|
|
|
file_new_create_image (NewImageValues *vals)
|
|
|
|
{
|
|
|
|
GImage *gimage;
|
|
|
|
GDisplay *gdisplay;
|
|
|
|
Layer *layer;
|
|
|
|
gint type;
|
1998-06-09 05:53:45 +08:00
|
|
|
|
|
|
|
last_width = vals->width;
|
|
|
|
last_height = vals->height;
|
|
|
|
last_type = vals->type;
|
|
|
|
last_fill_type = vals->fill_type;
|
1999-02-25 19:25:53 +08:00
|
|
|
last_xresolution = vals->xresolution;
|
|
|
|
last_yresolution = vals->yresolution;
|
1998-06-09 05:53:45 +08:00
|
|
|
last_unit = vals->unit;
|
1998-06-10 05:21:23 +08:00
|
|
|
last_res_unit = vals->res_unit;
|
1999-04-03 03:46:59 +08:00
|
|
|
last_new_image = TRUE;
|
1999-05-19 01:33:39 +08:00
|
|
|
|
1998-06-09 05:53:45 +08:00
|
|
|
switch (vals->fill_type)
|
|
|
|
{
|
|
|
|
case BACKGROUND_FILL:
|
1998-07-14 13:35:42 +08:00
|
|
|
case FOREGROUND_FILL:
|
1998-06-09 05:53:45 +08:00
|
|
|
case WHITE_FILL:
|
|
|
|
type = (vals->type == RGB) ? RGB_GIMAGE : GRAY_GIMAGE;
|
|
|
|
break;
|
|
|
|
case TRANSPARENT_FILL:
|
|
|
|
type = (vals->type == RGB) ? RGBA_GIMAGE : GRAYA_GIMAGE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
type = RGB_IMAGE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
gimage = gimage_new (vals->width, vals->height, vals->type);
|
|
|
|
|
1999-02-25 19:25:53 +08:00
|
|
|
gimp_image_set_resolution (gimage, vals->xresolution, vals->yresolution);
|
|
|
|
gimp_image_set_unit (gimage, vals->unit);
|
1998-10-05 18:05:29 +08:00
|
|
|
|
1998-06-09 05:53:45 +08:00
|
|
|
/* Make the background (or first) layer */
|
1998-06-29 08:24:44 +08:00
|
|
|
layer = layer_new (gimage, gimage->width, gimage->height,
|
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
|
|
|
type, _("Background"), OPAQUE_OPACITY, NORMAL);
|
1998-06-09 05:53:45 +08:00
|
|
|
|
1999-04-03 03:46:59 +08:00
|
|
|
if (layer)
|
|
|
|
{
|
|
|
|
/* add the new layer to the gimage */
|
|
|
|
gimage_disable_undo (gimage);
|
|
|
|
gimage_add_layer (gimage, layer, 0);
|
|
|
|
gimage_enable_undo (gimage);
|
|
|
|
|
|
|
|
drawable_fill (GIMP_DRAWABLE(layer), vals->fill_type);
|
|
|
|
|
|
|
|
gimage_clean_all (gimage);
|
|
|
|
|
|
|
|
gdisplay = gdisplay_new (gimage, 0x0101);
|
1999-06-07 01:26:51 +08:00
|
|
|
|
1999-06-21 07:29:34 +08:00
|
|
|
gimp_context_set_display (gimp_context_get_user (), gdisplay);
|
1999-04-03 03:46:59 +08:00
|
|
|
}
|
1998-06-09 05:53:45 +08:00
|
|
|
|
|
|
|
g_free (vals);
|
|
|
|
}
|
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
static void
|
|
|
|
file_new_ok_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
NewImageValues *vals;
|
|
|
|
|
|
|
|
vals = data;
|
|
|
|
|
|
|
|
/* get the image size in pixels */
|
1999-05-31 22:11:10 +08:00
|
|
|
vals->width = (int)
|
|
|
|
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 0) + 0.5);
|
|
|
|
vals->height = (int)
|
|
|
|
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 1) + 0.5);
|
1999-05-19 01:33:39 +08:00
|
|
|
|
|
|
|
/* get the resolution in dpi */
|
|
|
|
vals->xresolution =
|
|
|
|
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->resolution_se), 0);
|
|
|
|
vals->yresolution =
|
|
|
|
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->resolution_se), 1);
|
|
|
|
|
|
|
|
/* get the units */
|
|
|
|
vals->unit =
|
|
|
|
gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (vals->size_se));
|
|
|
|
vals->res_unit =
|
|
|
|
gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (vals->resolution_se));
|
|
|
|
|
|
|
|
if (vals->size > max_new_image_size)
|
|
|
|
{
|
|
|
|
file_new_confirm_dialog (vals);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gtk_widget_destroy (vals->dlg);
|
|
|
|
file_new_create_image (vals);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
file_new_reset_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
NewImageValues *vals;
|
|
|
|
|
|
|
|
vals = data;
|
|
|
|
|
|
|
|
gtk_signal_handler_block_by_data (GTK_OBJECT (vals->resolution_se), vals);
|
|
|
|
|
|
|
|
gimp_chain_button_set_active
|
|
|
|
(GIMP_CHAIN_BUTTON (vals->couple_resolutions),
|
|
|
|
ABS (default_xresolution - default_yresolution) < GIMP_MIN_RESOLUTION);
|
|
|
|
|
|
|
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->resolution_se),
|
|
|
|
0, default_xresolution);
|
|
|
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->resolution_se),
|
|
|
|
1, default_yresolution);
|
|
|
|
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (vals->resolution_se),
|
|
|
|
default_resolution_units);
|
|
|
|
|
|
|
|
gtk_signal_handler_unblock_by_data (GTK_OBJECT (vals->resolution_se), vals);
|
|
|
|
|
|
|
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (vals->size_se),
|
|
|
|
0, default_xresolution, TRUE);
|
|
|
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (vals->size_se),
|
|
|
|
1, default_yresolution, TRUE);
|
|
|
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->size_se),
|
|
|
|
0, default_width);
|
|
|
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->size_se),
|
|
|
|
1, default_height);
|
|
|
|
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (vals->size_se),
|
|
|
|
default_units);
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vals->type_w[default_type]),
|
|
|
|
TRUE);
|
|
|
|
gtk_toggle_button_set_active
|
|
|
|
(GTK_TOGGLE_BUTTON (vals->fill_type_w[BACKGROUND_FILL]), TRUE);
|
|
|
|
}
|
|
|
|
|
1998-06-09 05:53:45 +08:00
|
|
|
static gint
|
|
|
|
file_new_delete_callback (GtkWidget *widget,
|
1999-04-03 03:46:59 +08:00
|
|
|
GdkEvent *event,
|
|
|
|
gpointer data)
|
1998-06-09 05:53:45 +08:00
|
|
|
{
|
|
|
|
file_new_cancel_callback (widget, data);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
file_new_cancel_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
NewImageValues *vals;
|
|
|
|
|
|
|
|
vals = data;
|
|
|
|
|
|
|
|
gtk_widget_destroy (vals->dlg);
|
|
|
|
g_free (vals);
|
|
|
|
}
|
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
/* local callbacks of file_new_confirm_dialog() */
|
|
|
|
static void
|
|
|
|
file_new_confirm_dialog_ok_callback (GtkWidget *widget,
|
|
|
|
NewImageValues *vals)
|
|
|
|
{
|
|
|
|
gtk_widget_destroy (vals->confirm_dlg);
|
|
|
|
gtk_widget_destroy (vals->dlg);
|
|
|
|
file_new_create_image (vals);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
file_new_confirm_dialog_cancel_callback (GtkWidget *widget,
|
|
|
|
NewImageValues *vals)
|
|
|
|
{
|
|
|
|
gtk_widget_destroy (vals->confirm_dlg);
|
|
|
|
vals->confirm_dlg = NULL;
|
|
|
|
gtk_widget_set_sensitive (vals->dlg, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
file_new_confirm_dialog_delete_callback (GtkWidget *widget,
|
|
|
|
GdkEvent *event,
|
|
|
|
NewImageValues *vals)
|
|
|
|
{
|
|
|
|
file_new_confirm_dialog_cancel_callback (widget, vals);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
file_new_confirm_dialog (NewImageValues *vals)
|
|
|
|
{
|
|
|
|
GtkWidget *label;
|
|
|
|
gchar *size;
|
|
|
|
gchar *max_size;
|
|
|
|
gchar *text;
|
|
|
|
|
|
|
|
static ActionAreaItem action_items[] =
|
|
|
|
{
|
|
|
|
{ N_("OK"),
|
|
|
|
(ActionCallback) file_new_confirm_dialog_ok_callback, NULL, NULL },
|
|
|
|
{ N_("Cancel"),
|
|
|
|
(ActionCallback) file_new_confirm_dialog_cancel_callback, NULL, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (vals->dlg, FALSE);
|
|
|
|
|
|
|
|
vals->confirm_dlg = gtk_dialog_new ();
|
|
|
|
gtk_window_set_wmclass (GTK_WINDOW (vals->confirm_dlg),
|
1999-05-23 01:56:35 +08:00
|
|
|
"confirm_size", "Gimp");
|
1999-05-19 01:33:39 +08:00
|
|
|
gtk_window_set_title (GTK_WINDOW (vals->confirm_dlg), _("Confirm Image Size"));
|
1999-05-23 01:56:35 +08:00
|
|
|
gtk_window_set_policy (GTK_WINDOW (vals->confirm_dlg), FALSE, FALSE, FALSE);
|
1999-05-19 01:33:39 +08:00
|
|
|
gtk_window_position (GTK_WINDOW (vals->confirm_dlg), GTK_WIN_POS_MOUSE);
|
|
|
|
|
|
|
|
/* Handle the wm close signal */
|
|
|
|
gtk_signal_connect (GTK_OBJECT (vals->confirm_dlg), "delete_event",
|
|
|
|
(GtkSignalFunc) file_new_confirm_dialog_delete_callback,
|
|
|
|
vals);
|
|
|
|
|
|
|
|
/* The action area */
|
|
|
|
action_items[0].user_data = vals;
|
|
|
|
action_items[1].user_data = vals;
|
|
|
|
build_action_area (GTK_DIALOG (vals->confirm_dlg), action_items, 2, 0);
|
|
|
|
|
|
|
|
text = g_strdup_printf (_("You are trying to create an image which\n"
|
|
|
|
"has an initial size of %s.\n\n"
|
|
|
|
"Choose OK to create this image anyway.\n"
|
|
|
|
"Choose Cancel if you didn't mean to\n"
|
|
|
|
"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"
|
|
|
|
"preferences dialog."),
|
|
|
|
size = file_new_print_size (vals->size),
|
|
|
|
max_size = file_new_print_size (max_new_image_size));
|
|
|
|
label = gtk_label_new (text);
|
|
|
|
gtk_misc_set_padding (GTK_MISC (label), 6, 6);
|
|
|
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (vals->confirm_dlg)->vbox), label,
|
|
|
|
TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
g_free (text);
|
|
|
|
g_free (max_size);
|
|
|
|
g_free (size);
|
|
|
|
|
|
|
|
gtk_widget_show (vals->confirm_dlg);
|
|
|
|
}
|
|
|
|
|
1998-06-09 05:53:45 +08:00
|
|
|
static void
|
|
|
|
file_new_toggle_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
1999-05-19 01:33:39 +08:00
|
|
|
gint *val;
|
1998-06-09 05:53:45 +08:00
|
|
|
|
|
|
|
if (GTK_TOGGLE_BUTTON (widget)->active)
|
|
|
|
{
|
|
|
|
val = data;
|
|
|
|
*val = (long) gtk_object_get_user_data (GTK_OBJECT (widget));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
file_new_resolution_callback (GtkWidget *widget,
|
1999-04-03 03:46:59 +08:00
|
|
|
gpointer data)
|
1998-06-09 05:53:45 +08:00
|
|
|
{
|
|
|
|
NewImageValues *vals;
|
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
static gdouble xres = 0.0;
|
|
|
|
static gdouble yres = 0.0;
|
|
|
|
gdouble new_xres;
|
|
|
|
gdouble new_yres;
|
1998-06-09 05:53:45 +08:00
|
|
|
|
|
|
|
vals = data;
|
|
|
|
|
1999-02-25 19:25:53 +08:00
|
|
|
new_xres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
1999-05-19 01:33:39 +08:00
|
|
|
new_yres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
1998-06-09 05:53:45 +08:00
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
if (gimp_chain_button_get_active
|
|
|
|
(GIMP_CHAIN_BUTTON (vals->couple_resolutions)))
|
1999-02-25 19:25:53 +08:00
|
|
|
{
|
1999-05-19 01:33:39 +08:00
|
|
|
gtk_signal_handler_block_by_data
|
|
|
|
(GTK_OBJECT (vals->resolution_se), vals);
|
|
|
|
|
1999-02-25 19:25:53 +08:00
|
|
|
if (new_xres != xres)
|
|
|
|
{
|
1999-04-03 03:46:59 +08:00
|
|
|
yres = new_yres = xres = new_xres;
|
1999-05-19 01:33:39 +08:00
|
|
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 1, yres);
|
1999-02-25 19:25:53 +08:00
|
|
|
}
|
1999-05-19 01:33:39 +08:00
|
|
|
|
|
|
|
if (new_yres != yres)
|
1999-03-03 20:35:12 +08:00
|
|
|
{
|
1999-05-19 01:33:39 +08:00
|
|
|
xres = new_xres = yres = new_yres;
|
|
|
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 0, xres);
|
1999-03-03 20:35:12 +08:00
|
|
|
}
|
1999-04-03 03:46:59 +08:00
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
gtk_signal_handler_unblock_by_data
|
|
|
|
(GTK_OBJECT (vals->resolution_se), vals);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (new_xres != xres)
|
|
|
|
xres = new_xres;
|
|
|
|
if (new_yres != yres)
|
|
|
|
yres = new_yres;
|
|
|
|
}
|
1999-04-03 03:46:59 +08:00
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (vals->size_se), 0,
|
1999-04-03 03:46:59 +08:00
|
|
|
xres, FALSE);
|
1999-05-19 01:33:39 +08:00
|
|
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (vals->size_se), 1,
|
1999-04-03 03:46:59 +08:00
|
|
|
yres, FALSE);
|
1999-05-19 01:33:39 +08:00
|
|
|
|
|
|
|
file_new_image_size_callback (widget, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
|
|
|
file_new_print_size (gdouble size)
|
|
|
|
{
|
|
|
|
if (size < 4096)
|
|
|
|
return g_strdup_printf (_("%d Bytes"), (gint) size);
|
|
|
|
else if (size < 1024 * 10)
|
|
|
|
return g_strdup_printf (_("%.2f KB"), size / 1024);
|
|
|
|
else if (size < 1024 * 100)
|
|
|
|
return g_strdup_printf (_("%.1f KB"), size / 1024);
|
|
|
|
else if (size < 1024 * 1024)
|
|
|
|
return g_strdup_printf (_("%d KB"), (gint) size / 1024);
|
|
|
|
else if (size < 1024 * 1024 * 10)
|
|
|
|
return g_strdup_printf (_("%.2f MB"), size / 1024 / 1024);
|
|
|
|
else
|
|
|
|
return g_strdup_printf (_("%.1f MB"), size / 1024 / 1024);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
file_new_image_size_callback (GtkWidget *widget,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
NewImageValues *vals;
|
1999-05-31 22:11:10 +08:00
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
gdouble width, height, size;
|
|
|
|
gchar *text;
|
|
|
|
gchar *label;
|
|
|
|
|
1999-05-31 22:11:10 +08:00
|
|
|
vals = data;
|
1999-05-19 01:33:39 +08:00
|
|
|
|
1999-05-31 22:11:10 +08:00
|
|
|
width = (gdouble) (gint)
|
|
|
|
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 0) + 0.5);
|
|
|
|
height = (gdouble) (gint)
|
|
|
|
(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (vals->size_se), 1) + 0.5);
|
1999-05-19 01:33:39 +08:00
|
|
|
|
|
|
|
size =
|
|
|
|
width * height *
|
|
|
|
((vals->type == RGB ? 3 : 1) + /* bytes per pixel */
|
|
|
|
(vals->fill_type == TRANSPARENT_FILL ? 1 : 0)); /* alpha channel */
|
|
|
|
|
1999-05-31 22:11:10 +08:00
|
|
|
label = g_strdup_printf (_("Image Size: %s"),
|
|
|
|
text = file_new_print_size (size));
|
1999-05-19 01:33:39 +08:00
|
|
|
gtk_frame_set_label (GTK_FRAME (vals->size_frame), label);
|
1999-05-31 22:11:10 +08:00
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
g_free (label);
|
|
|
|
g_free (text);
|
|
|
|
|
|
|
|
vals->size = size;
|
1998-06-09 05:53:45 +08:00
|
|
|
}
|
1998-06-10 05:21:23 +08:00
|
|
|
|
1998-06-09 05:53:45 +08:00
|
|
|
void
|
1999-04-03 03:46:59 +08:00
|
|
|
file_new_cmd_callback (GtkWidget *widget,
|
|
|
|
gpointer callback_data,
|
|
|
|
guint callback_action)
|
1998-06-09 05:53:45 +08:00
|
|
|
{
|
1999-04-03 03:46:59 +08:00
|
|
|
GDisplay *gdisp;
|
1998-06-09 05:53:45 +08:00
|
|
|
NewImageValues *vals;
|
1999-04-03 03:46:59 +08:00
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
GtkWidget *top_vbox;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *abox;
|
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *separator;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *button;
|
|
|
|
GtkObject *adjustment;
|
|
|
|
GtkWidget *spinbutton;
|
|
|
|
GtkWidget *spinbutton2;
|
|
|
|
GtkWidget *radio_box;
|
|
|
|
GSList *group;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
static ActionAreaItem action_items[] =
|
|
|
|
{
|
|
|
|
{ N_("OK"), file_new_ok_callback, NULL, NULL },
|
|
|
|
{ N_("Reset"), file_new_reset_callback, NULL, NULL },
|
|
|
|
{ N_("Cancel"), file_new_cancel_callback, NULL, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static gchar *type_names[] =
|
|
|
|
{
|
|
|
|
N_("RGB"),
|
|
|
|
N_("Grayscale")
|
|
|
|
};
|
1999-05-31 22:11:10 +08:00
|
|
|
static gint ntypes = sizeof (type_names) / sizeof (type_names[0]);
|
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
static gchar *fill_type_names[] =
|
|
|
|
{
|
|
|
|
N_("Foreground"),
|
|
|
|
N_("Background"),
|
|
|
|
N_("White"),
|
|
|
|
N_("Transparent")
|
|
|
|
};
|
1999-05-31 22:11:10 +08:00
|
|
|
static gint nfill_types =
|
|
|
|
sizeof (fill_type_names) / sizeof (fill_type_names[0]);
|
1998-06-09 05:53:45 +08:00
|
|
|
|
|
|
|
if(!new_dialog_run)
|
|
|
|
{
|
1999-04-03 03:46:59 +08:00
|
|
|
/* all from gimprc */
|
1998-06-09 05:53:45 +08:00
|
|
|
last_width = default_width;
|
|
|
|
last_height = default_height;
|
1999-05-19 01:33:39 +08:00
|
|
|
last_unit = default_units;
|
|
|
|
|
1999-04-03 03:46:59 +08:00
|
|
|
last_xresolution = default_xresolution;
|
|
|
|
last_yresolution = default_yresolution;
|
1999-03-03 20:35:12 +08:00
|
|
|
last_res_unit = default_resolution_units;
|
1998-06-18 13:04:01 +08:00
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
last_type = default_type;
|
|
|
|
|
|
|
|
new_dialog_run = TRUE;
|
1998-06-09 05:53:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Before we try to determine the responsible gdisplay,
|
|
|
|
* make sure this wasn't called from the toolbox
|
|
|
|
*/
|
|
|
|
if (callback_action)
|
|
|
|
gdisp = gdisplay_active ();
|
|
|
|
else
|
|
|
|
gdisp = NULL;
|
|
|
|
|
|
|
|
vals = g_malloc (sizeof (NewImageValues));
|
1999-05-19 01:33:39 +08:00
|
|
|
vals->confirm_dlg = NULL;
|
|
|
|
vals->size = 0.0;
|
|
|
|
vals->res_unit = last_res_unit;
|
1998-06-09 05:53:45 +08:00
|
|
|
vals->fill_type = last_fill_type;
|
|
|
|
|
|
|
|
if (gdisp)
|
|
|
|
{
|
|
|
|
vals->width = gdisp->gimage->width;
|
|
|
|
vals->height = gdisp->gimage->height;
|
1999-05-19 01:33:39 +08:00
|
|
|
vals->unit = gdisp->gimage->unit;
|
|
|
|
|
1999-02-25 19:25:53 +08:00
|
|
|
vals->xresolution = gdisp->gimage->xresolution;
|
|
|
|
vals->yresolution = gdisp->gimage->yresolution;
|
1999-05-19 01:33:39 +08:00
|
|
|
|
|
|
|
vals->type = gimage_base_type (gdisp->gimage);
|
1998-06-09 05:53:45 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
vals->width = last_width;
|
|
|
|
vals->height = last_height;
|
1999-05-19 01:33:39 +08:00
|
|
|
vals->unit = last_unit;
|
|
|
|
|
1999-02-25 19:25:53 +08:00
|
|
|
vals->xresolution = last_xresolution;
|
|
|
|
vals->yresolution = last_yresolution;
|
1998-06-09 05:53:45 +08:00
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
vals->type = last_type;
|
|
|
|
}
|
1999-03-02 08:31:39 +08:00
|
|
|
|
1998-06-09 05:53:45 +08:00
|
|
|
if (vals->type == INDEXED)
|
|
|
|
vals->type = RGB; /* no indexed images */
|
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
/* If a cut buffer exists, default to using its size for the new image
|
|
|
|
* also check to see if a new_image has been opened
|
|
|
|
*/
|
1998-06-13 03:43:55 +08:00
|
|
|
|
|
|
|
if(global_buf && !last_new_image)
|
|
|
|
{
|
1998-08-16 03:17:36 +08:00
|
|
|
vals->width = global_buf->width;
|
|
|
|
vals->height = global_buf->height;
|
1998-06-13 03:43:55 +08:00
|
|
|
}
|
|
|
|
|
1998-06-09 05:53:45 +08:00
|
|
|
vals->dlg = gtk_dialog_new ();
|
|
|
|
gtk_window_set_wmclass (GTK_WINDOW (vals->dlg), "new_image", "Gimp");
|
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
|
|
|
gtk_window_set_title (GTK_WINDOW (vals->dlg), _("New Image"));
|
1998-12-04 07:01:44 +08:00
|
|
|
gtk_window_set_position (GTK_WINDOW (vals->dlg), GTK_WIN_POS_MOUSE);
|
1999-05-19 01:33:39 +08:00
|
|
|
gtk_window_set_policy(GTK_WINDOW (vals->dlg), FALSE, FALSE, TRUE);
|
1998-06-09 05:53:45 +08:00
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
/* Handle the wm close signal */
|
1998-06-09 05:53:45 +08:00
|
|
|
gtk_signal_connect (GTK_OBJECT (vals->dlg), "delete_event",
|
|
|
|
GTK_SIGNAL_FUNC (file_new_delete_callback),
|
|
|
|
vals);
|
|
|
|
|
1999-03-28 02:16:30 +08:00
|
|
|
/* The action area */
|
|
|
|
action_items[0].user_data = vals;
|
|
|
|
action_items[1].user_data = vals;
|
1999-05-19 01:33:39 +08:00
|
|
|
action_items[2].user_data = vals;
|
|
|
|
build_action_area (GTK_DIALOG (vals->dlg), action_items, 3, 2);
|
1998-06-09 05:53:45 +08:00
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
/* vbox holding the rest of the dialog */
|
1999-04-03 03:46:59 +08:00
|
|
|
top_vbox = gtk_vbox_new (FALSE, 2);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (top_vbox), 4);
|
1998-06-09 05:53:45 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (vals->dlg)->vbox),
|
1999-04-03 03:46:59 +08:00
|
|
|
top_vbox, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (top_vbox);
|
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
/* Image size frame */
|
|
|
|
vals->size_frame = gtk_frame_new (NULL);
|
|
|
|
gtk_box_pack_start (GTK_BOX (top_vbox), vals->size_frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (vals->size_frame);
|
|
|
|
|
|
|
|
vbox = gtk_vbox_new (FALSE, 0);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
|
|
|
gtk_container_add (GTK_CONTAINER (vals->size_frame), vbox);
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
|
|
|
table = gtk_table_new (7, 2, FALSE);
|
|
|
|
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
|
|
|
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
|
|
|
|
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);
|
|
|
|
vals->size_se =
|
|
|
|
gimp_size_entry_new (0, vals->unit, "%a", FALSE, FALSE, TRUE, 75,
|
|
|
|
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
|
|
|
gtk_table_set_col_spacing (GTK_TABLE (vals->size_se), 1, 2);
|
|
|
|
gtk_container_add (GTK_CONTAINER (abox), vals->size_se);
|
|
|
|
gtk_widget_show (vals->size_se);
|
|
|
|
gtk_widget_show (abox);
|
|
|
|
|
|
|
|
/* height in units */
|
|
|
|
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
|
|
|
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 2);
|
|
|
|
gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON (spinbutton),
|
|
|
|
GTK_SHADOW_NONE);
|
|
|
|
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
|
|
|
gtk_widget_set_usize (spinbutton, 75, 0);
|
|
|
|
/* add the "height in units" spinbutton to the sizeentry */
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (vals->size_se), spinbutton,
|
|
|
|
0, 1, 2, 3);
|
|
|
|
gtk_widget_show (spinbutton);
|
|
|
|
|
|
|
|
/* height in pixels */
|
|
|
|
hbox = gtk_hbox_new (FALSE, 2);
|
|
|
|
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
|
|
|
spinbutton2 = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 0);
|
|
|
|
gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON (spinbutton2),
|
|
|
|
GTK_SHADOW_NONE);
|
|
|
|
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton2), TRUE);
|
|
|
|
gtk_widget_set_usize (spinbutton2, 75, 0);
|
|
|
|
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);
|
|
|
|
|
|
|
|
/* 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 */
|
|
|
|
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (vals->size_se),
|
|
|
|
GTK_SPIN_BUTTON (spinbutton),
|
|
|
|
GTK_SPIN_BUTTON (spinbutton2));
|
|
|
|
|
|
|
|
/* width in units */
|
|
|
|
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
|
|
|
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 2);
|
|
|
|
gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON (spinbutton),
|
|
|
|
GTK_SHADOW_NONE);
|
|
|
|
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
|
|
|
gtk_widget_set_usize (spinbutton, 75, 0);
|
|
|
|
/* add the "width in units" spinbutton to the sizeentry */
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (vals->size_se), spinbutton,
|
|
|
|
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);
|
|
|
|
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
|
|
|
spinbutton2 = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 0);
|
|
|
|
gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON (spinbutton2),
|
|
|
|
GTK_SHADOW_NONE);
|
|
|
|
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton2), TRUE);
|
|
|
|
gtk_widget_set_usize (spinbutton2, 75, 0);
|
|
|
|
/* add the "width in pixels" spinbutton to the main table */
|
|
|
|
gtk_container_add (GTK_CONTAINER (abox), spinbutton2);
|
|
|
|
gtk_widget_show (spinbutton2);
|
|
|
|
gtk_widget_show (abox);
|
|
|
|
|
|
|
|
/* register the width spinbuttons with the sizeentry */
|
|
|
|
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (vals->size_se),
|
|
|
|
GTK_SPIN_BUTTON (spinbutton),
|
|
|
|
GTK_SPIN_BUTTON (spinbutton2));
|
|
|
|
|
|
|
|
/* initialize the sizeentry */
|
|
|
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (vals->size_se), 0,
|
1999-02-25 19:25:53 +08:00
|
|
|
vals->xresolution, FALSE);
|
1999-05-19 01:33:39 +08:00
|
|
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (vals->size_se), 1,
|
1999-02-25 19:25:53 +08:00
|
|
|
vals->yresolution, FALSE);
|
1998-06-09 05:53:45 +08:00
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (vals->size_se), 0,
|
|
|
|
GIMP_MIN_IMAGE_SIZE,
|
|
|
|
GIMP_MAX_IMAGE_SIZE);
|
|
|
|
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (vals->size_se), 1,
|
|
|
|
GIMP_MIN_IMAGE_SIZE,
|
|
|
|
GIMP_MAX_IMAGE_SIZE);
|
|
|
|
|
|
|
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->size_se), 0, vals->width);
|
|
|
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->size_se), 1, vals->height);
|
|
|
|
|
|
|
|
gtk_signal_connect (GTK_OBJECT (vals->size_se), "refval_changed",
|
|
|
|
(GtkSignalFunc) file_new_image_size_callback, vals);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (vals->size_se), "value_changed",
|
|
|
|
(GtkSignalFunc) file_new_image_size_callback, vals);
|
|
|
|
|
|
|
|
/* initialize the size label */
|
|
|
|
file_new_image_size_callback (vals->size_se, vals);
|
|
|
|
|
|
|
|
/* 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 */
|
|
|
|
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
|
|
|
|
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 2);
|
|
|
|
gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON (spinbutton),
|
|
|
|
GTK_SHADOW_NONE);
|
|
|
|
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
|
|
|
gtk_widget_set_usize (spinbutton, 75, 0);
|
|
|
|
|
|
|
|
vals->resolution_se =
|
|
|
|
gimp_size_entry_new (1, default_resolution_units, _("pixels/%a"),
|
|
|
|
FALSE, FALSE, FALSE, 75,
|
|
|
|
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
|
|
|
gtk_table_set_col_spacing (GTK_TABLE (vals->resolution_se), 1, 2);
|
|
|
|
gtk_table_set_col_spacing (GTK_TABLE (vals->resolution_se), 2, 2);
|
|
|
|
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (vals->resolution_se),
|
|
|
|
GTK_SPIN_BUTTON (spinbutton), NULL);
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (vals->resolution_se), spinbutton,
|
|
|
|
1, 2, 0, 1);
|
|
|
|
gtk_widget_show (spinbutton);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), vals->resolution_se, 1, 2, 5, 7,
|
|
|
|
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
|
|
|
gtk_widget_show (vals->resolution_se);
|
|
|
|
|
|
|
|
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (vals->resolution_se),
|
|
|
|
0, GIMP_MIN_RESOLUTION,
|
|
|
|
GIMP_MAX_RESOLUTION);
|
|
|
|
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (vals->resolution_se),
|
|
|
|
1, GIMP_MIN_RESOLUTION,
|
|
|
|
GIMP_MAX_RESOLUTION);
|
|
|
|
|
|
|
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->resolution_se),
|
|
|
|
0, vals->xresolution);
|
|
|
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->resolution_se),
|
|
|
|
1, vals->yresolution);
|
|
|
|
|
|
|
|
gtk_signal_connect (GTK_OBJECT (vals->resolution_se), "value_changed",
|
1999-04-03 03:46:59 +08:00
|
|
|
(GtkSignalFunc) file_new_resolution_callback, vals);
|
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
/* the resolution chainbutton */
|
|
|
|
vals->couple_resolutions = gimp_chain_button_new (GIMP_CHAIN_RIGHT);
|
|
|
|
gimp_chain_button_set_active
|
|
|
|
(GIMP_CHAIN_BUTTON (vals->couple_resolutions),
|
|
|
|
ABS (vals->xresolution - vals->yresolution) < GIMP_MIN_RESOLUTION);
|
|
|
|
gtk_table_attach_defaults (GTK_TABLE (vals->resolution_se),
|
|
|
|
vals->couple_resolutions, 2, 3, 0, 2);
|
|
|
|
gtk_widget_show (vals->couple_resolutions);
|
1999-02-25 19:25:53 +08:00
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
/* hbox containing the Image type and fill type frames */
|
|
|
|
hbox = gtk_hbox_new (FALSE, 2);
|
1999-04-03 03:46:59 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (top_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 */
|
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
|
|
|
frame = gtk_frame_new (_("Image Type"));
|
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-31 22:11:10 +08:00
|
|
|
/* radio buttons and box */
|
1998-06-09 05:53:45 +08:00
|
|
|
radio_box = gtk_vbox_new (FALSE, 1);
|
1998-12-04 07:01:44 +08:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (radio_box), 2);
|
1998-06-09 05:53:45 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), radio_box);
|
|
|
|
gtk_widget_show (radio_box);
|
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
group = NULL;
|
1999-05-31 22:11:10 +08:00
|
|
|
for (i = 0; i < ntypes; i++)
|
1999-05-19 01:33:39 +08:00
|
|
|
{
|
|
|
|
button = gtk_radio_button_new_with_label (group, gettext (type_names[i]));
|
|
|
|
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
|
|
|
gtk_box_pack_start (GTK_BOX (radio_box), button, FALSE, TRUE, 0);
|
|
|
|
gtk_object_set_user_data (GTK_OBJECT (button), (gpointer) i);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
|
|
|
(GtkSignalFunc) file_new_toggle_callback,
|
|
|
|
&vals->type);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
|
|
|
(GtkSignalFunc) file_new_image_size_callback, vals);
|
|
|
|
if (vals->type == i)
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
|
|
|
vals->type_w[i] = button;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* frame for Fill Type */
|
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
|
|
|
frame = gtk_frame_new (_("Fill Type"));
|
1998-06-09 05:53:45 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
radio_box = gtk_vbox_new (FALSE, 1);
|
1998-12-04 07:01:44 +08:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (radio_box), 2);
|
1998-06-09 05:53:45 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), radio_box);
|
|
|
|
gtk_widget_show (radio_box);
|
|
|
|
|
1999-05-19 01:33:39 +08:00
|
|
|
group = NULL;
|
1999-05-31 22:11:10 +08:00
|
|
|
for (i = 0; i < nfill_types; i++)
|
1999-05-19 01:33:39 +08:00
|
|
|
{
|
|
|
|
button =
|
|
|
|
gtk_radio_button_new_with_label (group, gettext (fill_type_names[i]));
|
|
|
|
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
|
|
|
gtk_box_pack_start (GTK_BOX (radio_box), button, TRUE, TRUE, 0);
|
|
|
|
gtk_object_set_user_data (GTK_OBJECT (button), (gpointer) i);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
|
|
|
(GtkSignalFunc) file_new_toggle_callback,
|
|
|
|
&vals->fill_type);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
|
|
|
(GtkSignalFunc) file_new_image_size_callback, vals);
|
|
|
|
if (vals->fill_type == i)
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
|
|
|
vals->fill_type_w[i] = button;
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_size_entry_grab_focus (GIMP_SIZE_ENTRY (vals->size_se));
|
1999-05-31 22:11:10 +08:00
|
|
|
|
1998-06-09 05:53:45 +08:00
|
|
|
gtk_widget_show (vals->dlg);
|
|
|
|
}
|
|
|
|
|
1999-04-03 03:46:59 +08:00
|
|
|
void
|
|
|
|
file_new_reset_current_cut_buffer ()
|
1998-06-13 03:43:55 +08:00
|
|
|
{
|
1999-02-25 19:25:53 +08:00
|
|
|
/* this function just changes the status of last_image_new
|
1998-06-13 03:43:55 +08:00
|
|
|
so i can if theres been a cut/copy since the last file new */
|
|
|
|
last_new_image = FALSE;
|
1998-06-18 13:04:01 +08:00
|
|
|
}
|