You are here

gtk.curve - no "changed" event?

I write a plugin and am using the gtk.curve widget. But I am confused because I dont know how to make preview refresh upon change of a curve. Simply, I miss something like this:

g_signal_connect( G_OBJECT( my_curve ), "changed",G_CALLBACK( .... ), NULL )

I noticed that the curves in gimp works as supposed - image is recalculated everytime when user changes the curve. I ended up (for now) with a button named like "refresh preview", but this is not good (= user friendly) approach.

So if any developer is here, please, advice me.


I see signal named "curve-type-changed" but not "changed" in the reference manual for gtk.curve widget, and I can't find a changed signal in any ancestor either. I don't know whether the call to g_signal_connect will return an error if the named signal is invalid.

I don't know whether that signal will do what you want. I interpret it to mean you will only get a signal if the user toggles the "curve type" button, not if the user drags the curve.

I would guess that the signal you want does not exist. Note the curve widget inherits from "drawing area" which means the widget is really low-level, tracking the mouse as the user drags a curve, etc. If any object in the inheritance is providing a changed signal, it should be the curve widget, but apparently it does not.

A work around could be to poll the curve in your main event loop. Ugly but it might work.

If Gimp is using the curve widget, you should be able to find an example in the Gimp source code.

Also note that the reference manual says this widget is little used and will disappear in the future (used mostly by Gimp.)

I am not a Gimp developer and I only hastily skimmed the gtk reference, so anything I said here could be wrong.

This what you wrote is also my understanding.

I looked into gimp source code (one or two .c files that might be relevant) but it is not easy to undestand it, as the code is too complex for me. Gimp uses curves, and I believe program as gimp will need curve(s) forever, so gtk might abandon it, but gimp will have to maintain it.

So it seems I will have to study gimp source - it is shame that feature like this is not described in easy to find and learn way.

Subscribe to Comments for "gtk.curve - no "changed" event?"