2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2003-07-05 03:55:58 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* GimpGrid
|
|
|
|
* Copyright (C) 2003 Henrik Brix Andersen <brix@gimp.org>
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2003-07-05 03:55:58 +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
|
2003-07-05 03:55:58 +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/>.
|
2003-07-05 03:55:58 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2013-10-15 07:58:39 +08:00
|
|
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
2008-10-10 04:24:04 +08:00
|
|
|
#include <gegl.h>
|
2003-07-05 03:55:58 +08:00
|
|
|
|
2005-01-26 03:11:26 +08:00
|
|
|
#include "libgimpconfig/gimpconfig.h"
|
2003-07-05 03:55:58 +08:00
|
|
|
|
2005-01-26 03:11:26 +08:00
|
|
|
#include "core-types.h"
|
2003-10-14 20:23:23 +08:00
|
|
|
|
2003-07-05 03:55:58 +08:00
|
|
|
#include "gimpgrid.h"
|
|
|
|
#include "gimpimage.h"
|
|
|
|
#include "gimpimage-grid.h"
|
2010-02-04 05:16:02 +08:00
|
|
|
#include "gimpimage-private.h"
|
2003-07-05 03:55:58 +08:00
|
|
|
#include "gimpimage-undo-push.h"
|
|
|
|
|
|
|
|
#include "gimp-intl.h"
|
|
|
|
|
|
|
|
|
|
|
|
GimpGrid *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_get_grid (GimpImage *image)
|
2003-07-05 03:55:58 +08:00
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
2003-07-05 03:55:58 +08:00
|
|
|
|
2010-02-04 05:16:02 +08:00
|
|
|
return GIMP_IMAGE_GET_PRIVATE (image)->grid;
|
2003-07-05 03:55:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_set_grid (GimpImage *image,
|
2003-07-05 03:55:58 +08:00
|
|
|
GimpGrid *grid,
|
|
|
|
gboolean push_undo)
|
|
|
|
{
|
2010-02-04 05:16:02 +08:00
|
|
|
GimpImagePrivate *private;
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_if_fail (GIMP_IS_IMAGE (image));
|
2003-10-14 20:23:23 +08:00
|
|
|
g_return_if_fail (GIMP_IS_GRID (grid));
|
2003-07-05 03:55:58 +08:00
|
|
|
|
2010-02-04 05:16:02 +08:00
|
|
|
private = GIMP_IMAGE_GET_PRIVATE (image);
|
|
|
|
|
|
|
|
if (gimp_config_is_equal_to (GIMP_CONFIG (private->grid), GIMP_CONFIG (grid)))
|
2003-10-14 20:23:23 +08:00
|
|
|
return;
|
2003-07-05 03:55:58 +08:00
|
|
|
|
2003-10-14 20:23:23 +08:00
|
|
|
if (push_undo)
|
2010-09-12 05:00:48 +08:00
|
|
|
gimp_image_undo_push_image_grid (image,
|
|
|
|
C_("undo-type", "Grid"), private->grid);
|
2003-07-05 03:55:58 +08:00
|
|
|
|
2010-02-04 05:16:02 +08:00
|
|
|
gimp_config_sync (G_OBJECT (grid), G_OBJECT (private->grid), 0);
|
2003-07-05 03:55:58 +08:00
|
|
|
}
|