added virtual function get_popup_size() which returns a boolean indicating

2003-02-27  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpviewable.[ch]: added virtual function
	get_popup_size() which returns a boolean indicating if a popup is
	needed and its size.

	* app/core/gimpbrush.c
	* app/core/gimpbrushpipe.c
	* app/core/gimpbuffer.c
	* app/core/gimpdrawable-preview.[ch]
	* app/core/gimpdrawable.c
	* app/core/gimpgradient.c
	* app/core/gimpimage.c
	* app/core/gimppalette.c
	* app/core/gimppattern.c
	* app/core/gimpundo.c: implement it.

	* app/widgets/gimppreview.[ch]: removed virtual functions
	needs_popup() and create_popup(). Removed the code which creates
	the popup and the popup members of the GimpPreview struct.

	* app/widgets/gimppreview-popup.[ch]: new files providing the
	utility function gimp_preview_popup_show() which can show popups
	from any widget, not just from a GimpPreview. Checks if a popup is
	needed using gimp_viewable_get_popup_size().

	* app/widgets/gimpcellrendererviewable.c: show popups here too.

	* app/widgets/gimpbrushpreview.c
	* app/widgets/gimpbufferpreview.c
	* app/widgets/gimpdrawablepreview.c
	* app/widgets/gimpimagepreview.c: removed needs_popup() and
	create_popup() implementations.

	* app/widgets/gimpnavigationpreview.c: removed empty render()
	implementation.

	* app/widgets/gimpundoeditor.c: use a tree instead of a list view.

	* app/widgets/gimpgradientpreview.[ch]
	* app/widgets/gimppalettepreview.[ch]
	* app/widgets/gimppatternpreview.[ch]: removed because they only
	implemented the removed popup functions.

	* app/widgets/Makefile.am
	* app/widgets/widgets-types.h
	* app/widgets/gimpmenuitem.c
	* app/widgets/gimppreview-utils.c: changed accordingly
This commit is contained in:
Michael Natterer
2003-02-27 13:59:41 +00:00
committed by Michael Natterer
parent b3e5867378
commit 0614aa5329
55 changed files with 1414 additions and 2094 deletions

View File

@ -35,8 +35,7 @@
static void gimp_image_preview_class_init (GimpImagePreviewClass *klass);
static void gimp_image_preview_init (GimpImagePreview *preview);
static void gimp_image_preview_render (GimpPreview *preview);
static GtkWidget * gimp_image_preview_create_popup (GimpPreview *preview);
static void gimp_image_preview_render (GimpPreview *preview);
static GimpPreviewClass *parent_class = NULL;
@ -79,8 +78,7 @@ gimp_image_preview_class_init (GimpImagePreviewClass *klass)
parent_class = g_type_class_peek_parent (klass);
preview_class->render = gimp_image_preview_render;
preview_class->create_popup = gimp_image_preview_create_popup;
preview_class->render = gimp_image_preview_render;
}
static void
@ -156,45 +154,3 @@ gimp_image_preview_render (GimpPreview *preview)
temp_buf_free (render_buf);
}
static GtkWidget *
gimp_image_preview_create_popup (GimpPreview *preview)
{
GimpImage *gimage;
gint popup_width;
gint popup_height;
gboolean scaling_up;
gimage = GIMP_IMAGE (preview->viewable);
gimp_viewable_calc_preview_size (preview->viewable,
gimage->width,
gimage->height,
MIN (preview->width * 2,
GIMP_PREVIEW_MAX_POPUP_SIZE),
MIN (preview->height * 2,
GIMP_PREVIEW_MAX_POPUP_SIZE),
preview->dot_for_dot,
gimage->xresolution,
gimage->yresolution,
&popup_width,
&popup_height,
&scaling_up);
if (scaling_up)
{
return gimp_preview_new_full (preview->viewable,
gimage->width,
gimage->height,
0,
TRUE, FALSE, FALSE);
}
else
{
return gimp_preview_new_full (preview->viewable,
popup_width,
popup_height,
0,
TRUE, FALSE, FALSE);
}
}