geert jordaens <[EMAIL PROTECTED]> writes:

> I'm trying to catch up with the changes concerning the preview widget
> Could somebody explain me why the functions
> gimp_preview_area_menu_popup
> gimp_preview_area_menu_new
> gimp_preview_area_menu_toggled are located in gimppreviewarea this way
> the preview area is not a basic replacement for the gtk_preview
> widget. If i understand the function of gimp_drawable_preview then I
> would place forementioned functions there.

These functions are not really part of the GimpPreviewArea widget. If
you use a GimpPreviewArea directly, you will never see a popup menu.
The only purpose of gimp_preview_area_menu_popup() is to make it
easier for higher-level widgets like GimpPreview to implement
GtkWidget::popup_menu(). The popup menu belongs to the higher-level
widget, it is only provided by GimpPreviewArea for convenience.

The popup menu API is likely going to change before 2.2.
GimpPreviewArea shouldn't provide a full menu, it should only add the
checkerboard related submenus. That way our widgets could add other
things to this menu. GimpPreview should for example add a toggle menu
item for the "Update Preview". I just haven't settled on an API here
but gimp_preview_area_menu_popup() is not likely going to stay.

Let me try to summarize the purpose of GimpPreviewArea. It is an area
you can draw to and it knows how to handle the various types of image
data that we deal with in GIMP (RGB, RGBA, GRAY, GRAYA, INDEXED,
INDEXEDA). GimpPreviewArea visualizes the alpha channel by compositing
the buffer on a checker-board. The checkerboard is configurable vie
object properties of the preview area. For convenience you can ask the
preview area to create a popup menu that is readily connected to the
checkerboard properties.

GimpPreviewArea can be used as a drop-in replacement for
GtkPreview. Like GtkPreview it keeps an internal buffer of the image
data you have drawn to it. This allows it to handle expose events for
you. It also provides an API that is very similar to GtkPreview.
Calls to gtk_preview_draw_row() can be replaced by calls to
gimp_preview_area_draw() passing a height of 1.

As you can see, GimpPreviewArea is still pretty much low-level. This
is intentional. Ideally we would provide more higher-level widgets and
noone would have to deal with GimpPreviewArea directly. At the moment
we only have GimpDrawablePreview which works nicely for a lot of
plug-in previews but not for all of them. For the plug-ins were
GimpDrawablePreview doesn't suit, you will have to use GimpPreviewArea
directly for now. It would be nice to hear though what other widgets
beside GimpDrawablePreview are needed. I would really like to see a
preview widget being added that deals with previewing the effect on a
scaled-down version of the drawable. That widget would show the full
drawable and wouldn't need any scrollbars and such. Still looking for
a good name for this beast...

Gimp-developer mailing list

Reply via email to