mirror of https://github.com/GNOME/gimp.git
app/widgets/Makefile.am app/widgets/widgets-types.h
2005-01-21 Sven Neumann <sven@gimp.org> * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpenumcombobox.[ch] * app/widgets/gimpenumstore.[ch]: moved GimpEnumStore and GimpEnumComboBox from here ... * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.def * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetstypes.h * libgimpwidgets/gimpenumcombobox.[ch] * libgimpwidgets/gimpenumstore.[ch]: ... to libgimpwidgets. * app/dialogs/convert-dialog.c * app/dialogs/scale-dialog.c * app/tools/gimpblendoptions.c * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c * app/widgets/gimpcolorframe.c * app/widgets/gimphistogrameditor.c * app/widgets/gimppropwidgets.c * app/widgets/gimpstrokeeditor.c * data/images/gimp-splash.png: changed includes accordingly.
This commit is contained in:
parent
a17f8e56d0
commit
3069695265
26
ChangeLog
26
ChangeLog
|
@ -1,3 +1,29 @@
|
|||
2005-01-21 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/widgets/Makefile.am
|
||||
* app/widgets/widgets-types.h
|
||||
* app/widgets/gimpenumcombobox.[ch]
|
||||
* app/widgets/gimpenumstore.[ch]: moved GimpEnumStore and
|
||||
GimpEnumComboBox from here ...
|
||||
|
||||
* libgimpwidgets/Makefile.am
|
||||
* libgimpwidgets/gimpwidgets.def
|
||||
* libgimpwidgets/gimpwidgets.h
|
||||
* libgimpwidgets/gimpwidgetstypes.h
|
||||
* libgimpwidgets/gimpenumcombobox.[ch]
|
||||
* libgimpwidgets/gimpenumstore.[ch]: ... to libgimpwidgets.
|
||||
|
||||
* app/dialogs/convert-dialog.c
|
||||
* app/dialogs/scale-dialog.c
|
||||
* app/tools/gimpblendoptions.c
|
||||
* app/tools/gimpcurvestool.c
|
||||
* app/tools/gimplevelstool.c
|
||||
* app/widgets/gimpcolorframe.c
|
||||
* app/widgets/gimphistogrameditor.c
|
||||
* app/widgets/gimppropwidgets.c
|
||||
* app/widgets/gimpstrokeeditor.c
|
||||
* data/images/gimp-splash.png: changed includes accordingly.
|
||||
|
||||
2005-01-21 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/widgets/gimpwidgets-utils.[ch] (gimp_action_get_accel_closure):
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
|
||||
#include "widgets/gimpenumwidgets.h"
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
#include "widgets/gimpenumcombobox.h"
|
||||
#include "widgets/gimpviewablebox.h"
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
#include "widgets/gimpwidgets-utils.h"
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "core/gimpimage.h"
|
||||
#include "core/gimpitem.h"
|
||||
|
||||
#include "widgets/gimpenumcombobox.h"
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
#include "widgets/gimpmessagebox.h"
|
||||
#include "widgets/gimpsizebox.h"
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "core/gimpdatafactory.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "widgets/gimpenumcombobox.h"
|
||||
#include "widgets/gimppropwidgets.h"
|
||||
#include "widgets/gimpwidgets-utils.h"
|
||||
|
||||
|
|
|
@ -45,8 +45,6 @@
|
|||
|
||||
#include "widgets/gimpcolorbar.h"
|
||||
#include "widgets/gimpcursor.h"
|
||||
#include "widgets/gimpenumcombobox.h"
|
||||
#include "widgets/gimpenumstore.h"
|
||||
#include "widgets/gimpenumwidgets.h"
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
#include "widgets/gimphistogramview.h"
|
||||
|
|
|
@ -44,8 +44,6 @@
|
|||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "widgets/gimpcolorbar.h"
|
||||
#include "widgets/gimpenumcombobox.h"
|
||||
#include "widgets/gimpenumstore.h"
|
||||
#include "widgets/gimpenumwidgets.h"
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
#include "widgets/gimphistogramview.h"
|
||||
|
|
|
@ -125,10 +125,6 @@ libappwidgets_a_sources = \
|
|||
gimpeditor.h \
|
||||
gimpenumaction.c \
|
||||
gimpenumaction.h \
|
||||
gimpenumcombobox.c \
|
||||
gimpenumcombobox.h \
|
||||
gimpenumstore.c \
|
||||
gimpenumstore.h \
|
||||
gimpenumwidgets.c \
|
||||
gimpenumwidgets.h \
|
||||
gimperrorconsole.c \
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "core/gimpimage.h"
|
||||
|
||||
#include "gimpcolorframe.h"
|
||||
#include "gimpenumcombobox.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
|
|
@ -1,158 +0,0 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpenumcombobox.c
|
||||
* Copyright (C) 2004 Sven Neumann <sven@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 <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "widgets-types.h"
|
||||
|
||||
#include "gimpenumcombobox.h"
|
||||
#include "gimpenumstore.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
GType
|
||||
gimp_enum_combo_box_get_type (void)
|
||||
{
|
||||
static GType enum_combo_box_type = 0;
|
||||
|
||||
if (!enum_combo_box_type)
|
||||
{
|
||||
static const GTypeInfo enum_combo_box_info =
|
||||
{
|
||||
sizeof (GimpEnumComboBoxClass),
|
||||
NULL, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
NULL, /* class_init */
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
sizeof (GimpEnumComboBox),
|
||||
0, /* n_preallocs */
|
||||
NULL /* instance_init */
|
||||
};
|
||||
|
||||
enum_combo_box_type = g_type_register_static (GIMP_TYPE_INT_COMBO_BOX,
|
||||
"GimpEnumComboBox",
|
||||
&enum_combo_box_info, 0);
|
||||
}
|
||||
|
||||
return enum_combo_box_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_enum_combo_box_new:
|
||||
* @enum_type: the #GType of an enum.
|
||||
*
|
||||
* Creates a #GtkComboBox readily filled with all enum values from a
|
||||
* given @enum_type. The enum needs to be registered to the type
|
||||
* system and should have translatable value names.
|
||||
*
|
||||
* This is just a convenience function. If you need more control over
|
||||
* the enum values that appear in the combo_box, you can create your
|
||||
* own #GimpEnumStore and use gimp_enum_combo_box_new_with_model().
|
||||
*
|
||||
* Return value: a new #GimpEnumComboBox.
|
||||
**/
|
||||
GtkWidget *
|
||||
gimp_enum_combo_box_new (GType enum_type)
|
||||
{
|
||||
GtkListStore *store;
|
||||
GtkWidget *combo_box;
|
||||
|
||||
g_return_val_if_fail (G_TYPE_IS_ENUM (enum_type), NULL);
|
||||
|
||||
store = gimp_enum_store_new (enum_type);
|
||||
|
||||
combo_box = g_object_new (GIMP_TYPE_ENUM_COMBO_BOX,
|
||||
"model", store,
|
||||
NULL);
|
||||
|
||||
g_object_unref (store);
|
||||
|
||||
return combo_box;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_enum_combo_box_set_stock_prefix:
|
||||
* @combo_box: a #GimpEnumComboBox
|
||||
* @stock_prefix: a prefix to create icon stock ID from enum values
|
||||
*
|
||||
* Attempts to create and set icons for all items in the
|
||||
* @combo_box. See gimp_enum_store_set_icons() for more info.
|
||||
**/
|
||||
void
|
||||
gimp_enum_combo_box_set_stock_prefix (GimpEnumComboBox *combo_box,
|
||||
const gchar *stock_prefix)
|
||||
{
|
||||
GtkTreeModel *model;
|
||||
|
||||
g_return_if_fail (GIMP_IS_ENUM_COMBO_BOX (combo_box));
|
||||
|
||||
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box));
|
||||
|
||||
gimp_enum_store_set_stock_prefix (GIMP_ENUM_STORE (model), stock_prefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_enum_combo_box_set_visible:
|
||||
* @combo_box: a #GimpEnumComboBox
|
||||
* @func: a #GtkTreeModelFilterVisibleFunc
|
||||
* @data: a pointer that is passed to @func
|
||||
*
|
||||
* Sets a filter on the combo_box that selectively hides items. The
|
||||
* registered callback @func is called with an iter for each item and
|
||||
* must return %TRUE or %FALSE indicating whether the respective row
|
||||
* should be visible or not.
|
||||
*
|
||||
* This function must only be called once for a @combo_box. If you
|
||||
* want to refresh the visibility of the items in the @combo_box
|
||||
* later, call gtk_tree_model_filter_refilter() on the @combo_box's
|
||||
* model.
|
||||
*
|
||||
* This is a kludge to allow to work around the inability of
|
||||
* #GtkComboBox to set the sensitivity of it's items (bug #135875).
|
||||
* It should be removed as soon as this bug is fixed (probably with
|
||||
* GTK+-2.6).
|
||||
**/
|
||||
void
|
||||
gimp_enum_combo_box_set_visible (GimpEnumComboBox *combo_box,
|
||||
GtkTreeModelFilterVisibleFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
GtkTreeModel *model;
|
||||
GtkTreeModelFilter *filter;
|
||||
|
||||
g_return_if_fail (GIMP_IS_ENUM_COMBO_BOX (combo_box));
|
||||
g_return_if_fail (func != NULL);
|
||||
|
||||
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box));
|
||||
|
||||
filter = GTK_TREE_MODEL_FILTER (gtk_tree_model_filter_new (model, NULL));
|
||||
gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (filter));
|
||||
g_object_unref (filter);
|
||||
|
||||
gtk_tree_model_filter_set_visible_func (filter, func, data, NULL);
|
||||
gtk_tree_model_filter_refilter (filter);
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpenumcombobox.h
|
||||
* Copyright (C) 2004 Sven Neumann <sven@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_ENUM_COMBO_BOX_H__
|
||||
#define __GIMP_ENUM_COMBO_BOX_H__
|
||||
|
||||
#include <libgimpwidgets/gimpintcombobox.h>
|
||||
|
||||
|
||||
#define GIMP_TYPE_ENUM_COMBO_BOX (gimp_enum_combo_box_get_type ())
|
||||
#define GIMP_ENUM_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_ENUM_COMBO_BOX, GimpEnumComboBox))
|
||||
#define GIMP_ENUM_COMBO_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_ENUM_COMBO_BOX, GimpEnumComboBoxClass))
|
||||
#define GIMP_IS_ENUM_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_ENUM_COMBO_BOX))
|
||||
#define GIMP_IS_ENUM_COMBO_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_ENUM_COMBO_BOX))
|
||||
#define GIMP_ENUM_COMBO_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_ENUM_COMBO_BOX, GimpEnumComboBoxClass))
|
||||
|
||||
|
||||
typedef struct _GimpEnumComboBoxClass GimpEnumComboBoxClass;
|
||||
|
||||
struct _GimpEnumComboBoxClass
|
||||
{
|
||||
GimpIntComboBoxClass parent_instance;
|
||||
};
|
||||
|
||||
struct _GimpEnumComboBox
|
||||
{
|
||||
GimpIntComboBox parent_instance;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_enum_combo_box_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_enum_combo_box_new (GType enum_type);
|
||||
|
||||
void gimp_enum_combo_box_set_stock_prefix (GimpEnumComboBox *combo_box,
|
||||
const gchar *stock_prefix);
|
||||
void gimp_enum_combo_box_set_visible (GimpEnumComboBox *combo_box,
|
||||
GtkTreeModelFilterVisibleFunc func,
|
||||
gpointer data);
|
||||
|
||||
|
||||
#endif /* __GIMP_ENUM_COMBO_BOX_H__ */
|
|
@ -1,296 +0,0 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpenumstore.c
|
||||
* Copyright (C) 2004 Sven Neumann <sven@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 <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "widgets-types.h"
|
||||
|
||||
#include "gimpenumstore.h"
|
||||
|
||||
|
||||
static void gimp_enum_store_class_init (GimpEnumStoreClass *klass);
|
||||
|
||||
static void gimp_enum_store_finalize (GObject *object);
|
||||
|
||||
static void gimp_enum_store_add_value (GtkListStore *store,
|
||||
GEnumValue *value);
|
||||
|
||||
|
||||
static GimpEnumStoreClass *parent_class = NULL;
|
||||
|
||||
|
||||
GType
|
||||
gimp_enum_store_get_type (void)
|
||||
{
|
||||
static GType enum_store_type = 0;
|
||||
|
||||
if (!enum_store_type)
|
||||
{
|
||||
static const GTypeInfo enum_store_info =
|
||||
{
|
||||
sizeof (GimpEnumStoreClass),
|
||||
NULL, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
(GClassInitFunc) gimp_enum_store_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
sizeof (GimpEnumStore),
|
||||
0, /* n_preallocs */
|
||||
NULL /* instance_init */
|
||||
};
|
||||
|
||||
enum_store_type = g_type_register_static (GIMP_TYPE_INT_STORE,
|
||||
"GimpEnumStore",
|
||||
&enum_store_info, 0);
|
||||
}
|
||||
|
||||
return enum_store_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_enum_store_class_init (GimpEnumStoreClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->finalize = gimp_enum_store_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_enum_store_finalize (GObject *object)
|
||||
{
|
||||
GimpEnumStore *enum_store = GIMP_ENUM_STORE (object);
|
||||
|
||||
if (enum_store->enum_class)
|
||||
g_type_class_unref (enum_store->enum_class);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_enum_store_add_value (GtkListStore *store,
|
||||
GEnumValue *value)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
const gchar *desc;
|
||||
|
||||
desc = gimp_enum_value_get_desc (GIMP_ENUM_STORE (store)->enum_class, value);
|
||||
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
GIMP_INT_STORE_VALUE, value->value,
|
||||
GIMP_INT_STORE_LABEL, desc,
|
||||
-1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gimp_enum_store_new:
|
||||
* @enum_type: the #GType of an enum.
|
||||
*
|
||||
* Creates a new #GimpEnumStore, derived from #GtkListStore and fills
|
||||
* it with enum values. The enum needs to be registered to the type
|
||||
* system and should have translatable value names.
|
||||
*
|
||||
* Return value: a new #GimpEnumStore.
|
||||
**/
|
||||
GtkListStore *
|
||||
gimp_enum_store_new (GType enum_type)
|
||||
{
|
||||
GtkListStore *store;
|
||||
GEnumClass *enum_class;
|
||||
|
||||
g_return_val_if_fail (G_TYPE_IS_ENUM (enum_type), NULL);
|
||||
|
||||
enum_class = g_type_class_ref (enum_type);
|
||||
|
||||
store = gimp_enum_store_new_with_range (enum_type,
|
||||
enum_class->minimum,
|
||||
enum_class->maximum);
|
||||
|
||||
g_type_class_unref (enum_class);
|
||||
|
||||
return store;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_enum_store_new_with_range:
|
||||
* @enum_type: the #GType of an enum.
|
||||
* @minimum: the minimum value to include
|
||||
* @maximum: the maximum value to include
|
||||
*
|
||||
* Creates a new #GimpEnumStore like gimp_enum_store_new() but allows
|
||||
* to limit the enum values to a certain range.
|
||||
*
|
||||
* Return value: a new #GimpEnumStore.
|
||||
**/
|
||||
GtkListStore *
|
||||
gimp_enum_store_new_with_range (GType enum_type,
|
||||
gint minimum,
|
||||
gint maximum)
|
||||
{
|
||||
GtkListStore *store;
|
||||
GEnumValue *value;
|
||||
|
||||
g_return_val_if_fail (G_TYPE_IS_ENUM (enum_type), NULL);
|
||||
|
||||
store = g_object_new (GIMP_TYPE_ENUM_STORE, NULL);
|
||||
|
||||
GIMP_ENUM_STORE (store)->enum_class = g_type_class_ref (enum_type);
|
||||
|
||||
for (value = GIMP_ENUM_STORE (store)->enum_class->values;
|
||||
value->value_name;
|
||||
value++)
|
||||
{
|
||||
if (value->value < minimum || value->value > maximum)
|
||||
continue;
|
||||
|
||||
gimp_enum_store_add_value (store, value);
|
||||
}
|
||||
|
||||
return store;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_enum_store_new_with_values
|
||||
* @enum_type: the #GType of an enum.
|
||||
* @n_values: the number of enum values to include
|
||||
* @...: a list of enum values (exactly @n_values)
|
||||
*
|
||||
* Creates a new #GimpEnumStore like gimp_enum_store_new() but allows
|
||||
* to list the enum values that should be added to the store.
|
||||
*
|
||||
* Return value: a new #GimpEnumStore.
|
||||
**/
|
||||
GtkListStore *
|
||||
gimp_enum_store_new_with_values (GType enum_type,
|
||||
gint n_values,
|
||||
...)
|
||||
{
|
||||
GtkListStore *store;
|
||||
va_list args;
|
||||
|
||||
va_start (args, n_values);
|
||||
|
||||
store = gimp_enum_store_new_with_values_valist (enum_type,
|
||||
n_values,
|
||||
args);
|
||||
|
||||
va_end (args);
|
||||
|
||||
return store;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_enum_store_new_with_values_valist:
|
||||
* @enum_type: the #GType of an enum.
|
||||
* @n_values: the number of enum values to include
|
||||
* @args: a va_list of enum values (exactly @n_values)
|
||||
*
|
||||
* See gimp_enum_store_new_with_values().
|
||||
*
|
||||
* Return value: a new #GimpEnumStore.
|
||||
**/
|
||||
GtkListStore *
|
||||
gimp_enum_store_new_with_values_valist (GType enum_type,
|
||||
gint n_values,
|
||||
va_list args)
|
||||
{
|
||||
GtkListStore *store;
|
||||
GEnumValue *value;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (G_TYPE_IS_ENUM (enum_type), NULL);
|
||||
g_return_val_if_fail (n_values > 1, NULL);
|
||||
|
||||
store = g_object_new (GIMP_TYPE_ENUM_STORE, NULL);
|
||||
|
||||
GIMP_ENUM_STORE (store)->enum_class = g_type_class_ref (enum_type);
|
||||
|
||||
for (i = 0; i < n_values; i++)
|
||||
{
|
||||
value = g_enum_get_value (GIMP_ENUM_STORE (store)->enum_class,
|
||||
va_arg (args, gint));
|
||||
|
||||
if (value)
|
||||
gimp_enum_store_add_value (store, value);
|
||||
}
|
||||
|
||||
return store;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_enum_store_set_stock_prefix:
|
||||
* @store: a #GimpEnumStore
|
||||
* @stock_prefix: a prefix to create icon stock ID from enum values
|
||||
*
|
||||
* Creates a stock ID for each enum value in the @store by appending
|
||||
* the value's nick to the given @stock_prefix inserting a hyphen
|
||||
* between them.
|
||||
**/
|
||||
void
|
||||
gimp_enum_store_set_stock_prefix (GimpEnumStore *store,
|
||||
const gchar *stock_prefix)
|
||||
{
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
gboolean iter_valid;
|
||||
|
||||
g_return_if_fail (GIMP_IS_ENUM_STORE (store));
|
||||
|
||||
model = GTK_TREE_MODEL (store);
|
||||
|
||||
for (iter_valid = gtk_tree_model_get_iter_first (model, &iter);
|
||||
iter_valid;
|
||||
iter_valid = gtk_tree_model_iter_next (model, &iter))
|
||||
{
|
||||
gchar *stock_id = NULL;
|
||||
|
||||
if (stock_prefix)
|
||||
{
|
||||
GEnumValue *enum_value;
|
||||
gint value;
|
||||
|
||||
gtk_tree_model_get (model, &iter,
|
||||
GIMP_INT_STORE_VALUE, &value,
|
||||
-1);
|
||||
|
||||
enum_value = g_enum_get_value (store->enum_class, value);
|
||||
|
||||
stock_id = g_strconcat (stock_prefix, "-",
|
||||
enum_value->value_nick,
|
||||
NULL);
|
||||
}
|
||||
|
||||
gtk_list_store_set (GTK_LIST_STORE (store), &iter,
|
||||
GIMP_INT_STORE_STOCK_ID, stock_id,
|
||||
-1);
|
||||
|
||||
if (stock_id)
|
||||
g_free (stock_id);
|
||||
}
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpenumstore.h
|
||||
* Copyright (C) 2004 Sven Neumann <sven@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_ENUM_STORE_H__
|
||||
#define __GIMP_ENUM_STORE_H__
|
||||
|
||||
#include <libgimpwidgets/gimpintstore.h>
|
||||
|
||||
|
||||
#define GIMP_TYPE_ENUM_STORE (gimp_enum_store_get_type ())
|
||||
#define GIMP_ENUM_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_ENUM_STORE, GimpEnumStore))
|
||||
#define GIMP_ENUM_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_ENUM_STORE, GimpEnumStoreClass))
|
||||
#define GIMP_IS_ENUM_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_ENUM_STORE))
|
||||
#define GIMP_IS_ENUM_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_ENUM_STORE))
|
||||
#define GIMP_ENUM_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_ENUM_STORE, GimpEnumStoreClass))
|
||||
|
||||
|
||||
typedef struct _GimpEnumStoreClass GimpEnumStoreClass;
|
||||
|
||||
struct _GimpEnumStoreClass
|
||||
{
|
||||
GimpIntStoreClass parent_instance;
|
||||
};
|
||||
|
||||
struct _GimpEnumStore
|
||||
{
|
||||
GimpIntStore parent_instance;
|
||||
|
||||
GEnumClass *enum_class;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_enum_store_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkListStore * gimp_enum_store_new (GType enum_type);
|
||||
GtkListStore * gimp_enum_store_new_with_range (GType enum_type,
|
||||
gint minimum,
|
||||
gint maximum);
|
||||
GtkListStore * gimp_enum_store_new_with_values (GType enum_type,
|
||||
gint n_values,
|
||||
...);
|
||||
GtkListStore * gimp_enum_store_new_with_values_valist (GType enum_type,
|
||||
gint n_values,
|
||||
va_list args);
|
||||
|
||||
void gimp_enum_store_set_stock_prefix (GimpEnumStore *store,
|
||||
const gchar *stock_prefix);
|
||||
|
||||
|
||||
#endif /* __GIMP_ENUM_STORE_H__ */
|
|
@ -35,8 +35,6 @@
|
|||
#include "core/gimpimage.h"
|
||||
|
||||
#include "gimpdocked.h"
|
||||
#include "gimpenumcombobox.h"
|
||||
#include "gimpenumstore.h"
|
||||
#include "gimphelp-ids.h"
|
||||
#include "gimphistogrambox.h"
|
||||
#include "gimphistogrameditor.h"
|
||||
|
|
|
@ -40,8 +40,6 @@
|
|||
|
||||
#include "gimpcolorpanel.h"
|
||||
#include "gimpdnd.h"
|
||||
#include "gimpenumcombobox.h"
|
||||
#include "gimpenumstore.h"
|
||||
#include "gimpenumwidgets.h"
|
||||
#include "gimpview.h"
|
||||
#include "gimppropwidgets.h"
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "core/gimpstrokeoptions.h"
|
||||
|
||||
#include "gimpdasheditor.h"
|
||||
#include "gimpenumcombobox.h"
|
||||
#include "gimppropwidgets.h"
|
||||
#include "gimpstrokeeditor.h"
|
||||
|
||||
|
|
|
@ -193,8 +193,6 @@ typedef struct _GimpCellRendererViewable GimpCellRendererViewable;
|
|||
/* misc utilities & constructors */
|
||||
|
||||
typedef struct _GimpDialogFactory GimpDialogFactory;
|
||||
typedef struct _GimpEnumStore GimpEnumStore;
|
||||
typedef struct _GimpEnumComboBox GimpEnumComboBox;
|
||||
typedef struct _GimpUnitStore GimpUnitStore;
|
||||
typedef struct _GimpUnitComboBox GimpUnitComboBox;
|
||||
|
||||
|
|
|
@ -96,6 +96,10 @@ libgimpwidgets_2_0_la_sources = \
|
|||
gimpcontroller.h \
|
||||
gimpdialog.c \
|
||||
gimpdialog.h \
|
||||
gimpenumstore.c \
|
||||
gimpenumstore.h \
|
||||
gimpenumcombobox.c \
|
||||
gimpenumcombobox.h \
|
||||
gimpfileentry.c \
|
||||
gimpfileentry.h \
|
||||
gimpframe.c \
|
||||
|
|
|
@ -1,36 +1,35 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
/* LIBGIMP - The GIMP Library
|
||||
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||
*
|
||||
* gimpenumcombobox.c
|
||||
* gimpenumcombobox.h
|
||||
* Copyright (C) 2004 Sven Neumann <sven@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 library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser 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,
|
||||
* This library 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.
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser 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.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "widgets-types.h"
|
||||
#include "gimpwidgetstypes.h"
|
||||
|
||||
#include "gimpenumcombobox.h"
|
||||
#include "gimpenumstore.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
#include "libgimp/libgimp-intl.h"
|
||||
|
||||
|
||||
GType
|
||||
|
@ -74,6 +73,8 @@ gimp_enum_combo_box_get_type (void)
|
|||
* own #GimpEnumStore and use gimp_enum_combo_box_new_with_model().
|
||||
*
|
||||
* Return value: a new #GimpEnumComboBox.
|
||||
*
|
||||
* Since: GIMP 2.4
|
||||
**/
|
||||
GtkWidget *
|
||||
gimp_enum_combo_box_new (GType enum_type)
|
||||
|
@ -101,6 +102,8 @@ gimp_enum_combo_box_new (GType enum_type)
|
|||
*
|
||||
* Attempts to create and set icons for all items in the
|
||||
* @combo_box. See gimp_enum_store_set_icons() for more info.
|
||||
*
|
||||
* Since: GIMP 2.4
|
||||
**/
|
||||
void
|
||||
gimp_enum_combo_box_set_stock_prefix (GimpEnumComboBox *combo_box,
|
||||
|
@ -135,6 +138,9 @@ gimp_enum_combo_box_set_stock_prefix (GimpEnumComboBox *combo_box,
|
|||
* #GtkComboBox to set the sensitivity of it's items (bug #135875).
|
||||
* It should be removed as soon as this bug is fixed (probably with
|
||||
* GTK+-2.6).
|
||||
*
|
||||
* This function is only temporarily in GIMP 2.3, it will not become
|
||||
* part of the GIMP 2.0 API!!
|
||||
**/
|
||||
void
|
||||
gimp_enum_combo_box_set_visible (GimpEnumComboBox *combo_box,
|
||||
|
|
|
@ -1,22 +1,23 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
/* LIBGIMP - The GIMP Library
|
||||
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||
*
|
||||
* gimpenumcombobox.h
|
||||
* Copyright (C) 2004 Sven Neumann <sven@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 library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser 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,
|
||||
* This library 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.
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser 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.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_ENUM_COMBO_BOX_H__
|
||||
|
|
|
@ -1,22 +1,23 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
/* LIBGIMP - The GIMP Library
|
||||
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||
*
|
||||
* gimpenumstore.c
|
||||
* Copyright (C) 2004 Sven Neumann <sven@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 library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser 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,
|
||||
* This library 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.
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser 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.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -24,9 +25,8 @@
|
|||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "widgets-types.h"
|
||||
#include "gimpwidgetstypes.h"
|
||||
|
||||
#include "gimpenumstore.h"
|
||||
|
||||
|
@ -117,6 +117,8 @@ gimp_enum_store_add_value (GtkListStore *store,
|
|||
* system and should have translatable value names.
|
||||
*
|
||||
* Return value: a new #GimpEnumStore.
|
||||
*
|
||||
* Since: GIMP 2.4
|
||||
**/
|
||||
GtkListStore *
|
||||
gimp_enum_store_new (GType enum_type)
|
||||
|
@ -147,6 +149,8 @@ gimp_enum_store_new (GType enum_type)
|
|||
* to limit the enum values to a certain range.
|
||||
*
|
||||
* Return value: a new #GimpEnumStore.
|
||||
*
|
||||
* Since: GIMP 2.4
|
||||
**/
|
||||
GtkListStore *
|
||||
gimp_enum_store_new_with_range (GType enum_type,
|
||||
|
@ -185,6 +189,8 @@ gimp_enum_store_new_with_range (GType enum_type,
|
|||
* to list the enum values that should be added to the store.
|
||||
*
|
||||
* Return value: a new #GimpEnumStore.
|
||||
*
|
||||
* Since: GIMP 2.4
|
||||
**/
|
||||
GtkListStore *
|
||||
gimp_enum_store_new_with_values (GType enum_type,
|
||||
|
@ -214,6 +220,8 @@ gimp_enum_store_new_with_values (GType enum_type,
|
|||
* See gimp_enum_store_new_with_values().
|
||||
*
|
||||
* Return value: a new #GimpEnumStore.
|
||||
*
|
||||
* Since: GIMP 2.4
|
||||
**/
|
||||
GtkListStore *
|
||||
gimp_enum_store_new_with_values_valist (GType enum_type,
|
||||
|
@ -251,6 +259,8 @@ gimp_enum_store_new_with_values_valist (GType enum_type,
|
|||
* Creates a stock ID for each enum value in the @store by appending
|
||||
* the value's nick to the given @stock_prefix inserting a hyphen
|
||||
* between them.
|
||||
*
|
||||
* Since: GIMP 2.4
|
||||
**/
|
||||
void
|
||||
gimp_enum_store_set_stock_prefix (GimpEnumStore *store,
|
||||
|
|
|
@ -1,22 +1,23 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
/* LIBGIMP - The GIMP Library
|
||||
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||
*
|
||||
* gimpenumstore.h
|
||||
* gimpintstore.c
|
||||
* Copyright (C) 2004 Sven Neumann <sven@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 library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser 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,
|
||||
* This library 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.
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser 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.
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_ENUM_STORE_H__
|
||||
|
|
|
@ -40,8 +40,6 @@
|
|||
|
||||
#include "gimpcolorpanel.h"
|
||||
#include "gimpdnd.h"
|
||||
#include "gimpenumcombobox.h"
|
||||
#include "gimpenumstore.h"
|
||||
#include "gimpenumwidgets.h"
|
||||
#include "gimpview.h"
|
||||
#include "gimppropwidgets.h"
|
||||
|
|
|
@ -94,6 +94,16 @@ EXPORTS
|
|||
gimp_dialog_run
|
||||
gimp_dialogs_show_help_button
|
||||
gimp_double_adjustment_update
|
||||
gimp_enum_combo_box_get_type
|
||||
gimp_enum_combo_box_new
|
||||
gimp_enum_combo_box_set_stock_prefix
|
||||
gimp_enum_combo_box_set_visible
|
||||
gimp_enum_store_get_type
|
||||
gimp_enum_store_new_with_range
|
||||
gimp_enum_store_new
|
||||
gimp_enum_store_new_with_values_valist
|
||||
gimp_enum_store_new_with_values
|
||||
gimp_enum_store_set_stock_prefix
|
||||
gimp_file_entry_get_filename
|
||||
gimp_file_entry_get_type
|
||||
gimp_file_entry_new
|
||||
|
|
|
@ -42,6 +42,8 @@
|
|||
#include <libgimpwidgets/gimpcolorselect.h>
|
||||
#include <libgimpwidgets/gimpcolorselection.h>
|
||||
#include <libgimpwidgets/gimpdialog.h>
|
||||
#include <libgimpwidgets/gimpenumcombobox.h>
|
||||
#include <libgimpwidgets/gimpenumstore.h>
|
||||
#include <libgimpwidgets/gimpfileentry.h>
|
||||
#include <libgimpwidgets/gimpframe.h>
|
||||
#include <libgimpwidgets/gimphelpui.h>
|
||||
|
|
|
@ -72,6 +72,8 @@ typedef struct _GimpColorSelect GimpColorSelect;
|
|||
typedef struct _GimpColorSelection GimpColorSelection;
|
||||
typedef struct _GimpController GimpController;
|
||||
typedef struct _GimpDialog GimpDialog;
|
||||
typedef struct _GimpEnumStore GimpEnumStore;
|
||||
typedef struct _GimpEnumComboBox GimpEnumComboBox;
|
||||
typedef struct _GimpFileEntry GimpFileEntry;
|
||||
typedef struct _GimpFrame GimpFrame;
|
||||
typedef struct _GimpIntComboBox GimpIntComboBox;
|
||||
|
|
Loading…
Reference in New Issue