/* The GIMP -- an image manipulation program * Copyright (C) 1995-1999 Spencer Kimball and Peter Mattis * * gimpfilloptions.c * Copyright (C) 2003 Simon Budig * * 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 3 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, see . */ #include "config.h" #include #include "libgimpbase/gimpbase.h" #include "libgimpconfig/gimpconfig.h" #include "core-types.h" #include "gimp.h" #include "gimpfilloptions.h" #include "gimpviewable.h" enum { PROP_0, PROP_STYLE, PROP_ANTIALIAS, PROP_PATTERN_VIEW_TYPE, PROP_PATTERN_VIEW_SIZE }; static void gimp_fill_options_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void gimp_fill_options_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); G_DEFINE_TYPE (GimpFillOptions, gimp_fill_options, GIMP_TYPE_CONTEXT) static void gimp_fill_options_class_init (GimpFillOptionsClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->set_property = gimp_fill_options_set_property; object_class->get_property = gimp_fill_options_get_property; GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_STYLE, "style", NULL, GIMP_TYPE_FILL_STYLE, GIMP_FILL_STYLE_SOLID, GIMP_PARAM_STATIC_STRINGS); GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_ANTIALIAS, "antialias", NULL, TRUE, GIMP_PARAM_STATIC_STRINGS); g_object_class_install_property (object_class, PROP_PATTERN_VIEW_TYPE, g_param_spec_enum ("pattern-view-type", NULL, NULL, GIMP_TYPE_VIEW_TYPE, GIMP_VIEW_TYPE_GRID, G_PARAM_CONSTRUCT | GIMP_PARAM_READWRITE)); g_object_class_install_property (object_class, PROP_PATTERN_VIEW_SIZE, g_param_spec_int ("pattern-view-size", NULL, NULL, GIMP_VIEW_SIZE_TINY, GIMP_VIEWABLE_MAX_BUTTON_SIZE, GIMP_VIEW_SIZE_SMALL, G_PARAM_CONSTRUCT | GIMP_PARAM_READWRITE)); } static void gimp_fill_options_init (GimpFillOptions *options) { } static void gimp_fill_options_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { GimpFillOptions *options = GIMP_FILL_OPTIONS (object); switch (property_id) { case PROP_STYLE: options->style = g_value_get_enum (value); break; case PROP_ANTIALIAS: options->antialias = g_value_get_boolean (value); break; case PROP_PATTERN_VIEW_TYPE: options->pattern_view_type = g_value_get_enum (value); break; case PROP_PATTERN_VIEW_SIZE: options->pattern_view_size = g_value_get_int (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void gimp_fill_options_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { GimpFillOptions *options = GIMP_FILL_OPTIONS (object); switch (property_id) { case PROP_STYLE: g_value_set_enum (value, options->style); break; case PROP_ANTIALIAS: g_value_set_boolean (value, options->antialias); break; case PROP_PATTERN_VIEW_TYPE: g_value_set_enum (value, options->pattern_view_type); break; case PROP_PATTERN_VIEW_SIZE: g_value_set_int (value, options->pattern_view_size); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } /* public functions */ GimpFillOptions * gimp_fill_options_new (Gimp *gimp) { g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); return g_object_new (GIMP_TYPE_FILL_OPTIONS, "gimp", gimp, NULL); }