Commit 24b3e080 authored by Manish Singh's avatar Manish Singh Committed by Manish Singh
Browse files

whitespace fix.

2005-06-03  Manish Singh  <yosh@gimp.org>

        * libgimpcolor/gimprgb.h: whitespace fix.

        * libgimpwidgets/gimpchainbutton.h
        * libgimpwidgets/gimpwidgetsenums.[ch]: move GimpChainPosition
        to a registered enum, and register GimpSizeEntryUpdatePolicy as
        as well.

        * libgimp/gimpuitypes.h
        * libgimp/gimpdrawablecombobox.[ch]: turn these into GObjects
        with their own types.

        * libgimp/gimpimagecombobox.c: use G_DEFINE_TYPE.
parent b77ca997
2005-06-03 Manish Singh <yosh@gimp.org>
* libgimpcolor/gimprgb.h: whitespace fix.
* libgimpwidgets/gimpchainbutton.h
* libgimpwidgets/gimpwidgetsenums.[ch]: move GimpChainPosition
to a registered enum, and register GimpSizeEntryUpdatePolicy as
as well.
* libgimp/gimpuitypes.h
* libgimp/gimpdrawablecombobox.[ch]: turn these into GObjects
with their own types.
* libgimp/gimpimagecombobox.c: use G_DEFINE_TYPE.
2005-06-03 Manish Singh <yosh@gimp.org>
* tools/pdbgen/enumcode.pl: make _gimp_enums_init public, so
......
......@@ -30,6 +30,7 @@
#include "gimp.h"
#include "gimpuitypes.h"
#include "gimpdrawablecombobox.h"
#include "gimppixbuf.h"
......@@ -38,7 +39,42 @@
#define WIDTH_REQUEST 200
static gint gimp_drawable_combo_box_model_add (GtkListStore *store,
typedef struct _GimpDrawableComboBoxClass GimpDrawableComboBoxClass;
typedef struct _GimpChannelComboBoxClass GimpChannelComboBoxClass;
typedef struct _GimpLayerComboBoxClass GimpLayerComboBoxClass;
struct _GimpDrawableComboBox
{
GimpIntComboBox parent_instance;
};
struct _GimpDrawableComboBoxClass
{
GimpIntComboBoxClass parent_class;
};
struct _GimpChannelComboBox
{
GimpIntComboBox parent_instance;
};
struct _GimpChannelComboBoxClass
{
GimpIntComboBoxClass parent_class;
};
struct _GimpLayerComboBox
{
GimpIntComboBox parent_instance;
};
struct _GimpLayerComboBoxClass
{
GimpIntComboBoxClass parent_class;
};
static void gimp_drawable_combo_box_model_add (GtkListStore *store,
gint32 image,
gint num_drawables,
gint32 *drawables,
......@@ -61,6 +97,31 @@ static const GtkTargetEntry targets[] =
};
G_DEFINE_TYPE(GimpDrawableComboBox,
gimp_drawable_combo_box,
GIMP_TYPE_INT_COMBO_BOX);
static void
gimp_drawable_combo_box_class_init (GimpDrawableComboBoxClass *klass)
{
GtkWidgetClass *widget_class;
widget_class = GTK_WIDGET_CLASS (klass);
widget_class->drag_data_received = gimp_drawable_combo_box_drag_data_received;
}
static void
gimp_drawable_combo_box_init (GimpDrawableComboBox *combo_box)
{
gtk_drag_dest_set (GTK_WIDGET (combo_box),
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
targets, 2,
GDK_ACTION_COPY);
}
/**
* gimp_drawable_combo_box_new:
* @constraint: a #GimpDrawableConstraintFunc or %NULL
......@@ -91,7 +152,7 @@ gimp_drawable_combo_box_new (GimpDrawableConstraintFunc constraint,
gint num_images;
gint i;
combo_box = g_object_new (GIMP_TYPE_INT_COMBO_BOX,
combo_box = g_object_new (GIMP_TYPE_DRAWABLE_COMBO_BOX,
"width-request", WIDTH_REQUEST,
"ellipsize", PANGO_ELLIPSIZE_MIDDLE,
NULL);
......@@ -125,18 +186,33 @@ gimp_drawable_combo_box_new (GimpDrawableConstraintFunc constraint,
if (gtk_tree_model_get_iter_first (model, &iter))
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box), &iter);
gtk_drag_dest_set (combo_box,
return combo_box;
}
G_DEFINE_TYPE(GimpChannelComboBox,
gimp_channel_combo_box,
GIMP_TYPE_INT_COMBO_BOX);
static void
gimp_channel_combo_box_class_init (GimpChannelComboBoxClass *klass)
{
GtkWidgetClass *widget_class;
widget_class = GTK_WIDGET_CLASS (klass);
widget_class->drag_data_received = gimp_drawable_combo_box_drag_data_received;
}
static void
gimp_channel_combo_box_init (GimpChannelComboBox *combo_box)
{
gtk_drag_dest_set (GTK_WIDGET (combo_box),
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
targets, 2,
targets, 1,
GDK_ACTION_COPY);
g_signal_connect (combo_box, "drag-data-received",
G_CALLBACK (gimp_drawable_combo_box_drag_data_received),
NULL);
return combo_box;
}
/**
......@@ -162,7 +238,7 @@ gimp_channel_combo_box_new (GimpDrawableConstraintFunc constraint,
gint num_images;
gint i;
combo_box = g_object_new (GIMP_TYPE_INT_COMBO_BOX,
combo_box = g_object_new (GIMP_TYPE_CHANNEL_COMBO_BOX,
"width-request", WIDTH_REQUEST,
"ellipsize", PANGO_ELLIPSIZE_MIDDLE,
NULL);
......@@ -189,18 +265,33 @@ gimp_channel_combo_box_new (GimpDrawableConstraintFunc constraint,
if (gtk_tree_model_get_iter_first (model, &iter))
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box), &iter);
gtk_drag_dest_set (combo_box,
return combo_box;
}
G_DEFINE_TYPE(GimpLayerComboBox,
gimp_layer_combo_box,
GIMP_TYPE_INT_COMBO_BOX);
static void
gimp_layer_combo_box_class_init (GimpLayerComboBoxClass *klass)
{
GtkWidgetClass *widget_class;
widget_class = GTK_WIDGET_CLASS (klass);
widget_class->drag_data_received = gimp_drawable_combo_box_drag_data_received;
}
static void
gimp_layer_combo_box_init (GimpLayerComboBox *combo_box)
{
gtk_drag_dest_set (GTK_WIDGET (combo_box),
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
targets, 1,
targets + 1, 1,
GDK_ACTION_COPY);
g_signal_connect (combo_box, "drag-data-received",
G_CALLBACK (gimp_drawable_combo_box_drag_data_received),
NULL);
return combo_box;
}
/**
......@@ -226,7 +317,7 @@ gimp_layer_combo_box_new (GimpDrawableConstraintFunc constraint,
gint num_images;
gint i;
combo_box = g_object_new (GIMP_TYPE_INT_COMBO_BOX,
combo_box = g_object_new (GIMP_TYPE_CHANNEL_COMBO_BOX,
"width-request", WIDTH_REQUEST,
"ellipsize", PANGO_ELLIPSIZE_MIDDLE,
NULL);
......@@ -253,21 +344,10 @@ gimp_layer_combo_box_new (GimpDrawableConstraintFunc constraint,
if (gtk_tree_model_get_iter_first (model, &iter))
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box), &iter);
gtk_drag_dest_set (combo_box,
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
targets + 1, 1,
GDK_ACTION_COPY);
g_signal_connect (combo_box, "drag-data-received",
G_CALLBACK (gimp_drawable_combo_box_drag_data_received),
NULL);
return combo_box;
}
static gint
static void
gimp_drawable_combo_box_model_add (GtkListStore *store,
gint32 image,
gint num_drawables,
......@@ -276,7 +356,6 @@ gimp_drawable_combo_box_model_add (GtkListStore *store,
gpointer data)
{
GtkTreeIter iter;
gint added = 0;
gint i;
for (i = 0; i < num_drawables; i++)
......@@ -305,7 +384,6 @@ gimp_drawable_combo_box_model_add (GtkListStore *store,
GIMP_INT_STORE_LABEL, label,
GIMP_INT_STORE_PIXBUF, thumb,
-1);
added++;
if (thumb)
g_object_unref (thumb);
......@@ -313,8 +391,6 @@ gimp_drawable_combo_box_model_add (GtkListStore *store,
g_free (label);
}
}
return added;
}
static void
......
......@@ -29,11 +29,28 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
#define GIMP_TYPE_DRAWABLE_COMBO_BOX (gimp_drawable_combo_box_get_type ())
#define GIMP_DRAWABLE_COMBO_BOX (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DRAWABLE_COMBO_BOX, GimpDrawableComboBox))
#define GIMP_IS_DRAWABLE_COMBO_BOX (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DRAWABLE_COMBO_BOX)
#define GIMP_TYPE_CHANNEL_COMBO_BOX (gimp_channel_combo_box_get_type ())
#define GIMP_CHANNEL_COMBO_BOX (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CHANNEL_COMBO_BOX, GimpChannelComboBox))
#define GIMP_IS_CHANNEL_COMBO_BOX (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CHANNEL_COMBO_BOX)
#define GIMP_TYPE_LAYER_COMBO_BOX (gimp_layer_combo_box_get_type ())
#define GIMP_LAYER_COMBO_BOX (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_LAYER_COMBO_BOX, GimpLayerComboBox))
#define GIMP_IS_LAYER_COMBO_BOX (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_LAYER_COMBO_BOX)
typedef gboolean (* GimpDrawableConstraintFunc) (gint32 image_id,
gint32 drawable_id,
gpointer data);
GType gimp_drawable_combo_box_get_type (void) G_GNUC_CONST;
GType gimp_channel_combo_box_get_type (void) G_GNUC_CONST;
GType gimp_layer_combo_box_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_drawable_combo_box_new (GimpDrawableConstraintFunc constraint,
gpointer data);
GtkWidget * gimp_channel_combo_box_new (GimpDrawableConstraintFunc constraint,
......
......@@ -52,9 +52,6 @@ struct _GimpImageComboBoxClass
};
static void gimp_image_combo_box_class_init (GimpImageComboBoxClass *klass);
static void gimp_image_combo_box_init (GimpImageComboBox *combo_box);
static void gimp_image_combo_box_model_add (GtkListStore *store,
gint num_images,
gint32 *images,
......@@ -73,34 +70,9 @@ static void gimp_image_combo_box_drag_data_received (GtkWidget *widget,
static const GtkTargetEntry target = { "application/x-gimp-image-id", 0 };
GType
gimp_image_combo_box_get_type (void)
{
static GType combo_box_type = 0;
if (!combo_box_type)
{
static const GTypeInfo combo_box_info =
{
sizeof (GimpImageComboBoxClass),
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gimp_image_combo_box_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpImageComboBox),
0,
(GInstanceInitFunc) gimp_image_combo_box_init
};
combo_box_type = g_type_register_static (GIMP_TYPE_INT_COMBO_BOX,
"GimpImageComboBox",
&combo_box_info,
0);
}
return combo_box_type;
}
G_DEFINE_TYPE(GimpImageComboBox,
gimp_image_combo_box,
GIMP_TYPE_INT_COMBO_BOX);
static void
gimp_image_combo_box_class_init (GimpImageComboBoxClass *klass)
......
......@@ -30,6 +30,7 @@
#include "gimp.h"
#include "gimpuitypes.h"
#include "gimpdrawablecombobox.h"
#include "gimppixbuf.h"
......@@ -38,7 +39,42 @@
#define WIDTH_REQUEST 200
static gint gimp_drawable_combo_box_model_add (GtkListStore *store,
typedef struct _GimpDrawableComboBoxClass GimpDrawableComboBoxClass;
typedef struct _GimpChannelComboBoxClass GimpChannelComboBoxClass;
typedef struct _GimpLayerComboBoxClass GimpLayerComboBoxClass;
struct _GimpDrawableComboBox
{
GimpIntComboBox parent_instance;
};
struct _GimpDrawableComboBoxClass
{
GimpIntComboBoxClass parent_class;
};
struct _GimpChannelComboBox
{
GimpIntComboBox parent_instance;
};
struct _GimpChannelComboBoxClass
{
GimpIntComboBoxClass parent_class;
};
struct _GimpLayerComboBox
{
GimpIntComboBox parent_instance;
};
struct _GimpLayerComboBoxClass
{
GimpIntComboBoxClass parent_class;
};
static void gimp_drawable_combo_box_model_add (GtkListStore *store,
gint32 image,
gint num_drawables,
gint32 *drawables,
......@@ -61,6 +97,31 @@ static const GtkTargetEntry targets[] =
};
G_DEFINE_TYPE(GimpDrawableComboBox,
gimp_drawable_combo_box,
GIMP_TYPE_INT_COMBO_BOX);
static void
gimp_drawable_combo_box_class_init (GimpDrawableComboBoxClass *klass)
{
GtkWidgetClass *widget_class;
widget_class = GTK_WIDGET_CLASS (klass);
widget_class->drag_data_received = gimp_drawable_combo_box_drag_data_received;
}
static void
gimp_drawable_combo_box_init (GimpDrawableComboBox *combo_box)
{
gtk_drag_dest_set (GTK_WIDGET (combo_box),
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
targets, 2,
GDK_ACTION_COPY);
}
/**
* gimp_drawable_combo_box_new:
* @constraint: a #GimpDrawableConstraintFunc or %NULL
......@@ -91,7 +152,7 @@ gimp_drawable_combo_box_new (GimpDrawableConstraintFunc constraint,
gint num_images;
gint i;
combo_box = g_object_new (GIMP_TYPE_INT_COMBO_BOX,
combo_box = g_object_new (GIMP_TYPE_DRAWABLE_COMBO_BOX,
"width-request", WIDTH_REQUEST,
"ellipsize", PANGO_ELLIPSIZE_MIDDLE,
NULL);
......@@ -125,18 +186,33 @@ gimp_drawable_combo_box_new (GimpDrawableConstraintFunc constraint,
if (gtk_tree_model_get_iter_first (model, &iter))
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box), &iter);
gtk_drag_dest_set (combo_box,
return combo_box;
}
G_DEFINE_TYPE(GimpChannelComboBox,
gimp_channel_combo_box,
GIMP_TYPE_INT_COMBO_BOX);
static void
gimp_channel_combo_box_class_init (GimpChannelComboBoxClass *klass)
{
GtkWidgetClass *widget_class;
widget_class = GTK_WIDGET_CLASS (klass);
widget_class->drag_data_received = gimp_drawable_combo_box_drag_data_received;
}
static void
gimp_channel_combo_box_init (GimpChannelComboBox *combo_box)
{
gtk_drag_dest_set (GTK_WIDGET (combo_box),
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
targets, 2,
targets, 1,
GDK_ACTION_COPY);
g_signal_connect (combo_box, "drag-data-received",
G_CALLBACK (gimp_drawable_combo_box_drag_data_received),
NULL);
return combo_box;
}
/**
......@@ -162,7 +238,7 @@ gimp_channel_combo_box_new (GimpDrawableConstraintFunc constraint,
gint num_images;
gint i;
combo_box = g_object_new (GIMP_TYPE_INT_COMBO_BOX,
combo_box = g_object_new (GIMP_TYPE_CHANNEL_COMBO_BOX,
"width-request", WIDTH_REQUEST,
"ellipsize", PANGO_ELLIPSIZE_MIDDLE,
NULL);
......@@ -189,18 +265,33 @@ gimp_channel_combo_box_new (GimpDrawableConstraintFunc constraint,
if (gtk_tree_model_get_iter_first (model, &iter))
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box), &iter);
gtk_drag_dest_set (combo_box,
return combo_box;
}
G_DEFINE_TYPE(GimpLayerComboBox,
gimp_layer_combo_box,
GIMP_TYPE_INT_COMBO_BOX);
static void
gimp_layer_combo_box_class_init (GimpLayerComboBoxClass *klass)
{
GtkWidgetClass *widget_class;
widget_class = GTK_WIDGET_CLASS (klass);
widget_class->drag_data_received = gimp_drawable_combo_box_drag_data_received;
}
static void
gimp_layer_combo_box_init (GimpLayerComboBox *combo_box)
{
gtk_drag_dest_set (GTK_WIDGET (combo_box),
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
targets, 1,
targets + 1, 1,
GDK_ACTION_COPY);
g_signal_connect (combo_box, "drag-data-received",
G_CALLBACK (gimp_drawable_combo_box_drag_data_received),
NULL);
return combo_box;
}
/**
......@@ -226,7 +317,7 @@ gimp_layer_combo_box_new (GimpDrawableConstraintFunc constraint,
gint num_images;
gint i;
combo_box = g_object_new (GIMP_TYPE_INT_COMBO_BOX,
combo_box = g_object_new (GIMP_TYPE_CHANNEL_COMBO_BOX,
"width-request", WIDTH_REQUEST,
"ellipsize", PANGO_ELLIPSIZE_MIDDLE,
NULL);
......@@ -253,21 +344,10 @@ gimp_layer_combo_box_new (GimpDrawableConstraintFunc constraint,
if (gtk_tree_model_get_iter_first (model, &iter))
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box), &iter);
gtk_drag_dest_set (combo_box,
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
targets + 1, 1,
GDK_ACTION_COPY);
g_signal_connect (combo_box, "drag-data-received",
G_CALLBACK (gimp_drawable_combo_box_drag_data_received),
NULL);
return combo_box;
}
static gint
static void
gimp_drawable_combo_box_model_add (GtkListStore *store,
gint32 image,
gint num_drawables,
......@@ -276,7 +356,6 @@ gimp_drawable_combo_box_model_add (GtkListStore *store,
gpointer data)
{
GtkTreeIter iter;
gint added = 0;
gint i;
for (i = 0; i < num_drawables; i++)
......@@ -305,7 +384,6 @@ gimp_drawable_combo_box_model_add (GtkListStore *store,
GIMP_INT_STORE_LABEL, label,
GIMP_INT_STORE_PIXBUF, thumb,
-1);
added++;
if (thumb)
g_object_unref (thumb);
......@@ -313,8 +391,6 @@ gimp_drawable_combo_box_model_add (GtkListStore *store,
g_free (label);
}
}
return added;
}
static void
......
......@@ -29,11 +29,28 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
#define GIMP_TYPE_DRAWABLE_COMBO_BOX (gimp_drawable_combo_box_get_type ())
#define GIMP_DRAWABLE_COMBO_BOX (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DRAWABLE_COMBO_BOX, GimpDrawableComboBox))
#define GIMP_IS_DRAWABLE_COMBO_BOX (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DRAWABLE_COMBO_BOX)
#define GIMP_TYPE_CHANNEL_COMBO_BOX (gimp_channel_combo_box_get_type ())
#define GIMP_CHANNEL_COMBO_BOX (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CHANNEL_COMBO_BOX, GimpChannelComboBox))
#define GIMP_IS_CHANNEL_COMBO_BOX (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CHANNEL_COMBO_BOX)
#define GIMP_TYPE_LAYER_COMBO_BOX (gimp_layer_combo_box_get_type ())
#define GIMP_LAYER_COMBO_BOX (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_LAYER_COMBO_BOX, GimpLayerComboBox))
#define GIMP_IS_LAYER_COMBO_BOX (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_LAYER_COMBO_BOX)
typedef gboolean (* GimpDrawableConstraintFunc) (gint32 image_id,
gint32 drawable_id,
gpointer data);
GType gimp_drawable_combo_box_get_type (void) G_GNUC_CONST;
GType gimp_channel_combo_box_get_type (void) G_GNUC_CONST;
GType gimp_layer_combo_box_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_drawable_combo_box_new (GimpDrawableConstraintFunc constraint,
gpointer data);
GtkWidget * gimp_channel_combo_box_new (GimpDrawableConstraintFunc constraint,
......
......@@ -31,9 +31,13 @@ G_BEGIN_DECLS
typedef struct _GimpAspectPreview GimpAspectPreview;
typedef struct _GimpDrawablePreview GimpDrawablePreview;
typedef struct _GimpImageComboBox GimpImageComboBox;
typedef struct _GimpProgressBar GimpProgressBar;
typedef struct _GimpImageComboBox GimpImageComboBox;
typedef struct _GimpDrawableComboBox GimpDrawableComboBox;
typedef struct _GimpChannelComboBox GimpChannelComboBox;
typedef struct _GimpLayerComboBox GimpLayerComboBox;
G_END_DECLS
......
......@@ -121,7 +121,7 @@ void gimp_rgba_set_uchar (GimpRGB *rgba,
guchar red,
guchar green,
guchar blue,
guchar alpha);
guchar alpha);
void gimp_rgba_get_uchar (const GimpRGB *rgba,
guchar *red,
guchar *green,
......
......@@ -36,15 +36,6 @@
G_BEGIN_DECLS
typedef enum
{
GIMP_CHAIN_TOP,
GIMP_CHAIN_LEFT,
GIMP_CHAIN_BOTTOM,