gimp/app/core/gimpgrid.c

348 lines
9.9 KiB
C
Raw Normal View History

/* GIMP - The GNU Image Manipulation Program
Added a per image configurable grid. This fixes bug #65198 * app/core/Makefile.am * app/core/core-types.h: * app/core/gimpgrid.[ch]: added new class GimpGrid. * app/core/core-enums.[ch]: added new enum GimpGridType. * app/core/gimpimage-guides.[ch]: removed the gimp_image_snap_*() functions... * app/core/gimpimage-snap.[ch]: ...and added them here since they are no longer guide specific. * app/core/gimpimage-undo-push.[ch]: added gimp_image_undo_push_image_grid() * app/display/gimpdisplayshell-handlers.c: * app/core/gimpimage.[ch]: added grid member to _GimpImage. Added new signal "grid_changed", added gimp_image_grid_changed(), gimp_image_get_grid() and gimp_image_set_grid(). * app/display/gimpdisplayshell-appearance.[ch]: added gimp_display_shell_set_show_grid(), gimp_display_shell_get_show_grid(), gimp_display_shell_set_snap_to_grid() and gimp_display_shell_get_snap_to_grid(). * app/display/gimpdisplayshell-callbacks.c: added call to gimp_display_shell_draw_grid() * app/display/gimpdisplayshell.[ch]: added grid member to _GimpDisplayShellVisibility, added snap_to_grid and grid_dialog members to _GimpDisplayShell, added gimp_display_shell_draw_grid(), modified gimp_display_shell_snap_coords() to use the new gimp_image_snap_*() functions. * app/gui/image-menu.c: added grid entries to image_menu_entries[]. * app/gui/view-commands.[ch]: added view_configure_grid_cmd_callback(), view_toggle_grid_cmd_callback() and view_snap_to_grid_cmd_callback(). * app/gui/Makefile.am * app/gui/grid-dialog.[ch]: added a grid dialog.
2003-06-24 03:34:48 +08:00
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* GimpGrid
* Copyright (C) 2003 Henrik Brix Andersen <brix@gimp.org>
*
* This program is free software: you can redistribute it and/or modify
Added a per image configurable grid. This fixes bug #65198 * app/core/Makefile.am * app/core/core-types.h: * app/core/gimpgrid.[ch]: added new class GimpGrid. * app/core/core-enums.[ch]: added new enum GimpGridType. * app/core/gimpimage-guides.[ch]: removed the gimp_image_snap_*() functions... * app/core/gimpimage-snap.[ch]: ...and added them here since they are no longer guide specific. * app/core/gimpimage-undo-push.[ch]: added gimp_image_undo_push_image_grid() * app/display/gimpdisplayshell-handlers.c: * app/core/gimpimage.[ch]: added grid member to _GimpImage. Added new signal "grid_changed", added gimp_image_grid_changed(), gimp_image_get_grid() and gimp_image_set_grid(). * app/display/gimpdisplayshell-appearance.[ch]: added gimp_display_shell_set_show_grid(), gimp_display_shell_get_show_grid(), gimp_display_shell_set_snap_to_grid() and gimp_display_shell_get_snap_to_grid(). * app/display/gimpdisplayshell-callbacks.c: added call to gimp_display_shell_draw_grid() * app/display/gimpdisplayshell.[ch]: added grid member to _GimpDisplayShellVisibility, added snap_to_grid and grid_dialog members to _GimpDisplayShell, added gimp_display_shell_draw_grid(), modified gimp_display_shell_snap_coords() to use the new gimp_image_snap_*() functions. * app/gui/image-menu.c: added grid entries to image_menu_entries[]. * app/gui/view-commands.[ch]: added view_configure_grid_cmd_callback(), view_toggle_grid_cmd_callback() and view_snap_to_grid_cmd_callback(). * app/gui/Makefile.am * app/gui/grid-dialog.[ch]: added a grid dialog.
2003-06-24 03:34:48 +08:00
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
Added a per image configurable grid. This fixes bug #65198 * app/core/Makefile.am * app/core/core-types.h: * app/core/gimpgrid.[ch]: added new class GimpGrid. * app/core/core-enums.[ch]: added new enum GimpGridType. * app/core/gimpimage-guides.[ch]: removed the gimp_image_snap_*() functions... * app/core/gimpimage-snap.[ch]: ...and added them here since they are no longer guide specific. * app/core/gimpimage-undo-push.[ch]: added gimp_image_undo_push_image_grid() * app/display/gimpdisplayshell-handlers.c: * app/core/gimpimage.[ch]: added grid member to _GimpImage. Added new signal "grid_changed", added gimp_image_grid_changed(), gimp_image_get_grid() and gimp_image_set_grid(). * app/display/gimpdisplayshell-appearance.[ch]: added gimp_display_shell_set_show_grid(), gimp_display_shell_get_show_grid(), gimp_display_shell_set_snap_to_grid() and gimp_display_shell_get_snap_to_grid(). * app/display/gimpdisplayshell-callbacks.c: added call to gimp_display_shell_draw_grid() * app/display/gimpdisplayshell.[ch]: added grid member to _GimpDisplayShellVisibility, added snap_to_grid and grid_dialog members to _GimpDisplayShell, added gimp_display_shell_draw_grid(), modified gimp_display_shell_snap_coords() to use the new gimp_image_snap_*() functions. * app/gui/image-menu.c: added grid entries to image_menu_entries[]. * app/gui/view-commands.[ch]: added view_configure_grid_cmd_callback(), view_toggle_grid_cmd_callback() and view_snap_to_grid_cmd_callback(). * app/gui/Makefile.am * app/gui/grid-dialog.[ch]: added a grid dialog.
2003-06-24 03:34:48 +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
* along with this program. If not, see <https://www.gnu.org/licenses/>.
Added a per image configurable grid. This fixes bug #65198 * app/core/Makefile.am * app/core/core-types.h: * app/core/gimpgrid.[ch]: added new class GimpGrid. * app/core/core-enums.[ch]: added new enum GimpGridType. * app/core/gimpimage-guides.[ch]: removed the gimp_image_snap_*() functions... * app/core/gimpimage-snap.[ch]: ...and added them here since they are no longer guide specific. * app/core/gimpimage-undo-push.[ch]: added gimp_image_undo_push_image_grid() * app/display/gimpdisplayshell-handlers.c: * app/core/gimpimage.[ch]: added grid member to _GimpImage. Added new signal "grid_changed", added gimp_image_grid_changed(), gimp_image_get_grid() and gimp_image_set_grid(). * app/display/gimpdisplayshell-appearance.[ch]: added gimp_display_shell_set_show_grid(), gimp_display_shell_get_show_grid(), gimp_display_shell_set_snap_to_grid() and gimp_display_shell_get_snap_to_grid(). * app/display/gimpdisplayshell-callbacks.c: added call to gimp_display_shell_draw_grid() * app/display/gimpdisplayshell.[ch]: added grid member to _GimpDisplayShellVisibility, added snap_to_grid and grid_dialog members to _GimpDisplayShell, added gimp_display_shell_draw_grid(), modified gimp_display_shell_snap_coords() to use the new gimp_image_snap_*() functions. * app/gui/image-menu.c: added grid entries to image_menu_entries[]. * app/gui/view-commands.[ch]: added view_configure_grid_cmd_callback(), view_toggle_grid_cmd_callback() and view_snap_to_grid_cmd_callback(). * app/gui/Makefile.am * app/gui/grid-dialog.[ch]: added a grid dialog.
2003-06-24 03:34:48 +08:00
*/
#include "config.h"
#include <string.h>
removed the grid parasite related functions from here ... 2003-10-10 Henrik Brix Andersen <brix@gimp.org> * app/core/gimpimage-grid.[ch]: removed the grid parasite related functions from here ... * app/core/gimpgrid.[ch]: ... and added them here. While I was at it I also changed PROP_TYPE to PROP_STYLE and added blurbs to the properties * app/xcf/xcf-load.c * app/display/gimpdisplayshell.c: changed accordingly * app/widgets/Makefile.am * po/POTFILES.in * app/widgets/widgets-types.h * app/widgets/gimpgrideditor.[ch]: added a new GimpGridEditor widget - with a work-around for the fact that gimp_prop_coordinated_new() doesn't accept boundaries * app/gui/grid-dialog.h * app/gui/grid-dialog.c (grid_dialog_new): use the new GimpGridEditor widget, take a GimpImage as function parameter, assume GimpImages always have a GimpGrid. This simplifies the grid dialog. * app/gui/image-commands.c (image_configure_grid_cmd_callback): changed accordingly * app/core/core-types.h: moved typedef GimpGrid from here ... * app/config/config-types.h: ... to here to be able to use it in GimpCoreConfig * app/config/gimprc-blurbs.h * app/config/gimpcoreconfig.[ch]: added default_grid member * app/widgets/gimphelp-ids.h * themes/Default/images/preferences/Makefile.am * themes/Default/images/default-grid.png * app/gui/preferences-dialog.c: added UI for specifying default image grid * app/core/gimpimage.c (gimp_image_new): create a GimpGrid from core_config->default_grid * app/gui/image-menu.c (image_menu_update): the grid/guide entries in <Image>/View/ should always be sensitive ... * app/display/gimpdisplayshell.c (gimp_display_shell_init): ... but the grid entries should be disabled by default
2003-10-10 22:11:47 +08:00
#include <cairo.h>
#include <gegl.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
Added a per image configurable grid. This fixes bug #65198 * app/core/Makefile.am * app/core/core-types.h: * app/core/gimpgrid.[ch]: added new class GimpGrid. * app/core/core-enums.[ch]: added new enum GimpGridType. * app/core/gimpimage-guides.[ch]: removed the gimp_image_snap_*() functions... * app/core/gimpimage-snap.[ch]: ...and added them here since they are no longer guide specific. * app/core/gimpimage-undo-push.[ch]: added gimp_image_undo_push_image_grid() * app/display/gimpdisplayshell-handlers.c: * app/core/gimpimage.[ch]: added grid member to _GimpImage. Added new signal "grid_changed", added gimp_image_grid_changed(), gimp_image_get_grid() and gimp_image_set_grid(). * app/display/gimpdisplayshell-appearance.[ch]: added gimp_display_shell_set_show_grid(), gimp_display_shell_get_show_grid(), gimp_display_shell_set_snap_to_grid() and gimp_display_shell_get_snap_to_grid(). * app/display/gimpdisplayshell-callbacks.c: added call to gimp_display_shell_draw_grid() * app/display/gimpdisplayshell.[ch]: added grid member to _GimpDisplayShellVisibility, added snap_to_grid and grid_dialog members to _GimpDisplayShell, added gimp_display_shell_draw_grid(), modified gimp_display_shell_snap_coords() to use the new gimp_image_snap_*() functions. * app/gui/image-menu.c: added grid entries to image_menu_entries[]. * app/gui/view-commands.[ch]: added view_configure_grid_cmd_callback(), view_toggle_grid_cmd_callback() and view_snap_to_grid_cmd_callback(). * app/gui/Makefile.am * app/gui/grid-dialog.[ch]: added a grid dialog.
2003-06-24 03:34:48 +08:00
#include "libgimpmath/gimpmath.h"
removed the grid parasite related functions from here ... 2003-10-10 Henrik Brix Andersen <brix@gimp.org> * app/core/gimpimage-grid.[ch]: removed the grid parasite related functions from here ... * app/core/gimpgrid.[ch]: ... and added them here. While I was at it I also changed PROP_TYPE to PROP_STYLE and added blurbs to the properties * app/xcf/xcf-load.c * app/display/gimpdisplayshell.c: changed accordingly * app/widgets/Makefile.am * po/POTFILES.in * app/widgets/widgets-types.h * app/widgets/gimpgrideditor.[ch]: added a new GimpGridEditor widget - with a work-around for the fact that gimp_prop_coordinated_new() doesn't accept boundaries * app/gui/grid-dialog.h * app/gui/grid-dialog.c (grid_dialog_new): use the new GimpGridEditor widget, take a GimpImage as function parameter, assume GimpImages always have a GimpGrid. This simplifies the grid dialog. * app/gui/image-commands.c (image_configure_grid_cmd_callback): changed accordingly * app/core/core-types.h: moved typedef GimpGrid from here ... * app/config/config-types.h: ... to here to be able to use it in GimpCoreConfig * app/config/gimprc-blurbs.h * app/config/gimpcoreconfig.[ch]: added default_grid member * app/widgets/gimphelp-ids.h * themes/Default/images/preferences/Makefile.am * themes/Default/images/default-grid.png * app/gui/preferences-dialog.c: added UI for specifying default image grid * app/core/gimpimage.c (gimp_image_new): create a GimpGrid from core_config->default_grid * app/gui/image-menu.c (image_menu_update): the grid/guide entries in <Image>/View/ should always be sensitive ... * app/display/gimpdisplayshell.c (gimp_display_shell_init): ... but the grid entries should be disabled by default
2003-10-10 22:11:47 +08:00
#include "libgimpbase/gimpbase.h"
2005-01-26 03:11:26 +08:00
#include "libgimpconfig/gimpconfig.h"
removed the grid parasite related functions from here ... 2003-10-10 Henrik Brix Andersen <brix@gimp.org> * app/core/gimpimage-grid.[ch]: removed the grid parasite related functions from here ... * app/core/gimpgrid.[ch]: ... and added them here. While I was at it I also changed PROP_TYPE to PROP_STYLE and added blurbs to the properties * app/xcf/xcf-load.c * app/display/gimpdisplayshell.c: changed accordingly * app/widgets/Makefile.am * po/POTFILES.in * app/widgets/widgets-types.h * app/widgets/gimpgrideditor.[ch]: added a new GimpGridEditor widget - with a work-around for the fact that gimp_prop_coordinated_new() doesn't accept boundaries * app/gui/grid-dialog.h * app/gui/grid-dialog.c (grid_dialog_new): use the new GimpGridEditor widget, take a GimpImage as function parameter, assume GimpImages always have a GimpGrid. This simplifies the grid dialog. * app/gui/image-commands.c (image_configure_grid_cmd_callback): changed accordingly * app/core/core-types.h: moved typedef GimpGrid from here ... * app/config/config-types.h: ... to here to be able to use it in GimpCoreConfig * app/config/gimprc-blurbs.h * app/config/gimpcoreconfig.[ch]: added default_grid member * app/widgets/gimphelp-ids.h * themes/Default/images/preferences/Makefile.am * themes/Default/images/default-grid.png * app/gui/preferences-dialog.c: added UI for specifying default image grid * app/core/gimpimage.c (gimp_image_new): create a GimpGrid from core_config->default_grid * app/gui/image-menu.c (image_menu_update): the grid/guide entries in <Image>/View/ should always be sensitive ... * app/display/gimpdisplayshell.c (gimp_display_shell_init): ... but the grid entries should be disabled by default
2003-10-10 22:11:47 +08:00
Added a per image configurable grid. This fixes bug #65198 * app/core/Makefile.am * app/core/core-types.h: * app/core/gimpgrid.[ch]: added new class GimpGrid. * app/core/core-enums.[ch]: added new enum GimpGridType. * app/core/gimpimage-guides.[ch]: removed the gimp_image_snap_*() functions... * app/core/gimpimage-snap.[ch]: ...and added them here since they are no longer guide specific. * app/core/gimpimage-undo-push.[ch]: added gimp_image_undo_push_image_grid() * app/display/gimpdisplayshell-handlers.c: * app/core/gimpimage.[ch]: added grid member to _GimpImage. Added new signal "grid_changed", added gimp_image_grid_changed(), gimp_image_get_grid() and gimp_image_set_grid(). * app/display/gimpdisplayshell-appearance.[ch]: added gimp_display_shell_set_show_grid(), gimp_display_shell_get_show_grid(), gimp_display_shell_set_snap_to_grid() and gimp_display_shell_get_snap_to_grid(). * app/display/gimpdisplayshell-callbacks.c: added call to gimp_display_shell_draw_grid() * app/display/gimpdisplayshell.[ch]: added grid member to _GimpDisplayShellVisibility, added snap_to_grid and grid_dialog members to _GimpDisplayShell, added gimp_display_shell_draw_grid(), modified gimp_display_shell_snap_coords() to use the new gimp_image_snap_*() functions. * app/gui/image-menu.c: added grid entries to image_menu_entries[]. * app/gui/view-commands.[ch]: added view_configure_grid_cmd_callback(), view_toggle_grid_cmd_callback() and view_snap_to_grid_cmd_callback(). * app/gui/Makefile.am * app/gui/grid-dialog.[ch]: added a grid dialog.
2003-06-24 03:34:48 +08:00
#include "libgimpcolor/gimpcolor.h"
#include "core-types.h"
#include "gimpgrid.h"
#include "gimp-intl.h"
enum
{
PROP_0,
PROP_STYLE,
PROP_FGCOLOR,
PROP_BGCOLOR,
Added a per image configurable grid. This fixes bug #65198 * app/core/Makefile.am * app/core/core-types.h: * app/core/gimpgrid.[ch]: added new class GimpGrid. * app/core/core-enums.[ch]: added new enum GimpGridType. * app/core/gimpimage-guides.[ch]: removed the gimp_image_snap_*() functions... * app/core/gimpimage-snap.[ch]: ...and added them here since they are no longer guide specific. * app/core/gimpimage-undo-push.[ch]: added gimp_image_undo_push_image_grid() * app/display/gimpdisplayshell-handlers.c: * app/core/gimpimage.[ch]: added grid member to _GimpImage. Added new signal "grid_changed", added gimp_image_grid_changed(), gimp_image_get_grid() and gimp_image_set_grid(). * app/display/gimpdisplayshell-appearance.[ch]: added gimp_display_shell_set_show_grid(), gimp_display_shell_get_show_grid(), gimp_display_shell_set_snap_to_grid() and gimp_display_shell_get_snap_to_grid(). * app/display/gimpdisplayshell-callbacks.c: added call to gimp_display_shell_draw_grid() * app/display/gimpdisplayshell.[ch]: added grid member to _GimpDisplayShellVisibility, added snap_to_grid and grid_dialog members to _GimpDisplayShell, added gimp_display_shell_draw_grid(), modified gimp_display_shell_snap_coords() to use the new gimp_image_snap_*() functions. * app/gui/image-menu.c: added grid entries to image_menu_entries[]. * app/gui/view-commands.[ch]: added view_configure_grid_cmd_callback(), view_toggle_grid_cmd_callback() and view_snap_to_grid_cmd_callback(). * app/gui/Makefile.am * app/gui/grid-dialog.[ch]: added a grid dialog.
2003-06-24 03:34:48 +08:00
PROP_XSPACING,
PROP_YSPACING,
PROP_SPACING_UNIT,
PROP_XOFFSET,
PROP_YOFFSET,
PROP_OFFSET_UNIT
Added a per image configurable grid. This fixes bug #65198 * app/core/Makefile.am * app/core/core-types.h: * app/core/gimpgrid.[ch]: added new class GimpGrid. * app/core/core-enums.[ch]: added new enum GimpGridType. * app/core/gimpimage-guides.[ch]: removed the gimp_image_snap_*() functions... * app/core/gimpimage-snap.[ch]: ...and added them here since they are no longer guide specific. * app/core/gimpimage-undo-push.[ch]: added gimp_image_undo_push_image_grid() * app/display/gimpdisplayshell-handlers.c: * app/core/gimpimage.[ch]: added grid member to _GimpImage. Added new signal "grid_changed", added gimp_image_grid_changed(), gimp_image_get_grid() and gimp_image_set_grid(). * app/display/gimpdisplayshell-appearance.[ch]: added gimp_display_shell_set_show_grid(), gimp_display_shell_get_show_grid(), gimp_display_shell_set_snap_to_grid() and gimp_display_shell_get_snap_to_grid(). * app/display/gimpdisplayshell-callbacks.c: added call to gimp_display_shell_draw_grid() * app/display/gimpdisplayshell.[ch]: added grid member to _GimpDisplayShellVisibility, added snap_to_grid and grid_dialog members to _GimpDisplayShell, added gimp_display_shell_draw_grid(), modified gimp_display_shell_snap_coords() to use the new gimp_image_snap_*() functions. * app/gui/image-menu.c: added grid entries to image_menu_entries[]. * app/gui/view-commands.[ch]: added view_configure_grid_cmd_callback(), view_toggle_grid_cmd_callback() and view_snap_to_grid_cmd_callback(). * app/gui/Makefile.am * app/gui/grid-dialog.[ch]: added a grid dialog.
2003-06-24 03:34:48 +08:00
};
static void gimp_grid_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_grid_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
Added a per image configurable grid. This fixes bug #65198 * app/core/Makefile.am * app/core/core-types.h: * app/core/gimpgrid.[ch]: added new class GimpGrid. * app/core/core-enums.[ch]: added new enum GimpGridType. * app/core/gimpimage-guides.[ch]: removed the gimp_image_snap_*() functions... * app/core/gimpimage-snap.[ch]: ...and added them here since they are no longer guide specific. * app/core/gimpimage-undo-push.[ch]: added gimp_image_undo_push_image_grid() * app/display/gimpdisplayshell-handlers.c: * app/core/gimpimage.[ch]: added grid member to _GimpImage. Added new signal "grid_changed", added gimp_image_grid_changed(), gimp_image_get_grid() and gimp_image_set_grid(). * app/display/gimpdisplayshell-appearance.[ch]: added gimp_display_shell_set_show_grid(), gimp_display_shell_get_show_grid(), gimp_display_shell_set_snap_to_grid() and gimp_display_shell_get_snap_to_grid(). * app/display/gimpdisplayshell-callbacks.c: added call to gimp_display_shell_draw_grid() * app/display/gimpdisplayshell.[ch]: added grid member to _GimpDisplayShellVisibility, added snap_to_grid and grid_dialog members to _GimpDisplayShell, added gimp_display_shell_draw_grid(), modified gimp_display_shell_snap_coords() to use the new gimp_image_snap_*() functions. * app/gui/image-menu.c: added grid entries to image_menu_entries[]. * app/gui/view-commands.[ch]: added view_configure_grid_cmd_callback(), view_toggle_grid_cmd_callback() and view_snap_to_grid_cmd_callback(). * app/gui/Makefile.am * app/gui/grid-dialog.[ch]: added a grid dialog.
2003-06-24 03:34:48 +08:00
G_DEFINE_TYPE_WITH_CODE (GimpGrid, gimp_grid, GIMP_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL))
Added a per image configurable grid. This fixes bug #65198 * app/core/Makefile.am * app/core/core-types.h: * app/core/gimpgrid.[ch]: added new class GimpGrid. * app/core/core-enums.[ch]: added new enum GimpGridType. * app/core/gimpimage-guides.[ch]: removed the gimp_image_snap_*() functions... * app/core/gimpimage-snap.[ch]: ...and added them here since they are no longer guide specific. * app/core/gimpimage-undo-push.[ch]: added gimp_image_undo_push_image_grid() * app/display/gimpdisplayshell-handlers.c: * app/core/gimpimage.[ch]: added grid member to _GimpImage. Added new signal "grid_changed", added gimp_image_grid_changed(), gimp_image_get_grid() and gimp_image_set_grid(). * app/display/gimpdisplayshell-appearance.[ch]: added gimp_display_shell_set_show_grid(), gimp_display_shell_get_show_grid(), gimp_display_shell_set_snap_to_grid() and gimp_display_shell_get_snap_to_grid(). * app/display/gimpdisplayshell-callbacks.c: added call to gimp_display_shell_draw_grid() * app/display/gimpdisplayshell.[ch]: added grid member to _GimpDisplayShellVisibility, added snap_to_grid and grid_dialog members to _GimpDisplayShell, added gimp_display_shell_draw_grid(), modified gimp_display_shell_snap_coords() to use the new gimp_image_snap_*() functions. * app/gui/image-menu.c: added grid entries to image_menu_entries[]. * app/gui/view-commands.[ch]: added view_configure_grid_cmd_callback(), view_toggle_grid_cmd_callback() and view_snap_to_grid_cmd_callback(). * app/gui/Makefile.am * app/gui/grid-dialog.[ch]: added a grid dialog.
2003-06-24 03:34:48 +08:00
static void
gimp_grid_class_init (GimpGridClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
Added a per image configurable grid. This fixes bug #65198 * app/core/Makefile.am * app/core/core-types.h: * app/core/gimpgrid.[ch]: added new class GimpGrid. * app/core/core-enums.[ch]: added new enum GimpGridType. * app/core/gimpimage-guides.[ch]: removed the gimp_image_snap_*() functions... * app/core/gimpimage-snap.[ch]: ...and added them here since they are no longer guide specific. * app/core/gimpimage-undo-push.[ch]: added gimp_image_undo_push_image_grid() * app/display/gimpdisplayshell-handlers.c: * app/core/gimpimage.[ch]: added grid member to _GimpImage. Added new signal "grid_changed", added gimp_image_grid_changed(), gimp_image_get_grid() and gimp_image_set_grid(). * app/display/gimpdisplayshell-appearance.[ch]: added gimp_display_shell_set_show_grid(), gimp_display_shell_get_show_grid(), gimp_display_shell_set_snap_to_grid() and gimp_display_shell_get_snap_to_grid(). * app/display/gimpdisplayshell-callbacks.c: added call to gimp_display_shell_draw_grid() * app/display/gimpdisplayshell.[ch]: added grid member to _GimpDisplayShellVisibility, added snap_to_grid and grid_dialog members to _GimpDisplayShell, added gimp_display_shell_draw_grid(), modified gimp_display_shell_snap_coords() to use the new gimp_image_snap_*() functions. * app/gui/image-menu.c: added grid entries to image_menu_entries[]. * app/gui/view-commands.[ch]: added view_configure_grid_cmd_callback(), view_toggle_grid_cmd_callback() and view_snap_to_grid_cmd_callback(). * app/gui/Makefile.am * app/gui/grid-dialog.[ch]: added a grid dialog.
2003-06-24 03:34:48 +08:00
GimpRGB black;
GimpRGB white;
object_class->get_property = gimp_grid_get_property;
object_class->set_property = gimp_grid_set_property;
gimp_rgba_set (&black, 0.0, 0.0, 0.0, GIMP_OPACITY_OPAQUE);
gimp_rgba_set (&white, 1.0, 1.0, 1.0, GIMP_OPACITY_OPAQUE);
GIMP_CONFIG_PROP_ENUM (object_class, PROP_STYLE,
"style",
_("Line style"),
_("Line style used for the grid."),
GIMP_TYPE_GRID_STYLE,
GIMP_GRID_SOLID,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_RGB (object_class, PROP_FGCOLOR,
"fgcolor",
_("Foreground color"),
_("The foreground color of the grid."),
TRUE, &black,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_RGB (object_class, PROP_BGCOLOR,
"bgcolor",
_("Background color"),
_("The background color of the grid; "
"only used in double dashed line style."),
TRUE, &white,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_XSPACING,
"xspacing",
_("Spacing X"),
_("Horizontal spacing of grid lines."),
0.0, GIMP_MAX_IMAGE_SIZE, 10.0,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_YSPACING,
"yspacing",
_("Spacing Y"),
_("Vertical spacing of grid lines."),
0.0, GIMP_MAX_IMAGE_SIZE, 10.0,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_UNIT (object_class, PROP_SPACING_UNIT,
"spacing-unit",
_("Spacing unit"),
NULL,
FALSE, FALSE, GIMP_UNIT_INCH,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_XOFFSET,
"xoffset",
_("Offset X"),
_("Horizontal offset of the first grid "
"line; this may be a negative number."),
- GIMP_MAX_IMAGE_SIZE,
GIMP_MAX_IMAGE_SIZE, 0.0,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_YOFFSET,
"yoffset",
_("Offset Y"),
_("Vertical offset of the first grid "
"line; this may be a negative number."),
- GIMP_MAX_IMAGE_SIZE,
GIMP_MAX_IMAGE_SIZE, 0.0,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_UNIT (object_class, PROP_OFFSET_UNIT,
"offset-unit",
_("Offset unit"),
NULL,
FALSE, FALSE, GIMP_UNIT_INCH,
GIMP_PARAM_STATIC_STRINGS);
Added a per image configurable grid. This fixes bug #65198 * app/core/Makefile.am * app/core/core-types.h: * app/core/gimpgrid.[ch]: added new class GimpGrid. * app/core/core-enums.[ch]: added new enum GimpGridType. * app/core/gimpimage-guides.[ch]: removed the gimp_image_snap_*() functions... * app/core/gimpimage-snap.[ch]: ...and added them here since they are no longer guide specific. * app/core/gimpimage-undo-push.[ch]: added gimp_image_undo_push_image_grid() * app/display/gimpdisplayshell-handlers.c: * app/core/gimpimage.[ch]: added grid member to _GimpImage. Added new signal "grid_changed", added gimp_image_grid_changed(), gimp_image_get_grid() and gimp_image_set_grid(). * app/display/gimpdisplayshell-appearance.[ch]: added gimp_display_shell_set_show_grid(), gimp_display_shell_get_show_grid(), gimp_display_shell_set_snap_to_grid() and gimp_display_shell_get_snap_to_grid(). * app/display/gimpdisplayshell-callbacks.c: added call to gimp_display_shell_draw_grid() * app/display/gimpdisplayshell.[ch]: added grid member to _GimpDisplayShellVisibility, added snap_to_grid and grid_dialog members to _GimpDisplayShell, added gimp_display_shell_draw_grid(), modified gimp_display_shell_snap_coords() to use the new gimp_image_snap_*() functions. * app/gui/image-menu.c: added grid entries to image_menu_entries[]. * app/gui/view-commands.[ch]: added view_configure_grid_cmd_callback(), view_toggle_grid_cmd_callback() and view_snap_to_grid_cmd_callback(). * app/gui/Makefile.am * app/gui/grid-dialog.[ch]: added a grid dialog.
2003-06-24 03:34:48 +08:00
}
static void
gimp_grid_init (GimpGrid *grid)
Added a per image configurable grid. This fixes bug #65198 * app/core/Makefile.am * app/core/core-types.h: * app/core/gimpgrid.[ch]: added new class GimpGrid. * app/core/core-enums.[ch]: added new enum GimpGridType. * app/core/gimpimage-guides.[ch]: removed the gimp_image_snap_*() functions... * app/core/gimpimage-snap.[ch]: ...and added them here since they are no longer guide specific. * app/core/gimpimage-undo-push.[ch]: added gimp_image_undo_push_image_grid() * app/display/gimpdisplayshell-handlers.c: * app/core/gimpimage.[ch]: added grid member to _GimpImage. Added new signal "grid_changed", added gimp_image_grid_changed(), gimp_image_get_grid() and gimp_image_set_grid(). * app/display/gimpdisplayshell-appearance.[ch]: added gimp_display_shell_set_show_grid(), gimp_display_shell_get_show_grid(), gimp_display_shell_set_snap_to_grid() and gimp_display_shell_get_snap_to_grid(). * app/display/gimpdisplayshell-callbacks.c: added call to gimp_display_shell_draw_grid() * app/display/gimpdisplayshell.[ch]: added grid member to _GimpDisplayShellVisibility, added snap_to_grid and grid_dialog members to _GimpDisplayShell, added gimp_display_shell_draw_grid(), modified gimp_display_shell_snap_coords() to use the new gimp_image_snap_*() functions. * app/gui/image-menu.c: added grid entries to image_menu_entries[]. * app/gui/view-commands.[ch]: added view_configure_grid_cmd_callback(), view_toggle_grid_cmd_callback() and view_snap_to_grid_cmd_callback(). * app/gui/Makefile.am * app/gui/grid-dialog.[ch]: added a grid dialog.
2003-06-24 03:34:48 +08:00
{
}
static void
gimp_grid_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpGrid *grid = GIMP_GRID (object);
switch (property_id)
{
case PROP_STYLE:
g_value_set_enum (value, grid->style);
break;
case PROP_FGCOLOR:
g_value_set_boxed (value, &grid->fgcolor);
break;
case PROP_BGCOLOR:
g_value_set_boxed (value, &grid->bgcolor);
break;
Added a per image configurable grid. This fixes bug #65198 * app/core/Makefile.am * app/core/core-types.h: * app/core/gimpgrid.[ch]: added new class GimpGrid. * app/core/core-enums.[ch]: added new enum GimpGridType. * app/core/gimpimage-guides.[ch]: removed the gimp_image_snap_*() functions... * app/core/gimpimage-snap.[ch]: ...and added them here since they are no longer guide specific. * app/core/gimpimage-undo-push.[ch]: added gimp_image_undo_push_image_grid() * app/display/gimpdisplayshell-handlers.c: * app/core/gimpimage.[ch]: added grid member to _GimpImage. Added new signal "grid_changed", added gimp_image_grid_changed(), gimp_image_get_grid() and gimp_image_set_grid(). * app/display/gimpdisplayshell-appearance.[ch]: added gimp_display_shell_set_show_grid(), gimp_display_shell_get_show_grid(), gimp_display_shell_set_snap_to_grid() and gimp_display_shell_get_snap_to_grid(). * app/display/gimpdisplayshell-callbacks.c: added call to gimp_display_shell_draw_grid() * app/display/gimpdisplayshell.[ch]: added grid member to _GimpDisplayShellVisibility, added snap_to_grid and grid_dialog members to _GimpDisplayShell, added gimp_display_shell_draw_grid(), modified gimp_display_shell_snap_coords() to use the new gimp_image_snap_*() functions. * app/gui/image-menu.c: added grid entries to image_menu_entries[]. * app/gui/view-commands.[ch]: added view_configure_grid_cmd_callback(), view_toggle_grid_cmd_callback() and view_snap_to_grid_cmd_callback(). * app/gui/Makefile.am * app/gui/grid-dialog.[ch]: added a grid dialog.
2003-06-24 03:34:48 +08:00
case PROP_XSPACING:
g_value_set_double (value, grid->xspacing);
break;
case PROP_YSPACING:
g_value_set_double (value, grid->yspacing);
break;
case PROP_SPACING_UNIT:
g_value_set_int (value, grid->spacing_unit);
break;
case PROP_XOFFSET:
g_value_set_double (value, grid->xoffset);
break;
case PROP_YOFFSET:
g_value_set_double (value, grid->yoffset);
break;
case PROP_OFFSET_UNIT:
g_value_set_int (value, grid->offset_unit);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_grid_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GimpGrid *grid = GIMP_GRID (object);
GimpRGB *color;
switch (property_id)
{
case PROP_STYLE:
grid->style = g_value_get_enum (value);
break;
case PROP_FGCOLOR:
color = g_value_get_boxed (value);
grid->fgcolor = *color;
break;
case PROP_BGCOLOR:
color = g_value_get_boxed (value);
grid->bgcolor = *color;
break;
Added a per image configurable grid. This fixes bug #65198 * app/core/Makefile.am * app/core/core-types.h: * app/core/gimpgrid.[ch]: added new class GimpGrid. * app/core/core-enums.[ch]: added new enum GimpGridType. * app/core/gimpimage-guides.[ch]: removed the gimp_image_snap_*() functions... * app/core/gimpimage-snap.[ch]: ...and added them here since they are no longer guide specific. * app/core/gimpimage-undo-push.[ch]: added gimp_image_undo_push_image_grid() * app/display/gimpdisplayshell-handlers.c: * app/core/gimpimage.[ch]: added grid member to _GimpImage. Added new signal "grid_changed", added gimp_image_grid_changed(), gimp_image_get_grid() and gimp_image_set_grid(). * app/display/gimpdisplayshell-appearance.[ch]: added gimp_display_shell_set_show_grid(), gimp_display_shell_get_show_grid(), gimp_display_shell_set_snap_to_grid() and gimp_display_shell_get_snap_to_grid(). * app/display/gimpdisplayshell-callbacks.c: added call to gimp_display_shell_draw_grid() * app/display/gimpdisplayshell.[ch]: added grid member to _GimpDisplayShellVisibility, added snap_to_grid and grid_dialog members to _GimpDisplayShell, added gimp_display_shell_draw_grid(), modified gimp_display_shell_snap_coords() to use the new gimp_image_snap_*() functions. * app/gui/image-menu.c: added grid entries to image_menu_entries[]. * app/gui/view-commands.[ch]: added view_configure_grid_cmd_callback(), view_toggle_grid_cmd_callback() and view_snap_to_grid_cmd_callback(). * app/gui/Makefile.am * app/gui/grid-dialog.[ch]: added a grid dialog.
2003-06-24 03:34:48 +08:00
case PROP_XSPACING:
grid->xspacing = g_value_get_double (value);
break;
case PROP_YSPACING:
grid->yspacing = g_value_get_double (value);
break;
case PROP_SPACING_UNIT:
grid->spacing_unit = g_value_get_int (value);
break;
case PROP_XOFFSET:
grid->xoffset = g_value_get_double (value);
break;
case PROP_YOFFSET:
grid->yoffset = g_value_get_double (value);
break;
case PROP_OFFSET_UNIT:
grid->offset_unit = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
removed the grid parasite related functions from here ... 2003-10-10 Henrik Brix Andersen <brix@gimp.org> * app/core/gimpimage-grid.[ch]: removed the grid parasite related functions from here ... * app/core/gimpgrid.[ch]: ... and added them here. While I was at it I also changed PROP_TYPE to PROP_STYLE and added blurbs to the properties * app/xcf/xcf-load.c * app/display/gimpdisplayshell.c: changed accordingly * app/widgets/Makefile.am * po/POTFILES.in * app/widgets/widgets-types.h * app/widgets/gimpgrideditor.[ch]: added a new GimpGridEditor widget - with a work-around for the fact that gimp_prop_coordinated_new() doesn't accept boundaries * app/gui/grid-dialog.h * app/gui/grid-dialog.c (grid_dialog_new): use the new GimpGridEditor widget, take a GimpImage as function parameter, assume GimpImages always have a GimpGrid. This simplifies the grid dialog. * app/gui/image-commands.c (image_configure_grid_cmd_callback): changed accordingly * app/core/core-types.h: moved typedef GimpGrid from here ... * app/config/config-types.h: ... to here to be able to use it in GimpCoreConfig * app/config/gimprc-blurbs.h * app/config/gimpcoreconfig.[ch]: added default_grid member * app/widgets/gimphelp-ids.h * themes/Default/images/preferences/Makefile.am * themes/Default/images/default-grid.png * app/gui/preferences-dialog.c: added UI for specifying default image grid * app/core/gimpimage.c (gimp_image_new): create a GimpGrid from core_config->default_grid * app/gui/image-menu.c (image_menu_update): the grid/guide entries in <Image>/View/ should always be sensitive ... * app/display/gimpdisplayshell.c (gimp_display_shell_init): ... but the grid entries should be disabled by default
2003-10-10 22:11:47 +08:00
/* public functions */
GimpGridStyle
gimp_grid_get_style (GimpGrid *grid)
{
g_return_val_if_fail (GIMP_IS_GRID (grid), GIMP_GRID_SOLID);
return grid->style;
}
void
gimp_grid_get_fgcolor (GimpGrid *grid,
GimpRGB *fgcolor)
{
g_return_if_fail (GIMP_IS_GRID (grid));
g_return_if_fail (fgcolor != NULL);
*fgcolor = grid->fgcolor;
}
void
gimp_grid_get_bgcolor (GimpGrid *grid,
GimpRGB *bgcolor)
{
g_return_if_fail (GIMP_IS_GRID (grid));
g_return_if_fail (bgcolor != NULL);
*bgcolor = grid->bgcolor;
}
void
gimp_grid_get_spacing (GimpGrid *grid,
gdouble *xspacing,
gdouble *yspacing)
{
g_return_if_fail (GIMP_IS_GRID (grid));
if (xspacing) *xspacing = grid->xspacing;
if (yspacing) *yspacing = grid->yspacing;
}
void
gimp_grid_get_offset (GimpGrid *grid,
gdouble *xoffset,
gdouble *yoffset)
{
g_return_if_fail (GIMP_IS_GRID (grid));
if (xoffset) *xoffset = grid->xoffset;
if (yoffset) *yoffset = grid->yoffset;
}
removed the grid parasite related functions from here ... 2003-10-10 Henrik Brix Andersen <brix@gimp.org> * app/core/gimpimage-grid.[ch]: removed the grid parasite related functions from here ... * app/core/gimpgrid.[ch]: ... and added them here. While I was at it I also changed PROP_TYPE to PROP_STYLE and added blurbs to the properties * app/xcf/xcf-load.c * app/display/gimpdisplayshell.c: changed accordingly * app/widgets/Makefile.am * po/POTFILES.in * app/widgets/widgets-types.h * app/widgets/gimpgrideditor.[ch]: added a new GimpGridEditor widget - with a work-around for the fact that gimp_prop_coordinated_new() doesn't accept boundaries * app/gui/grid-dialog.h * app/gui/grid-dialog.c (grid_dialog_new): use the new GimpGridEditor widget, take a GimpImage as function parameter, assume GimpImages always have a GimpGrid. This simplifies the grid dialog. * app/gui/image-commands.c (image_configure_grid_cmd_callback): changed accordingly * app/core/core-types.h: moved typedef GimpGrid from here ... * app/config/config-types.h: ... to here to be able to use it in GimpCoreConfig * app/config/gimprc-blurbs.h * app/config/gimpcoreconfig.[ch]: added default_grid member * app/widgets/gimphelp-ids.h * themes/Default/images/preferences/Makefile.am * themes/Default/images/default-grid.png * app/gui/preferences-dialog.c: added UI for specifying default image grid * app/core/gimpimage.c (gimp_image_new): create a GimpGrid from core_config->default_grid * app/gui/image-menu.c (image_menu_update): the grid/guide entries in <Image>/View/ should always be sensitive ... * app/display/gimpdisplayshell.c (gimp_display_shell_init): ... but the grid entries should be disabled by default
2003-10-10 22:11:47 +08:00
const gchar *
gimp_grid_parasite_name (void)
{
return "gimp-image-grid";
}
GimpParasite *
gimp_grid_to_parasite (GimpGrid *grid)
removed the grid parasite related functions from here ... 2003-10-10 Henrik Brix Andersen <brix@gimp.org> * app/core/gimpimage-grid.[ch]: removed the grid parasite related functions from here ... * app/core/gimpgrid.[ch]: ... and added them here. While I was at it I also changed PROP_TYPE to PROP_STYLE and added blurbs to the properties * app/xcf/xcf-load.c * app/display/gimpdisplayshell.c: changed accordingly * app/widgets/Makefile.am * po/POTFILES.in * app/widgets/widgets-types.h * app/widgets/gimpgrideditor.[ch]: added a new GimpGridEditor widget - with a work-around for the fact that gimp_prop_coordinated_new() doesn't accept boundaries * app/gui/grid-dialog.h * app/gui/grid-dialog.c (grid_dialog_new): use the new GimpGridEditor widget, take a GimpImage as function parameter, assume GimpImages always have a GimpGrid. This simplifies the grid dialog. * app/gui/image-commands.c (image_configure_grid_cmd_callback): changed accordingly * app/core/core-types.h: moved typedef GimpGrid from here ... * app/config/config-types.h: ... to here to be able to use it in GimpCoreConfig * app/config/gimprc-blurbs.h * app/config/gimpcoreconfig.[ch]: added default_grid member * app/widgets/gimphelp-ids.h * themes/Default/images/preferences/Makefile.am * themes/Default/images/default-grid.png * app/gui/preferences-dialog.c: added UI for specifying default image grid * app/core/gimpimage.c (gimp_image_new): create a GimpGrid from core_config->default_grid * app/gui/image-menu.c (image_menu_update): the grid/guide entries in <Image>/View/ should always be sensitive ... * app/display/gimpdisplayshell.c (gimp_display_shell_init): ... but the grid entries should be disabled by default
2003-10-10 22:11:47 +08:00
{
g_return_val_if_fail (GIMP_IS_GRID (grid), NULL);
return gimp_config_serialize_to_parasite (GIMP_CONFIG (grid),
gimp_grid_parasite_name (),
GIMP_PARASITE_PERSISTENT,
NULL);
removed the grid parasite related functions from here ... 2003-10-10 Henrik Brix Andersen <brix@gimp.org> * app/core/gimpimage-grid.[ch]: removed the grid parasite related functions from here ... * app/core/gimpgrid.[ch]: ... and added them here. While I was at it I also changed PROP_TYPE to PROP_STYLE and added blurbs to the properties * app/xcf/xcf-load.c * app/display/gimpdisplayshell.c: changed accordingly * app/widgets/Makefile.am * po/POTFILES.in * app/widgets/widgets-types.h * app/widgets/gimpgrideditor.[ch]: added a new GimpGridEditor widget - with a work-around for the fact that gimp_prop_coordinated_new() doesn't accept boundaries * app/gui/grid-dialog.h * app/gui/grid-dialog.c (grid_dialog_new): use the new GimpGridEditor widget, take a GimpImage as function parameter, assume GimpImages always have a GimpGrid. This simplifies the grid dialog. * app/gui/image-commands.c (image_configure_grid_cmd_callback): changed accordingly * app/core/core-types.h: moved typedef GimpGrid from here ... * app/config/config-types.h: ... to here to be able to use it in GimpCoreConfig * app/config/gimprc-blurbs.h * app/config/gimpcoreconfig.[ch]: added default_grid member * app/widgets/gimphelp-ids.h * themes/Default/images/preferences/Makefile.am * themes/Default/images/default-grid.png * app/gui/preferences-dialog.c: added UI for specifying default image grid * app/core/gimpimage.c (gimp_image_new): create a GimpGrid from core_config->default_grid * app/gui/image-menu.c (image_menu_update): the grid/guide entries in <Image>/View/ should always be sensitive ... * app/display/gimpdisplayshell.c (gimp_display_shell_init): ... but the grid entries should be disabled by default
2003-10-10 22:11:47 +08:00
}
GimpGrid *
gimp_grid_from_parasite (const GimpParasite *parasite)
{
GimpGrid *grid;
GError *error = NULL;
removed the grid parasite related functions from here ... 2003-10-10 Henrik Brix Andersen <brix@gimp.org> * app/core/gimpimage-grid.[ch]: removed the grid parasite related functions from here ... * app/core/gimpgrid.[ch]: ... and added them here. While I was at it I also changed PROP_TYPE to PROP_STYLE and added blurbs to the properties * app/xcf/xcf-load.c * app/display/gimpdisplayshell.c: changed accordingly * app/widgets/Makefile.am * po/POTFILES.in * app/widgets/widgets-types.h * app/widgets/gimpgrideditor.[ch]: added a new GimpGridEditor widget - with a work-around for the fact that gimp_prop_coordinated_new() doesn't accept boundaries * app/gui/grid-dialog.h * app/gui/grid-dialog.c (grid_dialog_new): use the new GimpGridEditor widget, take a GimpImage as function parameter, assume GimpImages always have a GimpGrid. This simplifies the grid dialog. * app/gui/image-commands.c (image_configure_grid_cmd_callback): changed accordingly * app/core/core-types.h: moved typedef GimpGrid from here ... * app/config/config-types.h: ... to here to be able to use it in GimpCoreConfig * app/config/gimprc-blurbs.h * app/config/gimpcoreconfig.[ch]: added default_grid member * app/widgets/gimphelp-ids.h * themes/Default/images/preferences/Makefile.am * themes/Default/images/default-grid.png * app/gui/preferences-dialog.c: added UI for specifying default image grid * app/core/gimpimage.c (gimp_image_new): create a GimpGrid from core_config->default_grid * app/gui/image-menu.c (image_menu_update): the grid/guide entries in <Image>/View/ should always be sensitive ... * app/display/gimpdisplayshell.c (gimp_display_shell_init): ... but the grid entries should be disabled by default
2003-10-10 22:11:47 +08:00
g_return_val_if_fail (parasite != NULL, NULL);
g_return_val_if_fail (strcmp (gimp_parasite_name (parasite),
gimp_grid_parasite_name ()) == 0, NULL);
if (! gimp_parasite_data (parasite))
{
g_warning ("Empty grid parasite");
return NULL;
}
removed the grid parasite related functions from here ... 2003-10-10 Henrik Brix Andersen <brix@gimp.org> * app/core/gimpimage-grid.[ch]: removed the grid parasite related functions from here ... * app/core/gimpgrid.[ch]: ... and added them here. While I was at it I also changed PROP_TYPE to PROP_STYLE and added blurbs to the properties * app/xcf/xcf-load.c * app/display/gimpdisplayshell.c: changed accordingly * app/widgets/Makefile.am * po/POTFILES.in * app/widgets/widgets-types.h * app/widgets/gimpgrideditor.[ch]: added a new GimpGridEditor widget - with a work-around for the fact that gimp_prop_coordinated_new() doesn't accept boundaries * app/gui/grid-dialog.h * app/gui/grid-dialog.c (grid_dialog_new): use the new GimpGridEditor widget, take a GimpImage as function parameter, assume GimpImages always have a GimpGrid. This simplifies the grid dialog. * app/gui/image-commands.c (image_configure_grid_cmd_callback): changed accordingly * app/core/core-types.h: moved typedef GimpGrid from here ... * app/config/config-types.h: ... to here to be able to use it in GimpCoreConfig * app/config/gimprc-blurbs.h * app/config/gimpcoreconfig.[ch]: added default_grid member * app/widgets/gimphelp-ids.h * themes/Default/images/preferences/Makefile.am * themes/Default/images/default-grid.png * app/gui/preferences-dialog.c: added UI for specifying default image grid * app/core/gimpimage.c (gimp_image_new): create a GimpGrid from core_config->default_grid * app/gui/image-menu.c (image_menu_update): the grid/guide entries in <Image>/View/ should always be sensitive ... * app/display/gimpdisplayshell.c (gimp_display_shell_init): ... but the grid entries should be disabled by default
2003-10-10 22:11:47 +08:00
grid = g_object_new (GIMP_TYPE_GRID, NULL);
if (! gimp_config_deserialize_parasite (GIMP_CONFIG (grid),
parasite,
NULL,
&error))
removed the grid parasite related functions from here ... 2003-10-10 Henrik Brix Andersen <brix@gimp.org> * app/core/gimpimage-grid.[ch]: removed the grid parasite related functions from here ... * app/core/gimpgrid.[ch]: ... and added them here. While I was at it I also changed PROP_TYPE to PROP_STYLE and added blurbs to the properties * app/xcf/xcf-load.c * app/display/gimpdisplayshell.c: changed accordingly * app/widgets/Makefile.am * po/POTFILES.in * app/widgets/widgets-types.h * app/widgets/gimpgrideditor.[ch]: added a new GimpGridEditor widget - with a work-around for the fact that gimp_prop_coordinated_new() doesn't accept boundaries * app/gui/grid-dialog.h * app/gui/grid-dialog.c (grid_dialog_new): use the new GimpGridEditor widget, take a GimpImage as function parameter, assume GimpImages always have a GimpGrid. This simplifies the grid dialog. * app/gui/image-commands.c (image_configure_grid_cmd_callback): changed accordingly * app/core/core-types.h: moved typedef GimpGrid from here ... * app/config/config-types.h: ... to here to be able to use it in GimpCoreConfig * app/config/gimprc-blurbs.h * app/config/gimpcoreconfig.[ch]: added default_grid member * app/widgets/gimphelp-ids.h * themes/Default/images/preferences/Makefile.am * themes/Default/images/default-grid.png * app/gui/preferences-dialog.c: added UI for specifying default image grid * app/core/gimpimage.c (gimp_image_new): create a GimpGrid from core_config->default_grid * app/gui/image-menu.c (image_menu_update): the grid/guide entries in <Image>/View/ should always be sensitive ... * app/display/gimpdisplayshell.c (gimp_display_shell_init): ... but the grid entries should be disabled by default
2003-10-10 22:11:47 +08:00
{
g_warning ("Failed to deserialize grid parasite: %s", error->message);
g_error_free (error);
}
return grid;
}