gimp r25724 - in trunk: . app app/core app/gegl app/tools
- From: mitch svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r25724 - in trunk: . app app/core app/gegl app/tools
- Date: Tue, 20 May 2008 21:41:47 +0000 (UTC)
Author: mitch
Date: Tue May 20 21:41:47 2008
New Revision: 25724
URL: http://svn.gnome.org/viewvc/gimp?rev=25724&view=rev
Log:
2008-05-20 Michael Natterer <mitch gimp org>
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpimagemapconfig.[ch]: new GimpViewable subclass
which has a "time" property. Sets the object's name to a date
string if a time != 0 gets set. Has a compare function which first
sorts the objects with a timestamp in MRU order and then the
objects without timestamp by name.
* app/gegl/gimpbrightnesscontrastconfig.[ch]
* app/gegl/gimpcolorbalanceconfig.[ch]
* app/gegl/gimpcolorizeconfig.[ch]
* app/gegl/gimpcurvesconfig.[ch]
* app/gegl/gimphuesaturationconfig.[ch]
* app/gegl/gimplevelsconfig.[ch]
* app/gegl/gimpposterizeconfig.[ch]
* app/gegl/gimpthresholdconfig.[ch]: derive from GimpImageMapConfig.
* app/tools/gimpimagemaptool.c: sort the settings container with
above compare function.
* app/tools/gimpimagemaptool-settings.c: add utility functions
for loading and saving the settings container. In the settings
combo, add a separator between MRU items and favorites.
* app/Makefile.am: make the thing link.
Added:
trunk/app/core/gimpimagemapconfig.c
trunk/app/core/gimpimagemapconfig.h
Modified:
trunk/ChangeLog
trunk/app/Makefile.am
trunk/app/core/Makefile.am
trunk/app/core/core-types.h
trunk/app/gegl/gimpbrightnesscontrastconfig.c
trunk/app/gegl/gimpbrightnesscontrastconfig.h
trunk/app/gegl/gimpcolorbalanceconfig.c
trunk/app/gegl/gimpcolorbalanceconfig.h
trunk/app/gegl/gimpcolorizeconfig.c
trunk/app/gegl/gimpcolorizeconfig.h
trunk/app/gegl/gimpcurvesconfig.c
trunk/app/gegl/gimpcurvesconfig.h
trunk/app/gegl/gimphuesaturationconfig.c
trunk/app/gegl/gimphuesaturationconfig.h
trunk/app/gegl/gimplevelsconfig.c
trunk/app/gegl/gimplevelsconfig.h
trunk/app/gegl/gimpposterizeconfig.c
trunk/app/gegl/gimpposterizeconfig.h
trunk/app/gegl/gimpthresholdconfig.c
trunk/app/gegl/gimpthresholdconfig.h
trunk/app/tools/gimpimagemaptool-settings.c
trunk/app/tools/gimpimagemaptool.c
Modified: trunk/app/Makefile.am
==============================================================================
--- trunk/app/Makefile.am (original)
+++ trunk/app/Makefile.am Tue May 20 21:41:47 2008
@@ -91,12 +91,13 @@
-I$(includedir)
AM_LDFLAGS = \
- $(munix) \
- $(CARBON_LDFLAGS) \
- -u $(SYMPREFIX)xcf_init \
- -u $(SYMPREFIX)internal_procs_init \
- -u $(SYMPREFIX)gimp_coords_mix \
- -u $(SYMPREFIX)gimp_curve_map_pixels \
+ $(munix) \
+ $(CARBON_LDFLAGS) \
+ -u $(SYMPREFIX)xcf_init \
+ -u $(SYMPREFIX)internal_procs_init \
+ -u $(SYMPREFIX)gimp_coords_mix \
+ -u $(SYMPREFIX)gimp_curve_map_pixels \
+ -u $(SYMPREFIX)gimp_image_map_config_get_type \
-u $(SYMPREFIX)gimp_plug_in_manager_restore
gimp_2_5_LDFLAGS = $(AM_LDFLAGS) $(mwindows)
Modified: trunk/app/core/Makefile.am
==============================================================================
--- trunk/app/core/Makefile.am (original)
+++ trunk/app/core/Makefile.am Tue May 20 21:41:47 2008
@@ -227,6 +227,8 @@
gimpimagefile.h \
gimpimagemap.c \
gimpimagemap.h \
+ gimpimagemapconfig.c \
+ gimpimagemapconfig.h \
gimpitem.c \
gimpitem.h \
gimpitem-linked.c \
Modified: trunk/app/core/core-types.h
==============================================================================
--- trunk/app/core/core-types.h (original)
+++ trunk/app/core/core-types.h Tue May 20 21:41:47 2008
@@ -137,6 +137,7 @@
typedef struct _GimpGuide GimpGuide;
typedef struct _GimpImagefile GimpImagefile;
typedef struct _GimpImageMap GimpImageMap;
+typedef struct _GimpImageMapConfig GimpImageMapConfig;
typedef struct _GimpInterpreterDB GimpInterpreterDB;
typedef struct _GimpParasiteList GimpParasiteList;
typedef struct _GimpPdbProgress GimpPdbProgress;
Added: trunk/app/core/gimpimagemapconfig.c
==============================================================================
--- (empty file)
+++ trunk/app/core/gimpimagemapconfig.c Tue May 20 21:41:47 2008
@@ -0,0 +1,169 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpimagemapconfig.c
+ * Copyright (C) 2008 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 <string.h>
+
+#include <glib-object.h>
+
+#include "libgimpconfig/gimpconfig.h"
+
+#include "core-types.h"
+
+#include "gimpimagemapconfig.h"
+
+
+enum
+{
+ PROP_0,
+ PROP_TIME
+};
+
+
+static void gimp_image_map_config_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void gimp_image_map_config_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+
+
+G_DEFINE_TYPE (GimpImageMapConfig, gimp_image_map_config,
+ GIMP_TYPE_VIEWABLE)
+
+#define parent_class gimp_image_map_config_parent_class
+
+
+static void
+gimp_image_map_config_class_init (GimpImageMapConfigClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->set_property = gimp_image_map_config_set_property;
+ object_class->get_property = gimp_image_map_config_get_property;
+
+ GIMP_CONFIG_INSTALL_PROP_UINT (object_class, PROP_TIME,
+ "time",
+ "Time of settings creation",
+ 0, G_MAXUINT, 0, 0);
+}
+
+static void
+gimp_image_map_config_init (GimpImageMapConfig *config)
+{
+}
+
+static void
+gimp_image_map_config_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GimpImageMapConfig *config = GIMP_IMAGE_MAP_CONFIG (object);
+
+ switch (property_id)
+ {
+ case PROP_TIME:
+ g_value_set_uint (value, config->time);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_image_map_config_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GimpImageMapConfig *config = GIMP_IMAGE_MAP_CONFIG (object);
+
+ switch (property_id)
+ {
+ case PROP_TIME:
+ config->time = g_value_get_uint (value);
+
+ if (config->time > 0)
+ {
+ time_t t;
+ struct tm tm;
+ gchar buf[64];
+ gchar *name;
+
+ t = config->time;
+ tm = *localtime (&t);
+ strftime (buf, sizeof (buf), "%Y-%m-%d %T", &tm);
+
+ name = g_locale_to_utf8 (buf, -1, NULL, NULL, NULL);
+ gimp_object_set_name (GIMP_OBJECT (config), name);
+ g_free (name);
+ }
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+
+/* public functions */
+
+gint
+gimp_image_map_config_compare (GimpImageMapConfig *a,
+ GimpImageMapConfig *b)
+{
+ const gchar *name_a = gimp_object_get_name (GIMP_OBJECT (a));
+ const gchar *name_b = gimp_object_get_name (GIMP_OBJECT (b));
+
+ if (a->time > 0 && b->time > 0)
+ {
+ return - strcmp (name_a, name_b);
+ }
+ else if (a->time > 0)
+ {
+ return -1;
+ }
+ else if (b->time)
+ {
+ return 1;
+ }
+ else if (name_a && name_b)
+ {
+ return strcmp (name_a, name_b);
+ }
+ else if (name_a)
+ {
+ return 1;
+ }
+ else if (name_b)
+ {
+ return -1;
+ }
+
+ return 0;
+}
Added: trunk/app/core/gimpimagemapconfig.h
==============================================================================
--- (empty file)
+++ trunk/app/core/gimpimagemapconfig.h Tue May 20 21:41:47 2008
@@ -0,0 +1,58 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpimagemapconfig.h
+ * Copyright (C) 2008 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_IMAGE_MAP_CONFIG_H__
+#define __GIMP_IMAGE_MAP_CONFIG_H__
+
+
+#include "gimpviewable.h"
+
+
+#define GIMP_TYPE_IMAGE_MAP_CONFIG (gimp_image_map_config_get_type ())
+#define GIMP_IMAGE_MAP_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_IMAGE_MAP_CONFIG, GimpImageMapConfig))
+#define GIMP_IMAGE_MAP_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_IMAGE_MAP_CONFIG, GimpImageMapConfigClass))
+#define GIMP_IS_IMAGE_MAP_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_IMAGE_MAP_CONFIG))
+#define GIMP_IS_IMAGE_MAP_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_IMAGE_MAP_CONFIG))
+#define GIMP_IMAGE_MAP_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_IMAGE_MAP_CONFIG, GimpImageMapConfigClass))
+
+
+typedef struct _GimpImageMapConfigClass GimpImageMapConfigClass;
+
+struct _GimpImageMapConfig
+{
+ GimpViewable parent_instance;
+
+ guint time;
+};
+
+struct _GimpImageMapConfigClass
+{
+ GimpViewableClass parent_class;
+};
+
+
+GType gimp_image_map_config_get_type (void) G_GNUC_CONST;
+
+gint gimp_image_map_config_compare (GimpImageMapConfig *a,
+ GimpImageMapConfig *b);
+
+
+#endif /* __GIMP_IMAGE_MAP_CONFIG_H__ */
Modified: trunk/app/gegl/gimpbrightnesscontrastconfig.c
==============================================================================
--- trunk/app/gegl/gimpbrightnesscontrastconfig.c (original)
+++ trunk/app/gegl/gimpbrightnesscontrastconfig.c Tue May 20 21:41:47 2008
@@ -52,7 +52,7 @@
G_DEFINE_TYPE_WITH_CODE (GimpBrightnessContrastConfig,
gimp_brightness_contrast_config,
- GIMP_TYPE_VIEWABLE,
+ GIMP_TYPE_IMAGE_MAP_CONFIG,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL))
#define parent_class gimp_brightness_contrast_config_parent_class
Modified: trunk/app/gegl/gimpbrightnesscontrastconfig.h
==============================================================================
--- trunk/app/gegl/gimpbrightnesscontrastconfig.h (original)
+++ trunk/app/gegl/gimpbrightnesscontrastconfig.h Tue May 20 21:41:47 2008
@@ -23,7 +23,7 @@
#define __GIMP_BRIGHTNESS_CONTRAST_CONFIG_H__
-#include "core/gimpviewable.h"
+#include "core/gimpimagemapconfig.h"
#define GIMP_TYPE_BRIGHTNESS_CONTRAST_CONFIG (gimp_brightness_contrast_config_get_type ())
@@ -38,15 +38,15 @@
struct _GimpBrightnessContrastConfig
{
- GimpViewable parent_instance;
+ GimpImageMapConfig parent_instance;
- gdouble brightness;
- gdouble contrast;
+ gdouble brightness;
+ gdouble contrast;
};
struct _GimpBrightnessContrastConfigClass
{
- GimpViewableClass parent_class;
+ GimpImageMapConfigClass parent_class;
};
Modified: trunk/app/gegl/gimpcolorbalanceconfig.c
==============================================================================
--- trunk/app/gegl/gimpcolorbalanceconfig.c (original)
+++ trunk/app/gegl/gimpcolorbalanceconfig.c Tue May 20 21:41:47 2008
@@ -73,7 +73,7 @@
G_DEFINE_TYPE_WITH_CODE (GimpColorBalanceConfig, gimp_color_balance_config,
- GIMP_TYPE_VIEWABLE,
+ GIMP_TYPE_IMAGE_MAP_CONFIG,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
gimp_color_balance_config_iface_init))
Modified: trunk/app/gegl/gimpcolorbalanceconfig.h
==============================================================================
--- trunk/app/gegl/gimpcolorbalanceconfig.h (original)
+++ trunk/app/gegl/gimpcolorbalanceconfig.h Tue May 20 21:41:47 2008
@@ -23,7 +23,7 @@
#define __GIMP_COLOR_BALANCE_CONFIG_H__
-#include "core/gimpviewable.h"
+#include "core/gimpimagemapconfig.h"
#define GIMP_TYPE_COLOR_BALANCE_CONFIG (gimp_color_balance_config_get_type ())
@@ -38,20 +38,20 @@
struct _GimpColorBalanceConfig
{
- GimpViewable parent_instance;
+ GimpImageMapConfig parent_instance;
- GimpTransferMode range;
+ GimpTransferMode range;
- gdouble cyan_red[3];
- gdouble magenta_green[3];
- gdouble yellow_blue[3];
+ gdouble cyan_red[3];
+ gdouble magenta_green[3];
+ gdouble yellow_blue[3];
- gboolean preserve_luminosity;
+ gboolean preserve_luminosity;
};
struct _GimpColorBalanceConfigClass
{
- GimpViewableClass parent_class;
+ GimpImageMapConfigClass parent_class;
};
Modified: trunk/app/gegl/gimpcolorizeconfig.c
==============================================================================
--- trunk/app/gegl/gimpcolorizeconfig.c (original)
+++ trunk/app/gegl/gimpcolorizeconfig.c Tue May 20 21:41:47 2008
@@ -53,7 +53,7 @@
G_DEFINE_TYPE_WITH_CODE (GimpColorizeConfig, gimp_colorize_config,
- GIMP_TYPE_VIEWABLE,
+ GIMP_TYPE_IMAGE_MAP_CONFIG,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL))
#define parent_class gimp_colorize_config_parent_class
Modified: trunk/app/gegl/gimpcolorizeconfig.h
==============================================================================
--- trunk/app/gegl/gimpcolorizeconfig.h (original)
+++ trunk/app/gegl/gimpcolorizeconfig.h Tue May 20 21:41:47 2008
@@ -23,7 +23,7 @@
#define __GIMP_COLORIZE_CONFIG_H__
-#include "core/gimpviewable.h"
+#include "core/gimpimagemapconfig.h"
#define GIMP_TYPE_COLORIZE_CONFIG (gimp_colorize_config_get_type ())
@@ -38,16 +38,16 @@
struct _GimpColorizeConfig
{
- GimpViewable parent_instance;
+ GimpImageMapConfig parent_instance;
- gdouble hue;
- gdouble saturation;
- gdouble lightness;
+ gdouble hue;
+ gdouble saturation;
+ gdouble lightness;
};
struct _GimpColorizeConfigClass
{
- GimpViewableClass parent_class;
+ GimpImageMapConfigClass parent_class;
};
Modified: trunk/app/gegl/gimpcurvesconfig.c
==============================================================================
--- trunk/app/gegl/gimpcurvesconfig.c (original)
+++ trunk/app/gegl/gimpcurvesconfig.c Tue May 20 21:41:47 2008
@@ -83,7 +83,7 @@
G_DEFINE_TYPE_WITH_CODE (GimpCurvesConfig, gimp_curves_config,
- GIMP_TYPE_VIEWABLE,
+ GIMP_TYPE_IMAGE_MAP_CONFIG,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
gimp_curves_config_iface_init))
Modified: trunk/app/gegl/gimpcurvesconfig.h
==============================================================================
--- trunk/app/gegl/gimpcurvesconfig.h (original)
+++ trunk/app/gegl/gimpcurvesconfig.h Tue May 20 21:41:47 2008
@@ -23,7 +23,7 @@
#define __GIMP_CURVES_CONFIG_H__
-#include "core/gimpviewable.h"
+#include "core/gimpimagemapconfig.h"
#define GIMP_TYPE_CURVES_CONFIG (gimp_curves_config_get_type ())
@@ -38,7 +38,7 @@
struct _GimpCurvesConfig
{
- GimpViewable parent_instance;
+ GimpImageMapConfig parent_instance;
GimpHistogramChannel channel;
@@ -47,7 +47,7 @@
struct _GimpCurvesConfigClass
{
- GimpViewableClass parent_class;
+ GimpImageMapConfigClass parent_class;
};
Modified: trunk/app/gegl/gimphuesaturationconfig.c
==============================================================================
--- trunk/app/gegl/gimphuesaturationconfig.c (original)
+++ trunk/app/gegl/gimphuesaturationconfig.c Tue May 20 21:41:47 2008
@@ -71,7 +71,7 @@
G_DEFINE_TYPE_WITH_CODE (GimpHueSaturationConfig, gimp_hue_saturation_config,
- GIMP_TYPE_VIEWABLE,
+ GIMP_TYPE_IMAGE_MAP_CONFIG,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
gimp_hue_saturation_config_iface_init))
Modified: trunk/app/gegl/gimphuesaturationconfig.h
==============================================================================
--- trunk/app/gegl/gimphuesaturationconfig.h (original)
+++ trunk/app/gegl/gimphuesaturationconfig.h Tue May 20 21:41:47 2008
@@ -23,7 +23,7 @@
#define __GIMP_HUE_SATURATION_CONFIG_H__
-#include "core/gimpviewable.h"
+#include "core/gimpimagemapconfig.h"
#define GIMP_TYPE_HUE_SATURATION_CONFIG (gimp_hue_saturation_config_get_type ())
@@ -38,20 +38,20 @@
struct _GimpHueSaturationConfig
{
- GimpViewable parent_instance;
+ GimpImageMapConfig parent_instance;
- GimpHueRange range;
+ GimpHueRange range;
- gdouble hue[7];
- gdouble saturation[7];
- gdouble lightness[7];
+ gdouble hue[7];
+ gdouble saturation[7];
+ gdouble lightness[7];
- gdouble overlap;
+ gdouble overlap;
};
struct _GimpHueSaturationConfigClass
{
- GimpViewableClass parent_class;
+ GimpImageMapConfigClass parent_class;
};
Modified: trunk/app/gegl/gimplevelsconfig.c
==============================================================================
--- trunk/app/gegl/gimplevelsconfig.c (original)
+++ trunk/app/gegl/gimplevelsconfig.c Tue May 20 21:41:47 2008
@@ -85,7 +85,7 @@
G_DEFINE_TYPE_WITH_CODE (GimpLevelsConfig, gimp_levels_config,
- GIMP_TYPE_VIEWABLE,
+ GIMP_TYPE_IMAGE_MAP_CONFIG,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
gimp_levels_config_iface_init))
Modified: trunk/app/gegl/gimplevelsconfig.h
==============================================================================
--- trunk/app/gegl/gimplevelsconfig.h (original)
+++ trunk/app/gegl/gimplevelsconfig.h Tue May 20 21:41:47 2008
@@ -23,7 +23,7 @@
#define __GIMP_LEVELS_CONFIG_H__
-#include "core/gimpviewable.h"
+#include "core/gimpimagemapconfig.h"
#define GIMP_TYPE_LEVELS_CONFIG (gimp_levels_config_get_type ())
@@ -38,7 +38,7 @@
struct _GimpLevelsConfig
{
- GimpViewable parent_instance;
+ GimpImageMapConfig parent_instance;
GimpHistogramChannel channel;
@@ -53,7 +53,7 @@
struct _GimpLevelsConfigClass
{
- GimpViewableClass parent_class;
+ GimpImageMapConfigClass parent_class;
};
Modified: trunk/app/gegl/gimpposterizeconfig.c
==============================================================================
--- trunk/app/gegl/gimpposterizeconfig.c (original)
+++ trunk/app/gegl/gimpposterizeconfig.c Tue May 20 21:41:47 2008
@@ -48,7 +48,7 @@
G_DEFINE_TYPE_WITH_CODE (GimpPosterizeConfig, gimp_posterize_config,
- GIMP_TYPE_VIEWABLE,
+ GIMP_TYPE_IMAGE_MAP_CONFIG,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL))
#define parent_class gimp_posterize_config_parent_class
Modified: trunk/app/gegl/gimpposterizeconfig.h
==============================================================================
--- trunk/app/gegl/gimpposterizeconfig.h (original)
+++ trunk/app/gegl/gimpposterizeconfig.h Tue May 20 21:41:47 2008
@@ -23,7 +23,7 @@
#define __GIMP_POSTERIZE_CONFIG_H__
-#include "core/gimpviewable.h"
+#include "core/gimpimagemapconfig.h"
#define GIMP_TYPE_POSTERIZE_CONFIG (gimp_posterize_config_get_type ())
@@ -38,14 +38,14 @@
struct _GimpPosterizeConfig
{
- GimpViewable parent_instance;
+ GimpImageMapConfig parent_instance;
- gint levels;
+ gint levels;
};
struct _GimpPosterizeConfigClass
{
- GimpViewableClass parent_class;
+ GimpImageMapConfigClass parent_class;
};
Modified: trunk/app/gegl/gimpthresholdconfig.c
==============================================================================
--- trunk/app/gegl/gimpthresholdconfig.c (original)
+++ trunk/app/gegl/gimpthresholdconfig.c Tue May 20 21:41:47 2008
@@ -52,7 +52,7 @@
G_DEFINE_TYPE_WITH_CODE (GimpThresholdConfig, gimp_threshold_config,
- GIMP_TYPE_VIEWABLE,
+ GIMP_TYPE_IMAGE_MAP_CONFIG,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL))
#define parent_class gimp_threshold_config_parent_class
Modified: trunk/app/gegl/gimpthresholdconfig.h
==============================================================================
--- trunk/app/gegl/gimpthresholdconfig.h (original)
+++ trunk/app/gegl/gimpthresholdconfig.h Tue May 20 21:41:47 2008
@@ -23,7 +23,7 @@
#define __GIMP_THRESHOLD_CONFIG_H__
-#include "core/gimpviewable.h"
+#include "core/gimpimagemapconfig.h"
#define GIMP_TYPE_THRESHOLD_CONFIG (gimp_threshold_config_get_type ())
@@ -38,15 +38,15 @@
struct _GimpThresholdConfig
{
- GimpViewable parent_instance;
+ GimpImageMapConfig parent_instance;
- gdouble low;
- gdouble high;
+ gdouble low;
+ gdouble high;
};
struct _GimpThresholdConfigClass
{
- GimpViewableClass parent_class;
+ GimpImageMapConfigClass parent_class;
};
Modified: trunk/app/tools/gimpimagemaptool-settings.c
==============================================================================
--- trunk/app/tools/gimpimagemaptool-settings.c (original)
+++ trunk/app/tools/gimpimagemaptool-settings.c Tue May 20 21:41:47 2008
@@ -34,6 +34,7 @@
#include "core/gimp.h"
#include "core/gimpcontext.h"
+#include "core/gimpimagemapconfig.h"
#include "core/gimplist.h"
#include "core/gimptoolinfo.h"
@@ -49,6 +50,13 @@
/* local function prototypes */
+static void gimp_image_map_tool_recent_deserialize (GimpImageMapTool *im_tool);
+static void gimp_image_map_tool_recent_serialize (GimpImageMapTool *im_tool);
+
+static gboolean
+ gimp_image_map_tool_row_separator_func (GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer data);
static void gimp_image_map_tool_recent_selected (GimpContainerView *view,
GimpViewable *object,
gpointer insert_data,
@@ -91,31 +99,7 @@
tool_info = GIMP_TOOL (image_map_tool)->tool_info;
if (gimp_container_num_children (klass->recent_settings) == 0)
- {
- gchar *filename;
- GError *error = NULL;
-
- filename = gimp_tool_info_build_options_filename (tool_info,
- ".settings");
-
- if (tool_info->gimp->be_verbose)
- g_print ("Parsing '%s'\n", gimp_filename_to_utf8 (filename));
-
- if (! gimp_config_deserialize_file (GIMP_CONFIG (klass->recent_settings),
- filename,
- NULL, &error))
- {
- if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
- gimp_message (tool_info->gimp, NULL, GIMP_MESSAGE_ERROR,
- "%s", error->message);
-
- g_clear_error (&error);
- }
-
- gimp_list_reverse (GIMP_LIST (klass->recent_settings));
-
- g_free (filename);
- }
+ gimp_image_map_tool_recent_deserialize (image_map_tool);
hbox = gtk_hbox_new (FALSE, 4);
gtk_box_pack_start (GTK_BOX (image_map_tool->main_vbox), hbox,
@@ -129,6 +113,9 @@
combo = gimp_container_combo_box_new (klass->recent_settings,
GIMP_CONTEXT (tool_info->tool_options),
16, 0);
+ gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (combo),
+ gimp_image_map_tool_row_separator_func,
+ NULL, NULL);
gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0);
gtk_widget_show (combo);
@@ -195,17 +182,10 @@
void
gimp_image_map_tool_add_recent_settings (GimpImageMapTool *image_map_tool)
{
- GimpTool *tool = GIMP_TOOL (image_map_tool);
GimpContainer *recent;
GimpConfig *current;
GimpConfig *config = NULL;
GList *list;
- time_t now;
- struct tm tm;
- gchar buf[64];
- gchar *name;
- gchar *filename;
- GError *error = NULL;
recent = GIMP_IMAGE_MAP_TOOL_GET_CLASS (image_map_tool)->recent_settings;
current = GIMP_CONFIG (image_map_tool->config);
@@ -214,48 +194,29 @@
{
config = list->data;
- if (gimp_config_is_equal_to (config, current))
+ if (GIMP_IMAGE_MAP_CONFIG (config)->time > 0 &&
+ gimp_config_is_equal_to (config, current))
{
- gimp_container_reorder (recent, GIMP_OBJECT (config), 0);
+ g_object_set (current,
+ "time", (guint) time (NULL),
+ NULL);
break;
}
-
- config = NULL;
}
- if (! config)
+ if (! list)
{
config = gimp_config_duplicate (current);
+ g_object_set (config,
+ "time", (guint) time (NULL),
+ NULL);
+
gimp_container_insert (recent, GIMP_OBJECT (config), 0);
g_object_unref (config);
}
- now = time (NULL);
- tm = *localtime (&now);
- strftime (buf, sizeof (buf), "%Y-%m-%d %T", &tm);
- name = g_locale_to_utf8 (buf, -1, NULL, NULL, NULL);
- gimp_object_set_name (GIMP_OBJECT (config), name);
- g_free (name);
-
- filename = gimp_tool_info_build_options_filename (tool->tool_info,
- ".settings");
-
- if (tool->tool_info->gimp->be_verbose)
- g_print ("Writing '%s'\n", gimp_filename_to_utf8 (filename));
-
- if (! gimp_config_serialize_to_file (GIMP_CONFIG (recent),
- filename,
- "tool settings",
- "end of tool settings",
- NULL, &error))
- {
- gimp_message (tool->tool_info->gimp, NULL, GIMP_MESSAGE_ERROR,
- "%s", error->message);
- g_clear_error (&error);
- }
-
- g_free (filename);
+ gimp_image_map_tool_recent_serialize (image_map_tool);
}
gboolean
@@ -306,6 +267,108 @@
/* private functions */
static void
+gimp_image_map_tool_separator_add (GimpContainer *container)
+{
+ GimpObject *sep = g_object_new (GIMP_TYPE_IMAGE_MAP_CONFIG, NULL);
+
+ gimp_container_add (container, sep);
+ g_object_unref (sep);
+
+ g_object_set_data (G_OBJECT (container), "separator", sep);
+}
+
+static void
+gimp_image_map_tool_separator_remove (GimpContainer *container)
+{
+ GimpObject *sep = g_object_get_data (G_OBJECT (container), "separator");
+
+ gimp_container_remove (container, sep);
+
+ g_object_set_data (G_OBJECT (container), "separator", NULL);
+}
+
+static void
+gimp_image_map_tool_recent_deserialize (GimpImageMapTool *im_tool)
+{
+ GimpImageMapToolClass *klass = GIMP_IMAGE_MAP_TOOL_GET_CLASS (im_tool);
+ GimpToolInfo *tool_info = GIMP_TOOL (im_tool)->tool_info;
+ gchar *filename;
+ GError *error = NULL;
+
+ filename = gimp_tool_info_build_options_filename (tool_info,
+ ".settings");
+
+ if (tool_info->gimp->be_verbose)
+ g_print ("Parsing '%s'\n", gimp_filename_to_utf8 (filename));
+
+ if (! gimp_config_deserialize_file (GIMP_CONFIG (klass->recent_settings),
+ filename,
+ NULL, &error))
+ {
+ if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
+ gimp_message (tool_info->gimp, NULL, GIMP_MESSAGE_ERROR,
+ "%s", error->message);
+
+ g_clear_error (&error);
+ }
+
+ g_free (filename);
+
+ gimp_image_map_tool_separator_add (klass->recent_settings);
+}
+
+static void
+gimp_image_map_tool_recent_serialize (GimpImageMapTool *im_tool)
+{
+ GimpImageMapToolClass *klass = GIMP_IMAGE_MAP_TOOL_GET_CLASS (im_tool);
+ GimpToolInfo *tool_info = GIMP_TOOL (im_tool)->tool_info;
+ gchar *filename;
+ GError *error = NULL;
+
+ gimp_image_map_tool_separator_remove (klass->recent_settings);
+
+ filename = gimp_tool_info_build_options_filename (tool_info,
+ ".settings");
+
+ if (tool_info->gimp->be_verbose)
+ g_print ("Writing '%s'\n", gimp_filename_to_utf8 (filename));
+
+ if (! gimp_config_serialize_to_file (GIMP_CONFIG (klass->recent_settings),
+ filename,
+ "tool settings",
+ "end of tool settings",
+ NULL, &error))
+ {
+ gimp_message (tool_info->gimp, NULL, GIMP_MESSAGE_ERROR,
+ "%s", error->message);
+ g_clear_error (&error);
+ }
+
+ g_free (filename);
+
+ gimp_image_map_tool_separator_add (klass->recent_settings);
+}
+
+static gboolean
+gimp_image_map_tool_row_separator_func (GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer data)
+{
+ gchar *name = NULL;
+
+#ifdef __GNUC__
+#warning FIXME: dont use magic model column
+#endif
+ gtk_tree_model_get (model, iter,
+ 1, &name,
+ -1);
+
+ g_free (name);
+
+ return name == NULL;
+}
+
+static void
gimp_image_map_tool_recent_selected (GimpContainerView *view,
GimpViewable *object,
gpointer insert_data,
@@ -482,9 +545,11 @@
config = gimp_config_duplicate (GIMP_CONFIG (tool->config));
gimp_object_set_name (GIMP_OBJECT (config), string);
- gimp_container_insert (GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool)->recent_settings,
- GIMP_OBJECT (config), 0);
+ gimp_container_add (GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool)->recent_settings,
+ GIMP_OBJECT (config));
g_object_unref (config);
+
+ gimp_image_map_tool_recent_serialize (tool);
}
static gboolean
Modified: trunk/app/tools/gimpimagemaptool.c
==============================================================================
--- trunk/app/tools/gimpimagemaptool.c (original)
+++ trunk/app/tools/gimpimagemaptool.c Tue May 20 21:41:47 2008
@@ -18,6 +18,8 @@
#include "config.h"
+#include <string.h>
+
#include <gegl.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
@@ -33,6 +35,7 @@
#include "core/gimpimage.h"
#include "core/gimpimage-pick-color.h"
#include "core/gimpimagemap.h"
+#include "core/gimpimagemapconfig.h"
#include "core/gimplist.h"
#include "core/gimppickable.h"
#include "core/gimpprojection.h"
@@ -170,7 +173,9 @@
static void
gimp_image_map_tool_base_init (GimpImageMapToolClass *klass)
{
- klass->recent_settings = gimp_list_new (GIMP_TYPE_VIEWABLE, FALSE);
+ klass->recent_settings = gimp_list_new (GIMP_TYPE_VIEWABLE, TRUE);
+ gimp_list_set_sort_func (GIMP_LIST (klass->recent_settings),
+ (GCompareFunc) gimp_image_map_config_compare);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]