2006-12-09 21:33:38 +00:00
|
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2003-04-11 13:17:23 +00:00
|
|
|
|
* Copyright (C) 1995-1999 Spencer Kimball and Peter Mattis
|
|
|
|
|
*
|
2009-01-17 22:28:01 +00:00
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2003-04-11 13:17:23 +00:00
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-17 22:28:01 +00:00
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2003-04-11 13:17:23 +00:00
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-07-11 23:27:07 +02:00
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2003-04-11 13:17:23 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
2012-04-21 21:41:36 +02:00
|
|
|
|
#include <gegl.h>
|
2003-04-11 13:17:23 +00:00
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
|
|
#include "libgimpmath/gimpmath.h"
|
|
|
|
|
#include "libgimpbase/gimpbase.h"
|
2022-08-06 04:42:46 +00:00
|
|
|
|
#include "libgimpcolor/gimpcolor.h"
|
2005-01-25 19:11:26 +00:00
|
|
|
|
#include "libgimpconfig/gimpconfig.h"
|
2003-04-11 13:17:23 +00:00
|
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
|
|
|
|
|
#include "widgets-types.h"
|
|
|
|
|
|
2016-05-22 13:26:50 +02:00
|
|
|
|
#include "config/gimpcoreconfig.h"
|
|
|
|
|
|
2019-03-31 14:54:30 -04:00
|
|
|
|
#include "gegl/gimp-babl.h"
|
|
|
|
|
|
2003-04-11 13:17:23 +00:00
|
|
|
|
#include "core/gimp.h"
|
|
|
|
|
#include "core/gimptemplate.h"
|
2019-05-31 17:26:50 +02:00
|
|
|
|
#include "core/gimp-utils.h"
|
2003-04-11 13:17:23 +00:00
|
|
|
|
|
2011-03-22 15:20:03 +01:00
|
|
|
|
#include "gimppropwidgets.h"
|
2003-04-11 13:17:23 +00:00
|
|
|
|
#include "gimptemplateeditor.h"
|
2016-05-22 13:26:50 +02:00
|
|
|
|
#include "gimpwidgets-utils.h"
|
2003-04-11 13:17:23 +00:00
|
|
|
|
|
|
|
|
|
#include "gimp-intl.h"
|
|
|
|
|
|
|
|
|
|
|
2004-05-07 15:45:56 +00:00
|
|
|
|
#define SB_WIDTH 8
|
2003-10-15 15:30:11 +00:00
|
|
|
|
#define MAX_COMMENT_LENGTH 512 /* arbitrary */
|
2003-04-11 13:17:23 +00:00
|
|
|
|
|
2011-03-01 11:50:16 +01:00
|
|
|
|
|
2003-10-14 15:20:59 +00:00
|
|
|
|
enum
|
|
|
|
|
{
|
|
|
|
|
PROP_0,
|
2016-05-22 13:26:50 +02:00
|
|
|
|
PROP_GIMP,
|
2003-10-14 15:20:59 +00:00
|
|
|
|
PROP_TEMPLATE
|
|
|
|
|
};
|
|
|
|
|
|
2003-04-11 13:17:23 +00:00
|
|
|
|
|
2011-03-01 11:50:16 +01:00
|
|
|
|
typedef struct _GimpTemplateEditorPrivate GimpTemplateEditorPrivate;
|
|
|
|
|
|
|
|
|
|
struct _GimpTemplateEditorPrivate
|
|
|
|
|
{
|
2016-05-22 13:26:50 +02:00
|
|
|
|
Gimp *gimp;
|
|
|
|
|
|
2011-03-01 11:50:16 +01:00
|
|
|
|
GimpTemplate *template;
|
|
|
|
|
|
|
|
|
|
GtkWidget *aspect_button;
|
|
|
|
|
gboolean block_aspect;
|
|
|
|
|
|
|
|
|
|
GtkWidget *expander;
|
|
|
|
|
GtkWidget *size_se;
|
|
|
|
|
GtkWidget *memsize_label;
|
|
|
|
|
GtkWidget *pixel_label;
|
|
|
|
|
GtkWidget *more_label;
|
|
|
|
|
GtkWidget *resolution_se;
|
2014-04-18 18:43:32 +02:00
|
|
|
|
GtkWidget *chain_button;
|
2019-03-31 14:54:30 -04:00
|
|
|
|
GtkWidget *precision_combo;
|
2016-05-22 13:26:50 +02:00
|
|
|
|
GtkWidget *profile_combo;
|
2022-08-06 04:42:46 +00:00
|
|
|
|
GtkWidget *simulation_profile_combo;
|
|
|
|
|
GtkWidget *simulation_intent_combo;
|
|
|
|
|
GtkWidget *simulation_bpc_toggle;
|
2011-03-01 11:50:16 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define GET_PRIVATE(editor) \
|
app, libgimp*, modules: don't use g_type_class_add_private() ...
... and G_TYPE_INSTANCE_GET_PRIVATE()
g_type_class_add_private() and G_TYPE_INSTANCE_GET_PRIVATE() were
deprecated in GLib 2.58. Instead, use
G_DEFINE_[ABSTRACT_]TYPE_WITH_PRIVATE(), and
G_ADD_PRIVATE[_DYNAMIC](), and the implictly-defined
foo_get_instance_private() functions, all of which are available in
the GLib versions we depend on.
This commit only covers types registered using one of the
G_DEFINE_FOO() macros (i.e., most types), but not types with a
custom registration function, of which we still have a few -- GLib
currently only provides a (non-deprecated) public API for adding a
private struct using the G_DEFINE_FOO() macros.
Note that this commit was 99% auto-generated (because I'm not
*that* crazy :), so if there are any style mismatches... we'll have
to live with them for now.
2018-09-18 12:09:39 -04:00
|
|
|
|
((GimpTemplateEditorPrivate *) gimp_template_editor_get_instance_private ((GimpTemplateEditor *) (editor)))
|
2011-03-01 11:50:16 +01:00
|
|
|
|
|
|
|
|
|
|
2016-11-10 13:50:56 +01:00
|
|
|
|
static void gimp_template_editor_constructed (GObject *object);
|
|
|
|
|
static void gimp_template_editor_finalize (GObject *object);
|
|
|
|
|
static void gimp_template_editor_set_property (GObject *object,
|
|
|
|
|
guint property_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec);
|
|
|
|
|
static void gimp_template_editor_get_property (GObject *object,
|
|
|
|
|
guint property_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec);
|
|
|
|
|
|
|
|
|
|
static void gimp_template_editor_precision_changed (GtkWidget *widget,
|
|
|
|
|
GimpTemplateEditor *editor);
|
2022-08-06 04:42:46 +00:00
|
|
|
|
static void gimp_template_editor_simulation_intent_changed
|
|
|
|
|
(GtkWidget *widget,
|
|
|
|
|
GimpTemplateEditor *editor);
|
|
|
|
|
static void gimp_template_editor_simulation_bpc_toggled
|
|
|
|
|
(GtkWidget *widget,
|
|
|
|
|
GimpTemplateEditor *editor);
|
|
|
|
|
|
2016-11-10 13:50:56 +01:00
|
|
|
|
static void gimp_template_editor_aspect_callback (GtkWidget *widget,
|
|
|
|
|
GimpTemplateEditor *editor);
|
|
|
|
|
static void gimp_template_editor_template_notify (GimpTemplate *template,
|
|
|
|
|
GParamSpec *param_spec,
|
|
|
|
|
GimpTemplateEditor *editor);
|
2003-04-11 13:17:23 +00:00
|
|
|
|
|
|
|
|
|
|
app, libgimp*, modules: don't use g_type_class_add_private() ...
... and G_TYPE_INSTANCE_GET_PRIVATE()
g_type_class_add_private() and G_TYPE_INSTANCE_GET_PRIVATE() were
deprecated in GLib 2.58. Instead, use
G_DEFINE_[ABSTRACT_]TYPE_WITH_PRIVATE(), and
G_ADD_PRIVATE[_DYNAMIC](), and the implictly-defined
foo_get_instance_private() functions, all of which are available in
the GLib versions we depend on.
This commit only covers types registered using one of the
G_DEFINE_FOO() macros (i.e., most types), but not types with a
custom registration function, of which we still have a few -- GLib
currently only provides a (non-deprecated) public API for adding a
private struct using the G_DEFINE_FOO() macros.
Note that this commit was 99% auto-generated (because I'm not
*that* crazy :), so if there are any style mismatches... we'll have
to live with them for now.
2018-09-18 12:09:39 -04:00
|
|
|
|
G_DEFINE_TYPE_WITH_PRIVATE (GimpTemplateEditor, gimp_template_editor,
|
|
|
|
|
GTK_TYPE_BOX)
|
2003-04-11 13:17:23 +00:00
|
|
|
|
|
2005-12-19 22:37:49 +00:00
|
|
|
|
#define parent_class gimp_template_editor_parent_class
|
2003-04-11 13:17:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gimp_template_editor_class_init (GimpTemplateEditorClass *klass)
|
|
|
|
|
{
|
2005-12-19 22:37:49 +00:00
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2003-04-11 13:17:23 +00:00
|
|
|
|
|
2011-01-14 09:38:11 +01:00
|
|
|
|
object_class->constructed = gimp_template_editor_constructed;
|
2005-12-19 22:37:49 +00:00
|
|
|
|
object_class->finalize = gimp_template_editor_finalize;
|
2003-10-14 15:20:59 +00:00
|
|
|
|
object_class->set_property = gimp_template_editor_set_property;
|
|
|
|
|
object_class->get_property = gimp_template_editor_get_property;
|
|
|
|
|
|
2016-05-22 13:26:50 +02:00
|
|
|
|
g_object_class_install_property (object_class, PROP_GIMP,
|
|
|
|
|
g_param_spec_object ("gimp", NULL, NULL,
|
|
|
|
|
GIMP_TYPE_GIMP,
|
|
|
|
|
GIMP_PARAM_READWRITE |
|
|
|
|
|
G_PARAM_CONSTRUCT_ONLY));
|
|
|
|
|
|
2003-10-14 15:20:59 +00:00
|
|
|
|
g_object_class_install_property (object_class, PROP_TEMPLATE,
|
|
|
|
|
g_param_spec_object ("template", NULL, NULL,
|
|
|
|
|
GIMP_TYPE_TEMPLATE,
|
2006-01-18 20:29:40 +00:00
|
|
|
|
GIMP_PARAM_READWRITE |
|
2003-10-14 15:20:59 +00:00
|
|
|
|
G_PARAM_CONSTRUCT_ONLY));
|
2003-04-11 13:17:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gimp_template_editor_init (GimpTemplateEditor *editor)
|
|
|
|
|
{
|
2010-10-30 15:44:46 +02:00
|
|
|
|
gtk_orientable_set_orientation (GTK_ORIENTABLE (editor),
|
|
|
|
|
GTK_ORIENTATION_VERTICAL);
|
|
|
|
|
|
|
|
|
|
gtk_box_set_spacing (GTK_BOX (editor), 12);
|
2003-10-14 15:20:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-14 09:38:11 +01:00
|
|
|
|
static void
|
|
|
|
|
gimp_template_editor_constructed (GObject *object)
|
2003-10-14 15:20:59 +00:00
|
|
|
|
{
|
2011-03-01 11:50:16 +01:00
|
|
|
|
GimpTemplateEditor *editor = GIMP_TEMPLATE_EDITOR (object);
|
|
|
|
|
GimpTemplateEditorPrivate *private = GET_PRIVATE (object);
|
2011-03-02 10:16:43 +01:00
|
|
|
|
GimpTemplate *template;
|
2011-03-01 11:50:16 +01:00
|
|
|
|
GtkWidget *aspect_box;
|
|
|
|
|
GtkWidget *frame;
|
|
|
|
|
GtkWidget *hbox;
|
|
|
|
|
GtkWidget *vbox;
|
2018-05-03 01:49:05 +02:00
|
|
|
|
GtkWidget *grid;
|
2011-03-01 11:50:16 +01:00
|
|
|
|
GtkWidget *label;
|
2014-06-21 22:39:37 +02:00
|
|
|
|
GtkAdjustment *adjustment;
|
2011-03-01 11:50:16 +01:00
|
|
|
|
GtkWidget *width;
|
|
|
|
|
GtkWidget *height;
|
|
|
|
|
GtkWidget *xres;
|
|
|
|
|
GtkWidget *yres;
|
|
|
|
|
GtkWidget *combo;
|
|
|
|
|
GtkWidget *scrolled_window;
|
|
|
|
|
GtkWidget *text_view;
|
|
|
|
|
GtkTextBuffer *text_buffer;
|
2019-03-31 14:54:30 -04:00
|
|
|
|
GtkListStore *store;
|
2011-03-01 11:50:16 +01:00
|
|
|
|
gchar *text;
|
2016-11-09 12:21:39 +01:00
|
|
|
|
gint row;
|
2003-10-14 15:20:59 +00:00
|
|
|
|
|
2012-11-12 21:51:22 +01:00
|
|
|
|
G_OBJECT_CLASS (parent_class)->constructed (object);
|
2003-10-14 15:20:59 +00:00
|
|
|
|
|
2018-02-11 22:23:10 +01:00
|
|
|
|
gimp_assert (private->gimp != NULL);
|
|
|
|
|
gimp_assert (private->template != NULL);
|
2003-04-11 13:17:23 +00:00
|
|
|
|
|
2011-03-02 10:16:43 +01:00
|
|
|
|
template = private->template;
|
|
|
|
|
|
2003-04-11 13:17:23 +00:00
|
|
|
|
/* Image size frame */
|
2004-05-02 21:13:51 +00:00
|
|
|
|
frame = gimp_frame_new (_("Image Size"));
|
2003-04-11 13:17:23 +00:00
|
|
|
|
gtk_box_pack_start (GTK_BOX (editor), frame, FALSE, FALSE, 0);
|
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
2018-05-03 01:49:05 +02:00
|
|
|
|
grid = gtk_grid_new ();
|
|
|
|
|
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
|
|
|
|
|
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
|
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), grid);
|
|
|
|
|
gtk_widget_show (grid);
|
2003-04-11 13:17:23 +00:00
|
|
|
|
|
2018-06-24 18:15:16 +02:00
|
|
|
|
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 0);
|
2019-03-09 07:25:19 -05:00
|
|
|
|
width = gimp_spin_button_new (adjustment, 1.0, 2);
|
2014-06-21 22:39:37 +02:00
|
|
|
|
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (width), TRUE);
|
2004-10-12 14:14:16 +00:00
|
|
|
|
gtk_entry_set_width_chars (GTK_ENTRY (width), SB_WIDTH);
|
|
|
|
|
|
2018-06-24 18:15:16 +02:00
|
|
|
|
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 0);
|
2019-03-09 07:25:19 -05:00
|
|
|
|
height = gimp_spin_button_new (adjustment, 1.0, 2);
|
2014-06-21 22:39:37 +02:00
|
|
|
|
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (height), TRUE);
|
2004-10-12 14:14:16 +00:00
|
|
|
|
gtk_entry_set_width_chars (GTK_ENTRY (height), SB_WIDTH);
|
|
|
|
|
|
2004-05-07 15:45:56 +00:00
|
|
|
|
/* the image size labels */
|
2004-10-12 14:14:16 +00:00
|
|
|
|
label = gtk_label_new_with_mnemonic (_("_Width:"));
|
2016-09-08 19:11:20 +02:00
|
|
|
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
2004-10-12 14:14:16 +00:00
|
|
|
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), width);
|
2018-05-03 01:49:05 +02:00
|
|
|
|
gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);
|
2003-04-11 13:17:23 +00:00
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
2004-10-12 14:14:16 +00:00
|
|
|
|
label = gtk_label_new_with_mnemonic (_("H_eight:"));
|
2016-09-08 19:11:20 +02:00
|
|
|
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
2004-10-12 14:14:16 +00:00
|
|
|
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), height);
|
2018-05-03 01:49:05 +02:00
|
|
|
|
gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1);
|
2003-04-11 13:17:23 +00:00
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
|
|
/* create the sizeentry which keeps it all together */
|
2011-09-30 11:29:11 +02:00
|
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
2018-05-03 01:49:05 +02:00
|
|
|
|
gtk_grid_attach (GTK_GRID (grid), hbox, 1, 0, 1, 2);
|
2003-09-23 21:51:08 +00:00
|
|
|
|
gtk_widget_show (hbox);
|
2003-04-11 13:17:23 +00:00
|
|
|
|
|
2011-03-02 10:16:43 +01:00
|
|
|
|
private->size_se = gimp_size_entry_new (0,
|
|
|
|
|
gimp_template_get_unit (template),
|
|
|
|
|
_("%p"),
|
2011-03-01 11:50:16 +01:00
|
|
|
|
TRUE, FALSE, FALSE, SB_WIDTH,
|
|
|
|
|
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
2004-10-12 00:12:31 +00:00
|
|
|
|
|
2011-03-01 11:50:16 +01:00
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), private->size_se, FALSE, FALSE, 0);
|
|
|
|
|
gtk_widget_show (private->size_se);
|
2003-04-11 13:17:23 +00:00
|
|
|
|
|
2011-03-01 11:50:16 +01:00
|
|
|
|
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->size_se),
|
2006-04-12 12:49:29 +00:00
|
|
|
|
GTK_SPIN_BUTTON (height), NULL);
|
2018-05-02 20:23:05 +02:00
|
|
|
|
gtk_grid_attach (GTK_GRID (private->size_se), height, 0, 1, 1, 1);
|
2004-05-07 15:45:56 +00:00
|
|
|
|
gtk_widget_show (height);
|
|
|
|
|
|
2011-03-01 11:50:16 +01:00
|
|
|
|
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->size_se),
|
2006-04-12 12:49:29 +00:00
|
|
|
|
GTK_SPIN_BUTTON (width), NULL);
|
2018-05-02 20:23:05 +02:00
|
|
|
|
gtk_grid_attach (GTK_GRID (private->size_se), width, 0, 0, 1, 1);
|
2004-05-28 22:35:54 +00:00
|
|
|
|
gtk_widget_show (width);
|
|
|
|
|
|
2011-03-02 10:16:43 +01:00
|
|
|
|
gimp_prop_coordinates_connect (G_OBJECT (template),
|
2004-05-07 15:45:56 +00:00
|
|
|
|
"width", "height", "unit",
|
2011-03-01 11:50:16 +01:00
|
|
|
|
private->size_se, NULL,
|
2011-03-02 10:16:43 +01:00
|
|
|
|
gimp_template_get_resolution_x (template),
|
|
|
|
|
gimp_template_get_resolution_y (template));
|
2004-05-07 15:45:56 +00:00
|
|
|
|
|
2011-09-30 11:29:11 +02:00
|
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
|
2018-05-03 01:49:05 +02:00
|
|
|
|
gtk_grid_attach (GTK_GRID (grid), hbox, 1, 2, 2, 1);
|
2004-05-07 15:45:56 +00:00
|
|
|
|
gtk_widget_show (hbox);
|
2003-04-11 13:17:23 +00:00
|
|
|
|
|
2011-09-30 11:29:11 +02:00
|
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
2004-09-25 01:47:01 +00:00
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
|
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
|
2014-05-07 21:30:06 +02:00
|
|
|
|
aspect_box = gimp_enum_icon_box_new (GIMP_TYPE_ASPECT_TYPE,
|
|
|
|
|
"gimp", GTK_ICON_SIZE_MENU,
|
|
|
|
|
G_CALLBACK (gimp_template_editor_aspect_callback),
|
2019-08-08 00:01:10 +02:00
|
|
|
|
editor, NULL,
|
2014-05-07 21:30:06 +02:00
|
|
|
|
&private->aspect_button);
|
2011-03-01 11:50:16 +01:00
|
|
|
|
gtk_widget_hide (private->aspect_button); /* hide "square" */
|
2003-10-15 01:06:30 +00:00
|
|
|
|
|
2004-09-25 01:47:01 +00:00
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), aspect_box, FALSE, FALSE, 0);
|
2003-04-16 12:59:36 +00:00
|
|
|
|
gtk_widget_show (aspect_box);
|
2003-04-11 13:17:23 +00:00
|
|
|
|
|
2011-09-30 11:29:11 +02:00
|
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
|
2004-09-24 14:43:32 +00:00
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
|
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
|
2011-03-01 11:50:16 +01:00
|
|
|
|
private->pixel_label = gtk_label_new (NULL);
|
|
|
|
|
gimp_label_set_attributes (GTK_LABEL (private->pixel_label),
|
2004-09-24 14:43:32 +00:00
|
|
|
|
PANGO_ATTR_SCALE, PANGO_SCALE_SMALL,
|
|
|
|
|
-1);
|
2016-09-08 19:11:20 +02:00
|
|
|
|
gtk_label_set_xalign (GTK_LABEL (private->pixel_label), 0.0);
|
2011-03-01 11:50:16 +01:00
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), private->pixel_label, FALSE, FALSE, 0);
|
|
|
|
|
gtk_widget_show (private->pixel_label);
|
2004-09-24 14:43:32 +00:00
|
|
|
|
|
2011-03-01 11:50:16 +01:00
|
|
|
|
private->more_label = gtk_label_new (NULL);
|
|
|
|
|
gimp_label_set_attributes (GTK_LABEL (private->more_label),
|
2004-09-25 01:47:01 +00:00
|
|
|
|
PANGO_ATTR_SCALE, PANGO_SCALE_SMALL,
|
|
|
|
|
-1);
|
2016-09-08 19:11:20 +02:00
|
|
|
|
gtk_label_set_xalign (GTK_LABEL (private->more_label), 0.0);
|
2011-03-01 11:50:16 +01:00
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), private->more_label, FALSE, FALSE, 0);
|
|
|
|
|
gtk_widget_show (private->more_label);
|
2004-09-25 01:47:01 +00:00
|
|
|
|
|
2004-10-26 21:18:20 +00:00
|
|
|
|
#ifdef ENABLE_MEMSIZE_LABEL
|
2011-03-01 11:50:16 +01:00
|
|
|
|
private->memsize_label = gtk_label_new (NULL);
|
|
|
|
|
gimp_label_set_attributes (GTK_LABEL (private->memsize_label),
|
2004-09-24 14:43:32 +00:00
|
|
|
|
PANGO_ATTR_SCALE, PANGO_SCALE_SMALL,
|
|
|
|
|
PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD,
|
|
|
|
|
-1);
|
2016-09-08 19:11:20 +02:00
|
|
|
|
gtk_label_set_xalign (GTK_LABEL (private->memsize_label), 0.0);
|
2011-03-01 11:50:16 +01:00
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), private->memsize_label, FALSE, FALSE, 0);
|
|
|
|
|
gtk_widget_show (private->memsize_label);
|
2004-10-26 21:18:20 +00:00
|
|
|
|
#endif
|
2003-04-11 13:17:23 +00:00
|
|
|
|
|
2004-05-07 15:45:56 +00:00
|
|
|
|
text = g_strdup_printf ("<b>%s</b>", _("_Advanced Options"));
|
2011-03-01 11:50:16 +01:00
|
|
|
|
private->expander = g_object_new (GTK_TYPE_EXPANDER,
|
|
|
|
|
"label", text,
|
|
|
|
|
"use-markup", TRUE,
|
|
|
|
|
"use-underline", TRUE,
|
|
|
|
|
NULL);
|
2004-05-07 15:45:56 +00:00
|
|
|
|
g_free (text);
|
2003-04-11 13:17:23 +00:00
|
|
|
|
|
2011-03-01 11:50:16 +01:00
|
|
|
|
gtk_box_pack_start (GTK_BOX (editor), private->expander, TRUE, TRUE, 0);
|
|
|
|
|
gtk_widget_show (private->expander);
|
2003-04-16 12:59:36 +00:00
|
|
|
|
|
2004-05-07 15:45:56 +00:00
|
|
|
|
frame = gimp_frame_new ("<expander>");
|
2011-03-01 11:50:16 +01:00
|
|
|
|
gtk_container_add (GTK_CONTAINER (private->expander), frame);
|
2004-05-07 15:45:56 +00:00
|
|
|
|
gtk_widget_show (frame);
|
|
|
|
|
|
2022-08-06 04:42:46 +00:00
|
|
|
|
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
|
|
|
|
gtk_widget_set_size_request (scrolled_window, -1, 300);
|
|
|
|
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
|
|
|
|
|
GTK_SHADOW_OUT);
|
|
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
|
|
|
|
GTK_POLICY_NEVER,
|
|
|
|
|
GTK_POLICY_AUTOMATIC);
|
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), scrolled_window);
|
|
|
|
|
gtk_widget_show (scrolled_window);
|
|
|
|
|
|
2018-05-03 01:49:05 +02:00
|
|
|
|
grid = gtk_grid_new ();
|
|
|
|
|
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
|
|
|
|
|
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
|
2022-08-06 04:42:46 +00:00
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (grid), 16);
|
|
|
|
|
gtk_container_add (GTK_CONTAINER (scrolled_window), grid);
|
2018-05-03 01:49:05 +02:00
|
|
|
|
gtk_widget_show (grid);
|
2003-04-16 12:59:36 +00:00
|
|
|
|
|
2018-06-24 18:15:16 +02:00
|
|
|
|
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 0);
|
2019-03-09 07:25:19 -05:00
|
|
|
|
xres = gimp_spin_button_new (adjustment, 1.0, 2);
|
2014-06-21 22:39:37 +02:00
|
|
|
|
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (xres), TRUE);
|
2004-10-12 14:14:16 +00:00
|
|
|
|
gtk_entry_set_width_chars (GTK_ENTRY (xres), SB_WIDTH);
|
|
|
|
|
|
2018-06-24 18:15:16 +02:00
|
|
|
|
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 0);
|
2019-03-09 07:25:19 -05:00
|
|
|
|
yres = gimp_spin_button_new (adjustment, 1.0, 2);
|
2014-06-21 22:39:37 +02:00
|
|
|
|
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (yres), TRUE);
|
2004-10-12 14:14:16 +00:00
|
|
|
|
gtk_entry_set_width_chars (GTK_ENTRY (yres), SB_WIDTH);
|
|
|
|
|
|
2003-04-11 13:17:23 +00:00
|
|
|
|
/* the resolution labels */
|
2004-10-12 14:14:16 +00:00
|
|
|
|
label = gtk_label_new_with_mnemonic (_("_X resolution:"));
|
2016-09-08 19:11:20 +02:00
|
|
|
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
2004-10-12 14:14:16 +00:00
|
|
|
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), xres);
|
2018-05-03 01:49:05 +02:00
|
|
|
|
gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);
|
2003-04-11 13:17:23 +00:00
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
2004-10-12 14:14:16 +00:00
|
|
|
|
label = gtk_label_new_with_mnemonic (_("_Y resolution:"));
|
2016-09-08 19:11:20 +02:00
|
|
|
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
2004-10-12 14:14:16 +00:00
|
|
|
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), yres);
|
2018-05-03 01:49:05 +02:00
|
|
|
|
gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1);
|
2003-04-11 13:17:23 +00:00
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
|
|
/* the resolution sizeentry */
|
2011-09-30 11:29:11 +02:00
|
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
2018-05-03 01:49:05 +02:00
|
|
|
|
gtk_grid_attach (GTK_GRID (grid), hbox, 1, 0, 1, 2);
|
2003-09-23 21:51:08 +00:00
|
|
|
|
gtk_widget_show (hbox);
|
2003-04-11 13:17:23 +00:00
|
|
|
|
|
2011-03-01 11:50:16 +01:00
|
|
|
|
private->resolution_se =
|
2011-03-02 10:16:43 +01:00
|
|
|
|
gimp_size_entry_new (0,
|
|
|
|
|
gimp_template_get_resolution_unit (template),
|
|
|
|
|
_("pixels/%s"),
|
2003-04-16 12:59:36 +00:00
|
|
|
|
FALSE, FALSE, FALSE, SB_WIDTH,
|
|
|
|
|
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
2004-10-12 00:12:31 +00:00
|
|
|
|
|
2011-03-01 11:50:16 +01:00
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), private->resolution_se, FALSE, FALSE, 0);
|
|
|
|
|
gtk_widget_show (private->resolution_se);
|
2003-09-23 21:51:08 +00:00
|
|
|
|
|
2011-03-01 11:50:16 +01:00
|
|
|
|
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->resolution_se),
|
2006-04-12 12:49:29 +00:00
|
|
|
|
GTK_SPIN_BUTTON (yres), NULL);
|
2018-05-02 20:23:05 +02:00
|
|
|
|
gtk_grid_attach (GTK_GRID (private->resolution_se), yres, 0, 1, 1, 1);
|
2003-04-16 12:59:36 +00:00
|
|
|
|
gtk_widget_show (yres);
|
|
|
|
|
|
2011-03-01 11:50:16 +01:00
|
|
|
|
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->resolution_se),
|
2006-04-12 12:49:29 +00:00
|
|
|
|
GTK_SPIN_BUTTON (xres), NULL);
|
2018-05-02 20:23:05 +02:00
|
|
|
|
gtk_grid_attach (GTK_GRID (private->resolution_se), xres, 0, 0, 1, 1);
|
2003-04-16 12:59:36 +00:00
|
|
|
|
gtk_widget_show (xres);
|
2003-04-11 13:17:23 +00:00
|
|
|
|
|
2011-03-01 11:50:16 +01:00
|
|
|
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->size_se), 0,
|
2011-03-02 10:16:43 +01:00
|
|
|
|
gimp_template_get_resolution_x (template),
|
|
|
|
|
FALSE);
|
2011-03-01 11:50:16 +01:00
|
|
|
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->size_se), 1,
|
2011-03-02 10:16:43 +01:00
|
|
|
|
gimp_template_get_resolution_y (template),
|
|
|
|
|
FALSE);
|
2003-10-15 15:30:11 +00:00
|
|
|
|
|
2003-04-11 13:17:23 +00:00
|
|
|
|
/* the resolution chainbutton */
|
2014-04-18 18:43:32 +02:00
|
|
|
|
private->chain_button = gimp_chain_button_new (GIMP_CHAIN_RIGHT);
|
2018-05-02 20:23:05 +02:00
|
|
|
|
gtk_grid_attach (GTK_GRID (private->resolution_se), private->chain_button, 1, 0, 1, 2);
|
2014-04-18 18:43:32 +02:00
|
|
|
|
gtk_widget_show (private->chain_button);
|
2003-04-11 13:17:23 +00:00
|
|
|
|
|
2011-03-02 10:16:43 +01:00
|
|
|
|
gimp_prop_coordinates_connect (G_OBJECT (template),
|
2003-10-01 19:55:13 +00:00
|
|
|
|
"xresolution", "yresolution",
|
|
|
|
|
"resolution-unit",
|
2014-04-18 18:43:32 +02:00
|
|
|
|
private->resolution_se, private->chain_button,
|
2003-10-01 19:55:13 +00:00
|
|
|
|
1.0, 1.0);
|
2003-04-11 13:17:23 +00:00
|
|
|
|
|
2016-11-09 12:21:39 +01:00
|
|
|
|
row = 2;
|
|
|
|
|
|
2011-03-02 10:16:43 +01:00
|
|
|
|
combo = gimp_prop_enum_combo_box_new (G_OBJECT (template),
|
2004-05-07 15:45:56 +00:00
|
|
|
|
"image-type",
|
|
|
|
|
GIMP_RGB, GIMP_GRAY);
|
2018-05-03 01:49:05 +02:00
|
|
|
|
gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
|
|
|
|
|
_("Color _space:"), 0.0, 0.5,
|
|
|
|
|
combo, 1);
|
2004-05-07 15:45:56 +00:00
|
|
|
|
|
2019-03-31 14:54:30 -04:00
|
|
|
|
/* construct the precision combo manually, instead of using
|
|
|
|
|
* gimp_prop_enum_combo_box_new(), so that we only reset the gamma combo when
|
|
|
|
|
* the precision is changed through the ui. see issue #3025.
|
|
|
|
|
*/
|
|
|
|
|
store = gimp_enum_store_new_with_range (GIMP_TYPE_COMPONENT_TYPE,
|
|
|
|
|
GIMP_COMPONENT_TYPE_U8,
|
|
|
|
|
GIMP_COMPONENT_TYPE_FLOAT);
|
|
|
|
|
|
|
|
|
|
private->precision_combo = g_object_new (GIMP_TYPE_ENUM_COMBO_BOX,
|
|
|
|
|
"model", store,
|
|
|
|
|
NULL);
|
|
|
|
|
g_object_unref (store);
|
|
|
|
|
|
2018-05-03 01:49:05 +02:00
|
|
|
|
gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
|
|
|
|
|
_("_Precision:"), 0.0, 0.5,
|
2019-03-31 14:54:30 -04:00
|
|
|
|
private->precision_combo, 1);
|
2012-04-22 19:10:01 +02:00
|
|
|
|
|
2019-03-31 14:54:30 -04:00
|
|
|
|
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (private->precision_combo),
|
|
|
|
|
gimp_babl_component_type (
|
|
|
|
|
gimp_template_get_precision (template)));
|
|
|
|
|
|
|
|
|
|
g_signal_connect (private->precision_combo, "changed",
|
2016-11-10 13:50:56 +01:00
|
|
|
|
G_CALLBACK (gimp_template_editor_precision_changed),
|
|
|
|
|
editor);
|
|
|
|
|
|
Initial space invasion commit in GIMP
All babl formats now have a space equivalent to a color profile,
determining the format's primaries and TRCs. This commit makes GIMP
aware of this.
libgimp:
- enum GimpPrecision: rename GAMMA values to NON_LINEAR and keep GAMMA
as deprecated aliases, add PERCEPTUAL values so we now have LINEAR,
NON_LINEAR and PERCPTUAL for each encoding, matching the babl
encoding variants RGB, R'G'B' and R~G~B~.
- gimp_color_transform_can_gegl_copy() now returns TRUE if both
profiles can return a babl space, increasing the amount of fast babl
color conversions significantly.
- TODO: no solution yet for getting libgimp drawable proxy buffers in
the right format with space.
plug-ins:
- follow the GimpPrecision change.
- TODO: everything else unchanged and partly broken or sub-optimal,
like setting a new image's color profile too late.
app:
- add enum GimpTRCType { LINEAR, NON_LINEAR, PERCEPTUAL } as
replacement for all "linear" booleans.
- change gimp-babl functions to take babl spaces and GimpTRCType
parameters and support all sorts of new perceptual ~ formats.
- a lot of places changed in the early days of goat invasion didn't
take advantage of gimp-babl utility functions and constructed
formats manually. They all needed revisiting and many now use much
simpler code calling gimp-babl API.
- change gimp_babl_format_get_color_profile() to really extract a
newly allocated color profile from the format, and add
gimp_babl_get_builtin_color_profile() which does the same as
gimp_babl_format_get_color_profile() did before. Visited all callers
to decide whether they are looking for the format's actual profile,
or for one of the builtin profiles, simplifying code that only needs
builtin profiles.
- drawables have a new get_space_api(), get_linear() is now get_trc().
- images now have a "layer space" and an API to get it,
gimp_image_get_layer_format() returns formats in that space.
- an image's layer space is created from the image's color profile,
change gimpimage-color-profile to deal with that correctly
- change many babl_format() calls to babl_format_with_space() and take
the space from passed formats or drawables
- add function gimp_layer_fix_format_space() which replaces the
layer's buffer with one that has the image's layer format, but
doesn't change pixel values
- use gimp_layer_fix_format_space() to make sure layers loaded from
XCF and created by plug-ins have the right space when added to the
image, because it's impossible to always assign the right space upon
layer creation
- "assign color profile" and "discard color profile" now require use
of gimp_layer_fix_format_space() too because the profile is now
embedded in all formats via the space. Add
gimp_image_assign_color_profile() which does all that and call it
instead of a simple gimp_image_set_color_profile(), also from the
PDB set-color-profile functions, which are essentially "assign" and
"discard" calls.
- generally, make sure a new image's color profile is set before
adding layers to it, gimp_image_set_color_profile() is more than
before considered know-what-you-are-doing API.
- take special precaution in all places that call
gimp_drawable_convert_type(), we now must pass a new_profile from
all callers that convert layers within the same image (such as
image_convert_type, image_convert_precision), because the layer's
new space can't be determined from the image's layer format during
the call.
- change all "linear" properties to "trc", in all config objects like
for levels and curves, in the histogram, in the widgets. This results
in some GUI that now has three choices instead of two.
TODO: we might want to reduce that back to two later.
- keep "linear" boolean properties around as compat if needed for file
pasring, but always convert the parsed parsed boolean to
GimpTRCType.
- TODO: the image's "enable color management" switch is currently
broken, will fix that in another commit.
2018-07-21 14:23:01 +02:00
|
|
|
|
combo = gimp_prop_enum_combo_box_new (G_OBJECT (template), "trc",
|
|
|
|
|
GIMP_TRC_LINEAR,
|
|
|
|
|
GIMP_TRC_NON_LINEAR);
|
2018-05-03 01:49:05 +02:00
|
|
|
|
gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
|
|
|
|
|
_("_Gamma:"), 0.0, 0.5,
|
|
|
|
|
combo, 1);
|
2016-11-09 12:21:39 +01:00
|
|
|
|
|
2016-05-22 13:26:50 +02:00
|
|
|
|
private->profile_combo =
|
|
|
|
|
gimp_prop_profile_combo_box_new (G_OBJECT (template),
|
|
|
|
|
"color-profile",
|
|
|
|
|
NULL,
|
2018-01-02 23:09:00 +01:00
|
|
|
|
_("Choose A Color Profile"),
|
|
|
|
|
G_OBJECT (private->gimp->config),
|
|
|
|
|
"color-profile-path");
|
2018-05-03 01:49:05 +02:00
|
|
|
|
gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
|
|
|
|
|
_("Co_lor profile:"), 0.0, 0.5,
|
|
|
|
|
private->profile_combo, 1);
|
2016-05-08 23:20:26 +02:00
|
|
|
|
|
2022-08-06 04:42:46 +00:00
|
|
|
|
private->simulation_profile_combo =
|
|
|
|
|
gimp_prop_profile_combo_box_new (G_OBJECT (template),
|
|
|
|
|
"simulation-profile",
|
|
|
|
|
NULL,
|
|
|
|
|
_("Choose A Soft-Proofing Color Profile"),
|
|
|
|
|
G_OBJECT (private->gimp->config),
|
|
|
|
|
"color-profile-path");
|
|
|
|
|
gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
|
|
|
|
|
_("_Soft-proofing color profile:"), 0.0, 0.5,
|
|
|
|
|
private->simulation_profile_combo, 1);
|
|
|
|
|
|
|
|
|
|
private->simulation_intent_combo =
|
|
|
|
|
gimp_enum_combo_box_new (GIMP_TYPE_COLOR_RENDERING_INTENT);
|
|
|
|
|
|
|
|
|
|
gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
|
|
|
|
|
_("_Soft-proofing rendering intent:"), 0.0, 0.5,
|
|
|
|
|
private->simulation_intent_combo, 1);
|
|
|
|
|
|
|
|
|
|
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (private->simulation_intent_combo),
|
|
|
|
|
GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC);
|
|
|
|
|
|
|
|
|
|
g_signal_connect (private->simulation_intent_combo, "changed",
|
|
|
|
|
G_CALLBACK (gimp_template_editor_simulation_intent_changed),
|
|
|
|
|
editor);
|
|
|
|
|
|
|
|
|
|
private->simulation_bpc_toggle =
|
|
|
|
|
gtk_check_button_new_with_mnemonic (_("_Use Black Point Compensation"));
|
|
|
|
|
|
|
|
|
|
gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
|
|
|
|
|
NULL, 0.0, 0.5,
|
|
|
|
|
private->simulation_bpc_toggle, 1);
|
|
|
|
|
|
|
|
|
|
g_signal_connect (private->simulation_bpc_toggle, "toggled",
|
|
|
|
|
G_CALLBACK (gimp_template_editor_simulation_bpc_toggled),
|
|
|
|
|
editor);
|
|
|
|
|
|
2011-03-02 10:16:43 +01:00
|
|
|
|
combo = gimp_prop_enum_combo_box_new (G_OBJECT (template),
|
2004-05-07 15:45:56 +00:00
|
|
|
|
"fill-type",
|
2014-06-03 01:11:32 +02:00
|
|
|
|
0, 0);
|
2018-05-03 01:49:05 +02:00
|
|
|
|
gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
|
|
|
|
|
_("_Fill with:"), 0.0, 0.5,
|
|
|
|
|
combo, 1);
|
2003-10-15 15:30:11 +00:00
|
|
|
|
|
|
|
|
|
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
2004-07-21 16:29:29 +00:00
|
|
|
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
|
|
|
|
|
GTK_SHADOW_IN);
|
2003-10-15 15:30:11 +00:00
|
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
2006-04-12 12:49:29 +00:00
|
|
|
|
GTK_POLICY_AUTOMATIC,
|
|
|
|
|
GTK_POLICY_AUTOMATIC);
|
2018-05-03 01:49:05 +02:00
|
|
|
|
label = gimp_grid_attach_aligned (GTK_GRID (grid), 0, row++,
|
|
|
|
|
_("Comme_nt:"), 0.0, 0.0,
|
|
|
|
|
scrolled_window, 1);
|
2003-10-15 15:30:11 +00:00
|
|
|
|
|
2011-03-02 10:16:43 +01:00
|
|
|
|
text_buffer = gimp_prop_text_buffer_new (G_OBJECT (template),
|
2003-10-15 15:30:11 +00:00
|
|
|
|
"comment", MAX_COMMENT_LENGTH);
|
|
|
|
|
|
|
|
|
|
text_view = gtk_text_view_new_with_buffer (text_buffer);
|
|
|
|
|
g_object_unref (text_buffer);
|
|
|
|
|
|
|
|
|
|
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_WORD);
|
|
|
|
|
gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
|
|
|
|
|
gtk_widget_show (text_view);
|
2003-10-14 15:20:59 +00:00
|
|
|
|
|
2016-11-09 12:21:39 +01:00
|
|
|
|
gtk_label_set_mnemonic_widget (GTK_LABEL (label), text_view);
|
|
|
|
|
|
2011-03-02 10:16:43 +01:00
|
|
|
|
g_signal_connect_object (template, "notify",
|
2004-04-18 20:46:46 +00:00
|
|
|
|
G_CALLBACK (gimp_template_editor_template_notify),
|
|
|
|
|
editor, 0);
|
2003-10-14 15:20:59 +00:00
|
|
|
|
|
2004-09-24 14:43:32 +00:00
|
|
|
|
/* call the notify callback once to get the labels set initially */
|
2011-03-02 10:16:43 +01:00
|
|
|
|
gimp_template_editor_template_notify (template, NULL, editor);
|
2003-04-11 13:17:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gimp_template_editor_finalize (GObject *object)
|
|
|
|
|
{
|
2011-03-01 11:50:16 +01:00
|
|
|
|
GimpTemplateEditorPrivate *private = GET_PRIVATE (object);
|
2003-04-11 13:17:23 +00:00
|
|
|
|
|
2017-07-15 18:38:01 +02:00
|
|
|
|
g_clear_object (&private->template);
|
2003-04-11 13:17:23 +00:00
|
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
|
}
|
|
|
|
|
|
2005-12-19 22:37:49 +00:00
|
|
|
|
static void
|
|
|
|
|
gimp_template_editor_set_property (GObject *object,
|
|
|
|
|
guint property_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
|
|
|
|
{
|
2011-03-01 11:50:16 +01:00
|
|
|
|
GimpTemplateEditorPrivate *private = GET_PRIVATE (object);
|
2005-12-19 22:37:49 +00:00
|
|
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
|
{
|
2016-05-22 13:26:50 +02:00
|
|
|
|
case PROP_GIMP:
|
|
|
|
|
private->gimp = g_value_get_object (value); /* don't ref */
|
|
|
|
|
break;
|
|
|
|
|
|
2005-12-19 22:37:49 +00:00
|
|
|
|
case PROP_TEMPLATE:
|
2011-03-01 11:50:16 +01:00
|
|
|
|
private->template = g_value_dup_object (value);
|
2005-12-19 22:37:49 +00:00
|
|
|
|
break;
|
2008-07-23 07:47:10 +00:00
|
|
|
|
|
2005-12-19 22:37:49 +00:00
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gimp_template_editor_get_property (GObject *object,
|
|
|
|
|
guint property_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
|
|
|
|
{
|
2011-03-01 11:50:16 +01:00
|
|
|
|
GimpTemplateEditorPrivate *private = GET_PRIVATE (object);
|
2005-12-19 22:37:49 +00:00
|
|
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
|
{
|
2016-05-22 13:26:50 +02:00
|
|
|
|
case PROP_GIMP:
|
|
|
|
|
g_value_set_object (value, private->gimp);
|
|
|
|
|
break;
|
|
|
|
|
|
2005-12-19 22:37:49 +00:00
|
|
|
|
case PROP_TEMPLATE:
|
2011-03-01 11:50:16 +01:00
|
|
|
|
g_value_set_object (value, private->template);
|
2005-12-19 22:37:49 +00:00
|
|
|
|
break;
|
2008-07-23 07:47:10 +00:00
|
|
|
|
|
2005-12-19 22:37:49 +00:00
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-04-11 13:17:23 +00:00
|
|
|
|
GtkWidget *
|
2003-10-14 15:20:59 +00:00
|
|
|
|
gimp_template_editor_new (GimpTemplate *template,
|
|
|
|
|
Gimp *gimp,
|
|
|
|
|
gboolean edit_template)
|
2003-04-11 13:17:23 +00:00
|
|
|
|
{
|
2011-03-01 11:50:16 +01:00
|
|
|
|
GimpTemplateEditor *editor;
|
|
|
|
|
GimpTemplateEditorPrivate *private;
|
2003-04-12 19:06:25 +00:00
|
|
|
|
|
2016-05-22 13:26:50 +02:00
|
|
|
|
g_return_val_if_fail (GIMP_IS_TEMPLATE (template), NULL);
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
2003-04-12 19:06:25 +00:00
|
|
|
|
|
2003-10-14 15:20:59 +00:00
|
|
|
|
editor = g_object_new (GIMP_TYPE_TEMPLATE_EDITOR,
|
2016-05-22 13:26:50 +02:00
|
|
|
|
"gimp", gimp,
|
2003-10-14 15:20:59 +00:00
|
|
|
|
"template", template,
|
|
|
|
|
NULL);
|
2003-04-12 19:06:25 +00:00
|
|
|
|
|
2011-03-01 11:50:16 +01:00
|
|
|
|
private = GET_PRIVATE (editor);
|
|
|
|
|
|
2003-04-13 16:25:14 +00:00
|
|
|
|
if (edit_template)
|
2003-04-12 19:06:25 +00:00
|
|
|
|
{
|
2018-05-03 01:49:05 +02:00
|
|
|
|
GtkWidget *grid;
|
2003-10-14 16:29:33 +00:00
|
|
|
|
GtkWidget *entry;
|
2011-03-22 15:20:03 +01:00
|
|
|
|
GtkWidget *icon_picker;
|
2003-10-14 16:29:33 +00:00
|
|
|
|
|
2018-05-03 01:49:05 +02:00
|
|
|
|
grid = gtk_grid_new ();
|
|
|
|
|
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
|
|
|
|
|
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (editor), grid, FALSE, FALSE, 0);
|
|
|
|
|
gtk_box_reorder_child (GTK_BOX (editor), grid, 0);
|
|
|
|
|
gtk_widget_show (grid);
|
2003-04-12 19:06:25 +00:00
|
|
|
|
|
2011-03-01 11:50:16 +01:00
|
|
|
|
entry = gimp_prop_entry_new (G_OBJECT (private->template), "name", 128);
|
2003-04-13 16:25:14 +00:00
|
|
|
|
|
2018-05-03 01:49:05 +02:00
|
|
|
|
gimp_grid_attach_aligned (GTK_GRID (grid), 0, 0,
|
|
|
|
|
_("_Name:"), 1.0, 0.5,
|
|
|
|
|
entry, 1);
|
2003-04-13 16:25:14 +00:00
|
|
|
|
|
2012-12-11 20:50:45 -08:00
|
|
|
|
icon_picker = gimp_prop_icon_picker_new (GIMP_VIEWABLE (private->template),
|
2011-03-22 15:20:03 +01:00
|
|
|
|
gimp);
|
2018-05-03 01:49:05 +02:00
|
|
|
|
gimp_grid_attach_aligned (GTK_GRID (grid), 0, 1,
|
|
|
|
|
_("_Icon:"), 1.0, 0.5,
|
|
|
|
|
icon_picker, 1);
|
2003-04-12 19:06:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return GTK_WIDGET (editor);
|
2003-04-11 13:17:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-03-01 11:50:16 +01:00
|
|
|
|
GimpTemplate *
|
|
|
|
|
gimp_template_editor_get_template (GimpTemplateEditor *editor)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_TEMPLATE_EDITOR (editor), NULL);
|
|
|
|
|
|
|
|
|
|
return GET_PRIVATE (editor)->template;
|
|
|
|
|
}
|
|
|
|
|
|
2004-06-09 22:37:49 +00:00
|
|
|
|
void
|
|
|
|
|
gimp_template_editor_show_advanced (GimpTemplateEditor *editor,
|
|
|
|
|
gboolean expanded)
|
|
|
|
|
{
|
2011-03-01 11:50:16 +01:00
|
|
|
|
GimpTemplateEditorPrivate *private;
|
|
|
|
|
|
2004-06-09 22:37:49 +00:00
|
|
|
|
g_return_if_fail (GIMP_IS_TEMPLATE_EDITOR (editor));
|
|
|
|
|
|
2011-03-01 11:50:16 +01:00
|
|
|
|
private = GET_PRIVATE (editor);
|
|
|
|
|
|
|
|
|
|
gtk_expander_set_expanded (GTK_EXPANDER (private->expander), expanded);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GtkWidget *
|
|
|
|
|
gimp_template_editor_get_size_se (GimpTemplateEditor *editor)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_TEMPLATE_EDITOR (editor), NULL);
|
|
|
|
|
|
|
|
|
|
return GET_PRIVATE (editor)->size_se;
|
2004-06-09 22:37:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-04-18 18:43:32 +02:00
|
|
|
|
GtkWidget *
|
|
|
|
|
gimp_template_editor_get_resolution_se (GimpTemplateEditor *editor)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_TEMPLATE_EDITOR (editor), NULL);
|
|
|
|
|
|
|
|
|
|
return GET_PRIVATE (editor)->resolution_se;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GtkWidget *
|
|
|
|
|
gimp_template_editor_get_resolution_chain (GimpTemplateEditor *editor)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_TEMPLATE_EDITOR (editor), NULL);
|
|
|
|
|
|
|
|
|
|
return GET_PRIVATE (editor)->chain_button;
|
|
|
|
|
}
|
|
|
|
|
|
2003-04-11 13:17:23 +00:00
|
|
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
|
2016-11-10 13:50:56 +01:00
|
|
|
|
static void
|
|
|
|
|
gimp_template_editor_precision_changed (GtkWidget *widget,
|
|
|
|
|
GimpTemplateEditor *editor)
|
|
|
|
|
{
|
|
|
|
|
GimpTemplateEditorPrivate *private = GET_PRIVATE (editor);
|
|
|
|
|
GimpComponentType component_type;
|
2019-05-31 17:26:50 +02:00
|
|
|
|
GimpTRCType trc;
|
2016-11-10 13:50:56 +01:00
|
|
|
|
|
|
|
|
|
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget),
|
|
|
|
|
(gint *) &component_type);
|
|
|
|
|
|
2019-05-31 17:26:50 +02:00
|
|
|
|
g_object_get (private->template,
|
|
|
|
|
"trc", &trc,
|
2019-03-31 14:54:30 -04:00
|
|
|
|
NULL);
|
|
|
|
|
|
2019-05-31 17:26:50 +02:00
|
|
|
|
trc = gimp_suggest_trc_for_component_type (component_type, trc);
|
2016-11-10 13:50:56 +01:00
|
|
|
|
|
2019-05-31 17:26:50 +02:00
|
|
|
|
g_object_set (private->template,
|
|
|
|
|
"component-type", component_type,
|
|
|
|
|
"trc", trc,
|
|
|
|
|
NULL);
|
2016-11-10 13:50:56 +01:00
|
|
|
|
}
|
|
|
|
|
|
2022-08-06 04:42:46 +00:00
|
|
|
|
static void
|
|
|
|
|
gimp_template_editor_simulation_intent_changed (GtkWidget *widget,
|
|
|
|
|
GimpTemplateEditor *editor)
|
|
|
|
|
{
|
|
|
|
|
GimpTemplateEditorPrivate *private = GET_PRIVATE (editor);
|
|
|
|
|
GimpColorRenderingIntent intent;
|
|
|
|
|
|
|
|
|
|
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget),
|
|
|
|
|
(gint *) &intent);
|
|
|
|
|
|
|
|
|
|
g_object_set (private->template,
|
|
|
|
|
"simulation-intent", intent,
|
|
|
|
|
NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gimp_template_editor_simulation_bpc_toggled (GtkWidget *widget,
|
|
|
|
|
GimpTemplateEditor *editor)
|
|
|
|
|
{
|
|
|
|
|
GimpTemplateEditorPrivate *private = GET_PRIVATE (editor);
|
|
|
|
|
gboolean bpc = FALSE;
|
|
|
|
|
|
|
|
|
|
bpc = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
|
|
|
|
|
|
|
|
|
|
g_object_set (private->template,
|
|
|
|
|
"simulation-bpc", bpc,
|
|
|
|
|
NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2005-11-02 16:07:07 +00:00
|
|
|
|
static void
|
|
|
|
|
gimp_template_editor_set_pixels (GimpTemplateEditor *editor,
|
|
|
|
|
GimpTemplate *template)
|
|
|
|
|
{
|
2011-03-01 11:50:16 +01:00
|
|
|
|
GimpTemplateEditorPrivate *private = GET_PRIVATE (editor);
|
|
|
|
|
gchar *text;
|
|
|
|
|
|
|
|
|
|
text = g_strdup_printf (ngettext ("%d × %d pixel",
|
2011-03-02 10:16:43 +01:00
|
|
|
|
"%d × %d pixels",
|
|
|
|
|
gimp_template_get_height (template)),
|
|
|
|
|
gimp_template_get_width (template),
|
|
|
|
|
gimp_template_get_height (template));
|
2011-03-01 11:50:16 +01:00
|
|
|
|
gtk_label_set_text (GTK_LABEL (private->pixel_label), text);
|
2005-11-02 16:07:07 +00:00
|
|
|
|
g_free (text);
|
|
|
|
|
}
|
|
|
|
|
|
2003-04-11 13:17:23 +00:00
|
|
|
|
static void
|
|
|
|
|
gimp_template_editor_aspect_callback (GtkWidget *widget,
|
|
|
|
|
GimpTemplateEditor *editor)
|
|
|
|
|
{
|
2011-03-01 11:50:16 +01:00
|
|
|
|
GimpTemplateEditorPrivate *private = GET_PRIVATE (editor);
|
|
|
|
|
|
|
|
|
|
if (! private->block_aspect &&
|
2008-06-28 15:50:27 +00:00
|
|
|
|
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
|
2003-04-11 13:17:23 +00:00
|
|
|
|
{
|
2011-03-01 11:50:16 +01:00
|
|
|
|
GimpTemplate *template = private->template;
|
2011-03-02 10:16:43 +01:00
|
|
|
|
gint width = gimp_template_get_width (template);
|
|
|
|
|
gint height = gimp_template_get_height (template);
|
|
|
|
|
gdouble xresolution = gimp_template_get_resolution_x (template);
|
|
|
|
|
gdouble yresolution = gimp_template_get_resolution_y (template);
|
2004-10-14 22:55:18 +00:00
|
|
|
|
|
2011-03-02 10:16:43 +01:00
|
|
|
|
if (width == height)
|
2003-04-11 13:17:23 +00:00
|
|
|
|
{
|
2011-03-01 11:50:16 +01:00
|
|
|
|
private->block_aspect = TRUE;
|
|
|
|
|
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (private->aspect_button),
|
2003-11-14 23:17:38 +00:00
|
|
|
|
GIMP_ASPECT_SQUARE);
|
2011-03-01 11:50:16 +01:00
|
|
|
|
private->block_aspect = FALSE;
|
2003-04-11 13:17:23 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2004-10-14 22:55:18 +00:00
|
|
|
|
g_signal_handlers_block_by_func (template,
|
2003-04-11 13:17:23 +00:00
|
|
|
|
gimp_template_editor_template_notify,
|
|
|
|
|
editor);
|
|
|
|
|
|
2011-03-01 11:50:16 +01:00
|
|
|
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->size_se), 0,
|
2003-04-11 13:17:23 +00:00
|
|
|
|
yresolution, FALSE);
|
2011-03-01 11:50:16 +01:00
|
|
|
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->size_se), 1,
|
2003-04-11 13:17:23 +00:00
|
|
|
|
xresolution, FALSE);
|
|
|
|
|
|
2004-10-14 22:55:18 +00:00
|
|
|
|
g_object_set (template,
|
2003-04-11 13:17:23 +00:00
|
|
|
|
"width", height,
|
|
|
|
|
"height", width,
|
|
|
|
|
"xresolution", yresolution,
|
|
|
|
|
"yresolution", xresolution,
|
|
|
|
|
NULL);
|
|
|
|
|
|
2004-10-14 22:55:18 +00:00
|
|
|
|
g_signal_handlers_unblock_by_func (template,
|
2003-04-11 13:17:23 +00:00
|
|
|
|
gimp_template_editor_template_notify,
|
|
|
|
|
editor);
|
2004-10-14 22:55:18 +00:00
|
|
|
|
|
2005-11-02 16:07:07 +00:00
|
|
|
|
gimp_template_editor_set_pixels (editor, template);
|
2003-04-11 13:17:23 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gimp_template_editor_template_notify (GimpTemplate *template,
|
|
|
|
|
GParamSpec *param_spec,
|
|
|
|
|
GimpTemplateEditor *editor)
|
|
|
|
|
{
|
2011-03-01 11:50:16 +01:00
|
|
|
|
GimpTemplateEditorPrivate *private = GET_PRIVATE (editor);
|
|
|
|
|
GimpAspectType aspect;
|
|
|
|
|
const gchar *desc;
|
|
|
|
|
gchar *text;
|
2011-03-02 10:16:43 +01:00
|
|
|
|
gint width;
|
|
|
|
|
gint height;
|
2011-03-01 11:50:16 +01:00
|
|
|
|
gint xres;
|
|
|
|
|
gint yres;
|
2003-04-11 13:17:23 +00:00
|
|
|
|
|
|
|
|
|
if (param_spec)
|
|
|
|
|
{
|
|
|
|
|
if (! strcmp (param_spec->name, "xresolution"))
|
|
|
|
|
{
|
2011-03-01 11:50:16 +01:00
|
|
|
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->size_se), 0,
|
2011-03-02 10:16:43 +01:00
|
|
|
|
gimp_template_get_resolution_x (template),
|
|
|
|
|
FALSE);
|
2003-04-11 13:17:23 +00:00
|
|
|
|
}
|
|
|
|
|
else if (! strcmp (param_spec->name, "yresolution"))
|
|
|
|
|
{
|
2011-03-01 11:50:16 +01:00
|
|
|
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->size_se), 1,
|
2011-03-02 10:16:43 +01:00
|
|
|
|
gimp_template_get_resolution_y (template),
|
|
|
|
|
FALSE);
|
2003-04-11 13:17:23 +00:00
|
|
|
|
}
|
2019-03-31 14:54:30 -04:00
|
|
|
|
else if (! strcmp (param_spec->name, "component-type"))
|
|
|
|
|
{
|
|
|
|
|
g_signal_handlers_block_by_func (private->precision_combo,
|
|
|
|
|
gimp_template_editor_precision_changed,
|
|
|
|
|
editor);
|
|
|
|
|
|
|
|
|
|
gimp_int_combo_box_set_active (
|
|
|
|
|
GIMP_INT_COMBO_BOX (private->precision_combo),
|
|
|
|
|
gimp_babl_component_type (gimp_template_get_precision (template)));
|
|
|
|
|
|
|
|
|
|
g_signal_handlers_unblock_by_func (private->precision_combo,
|
|
|
|
|
gimp_template_editor_precision_changed,
|
|
|
|
|
editor);
|
|
|
|
|
}
|
2003-04-11 13:17:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-10-26 21:18:20 +00:00
|
|
|
|
#ifdef ENABLE_MEMSIZE_LABEL
|
2011-09-13 11:39:24 +02:00
|
|
|
|
text = g_format_size (gimp_template_get_initial_size (template));
|
2011-03-01 11:50:16 +01:00
|
|
|
|
gtk_label_set_text (GTK_LABEL (private->memsize_label), text);
|
2003-11-14 12:05:13 +00:00
|
|
|
|
g_free (text);
|
2004-10-26 21:18:20 +00:00
|
|
|
|
#endif
|
2003-04-11 13:17:23 +00:00
|
|
|
|
|
2005-11-02 16:07:07 +00:00
|
|
|
|
gimp_template_editor_set_pixels (editor, template);
|
2004-09-24 14:43:32 +00:00
|
|
|
|
|
2011-03-02 10:16:43 +01:00
|
|
|
|
width = gimp_template_get_width (template);
|
|
|
|
|
height = gimp_template_get_height (template);
|
|
|
|
|
|
|
|
|
|
if (width > height)
|
2003-04-11 13:17:23 +00:00
|
|
|
|
aspect = GIMP_ASPECT_LANDSCAPE;
|
2011-03-02 10:16:43 +01:00
|
|
|
|
else if (height > width)
|
2003-04-11 13:17:23 +00:00
|
|
|
|
aspect = GIMP_ASPECT_PORTRAIT;
|
|
|
|
|
else
|
|
|
|
|
aspect = GIMP_ASPECT_SQUARE;
|
|
|
|
|
|
2011-03-01 11:50:16 +01:00
|
|
|
|
private->block_aspect = TRUE;
|
|
|
|
|
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (private->aspect_button),
|
2003-11-14 23:17:38 +00:00
|
|
|
|
aspect);
|
2011-03-01 11:50:16 +01:00
|
|
|
|
private->block_aspect = FALSE;
|
2003-04-12 19:06:25 +00:00
|
|
|
|
|
2011-03-02 10:16:43 +01:00
|
|
|
|
gimp_enum_get_value (GIMP_TYPE_IMAGE_BASE_TYPE,
|
2012-04-22 17:35:47 +02:00
|
|
|
|
gimp_template_get_base_type (template),
|
2004-10-25 17:55:25 +00:00
|
|
|
|
NULL, NULL, &desc, NULL);
|
2004-09-25 01:47:01 +00:00
|
|
|
|
|
2011-03-02 10:16:43 +01:00
|
|
|
|
xres = ROUND (gimp_template_get_resolution_x (template));
|
|
|
|
|
yres = ROUND (gimp_template_get_resolution_y (template));
|
2005-01-02 16:55:50 +00:00
|
|
|
|
|
|
|
|
|
if (xres != yres)
|
2006-04-05 16:45:27 +00:00
|
|
|
|
text = g_strdup_printf (_("%d × %d ppi, %s"), xres, yres, desc);
|
2004-09-25 01:47:01 +00:00
|
|
|
|
else
|
2006-04-05 16:45:27 +00:00
|
|
|
|
text = g_strdup_printf (_("%d ppi, %s"), yres, desc);
|
2004-09-25 01:47:01 +00:00
|
|
|
|
|
2011-03-01 11:50:16 +01:00
|
|
|
|
gtk_label_set_text (GTK_LABEL (private->more_label), text);
|
2004-09-25 01:47:01 +00:00
|
|
|
|
g_free (text);
|
2016-05-22 13:26:50 +02:00
|
|
|
|
|
|
|
|
|
if (! param_spec ||
|
|
|
|
|
! strcmp (param_spec->name, "image-type") ||
|
|
|
|
|
! strcmp (param_spec->name, "precision"))
|
|
|
|
|
{
|
2022-08-06 04:42:46 +00:00
|
|
|
|
GimpColorProfile *profile;
|
|
|
|
|
GtkListStore *profile_store;
|
|
|
|
|
GFile *file;
|
|
|
|
|
gchar *path;
|
2016-05-22 13:26:50 +02:00
|
|
|
|
|
2019-09-21 18:08:13 +02:00
|
|
|
|
file = gimp_directory_file ("profilerc", NULL);
|
|
|
|
|
profile_store = gimp_color_profile_store_new (file);
|
|
|
|
|
g_object_unref (file);
|
2016-05-22 13:26:50 +02:00
|
|
|
|
|
|
|
|
|
gimp_color_profile_store_add_defaults (GIMP_COLOR_PROFILE_STORE (profile_store),
|
|
|
|
|
private->gimp->config->color_management,
|
|
|
|
|
gimp_template_get_base_type (template),
|
|
|
|
|
gimp_template_get_precision (template),
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
gtk_combo_box_set_model (GTK_COMBO_BOX (private->profile_combo),
|
|
|
|
|
GTK_TREE_MODEL (profile_store));
|
2022-08-06 04:42:46 +00:00
|
|
|
|
|
|
|
|
|
/* Simulation Profile should not be set by default */
|
|
|
|
|
file = gimp_directory_file ("profilerc", NULL);
|
|
|
|
|
profile_store = gimp_color_profile_store_new (file);
|
|
|
|
|
g_object_unref (file);
|
|
|
|
|
|
|
|
|
|
gimp_color_profile_store_add_file (GIMP_COLOR_PROFILE_STORE (profile_store),
|
|
|
|
|
NULL, NULL);
|
|
|
|
|
/* Add Preferred CMYK profile if it exists */
|
|
|
|
|
profile =
|
|
|
|
|
gimp_color_config_get_cmyk_color_profile (GIMP_COLOR_CONFIG (private->gimp->config->color_management),
|
|
|
|
|
NULL);
|
|
|
|
|
if (profile)
|
|
|
|
|
{
|
|
|
|
|
g_object_get (G_OBJECT (private->gimp->config->color_management),
|
|
|
|
|
"cmyk-profile", &path, NULL);
|
|
|
|
|
file = gimp_file_new_for_config_path (path, NULL);
|
|
|
|
|
g_free (path);
|
|
|
|
|
text = g_strdup_printf (_("Preferred CMYK (%s)"),
|
|
|
|
|
gimp_color_profile_get_label (profile));
|
|
|
|
|
g_object_unref (profile);
|
|
|
|
|
gimp_color_profile_store_add_file (GIMP_COLOR_PROFILE_STORE (profile_store),
|
|
|
|
|
file, text);
|
|
|
|
|
g_object_unref (file);
|
|
|
|
|
g_free (text);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gtk_combo_box_set_model (GTK_COMBO_BOX (private->simulation_profile_combo),
|
|
|
|
|
GTK_TREE_MODEL (profile_store));
|
|
|
|
|
|
2016-05-22 13:26:50 +02:00
|
|
|
|
g_object_unref (profile_store);
|
|
|
|
|
|
2016-10-12 23:48:06 +02:00
|
|
|
|
g_object_get (template,
|
2019-09-21 18:08:13 +02:00
|
|
|
|
"color-profile", &file,
|
2016-10-12 23:48:06 +02:00
|
|
|
|
NULL);
|
|
|
|
|
|
2016-05-22 13:26:50 +02:00
|
|
|
|
gimp_color_profile_combo_box_set_active_file (GIMP_COLOR_PROFILE_COMBO_BOX (private->profile_combo),
|
2019-09-21 18:08:13 +02:00
|
|
|
|
file, NULL);
|
2016-10-12 23:48:06 +02:00
|
|
|
|
|
2019-09-21 18:08:13 +02:00
|
|
|
|
if (file)
|
|
|
|
|
g_object_unref (file);
|
2022-08-06 04:42:46 +00:00
|
|
|
|
|
|
|
|
|
g_object_get (template,
|
|
|
|
|
"simulation-profile", &file,
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
gimp_color_profile_combo_box_set_active_file (GIMP_COLOR_PROFILE_COMBO_BOX (private->simulation_profile_combo),
|
|
|
|
|
file, NULL);
|
|
|
|
|
|
|
|
|
|
if (file)
|
|
|
|
|
g_object_unref (file);
|
2016-05-22 13:26:50 +02:00
|
|
|
|
}
|
2003-04-11 13:17:23 +00:00
|
|
|
|
}
|