2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2001-11-01 05:20:09 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2001-11-01 05:20:09 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2001-11-01 05:20:09 +08:00
|
|
|
* (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
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2001-11-01 05:20:09 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2008-10-10 04:24:04 +08:00
|
|
|
#include <gegl.h>
|
2001-11-01 05:20:09 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include "display-types.h"
|
|
|
|
|
|
|
|
#include "core/gimpimage.h"
|
|
|
|
|
|
|
|
#include "gimpdisplay.h"
|
|
|
|
#include "gimpdisplay-handlers.h"
|
2006-12-12 04:57:44 +08:00
|
|
|
|
2001-11-01 05:20:09 +08:00
|
|
|
|
|
|
|
/* local function prototypes */
|
|
|
|
|
2009-10-08 03:13:39 +08:00
|
|
|
static void gimp_display_update_handler (GimpProjection *projection,
|
|
|
|
gboolean now,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint w,
|
|
|
|
gint h,
|
|
|
|
GimpDisplay *display);
|
|
|
|
static void gimp_display_flush_handler (GimpImage *image,
|
|
|
|
gboolean invalidate_preview,
|
|
|
|
GimpDisplay *display);
|
2001-11-01 05:20:09 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* public functions */
|
|
|
|
|
|
|
|
void
|
2009-10-08 03:13:39 +08:00
|
|
|
gimp_display_connect (GimpDisplay *display)
|
2001-11-01 05:20:09 +08:00
|
|
|
{
|
2009-10-08 03:13:39 +08:00
|
|
|
GimpImage *image;
|
2001-11-01 05:20:09 +08:00
|
|
|
|
2009-10-08 03:13:39 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
2001-11-20 21:53:21 +08:00
|
|
|
|
2009-10-08 03:13:39 +08:00
|
|
|
image = gimp_display_get_image (display);
|
2009-10-06 15:16:46 +08:00
|
|
|
|
2009-10-08 03:13:39 +08:00
|
|
|
g_return_if_fail (GIMP_IS_IMAGE (image));
|
2001-11-01 05:20:09 +08:00
|
|
|
|
2008-08-07 17:17:46 +08:00
|
|
|
g_signal_connect (gimp_image_get_projection (image), "update",
|
2001-11-01 05:20:09 +08:00
|
|
|
G_CALLBACK (gimp_display_update_handler),
|
2006-03-29 01:55:52 +08:00
|
|
|
display);
|
2008-08-07 17:17:46 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_signal_connect (image, "flush",
|
2002-05-09 01:48:24 +08:00
|
|
|
G_CALLBACK (gimp_display_flush_handler),
|
2006-03-29 01:55:52 +08:00
|
|
|
display);
|
2001-11-01 05:20:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-03-29 01:55:52 +08:00
|
|
|
gimp_display_disconnect (GimpDisplay *display)
|
2001-11-01 05:20:09 +08:00
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
GimpImage *image;
|
2003-05-18 00:34:30 +08:00
|
|
|
|
2006-03-29 01:55:52 +08:00
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
2001-11-01 05:20:09 +08:00
|
|
|
|
2009-10-08 03:13:39 +08:00
|
|
|
image = gimp_display_get_image (display);
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_IMAGE (image));
|
2008-08-07 17:17:46 +08:00
|
|
|
|
|
|
|
g_signal_handlers_disconnect_by_func (image,
|
2002-05-09 01:48:24 +08:00
|
|
|
gimp_display_flush_handler,
|
2006-03-29 01:55:52 +08:00
|
|
|
display);
|
2008-08-07 17:17:46 +08:00
|
|
|
|
|
|
|
g_signal_handlers_disconnect_by_func (gimp_image_get_projection (image),
|
2001-11-01 05:20:09 +08:00
|
|
|
gimp_display_update_handler,
|
2006-03-29 01:55:52 +08:00
|
|
|
display);
|
2001-11-01 05:20:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
|
|
|
static void
|
2004-07-14 00:36:29 +08:00
|
|
|
gimp_display_update_handler (GimpProjection *projection,
|
|
|
|
gboolean now,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint w,
|
|
|
|
gint h,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display)
|
2001-11-01 05:20:09 +08:00
|
|
|
{
|
2006-03-29 01:55:52 +08:00
|
|
|
gimp_display_update_area (display, now, x, y, w, h);
|
2001-11-01 05:20:09 +08:00
|
|
|
}
|
2002-05-09 01:48:24 +08:00
|
|
|
|
|
|
|
static void
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_display_flush_handler (GimpImage *image,
|
2007-06-27 05:39:51 +08:00
|
|
|
gboolean invalidate_preview,
|
2006-03-29 01:55:52 +08:00
|
|
|
GimpDisplay *display)
|
2002-05-09 01:48:24 +08:00
|
|
|
{
|
2006-03-29 01:55:52 +08:00
|
|
|
gimp_display_flush (display);
|
2002-05-09 01:48:24 +08:00
|
|
|
}
|