From df4aa0715a86d170e08d8de8286fa76215f027b1 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Sat, 9 Jul 2005 11:23:15 +0000 Subject: [PATCH] added "sample-merged" property and API. Pass it to 2005-07-09 Michael Natterer * app/widgets/gimpsamplepointeditor.[ch]: added "sample-merged" property and API. Pass it to gimp_image_pick_color(). * app/actions/Makefile.am * app/actions/actions.c * app/actions/sample-point-editor-actions.[ch] * app/actions/sample-point-editor-commands.[ch]: actions and callbacks for the sample point editor's menu. * app/widgets/gimphelp-ids.h: its help IDs. * app/menus/menus.c * menus/Makefile.am * menus/sample-point-editor-menu.xml: the sample point editor menu. --- ChangeLog | 17 ++++ app/actions/Makefile.am | 4 + app/actions/actions.c | 4 + app/actions/sample-point-editor-actions.c | 80 ++++++++++++++++ app/actions/sample-point-editor-actions.h | 28 ++++++ app/actions/sample-point-editor-commands.c | 48 ++++++++++ app/actions/sample-point-editor-commands.h | 27 ++++++ app/actions/sample-points-actions.c | 80 ++++++++++++++++ app/actions/sample-points-actions.h | 28 ++++++ app/actions/sample-points-commands.c | 48 ++++++++++ app/actions/sample-points-commands.h | 27 ++++++ app/menus/menus.c | 8 ++ app/widgets/gimphelp-ids.h | 4 +- app/widgets/gimpsamplepointeditor.c | 102 ++++++++++++++++++++- app/widgets/gimpsamplepointeditor.h | 10 +- menus/Makefile.am | 1 + menus/sample-point-editor-menu.xml | 8 ++ menus/sample-points-menu.xml | 8 ++ 18 files changed, 525 insertions(+), 7 deletions(-) create mode 100644 app/actions/sample-point-editor-actions.c create mode 100644 app/actions/sample-point-editor-actions.h create mode 100644 app/actions/sample-point-editor-commands.c create mode 100644 app/actions/sample-point-editor-commands.h create mode 100644 app/actions/sample-points-actions.c create mode 100644 app/actions/sample-points-actions.h create mode 100644 app/actions/sample-points-commands.c create mode 100644 app/actions/sample-points-commands.h create mode 100644 menus/sample-point-editor-menu.xml create mode 100644 menus/sample-points-menu.xml diff --git a/ChangeLog b/ChangeLog index 1cdbb46506..31c0f3e25f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2005-07-09 Michael Natterer + + * app/widgets/gimpsamplepointeditor.[ch]: added "sample-merged" + property and API. Pass it to gimp_image_pick_color(). + + * app/actions/Makefile.am + * app/actions/actions.c + * app/actions/sample-point-editor-actions.[ch] + * app/actions/sample-point-editor-commands.[ch]: actions and + callbacks for the sample point editor's menu. + + * app/widgets/gimphelp-ids.h: its help IDs. + + * app/menus/menus.c + * menus/Makefile.am + * menus/sample-point-editor-menu.xml: the sample point editor menu. + 2005-07-09 Michael Natterer * app/core/gimpimage-pick-color.c (gimp_image_pick_color): if diff --git a/app/actions/Makefile.am b/app/actions/Makefile.am index 763c3a4251..1a6d8430cc 100644 --- a/app/actions/Makefile.am +++ b/app/actions/Makefile.am @@ -113,6 +113,10 @@ libappactions_a_SOURCES = \ qmask-actions.h \ qmask-commands.c \ qmask-commands.h \ + sample-point-editor-actions.c \ + sample-point-editor-actions.h \ + sample-point-editor-commands.c \ + sample-point-editor-commands.h \ select-actions.c \ select-actions.h \ select-commands.c \ diff --git a/app/actions/actions.c b/app/actions/actions.c index a7dc5c4c7f..9b434a1a47 100644 --- a/app/actions/actions.c +++ b/app/actions/actions.c @@ -73,6 +73,7 @@ #include "patterns-actions.h" #include "plug-in-actions.h" #include "qmask-actions.h" +#include "sample-point-editor-actions.h" #include "select-actions.h" #include "templates-actions.h" #include "text-editor-actions.h" @@ -174,6 +175,9 @@ static GimpActionFactoryEntry action_groups[] = { "qmask", N_("QuickMask"), GIMP_STOCK_QMASK_ON, qmask_actions_setup, qmask_actions_update }, + { "sample-point-editor", N_("Sample Points"), GIMP_STOCK_SAMPLE_POINT, + sample_point_editor_actions_setup, + sample_point_editor_actions_update }, { "select", N_("Select"), GIMP_STOCK_SELECTION, select_actions_setup, select_actions_update }, diff --git a/app/actions/sample-point-editor-actions.c b/app/actions/sample-point-editor-actions.c new file mode 100644 index 0000000000..0fb50f38b0 --- /dev/null +++ b/app/actions/sample-point-editor-actions.c @@ -0,0 +1,80 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * 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 + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimphelp-ids.h" +#include "widgets/gimpsamplepointeditor.h" + +#include "sample-point-editor-actions.h" +#include "sample-point-editor-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry sample_point_editor_actions[] = +{ + { "sample-point-editor-popup", GIMP_STOCK_SAMPLE_POINT, + N_("Sample Point Menu"), NULL, NULL, NULL, + GIMP_HELP_SAMPLE_POINT_DIALOG } +}; + +static GimpToggleActionEntry sample_point_editor_toggle_actions[] = +{ + { "sample-point-editor-sample-merged", NULL, + N_("_Sample Merged"), "", + N_("Sample Merged"), + G_CALLBACK (sample_point_editor_sample_merged_cmd_callback), + TRUE, + GIMP_HELP_SAMPLE_POINT_SAMPLE_MERGED } +}; + + +void +sample_point_editor_actions_setup (GimpActionGroup *group) +{ + gimp_action_group_add_actions (group, + sample_point_editor_actions, + G_N_ELEMENTS (sample_point_editor_actions)); + + gimp_action_group_add_toggle_actions (group, + sample_point_editor_toggle_actions, + G_N_ELEMENTS (sample_point_editor_toggle_actions)); +} + +void +sample_point_editor_actions_update (GimpActionGroup *group, + gpointer data) +{ + GimpSamplePointEditor *editor = GIMP_SAMPLE_POINT_EDITOR (data); + +#define SET_ACTIVE(action,condition) \ + gimp_action_group_set_action_active (group, action, (condition) != 0) + + SET_ACTIVE ("sample-point-editor-sample-merged", + gimp_sample_point_editor_get_sample_merged (editor)); + +#undef SET_ACTIVE +} diff --git a/app/actions/sample-point-editor-actions.h b/app/actions/sample-point-editor-actions.h new file mode 100644 index 0000000000..ede3f24ba0 --- /dev/null +++ b/app/actions/sample-point-editor-actions.h @@ -0,0 +1,28 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * 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 __SAMPLE_POINT_EDITOR_ACIONS_H__ +#define __SAMPLE_POINT_EDITOR_ACIONS_H__ + + +void sample_point_editor_actions_setup (GimpActionGroup *group); +void sample_point_editor_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __SAMPLE_POINT_EDITOR_ACTIONS_H__ */ diff --git a/app/actions/sample-point-editor-commands.c b/app/actions/sample-point-editor-commands.c new file mode 100644 index 0000000000..d39fdafd20 --- /dev/null +++ b/app/actions/sample-point-editor-commands.c @@ -0,0 +1,48 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * 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 + +#include "libgimpbase/gimpbase.h" +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "widgets/gimphelp-ids.h" +#include "widgets/gimpsamplepointeditor.h" + +#include "sample-point-editor-commands.h" + +#include "gimp-intl.h" + + +/* public functions */ + +void +sample_point_editor_sample_merged_cmd_callback (GtkAction *action, + gpointer data) +{ + GimpSamplePointEditor *editor = GIMP_SAMPLE_POINT_EDITOR (data); + gboolean active; + + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + + gimp_sample_point_editor_set_sample_merged (editor, active); +} diff --git a/app/actions/sample-point-editor-commands.h b/app/actions/sample-point-editor-commands.h new file mode 100644 index 0000000000..a2ce62a0c7 --- /dev/null +++ b/app/actions/sample-point-editor-commands.h @@ -0,0 +1,27 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * 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 __SAMPLE_POINT_EDITOR_COMMANDS_H__ +#define __SAMPLE_POINT_EDITOR_COMMANDS_H__ + + +void sample_point_editor_sample_merged_cmd_callback (GtkAction *action, + gpointer data); + + +#endif /* __SAMPLE_POINT_EDITOR_COMMANDS_H__ */ diff --git a/app/actions/sample-points-actions.c b/app/actions/sample-points-actions.c new file mode 100644 index 0000000000..0fb50f38b0 --- /dev/null +++ b/app/actions/sample-points-actions.c @@ -0,0 +1,80 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * 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 + +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "widgets/gimpactiongroup.h" +#include "widgets/gimphelp-ids.h" +#include "widgets/gimpsamplepointeditor.h" + +#include "sample-point-editor-actions.h" +#include "sample-point-editor-commands.h" + +#include "gimp-intl.h" + + +static GimpActionEntry sample_point_editor_actions[] = +{ + { "sample-point-editor-popup", GIMP_STOCK_SAMPLE_POINT, + N_("Sample Point Menu"), NULL, NULL, NULL, + GIMP_HELP_SAMPLE_POINT_DIALOG } +}; + +static GimpToggleActionEntry sample_point_editor_toggle_actions[] = +{ + { "sample-point-editor-sample-merged", NULL, + N_("_Sample Merged"), "", + N_("Sample Merged"), + G_CALLBACK (sample_point_editor_sample_merged_cmd_callback), + TRUE, + GIMP_HELP_SAMPLE_POINT_SAMPLE_MERGED } +}; + + +void +sample_point_editor_actions_setup (GimpActionGroup *group) +{ + gimp_action_group_add_actions (group, + sample_point_editor_actions, + G_N_ELEMENTS (sample_point_editor_actions)); + + gimp_action_group_add_toggle_actions (group, + sample_point_editor_toggle_actions, + G_N_ELEMENTS (sample_point_editor_toggle_actions)); +} + +void +sample_point_editor_actions_update (GimpActionGroup *group, + gpointer data) +{ + GimpSamplePointEditor *editor = GIMP_SAMPLE_POINT_EDITOR (data); + +#define SET_ACTIVE(action,condition) \ + gimp_action_group_set_action_active (group, action, (condition) != 0) + + SET_ACTIVE ("sample-point-editor-sample-merged", + gimp_sample_point_editor_get_sample_merged (editor)); + +#undef SET_ACTIVE +} diff --git a/app/actions/sample-points-actions.h b/app/actions/sample-points-actions.h new file mode 100644 index 0000000000..ede3f24ba0 --- /dev/null +++ b/app/actions/sample-points-actions.h @@ -0,0 +1,28 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * 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 __SAMPLE_POINT_EDITOR_ACIONS_H__ +#define __SAMPLE_POINT_EDITOR_ACIONS_H__ + + +void sample_point_editor_actions_setup (GimpActionGroup *group); +void sample_point_editor_actions_update (GimpActionGroup *group, + gpointer data); + + +#endif /* __SAMPLE_POINT_EDITOR_ACTIONS_H__ */ diff --git a/app/actions/sample-points-commands.c b/app/actions/sample-points-commands.c new file mode 100644 index 0000000000..d39fdafd20 --- /dev/null +++ b/app/actions/sample-points-commands.c @@ -0,0 +1,48 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * 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 + +#include "libgimpbase/gimpbase.h" +#include "libgimpwidgets/gimpwidgets.h" + +#include "actions-types.h" + +#include "widgets/gimphelp-ids.h" +#include "widgets/gimpsamplepointeditor.h" + +#include "sample-point-editor-commands.h" + +#include "gimp-intl.h" + + +/* public functions */ + +void +sample_point_editor_sample_merged_cmd_callback (GtkAction *action, + gpointer data) +{ + GimpSamplePointEditor *editor = GIMP_SAMPLE_POINT_EDITOR (data); + gboolean active; + + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + + gimp_sample_point_editor_set_sample_merged (editor, active); +} diff --git a/app/actions/sample-points-commands.h b/app/actions/sample-points-commands.h new file mode 100644 index 0000000000..a2ce62a0c7 --- /dev/null +++ b/app/actions/sample-points-commands.h @@ -0,0 +1,27 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * 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 __SAMPLE_POINT_EDITOR_COMMANDS_H__ +#define __SAMPLE_POINT_EDITOR_COMMANDS_H__ + + +void sample_point_editor_sample_merged_cmd_callback (GtkAction *action, + gpointer data); + + +#endif /* __SAMPLE_POINT_EDITOR_COMMANDS_H__ */ diff --git a/app/menus/menus.c b/app/menus/menus.c index 73a00fa3ee..181164fd1c 100644 --- a/app/menus/menus.c +++ b/app/menus/menus.c @@ -317,6 +317,14 @@ menus_init (Gimp *gimp, "cursor-info-menu.xml", NULL, NULL); + + gimp_menu_factory_manager_register (global_menu_factory, "", + "sample-point-editor", + NULL, + "/sample-point-editor-popup", + "sample-point-editor-menu.xml", + NULL, + NULL); } void diff --git a/app/widgets/gimphelp-ids.h b/app/widgets/gimphelp-ids.h index 1ee0e1caad..d953677ec7 100644 --- a/app/widgets/gimphelp-ids.h +++ b/app/widgets/gimphelp-ids.h @@ -414,6 +414,9 @@ #define GIMP_HELP_CURSOR_INFO_DIALOG "gimp-cursor-info-dialog" #define GIMP_HELP_CURSOR_INFO_SAMPLE_MERGED "gimp-cursor-info-sample-merged" +#define GIMP_HELP_SAMPLE_POINT_DIALOG "gimp-sample-point-dialog" +#define GIMP_HELP_SAMPLE_POINT_SAMPLE_MERGED "gimp-sample-point-sample-merged" + #define GIMP_HELP_DOCK "gimp-dock" #define GIMP_HELP_DOCK_CLOSE "gimp-dock-close" #define GIMP_HELP_DOCK_IMAGE_MENU "gimp-dock-image-menu" @@ -437,7 +440,6 @@ #define GIMP_HELP_DISPLAY_FILTER_DIALOG "gimp-display-filter-dialog" #define GIMP_HELP_HISTOGRAM_DIALOG "gimp-histogram-dialog" #define GIMP_HELP_INFO_DIALOG "gimp-info-dialog" -#define GIMP_HELP_SAMPLE_POINT_DIALOG "gimp-sample-point-dialog" #define GIMP_HELP_MODULE_DIALOG "gimp-module-dialog" #define GIMP_HELP_NAVIGATION_DIALOG "gimp-navigation-dialog" #define GIMP_HELP_TEXT_EDITOR_DIALOG "gimp-text-editor-dialog" diff --git a/app/widgets/gimpsamplepointeditor.c b/app/widgets/gimpsamplepointeditor.c index 2fd0806bf9..25f8e9132d 100644 --- a/app/widgets/gimpsamplepointeditor.c +++ b/app/widgets/gimpsamplepointeditor.c @@ -40,12 +40,27 @@ #include "gimp-intl.h" +enum +{ + PROP_0, + PROP_SAMPLE_MERGED +}; + + static void gimp_sample_point_editor_class_init (GimpSamplePointEditorClass *klass); static void gimp_sample_point_editor_init (GimpSamplePointEditor *editor); static GObject * gimp_sample_point_editor_constructor (GType type, guint n_params, GObjectConstructParam *params); +static void gimp_sample_point_editor_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec); +static void gimp_sample_point_editor_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec); static void gimp_sample_point_editor_dispose (GObject *object); static void gimp_sample_point_editor_style_set (GtkWidget *widget, @@ -116,11 +131,20 @@ gimp_sample_point_editor_class_init (GimpSamplePointEditorClass* klass) parent_class = g_type_class_peek_parent (klass); object_class->constructor = gimp_sample_point_editor_constructor; + object_class->get_property = gimp_sample_point_editor_get_property; + object_class->set_property = gimp_sample_point_editor_set_property; object_class->dispose = gimp_sample_point_editor_dispose; widget_class->style_set = gimp_sample_point_editor_style_set; image_editor_class->set_image = gimp_sample_point_editor_set_image; + + g_object_class_install_property (object_class, PROP_SAMPLE_MERGED, + g_param_spec_boolean ("sample-merged", + NULL, NULL, + TRUE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT)); } static void @@ -131,6 +155,8 @@ gimp_sample_point_editor_init (GimpSamplePointEditor *editor) gint row = 0; gint column = 0; + editor->sample_merged = TRUE; + gtk_widget_style_get (GTK_WIDGET (editor), "content_spacing", &content_spacing, NULL); @@ -185,6 +211,45 @@ gimp_sample_point_editor_constructor (GType type, return object; } +static void +gimp_sample_point_editor_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + GimpSamplePointEditor *editor = GIMP_SAMPLE_POINT_EDITOR (object); + + switch (property_id) + { + case PROP_SAMPLE_MERGED: + gimp_sample_point_editor_set_sample_merged (editor, + g_value_get_boolean (value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +static void +gimp_sample_point_editor_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + GimpSamplePointEditor *editor = GIMP_SAMPLE_POINT_EDITOR (object); + + switch (property_id) + { + case PROP_SAMPLE_MERGED: + g_value_set_boolean (value, editor->sample_merged); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + static void gimp_sample_point_editor_dispose (GObject *object) { @@ -269,14 +334,42 @@ gimp_sample_point_editor_new (GimpMenuFactory *menu_factory) g_return_val_if_fail (GIMP_IS_MENU_FACTORY (menu_factory), NULL); return g_object_new (GIMP_TYPE_SAMPLE_POINT_EDITOR, -#if 0 "menu-factory", menu_factory, "menu-identifier", "", - "ui-path", "/selection-editor-popup", -#endif + "ui-path", "/sample-point-editor-popup", NULL); } +void +gimp_sample_point_editor_set_sample_merged (GimpSamplePointEditor *editor, + gboolean sample_merged) +{ + g_return_if_fail (GIMP_IS_SAMPLE_POINT_EDITOR (editor)); + + sample_merged = sample_merged ? TRUE : FALSE; + + if (editor->sample_merged != sample_merged) + { + gint i; + + editor->sample_merged = sample_merged; + + for (i = 0; i < 4; i++) + editor->dirty[i] = TRUE; + + gimp_sample_point_editor_dirty (editor, -1); + + g_object_notify (G_OBJECT (editor), "sample-merged"); + } +} + +gboolean +gimp_sample_point_editor_get_sample_merged (GimpSamplePointEditor *editor) +{ + g_return_val_if_fail (GIMP_IS_SAMPLE_POINT_EDITOR (editor), FALSE); + + return editor->sample_merged; +} /* private functions */ @@ -413,7 +506,8 @@ gimp_sample_point_editor_update (GimpSamplePointEditor *editor) if (gimp_image_pick_color (image_editor->gimage, NULL, sample_point->x, sample_point->y, - TRUE, FALSE, 0.0, + editor->sample_merged, + FALSE, 0.0, &image_type, &color, &color_index)) diff --git a/app/widgets/gimpsamplepointeditor.h b/app/widgets/gimpsamplepointeditor.h index b3fc1abeed..e5695a9baa 100644 --- a/app/widgets/gimpsamplepointeditor.h +++ b/app/widgets/gimpsamplepointeditor.h @@ -45,6 +45,8 @@ struct _GimpSamplePointEditor gboolean dirty[4]; guint dirty_idle_id; + + gboolean sample_merged; }; struct _GimpSamplePointEditorClass @@ -53,9 +55,13 @@ struct _GimpSamplePointEditorClass }; -GType gimp_sample_point_editor_get_type (void) G_GNUC_CONST; +GType gimp_sample_point_editor_get_type (void) G_GNUC_CONST; -GtkWidget * gimp_sample_point_editor_new (GimpMenuFactory *menu_factory); +GtkWidget * gimp_sample_point_editor_new (GimpMenuFactory *menu_factory); + +void gimp_sample_point_editor_set_sample_merged (GimpSamplePointEditor *editor, + gboolean sample_merged); +gboolean gimp_sample_point_editor_get_sample_merged (GimpSamplePointEditor *editor); #endif /* __GIMP_SAMPLE_POINT_EDITOR_H__ */ diff --git a/menus/Makefile.am b/menus/Makefile.am index dec2a2dc92..b6f8f50995 100644 --- a/menus/Makefile.am +++ b/menus/Makefile.am @@ -27,6 +27,7 @@ menudata_DATA = \ palettes-menu.xml \ patterns-menu.xml \ qmask-menu.xml \ + sample-point-editor-menu.xml \ selection-editor-menu.xml \ templates-menu.xml \ text-editor-toolbar.xml \ diff --git a/menus/sample-point-editor-menu.xml b/menus/sample-point-editor-menu.xml new file mode 100644 index 0000000000..caf6c058e5 --- /dev/null +++ b/menus/sample-point-editor-menu.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/menus/sample-points-menu.xml b/menus/sample-points-menu.xml new file mode 100644 index 0000000000..caf6c058e5 --- /dev/null +++ b/menus/sample-points-menu.xml @@ -0,0 +1,8 @@ + + + + + + + +