mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 17:33:25 +00:00
libgimp*, plug-ins: now hide GimpParamSpecChoice struct.
New libgimpbase functions: - gimp_param_spec_choice_get_choice - gimp_param_spec_choice_get_default Now the only GParamSpec in libgimpbase whose struct is visible is GimpParamSpecObject. This can't change since it is derived into param specs defined in libgimp and therefore needs to be visible.
This commit is contained in:
parent
080b09bb96
commit
b1acb256e1
12 changed files with 152 additions and 110 deletions
|
@ -537,13 +537,12 @@ _gimp_param_spec_to_gp_param_def (GParamSpec *pspec,
|
||||||
/* Must be before G_IS_PARAM_SPEC_STRING() because it's a parent. */
|
/* Must be before G_IS_PARAM_SPEC_STRING() because it's a parent. */
|
||||||
else if (pspec_type == GIMP_TYPE_PARAM_CHOICE)
|
else if (pspec_type == GIMP_TYPE_PARAM_CHOICE)
|
||||||
{
|
{
|
||||||
GimpParamSpecChoice *cspec = GIMP_PARAM_SPEC_CHOICE (pspec);
|
GParamSpecString *sspec = G_PARAM_SPEC_STRING (pspec);
|
||||||
GParamSpecString *sspec = G_PARAM_SPEC_STRING (pspec);
|
|
||||||
|
|
||||||
param_def->param_def_type = GP_PARAM_DEF_TYPE_CHOICE;
|
param_def->param_def_type = GP_PARAM_DEF_TYPE_CHOICE;
|
||||||
|
|
||||||
param_def->meta.m_choice.default_val = sspec->default_value;
|
param_def->meta.m_choice.default_val = sspec->default_value;
|
||||||
param_def->meta.m_choice.choice = cspec->choice;
|
param_def->meta.m_choice.choice = gimp_param_spec_choice_get_choice (pspec);
|
||||||
}
|
}
|
||||||
else if (G_IS_PARAM_SPEC_STRING (pspec) &&
|
else if (G_IS_PARAM_SPEC_STRING (pspec) &&
|
||||||
#ifdef LIBGIMP_COMPILATION
|
#ifdef LIBGIMP_COMPILATION
|
||||||
|
|
|
@ -57,11 +57,12 @@ gimp_param_spec_unit_desc (GParamSpec *pspec)
|
||||||
static gchar *
|
static gchar *
|
||||||
gimp_param_spec_choice_desc (GParamSpec *pspec)
|
gimp_param_spec_choice_desc (GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GimpParamSpecChoice *cspec = GIMP_PARAM_SPEC_CHOICE (pspec);
|
GimpChoice *choice;
|
||||||
GList *choices;
|
GList *choices;
|
||||||
GString *desc;
|
GString *desc;
|
||||||
|
|
||||||
choices = gimp_choice_list_nicks (cspec->choice);
|
choice = gimp_param_spec_choice_get_choice (pspec);
|
||||||
|
choices = gimp_choice_list_nicks (choice);
|
||||||
desc = g_string_new ("\n");
|
desc = g_string_new ("\n");
|
||||||
|
|
||||||
g_string_append_printf (desc, "<i>%s</i>", _("Allowed values:"));
|
g_string_append_printf (desc, "<i>%s</i>", _("Allowed values:"));
|
||||||
|
@ -72,7 +73,7 @@ gimp_param_spec_choice_desc (GParamSpec *pspec)
|
||||||
gchar *label = NULL;
|
gchar *label = NULL;
|
||||||
gchar *help = NULL;
|
gchar *help = NULL;
|
||||||
|
|
||||||
gimp_choice_get_documentation (cspec->choice, (const gchar *) nick, (const gchar **) &label, (const gchar **) &help);
|
gimp_choice_get_documentation (choice, (const gchar *) nick, (const gchar **) &label, (const gchar **) &help);
|
||||||
nick = g_markup_escape_text (nick, -1);
|
nick = g_markup_escape_text (nick, -1);
|
||||||
label = g_markup_escape_text (label, -1);
|
label = g_markup_escape_text (label, -1);
|
||||||
help = (help != NULL ? g_markup_escape_text (help, -1) : NULL);
|
help = (help != NULL ? g_markup_escape_text (help, -1) : NULL);
|
||||||
|
|
|
@ -671,11 +671,11 @@ gimp_procedure_config_set_color_array (GimpProcedureConfig *config,
|
||||||
/**
|
/**
|
||||||
* gimp_procedure_config_get_choice_id:
|
* gimp_procedure_config_get_choice_id:
|
||||||
* @config: a #GimpProcedureConfig
|
* @config: a #GimpProcedureConfig
|
||||||
* @property_name: the name of a [struct@ParamSpecChoice] property.
|
* @property_name: the name of a #GimpParamSpecChoice property.
|
||||||
*
|
*
|
||||||
* A utility function which will get the current string value of a
|
* A utility function which will get the current string value of a
|
||||||
* [struct@ParamSpecChoice] property in @config and convert it to the integer ID
|
* #GimpParamSpecChoice property in @config and convert it to the
|
||||||
* mapped to this value.
|
* integer ID mapped to this value.
|
||||||
* This makes it easy to work with an Enum type locally, within a plug-in code.
|
* This makes it easy to work with an Enum type locally, within a plug-in code.
|
||||||
*
|
*
|
||||||
* Since: 3.0
|
* Since: 3.0
|
||||||
|
@ -684,10 +684,10 @@ gint
|
||||||
gimp_procedure_config_get_choice_id (GimpProcedureConfig *config,
|
gimp_procedure_config_get_choice_id (GimpProcedureConfig *config,
|
||||||
const gchar *property_name)
|
const gchar *property_name)
|
||||||
{
|
{
|
||||||
GParamSpec *param_spec;
|
GParamSpec *param_spec;
|
||||||
GimpParamSpecChoice *cspec;
|
GimpChoice *choice;
|
||||||
gchar *value = NULL;
|
gchar *value = NULL;
|
||||||
gint id;
|
gint id;
|
||||||
|
|
||||||
param_spec = g_object_class_find_property (G_OBJECT_GET_CLASS (config),
|
param_spec = g_object_class_find_property (G_OBJECT_GET_CLASS (config),
|
||||||
property_name);
|
property_name);
|
||||||
|
@ -711,11 +711,11 @@ gimp_procedure_config_get_choice_id (GimpProcedureConfig *config,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cspec = GIMP_PARAM_SPEC_CHOICE (param_spec);
|
choice = gimp_param_spec_choice_get_choice (param_spec);
|
||||||
g_object_get (config,
|
g_object_get (config,
|
||||||
property_name, &value,
|
property_name, &value,
|
||||||
NULL);
|
NULL);
|
||||||
id = gimp_choice_get_id (cspec->choice, value);
|
id = gimp_choice_get_id (choice, value);
|
||||||
|
|
||||||
g_free (value);
|
g_free (value);
|
||||||
|
|
||||||
|
|
|
@ -140,6 +140,8 @@ EXPORTS
|
||||||
gimp_param_parasite_get_type
|
gimp_param_parasite_get_type
|
||||||
gimp_param_spec_array
|
gimp_param_spec_array
|
||||||
gimp_param_spec_choice
|
gimp_param_spec_choice
|
||||||
|
gimp_param_spec_choice_get_choice
|
||||||
|
gimp_param_spec_choice_get_default
|
||||||
gimp_param_spec_core_object_array
|
gimp_param_spec_core_object_array
|
||||||
gimp_param_spec_core_object_array_get_object_type
|
gimp_param_spec_core_object_array_get_object_type
|
||||||
gimp_param_spec_double_array
|
gimp_param_spec_double_array
|
||||||
|
|
|
@ -401,6 +401,17 @@ gimp_choice_desc_free (GimpChoiceDesc *desc)
|
||||||
* GIMP_TYPE_PARAM_CHOICE
|
* GIMP_TYPE_PARAM_CHOICE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define GIMP_PARAM_SPEC_CHOICE(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_CHOICE, GimpParamSpecChoice))
|
||||||
|
|
||||||
|
typedef struct _GimpParamSpecChoice GimpParamSpecChoice;
|
||||||
|
|
||||||
|
struct _GimpParamSpecChoice
|
||||||
|
{
|
||||||
|
GParamSpecString parent_instance;
|
||||||
|
|
||||||
|
GimpChoice *choice;
|
||||||
|
};
|
||||||
|
|
||||||
static void gimp_param_choice_class_init (GParamSpecClass *klass);
|
static void gimp_param_choice_class_init (GParamSpecClass *klass);
|
||||||
static void gimp_param_choice_init (GParamSpec *pspec);
|
static void gimp_param_choice_init (GParamSpec *pspec);
|
||||||
static void gimp_param_choice_finalize (GParamSpec *pspec);
|
static void gimp_param_choice_finalize (GParamSpec *pspec);
|
||||||
|
@ -568,3 +579,39 @@ gimp_param_spec_choice (const gchar *name,
|
||||||
|
|
||||||
return G_PARAM_SPEC (choice_spec);
|
return G_PARAM_SPEC (choice_spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_param_spec_choice_get_choice:
|
||||||
|
* @pspec: a #GParamSpec to hold a #GimpParamSpecChoice value.
|
||||||
|
*
|
||||||
|
* Returns: (transfer none): the choice object defining the valid values.
|
||||||
|
*
|
||||||
|
* Since: 3.0
|
||||||
|
**/
|
||||||
|
GimpChoice *
|
||||||
|
gimp_param_spec_choice_get_choice (GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GIMP_IS_PARAM_SPEC_CHOICE (pspec), NULL);
|
||||||
|
|
||||||
|
return GIMP_PARAM_SPEC_CHOICE (pspec)->choice;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_param_spec_choice_get_default:
|
||||||
|
* @pspec: a #GParamSpec to hold a #GimpParamSpecChoice value.
|
||||||
|
*
|
||||||
|
* Returns: the default value.
|
||||||
|
*
|
||||||
|
* Since: 3.0
|
||||||
|
**/
|
||||||
|
const gchar *
|
||||||
|
gimp_param_spec_choice_get_default (GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
const GValue *value;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GIMP_IS_PARAM_SPEC_CHOICE (pspec), NULL);
|
||||||
|
|
||||||
|
value = g_param_spec_get_default_value (pspec);
|
||||||
|
|
||||||
|
return g_value_get_string (value);
|
||||||
|
}
|
||||||
|
|
|
@ -73,26 +73,20 @@ void gimp_choice_set_sensitive (GimpChoice *choice,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define GIMP_TYPE_PARAM_CHOICE (gimp_param_choice_get_type ())
|
#define GIMP_TYPE_PARAM_CHOICE (gimp_param_choice_get_type ())
|
||||||
#define GIMP_PARAM_SPEC_CHOICE(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_CHOICE, GimpParamSpecChoice))
|
|
||||||
#define GIMP_IS_PARAM_SPEC_CHOICE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_CHOICE))
|
#define GIMP_IS_PARAM_SPEC_CHOICE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_CHOICE))
|
||||||
|
|
||||||
typedef struct _GimpParamSpecChoice GimpParamSpecChoice;
|
|
||||||
|
|
||||||
struct _GimpParamSpecChoice
|
GType gimp_param_choice_get_type (void) G_GNUC_CONST;
|
||||||
{
|
|
||||||
GParamSpecString parent_instance;
|
|
||||||
|
|
||||||
GimpChoice *choice;
|
GParamSpec * gimp_param_spec_choice (const gchar *name,
|
||||||
};
|
const gchar *nick,
|
||||||
|
const gchar *blurb,
|
||||||
|
GimpChoice *choice,
|
||||||
|
const gchar *default_value,
|
||||||
|
GParamFlags flags);
|
||||||
|
|
||||||
GType gimp_param_choice_get_type (void) G_GNUC_CONST;
|
GimpChoice * gimp_param_spec_choice_get_choice (GParamSpec *pspec);
|
||||||
|
const gchar * gimp_param_spec_choice_get_default (GParamSpec *pspec);
|
||||||
GParamSpec * gimp_param_spec_choice (const gchar *name,
|
|
||||||
const gchar *nick,
|
|
||||||
const gchar *blurb,
|
|
||||||
GimpChoice *choice,
|
|
||||||
const gchar *default_value,
|
|
||||||
GParamFlags flags);
|
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
|
@ -96,11 +96,9 @@ gimp_config_param_spec_duplicate (GParamSpec *pspec)
|
||||||
|
|
||||||
if (GIMP_IS_PARAM_SPEC_CHOICE (pspec))
|
if (GIMP_IS_PARAM_SPEC_CHOICE (pspec))
|
||||||
{
|
{
|
||||||
GimpParamSpecChoice *cspec = GIMP_PARAM_SPEC_CHOICE (pspec);
|
|
||||||
|
|
||||||
copy = gimp_param_spec_choice (name, nick, blurb,
|
copy = gimp_param_spec_choice (name, nick, blurb,
|
||||||
g_object_ref (cspec->choice),
|
g_object_ref (gimp_param_spec_choice_get_choice (pspec)),
|
||||||
spec->default_value,
|
gimp_param_spec_choice_get_default (pspec),
|
||||||
flags);
|
flags);
|
||||||
}
|
}
|
||||||
else if (GEGL_IS_PARAM_SPEC_FILE_PATH (pspec))
|
else if (GEGL_IS_PARAM_SPEC_FILE_PATH (pspec))
|
||||||
|
|
|
@ -2622,12 +2622,12 @@ GtkWidget *
|
||||||
gimp_prop_choice_combo_box_new (GObject *config,
|
gimp_prop_choice_combo_box_new (GObject *config,
|
||||||
const gchar *property_name)
|
const gchar *property_name)
|
||||||
{
|
{
|
||||||
GParamSpec *param_spec;
|
GParamSpec *param_spec;
|
||||||
GimpParamSpecChoice *cspec;
|
GimpChoice *choice;
|
||||||
GtkWidget *combo_box;
|
GtkWidget *combo_box;
|
||||||
GtkListStore *store;
|
GtkListStore *store;
|
||||||
GList *values;
|
GList *values;
|
||||||
GList *iter;
|
GList *iter;
|
||||||
|
|
||||||
g_return_val_if_fail (G_IS_OBJECT (config), NULL);
|
g_return_val_if_fail (G_IS_OBJECT (config), NULL);
|
||||||
g_return_val_if_fail (property_name != NULL, NULL);
|
g_return_val_if_fail (property_name != NULL, NULL);
|
||||||
|
@ -2637,14 +2637,14 @@ gimp_prop_choice_combo_box_new (GObject *config,
|
||||||
if (! param_spec)
|
if (! param_spec)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
cspec = GIMP_PARAM_SPEC_CHOICE (param_spec);
|
choice = gimp_param_spec_choice_get_choice (param_spec);
|
||||||
values = gimp_choice_list_nicks (cspec->choice);
|
values = gimp_choice_list_nicks (choice);
|
||||||
store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
|
store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
|
||||||
|
|
||||||
for (iter = values; iter; iter = iter->next)
|
for (iter = values; iter; iter = iter->next)
|
||||||
{
|
{
|
||||||
const gchar *nick = iter->data;
|
const gchar *nick = iter->data;
|
||||||
const gchar *label = gimp_choice_get_label (cspec->choice, nick);
|
const gchar *label = gimp_choice_get_label (choice, nick);
|
||||||
|
|
||||||
gtk_list_store_insert_with_values (store, NULL, -1,
|
gtk_list_store_insert_with_values (store, NULL, -1,
|
||||||
0, nick,
|
0, nick,
|
||||||
|
@ -2658,8 +2658,8 @@ gimp_prop_choice_combo_box_new (GObject *config,
|
||||||
|
|
||||||
gimp_string_combo_box_set_sensitivity (GIMP_STRING_COMBO_BOX (combo_box),
|
gimp_string_combo_box_set_sensitivity (GIMP_STRING_COMBO_BOX (combo_box),
|
||||||
(GimpStringSensitivityFunc) gimp_prop_choice_combo_box_is_sensitive,
|
(GimpStringSensitivityFunc) gimp_prop_choice_combo_box_is_sensitive,
|
||||||
cspec->choice, NULL);
|
choice, NULL);
|
||||||
g_signal_connect_swapped (cspec->choice, "sensitivity-changed",
|
g_signal_connect_swapped (choice, "sensitivity-changed",
|
||||||
G_CALLBACK (gtk_widget_queue_draw),
|
G_CALLBACK (gtk_widget_queue_draw),
|
||||||
combo_box);
|
combo_box);
|
||||||
|
|
||||||
|
@ -2764,12 +2764,12 @@ GtkWidget *
|
||||||
gimp_prop_choice_radio_frame_new (GObject *config,
|
gimp_prop_choice_radio_frame_new (GObject *config,
|
||||||
const gchar *property_name)
|
const gchar *property_name)
|
||||||
{
|
{
|
||||||
GParamSpec *param_spec;
|
GParamSpec *param_spec;
|
||||||
GimpParamSpecChoice *cspec;
|
GimpChoice *choice;
|
||||||
GtkWidget *frame;
|
GtkWidget *frame;
|
||||||
GimpIntStore *store;
|
GimpIntStore *store;
|
||||||
GList *values;
|
GList *values;
|
||||||
GList *iter;
|
GList *iter;
|
||||||
|
|
||||||
g_return_val_if_fail (G_IS_OBJECT (config), NULL);
|
g_return_val_if_fail (G_IS_OBJECT (config), NULL);
|
||||||
g_return_val_if_fail (property_name != NULL, NULL);
|
g_return_val_if_fail (property_name != NULL, NULL);
|
||||||
|
@ -2779,15 +2779,15 @@ gimp_prop_choice_radio_frame_new (GObject *config,
|
||||||
if (! param_spec)
|
if (! param_spec)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
cspec = GIMP_PARAM_SPEC_CHOICE (param_spec);
|
choice = gimp_param_spec_choice_get_choice (param_spec);
|
||||||
values = gimp_choice_list_nicks (cspec->choice);
|
values = gimp_choice_list_nicks (choice);
|
||||||
store = g_object_new (GIMP_TYPE_INT_STORE, NULL);
|
store = g_object_new (GIMP_TYPE_INT_STORE, NULL);
|
||||||
|
|
||||||
for (iter = values; iter; iter = iter->next)
|
for (iter = values; iter; iter = iter->next)
|
||||||
{
|
{
|
||||||
const gchar *nick = iter->data;
|
const gchar *nick = iter->data;
|
||||||
const gchar *label = gimp_choice_get_label (cspec->choice, nick);
|
const gchar *label = gimp_choice_get_label (choice, nick);
|
||||||
gint id = gimp_choice_get_id (cspec->choice, nick);
|
gint id = gimp_choice_get_id (choice, nick);
|
||||||
|
|
||||||
gtk_list_store_insert_with_values (GTK_LIST_STORE (store), NULL, -1,
|
gtk_list_store_insert_with_values (GTK_LIST_STORE (store), NULL, -1,
|
||||||
GIMP_INT_STORE_VALUE, id,
|
GIMP_INT_STORE_VALUE, id,
|
||||||
|
@ -2803,14 +2803,14 @@ gimp_prop_choice_radio_frame_new (GObject *config,
|
||||||
|
|
||||||
gimp_int_radio_frame_set_sensitivity (GIMP_INT_RADIO_FRAME (frame),
|
gimp_int_radio_frame_set_sensitivity (GIMP_INT_RADIO_FRAME (frame),
|
||||||
(GimpIntRadioFrameSensitivityFunc) gimp_prop_widget_choice_is_sensitive,
|
(GimpIntRadioFrameSensitivityFunc) gimp_prop_widget_choice_is_sensitive,
|
||||||
cspec->choice, NULL);
|
choice, NULL);
|
||||||
|
|
||||||
g_object_bind_property_full (config, property_name,
|
g_object_bind_property_full (config, property_name,
|
||||||
frame, "value",
|
frame, "value",
|
||||||
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE,
|
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE,
|
||||||
gimp_prop_widget_choice_string_to_int,
|
gimp_prop_widget_choice_string_to_int,
|
||||||
gimp_prop_widget_choice_int_to_string,
|
gimp_prop_widget_choice_int_to_string,
|
||||||
cspec->choice, NULL);
|
choice, NULL);
|
||||||
|
|
||||||
gimp_widget_set_bound_property (frame, config, property_name);
|
gimp_widget_set_bound_property (frame, config, property_name);
|
||||||
|
|
||||||
|
|
|
@ -936,11 +936,12 @@ open_dialog (GimpProcedure *procedure,
|
||||||
gint num_components,
|
gint num_components,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const gchar *title;
|
const gchar *title;
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
gboolean run;
|
gboolean run;
|
||||||
GimpParamSpecChoice *cspec;
|
GParamSpec *cspec;
|
||||||
OPJ_COLOR_SPACE color_space = OPJ_CLRSPC_SRGB;
|
GimpChoice *choice;
|
||||||
|
OPJ_COLOR_SPACE color_space = OPJ_CLRSPC_SRGB;
|
||||||
|
|
||||||
if (format == OPJ_CODEC_J2K)
|
if (format == OPJ_CODEC_J2K)
|
||||||
/* Not having color information is expected. */
|
/* Not having color information is expected. */
|
||||||
|
@ -955,21 +956,19 @@ open_dialog (GimpProcedure *procedure,
|
||||||
GIMP_PROCEDURE_CONFIG (config),
|
GIMP_PROCEDURE_CONFIG (config),
|
||||||
_(title));
|
_(title));
|
||||||
|
|
||||||
cspec =
|
cspec = g_object_class_find_property (G_OBJECT_GET_CLASS (config), "colorspace");
|
||||||
GIMP_PARAM_SPEC_CHOICE (g_object_class_find_property (G_OBJECT_GET_CLASS (config),
|
choice = gimp_param_spec_choice_get_choice (cspec);
|
||||||
"colorspace"));
|
|
||||||
|
|
||||||
|
|
||||||
if (num_components == 3)
|
if (num_components == 3)
|
||||||
{
|
{
|
||||||
/* Can be RGB, YUV and YCC. */
|
/* Can be RGB, YUV and YCC. */
|
||||||
gimp_choice_set_sensitive (cspec->choice, "grayscale", FALSE);
|
gimp_choice_set_sensitive (choice, "grayscale", FALSE);
|
||||||
gimp_choice_set_sensitive (cspec->choice, "cmyk", FALSE);
|
gimp_choice_set_sensitive (choice, "cmyk", FALSE);
|
||||||
}
|
}
|
||||||
else if (num_components == 4)
|
else if (num_components == 4)
|
||||||
{
|
{
|
||||||
/* Can be RGB, YUV and YCC with alpha or CMYK. */
|
/* Can be RGB, YUV and YCC with alpha or CMYK. */
|
||||||
gimp_choice_set_sensitive (cspec->choice, "grayscale", FALSE);
|
gimp_choice_set_sensitive (choice, "grayscale", FALSE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -984,7 +983,7 @@ open_dialog (GimpProcedure *procedure,
|
||||||
if (num_components == 3 || num_components == 4)
|
if (num_components == 3 || num_components == 4)
|
||||||
{
|
{
|
||||||
/* By default, RGB is active. */
|
/* By default, RGB is active. */
|
||||||
gimp_choice_set_sensitive (cspec->choice, "unknown", FALSE);
|
gimp_choice_set_sensitive (choice, "unknown", FALSE);
|
||||||
g_object_set (config, "colorspace", "srgb", NULL);
|
g_object_set (config, "colorspace", "srgb", NULL);
|
||||||
|
|
||||||
gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog),
|
gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog),
|
||||||
|
|
|
@ -1607,14 +1607,14 @@ mng_save_dialog (GimpImage *image,
|
||||||
|
|
||||||
if (num_layers == 1)
|
if (num_layers == 1)
|
||||||
{
|
{
|
||||||
GimpParamSpecChoice *cspec;
|
GParamSpec *cspec;
|
||||||
|
GimpChoice *choice;
|
||||||
|
|
||||||
cspec =
|
cspec = g_object_class_find_property (G_OBJECT_GET_CLASS (config), "default-chunks");
|
||||||
GIMP_PARAM_SPEC_CHOICE (g_object_class_find_property (G_OBJECT_GET_CLASS (config),
|
choice = gimp_param_spec_choice_get_choice (cspec);
|
||||||
"default-chunks"));
|
|
||||||
|
|
||||||
gimp_choice_set_sensitive (cspec->choice, "all-png", FALSE);
|
gimp_choice_set_sensitive (choice, "all-png", FALSE);
|
||||||
gimp_choice_set_sensitive (cspec->choice, "all-jng", FALSE);
|
gimp_choice_set_sensitive (choice, "all-jng", FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
combo = gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
|
combo = gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
|
||||||
|
|
|
@ -1748,8 +1748,9 @@ config_notify (GimpProcedureConfig *config,
|
||||||
}
|
}
|
||||||
else if (! strcmp (pspec->name, "save-type"))
|
else if (! strcmp (pspec->name, "save-type"))
|
||||||
{
|
{
|
||||||
gint savetype;
|
GParamSpec *cspec;
|
||||||
GimpParamSpecChoice *pspec;
|
GimpChoice *choice;
|
||||||
|
gint savetype;
|
||||||
|
|
||||||
savetype = gimp_procedure_config_get_choice_id (config, "save-type");
|
savetype = gimp_procedure_config_get_choice_id (config, "save-type");
|
||||||
|
|
||||||
|
@ -1774,9 +1775,9 @@ config_notify (GimpProcedureConfig *config,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pspec = GIMP_PARAM_SPEC_CHOICE (g_object_class_find_property (G_OBJECT_GET_CLASS (config),
|
cspec = g_object_class_find_property (G_OBJECT_GET_CLASS (config), "mipmaps");
|
||||||
"mipmaps"));
|
choice = gimp_param_spec_choice_get_choice (cspec);
|
||||||
gimp_choice_set_sensitive (pspec->choice, "existing", check_mipmaps (savetype));
|
gimp_choice_set_sensitive (choice, "existing", check_mipmaps (savetype));
|
||||||
}
|
}
|
||||||
else if (! strcmp (pspec->name, "mipmaps"))
|
else if (! strcmp (pspec->name, "mipmaps"))
|
||||||
{
|
{
|
||||||
|
@ -1906,10 +1907,11 @@ save_dialog (GimpImage *image,
|
||||||
GimpProcedure *procedure,
|
GimpProcedure *procedure,
|
||||||
GimpProcedureConfig *config)
|
GimpProcedureConfig *config)
|
||||||
{
|
{
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
GimpParamSpecChoice *cspec;
|
GParamSpec *cspec;
|
||||||
GimpImageBaseType base_type;
|
GimpChoice *choice;
|
||||||
gboolean run;
|
GimpImageBaseType base_type;
|
||||||
|
gboolean run;
|
||||||
|
|
||||||
base_type = gimp_image_get_base_type (image);
|
base_type = gimp_image_get_base_type (image);
|
||||||
|
|
||||||
|
@ -1956,17 +1958,17 @@ save_dialog (GimpImage *image,
|
||||||
|
|
||||||
gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
|
gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
|
||||||
"save-type", G_TYPE_NONE);
|
"save-type", G_TYPE_NONE);
|
||||||
cspec = GIMP_PARAM_SPEC_CHOICE (g_object_class_find_property (G_OBJECT_GET_CLASS (config),
|
cspec = g_object_class_find_property (G_OBJECT_GET_CLASS (config), "save-type");
|
||||||
"save-type"));
|
choice = gimp_param_spec_choice_get_choice (cspec);
|
||||||
gimp_choice_set_sensitive (cspec->choice, "cube", is_cubemap);
|
gimp_choice_set_sensitive (choice, "cube", is_cubemap);
|
||||||
gimp_choice_set_sensitive (cspec->choice, "volume", is_volume);
|
gimp_choice_set_sensitive (choice, "volume", is_volume);
|
||||||
gimp_choice_set_sensitive (cspec->choice, "array", is_array);
|
gimp_choice_set_sensitive (choice, "array", is_array);
|
||||||
|
|
||||||
gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
|
gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
|
||||||
"mipmaps", G_TYPE_NONE);
|
"mipmaps", G_TYPE_NONE);
|
||||||
cspec = GIMP_PARAM_SPEC_CHOICE (g_object_class_find_property (G_OBJECT_GET_CLASS (config),
|
cspec = g_object_class_find_property (G_OBJECT_GET_CLASS (config), "mipmaps");
|
||||||
"mipmaps"));
|
choice = gimp_param_spec_choice_get_choice (cspec);
|
||||||
gimp_choice_set_sensitive (cspec->choice, "existing",
|
gimp_choice_set_sensitive (choice, "existing",
|
||||||
! (is_volume || is_cubemap) && is_mipmap_chain_valid);
|
! (is_volume || is_cubemap) && is_mipmap_chain_valid);
|
||||||
|
|
||||||
gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog),
|
gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog),
|
||||||
|
|
|
@ -1234,22 +1234,22 @@ save_dialog (GimpImage *image,
|
||||||
gboolean is_multi_layer,
|
gboolean is_multi_layer,
|
||||||
gboolean classic_tiff_failed)
|
gboolean classic_tiff_failed)
|
||||||
{
|
{
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
GtkWidget *profile_label;
|
GtkWidget *profile_label;
|
||||||
gchar **parasites;
|
gchar **parasites;
|
||||||
GimpCompression compression;
|
GimpCompression compression;
|
||||||
gboolean run;
|
gboolean run;
|
||||||
gboolean has_geotiff = FALSE;
|
gboolean has_geotiff = FALSE;
|
||||||
gint i;
|
gint i;
|
||||||
GimpColorProfile *cmyk_profile = NULL;
|
GimpColorProfile *cmyk_profile = NULL;
|
||||||
GParamSpec *comp_spec;
|
GParamSpec *cspec;
|
||||||
GimpParamSpecChoice *cspec;
|
GimpChoice *choice;
|
||||||
|
|
||||||
comp_spec = g_object_class_find_property (G_OBJECT_GET_CLASS (config), "compression");
|
cspec = g_object_class_find_property (G_OBJECT_GET_CLASS (config), "compression");
|
||||||
cspec = GIMP_PARAM_SPEC_CHOICE (comp_spec);
|
choice = gimp_param_spec_choice_get_choice (cspec);
|
||||||
gimp_choice_set_sensitive (cspec->choice, "ccittfax3", is_monochrome);
|
gimp_choice_set_sensitive (choice, "ccittfax3", is_monochrome);
|
||||||
gimp_choice_set_sensitive (cspec->choice, "ccittfax4", is_monochrome);
|
gimp_choice_set_sensitive (choice, "ccittfax4", is_monochrome);
|
||||||
gimp_choice_set_sensitive (cspec->choice, "jpeg", ! is_indexed);
|
gimp_choice_set_sensitive (choice, "jpeg", ! is_indexed);
|
||||||
|
|
||||||
parasites = gimp_image_get_parasite_list (image);
|
parasites = gimp_image_get_parasite_list (image);
|
||||||
for (i = 0; i < g_strv_length (parasites); i++)
|
for (i = 0; i < g_strv_length (parasites); i++)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue