Commit 16222432 authored by David Odin's avatar David Odin

app/widgets/gimppreviewrenderer-utils.c

* app/widgets/gimppreviewrenderer-utils.c
* app/widgets/gimppreviewrenderer-utils.h
* app/widgets/gimppreviewrendererbrush.c
* app/widgets/gimppreviewrendererbrush.h
* app/widgets/gimppreviewrendererdrawable.c
* app/widgets/gimppreviewrendererdrawable.h
* app/widgets/gimppreviewrenderergradient.c
* app/widgets/gimppreviewrenderergradient.h
* app/widgets/gimppreviewrendererimage.c
* app/widgets/gimppreviewrendererimage.h
* app/widgets/gimppreviewrendererimagefile.c
* app/widgets/gimppreviewrendererimagefile.h
* app/widgets/gimppreviewrendererlayer.c
* app/widgets/gimppreviewrendererlayer.h
* app/widgets/gimppreviewrenderervectors.c
* app/widgets/gimppreviewrenderervectors.h: Renamed all these files...

* app/widgets/gimpviewrenderer-utils.c
* app/widgets/gimpviewrenderer-utils.h
* app/widgets/gimpviewrendererbrush.c
* app/widgets/gimpviewrendererbrush.h
* app/widgets/gimpviewrendererdrawable.c
* app/widgets/gimpviewrendererdrawable.h
* app/widgets/gimpviewrenderergradient.c
* app/widgets/gimpviewrenderergradient.h
* app/widgets/gimpviewrendererimage.c
* app/widgets/gimpviewrendererimage.h
* app/widgets/gimpviewrendererimagefile.c
* app/widgets/gimpviewrendererimagefile.h
* app/widgets/gimpviewrendererlayer.c
* app/widgets/gimpviewrendererlayer.h
* app/widgets/gimpviewrenderervectors.c
* app/widgets/gimpviewrenderervectors.h: ... to these names. And also
  changed all the GimpPreviewRenderer* types to GimpViewRenderer* ones.

* app/tools/gimppaintoptions-gui.c

* app/widgets/Makefile.am
* app/widgets/gimpcomponenteditor.c
* app/widgets/gimpfiledialog.c
* app/widgets/gimpgradienteditor.c
* app/widgets/gimpview.c
* app/widgets/widgets-types.h
* app/widgets/gimpviewrenderer.c
* app/widgets/gimpviewrenderer.h: modified accordingly.
parent db6dff28
2004-08-26 DindinX <david@dindinx.org>
* app/widgets/gimppreviewrenderer-utils.c
* app/widgets/gimppreviewrenderer-utils.h
* app/widgets/gimppreviewrendererbrush.c
* app/widgets/gimppreviewrendererbrush.h
* app/widgets/gimppreviewrendererdrawable.c
* app/widgets/gimppreviewrendererdrawable.h
* app/widgets/gimppreviewrenderergradient.c
* app/widgets/gimppreviewrenderergradient.h
* app/widgets/gimppreviewrendererimage.c
* app/widgets/gimppreviewrendererimage.h
* app/widgets/gimppreviewrendererimagefile.c
* app/widgets/gimppreviewrendererimagefile.h
* app/widgets/gimppreviewrendererlayer.c
* app/widgets/gimppreviewrendererlayer.h
* app/widgets/gimppreviewrenderervectors.c
* app/widgets/gimppreviewrenderervectors.h: Renamed all these files...
* app/widgets/gimpviewrenderer-utils.c
* app/widgets/gimpviewrenderer-utils.h
* app/widgets/gimpviewrendererbrush.c
* app/widgets/gimpviewrendererbrush.h
* app/widgets/gimpviewrendererdrawable.c
* app/widgets/gimpviewrendererdrawable.h
* app/widgets/gimpviewrenderergradient.c
* app/widgets/gimpviewrenderergradient.h
* app/widgets/gimpviewrendererimage.c
* app/widgets/gimpviewrendererimage.h
* app/widgets/gimpviewrendererimagefile.c
* app/widgets/gimpviewrendererimagefile.h
* app/widgets/gimpviewrendererlayer.c
* app/widgets/gimpviewrendererlayer.h
* app/widgets/gimpviewrenderervectors.c
* app/widgets/gimpviewrenderervectors.h: ... to these names. And also
changed all the GimpPreviewRenderer* types to GimpViewRenderer* ones.
* app/tools/gimppaintoptions-gui.c
* app/widgets/Makefile.am
* app/widgets/gimpcomponenteditor.c
* app/widgets/gimpfiledialog.c
* app/widgets/gimpgradienteditor.c
* app/widgets/gimpview.c
* app/widgets/widgets-types.h
* app/widgets/gimpviewrenderer.c
* app/widgets/gimpviewrenderer.h: modified accordingly.
2004-08-26 Sven Neumann <sven@gimp.org>
* app/sanity.c (sanity_check_filename_encoding): try to convert
......
......@@ -36,7 +36,7 @@
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpview.h"
#include "widgets/gimppreviewrenderergradient.h"
#include "widgets/gimpviewrenderergradient.h"
#include "widgets/gimppropwidgets.h"
#include "widgets/gtkhwrapbox.h"
#include "widgets/gimpviewablebutton.h"
......@@ -131,7 +131,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
gtk_widget_set_sensitive (mode_label, FALSE);
}
/* the brush preview */
/* the brush view */
if (tool_type != GIMP_TYPE_BUCKET_FILL_TOOL &&
tool_type != GIMP_TYPE_BLEND_TOOL &&
tool_type != GIMP_TYPE_INK_TOOL)
......@@ -149,7 +149,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
button, 2, TRUE);
}
/* the pattern preview */
/* the pattern view */
if (tool_type == GIMP_TYPE_BUCKET_FILL_TOOL ||
tool_type == GIMP_TYPE_CLONE_TOOL)
{
......@@ -166,7 +166,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
button, 2, TRUE);
}
/* the gradient preview */
/* the gradient view */
if (g_type_is_a (tool_type, GIMP_TYPE_PAINTBRUSH_TOOL) ||
tool_options->tool_info->tool_type == GIMP_TYPE_BLEND_TOOL)
{
......@@ -495,10 +495,10 @@ gradient_options_reverse_notify (GimpPaintOptions *paint_options,
GParamSpec *pspec,
GimpView *view)
{
GimpPreviewRendererGradient *rendergrad;
GimpViewRendererGradient *rendergrad;
rendergrad = GIMP_PREVIEW_RENDERER_GRADIENT (view->renderer);
rendergrad = GIMP_VIEW_RENDERER_GRADIENT (view->renderer);
gimp_preview_renderer_gradient_set_reverse (rendergrad,
paint_options->gradient_options->gradient_reverse);
gimp_view_renderer_gradient_set_reverse (rendergrad,
paint_options->gradient_options->gradient_reverse);
}
......@@ -188,22 +188,6 @@ libappwidgets_a_sources = \
gimppdbdialog.h \
gimppluginaction.c \
gimppluginaction.h \
gimppreviewrenderer-utils.c \
gimppreviewrenderer-utils.h \
gimppreviewrendererbrush.c \
gimppreviewrendererbrush.h \
gimppreviewrendererdrawable.c \
gimppreviewrendererdrawable.h \
gimppreviewrenderergradient.c \
gimppreviewrenderergradient.h \
gimppreviewrendererimage.c \
gimppreviewrendererimage.h \
gimppreviewrendererimagefile.c \
gimppreviewrendererimagefile.h \
gimppreviewrendererlayer.c \
gimppreviewrendererlayer.h \
gimppreviewrenderervectors.c \
gimppreviewrenderervectors.h \
gimpprogressbox.c \
gimpprogressbox.h \
gimpprogressdialog.c \
......@@ -264,6 +248,22 @@ libappwidgets_a_sources = \
gimpviewabledialog.h \
gimpviewrenderer.c \
gimpviewrenderer.h \
gimpviewrenderer-utils.c \
gimpviewrenderer-utils.h \
gimpviewrendererbrush.c \
gimpviewrendererbrush.h \
gimpviewrendererdrawable.c \
gimpviewrendererdrawable.h \
gimpviewrenderergradient.c \
gimpviewrenderergradient.h \
gimpviewrendererimage.c \
gimpviewrendererimage.h \
gimpviewrendererimagefile.c \
gimpviewrendererimagefile.h \
gimpviewrendererlayer.c \
gimpviewrendererlayer.h \
gimpviewrenderervectors.c \
gimpviewrenderervectors.h \
gimpwidgets-constructors.c \
gimpwidgets-constructors.h \
gimpwidgets-utils.c \
......
......@@ -33,7 +33,7 @@
#include "gimpcellrendererviewable.h"
#include "gimpcomponenteditor.h"
#include "gimpmenufactory.h"
#include "gimppreviewrendererimage.h"
#include "gimpviewrendererimage.h"
#include "gimpwidgets-utils.h"
#include "gimp-intl.h"
......@@ -268,13 +268,13 @@ gimp_component_editor_set_image (GimpImageEditor *editor,
}
GtkWidget *
gimp_component_editor_new (gint preview_size,
gimp_component_editor_new (gint view_size,
GimpMenuFactory *menu_factory)
{
GimpComponentEditor *editor;
g_return_val_if_fail (preview_size > 0 &&
preview_size <= GIMP_VIEWABLE_MAX_PREVIEW_SIZE, NULL);
g_return_val_if_fail (view_size > 0 &&
view_size <= GIMP_VIEWABLE_MAX_PREVIEW_SIZE, NULL);
g_return_val_if_fail (GIMP_IS_MENU_FACTORY (menu_factory), NULL);
editor = g_object_new (GIMP_TYPE_COMPONENT_EDITOR,
......@@ -283,14 +283,14 @@ gimp_component_editor_new (gint preview_size,
"ui-path", "/channels-popup",
NULL);
gimp_component_editor_set_preview_size (editor, preview_size);
gimp_component_editor_set_preview_size (editor, view_size);
return GTK_WIDGET (editor);
}
void
gimp_component_editor_set_preview_size (GimpComponentEditor *editor,
gint preview_size)
gint view_size)
{
GtkWidget *tree_widget;
GtkIconSize icon_size;
......@@ -298,17 +298,17 @@ gimp_component_editor_set_preview_size (GimpComponentEditor *editor,
gboolean iter_valid;
g_return_if_fail (GIMP_IS_COMPONENT_EDITOR (editor));
g_return_if_fail (preview_size > 0 &&
preview_size <= GIMP_VIEWABLE_MAX_PREVIEW_SIZE);
g_return_if_fail (view_size > 0 &&
view_size <= GIMP_VIEWABLE_MAX_PREVIEW_SIZE);
tree_widget = GTK_WIDGET (editor->view);
icon_size = gimp_get_icon_size (tree_widget,
GIMP_STOCK_VISIBLE,
GTK_ICON_SIZE_BUTTON,
preview_size -
view_size -
2 * tree_widget->style->xthickness,
preview_size -
view_size -
2 * tree_widget->style->ythickness);
g_object_set (editor->eye_cell,
......@@ -325,11 +325,11 @@ gimp_component_editor_set_preview_size (GimpComponentEditor *editor,
COLUMN_RENDERER, &renderer,
-1);
gimp_view_renderer_set_size (renderer, preview_size, 1);
gimp_view_renderer_set_size (renderer, view_size, 1);
g_object_unref (renderer);
}
editor->preview_size = preview_size;
editor->preview_size = view_size;
gtk_tree_view_columns_autosize (editor->view);
}
......@@ -384,7 +384,7 @@ gimp_component_editor_create_components (GimpComponentEditor *editor)
gimp_view_renderer_set_viewable (renderer, GIMP_VIEWABLE (gimage));
gimp_view_renderer_remove_idle (renderer);
GIMP_PREVIEW_RENDERER_IMAGE (renderer)->channel = components[i];
GIMP_VIEW_RENDERER_IMAGE (renderer)->channel = components[i];
g_signal_connect (renderer, "update",
G_CALLBACK (gimp_component_editor_renderer_update),
......@@ -553,7 +553,7 @@ gimp_component_editor_renderer_update (GimpViewRenderer *renderer,
gint index;
index = gimp_image_get_component_index (GIMP_IMAGE (renderer->viewable),
GIMP_PREVIEW_RENDERER_IMAGE (renderer)->channel);
GIMP_VIEW_RENDERER_IMAGE (renderer)->channel);
if (gtk_tree_model_iter_nth_child (editor->model, &iter, NULL, index))
{
......
......@@ -44,7 +44,7 @@
#include "gimpfileprocview.h"
#include "gimphelp-ids.h"
#include "gimpview.h"
#include "gimppreviewrendererimagefile.h"
#include "gimpviewrendererimagefile.h"
#include "gimpthumbbox.h"
#include "gimpwidgets-utils.h"
......@@ -470,7 +470,7 @@ gimp_file_dialog_add_preview (GimpFileDialog *dialog,
gtk_widget_show (dialog->thumb_box);
#ifdef ENABLE_FILE_SYSTEM_ICONS
GIMP_PREVIEW_RENDERER_IMAGEFILE (GIMP_VIEW (GIMP_THUMB_BOX (dialog->thumb_box)->preview)->renderer)->file_system = _gtk_file_chooser_get_file_system (GTK_FILE_CHOOSER (dialog));
GIMP_VIEW_RENDERER_IMAGEFILE (GIMP_VIEW (GIMP_THUMB_BOX (dialog->thumb_box)->preview)->renderer)->file_system = _gtk_file_chooser_get_file_system (GTK_FILE_CHOOSER (dialog));
#endif
}
......
......@@ -70,7 +70,7 @@
#include "gimpgradienteditor.h"
#include "gimphelp-ids.h"
#include "gimpview.h"
#include "gimppreviewrenderergradient.h"
#include "gimpviewrenderergradient.h"
#include "gimpwidgets-utils.h"
#include "gui/color-notebook.h"
......@@ -83,19 +83,19 @@
#define GRAD_SCROLLBAR_STEP_SIZE 0.05
#define GRAD_SCROLLBAR_PAGE_SIZE 0.75
#define GRAD_PREVIEW_WIDTH 128
#define GRAD_PREVIEW_HEIGHT 96
#define GRAD_VIEW_WIDTH 128
#define GRAD_VIEW_HEIGHT 96
#define GRAD_CONTROL_HEIGHT 10
#define GRAD_MOVE_TIME 150 /* ms between mouse click and detection of movement in gradient control */
#define GRAD_PREVIEW_EVENT_MASK (GDK_EXPOSURE_MASK | \
GDK_LEAVE_NOTIFY_MASK | \
GDK_POINTER_MOTION_MASK | \
GDK_POINTER_MOTION_HINT_MASK | \
GDK_BUTTON_PRESS_MASK | \
GDK_BUTTON_RELEASE_MASK)
#define GRAD_VIEW_EVENT_MASK (GDK_EXPOSURE_MASK | \
GDK_LEAVE_NOTIFY_MASK | \
GDK_POINTER_MOTION_MASK | \
GDK_POINTER_MOTION_HINT_MASK | \
GDK_BUTTON_PRESS_MASK | \
GDK_BUTTON_RELEASE_MASK)
#define GRAD_CONTROL_EVENT_MASK (GDK_EXPOSURE_MASK | \
GDK_LEAVE_NOTIFY_MASK | \
......@@ -137,17 +137,17 @@ static void gradient_editor_set_hint (GimpGradientEditor *editor,
const gchar *str4);
/* Gradient preview functions */
/* Gradient view functions */
static gint preview_events (GtkWidget *widget,
static gint view_events (GtkWidget *widget,
GdkEvent *event,
GimpGradientEditor *editor);
static void preview_set_hint (GimpGradientEditor *editor,
static void view_set_hint (GimpGradientEditor *editor,
gint x);
static void preview_set_foreground (GimpGradientEditor *editor,
static void view_set_foreground (GimpGradientEditor *editor,
gint x);
static void preview_set_background (GimpGradientEditor *editor,
static void view_set_background (GimpGradientEditor *editor,
gint x);
/* Gradient control functions */
......@@ -277,7 +277,7 @@ gimp_gradient_editor_init (GimpGradientEditor *editor)
GtkWidget *hbox;
GtkWidget *button;
/* Frame for gradient preview and gradient control */
/* Frame for gradient view and gradient control */
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (editor), frame, TRUE, TRUE, 0);
......@@ -293,18 +293,18 @@ gimp_gradient_editor_init (GimpGradientEditor *editor)
editor->preview = gimp_view_new_full_by_types (GIMP_TYPE_VIEW,
GIMP_TYPE_GRADIENT,
GRAD_PREVIEW_WIDTH,
GRAD_PREVIEW_HEIGHT, 0,
GRAD_VIEW_WIDTH,
GRAD_VIEW_HEIGHT, 0,
FALSE, FALSE, FALSE);
gtk_widget_set_size_request (editor->preview,
GRAD_PREVIEW_WIDTH, GRAD_PREVIEW_HEIGHT);
gtk_widget_set_events (editor->preview, GRAD_PREVIEW_EVENT_MASK);
GRAD_VIEW_WIDTH, GRAD_VIEW_HEIGHT);
gtk_widget_set_events (editor->preview, GRAD_VIEW_EVENT_MASK);
gimp_view_set_expand (GIMP_VIEW (editor->preview), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), editor->preview, TRUE, TRUE, 0);
gtk_widget_show (editor->preview);
g_signal_connect (editor->preview, "event",
G_CALLBACK (preview_events),
G_CALLBACK (view_events),
editor);
gimp_dnd_viewable_dest_add (GTK_WIDGET (editor->preview),
......@@ -326,7 +326,7 @@ gimp_gradient_editor_init (GimpGradientEditor *editor)
editor->control = gtk_drawing_area_new ();
gtk_widget_set_size_request (editor->control,
GRAD_PREVIEW_WIDTH, GRAD_CONTROL_HEIGHT);
GRAD_VIEW_WIDTH, GRAD_CONTROL_HEIGHT);
gtk_widget_set_events (editor->control, GRAD_CONTROL_EVENT_MASK);
gtk_box_pack_start (GTK_BOX (vbox), editor->control, FALSE, FALSE, 0);
gtk_widget_show (editor->control);
......@@ -556,9 +556,9 @@ static void
gradient_editor_scrollbar_update (GtkAdjustment *adjustment,
GimpGradientEditor *editor)
{
GimpPreviewRendererGradient *renderer;
gchar *str1;
gchar *str2;
GimpViewRendererGradient *renderer;
gchar *str1;
gchar *str2;
str1 = g_strdup_printf (_("Zoom factor: %d:1"),
editor->zoom_factor);
......@@ -572,13 +572,13 @@ gradient_editor_scrollbar_update (GtkAdjustment *adjustment,
g_free (str1);
g_free (str2);
renderer = GIMP_PREVIEW_RENDERER_GRADIENT (GIMP_VIEW (editor->preview)->renderer);
renderer = GIMP_VIEW_RENDERER_GRADIENT (GIMP_VIEW (editor->preview)->renderer);
gimp_preview_renderer_gradient_set_offsets (renderer,
adjustment->value,
adjustment->value +
adjustment->page_size,
editor->instant_update);
gimp_view_renderer_gradient_set_offsets (renderer,
adjustment->value,
adjustment->value +
adjustment->page_size,
editor->instant_update);
gimp_gradient_editor_update (editor);
}
......@@ -695,12 +695,12 @@ gradient_editor_set_hint (GimpGradientEditor *editor,
}
/***** Gradient preview functions *****/
/***** Gradient view functions *****/
static gboolean
preview_events (GtkWidget *widget,
GdkEvent *event,
GimpGradientEditor *editor)
view_events (GtkWidget *widget,
GdkEvent *event,
GimpGradientEditor *editor)
{
gint x, y;
GdkEventButton *bevent;
......@@ -728,13 +728,13 @@ preview_events (GtkWidget *widget,
if (editor->preview_button_down)
{
if (mevent->state & GDK_CONTROL_MASK)
preview_set_background (editor, x);
view_set_background (editor, x);
else
preview_set_foreground (editor, x);
view_set_foreground (editor, x);
}
else
{
preview_set_hint (editor, x);
view_set_hint (editor, x);
}
}
break;
......@@ -750,9 +750,9 @@ preview_events (GtkWidget *widget,
editor->preview_last_x = x;
editor->preview_button_down = TRUE;
if (bevent->state & GDK_CONTROL_MASK)
preview_set_background (editor, x);
view_set_background (editor, x);
else
preview_set_foreground (editor, x);
view_set_foreground (editor, x);
break;
case 3:
......@@ -799,9 +799,9 @@ preview_events (GtkWidget *widget,
editor->preview_last_x = x;
editor->preview_button_down = FALSE;
if (bevent->state & GDK_CONTROL_MASK)
preview_set_background (editor, x);
view_set_background (editor, x);
else
preview_set_foreground (editor, x);
view_set_foreground (editor, x);
break;
}
break;
......@@ -814,8 +814,8 @@ preview_events (GtkWidget *widget,
}
static void
preview_set_hint (GimpGradientEditor *editor,
gint x)
view_set_hint (GimpGradientEditor *editor,
gint x)
{
GimpDataEditor *data_editor;
gdouble xpos;
......@@ -855,8 +855,8 @@ preview_set_hint (GimpGradientEditor *editor,
}
static void
preview_set_foreground (GimpGradientEditor *editor,
gint x)
view_set_foreground (GimpGradientEditor *editor,
gint x)
{
GimpGradient *gradient;
GimpContext *user_context;
......@@ -890,8 +890,8 @@ preview_set_foreground (GimpGradientEditor *editor,
}
static void
preview_set_background (GimpGradientEditor *editor,
gint x)
view_set_background (GimpGradientEditor *editor,
gint x)
{
GimpGradient *gradient;
GimpContext *user_context;
......@@ -1585,7 +1585,7 @@ control_update (GimpGradientEditor *editor,
return;
/* See whether we have to re-create the control pixmap
* depending on the preview's width
* depending on the view's width
*/
cwidth = editor->preview->allocation.width;
cheight = GRAD_CONTROL_HEIGHT;
......@@ -1763,7 +1763,7 @@ control_calc_p_pos (GimpGradientEditor *editor,
/* Calculate the position (in widget's coordinates) of the
* requested point from the gradient. Rounding is done to
* minimize mismatches between the rendered gradient preview
* minimize mismatches between the rendered gradient view
* and the gradient control's handles.
*/
......
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimppreviewrenderer-utils.c
* Copyright (C) 2003 Michael Natterer <mitch@gimp.org>
*
* 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 "widgets-types.h"
#include "core/gimpbrush.h"
#include "core/gimpdrawable.h"
#include "core/gimpgradient.h"
#include "core/gimplayer.h"
#include "core/gimpimage.h"
#include "core/gimpimagefile.h"
#include "vectors/gimpvectors.h"
#include "gimppreviewrendererbrush.h"
#include "gimppreviewrendererlayer.h"
#include "gimppreviewrenderergradient.h"
#include "gimppreviewrendererimage.h"
#include "gimppreviewrendererimagefile.h"
#include "gimppreviewrenderervectors.h"
GType
gimp_preview_renderer_type_from_viewable_type (GType viewable_type)
{
GType type = GIMP_TYPE_VIEW_RENDERER;
g_return_val_if_fail (g_type_is_a (viewable_type, GIMP_TYPE_VIEWABLE),
G_TYPE_NONE);
if (g_type_is_a (viewable_type, GIMP_TYPE_BRUSH))
{
type = GIMP_TYPE_PREVIEW_RENDERER_BRUSH;
}
else if (g_type_is_a (viewable_type, GIMP_TYPE_IMAGE))
{
type = GIMP_TYPE_PREVIEW_RENDERER_IMAGE;
}
else if (g_type_is_a (viewable_type, GIMP_TYPE_LAYER))
{
type = GIMP_TYPE_PREVIEW_RENDERER_LAYER;
}
else if (g_type_is_a (viewable_type, GIMP_TYPE_DRAWABLE))
{
type = GIMP_TYPE_PREVIEW_RENDERER_DRAWABLE;
}
else if (g_type_is_a (viewable_type, GIMP_TYPE_GRADIENT))
{
type = GIMP_TYPE_PREVIEW_RENDERER_GRADIENT;
}
else if (g_type_is_a (viewable_type, GIMP_TYPE_VECTORS))
{
type = GIMP_TYPE_PREVIEW_RENDERER_VECTORS;
}
else if (g_type_is_a (viewable_type, GIMP_TYPE_IMAGEFILE))
{
type = GIMP_TYPE_PREVIEW_RENDERER_IMAGEFILE;
}
return type;
}
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimppreviewrenderer-utils.h
* Copyright (C) 2003 Michael Natterer <mitch@gimp.org>
*
* 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.
*/
#ifndef __GIMP_PREVIEW_RENDERER_UTILS_H__
#define __GIMP_PREVIEW_RENDERER_UTILS_H__
GType gimp_preview_renderer_type_from_viewable_type (GType viewable_type);
#endif /* __GIMP_PREVIEW_RENDERER_UTILS_H__ */
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimppreviewrendererbrush.c
* Copyright (C) 2003 Michael Natterer <mitch@gimp.org>
*
* 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 "widgets-types.h"
#include "base/temp-buf.h"
#include "core/gimpbrush.h"
#include "core/gimpbrushpipe.h"
#include "gimppreviewrendererbrush.h"
static void gimp_preview_renderer_brush_class_init (GimpPreviewRendererBrushClass *klass);
static void gimp_preview_renderer_brush_init (GimpPreviewRendererBrush *renderer);
static void gimp_preview_renderer_brush_finalize (GObject *object);
static void gimp_preview_renderer_brush_render (GimpViewRenderer *renderer,
GtkWidget *widget);
static gboolean gimp_preview_renderer_brush_render_timeout (gpointer data);
static GimpViewRendererClass *parent_class = NULL;
GType
gimp_preview_renderer_brush_get_type (void)
{
static GType renderer_type = 0;
if (! renderer_type)
{
static const GTypeInfo renderer_info =
{
sizeof (GimpPreviewRendererBrushClass),
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gimp_preview_renderer_brush_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpPreviewRendererBrush),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_preview_renderer_brush_init,
};
renderer_type = g_type_register_static (GIMP_TYPE_VIEW_RENDERER,
"GimpPreviewRendererBrush",
&renderer_info, 0);
}
return renderer_type;
}
static void
gimp_preview_renderer_brush_class_init (GimpPreviewRendererBrushClass *klass)
{
GObjectClass *object_class;
GimpViewRendererClass *renderer_class;
object_class = G_OBJECT_CLASS (klass);
renderer_class = GIMP_VIEW_RENDERER_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gimp_preview_renderer_brush_finalize;
renderer_class->render = gimp_preview_renderer_brush_render;
}
static void
gimp_preview_renderer_brush_init (GimpPreviewRendererBrush *renderer)
{
renderer->pipe_timeout_id = 0;
renderer->pipe_animation_index = 0;
}
static void
gimp_preview_renderer_brush_finalize (GObject *object)
{
GimpPreviewRendererBrush *renderer = GIMP_PREVIEW_RENDERER_BRUSH (object);
if (renderer->pipe_timeout_id)
{
g_source_remove (renderer->pipe_timeout_id);
<