gimp/app/widgets/gimppatternpreview.c
Michael Natterer 5ffb34db38 V2001-02-07 Michael Natterer <mitch@gimp.org>
* app/Makefile.am
	* app/gimpdrawable-preview.[ch]: new files formerly known as
	gimpdrawablepreview.[ch].

	This is a new naming scheme for methods of objects which live
	outside their object's file. The old name implied a derived object
	(and is in fact now taken by a GimpPreview subclass, see below).

	Further candidates for renaming are e.g. gimpdrawable-invert.[ch],
	gimpimage-convert.[ch] etc.  Finaly, the main objects (image,
	drawable) will go to their own directories together with their
	subclasses.

	* app/apptypes.h: added typedefs for the new objects:

	* app/gimpbrushpreview.[ch]
	* app/gimppatternpreview.[ch]: new subclasses of GimpPreview.

	* app/gimpdrawablepreview.[ch]: contains a subclass of GimpPreview
	now.

	* app/gimpviewable.[ch]: renamed the virtual functions to
	"get_preview" and "get_new_preview" to avoid confusion with the
	new GimpPreview subclasses.

	* app/gimppreview.[ch]: virtualized "create_preview" and
	"create_popup".

	* app/gimpmarshal.[ch]: new marsaller for GimpPreview.

	* app/channels_dialog.c
	* app/fileops.c
	* app/gimpbrush.c
	* app/gimpdnd.c
	* app/gimpdrawable.c
	* app/gimpimage.c
	* app/gimppattern.c
	* app/layer_select.c
	* app/layers_dialog.c
	* app/lc_dialog.c
	* app/nav_window.c
	* app/palette_import.c
	* app/undo_history.c
	* app/pdb/drawable_cmds.c
	* app/pdb/image_cmds.c
	* tools/pdbgen/pdb/drawable.pdb
	* tools/pdbgen/pdb/image.pdb: changed accordingly.
2001-02-07 00:06:58 +00:00

100 lines
2.6 KiB
C

/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* GimpPatternPreview Widget
* Copyright (C) 2001 Michael Natterer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "apptypes.h"
#include "gimppattern.h"
#include "gimppatternpreview.h"
#include "temp_buf.h"
static void gimp_pattern_preview_class_init (GimpPatternPreviewClass *klass);
static void gimp_pattern_preview_init (GimpPatternPreview *preview);
static GtkWidget * gimp_pattern_preview_create_popup (GimpPreview *preview);
static GimpPreviewClass *parent_class = NULL;
GtkType
gimp_pattern_preview_get_type (void)
{
static GtkType preview_type = 0;
if (! preview_type)
{
GtkTypeInfo preview_info =
{
"GimpPatternPreview",
sizeof (GimpPatternPreview),
sizeof (GimpPatternPreviewClass),
(GtkClassInitFunc) gimp_pattern_preview_class_init,
(GtkObjectInitFunc) gimp_pattern_preview_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
};
preview_type = gtk_type_unique (GIMP_TYPE_PREVIEW, &preview_info);
}
return preview_type;
}
static void
gimp_pattern_preview_class_init (GimpPatternPreviewClass *klass)
{
GtkObjectClass *object_class;
GimpPreviewClass *preview_class;
object_class = (GtkObjectClass *) klass;
preview_class = (GimpPreviewClass *) klass;
parent_class = gtk_type_class (GIMP_TYPE_PREVIEW);
preview_class->create_popup = gimp_pattern_preview_create_popup;
}
static void
gimp_pattern_preview_init (GimpPatternPreview *preview)
{
}
static GtkWidget *
gimp_pattern_preview_create_popup (GimpPreview *preview)
{
gint popup_width;
gint popup_height;
popup_width = GIMP_PATTERN (preview->viewable)->mask->width;
popup_height = GIMP_PATTERN (preview->viewable)->mask->height;
return gimp_preview_new (preview->viewable,
popup_width,
popup_height,
FALSE, FALSE);
}