2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1997-11-25 06:05:25 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
1997-11-25 06:05:25 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
1997-11-25 06:05:25 +08: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-12 05:27:07 +08:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
2000-12-17 05:37:03 +08:00
|
|
|
|
1999-07-27 08:14:14 +08:00
|
|
|
#include "config.h"
|
2000-04-06 10:13:18 +08:00
|
|
|
|
2008-10-10 04:24:04 +08:00
|
|
|
#include <gegl.h>
|
2000-12-17 05:37:03 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2001-05-21 21:58:46 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
2007-03-09 21:00:01 +08:00
|
|
|
#include "libgimpmath/gimpmath.h"
|
2001-01-25 06:36:18 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
2001-01-24 07:56:18 +08:00
|
|
|
|
2004-09-13 23:15:23 +08:00
|
|
|
#include "dialogs-types.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2021-01-25 04:03:25 +08:00
|
|
|
#include "core/gimp.h"
|
2006-09-01 19:26:54 +08:00
|
|
|
#include "core/gimpcontext.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpimage.h"
|
|
|
|
#include "core/gimplayer.h"
|
2021-01-25 04:03:25 +08:00
|
|
|
#include "core/gimptemplate.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
|
2021-01-25 04:03:25 +08:00
|
|
|
#include "widgets/gimpcontainercombobox.h"
|
2003-08-21 23:54:47 +08:00
|
|
|
#include "widgets/gimphelp-ids.h"
|
2004-10-27 18:33:08 +08:00
|
|
|
#include "widgets/gimpsizebox.h"
|
2002-08-31 05:00:42 +08:00
|
|
|
#include "widgets/gimpviewabledialog.h"
|
2021-02-08 00:06:41 +08:00
|
|
|
#include "widgets/gimpwidgets-constructors.h"
|
2002-03-17 22:07:54 +08:00
|
|
|
|
2001-06-05 07:27:38 +08:00
|
|
|
#include "resize-dialog.h"
|
|
|
|
|
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
|
|
|
|
2004-10-27 18:33:08 +08:00
|
|
|
#define RESPONSE_RESET 1
|
2004-10-29 02:27:04 +08:00
|
|
|
#define SB_WIDTH 8
|
2004-10-27 18:33:08 +08:00
|
|
|
|
|
|
|
|
2016-10-28 03:26:07 +08:00
|
|
|
typedef struct _ResizeDialog ResizeDialog;
|
|
|
|
|
|
|
|
struct _ResizeDialog
|
2004-10-27 18:33:08 +08:00
|
|
|
{
|
2006-05-19 22:50:46 +08:00
|
|
|
GimpViewable *viewable;
|
2016-09-24 21:07:04 +08:00
|
|
|
GimpContext *context;
|
2021-01-25 04:03:25 +08:00
|
|
|
GimpContext *parent_context;
|
2016-10-10 06:02:16 +08:00
|
|
|
GimpFillType fill_type;
|
2006-05-19 22:50:46 +08:00
|
|
|
GimpItemSet layer_set;
|
2012-09-06 05:26:54 +08:00
|
|
|
gboolean resize_text_layers;
|
2006-05-19 22:50:46 +08:00
|
|
|
GimpResizeCallback callback;
|
|
|
|
gpointer user_data;
|
2016-10-10 06:02:16 +08:00
|
|
|
|
2021-02-08 00:06:41 +08:00
|
|
|
gdouble old_xres;
|
|
|
|
gdouble old_yres;
|
Issue #8900 and #9923: reimplementing GimpUnit as a proper class.
This fixes all our GObject Introspection issues with GimpUnit which was
both an enum and an int-derived type of user-defined units *completing*
the enum values. GIR clearly didn't like this!
Now GimpUnit is a proper class and units are unique objects, allowing to
compare them with an identity test (i.e. `unit == gimp_unit_pixel ()`
tells us if unit is the pixel unit or not), which makes it easy to use,
just like with int, yet adding also methods, making for nicer
introspected API.
As an aside, this also fixes #10738, by having all the built-in units
retrievable even if libgimpbase had not been properly initialized with
gimp_base_init().
I haven't checked in details how GIR works to introspect, but it looks
like it loads the library to inspect and runs functions, hence
triggering some CRITICALS because virtual methods (supposed to be
initialized with gimp_base_init() run by libgimp) are not set. This new
code won't trigger any critical because the vtable method are now not
necessary, at least for all built-in units.
Note that GimpUnit is still in libgimpbase. It could have been moved to
libgimp in order to avoid any virtual method table (since we need to
keep core and libgimp side's units in sync, PDB is required), but too
many libgimpwidgets widgets were already using GimpUnit. And technically
most of GimpUnit logic doesn't require PDB (only the creation/sync
part). This is one of the reasons why user-created GimpUnit list is
handled and stored differently from other types of objects.
Globally this simplifies the code a lot too and we don't need separate
implementations of various utils for core and libgimp, which means less
prone to errors.
2024-07-26 02:55:21 +08:00
|
|
|
GimpUnit *old_res_unit;
|
2016-10-10 06:02:16 +08:00
|
|
|
gint old_width;
|
|
|
|
gint old_height;
|
Issue #8900 and #9923: reimplementing GimpUnit as a proper class.
This fixes all our GObject Introspection issues with GimpUnit which was
both an enum and an int-derived type of user-defined units *completing*
the enum values. GIR clearly didn't like this!
Now GimpUnit is a proper class and units are unique objects, allowing to
compare them with an identity test (i.e. `unit == gimp_unit_pixel ()`
tells us if unit is the pixel unit or not), which makes it easy to use,
just like with int, yet adding also methods, making for nicer
introspected API.
As an aside, this also fixes #10738, by having all the built-in units
retrievable even if libgimpbase had not been properly initialized with
gimp_base_init().
I haven't checked in details how GIR works to introspect, but it looks
like it loads the library to inspect and runs functions, hence
triggering some CRITICALS because virtual methods (supposed to be
initialized with gimp_base_init() run by libgimp) are not set. This new
code won't trigger any critical because the vtable method are now not
necessary, at least for all built-in units.
Note that GimpUnit is still in libgimpbase. It could have been moved to
libgimp in order to avoid any virtual method table (since we need to
keep core and libgimp side's units in sync, PDB is required), but too
many libgimpwidgets widgets were already using GimpUnit. And technically
most of GimpUnit logic doesn't require PDB (only the creation/sync
part). This is one of the reasons why user-created GimpUnit list is
handled and stored differently from other types of objects.
Globally this simplifies the code a lot too and we don't need separate
implementations of various utils for core and libgimp, which means less
prone to errors.
2024-07-26 02:55:21 +08:00
|
|
|
GimpUnit *old_unit;
|
2016-10-20 06:30:10 +08:00
|
|
|
GimpFillType old_fill_type;
|
|
|
|
GimpItemSet old_layer_set;
|
|
|
|
gboolean old_resize_text_layers;
|
|
|
|
|
2016-10-10 06:02:16 +08:00
|
|
|
GtkWidget *box;
|
|
|
|
GtkWidget *offset;
|
|
|
|
GtkWidget *area;
|
2016-10-20 06:30:10 +08:00
|
|
|
GtkWidget *layer_set_combo;
|
|
|
|
GtkWidget *fill_type_combo;
|
|
|
|
GtkWidget *text_layers_button;
|
2021-02-08 00:06:41 +08:00
|
|
|
|
|
|
|
GtkWidget *ppi_box;
|
|
|
|
GtkWidget *ppi_image;
|
|
|
|
GtkWidget *ppi_template;
|
|
|
|
GimpTemplate *template;
|
2016-10-28 03:26:07 +08:00
|
|
|
};
|
|
|
|
|
2004-10-27 18:33:08 +08:00
|
|
|
|
2016-10-28 03:26:07 +08:00
|
|
|
/* local function prototypes */
|
2004-10-27 18:33:08 +08:00
|
|
|
|
2016-10-28 03:26:07 +08:00
|
|
|
static void resize_dialog_free (ResizeDialog *private);
|
2004-10-27 18:33:08 +08:00
|
|
|
static void resize_dialog_response (GtkWidget *dialog,
|
|
|
|
gint response_id,
|
|
|
|
ResizeDialog *private);
|
|
|
|
static void resize_dialog_reset (ResizeDialog *private);
|
|
|
|
|
2004-10-31 07:16:19 +08:00
|
|
|
static void size_notify (GimpSizeBox *box,
|
|
|
|
GParamSpec *pspec,
|
|
|
|
ResizeDialog *private);
|
2004-10-29 02:27:04 +08:00
|
|
|
static void offset_update (GtkWidget *widget,
|
2004-10-31 02:11:16 +08:00
|
|
|
ResizeDialog *private);
|
2004-10-29 02:27:04 +08:00
|
|
|
static void offsets_changed (GtkWidget *area,
|
|
|
|
gint off_x,
|
|
|
|
gint off_y,
|
2004-10-31 02:11:16 +08:00
|
|
|
ResizeDialog *private);
|
2004-10-29 02:27:04 +08:00
|
|
|
static void offset_center_clicked (GtkWidget *widget,
|
2004-10-31 02:11:16 +08:00
|
|
|
ResizeDialog *private);
|
2004-10-29 02:27:04 +08:00
|
|
|
|
2021-01-25 04:03:25 +08:00
|
|
|
static void template_changed (GimpContext *context,
|
|
|
|
GimpTemplate *template,
|
|
|
|
ResizeDialog *private);
|
2004-10-27 18:33:08 +08:00
|
|
|
|
2021-02-08 00:06:41 +08:00
|
|
|
static void reset_template_clicked (GtkWidget *button,
|
|
|
|
ResizeDialog *private);
|
|
|
|
static void ppi_select_toggled (GtkWidget *radio,
|
|
|
|
ResizeDialog *private);
|
|
|
|
|
2016-10-28 03:26:07 +08:00
|
|
|
/* public function */
|
|
|
|
|
2004-10-27 18:33:08 +08:00
|
|
|
GtkWidget *
|
|
|
|
resize_dialog_new (GimpViewable *viewable,
|
2006-09-01 19:26:54 +08:00
|
|
|
GimpContext *context,
|
2004-10-27 18:33:08 +08:00
|
|
|
const gchar *title,
|
|
|
|
const gchar *role,
|
|
|
|
GtkWidget *parent,
|
|
|
|
GimpHelpFunc help_func,
|
|
|
|
const gchar *help_id,
|
Issue #8900 and #9923: reimplementing GimpUnit as a proper class.
This fixes all our GObject Introspection issues with GimpUnit which was
both an enum and an int-derived type of user-defined units *completing*
the enum values. GIR clearly didn't like this!
Now GimpUnit is a proper class and units are unique objects, allowing to
compare them with an identity test (i.e. `unit == gimp_unit_pixel ()`
tells us if unit is the pixel unit or not), which makes it easy to use,
just like with int, yet adding also methods, making for nicer
introspected API.
As an aside, this also fixes #10738, by having all the built-in units
retrievable even if libgimpbase had not been properly initialized with
gimp_base_init().
I haven't checked in details how GIR works to introspect, but it looks
like it loads the library to inspect and runs functions, hence
triggering some CRITICALS because virtual methods (supposed to be
initialized with gimp_base_init() run by libgimp) are not set. This new
code won't trigger any critical because the vtable method are now not
necessary, at least for all built-in units.
Note that GimpUnit is still in libgimpbase. It could have been moved to
libgimp in order to avoid any virtual method table (since we need to
keep core and libgimp side's units in sync, PDB is required), but too
many libgimpwidgets widgets were already using GimpUnit. And technically
most of GimpUnit logic doesn't require PDB (only the creation/sync
part). This is one of the reasons why user-created GimpUnit list is
handled and stored differently from other types of objects.
Globally this simplifies the code a lot too and we don't need separate
implementations of various utils for core and libgimp, which means less
prone to errors.
2024-07-26 02:55:21 +08:00
|
|
|
GimpUnit *unit,
|
2016-10-20 06:30:10 +08:00
|
|
|
GimpFillType fill_type,
|
|
|
|
GimpItemSet layer_set,
|
|
|
|
gboolean resize_text_layers,
|
2004-10-27 18:33:08 +08:00
|
|
|
GimpResizeCallback callback,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2016-10-10 06:02:16 +08:00
|
|
|
ResizeDialog *private;
|
2014-06-22 04:39:37 +08:00
|
|
|
GtkWidget *dialog;
|
|
|
|
GtkWidget *main_vbox;
|
|
|
|
GtkWidget *vbox;
|
2021-08-23 00:04:39 +08:00
|
|
|
GtkWidget *center_hbox;
|
|
|
|
GtkWidget *center_left_vbox;
|
|
|
|
GtkWidget *center_right_vbox;
|
2014-06-22 04:39:37 +08:00
|
|
|
GtkWidget *frame;
|
|
|
|
GtkWidget *button;
|
|
|
|
GtkWidget *spinbutton;
|
|
|
|
GtkWidget *entry;
|
2016-10-10 06:02:16 +08:00
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *combo;
|
2021-01-25 04:03:25 +08:00
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *template_selector;
|
2021-02-08 00:06:41 +08:00
|
|
|
GtkWidget *ppi_image;
|
|
|
|
GtkWidget *ppi_template;
|
2014-06-22 04:39:37 +08:00
|
|
|
GtkAdjustment *adjustment;
|
|
|
|
GdkPixbuf *pixbuf;
|
2016-10-10 06:02:16 +08:00
|
|
|
GtkSizeGroup *size_group = NULL;
|
|
|
|
GimpImage *image = NULL;
|
|
|
|
const gchar *size_title = NULL;
|
|
|
|
const gchar *layers_title = NULL;
|
2014-06-22 04:39:37 +08:00
|
|
|
gint width, height;
|
|
|
|
gdouble xres, yres;
|
2004-10-27 18:33:08 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), NULL);
|
2006-10-15 02:15:41 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
2004-10-27 18:33:08 +08:00
|
|
|
g_return_val_if_fail (callback != NULL, NULL);
|
|
|
|
|
|
|
|
if (GIMP_IS_IMAGE (viewable))
|
|
|
|
{
|
|
|
|
image = GIMP_IMAGE (viewable);
|
|
|
|
|
|
|
|
width = gimp_image_get_width (image);
|
|
|
|
height = gimp_image_get_height (image);
|
|
|
|
|
2016-10-10 06:02:16 +08:00
|
|
|
size_title = _("Canvas Size");
|
|
|
|
layers_title = _("Layers");
|
2004-10-27 18:33:08 +08:00
|
|
|
}
|
|
|
|
else if (GIMP_IS_ITEM (viewable))
|
|
|
|
{
|
|
|
|
GimpItem *item = GIMP_ITEM (viewable);
|
|
|
|
|
|
|
|
image = gimp_item_get_image (item);
|
|
|
|
|
2008-11-03 08:09:01 +08:00
|
|
|
width = gimp_item_get_width (item);
|
|
|
|
height = gimp_item_get_height (item);
|
2004-10-27 18:33:08 +08:00
|
|
|
|
2016-10-10 06:02:16 +08:00
|
|
|
size_title = _("Layer Size");
|
|
|
|
layers_title = _("Fill With");
|
2004-10-27 18:33:08 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_return_val_if_reached (NULL);
|
|
|
|
}
|
|
|
|
|
2016-09-24 21:07:04 +08:00
|
|
|
private = g_slice_new0 (ResizeDialog);
|
|
|
|
|
2021-01-25 04:03:25 +08:00
|
|
|
private->parent_context = context;
|
|
|
|
private->context = gimp_context_new (context->gimp,
|
|
|
|
"resize-dialog",
|
|
|
|
context);
|
|
|
|
|
2021-02-08 00:06:41 +08:00
|
|
|
gimp_image_get_resolution (image, &xres, &yres);
|
|
|
|
|
|
|
|
private->old_xres = xres;
|
|
|
|
private->old_yres = yres;
|
|
|
|
private->old_res_unit = gimp_image_get_unit (image);
|
|
|
|
|
2016-09-24 21:07:04 +08:00
|
|
|
private->viewable = viewable;
|
2016-10-20 06:30:10 +08:00
|
|
|
private->fill_type = fill_type;
|
|
|
|
private->layer_set = layer_set;
|
|
|
|
private->resize_text_layers = resize_text_layers;
|
2016-09-24 21:07:04 +08:00
|
|
|
private->callback = callback;
|
|
|
|
private->user_data = user_data;
|
2016-10-20 06:30:10 +08:00
|
|
|
|
|
|
|
private->old_width = width;
|
|
|
|
private->old_height = height;
|
|
|
|
private->old_unit = unit;
|
|
|
|
private->old_fill_type = private->fill_type;
|
|
|
|
private->old_layer_set = private->layer_set;
|
|
|
|
private->old_resize_text_layers = private->resize_text_layers;
|
2016-09-24 21:07:04 +08:00
|
|
|
|
2021-01-25 04:03:25 +08:00
|
|
|
gimp_context_set_template (private->context, NULL);
|
|
|
|
|
2020-05-02 07:42:04 +08:00
|
|
|
dialog = gimp_viewable_dialog_new (g_list_prepend (NULL, viewable), context,
|
2017-03-05 23:01:59 +08:00
|
|
|
title, role, GIMP_ICON_OBJECT_RESIZE, title,
|
2004-10-27 18:33:08 +08:00
|
|
|
parent,
|
|
|
|
help_func, help_id,
|
|
|
|
|
2017-02-12 23:06:34 +08:00
|
|
|
_("Re_set"), RESPONSE_RESET,
|
|
|
|
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
|
|
|
_("_Resize"), GTK_RESPONSE_OK,
|
2004-10-27 18:33:08 +08:00
|
|
|
|
|
|
|
NULL);
|
|
|
|
|
2018-05-10 23:04:37 +08:00
|
|
|
gimp_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
2005-09-28 02:51:44 +08:00
|
|
|
RESPONSE_RESET,
|
2005-02-10 19:00:46 +08:00
|
|
|
GTK_RESPONSE_OK,
|
|
|
|
GTK_RESPONSE_CANCEL,
|
|
|
|
-1);
|
2005-02-09 04:40:33 +08:00
|
|
|
|
2016-10-28 03:26:07 +08:00
|
|
|
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
|
|
|
|
|
2007-05-24 04:08:27 +08:00
|
|
|
g_object_weak_ref (G_OBJECT (dialog),
|
|
|
|
(GWeakNotify) resize_dialog_free, private);
|
2004-10-27 18:33:08 +08:00
|
|
|
|
2016-09-24 21:07:04 +08:00
|
|
|
g_signal_connect (dialog, "response",
|
|
|
|
G_CALLBACK (resize_dialog_response),
|
|
|
|
private);
|
2004-10-27 18:33:08 +08:00
|
|
|
|
2016-10-10 06:02:16 +08:00
|
|
|
main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
|
|
|
|
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
|
|
|
|
main_vbox, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (main_vbox);
|
|
|
|
|
2021-01-25 04:03:25 +08:00
|
|
|
/* template selector */
|
|
|
|
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);
|
|
|
|
|
|
|
|
template_selector = 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), template_selector, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (template_selector);
|
|
|
|
|
|
|
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), template_selector);
|
|
|
|
|
|
|
|
g_signal_connect (private->context,
|
|
|
|
"template-changed",
|
|
|
|
G_CALLBACK (template_changed),
|
|
|
|
private);
|
|
|
|
|
2021-02-08 00:06:41 +08:00
|
|
|
/* reset template button */
|
|
|
|
button = gimp_icon_button_new (GIMP_ICON_RESET, NULL);
|
|
|
|
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
|
|
|
|
gtk_image_set_from_icon_name (GTK_IMAGE (gtk_bin_get_child (GTK_BIN (button))),
|
|
|
|
GIMP_ICON_RESET, GTK_ICON_SIZE_MENU);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
|
|
|
g_signal_connect (button,
|
|
|
|
"clicked",
|
|
|
|
G_CALLBACK (reset_template_clicked),
|
|
|
|
private);
|
|
|
|
|
|
|
|
gimp_help_set_help_data (button,
|
|
|
|
_("Reset the template selection"),
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
/* ppi selector box */
|
|
|
|
private->ppi_box = vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
|
|
|
|
gtk_box_pack_start (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("Template and image print resolution don't match.\n"
|
|
|
|
"Choose how to scale the canvas:"));
|
|
|
|
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
|
|
|
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
|
|
|
/* actual label text is set inside template_change fn. */
|
|
|
|
ppi_image = gtk_radio_button_new_with_label (NULL, "");
|
|
|
|
ppi_template = gtk_radio_button_new_with_label (NULL, "");
|
|
|
|
|
|
|
|
private->ppi_image = ppi_image;
|
|
|
|
private->ppi_template = ppi_template;
|
|
|
|
|
|
|
|
gtk_radio_button_join_group (GTK_RADIO_BUTTON (ppi_template),
|
|
|
|
GTK_RADIO_BUTTON (ppi_image));
|
|
|
|
|
|
|
|
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (ppi_image), FALSE);
|
|
|
|
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (ppi_template), FALSE);
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), ppi_image, FALSE, FALSE, 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), ppi_template, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
gtk_widget_show (ppi_image);
|
|
|
|
gtk_widget_show (ppi_template);
|
|
|
|
|
|
|
|
g_signal_connect (G_OBJECT (ppi_image),
|
|
|
|
"toggled",
|
|
|
|
G_CALLBACK (ppi_select_toggled),
|
|
|
|
private);
|
|
|
|
|
|
|
|
g_signal_connect (G_OBJECT (ppi_template),
|
|
|
|
"toggled",
|
|
|
|
G_CALLBACK (ppi_select_toggled),
|
|
|
|
private);
|
|
|
|
|
2021-08-23 00:04:39 +08:00
|
|
|
/* For space gain, organize the main widgets in both vertical and
|
|
|
|
* horizontal layout.
|
|
|
|
* The size and offset fields are on the center left, while the
|
|
|
|
* preview and the "Center" button are on center right.
|
|
|
|
*/
|
|
|
|
center_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
|
|
|
|
gtk_box_pack_start (GTK_BOX (main_vbox), center_hbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (center_hbox);
|
|
|
|
|
|
|
|
center_left_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
|
|
|
|
gtk_box_pack_start (GTK_BOX (center_hbox), center_left_vbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (center_left_vbox);
|
|
|
|
|
|
|
|
center_right_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
|
|
|
|
gtk_box_pack_start (GTK_BOX (center_hbox), center_right_vbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (center_right_vbox);
|
|
|
|
|
2021-01-25 04:03:25 +08:00
|
|
|
/* size select frame */
|
2016-10-10 06:02:16 +08:00
|
|
|
frame = gimp_frame_new (size_title);
|
2021-08-23 00:04:39 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (center_left_vbox), frame, FALSE, FALSE, 0);
|
2016-10-10 06:02:16 +08:00
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2021-01-25 04:03:25 +08:00
|
|
|
/* size box */
|
2004-10-27 18:33:08 +08:00
|
|
|
private->box = g_object_new (GIMP_TYPE_SIZE_BOX,
|
|
|
|
"width", width,
|
|
|
|
"height", height,
|
|
|
|
"unit", unit,
|
|
|
|
"xresolution", xres,
|
|
|
|
"yresolution", yres,
|
2009-09-21 02:03:20 +08:00
|
|
|
"keep-aspect", FALSE,
|
2004-10-27 18:33:08 +08:00
|
|
|
"edit-resolution", FALSE,
|
|
|
|
NULL);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), private->box);
|
|
|
|
gtk_widget_show (private->box);
|
|
|
|
|
2021-02-08 00:06:41 +08:00
|
|
|
/* offset frame */
|
2004-10-27 18:33:08 +08:00
|
|
|
frame = gimp_frame_new (_("Offset"));
|
2021-08-23 00:04:39 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (center_left_vbox), frame, FALSE, FALSE, 0);
|
2004-10-27 18:33:08 +08:00
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
2011-09-30 17:29:11 +08:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
|
2004-10-29 02:27:04 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
|
|
|
/* the offset sizeentry */
|
2018-06-25 00:15:16 +08:00
|
|
|
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 0);
|
2019-03-09 20:25:19 +08:00
|
|
|
spinbutton = gimp_spin_button_new (adjustment, 1.0, 2);
|
2014-06-22 04:39:37 +08:00
|
|
|
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
2004-10-29 02:27:04 +08:00
|
|
|
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
|
|
|
|
|
Issue #434: remove broken plural support for GimpUnit.
Rather than trying to implement full i18n plural support, we just remove
this failed attempt from the past. The fact is that to get proper
support, we'd basically need to reimplement a Gettext-like plural
definition syntax within our API, then ask people to write down this
plural definition for their language, then to write every plural form…
all this for custom units which only them will ever see!
Moreover code investigation shows that the singular form was simply
never used, and the plural form was always used (whatever the actual
unit value displayed).
As for the "identifier", this was a text which was never shown anywhere
(except in the unit editor) and for all built-in units, as well as
default unitrc units, it was equivalent to the English plural value.
So we now just have a unique name which is the "long label" to be used
everywhere in the GUI, and abbreviation will be basically the "short
label". That's it. No useless (or worse, not actually usable because it
was not generic internationalization) values anymore!
2024-08-05 22:02:47 +08:00
|
|
|
private->offset = entry = gimp_size_entry_new (1, unit, "%n",
|
2004-10-29 02:27:04 +08:00
|
|
|
TRUE, FALSE, FALSE, SB_WIDTH,
|
|
|
|
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
|
|
|
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (entry),
|
|
|
|
GTK_SPIN_BUTTON (spinbutton), NULL);
|
2018-05-03 02:23:05 +08:00
|
|
|
gtk_grid_attach (GTK_GRID (entry), spinbutton, 1, 0, 1, 1);
|
2004-10-29 02:27:04 +08:00
|
|
|
gtk_widget_show (spinbutton);
|
|
|
|
|
|
|
|
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (entry),
|
|
|
|
_("_X:"), 0, 0, 0.0);
|
|
|
|
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (entry),_("_Y:"), 1, 0, 0.0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (entry);
|
|
|
|
|
|
|
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (entry), 0, xres, FALSE);
|
|
|
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (entry), 1, yres, FALSE);
|
|
|
|
|
|
|
|
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (entry), 0, 0, 0);
|
|
|
|
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (entry), 1, 0, 0);
|
|
|
|
|
|
|
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (entry), 0, 0);
|
|
|
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (entry), 1, 0);
|
|
|
|
|
2005-05-28 00:51:39 +08:00
|
|
|
g_signal_connect (entry, "value-changed",
|
2004-10-29 02:27:04 +08:00
|
|
|
G_CALLBACK (offset_update),
|
2004-10-31 02:11:16 +08:00
|
|
|
private);
|
2004-10-29 02:27:04 +08:00
|
|
|
|
|
|
|
frame = gtk_frame_new (NULL);
|
2018-05-04 18:58:22 +08:00
|
|
|
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
|
2004-10-29 02:27:04 +08:00
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
2021-08-23 00:04:39 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (center_right_vbox), frame, FALSE, FALSE, 0);
|
2023-09-12 04:07:17 +08:00
|
|
|
gtk_style_context_add_class (gtk_widget_get_style_context (frame),
|
|
|
|
"gimp-offset-area-frame");
|
2004-10-31 07:16:19 +08:00
|
|
|
gtk_widget_show (frame);
|
2004-10-29 02:27:04 +08:00
|
|
|
|
|
|
|
private->area = gimp_offset_area_new (width, height);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), private->area);
|
|
|
|
gtk_widget_show (private->area);
|
|
|
|
|
2018-06-17 21:33:53 +08:00
|
|
|
gimp_viewable_get_preview_size (viewable, 200, TRUE, TRUE, &width, &height);
|
2006-09-01 19:26:54 +08:00
|
|
|
pixbuf = gimp_viewable_get_pixbuf (viewable, context,
|
2006-08-30 05:44:51 +08:00
|
|
|
width, height);
|
2004-10-29 02:27:04 +08:00
|
|
|
|
2005-03-28 08:11:43 +08:00
|
|
|
if (pixbuf)
|
|
|
|
gimp_offset_area_set_pixbuf (GIMP_OFFSET_AREA (private->area), pixbuf);
|
2004-10-29 02:27:04 +08:00
|
|
|
|
2005-05-28 00:51:39 +08:00
|
|
|
g_signal_connect (private->area, "offsets-changed",
|
2004-10-29 02:27:04 +08:00
|
|
|
G_CALLBACK (offsets_changed),
|
2004-10-31 02:11:16 +08:00
|
|
|
private);
|
2004-10-29 02:27:04 +08:00
|
|
|
|
2004-10-31 07:16:19 +08:00
|
|
|
g_signal_connect (private->box, "notify",
|
|
|
|
G_CALLBACK (size_notify),
|
|
|
|
private);
|
2004-10-29 02:27:04 +08:00
|
|
|
|
2021-08-23 00:04:39 +08:00
|
|
|
/* Button to center the image on canvas just below the preview. */
|
|
|
|
button = gtk_button_new_with_mnemonic (_("C_enter"));
|
|
|
|
gtk_box_pack_start (GTK_BOX (center_right_vbox), button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
|
|
|
g_signal_connect (button, "clicked",
|
|
|
|
G_CALLBACK (offset_center_clicked),
|
|
|
|
private);
|
|
|
|
|
2016-10-10 06:02:16 +08:00
|
|
|
frame = gimp_frame_new (layers_title);
|
|
|
|
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
2005-02-25 00:39:12 +08:00
|
|
|
if (GIMP_IS_IMAGE (viewable))
|
|
|
|
{
|
|
|
|
GtkWidget *label;
|
|
|
|
|
2016-10-10 06:02:16 +08:00
|
|
|
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
2012-09-06 05:26:54 +08:00
|
|
|
|
2011-09-30 17:29:11 +08:00
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
2012-09-06 05:26:54 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
2005-02-25 00:39:12 +08:00
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
2005-08-23 07:39:12 +08:00
|
|
|
label = gtk_label_new_with_mnemonic (_("Resize _layers:"));
|
2016-10-10 06:02:16 +08:00
|
|
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
2005-02-25 00:39:12 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
2016-10-10 06:02:16 +08:00
|
|
|
gtk_size_group_add_widget (size_group, label);
|
|
|
|
|
2016-10-20 06:30:10 +08:00
|
|
|
private->layer_set_combo = combo =
|
|
|
|
gimp_enum_combo_box_new (GIMP_TYPE_ITEM_SET);
|
2005-02-25 00:39:12 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (combo);
|
|
|
|
|
|
|
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo);
|
|
|
|
|
|
|
|
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo),
|
2006-05-19 22:50:46 +08:00
|
|
|
private->layer_set,
|
2005-02-25 00:39:12 +08:00
|
|
|
G_CALLBACK (gimp_int_combo_box_get_active),
|
2019-08-08 06:22:15 +08:00
|
|
|
&private->layer_set, NULL);
|
2016-10-10 06:02:16 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
2016-10-20 06:30:10 +08:00
|
|
|
private->fill_type_combo = combo =
|
|
|
|
gimp_enum_combo_box_new (GIMP_TYPE_FILL_TYPE);
|
2016-10-10 06:02:16 +08:00
|
|
|
gtk_box_pack_end (GTK_BOX (hbox), combo, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (combo);
|
|
|
|
|
|
|
|
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo),
|
|
|
|
private->fill_type,
|
|
|
|
G_CALLBACK (gimp_int_combo_box_get_active),
|
2019-08-08 06:22:15 +08:00
|
|
|
&private->fill_type, NULL);
|
2016-10-10 06:02:16 +08:00
|
|
|
|
|
|
|
if (GIMP_IS_IMAGE (viewable))
|
|
|
|
{
|
|
|
|
GtkWidget *label;
|
|
|
|
|
|
|
|
label = gtk_label_new_with_mnemonic (_("_Fill with:"));
|
|
|
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo);
|
|
|
|
|
|
|
|
gtk_size_group_add_widget (size_group, label);
|
2012-09-06 05:26:54 +08:00
|
|
|
|
2016-10-20 06:30:10 +08:00
|
|
|
private->text_layers_button = button =
|
|
|
|
gtk_check_button_new_with_mnemonic (_("Resize _text layers"));
|
2012-09-06 05:26:54 +08:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
|
|
|
|
private->resize_text_layers);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
|
|
|
g_signal_connect (button, "toggled",
|
|
|
|
G_CALLBACK (gimp_toggle_button_update),
|
|
|
|
&private->resize_text_layers);
|
2016-10-10 06:02:16 +08:00
|
|
|
|
2016-10-19 18:56:50 +08:00
|
|
|
gimp_help_set_help_data (button,
|
|
|
|
_("Resizing text layers will make them uneditable"),
|
|
|
|
NULL);
|
|
|
|
|
2016-10-10 06:02:16 +08:00
|
|
|
g_object_unref (size_group);
|
2005-02-25 00:39:12 +08:00
|
|
|
}
|
|
|
|
|
2004-10-27 18:33:08 +08:00
|
|
|
return dialog;
|
|
|
|
}
|
|
|
|
|
2016-10-28 03:26:07 +08:00
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
|
|
|
static void
|
|
|
|
resize_dialog_free (ResizeDialog *private)
|
|
|
|
{
|
2021-01-25 04:03:25 +08:00
|
|
|
g_object_unref (private->context);
|
|
|
|
|
2016-10-28 03:26:07 +08:00
|
|
|
g_slice_free (ResizeDialog, private);
|
|
|
|
}
|
|
|
|
|
2004-10-27 18:33:08 +08:00
|
|
|
static void
|
|
|
|
resize_dialog_response (GtkWidget *dialog,
|
|
|
|
gint response_id,
|
|
|
|
ResizeDialog *private)
|
|
|
|
{
|
2004-10-31 07:16:19 +08:00
|
|
|
GimpSizeEntry *entry = GIMP_SIZE_ENTRY (private->offset);
|
Issue #8900 and #9923: reimplementing GimpUnit as a proper class.
This fixes all our GObject Introspection issues with GimpUnit which was
both an enum and an int-derived type of user-defined units *completing*
the enum values. GIR clearly didn't like this!
Now GimpUnit is a proper class and units are unique objects, allowing to
compare them with an identity test (i.e. `unit == gimp_unit_pixel ()`
tells us if unit is the pixel unit or not), which makes it easy to use,
just like with int, yet adding also methods, making for nicer
introspected API.
As an aside, this also fixes #10738, by having all the built-in units
retrievable even if libgimpbase had not been properly initialized with
gimp_base_init().
I haven't checked in details how GIR works to introspect, but it looks
like it loads the library to inspect and runs functions, hence
triggering some CRITICALS because virtual methods (supposed to be
initialized with gimp_base_init() run by libgimp) are not set. This new
code won't trigger any critical because the vtable method are now not
necessary, at least for all built-in units.
Note that GimpUnit is still in libgimpbase. It could have been moved to
libgimp in order to avoid any virtual method table (since we need to
keep core and libgimp side's units in sync, PDB is required), but too
many libgimpwidgets widgets were already using GimpUnit. And technically
most of GimpUnit logic doesn't require PDB (only the creation/sync
part). This is one of the reasons why user-created GimpUnit list is
handled and stored differently from other types of objects.
Globally this simplifies the code a lot too and we don't need separate
implementations of various utils for core and libgimp, which means less
prone to errors.
2024-07-26 02:55:21 +08:00
|
|
|
GimpUnit *unit;
|
2004-10-31 07:16:19 +08:00
|
|
|
gint width;
|
|
|
|
gint height;
|
2021-02-08 00:06:41 +08:00
|
|
|
gdouble xres;
|
|
|
|
gdouble yres;
|
Issue #8900 and #9923: reimplementing GimpUnit as a proper class.
This fixes all our GObject Introspection issues with GimpUnit which was
both an enum and an int-derived type of user-defined units *completing*
the enum values. GIR clearly didn't like this!
Now GimpUnit is a proper class and units are unique objects, allowing to
compare them with an identity test (i.e. `unit == gimp_unit_pixel ()`
tells us if unit is the pixel unit or not), which makes it easy to use,
just like with int, yet adding also methods, making for nicer
introspected API.
As an aside, this also fixes #10738, by having all the built-in units
retrievable even if libgimpbase had not been properly initialized with
gimp_base_init().
I haven't checked in details how GIR works to introspect, but it looks
like it loads the library to inspect and runs functions, hence
triggering some CRITICALS because virtual methods (supposed to be
initialized with gimp_base_init() run by libgimp) are not set. This new
code won't trigger any critical because the vtable method are now not
necessary, at least for all built-in units.
Note that GimpUnit is still in libgimpbase. It could have been moved to
libgimp in order to avoid any virtual method table (since we need to
keep core and libgimp side's units in sync, PDB is required), but too
many libgimpwidgets widgets were already using GimpUnit. And technically
most of GimpUnit logic doesn't require PDB (only the creation/sync
part). This is one of the reasons why user-created GimpUnit list is
handled and stored differently from other types of objects.
Globally this simplifies the code a lot too and we don't need separate
implementations of various utils for core and libgimp, which means less
prone to errors.
2024-07-26 02:55:21 +08:00
|
|
|
GimpUnit *res_unit;
|
2004-10-27 18:33:08 +08:00
|
|
|
|
|
|
|
switch (response_id)
|
|
|
|
{
|
|
|
|
case RESPONSE_RESET:
|
|
|
|
resize_dialog_reset (private);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_RESPONSE_OK:
|
|
|
|
g_object_get (private->box,
|
2021-02-08 00:06:41 +08:00
|
|
|
"width", &width,
|
|
|
|
"height", &height,
|
|
|
|
"unit", &unit,
|
|
|
|
"xresolution", &xres,
|
|
|
|
"yresolution", &yres,
|
|
|
|
"resolution-unit", &res_unit,
|
2004-10-27 18:33:08 +08:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
private->callback (dialog,
|
|
|
|
private->viewable,
|
2021-01-25 04:03:25 +08:00
|
|
|
private->parent_context,
|
2004-10-31 07:16:19 +08:00
|
|
|
width,
|
|
|
|
height,
|
2005-08-25 01:22:07 +08:00
|
|
|
unit,
|
2004-10-31 07:16:19 +08:00
|
|
|
gimp_size_entry_get_refval (entry, 0),
|
|
|
|
gimp_size_entry_get_refval (entry, 1),
|
2021-02-08 00:06:41 +08:00
|
|
|
xres,
|
|
|
|
yres,
|
|
|
|
res_unit,
|
2016-10-20 06:30:10 +08:00
|
|
|
private->fill_type,
|
2006-05-19 22:50:46 +08:00
|
|
|
private->layer_set,
|
2012-09-06 05:26:54 +08:00
|
|
|
private->resize_text_layers,
|
2004-10-27 18:33:08 +08:00
|
|
|
private->user_data);
|
2004-11-08 19:22:24 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
gtk_widget_destroy (dialog);
|
2004-10-27 18:33:08 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-10-31 02:11:16 +08:00
|
|
|
resize_dialog_reset (ResizeDialog *private)
|
2004-10-27 18:33:08 +08:00
|
|
|
{
|
2004-10-31 02:11:16 +08:00
|
|
|
g_object_set (private->box,
|
2004-11-06 20:30:38 +08:00
|
|
|
"keep-aspect", FALSE,
|
2005-03-03 05:13:02 +08:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
g_object_set (private->box,
|
2021-02-08 00:06:41 +08:00
|
|
|
"unit", private->old_unit,
|
|
|
|
"xresolution", private->old_xres,
|
|
|
|
"yresolution", private->old_yres,
|
|
|
|
"resolution-unit", private->old_res_unit,
|
2005-03-03 05:13:02 +08:00
|
|
|
NULL);
|
2023-11-07 06:22:39 +08:00
|
|
|
/**
|
|
|
|
* reset width and height after the other properties to avoid the problems
|
|
|
|
* noted in issue #10225
|
|
|
|
**/
|
|
|
|
|
|
|
|
g_object_set (private->box,
|
|
|
|
"width", private->old_width,
|
|
|
|
"height", private->old_height,
|
|
|
|
NULL);
|
2016-10-20 06:30:10 +08:00
|
|
|
|
|
|
|
if (private->layer_set_combo)
|
|
|
|
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (private->layer_set_combo),
|
|
|
|
private->old_layer_set);
|
|
|
|
|
|
|
|
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (private->fill_type_combo),
|
|
|
|
private->old_fill_type);
|
|
|
|
|
|
|
|
if (private->text_layers_button)
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (private->text_layers_button),
|
|
|
|
private->old_resize_text_layers);
|
2021-01-25 04:03:25 +08:00
|
|
|
|
|
|
|
gimp_context_set_template (private->context, NULL);
|
|
|
|
|
|
|
|
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->offset),
|
|
|
|
private->old_unit);
|
2004-10-31 07:16:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
size_notify (GimpSizeBox *box,
|
|
|
|
GParamSpec *pspec,
|
|
|
|
ResizeDialog *private)
|
|
|
|
{
|
|
|
|
gint diff_x = box->width - private->old_width;
|
|
|
|
gint diff_y = box->height - private->old_height;
|
|
|
|
|
|
|
|
gimp_offset_area_set_size (GIMP_OFFSET_AREA (private->area),
|
|
|
|
box->width, box->height);
|
1999-05-02 22:24:54 +08:00
|
|
|
|
2004-10-31 07:16:19 +08:00
|
|
|
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (private->offset), 0,
|
|
|
|
MIN (0, diff_x), MAX (0, diff_x));
|
|
|
|
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (private->offset), 1,
|
|
|
|
MIN (0, diff_y), MAX (0, diff_y));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
1999-05-31 22:11:10 +08:00
|
|
|
static gint
|
2004-10-31 02:11:16 +08:00
|
|
|
resize_bound_off_x (ResizeDialog *private,
|
2006-04-12 20:49:29 +08:00
|
|
|
gint offset_x)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-10-31 02:11:16 +08:00
|
|
|
GimpSizeBox *box = GIMP_SIZE_BOX (private->box);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-10-31 02:11:16 +08:00
|
|
|
if (private->old_width <= box->width)
|
|
|
|
return CLAMP (offset_x, 0, (box->width - private->old_width));
|
1997-11-25 06:05:25 +08:00
|
|
|
else
|
2004-10-31 02:11:16 +08:00
|
|
|
return CLAMP (offset_x, (box->width - private->old_width), 0);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
1999-05-31 22:11:10 +08:00
|
|
|
static gint
|
2004-10-31 02:11:16 +08:00
|
|
|
resize_bound_off_y (ResizeDialog *private,
|
2006-04-12 20:49:29 +08:00
|
|
|
gint off_y)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-10-31 02:11:16 +08:00
|
|
|
GimpSizeBox *box = GIMP_SIZE_BOX (private->box);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-10-31 02:11:16 +08:00
|
|
|
if (private->old_height <= box->height)
|
|
|
|
return CLAMP (off_y, 0, (box->height - private->old_height));
|
1997-11-25 06:05:25 +08:00
|
|
|
else
|
2004-10-31 02:11:16 +08:00
|
|
|
return CLAMP (off_y, (box->height - private->old_height), 0);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-10-29 02:27:04 +08:00
|
|
|
offset_update (GtkWidget *widget,
|
2006-04-12 20:49:29 +08:00
|
|
|
ResizeDialog *private)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-10-31 02:11:16 +08:00
|
|
|
GimpSizeEntry *entry = GIMP_SIZE_ENTRY (private->offset);
|
2004-10-29 02:27:04 +08:00
|
|
|
gint off_x;
|
|
|
|
gint off_y;
|
2001-11-10 06:57:51 +08:00
|
|
|
|
2004-10-31 02:11:16 +08:00
|
|
|
off_x = resize_bound_off_x (private,
|
2004-10-29 02:27:04 +08:00
|
|
|
RINT (gimp_size_entry_get_refval (entry, 0)));
|
2004-10-31 02:11:16 +08:00
|
|
|
off_y = resize_bound_off_y (private,
|
2004-10-29 02:27:04 +08:00
|
|
|
RINT (gimp_size_entry_get_refval (entry, 1)));
|
2001-11-10 06:57:51 +08:00
|
|
|
|
2004-10-31 02:11:16 +08:00
|
|
|
gimp_offset_area_set_offsets (GIMP_OFFSET_AREA (private->area), off_x, off_y);
|
2000-10-19 07:31:38 +08:00
|
|
|
}
|
2003-09-24 05:51:08 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
static void
|
2004-10-29 02:27:04 +08:00
|
|
|
offsets_changed (GtkWidget *area,
|
|
|
|
gint off_x,
|
|
|
|
gint off_y,
|
2004-10-31 02:11:16 +08:00
|
|
|
ResizeDialog *private)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-10-31 02:11:16 +08:00
|
|
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->offset), 0, off_x);
|
|
|
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->offset), 1, off_y);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-10-29 02:27:04 +08:00
|
|
|
offset_center_clicked (GtkWidget *widget,
|
2004-10-31 02:11:16 +08:00
|
|
|
ResizeDialog *private)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-10-31 02:11:16 +08:00
|
|
|
GimpSizeBox *box = GIMP_SIZE_BOX (private->box);
|
2004-10-29 02:27:04 +08:00
|
|
|
gint off_x;
|
|
|
|
gint off_y;
|
1999-05-31 22:11:10 +08:00
|
|
|
|
2004-10-31 02:11:16 +08:00
|
|
|
off_x = resize_bound_off_x (private, (box->width - private->old_width) / 2);
|
|
|
|
off_y = resize_bound_off_y (private, (box->height - private->old_height) / 2);
|
1999-05-02 22:24:54 +08:00
|
|
|
|
2004-10-31 02:11:16 +08:00
|
|
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->offset), 0, off_x);
|
|
|
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->offset), 1, off_y);
|
1999-05-05 01:20:05 +08:00
|
|
|
|
2005-05-28 00:51:39 +08:00
|
|
|
g_signal_emit_by_name (private->offset, "value-changed", 0);
|
1999-05-05 01:20:05 +08:00
|
|
|
}
|
2021-01-25 04:03:25 +08:00
|
|
|
|
|
|
|
static void
|
|
|
|
template_changed (GimpContext *context,
|
|
|
|
GimpTemplate *template,
|
|
|
|
ResizeDialog *private)
|
|
|
|
{
|
Issue #8900 and #9923: reimplementing GimpUnit as a proper class.
This fixes all our GObject Introspection issues with GimpUnit which was
both an enum and an int-derived type of user-defined units *completing*
the enum values. GIR clearly didn't like this!
Now GimpUnit is a proper class and units are unique objects, allowing to
compare them with an identity test (i.e. `unit == gimp_unit_pixel ()`
tells us if unit is the pixel unit or not), which makes it easy to use,
just like with int, yet adding also methods, making for nicer
introspected API.
As an aside, this also fixes #10738, by having all the built-in units
retrievable even if libgimpbase had not been properly initialized with
gimp_base_init().
I haven't checked in details how GIR works to introspect, but it looks
like it loads the library to inspect and runs functions, hence
triggering some CRITICALS because virtual methods (supposed to be
initialized with gimp_base_init() run by libgimp) are not set. This new
code won't trigger any critical because the vtable method are now not
necessary, at least for all built-in units.
Note that GimpUnit is still in libgimpbase. It could have been moved to
libgimp in order to avoid any virtual method table (since we need to
keep core and libgimp side's units in sync, PDB is required), but too
many libgimpwidgets widgets were already using GimpUnit. And technically
most of GimpUnit logic doesn't require PDB (only the creation/sync
part). This is one of the reasons why user-created GimpUnit list is
handled and stored differently from other types of objects.
Globally this simplifies the code a lot too and we don't need separate
implementations of various utils for core and libgimp, which means less
prone to errors.
2024-07-26 02:55:21 +08:00
|
|
|
GimpUnit *unit = private->old_unit;
|
2021-02-08 00:06:41 +08:00
|
|
|
|
|
|
|
private->template = template;
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (private->ppi_image), TRUE);
|
|
|
|
gtk_widget_hide (private->ppi_box);
|
|
|
|
|
|
|
|
if (template != NULL)
|
|
|
|
{
|
Issue #8900 and #9923: reimplementing GimpUnit as a proper class.
This fixes all our GObject Introspection issues with GimpUnit which was
both an enum and an int-derived type of user-defined units *completing*
the enum values. GIR clearly didn't like this!
Now GimpUnit is a proper class and units are unique objects, allowing to
compare them with an identity test (i.e. `unit == gimp_unit_pixel ()`
tells us if unit is the pixel unit or not), which makes it easy to use,
just like with int, yet adding also methods, making for nicer
introspected API.
As an aside, this also fixes #10738, by having all the built-in units
retrievable even if libgimpbase had not been properly initialized with
gimp_base_init().
I haven't checked in details how GIR works to introspect, but it looks
like it loads the library to inspect and runs functions, hence
triggering some CRITICALS because virtual methods (supposed to be
initialized with gimp_base_init() run by libgimp) are not set. This new
code won't trigger any critical because the vtable method are now not
necessary, at least for all built-in units.
Note that GimpUnit is still in libgimpbase. It could have been moved to
libgimp in order to avoid any virtual method table (since we need to
keep core and libgimp side's units in sync, PDB is required), but too
many libgimpwidgets widgets were already using GimpUnit. And technically
most of GimpUnit logic doesn't require PDB (only the creation/sync
part). This is one of the reasons why user-created GimpUnit list is
handled and stored differently from other types of objects.
Globally this simplifies the code a lot too and we don't need separate
implementations of various utils for core and libgimp, which means less
prone to errors.
2024-07-26 02:55:21 +08:00
|
|
|
gdouble xres;
|
|
|
|
gdouble yres;
|
|
|
|
GimpUnit *res_unit;
|
|
|
|
gboolean resolution_mismatch;
|
2021-02-08 00:06:41 +08:00
|
|
|
|
|
|
|
unit = gimp_template_get_unit (template);
|
|
|
|
xres = gimp_template_get_resolution_x (template);
|
|
|
|
yres = gimp_template_get_resolution_y (template);
|
|
|
|
res_unit = gimp_template_get_resolution_unit (template);
|
|
|
|
|
|
|
|
resolution_mismatch = xres != private->old_xres ||
|
|
|
|
yres != private->old_yres ||
|
|
|
|
res_unit != private->old_res_unit;
|
|
|
|
|
Issue #8900 and #9923: reimplementing GimpUnit as a proper class.
This fixes all our GObject Introspection issues with GimpUnit which was
both an enum and an int-derived type of user-defined units *completing*
the enum values. GIR clearly didn't like this!
Now GimpUnit is a proper class and units are unique objects, allowing to
compare them with an identity test (i.e. `unit == gimp_unit_pixel ()`
tells us if unit is the pixel unit or not), which makes it easy to use,
just like with int, yet adding also methods, making for nicer
introspected API.
As an aside, this also fixes #10738, by having all the built-in units
retrievable even if libgimpbase had not been properly initialized with
gimp_base_init().
I haven't checked in details how GIR works to introspect, but it looks
like it loads the library to inspect and runs functions, hence
triggering some CRITICALS because virtual methods (supposed to be
initialized with gimp_base_init() run by libgimp) are not set. This new
code won't trigger any critical because the vtable method are now not
necessary, at least for all built-in units.
Note that GimpUnit is still in libgimpbase. It could have been moved to
libgimp in order to avoid any virtual method table (since we need to
keep core and libgimp side's units in sync, PDB is required), but too
many libgimpwidgets widgets were already using GimpUnit. And technically
most of GimpUnit logic doesn't require PDB (only the creation/sync
part). This is one of the reasons why user-created GimpUnit list is
handled and stored differently from other types of objects.
Globally this simplifies the code a lot too and we don't need separate
implementations of various utils for core and libgimp, which means less
prone to errors.
2024-07-26 02:55:21 +08:00
|
|
|
if (resolution_mismatch && unit != gimp_unit_pixel ())
|
2021-02-08 00:06:41 +08:00
|
|
|
{
|
|
|
|
gchar *text;
|
|
|
|
|
|
|
|
text = g_strdup_printf (_("Scale template to %.2f ppi"),
|
|
|
|
private->old_xres);
|
|
|
|
gtk_button_set_label (GTK_BUTTON (private->ppi_image), text);
|
|
|
|
g_free (text);
|
|
|
|
|
|
|
|
text = g_strdup_printf (_("Set image to %.2f ppi"),
|
|
|
|
xres);
|
|
|
|
gtk_button_set_label (GTK_BUTTON (private->ppi_template), text);
|
|
|
|
g_free (text);
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (private->ppi_image),
|
|
|
|
TRUE);
|
|
|
|
|
|
|
|
gtk_widget_show (private->ppi_box);
|
|
|
|
}
|
|
|
|
}
|
2021-01-25 04:03:25 +08:00
|
|
|
|
2021-02-08 00:06:41 +08:00
|
|
|
ppi_select_toggled (NULL, private);
|
|
|
|
|
|
|
|
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->offset), unit);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ppi_select_toggled (GtkWidget *radio,
|
|
|
|
ResizeDialog *private)
|
|
|
|
{
|
|
|
|
gint width;
|
|
|
|
gint height;
|
Issue #8900 and #9923: reimplementing GimpUnit as a proper class.
This fixes all our GObject Introspection issues with GimpUnit which was
both an enum and an int-derived type of user-defined units *completing*
the enum values. GIR clearly didn't like this!
Now GimpUnit is a proper class and units are unique objects, allowing to
compare them with an identity test (i.e. `unit == gimp_unit_pixel ()`
tells us if unit is the pixel unit or not), which makes it easy to use,
just like with int, yet adding also methods, making for nicer
introspected API.
As an aside, this also fixes #10738, by having all the built-in units
retrievable even if libgimpbase had not been properly initialized with
gimp_base_init().
I haven't checked in details how GIR works to introspect, but it looks
like it loads the library to inspect and runs functions, hence
triggering some CRITICALS because virtual methods (supposed to be
initialized with gimp_base_init() run by libgimp) are not set. This new
code won't trigger any critical because the vtable method are now not
necessary, at least for all built-in units.
Note that GimpUnit is still in libgimpbase. It could have been moved to
libgimp in order to avoid any virtual method table (since we need to
keep core and libgimp side's units in sync, PDB is required), but too
many libgimpwidgets widgets were already using GimpUnit. And technically
most of GimpUnit logic doesn't require PDB (only the creation/sync
part). This is one of the reasons why user-created GimpUnit list is
handled and stored differently from other types of objects.
Globally this simplifies the code a lot too and we don't need separate
implementations of various utils for core and libgimp, which means less
prone to errors.
2024-07-26 02:55:21 +08:00
|
|
|
GimpUnit *unit;
|
2021-02-08 00:06:41 +08:00
|
|
|
gdouble xres;
|
|
|
|
gdouble yres;
|
Issue #8900 and #9923: reimplementing GimpUnit as a proper class.
This fixes all our GObject Introspection issues with GimpUnit which was
both an enum and an int-derived type of user-defined units *completing*
the enum values. GIR clearly didn't like this!
Now GimpUnit is a proper class and units are unique objects, allowing to
compare them with an identity test (i.e. `unit == gimp_unit_pixel ()`
tells us if unit is the pixel unit or not), which makes it easy to use,
just like with int, yet adding also methods, making for nicer
introspected API.
As an aside, this also fixes #10738, by having all the built-in units
retrievable even if libgimpbase had not been properly initialized with
gimp_base_init().
I haven't checked in details how GIR works to introspect, but it looks
like it loads the library to inspect and runs functions, hence
triggering some CRITICALS because virtual methods (supposed to be
initialized with gimp_base_init() run by libgimp) are not set. This new
code won't trigger any critical because the vtable method are now not
necessary, at least for all built-in units.
Note that GimpUnit is still in libgimpbase. It could have been moved to
libgimp in order to avoid any virtual method table (since we need to
keep core and libgimp side's units in sync, PDB is required), but too
many libgimpwidgets widgets were already using GimpUnit. And technically
most of GimpUnit logic doesn't require PDB (only the creation/sync
part). This is one of the reasons why user-created GimpUnit list is
handled and stored differently from other types of objects.
Globally this simplifies the code a lot too and we don't need separate
implementations of various utils for core and libgimp, which means less
prone to errors.
2024-07-26 02:55:21 +08:00
|
|
|
GimpUnit *res_unit;
|
2021-02-08 00:06:41 +08:00
|
|
|
GtkToggleButton *image_button;
|
|
|
|
gboolean use_image_ppi;
|
|
|
|
|
|
|
|
width = private->old_width;
|
|
|
|
height = private->old_height;
|
|
|
|
xres = private->old_xres;
|
|
|
|
yres = private->old_yres;
|
|
|
|
res_unit = private->old_res_unit;
|
|
|
|
unit = private->old_unit;
|
|
|
|
|
|
|
|
image_button = GTK_TOGGLE_BUTTON (private->ppi_image);
|
|
|
|
use_image_ppi = gtk_toggle_button_get_active (image_button);
|
|
|
|
|
|
|
|
if (private->template != NULL)
|
|
|
|
{
|
|
|
|
width = gimp_template_get_width (private->template);
|
|
|
|
height = gimp_template_get_height (private->template);
|
|
|
|
unit = gimp_template_get_unit (private->template);
|
|
|
|
xres = gimp_template_get_resolution_x (private->template);
|
|
|
|
yres = gimp_template_get_resolution_y (private->template);
|
|
|
|
res_unit = gimp_template_get_resolution_unit (private->template);
|
|
|
|
}
|
2021-01-25 04:03:25 +08:00
|
|
|
|
Issue #8900 and #9923: reimplementing GimpUnit as a proper class.
This fixes all our GObject Introspection issues with GimpUnit which was
both an enum and an int-derived type of user-defined units *completing*
the enum values. GIR clearly didn't like this!
Now GimpUnit is a proper class and units are unique objects, allowing to
compare them with an identity test (i.e. `unit == gimp_unit_pixel ()`
tells us if unit is the pixel unit or not), which makes it easy to use,
just like with int, yet adding also methods, making for nicer
introspected API.
As an aside, this also fixes #10738, by having all the built-in units
retrievable even if libgimpbase had not been properly initialized with
gimp_base_init().
I haven't checked in details how GIR works to introspect, but it looks
like it loads the library to inspect and runs functions, hence
triggering some CRITICALS because virtual methods (supposed to be
initialized with gimp_base_init() run by libgimp) are not set. This new
code won't trigger any critical because the vtable method are now not
necessary, at least for all built-in units.
Note that GimpUnit is still in libgimpbase. It could have been moved to
libgimp in order to avoid any virtual method table (since we need to
keep core and libgimp side's units in sync, PDB is required), but too
many libgimpwidgets widgets were already using GimpUnit. And technically
most of GimpUnit logic doesn't require PDB (only the creation/sync
part). This is one of the reasons why user-created GimpUnit list is
handled and stored differently from other types of objects.
Globally this simplifies the code a lot too and we don't need separate
implementations of various utils for core and libgimp, which means less
prone to errors.
2024-07-26 02:55:21 +08:00
|
|
|
if (private->template != NULL && unit != gimp_unit_pixel ())
|
2021-02-08 00:06:41 +08:00
|
|
|
{
|
|
|
|
if (use_image_ppi)
|
|
|
|
{
|
|
|
|
width = ceil (width * (private->old_xres / xres));
|
|
|
|
height = ceil (height * (private->old_yres / yres));
|
|
|
|
|
|
|
|
xres = private->old_xres;
|
|
|
|
yres = private->old_yres;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_object_set (private->box,
|
|
|
|
"xresolution", xres,
|
|
|
|
"yresolution", yres,
|
|
|
|
"resolution-unit", res_unit,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_object_set (private->box,
|
|
|
|
"xresolution", private->old_xres,
|
|
|
|
"yresolution", private->old_yres,
|
|
|
|
"resolution-unit", private->old_res_unit,
|
|
|
|
NULL);
|
|
|
|
}
|
2021-01-25 04:03:25 +08:00
|
|
|
|
|
|
|
g_object_set (private->box,
|
|
|
|
"width", width,
|
|
|
|
"height", height,
|
|
|
|
"unit", unit,
|
|
|
|
NULL);
|
2021-02-08 00:06:41 +08:00
|
|
|
}
|
2021-01-25 04:03:25 +08:00
|
|
|
|
2021-02-08 00:06:41 +08:00
|
|
|
static void
|
|
|
|
reset_template_clicked (GtkWidget *button,
|
|
|
|
ResizeDialog *private)
|
|
|
|
{
|
|
|
|
gimp_context_set_template (private->context, NULL);
|
2021-01-25 04:03:25 +08:00
|
|
|
}
|