RSS/Atom feed Twitter
Site is read-only, email is disabled

adding option to crop tool

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

6 of 6 messages available
Toggle history

Please log in to manage your subscriptions.

adding option to crop tool Olivier 29 Sep 14:29
  adding option to crop tool Sven Neumann 29 Sep 16:15
   adding option to crop tool Olivier 29 Sep 16:27
    adding option to crop tool Sven Neumann 29 Sep 17:37
    adding option to crop tool Dave Neary 29 Sep 18:19
     adding option to crop tool Olivier 30 Sep 00:12
Olivier
2004-09-29 14:29:04 UTC (over 19 years ago)

adding option to crop tool

Hi all,

I'm trying to create a patch to fix several feature requests about the crop tool. However, after adding my first option to the crop tool info window, I get these messages during startup:

(gimp-2.1:11796): GLib-GObject-CRITICAL **: file genums.c: line 402 (g_value_get_enum): assertion _VALUE_HOLDS_ENUM (value)' failed

I've added a boolean (not enum!!) option to the struct in gimpcropoptions.h, added it to the set and get functions, to the class init, and added a corresponding widget to the GUI.

If I try to click the widget, I get the same errors.

Where should I look for the problem? Is there some auto-generated file that contains all registered options for all the tools or something like that??

thanks,
Olivier

Sven Neumann
2004-09-29 16:15:46 UTC (over 19 years ago)

adding option to crop tool

Hi,

lists@olivier.pk.wau.nl (Olivier) writes:

I'm trying to create a patch to fix several feature requests about the crop tool. However, after adding my first option to the crop tool info window, I get these messages during startup:

(gimp-2.1:11796): GLib-GObject-CRITICAL **: file genums.c: line 402 (g_value_get_enum): assertion _VALUE_HOLDS_ENUM (value)' failed

I've added a boolean (not enum!!) option to the struct in gimpcropoptions.h, added it to the set and get functions, to the class init, and added a corresponding widget to the GUI.

You should show us your code if you want us to help you.

Sven

Olivier
2004-09-29 16:27:54 UTC (over 19 years ago)

adding option to crop tool

On Wed, Sep 29, 2004 at 04:15:46PM +0200, Sven Neumann wrote:

You should show us your code if you want us to help you.

what is the policy towards attachments on this list? If allowed I'll attach the file, for now I'll list my changes:

-- in gimpcropoptions.h added a gboolean to the struct:

struct _GimpCropOptions {
GimpToolOptions parent_instence;

gboolean layer_only; gboolean allow_enlarge;
gboolean keep_aspect;
GimpCropMode crop_mode;
gboolean blank_outer_region; };

-- in gimpcropoptions.c added a number to the enum:

enum {
PROP_0,
PROP_LAYER_ONLY,
PROP_ALLOW_ENLARGE,
PROP_KEEP_ASPECT,
PROP_CROP_MODE,
PROP_BLANK_OUTER_REGION
};

-- added to gimp_crop_options_class_init (GimpCropOptionsClass *klass):

GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_BLANK_OUTER_REGION, "blank-outer-region", NULL, FALSE, 0);

-- added to gimp_crop_options_set_property:

case PROP_BLANK_OUTER_REGION: options->blank_outer_region = g_value_get_enum (value); break;

-- added to gimp_crop_options_get_property:

case PROP_BLANK_OUTER_REGION: g_value_set_enum (value, options->blank_outer_region); break;

-- added to gimp_crop_options_gui:

/* blank outer region */ button = gimp_prop_check_button_new (config, "blank-outer-region", _("Blank outer region"));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_widget_show (button);

(b.t.w: there is a memory leak in this function, the last string 'str' is not freed, but I'll include that in my patch whenever it is working)

so what is missing now?

thanks, Olivier

Sven Neumann
2004-09-29 17:37:52 UTC (over 19 years ago)

adding option to crop tool

Hi,

lists@olivier.pk.wau.nl (Olivier) writes:

-- added to gimp_crop_options_set_property:

case PROP_BLANK_OUTER_REGION: options->blank_outer_region = g_value_get_enum (value); break;

-- added to gimp_crop_options_get_property:

case PROP_BLANK_OUTER_REGION: g_value_set_enum (value, options->blank_outer_region); break;

You are using g_value_get_enum() and g_value_set_enum() on a boolean property.

Sven

Dave Neary
2004-09-29 18:19:15 UTC (over 19 years ago)

adding option to crop tool

Hi,

Quoting Olivier :

gboolean blank_outer_region;

GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_BLANK_OUTER_REGION, "blank-outer-region", NULL, FALSE, 0);

options->blank_outer_region = g_value_get_enum (value); g_value_set_enum (value, options->blank_outer_region);

This looks rather suspicions - you're declaring a gboolean as a BOOLEAN property, and then using get_ and set_enum to get and set its value. Try changing these to get_ and set_boolean and see what happens.

Cheers, Dave.

--
Dave Neary
Lyon, France

Olivier
2004-09-30 00:12:44 UTC (over 19 years ago)

adding option to crop tool

On Wed, Sep 29, 2004 at 06:19:15PM +0200, Dave Neary wrote:

Hi,

Quoting Olivier :

gboolean blank_outer_region;

GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_BLANK_OUTER_REGION, "blank-outer-region", NULL, FALSE, 0);

options->blank_outer_region = g_value_get_enum (value); g_value_set_enum (value, options->blank_outer_region);

This looks rather suspicions - you're declaring a gboolean as a BOOLEAN property, and then using get_ and set_enum to get and set its value. Try changing these to get_ and set_boolean and see what happens.

how blind did I become.... thanks for noticing that!

regards, Olivier