[gimp/soc-2011-gimpunitentry: 50/68] libgimpwidgets: rename GimpUnitEntryTable to GimpUnitEntries
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/soc-2011-gimpunitentry: 50/68] libgimpwidgets: rename GimpUnitEntryTable to GimpUnitEntries
- Date: Fri, 13 Sep 2013 19:58:10 +0000 (UTC)
commit 56b87a684537149e72e81e867a9bdf551bd60aba
Author: Enrico Schröder <enni schroeder gmail com>
Date: Sun Jul 17 00:58:30 2011 +0200
libgimpwidgets: rename GimpUnitEntryTable to GimpUnitEntries
app/actions/layers-commands.c | 4 +-
app/dialogs/image-new-dialog.c | 8 +-
app/dialogs/layer-options-dialog.c | 12 +-
app/dialogs/layer-options-dialog.h | 2 +-
app/dialogs/preferences-dialog.c | 34 +-
app/dialogs/resolution-calibrate-dialog.c | 34 +-
app/widgets/gimpgrideditor.c | 26 +-
app/widgets/gimpgrideditor.h | 2 +-
app/widgets/gimptemplateeditor.c | 42 ++--
app/widgets/gimptemplateeditor.h | 2 +-
libgimpwidgets/Makefile.am | 4 +-
libgimpwidgets/gimppropwidgets.c | 134 ++++----
libgimpwidgets/gimppropwidgets.h | 2 +-
libgimpwidgets/gimpunitentries.c | 506 +++++++++++++++++++++++++++++
libgimpwidgets/gimpunitentries.h | 118 +++++++
libgimpwidgets/gimpunitentrytable.c | 506 -----------------------------
libgimpwidgets/gimpunitentrytable.h | 121 -------
libgimpwidgets/gimpwidgets.def | 44 ++--
libgimpwidgets/gimpwidgets.h | 2 +-
libgimpwidgets/test-unitentrygui.c | 32 +-
20 files changed, 816 insertions(+), 819 deletions(-)
---
diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c
index 579979d..6c7eaa6 100644
--- a/app/actions/layers-commands.c
+++ b/app/actions/layers-commands.c
@@ -1020,10 +1020,10 @@ layers_new_layer_response (GtkWidget *widget,
layer_fill_type = dialog->fill_type;
dialog->xsize =
- RINT (gimp_unit_entry_table_get_pixels (dialog->unit_entries, "width"));
+ RINT (gimp_unit_entries_get_pixels (dialog->unit_entries, "width"));
dialog->ysize =
- RINT (gimp_unit_entry_table_get_pixels (dialog->unit_entries, "height"));
+ RINT (gimp_unit_entries_get_pixels (dialog->unit_entries, "height"));
layer = gimp_layer_new (dialog->image,
dialog->xsize,
diff --git a/app/dialogs/image-new-dialog.c b/app/dialogs/image-new-dialog.c
index 64ddf06..bfc871d 100644
--- a/app/dialogs/image-new-dialog.c
+++ b/app/dialogs/image-new-dialog.c
@@ -83,7 +83,7 @@ image_new_dialog_new (GimpContext *context)
ImageNewDialog *dialog;
GtkWidget *main_vbox;
GtkWidget *table;
- GimpUnitEntryTable *unit_entry_table;
+ GimpUnitEntries *unit_entries;
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
@@ -158,9 +158,9 @@ image_new_dialog_new (GimpContext *context)
gtk_box_pack_start (GTK_BOX (main_vbox), dialog->editor, FALSE, FALSE, 0);
gtk_widget_show (dialog->editor);
- unit_entry_table = gimp_template_editor_get_unit_entries (GIMP_TEMPLATE_EDITOR (dialog->editor));
- gimp_unit_entry_table_set_activates_default (unit_entry_table, TRUE);
- gimp_unit_entry_table_grab_focus (unit_entry_table);
+ unit_entries = gimp_template_editor_get_unit_entries (GIMP_TEMPLATE_EDITOR (dialog->editor));
+ gimp_unit_entries_set_activates_default (unit_entries, TRUE);
+ gimp_unit_entries_grab_focus (unit_entries);
image_new_template_changed (dialog->context,
gimp_context_get_template (dialog->context),
diff --git a/app/dialogs/layer-options-dialog.c b/app/dialogs/layer-options-dialog.c
index bd736c3..8e32c65 100644
--- a/app/dialogs/layer-options-dialog.c
+++ b/app/dialogs/layer-options-dialog.c
@@ -138,10 +138,10 @@ layer_options_dialog_new (GimpImage *image,
gimp_image_get_resolution (image, &xres, &yres);
/* UnitEntry */
- options->unit_entries = GIMP_UNIT_ENTRY_TABLE (gimp_unit_entry_table_new ());
- width_entry = gimp_unit_entry_table_add_entry_defaults (options->unit_entries, "width", _("Width:"));
- height_entry = gimp_unit_entry_table_add_entry_defaults (options->unit_entries, "height",
_("Height:"));
- gimp_unit_entry_table_add_label (options->unit_entries, GIMP_UNIT_PIXEL, "width", "height");
+ options->unit_entries = GIMP_UNIT_ENTRIES (gimp_unit_entries_new ());
+ width_entry = gimp_unit_entries_add_entry_defaults (options->unit_entries, "width", _("Width:"));
+ height_entry = gimp_unit_entries_add_entry_defaults (options->unit_entries, "height", _("Height:"));
+ gimp_unit_entries_add_label (options->unit_entries, GIMP_UNIT_PIXEL, "width", "height");
gimp_unit_entry_set_unit (GIMP_UNIT_ENTRY (width_entry), GIMP_UNIT_PIXEL);
@@ -152,9 +152,9 @@ layer_options_dialog_new (GimpImage *image,
gimp_unit_entry_set_bounds (GIMP_UNIT_ENTRY (width_entry), GIMP_UNIT_PIXEL, GIMP_MAX_IMAGE_SIZE,
GIMP_MIN_IMAGE_SIZE);
gimp_unit_entry_set_bounds (GIMP_UNIT_ENTRY (height_entry), GIMP_UNIT_PIXEL, GIMP_MAX_IMAGE_SIZE,
GIMP_MIN_IMAGE_SIZE);
- gtk_table_attach (GTK_TABLE (table), gimp_unit_entry_table_get_table (options->unit_entries), 0, 2, 1,
3,
+ gtk_table_attach (GTK_TABLE (table), gimp_unit_entries_get_table (options->unit_entries), 0, 2, 1, 3,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
- gtk_widget_show (gimp_unit_entry_table_get_table (options->unit_entries));
+ gtk_widget_show (gimp_unit_entries_get_table (options->unit_entries));
/* The radio frame */
frame = gimp_enum_radio_frame_new_with_range (GIMP_TYPE_FILL_TYPE,
diff --git a/app/dialogs/layer-options-dialog.h b/app/dialogs/layer-options-dialog.h
index 5974cca..cd23050 100644
--- a/app/dialogs/layer-options-dialog.h
+++ b/app/dialogs/layer-options-dialog.h
@@ -26,7 +26,7 @@ struct _LayerOptionsDialog
{
GtkWidget *dialog;
GtkWidget *name_entry;
- GimpUnitEntryTable *unit_entries;
+ GimpUnitEntries *unit_entries;
GtkWidget *rename_toggle;
GimpFillType fill_type;
diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c
index 7279000..81e1dc6 100644
--- a/app/dialogs/preferences-dialog.c
+++ b/app/dialogs/preferences-dialog.c
@@ -451,17 +451,17 @@ prefs_resolution_source_callback (GtkWidget *widget,
}
else
{
- GimpUnitEntryTable *entries = GIMP_UNIT_ENTRY_TABLE (
- g_object_get_data (G_OBJECT (widget),
- "monitor_resolution_sizeentry"));
+ GimpUnitEntries *entries = GIMP_UNIT_ENTRIES (
+ g_object_get_data (G_OBJECT (widget),
+ "monitor_resolution_sizeentry"));
- g_return_if_fail (GIMP_IS_UNIT_ENTRY_TABLE (entries));
+ g_return_if_fail (GIMP_IS_UNIT_ENTRIES (entries));
xres = gimp_unit_entry_get_value_in_unit (
- gimp_unit_entry_table_get_nth_entry (entries, 0),
+ gimp_unit_entries_get_nth_entry (entries, 0),
GIMP_UNIT_PIXEL);
yres = gimp_unit_entry_get_value_in_unit (
- gimp_unit_entry_table_get_nth_entry (entries, 1),
+ gimp_unit_entries_get_nth_entry (entries, 1),
GIMP_UNIT_PIXEL);
}
@@ -480,8 +480,8 @@ prefs_resolution_calibrate_callback (GtkWidget *widget,
GtkWidget *prefs_box;
GtkWidget *image;
- dialog = gtk_widget_get_toplevel (gimp_unit_entry_table_get_table (
- GIMP_UNIT_ENTRY_TABLE (unit_entries)));
+ dialog = gtk_widget_get_toplevel (gimp_unit_entries_get_table (
+ GIMP_UNIT_ENTRIES (unit_entries)));
prefs_box = g_object_get_data (G_OBJECT (dialog), "prefs-box");
image = gimp_prefs_box_get_image (GIMP_PREFS_BOX (prefs_box));
@@ -1296,7 +1296,7 @@ prefs_dialog_new (Gimp *gimp,
GSList *group;
GtkWidget *editor;
gint i;
- GimpUnitEntryTable *unit_entry_table;
+ GimpUnitEntries *unit_entries;
GObject *object;
GimpCoreConfig *core_config;
@@ -2171,7 +2171,7 @@ prefs_dialog_new (Gimp *gimp,
GTK_CONTAINER (vbox), FALSE);
{
- unit_entry_table = GIMP_UNIT_ENTRY_TABLE (
+ unit_entries = GIMP_UNIT_ENTRIES (
gimp_prop_coordinates_new2 (object,
"monitor-xresolution",
"monitor-yresolution",
@@ -2180,15 +2180,15 @@ prefs_dialog_new (Gimp *gimp,
NULL,
1.0, 1.0, /* FIXME: UnitEntry needs 1.0 as "resolution of resolution"
, otherwise calculation is not correct */
TRUE));
- gimp_unit_entry_table_set_mode (unit_entry_table, GIMP_UNIT_ENTRY_MODE_RESOLUTION);
+ gimp_unit_entries_set_mode (unit_entries, GIMP_UNIT_ENTRY_MODE_RESOLUTION);
}
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_pack_start (GTK_BOX (hbox), unit_entry_table->table, TRUE, TRUE, 24);
- gtk_widget_show (unit_entry_table->table);
- gtk_widget_set_sensitive (unit_entry_table->table, ! display_config->monitor_res_from_gdk);
+ gtk_box_pack_start (GTK_BOX (hbox), unit_entries->table, TRUE, TRUE, 24);
+ gtk_widget_show (unit_entries->table);
+ gtk_widget_set_sensitive (unit_entries->table, ! display_config->monitor_res_from_gdk);
group = NULL;
@@ -2210,7 +2210,7 @@ prefs_dialog_new (Gimp *gimp,
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_widget_show (button);
- g_object_set_data (G_OBJECT (button), "monitor_resolution_sizeentry", unit_entry_table);
+ g_object_set_data (G_OBJECT (button), "monitor_resolution_sizeentry", unit_entries);
g_signal_connect (button, "toggled",
G_CALLBACK (prefs_resolution_source_callback),
@@ -2240,7 +2240,7 @@ prefs_dialog_new (Gimp *gimp,
! display_config->monitor_res_from_gdk);
g_object_bind_property (button, "active",
- unit_entry_table->table, "sensitive",
+ unit_entries->table, "sensitive",
G_BINDING_SYNC_CREATE);
g_object_bind_property (button, "active",
calibrate_button, "sensitive",
@@ -2248,7 +2248,7 @@ prefs_dialog_new (Gimp *gimp,
g_signal_connect (calibrate_button, "clicked",
G_CALLBACK (prefs_resolution_calibrate_callback),
- unit_entry_table);
+ unit_entries);
g_object_unref (size_group);
size_group = NULL;
diff --git a/app/dialogs/resolution-calibrate-dialog.c b/app/dialogs/resolution-calibrate-dialog.c
index 55eccf4..94e0268 100644
--- a/app/dialogs/resolution-calibrate-dialog.c
+++ b/app/dialogs/resolution-calibrate-dialog.c
@@ -28,7 +28,7 @@
#include "gimp-intl.h"
-static GimpUnitEntryTable *calibrate_entries = NULL;
+static GimpUnitEntries *calibrate_entries = NULL;
static gdouble calibrate_xres = 1.0;
static gdouble calibrate_yres = 1.0;
static gint ruler_width = 1;
@@ -45,7 +45,7 @@ static gint ruler_height = 1;
* is connected to a #GimpSizeEntry handling the resolution to be set.
**/
void
-resolution_calibrate_dialog (GObject *unit_entry_table,
+resolution_calibrate_dialog (GObject *unit_entries,
GdkPixbuf *pixbuf)
{
GtkWidget *dialog;
@@ -57,21 +57,21 @@ resolution_calibrate_dialog (GObject *unit_entry_table,
GdkScreen *screen;
GdkRectangle rect;
gint monitor;
- GimpUnitEntryTable *resolution_entries;
+ GimpUnitEntries *resolution_entries;
GimpUnitEntry *horizontal_entry, *vertical_entry;
- g_return_if_fail (GIMP_IS_UNIT_ENTRY_TABLE (unit_entry_table));
+ g_return_if_fail (GIMP_IS_UNIT_ENTRIES (unit_entries));
g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf));
/* this dialog can only exist once */
if (calibrate_entries)
return;
- resolution_entries = GIMP_UNIT_ENTRY_TABLE (unit_entry_table);
+ resolution_entries = GIMP_UNIT_ENTRIES (unit_entries);
dialog = gimp_dialog_new (_("Calibrate Monitor Resolution"),
"gimp-resolution-calibration",
- gtk_widget_get_toplevel (gimp_unit_entry_table_get_table (resolution_entries)),
+ gtk_widget_get_toplevel (gimp_unit_entries_get_table (resolution_entries)),
GTK_DIALOG_DESTROY_WITH_PARENT,
NULL, NULL,
@@ -87,7 +87,7 @@ resolution_calibrate_dialog (GObject *unit_entry_table,
screen = gtk_widget_get_screen (dialog);
monitor = gdk_screen_get_monitor_at_window (screen,
- gtk_widget_get_window (gimp_unit_entry_table_get_table
(resolution_entries)));
+ gtk_widget_get_window (gimp_unit_entries_get_table
(resolution_entries)));
gdk_screen_get_monitor_geometry (screen, monitor, &rect);
ruler_width = rect.width - 300 - (rect.width % 100);
@@ -143,18 +143,18 @@ resolution_calibrate_dialog (GObject *unit_entry_table,
gtk_widget_show (hbox);
calibrate_xres =
- gimp_unit_entry_table_get_nth_pixels (resolution_entries, 0);
+ gimp_unit_entries_get_nth_pixels (resolution_entries, 0);
calibrate_yres =
- gimp_unit_entry_table_get_nth_pixels (resolution_entries, 1);
+ gimp_unit_entries_get_nth_pixels (resolution_entries, 1);
calibrate_entries =
- GIMP_UNIT_ENTRY_TABLE (gimp_unit_entry_table_new ());
- gimp_unit_entry_table_set_bounds (calibrate_entries, GIMP_UNIT_PIXEL, GIMP_MAX_IMAGE_SIZE, 1);
+ GIMP_UNIT_ENTRIES (gimp_unit_entries_new ());
+ gimp_unit_entries_set_bounds (calibrate_entries, GIMP_UNIT_PIXEL, GIMP_MAX_IMAGE_SIZE, 1);
horizontal_entry =
- GIMP_UNIT_ENTRY (gimp_unit_entry_table_add_entry_defaults (calibrate_entries, "horizontal",
_("Horizontal")));
+ GIMP_UNIT_ENTRY (gimp_unit_entries_add_entry_defaults (calibrate_entries, "horizontal",
_("Horizontal")));
vertical_entry =
- GIMP_UNIT_ENTRY (gimp_unit_entry_table_add_entry_defaults (calibrate_entries, "vertical",
_("Vertical")));
+ GIMP_UNIT_ENTRY (gimp_unit_entries_add_entry_defaults (calibrate_entries, "vertical", _("Vertical")));
gimp_unit_entry_set_resolution (horizontal_entry, calibrate_xres);
gimp_unit_entry_set_resolution (vertical_entry, calibrate_yres);
gimp_unit_entry_set_pixels (horizontal_entry, ruler_width);
@@ -164,7 +164,7 @@ resolution_calibrate_dialog (GObject *unit_entry_table,
G_CALLBACK (gtk_widget_destroyed),
&calibrate_entries);
- gtk_box_pack_end (GTK_BOX (hbox), gimp_unit_entry_table_get_table (calibrate_entries), FALSE, FALSE, 0);
+ gtk_box_pack_end (GTK_BOX (hbox), gimp_unit_entries_get_table (calibrate_entries), FALSE, FALSE, 0);
gtk_widget_show (dialog);
@@ -181,14 +181,14 @@ resolution_calibrate_dialog (GObject *unit_entry_table,
calibrate_xres = (gdouble) ruler_width * calibrate_xres / x;
calibrate_yres = (gdouble) ruler_height * calibrate_yres / y;
- chain_button = gimp_unit_entry_table_get_chain_button (resolution_entries);
+ chain_button = gimp_unit_entries_get_chain_button (resolution_entries);
if (ABS (x - y) > GIMP_MIN_RESOLUTION)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chain_button),
FALSE);
- gimp_unit_entry_table_set_nth_pixels (resolution_entries, 0, calibrate_xres);
- gimp_unit_entry_table_set_nth_pixels (resolution_entries, 1, calibrate_yres);
+ gimp_unit_entries_set_nth_pixels (resolution_entries, 0, calibrate_xres);
+ gimp_unit_entries_set_nth_pixels (resolution_entries, 1, calibrate_yres);
}
default:
diff --git a/app/widgets/gimpgrideditor.c b/app/widgets/gimpgrideditor.c
index 411d243..f0354a5 100644
--- a/app/widgets/gimpgrideditor.c
+++ b/app/widgets/gimpgrideditor.c
@@ -125,7 +125,7 @@ gimp_grid_editor_constructed (GObject *object)
GtkWidget *table;
GtkWidget *style;
GtkWidget *color_button;
- GimpUnitEntryTable *ue_table = NULL;
+ GimpUnitEntries *entries = NULL;
G_OBJECT_CLASS (parent_class)->constructed (object);
@@ -178,7 +178,7 @@ gimp_grid_editor_constructed (GObject *object)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_container_add (GTK_CONTAINER (frame), hbox);
- ue_table = editor->spacing_table = GIMP_UNIT_ENTRY_TABLE (
+ entries = editor->spacing_entries = GIMP_UNIT_ENTRIES (
gimp_prop_coordinates_new2 (G_OBJECT (editor->grid),
"xspacing",
"yspacing",
@@ -189,8 +189,8 @@ gimp_grid_editor_constructed (GObject *object)
editor->yresolution,
TRUE));
- gtk_box_pack_start (GTK_BOX (hbox), ue_table->table, TRUE, TRUE, 0);
- gtk_widget_show (ue_table->table);
+ gtk_box_pack_start (GTK_BOX (hbox), entries->table, TRUE, TRUE, 0);
+ gtk_widget_show (entries->table);
gtk_widget_show (hbox);
@@ -201,7 +201,7 @@ gimp_grid_editor_constructed (GObject *object)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_container_add (GTK_CONTAINER (frame), hbox);
- ue_table = editor->offset_table = GIMP_UNIT_ENTRY_TABLE (
+ entries = editor->offset_entries = GIMP_UNIT_ENTRIES (
gimp_prop_coordinates_new2 (G_OBJECT (editor->grid),
"xoffset",
"yoffset",
@@ -212,8 +212,8 @@ gimp_grid_editor_constructed (GObject *object)
editor->yresolution,
TRUE));
- gtk_box_pack_start (GTK_BOX (hbox), ue_table->table, TRUE, TRUE, 0);
- gtk_widget_show (ue_table->table);
+ gtk_box_pack_start (GTK_BOX (hbox), entries->table, TRUE, TRUE, 0);
+ gtk_widget_show (entries->table);
gtk_widget_show (hbox);
}
@@ -234,15 +234,15 @@ gimp_grid_editor_finalize (GObject *object)
g_object_unref (editor->context);
editor->context = NULL;
}
- if (editor->spacing_table)
+ if (editor->spacing_entries)
{
- g_object_unref (editor->spacing_table);
- editor->spacing_table = NULL;
+ g_object_unref (editor->spacing_entries);
+ editor->spacing_entries = NULL;
}
- if (editor->offset_table)
+ if (editor->offset_entries)
{
- g_object_unref (editor->offset_table);
- editor->offset_table = NULL;
+ g_object_unref (editor->offset_entries);
+ editor->offset_entries = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
diff --git a/app/widgets/gimpgrideditor.h b/app/widgets/gimpgrideditor.h
index 5fe18c2..6443c19 100644
--- a/app/widgets/gimpgrideditor.h
+++ b/app/widgets/gimpgrideditor.h
@@ -38,7 +38,7 @@ struct _GimpGridEditor
GimpGrid *grid;
GimpContext *context;
- GimpUnitEntryTable *spacing_table, *offset_table;
+ GimpUnitEntries *spacing_entries, *offset_entries;
gdouble xresolution;
gdouble yresolution;
};
diff --git a/app/widgets/gimptemplateeditor.c b/app/widgets/gimptemplateeditor.c
index 0cd75e5..584904b 100644
--- a/app/widgets/gimptemplateeditor.c
+++ b/app/widgets/gimptemplateeditor.c
@@ -59,11 +59,11 @@ struct _GimpTemplateEditorPrivate
gboolean block_aspect;
GtkWidget *expander;
- GimpUnitEntryTable *unit_entries;
+ GimpUnitEntries *unit_entries;
GtkWidget *memsize_label;
GtkWidget *pixel_label;
GtkWidget *more_label;
- GimpUnitEntryTable *resolution_entries;
+ GimpUnitEntries *resolution_entries;
};
#define GET_PRIVATE(editor) \
@@ -179,16 +179,16 @@ gimp_template_editor_constructed (GObject *object)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_show (hbox);
- private->unit_entries = GIMP_UNIT_ENTRY_TABLE (gimp_unit_entry_table_new ());
+ private->unit_entries = GIMP_UNIT_ENTRIES (gimp_unit_entries_new ());
gtk_table_attach_defaults (GTK_TABLE (table), private->unit_entries->table, 0, 2, 0, 2);
- gimp_unit_entry_table_add_entry_defaults (private->unit_entries,
- "width",
- _("Width:"));
- gimp_unit_entry_table_add_entry_defaults (private->unit_entries,
- "height",
- _("Height:"));
+ gimp_unit_entries_add_entry_defaults (private->unit_entries,
+ "width",
+ _("Width:"));
+ gimp_unit_entries_add_entry_defaults (private->unit_entries,
+ "height",
+ _("Height:"));
gimp_prop_coordinates_connect2 (G_OBJECT (template),
"width", "height", "unit",
@@ -282,26 +282,26 @@ gimp_template_editor_constructed (GObject *object)
gtk_table_attach_defaults (GTK_TABLE (table), hbox, 0, 2, 0, 2);
gtk_widget_show (hbox);
- private->resolution_entries = GIMP_UNIT_ENTRY_TABLE (gimp_unit_entry_table_new ());
+ private->resolution_entries = GIMP_UNIT_ENTRIES (gimp_unit_entries_new ());
- gimp_unit_entry_table_add_entry_defaults (private->resolution_entries,
+ gimp_unit_entries_add_entry_defaults (private->resolution_entries,
"xres",
_("X resolution:"));
- gimp_unit_entry_table_add_entry_defaults (private->resolution_entries,
+ gimp_unit_entries_add_entry_defaults (private->resolution_entries,
"yres",
_("Y resolution:"));
- gimp_unit_entry_table_set_mode (private->resolution_entries, GIMP_UNIT_ENTRY_MODE_RESOLUTION);
+ gimp_unit_entries_set_mode (private->resolution_entries, GIMP_UNIT_ENTRY_MODE_RESOLUTION);
gtk_box_pack_start (GTK_BOX (hbox), private->resolution_entries->table, TRUE, TRUE, 0);
gtk_widget_show (private->resolution_entries->table);
- gimp_unit_entry_set_resolution (gimp_unit_entry_table_get_nth_entry (private->unit_entries, 0),
+ gimp_unit_entry_set_resolution (gimp_unit_entries_get_nth_entry (private->unit_entries, 0),
gimp_template_get_resolution_x (template));
- gimp_unit_entry_set_resolution (gimp_unit_entry_table_get_nth_entry (private->unit_entries, 1),
+ gimp_unit_entry_set_resolution (gimp_unit_entries_get_nth_entry (private->unit_entries, 1),
gimp_template_get_resolution_y (template));
/* the resolution chainbutton */
- chainbutton = gimp_unit_entry_table_add_chain_button (private->resolution_entries,
+ chainbutton = gimp_unit_entries_add_chain_button (private->resolution_entries,
"xres", "yres");
gimp_prop_coordinates_connect2 (G_OBJECT (template),
@@ -489,7 +489,7 @@ gimp_template_editor_show_advanced (GimpTemplateEditor *editor,
gtk_expander_set_expanded (GTK_EXPANDER (private->expander), expanded);
}
-GimpUnitEntryTable *
+GimpUnitEntries *
gimp_template_editor_get_unit_entries (GimpTemplateEditor *editor)
{
g_return_val_if_fail (GIMP_IS_TEMPLATE_EDITOR (editor), NULL);
@@ -544,9 +544,9 @@ gimp_template_editor_aspect_callback (GtkWidget *widget,
gimp_template_editor_template_notify,
editor);
- gimp_unit_entry_set_resolution (gimp_unit_entry_table_get_nth_entry (private->unit_entries, 0),
+ gimp_unit_entry_set_resolution (gimp_unit_entries_get_nth_entry (private->unit_entries, 0),
yresolution);
- gimp_unit_entry_set_resolution (gimp_unit_entry_table_get_nth_entry (private->unit_entries, 1),
+ gimp_unit_entry_set_resolution (gimp_unit_entries_get_nth_entry (private->unit_entries, 1),
xresolution);
g_object_set (template,
@@ -582,12 +582,12 @@ gimp_template_editor_template_notify (GimpTemplate *template,
{
if (! strcmp (param_spec->name, "xresolution"))
{
- gimp_unit_entry_set_resolution (gimp_unit_entry_table_get_nth_entry (private->unit_entries, 0),
+ gimp_unit_entry_set_resolution (gimp_unit_entries_get_nth_entry (private->unit_entries, 0),
gimp_template_get_resolution_x (template));
}
else if (! strcmp (param_spec->name, "yresolution"))
{
- gimp_unit_entry_set_resolution (gimp_unit_entry_table_get_nth_entry (private->unit_entries, 1),
+ gimp_unit_entry_set_resolution (gimp_unit_entries_get_nth_entry (private->unit_entries, 1),
gimp_template_get_resolution_y (template));
}
}
diff --git a/app/widgets/gimptemplateeditor.h b/app/widgets/gimptemplateeditor.h
index 7a8ee46..d0eb6b3 100644
--- a/app/widgets/gimptemplateeditor.h
+++ b/app/widgets/gimptemplateeditor.h
@@ -53,7 +53,7 @@ GimpTemplate * gimp_template_editor_get_template (GimpTemplateEdit
void gimp_template_editor_show_advanced (GimpTemplateEditor *editor,
gboolean expanded);
-GimpUnitEntryTable * gimp_template_editor_get_unit_entries (GimpTemplateEditor *editor);
+GimpUnitEntries * gimp_template_editor_get_unit_entries (GimpTemplateEditor *editor);
#endif /* __GIMP_TEMPLATE_EDITOR_H__ */
diff --git a/libgimpwidgets/Makefile.am b/libgimpwidgets/Makefile.am
index 1abbe8b..9b4a141 100644
--- a/libgimpwidgets/Makefile.am
+++ b/libgimpwidgets/Makefile.am
@@ -171,8 +171,8 @@ libgimpwidgets_sources = \
gimpunitadjustment.h \
gimpunitentry.c \
gimpunitentry.h \
- gimpunitentrytable.c \
- gimpunitentrytable.h \
+ gimpunitentries.c \
+ gimpunitentries.h \
gimpunitmenu.c \
gimpunitmenu.h \
gimpunitparser.c \
diff --git a/libgimpwidgets/gimppropwidgets.c b/libgimpwidgets/gimppropwidgets.c
index 3f74601..153ebed 100644
--- a/libgimpwidgets/gimppropwidgets.c
+++ b/libgimpwidgets/gimppropwidgets.c
@@ -2822,7 +2822,7 @@ gimp_prop_size_entry_num_chars (gdouble lower,
static void gimp_prop_coordinates_callback (GimpSizeEntry *entry,
GObject *config);
-static void gimp_prop_coordinates_callback2 (GimpUnitEntryTable *entry,
+static void gimp_prop_coordinates_callback2 (GimpUnitEntries *entries,
GimpUnitEntry *e,
GObject *config);
static void gimp_prop_coordinates_notify_x (GObject *config,
@@ -2833,16 +2833,16 @@ static void gimp_prop_coordinates_notify_y (GObject *config,
GimpSizeEntry *entry);
static void gimp_prop_coordinates_notify_x2 (GObject *config,
GParamSpec *param_spec,
- GimpUnitEntryTable *entry);
+ GimpUnitEntries *entries);
static void gimp_prop_coordinates_notify_y2 (GObject *config,
GParamSpec *param_spec,
- GimpUnitEntryTable *entry);
+ GimpUnitEntries *entries);
static void gimp_prop_coordinates_notify_unit (GObject *config,
GParamSpec *param_spec,
GimpSizeEntry *entry);
static void gimp_prop_coordinates_notify_unit2 (GObject *config,
GParamSpec *param_spec,
- GimpUnitEntryTable *entry);
+ GimpUnitEntries *entries);
/**
@@ -2919,37 +2919,37 @@ gimp_prop_coordinates_new2 (GObject *config,
gdouble yresolution,
gboolean has_chainbutton)
{
- GimpUnitEntryTable *unit_entry_table;
- GtkWidget *chainbutton = NULL;
+ GimpUnitEntries *unit_entries;
+ GtkWidget *chainbutton = NULL;
- unit_entry_table = GIMP_UNIT_ENTRY_TABLE (gimp_unit_entry_table_new ());
+ unit_entries = GIMP_UNIT_ENTRIES (gimp_unit_entries_new ());
- gimp_unit_entry_table_add_entry_defaults (unit_entry_table, x_property_name, x_label_str);
- gimp_unit_entry_table_add_entry_defaults (unit_entry_table, y_property_name, y_label_str);
+ gimp_unit_entries_add_entry_defaults (unit_entries, x_property_name, x_label_str);
+ gimp_unit_entries_add_entry_defaults (unit_entries, y_property_name, y_label_str);
if (has_chainbutton)
{
- chainbutton = gimp_unit_entry_table_add_chain_button (unit_entry_table,
- x_property_name,
- y_property_name);
+ chainbutton = gimp_unit_entries_add_chain_button (unit_entries,
+ x_property_name,
+ y_property_name);
}
if (! gimp_prop_coordinates_connect2 (config,
x_property_name,
y_property_name,
unit_property_name,
- G_OBJECT (unit_entry_table),
+ G_OBJECT (unit_entries),
chainbutton,
xresolution,
yresolution))
{
- gtk_widget_destroy (unit_entry_table->table);
+ gtk_widget_destroy (unit_entries->table);
return NULL;
}
- gimp_prop_coordinates_callback2 (unit_entry_table, NULL, config);
+ gimp_prop_coordinates_callback2 (unit_entries, NULL, config);
- return G_OBJECT (unit_entry_table);
+ return G_OBJECT (unit_entries);
}
gboolean
@@ -3115,7 +3115,7 @@ gboolean gimp_prop_coordinates_connect2 (GObject *config,
const gchar *x_property_name,
const gchar *y_property_name,
const gchar *unit_property_name,
- GObject *unitentrytable,
+ GObject *unitentries,
GtkWidget *chainbutton,
gdouble xresolution,
gdouble yresolution)
@@ -3131,11 +3131,11 @@ gboolean gimp_prop_coordinates_connect2 (GObject *config,
GimpUnit *old_unit_value;
gboolean chain_checked;
GimpUnitEntry *entry1, *entry2;
- GimpUnitEntryTable *unit_entry_table;
+ GimpUnitEntries *unit_entries;
- g_return_val_if_fail (GIMP_IS_UNIT_ENTRY_TABLE (unitentrytable), FALSE);
- unit_entry_table = GIMP_UNIT_ENTRY_TABLE (unitentrytable);
- g_return_val_if_fail (gimp_unit_entry_table_get_entry_count(unit_entry_table) == 2, FALSE);
+ g_return_val_if_fail (GIMP_IS_UNIT_ENTRIES (unitentries), FALSE);
+ unit_entries = GIMP_UNIT_ENTRIES (unitentries);
+ g_return_val_if_fail (gimp_unit_entries_get_entry_count(unit_entries) == 2, FALSE);
g_return_val_if_fail (chainbutton == NULL ||
GIMP_IS_CHAIN_BUTTON (chainbutton), FALSE);
@@ -3170,8 +3170,8 @@ gboolean gimp_prop_coordinates_connect2 (GObject *config,
unit_value = GIMP_UNIT_INCH;
}
- entry1 = gimp_unit_entry_table_get_nth_entry (unit_entry_table, 0);
- entry2 = gimp_unit_entry_table_get_nth_entry (unit_entry_table, 1);
+ entry1 = gimp_unit_entries_get_nth_entry (unit_entries, 0);
+ entry2 = gimp_unit_entries_get_nth_entry (unit_entries, 1);
g_return_val_if_fail (GIMP_IS_UNIT_ENTRY (entry1), FALSE);
g_return_val_if_fail (GIMP_IS_UNIT_ENTRY (entry2), FALSE);
@@ -3182,7 +3182,7 @@ gboolean gimp_prop_coordinates_connect2 (GObject *config,
GTK_WIDGET (entry2),
y_param_spec);
- gimp_unit_entry_table_set_unit (unit_entry_table, unit_value);
+ gimp_unit_entries_set_unit (unit_entries, unit_value);
gimp_unit_entry_set_resolution (entry1, xresolution);
gimp_unit_entry_set_resolution (entry2, yresolution);
@@ -3202,20 +3202,20 @@ gboolean gimp_prop_coordinates_connect2 (GObject *config,
gimp_unit_entry_set_value_in_unit (entry1, x_value, GIMP_UNIT_PIXEL);
gimp_unit_entry_set_value_in_unit (entry2, y_value, GIMP_UNIT_PIXEL);
- g_object_set_data (G_OBJECT (unit_entry_table), "gimp-config-param-spec-x",
+ g_object_set_data (G_OBJECT (unit_entries), "gimp-config-param-spec-x",
x_param_spec);
- g_object_set_data (G_OBJECT (unit_entry_table), "gimp-config-param-spec-y",
+ g_object_set_data (G_OBJECT (unit_entries), "gimp-config-param-spec-y",
y_param_spec);
old_x_value = g_new0 (gdouble, 1);
*old_x_value = x_value;
- g_object_set_data_full (G_OBJECT (unit_entry_table), "old-x-value",
+ g_object_set_data_full (G_OBJECT (unit_entries), "old-x-value",
old_x_value,
(GDestroyNotify) g_free);
old_y_value = g_new0 (gdouble, 1);
*old_y_value = y_value;
- g_object_set_data_full (G_OBJECT (unit_entry_table), "old-y-value",
+ g_object_set_data_full (G_OBJECT (unit_entries), "old-y-value",
old_y_value,
(GDestroyNotify) g_free);
@@ -3224,38 +3224,38 @@ gboolean gimp_prop_coordinates_connect2 (GObject *config,
if (chain_checked)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chainbutton), TRUE);
- g_object_set_data (G_OBJECT (unit_entry_table), "chainbutton", chainbutton);
+ g_object_set_data (G_OBJECT (unit_entries), "chainbutton", chainbutton);
}
- g_signal_connect (unit_entry_table, "changed",
+ g_signal_connect (unit_entries, "changed",
G_CALLBACK (gimp_prop_coordinates_callback2),
config);
connect_notify (config, x_property_name,
G_CALLBACK (gimp_prop_coordinates_notify_x2),
- unit_entry_table);
+ unit_entries);
connect_notify (config, y_property_name,
G_CALLBACK (gimp_prop_coordinates_notify_y2),
- unit_entry_table);
+ unit_entries);
if (unit_property_name)
{
- g_object_set_data (G_OBJECT (unit_entry_table), "gimp-config-param-spec-unit",
+ g_object_set_data (G_OBJECT (unit_entries), "gimp-config-param-spec-unit",
unit_param_spec);
old_unit_value = g_new0 (GimpUnit, 1);
*old_unit_value = unit_value;
- g_object_set_data_full (G_OBJECT (unit_entry_table), "old-unit-value",
+ g_object_set_data_full (G_OBJECT (unit_entries), "old-unit-value",
old_unit_value,
(GDestroyNotify) g_free);
- g_signal_connect (unit_entry_table, "changed",
+ g_signal_connect (unit_entries, "changed",
G_CALLBACK (gimp_prop_coordinates_callback2),
config);
connect_notify (config, unit_property_name,
G_CALLBACK (gimp_prop_coordinates_notify_unit2),
- unit_entry_table);
+ unit_entries);
}
return TRUE;
@@ -3370,9 +3370,9 @@ gimp_prop_coordinates_callback (GimpSizeEntry *entry,
}
static void
-gimp_prop_coordinates_callback2 (GimpUnitEntryTable *entry,
- GimpUnitEntry *e,
- GObject *config)
+gimp_prop_coordinates_callback2 (GimpUnitEntries *entries,
+ GimpUnitEntry *e,
+ GObject *config)
{
GParamSpec *x_param_spec;
GParamSpec *y_param_spec;
@@ -3386,26 +3386,26 @@ gimp_prop_coordinates_callback2 (GimpUnitEntryTable *entry,
gboolean backwards;
GimpUnitEntry *entry1, *entry2;
- x_param_spec = g_object_get_data (G_OBJECT (entry),
+ x_param_spec = g_object_get_data (G_OBJECT (entries),
"gimp-config-param-spec-x");
- y_param_spec = g_object_get_data (G_OBJECT (entry),
+ y_param_spec = g_object_get_data (G_OBJECT (entries),
"gimp-config-param-spec-y");
if (! x_param_spec || ! y_param_spec)
return;
- unit_param_spec = g_object_get_data (G_OBJECT (entry),
+ unit_param_spec = g_object_get_data (G_OBJECT (entries),
"gimp-config-param-spec-unit");
- entry1 = gimp_unit_entry_table_get_nth_entry (entry, 0);
- entry2 = gimp_unit_entry_table_get_nth_entry (entry, 1);
+ entry1 = gimp_unit_entries_get_nth_entry (entries, 0);
+ entry2 = gimp_unit_entries_get_nth_entry (entries, 1);
x_value = gimp_unit_entry_get_value_in_unit (entry1, GIMP_UNIT_PIXEL);
y_value = gimp_unit_entry_get_value_in_unit (entry2, GIMP_UNIT_PIXEL);
unit_value = gimp_unit_entry_get_unit (entry1);
- old_x_value = g_object_get_data (G_OBJECT (entry), "old-x-value");
- old_y_value = g_object_get_data (G_OBJECT (entry), "old-y-value");
- old_unit_value = g_object_get_data (G_OBJECT (entry), "old-unit-value");
+ old_x_value = g_object_get_data (G_OBJECT (entries), "old-x-value");
+ old_y_value = g_object_get_data (G_OBJECT (entries), "old-y-value");
+ old_unit_value = g_object_get_data (G_OBJECT (entries), "old-unit-value");
if (! old_x_value || ! old_y_value || (unit_param_spec && ! old_unit_value))
return;
@@ -3419,7 +3419,7 @@ gimp_prop_coordinates_callback2 (GimpUnitEntryTable *entry,
{
GtkWidget *chainbutton;
- chainbutton = g_object_get_data (G_OBJECT (entry), "chainbutton");
+ chainbutton = g_object_get_data (G_OBJECT (entries), "chainbutton");
if (chainbutton &&
gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (chainbutton)) &&
@@ -3604,13 +3604,13 @@ gimp_prop_coordinates_notify_unit (GObject *config,
static void
gimp_prop_coordinates_notify_unit2 (GObject *config,
GParamSpec *param_spec,
- GimpUnitEntryTable *entryTable)
+ GimpUnitEntries *entries)
{
GimpUnit value;
GimpUnitEntry *entry;
- g_return_if_fail (GIMP_IS_UNIT_ENTRY_TABLE (entryTable));
- entry = gimp_unit_entry_table_get_nth_entry (entryTable, 0);
+ g_return_if_fail (GIMP_IS_UNIT_ENTRIES (entries));
+ entry = gimp_unit_entries_get_nth_entry (entries, 0);
g_return_if_fail (GIMP_IS_UNIT_ENTRY (entry));
g_object_get (config,
@@ -3619,13 +3619,13 @@ gimp_prop_coordinates_notify_unit2 (GObject *config,
if (value != gimp_unit_entry_get_unit (entry))
{
- g_signal_handlers_block_by_func (entryTable,
+ g_signal_handlers_block_by_func (entries,
gimp_prop_coordinates_callback2,
config);
gimp_unit_entry_set_unit (entry, value);
- g_signal_handlers_unblock_by_func (entryTable,
+ g_signal_handlers_unblock_by_func (entries,
gimp_prop_coordinates_callback2,
config);
}
@@ -3633,14 +3633,14 @@ gimp_prop_coordinates_notify_unit2 (GObject *config,
static void
gimp_prop_coordinates_notify_x2 (GObject *config,
- GParamSpec *param_spec,
- GimpUnitEntryTable *entryTable)
+ GParamSpec *param_spec,
+ GimpUnitEntries *entries)
{
gdouble value;
GimpUnitEntry *entry;
- g_return_if_fail (GIMP_IS_UNIT_ENTRY_TABLE (entryTable));
- entry = gimp_unit_entry_table_get_nth_entry (entryTable, 0);
+ g_return_if_fail (GIMP_IS_UNIT_ENTRIES (entries));
+ entry = gimp_unit_entries_get_nth_entry (entries, 0);
g_return_if_fail (GIMP_IS_UNIT_ENTRY (entry));
if (G_IS_PARAM_SPEC_INT (param_spec))
@@ -3662,10 +3662,10 @@ gimp_prop_coordinates_notify_x2 (GObject *config,
if (value != gimp_unit_entry_get_value_in_unit (entry, GIMP_UNIT_PIXEL))
{
- gdouble *old_x_value = g_object_get_data (G_OBJECT (entryTable),
+ gdouble *old_x_value = g_object_get_data (G_OBJECT (entries),
"old-x-value");
- g_signal_handlers_block_by_func (entryTable,
+ g_signal_handlers_block_by_func (entries,
gimp_prop_coordinates_callback2,
config);
@@ -3674,7 +3674,7 @@ gimp_prop_coordinates_notify_x2 (GObject *config,
if (old_x_value)
*old_x_value = value;
- g_signal_handlers_unblock_by_func (entryTable,
+ g_signal_handlers_unblock_by_func (entries,
gimp_prop_coordinates_callback2,
config);
}
@@ -3682,14 +3682,14 @@ gimp_prop_coordinates_notify_x2 (GObject *config,
static void
gimp_prop_coordinates_notify_y2 (GObject *config,
- GParamSpec *param_spec,
- GimpUnitEntryTable *entryTable)
+ GParamSpec *param_spec,
+ GimpUnitEntries *entries)
{
gdouble value;
GimpUnitEntry *entry;
- g_return_if_fail (GIMP_IS_UNIT_ENTRY_TABLE (entryTable));
- entry = gimp_unit_entry_table_get_nth_entry (entryTable, 1);
+ g_return_if_fail (GIMP_IS_UNIT_ENTRIES (entries));
+ entry = gimp_unit_entries_get_nth_entry (entries, 1);
g_return_if_fail (GIMP_IS_UNIT_ENTRY (entry));
if (G_IS_PARAM_SPEC_INT (param_spec))
@@ -3711,10 +3711,10 @@ gimp_prop_coordinates_notify_y2 (GObject *config,
if (value != gimp_unit_entry_get_value_in_unit (entry, GIMP_UNIT_PIXEL))
{
- gdouble *old_y_value = g_object_get_data (G_OBJECT (entryTable),
+ gdouble *old_y_value = g_object_get_data (G_OBJECT (entries),
"old-y-value");
- g_signal_handlers_block_by_func (entryTable,
+ g_signal_handlers_block_by_func (entries,
gimp_prop_coordinates_callback2,
config);
@@ -3723,7 +3723,7 @@ gimp_prop_coordinates_notify_y2 (GObject *config,
if (old_y_value)
*old_y_value = value;
- g_signal_handlers_unblock_by_func (entryTable,
+ g_signal_handlers_unblock_by_func (entries,
gimp_prop_coordinates_callback2,
config);
}
diff --git a/libgimpwidgets/gimppropwidgets.h b/libgimpwidgets/gimppropwidgets.h
index 5046e25..686e573 100644
--- a/libgimpwidgets/gimppropwidgets.h
+++ b/libgimpwidgets/gimppropwidgets.h
@@ -208,7 +208,7 @@ gboolean gimp_prop_coordinates_connect2 (GObject *config,
const gchar *x_property_name,
const gchar *y_property_name,
const gchar *unit_property_name,
- GObject *sizeentry,
+ GObject *entries,
GtkWidget *chainbutton,
gdouble xresolution,
gdouble yresolution);
diff --git a/libgimpwidgets/gimpunitentries.c b/libgimpwidgets/gimpunitentries.c
new file mode 100644
index 0000000..7ce47d0
--- /dev/null
+++ b/libgimpwidgets/gimpunitentries.c
@@ -0,0 +1,506 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpunitentries.c
+ * Copyright (C) 2011 Enrico Schröder <enni schroeder gmail com>
+ *
+ * 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 3 of the License, or (at your option) any later version.
+ *
+ * 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <glib/gprintf.h>
+
+#include "gimpunitentries.h"
+#include "gimpwidgets.h"
+
+/* debug macro */
+//#define UNITENTRY_DEBUG
+#ifdef UNITENTRY_DEBUG
+#define DEBUG(x) g_debug x
+#else
+#define DEBUG(x) /* nothing */
+#endif
+
+enum
+{
+ CHANGED,
+ LAST_SIGNAL
+};
+
+G_DEFINE_TYPE (GimpUnitEntries, gimp_unit_entries, G_TYPE_OBJECT);
+
+static void gimp_unit_entries_label_updater (GtkAdjustment *adj, gpointer user_data);
+static void gimp_unit_entries_entry_changed (GtkAdjustment *adj, gpointer user_data);
+
+static guint unit_entries_signals[LAST_SIGNAL] = {0};
+
+static void
+gimp_unit_entries_init (GimpUnitEntries *entries)
+{
+ entries->table = gtk_table_new (1, 1, FALSE);
+ entries->entries_store = g_hash_table_new (NULL, NULL);
+ entries->chain_button = NULL;
+ entries->bottom = 0;
+ entries->right = 0;
+}
+
+static void
+gimp_unit_entries_class_init (GimpUnitEntriesClass *klass)
+{
+ unit_entries_signals[CHANGED] =
+ g_signal_new ("changed",
+ GIMP_TYPE_UNIT_ENTRIES,
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_OBJECT);
+}
+
+GObject*
+gimp_unit_entries_new (void)
+{
+ GObject *table;
+
+ table = g_object_new (GIMP_TYPE_UNIT_ENTRIES, NULL);
+
+ return table;
+}
+
+/* add an UnitEntry */
+GtkWidget*
+gimp_unit_entries_add_entry (GimpUnitEntries *entries,
+ const gchar *id,
+ const gchar *labelStr,
+ gint x,
+ gint y)
+{
+ GimpUnitEntry *entry = GIMP_UNIT_ENTRY (gimp_unit_entry_new ());
+ GtkWidget *label;
+
+ /* position of the entry (leave one row/column empty for labels etc) */
+ gint left_attach = x + 1,
+ right_attach = x + 2,
+ top_attach = y + 1,
+ bottom_attach = y + 2;
+
+ /* remember position in table so that we later can place other widgets around it */
+ g_object_set_data (G_OBJECT (entry), "left_attach", GINT_TO_POINTER (left_attach));
+ g_object_set_data (G_OBJECT (entry), "right_attach", GINT_TO_POINTER (right_attach));
+ g_object_set_data (G_OBJECT (entry), "top_attach", GINT_TO_POINTER (top_attach));
+ g_object_set_data (G_OBJECT (entry), "bottom_attach", GINT_TO_POINTER (bottom_attach));
+
+ /* add entry to table at position (1, count) */
+ gtk_table_attach_defaults (GTK_TABLE (entries->table),
+ GTK_WIDGET (entry),
+ left_attach,
+ right_attach,
+ top_attach,
+ bottom_attach);
+
+ /* save new size of our table if neccessary */
+ if (bottom_attach > entries->bottom)
+ entries->bottom = bottom_attach;
+ if (right_attach > entries->right)
+ entries->right = right_attach;
+
+ /* if label string is given, create label and attach to the left of entry */
+ if (labelStr != NULL)
+ {
+ label = gtk_label_new (labelStr);
+ gtk_table_attach (GTK_TABLE (entries->table),
+ label,
+ left_attach-1 , left_attach, top_attach, bottom_attach,
+ GTK_SHRINK, GTK_EXPAND | GTK_FILL,
+ 10, 0);
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ }
+
+ /* connect to ourselves */
+ g_signal_connect (gimp_unit_entry_get_adjustment (entry), "value-changed",
+ G_CALLBACK (gimp_unit_entries_entry_changed), (gpointer) entries);
+ g_signal_connect (gimp_unit_entry_get_adjustment (entry), "resolution-changed",
+ G_CALLBACK (gimp_unit_entries_entry_changed), (gpointer) entries);
+
+ gtk_widget_show_all (entries->table);
+
+ g_hash_table_insert (entries->entries_store, (gpointer) id, (gpointer) entry);
+
+ return GTK_WIDGET (entry);
+}
+
+GtkWidget*
+gimp_unit_entries_add_entry_defaults (GimpUnitEntries *entries,
+ const gchar *id,
+ const gchar *labelStr)
+{
+ GimpUnitEntry *entry, *entry2;
+ gint i;
+
+ entry = GIMP_UNIT_ENTRY (gimp_unit_entries_add_entry (entries,
+ id,
+ labelStr,
+ 1,
+ entries->bottom));
+
+ /* connect entry to others */
+ for (i = 0; i < g_hash_table_size (entries->entries_store); i++)
+ {
+ entry2 = gimp_unit_entries_get_nth_entry (entries, i);
+ gimp_unit_entry_connect (GIMP_UNIT_ENTRY (entry), GIMP_UNIT_ENTRY (entry2));
+ gimp_unit_entry_connect (GIMP_UNIT_ENTRY (entry2), GIMP_UNIT_ENTRY (entry));
+ }
+
+ return GTK_WIDGET (entry);
+}
+
+/* add preview label showing value of the two given entries in given unit */
+void
+gimp_unit_entries_add_label (GimpUnitEntries *entries,
+ GimpUnit unit,
+ const gchar *id1,
+ const gchar *id2)
+{
+ GtkWidget *label = gtk_label_new("preview");
+ GimpUnitEntry *entry1 = gimp_unit_entries_get_entry (entries, id1);
+ GimpUnitEntry *entry2 = gimp_unit_entries_get_entry (entries, id2);
+ gint left_attach, right_attach, top_attach, bottom_attach;
+
+ /* save unit */
+ g_object_set_data (G_OBJECT (label), "unit", GINT_TO_POINTER (unit));
+ /* save the two entries */
+ g_object_set_data (G_OBJECT (label), "entry1", (gpointer) entry1);
+ g_object_set_data (G_OBJECT (label), "entry2", (gpointer) entry2);
+
+ /* get the position of the entries and set label accordingly */
+ left_attach = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (entry1), "left_attach"));
+ right_attach = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (entry1), "right_attach"));
+ top_attach = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (entry2), "bottom_attach"));
+ bottom_attach = top_attach + 1;
+
+ /* add label below unit entries */
+ gtk_table_attach (GTK_TABLE (entries->table),
+ label,
+ left_attach, right_attach,
+ top_attach, bottom_attach,
+ GTK_FILL, GTK_SHRINK,
+ 10, 0);
+
+ /* set alignment */
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
+ /*gimp_label_set_attributes (GTK_LABEL (label),
+ PANGO_ATTR_SCALE, PANGO_SCALE_SMALL,
+ -1);*/
+
+ entries->bottom++;
+
+ gtk_widget_show (GTK_WIDGET (label));
+
+ /* connect label updater to changed signal */
+ g_signal_connect (G_OBJECT (gimp_unit_entry_get_adjustment (entry1)), "value-changed",
+ G_CALLBACK (gimp_unit_entries_label_updater), (gpointer) label);
+
+ g_signal_connect (G_OBJECT (gimp_unit_entry_get_adjustment (entry2)), "value-changed",
+ G_CALLBACK (gimp_unit_entries_label_updater), (gpointer) label);
+
+ gimp_unit_entries_label_updater (NULL, (gpointer) label);
+}
+
+/* add chain button connecting the two given UnitEntries */
+GtkWidget*
+gimp_unit_entries_add_chain_button (GimpUnitEntries *entries,
+ const gchar *id1,
+ const gchar *id2)
+{
+ GtkWidget *chain_button;
+ GimpUnitEntry *entry1 = gimp_unit_entries_get_entry (entries, id1);
+ GimpUnitEntry *entry2 = gimp_unit_entries_get_entry (entries, id2);
+
+ /* retrieve position of entries */
+ gint right_attach = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (entry1), "right_attach"));
+ gint top_attach = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (entry1), "top_attach"));
+ gint bottom_attach = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (entry2), "bottom_attach"));
+
+ chain_button = gimp_chain_button_new(GIMP_CHAIN_RIGHT);
+
+ /* add chain_button to right of entries, spanning from the first to the second */
+ gtk_table_attach (GTK_TABLE (entries->table),
+ GTK_WIDGET (chain_button),
+ right_attach, right_attach + 1,
+ top_attach, bottom_attach,
+ GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+
+ gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chain_button), TRUE);
+
+ gtk_widget_show (chain_button);
+
+ entries->chain_button = chain_button;
+
+ return chain_button;
+}
+
+/* get UnitEntry by identifier */
+GimpUnitEntry*
+gimp_unit_entries_get_entry (GimpUnitEntries *entries,
+ const gchar *id)
+{
+ GimpUnitEntry *entry;
+
+ entry = GIMP_UNIT_ENTRY (g_hash_table_lookup (entries->entries_store, id));
+
+ if (entry == NULL)
+ {
+ g_warning ("gimp_unit_entries_get_entry: entry with id '%s' does not exist", id);
+ }
+
+ return entry;
+}
+
+/* get UnitEntry by index */
+GimpUnitEntry*
+gimp_unit_entries_get_nth_entry (GimpUnitEntries *entries,
+ gint index)
+{
+ GHashTableIter iter;
+ gpointer key, value;
+ gint i;
+
+ if (g_hash_table_size (entries->entries_store) <= index || index < 0)
+ {
+ g_warning ("gimp_unit_entries_get_nth_entry: index < 0 or hash table size smaller than index");
+ return NULL;
+ }
+
+ i = 0;
+
+ g_hash_table_iter_init (&iter, entries->entries_store);
+
+ while (g_hash_table_iter_next (&iter, &key, &value))
+ {
+ if (i == index)
+ return GIMP_UNIT_ENTRY (value);
+ i++;
+ }
+
+ return NULL;
+}
+
+/* updates the text of the preview label */
+static void
+gimp_unit_entries_label_updater (GtkAdjustment *adj,
+ gpointer user_data)
+{
+ gchar str[40];
+ GtkLabel *label = GTK_LABEL (user_data);
+ GimpUnitEntry *entry1 = GIMP_UNIT_ENTRY (g_object_get_data (G_OBJECT (label), "entry1"));
+ GimpUnitEntry *entry2 = GIMP_UNIT_ENTRY (g_object_get_data (G_OBJECT (label), "entry2"));
+ GimpUnitAdjustment *adjustment;
+ GimpUnit unit;
+
+ /* retrieve preview unit */
+ unit = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (label), "unit"));
+
+ /* retrieve values of the two entries */
+ adjustment = gimp_unit_entry_get_adjustment (entry1);
+ g_sprintf (str, "%s", gimp_unit_adjustment_to_string_in_unit (adjustment, unit));
+
+ adjustment = gimp_unit_entry_get_adjustment (entry2);
+ g_sprintf (str, "%s x %s ", str, gimp_unit_adjustment_to_string_in_unit (adjustment, unit));
+
+ gtk_label_set_text (label, str);
+}
+
+/* signal handler for signals of one of our entries/adjustments */
+static void
+gimp_unit_entries_entry_changed (GtkAdjustment *adj,
+ gpointer user_data)
+{
+ GimpUnitEntries *entries = GIMP_UNIT_ENTRIES (user_data);
+ GimpUnitEntry *entry;
+ gint i, count = gimp_unit_entries_get_entry_count (entries);
+
+ /* find corresponding entry */
+ for (i = 0; i < count; i++)
+ {
+ entry = gimp_unit_entries_get_nth_entry (entries, i);
+ if (gimp_unit_entry_get_adjustment (entry) == GIMP_UNIT_ADJUSTMENT (adj))
+ i = count;
+ }
+
+ /* emit "changed" */
+ g_signal_emit(entries, unit_entries_signals[CHANGED], 0, entry);
+}
+
+/* get count of attached unit entries */
+gint
+gimp_unit_entries_get_entry_count (GimpUnitEntries *entries)
+{
+ return g_hash_table_size (entries->entries_store);
+}
+
+/* get value of given entry in pixels */
+gdouble
+gimp_unit_entries_get_pixels (GimpUnitEntries *entries,
+ const gchar *id)
+{
+ return gimp_unit_entries_get_value_in_unit (entries, id, GIMP_UNIT_PIXEL);
+}
+
+gdouble
+gimp_unit_entries_get_nth_pixels (GimpUnitEntries *entries,
+ gint index)
+{
+ return gimp_unit_entry_get_pixels (gimp_unit_entries_get_nth_entry (entries, index));
+}
+
+gdouble
+gimp_unit_entries_get_value_in_unit (GimpUnitEntries *entries,
+ const gchar *id,
+ GimpUnit unit)
+{
+ GimpUnitEntry *entry = gimp_unit_entries_get_entry (entries, id);
+
+ if (entry != NULL)
+ return gimp_unit_entry_get_value_in_unit (entry, unit);
+ else
+ return -1;
+}
+
+/* sets the unit of all entries */
+void
+gimp_unit_entries_set_unit (GimpUnitEntries *entries,
+ GimpUnit unit)
+{
+ GimpUnitEntry *entry;
+ gint i, count = gimp_unit_entries_get_entry_count (entries);
+
+ /* iterate over list of entries */
+ for (i = 0; i < count; i++)
+ {
+ entry = gimp_unit_entries_get_nth_entry (entries, i);
+ gimp_unit_entry_set_unit (entry, unit);
+ }
+}
+
+/* sets the resolution of all entries */
+void
+gimp_unit_entries_set_resolution (GimpUnitEntries *entries,
+ gdouble res)
+{
+ GimpUnitEntry *entry;
+ gint i, count = gimp_unit_entries_get_entry_count (entries);
+
+ /* iterate over list of entries */
+ for (i = 0; i < count; i++)
+ {
+ entry = gimp_unit_entries_get_nth_entry (entries, i);
+ gimp_unit_entry_set_resolution (entry, res);
+ }
+}
+
+/* sets resolution mode for all entries */
+void
+gimp_unit_entries_set_mode (GimpUnitEntries *entries,
+ GimpUnitEntryMode mode)
+{
+ GimpUnitEntry *entry;
+ gint i, count = gimp_unit_entries_get_entry_count (entries);
+
+ /* iterate over list of entries */
+ for (i = 0; i < count; i++)
+ {
+ entry = gimp_unit_entries_get_nth_entry (entries, i);
+ gimp_unit_entry_set_mode (entry, mode);
+ }
+}
+
+/* calls gtk_entry_set_activates_default for all UnitEntries */
+void
+gimp_unit_entries_set_activates_default (GimpUnitEntries *entries,
+ gboolean setting)
+{
+ GimpUnitEntry *entry;
+ gint i, count = gimp_unit_entries_get_entry_count (entries);
+
+ /* iterate over list of entries */
+ for (i = 0; i < count; i++)
+ {
+ entry = gimp_unit_entries_get_nth_entry (entries, i);
+ gtk_entry_set_activates_default (GTK_ENTRY (entry), setting);
+ }
+}
+
+void
+gimp_unit_entries_set_bounds (GimpUnitEntries *entries,
+ GimpUnit unit,
+ gdouble upper,
+ gdouble lower)
+{
+ GimpUnitEntry *entry;
+ gint i, count = gimp_unit_entries_get_entry_count (entries);
+
+ /* iterate over list of entries */
+ for (i = 0; i < count; i++)
+ {
+ entry = gimp_unit_entries_get_nth_entry (entries, i);
+ gimp_unit_entry_set_bounds (entry, unit, upper, lower);
+ }
+}
+
+void
+gimp_unit_entries_grab_focus (GimpUnitEntries *entries)
+{
+ gtk_widget_grab_focus (GTK_WIDGET (gimp_unit_entries_get_nth_entry (entries, 0)));
+}
+
+GtkWidget*
+gimp_unit_entries_get_table (GimpUnitEntries *entries)
+{
+ return entries->table;
+}
+
+GtkWidget*
+gimp_unit_entries_get_chain_button (GimpUnitEntries *entries)
+{
+ return entries->chain_button;
+}
+
+void
+gimp_unit_entries_set_pixels (GimpUnitEntries *entries,
+ const gchar *id,
+ gdouble value)
+{
+ GimpUnitEntry *entry;
+
+ entry = gimp_unit_entries_get_entry (entries, id);
+
+ gimp_unit_entry_set_value_in_unit (entry, value, GIMP_UNIT_PIXEL);
+}
+
+void
+gimp_unit_entries_set_nth_pixels (GimpUnitEntries *entries,
+ gint index,
+ gdouble value)
+{
+ GimpUnitEntry *entry;
+
+ entry = gimp_unit_entries_get_nth_entry (entries, index);
+
+ gimp_unit_entry_set_value_in_unit (entry, value, GIMP_UNIT_PIXEL);
+}
diff --git a/libgimpwidgets/gimpunitentries.h b/libgimpwidgets/gimpunitentries.h
new file mode 100644
index 0000000..5f8bba9
--- /dev/null
+++ b/libgimpwidgets/gimpunitentries.h
@@ -0,0 +1,118 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpunitentries.h
+ * Copyright (C) 2011 Enrico Schröder <enni schroeder gmail com>
+ *
+ * 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 3 of the License, or (at your option) any later version.
+ *
+ * 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_UNIT_ENTRIES_H__
+#define __GIMP_UNIT_ENTRIES_H__
+
+#include <stdarg.h>
+
+#include <glib.h>
+
+#include "gimpunitentry.h"
+
+G_BEGIN_DECLS
+
+#define GIMP_TYPE_UNIT_ENTRIES (gimp_unit_entries_get_type ())
+#define GIMP_UNIT_ENTRIES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_UNIT_ENTRIES,
GimpUnitEntries))
+#define GIMP_UNIT_ENTRIES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_UNIT_ENTRIES,
GimpUnitEntriesClass))
+#define GIMP_IS_UNIT_ENTRIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GIMP_TYPE_UNIT_ENTRIES))
+#define GIMP_IS_UNIT_ENTRIES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_UNIT_ENTRIES))
+#define GIMP_UNIT_ENTRIES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_UNIT_ENTRIES,
GimpUnitEntriesClass))
+
+typedef struct _GimpUnitEntries GimpUnitEntries;
+typedef struct _GimpUnitEntriesClass GimpUnitEntriesClass;
+
+struct _GimpUnitEntries
+{
+ GObject parent_instance;
+
+ /* private */
+ GtkWidget *table;
+ GtkWidget *chain_button;
+ GHashTable *entries_store;
+
+ /* dimensions of "sub-table" containing the actual entries */
+ gint bottom, right;
+};
+
+struct _GimpUnitEntriesClass
+{
+ GObjectClass parent_class;
+};
+
+GType gimp_unit_entries_get_type (void);
+GObject* gimp_unit_entries_new (void);
+
+GtkWidget* gimp_unit_entries_add_entry (GimpUnitEntries *entries,
+ const gchar *id,
+ const gchar *label,
+ gint x,
+ gint y);
+GtkWidget* gimp_unit_entries_add_entry_defaults (GimpUnitEntries *entries,
+ const gchar *id,
+ const gchar *label);
+void gimp_unit_entries_add_label (GimpUnitEntries *entries,
+ GimpUnit unit,
+ const char *id1,
+ const char *id2);
+GtkWidget* gimp_unit_entries_add_chain_button (GimpUnitEntries *entries,
+ const char *id1,
+ const char *id2);
+
+GimpUnitEntry* gimp_unit_entries_get_entry (GimpUnitEntries *entries,
+ const gchar *id);
+GimpUnitEntry* gimp_unit_entries_get_nth_entry (GimpUnitEntries *entries,
+ gint index);
+gint gimp_unit_entries_get_entry_count (GimpUnitEntries *entries);
+gdouble gimp_unit_entries_get_pixels (GimpUnitEntries *entries,
+ const gchar *id);
+gdouble gimp_unit_entries_get_nth_pixels (GimpUnitEntries *entries,
+ gint index);
+GtkWidget* gimp_unit_entries_get_table (GimpUnitEntries *entries);
+gdouble gimp_unit_entries_get_value_in_unit (GimpUnitEntries *entries,
+ const gchar *id,
+ GimpUnit unit);
+GtkWidget* gimp_unit_entries_get_chain_button (GimpUnitEntries *entries);
+
+void gimp_unit_entries_set_unit (GimpUnitEntries *entries,
+ GimpUnit unit);
+void gimp_unit_entries_set_resolution (GimpUnitEntries *entries,
+ gdouble res);
+void gimp_unit_entries_set_mode (GimpUnitEntries *entries,
+ GimpUnitEntryMode mode);
+void gimp_unit_entries_set_activates_default (GimpUnitEntries *entries,
+ gboolean setting);
+void gimp_unit_entries_set_bounds (GimpUnitEntries *entries,
+ GimpUnit unit,
+ gdouble upper,
+ gdouble lower);
+void gimp_unit_entries_set_pixels (GimpUnitEntries *entries,
+ const gchar *id,
+ gdouble value);
+void gimp_unit_entries_set_nth_pixels (GimpUnitEntries *entries,
+ gint index,
+ gdouble value);
+
+void gimp_unit_entries_grab_focus (GimpUnitEntries *entries);
+
+G_END_DECLS
+
+#endif /*__GIMP_UNIT_ENTRIES_H__*/
diff --git a/libgimpwidgets/gimpwidgets.def b/libgimpwidgets/gimpwidgets.def
index 29200fa..acb95d9 100644
--- a/libgimpwidgets/gimpwidgets.def
+++ b/libgimpwidgets/gimpwidgets.def
@@ -394,28 +394,28 @@ EXPORTS
gimp_unit_entry_set_unit
gimp_unit_entry_set_value
gimp_unit_entry_set_value_in_unit
- gimp_unit_entry_table_add_chain_button
- gimp_unit_entry_table_add_entry
- gimp_unit_entry_table_add_entry_defaults
- gimp_unit_entry_table_add_label
- gimp_unit_entry_table_get_chain_button
- gimp_unit_entry_table_get_entry
- gimp_unit_entry_table_get_entry_count
- gimp_unit_entry_table_get_nth_entry
- gimp_unit_entry_table_get_nth_pixels
- gimp_unit_entry_table_get_pixels
- gimp_unit_entry_table_get_table
- gimp_unit_entry_table_get_type
- gimp_unit_entry_table_get_value_in_unit
- gimp_unit_entry_table_grab_focus
- gimp_unit_entry_table_new
- gimp_unit_entry_table_set_activates_default
- gimp_unit_entry_table_set_bounds
- gimp_unit_entry_table_set_mode
- gimp_unit_entry_table_set_nth_pixels
- gimp_unit_entry_table_set_pixels
- gimp_unit_entry_table_set_resolution
- gimp_unit_entry_table_set_unit
+ gimp_unit_entries_add_chain_button
+ gimp_unit_entries_add_entry
+ gimp_unit_entries_add_entry_defaults
+ gimp_unit_entries_add_label
+ gimp_unit_entries_get_chain_button
+ gimp_unit_entries_get_entry
+ gimp_unit_entries_get_entry_count
+ gimp_unit_entries_get_nth_entry
+ gimp_unit_entries_get_nth_pixels
+ gimp_unit_entries_get_pixels
+ gimp_unit_entries_get_table
+ gimp_unit_entries_get_type
+ gimp_unit_entries_get_value_in_unit
+ gimp_unit_entries_grab_focus
+ gimp_unit_entries_new
+ gimp_unit_entries_set_activates_default
+ gimp_unit_entries_set_bounds
+ gimp_unit_entries_set_mode
+ gimp_unit_entries_set_nth_pixels
+ gimp_unit_entries_set_pixels
+ gimp_unit_entries_set_resolution
+ gimp_unit_entries_set_unit
gimp_unit_menu_get_pixel_digits
gimp_unit_menu_get_type
gimp_unit_menu_get_unit
diff --git a/libgimpwidgets/gimpwidgets.h b/libgimpwidgets/gimpwidgets.h
index 472725b..037eeb6 100644
--- a/libgimpwidgets/gimpwidgets.h
+++ b/libgimpwidgets/gimpwidgets.h
@@ -74,7 +74,7 @@
#include <libgimpwidgets/gimpstock.h>
#include <libgimpwidgets/gimpstringcombobox.h>
#include <libgimpwidgets/gimpunitcombobox.h>
-#include <libgimpwidgets/gimpunitentrytable.h>
+#include <libgimpwidgets/gimpunitentries.h>
#include <libgimpwidgets/gimpunitmenu.h>
#include <libgimpwidgets/gimpunitstore.h>
#include <libgimpwidgets/gimpwidgets-error.h>
diff --git a/libgimpwidgets/test-unitentrygui.c b/libgimpwidgets/test-unitentrygui.c
index fe1b5f6..0580207 100644
--- a/libgimpwidgets/test-unitentrygui.c
+++ b/libgimpwidgets/test-unitentrygui.c
@@ -10,14 +10,14 @@
#include "devel-docs/tools/units.h"
-#include "gimpunitentrytable.h"
+#include "gimpunitentries.h"
/* global objects */
GtkWidget *window;
GtkWidget *vbox;
GtkWidget *valign;
-GimpUnitEntryTable *entryTable;
+GimpUnitEntries *entries;
/* set up interface */
void
@@ -40,35 +40,35 @@ create_interface(void)
gtk_container_add (GTK_CONTAINER (window), valign);
/* entry table */
- entryTable = GIMP_UNIT_ENTRY_TABLE (gimp_unit_entry_table_new ());
- gimp_unit_entry_table_add_entry_defaults (entryTable, "width", "Width");
- gimp_unit_entry_table_add_entry_defaults (entryTable, "height", "Height");
- gimp_unit_entry_table_add_label (entryTable, GIMP_UNIT_PIXEL, "width", "height");
+ entries = GIMP_UNIT_ENTRIES (gimp_unit_entries_new ());
+ gimp_unit_entries_add_entry_defaults (entries, "width", "Width");
+ gimp_unit_entries_add_entry_defaults (entries, "height", "Height");
+ gimp_unit_entries_add_label (entries, GIMP_UNIT_PIXEL, "width", "height");
- gimp_unit_entry_table_add_chain_button (entryTable, "width", "height");
+ gimp_unit_entries_add_chain_button (entries, "width", "height");
/* set some default values */
- a = gimp_unit_entry_table_get_entry (entryTable, "width");
- b = gimp_unit_entry_table_get_entry (entryTable, "height");
+ a = gimp_unit_entries_get_entry (entries, "width");
+ b = gimp_unit_entries_get_entry (entries, "height");
gimp_unit_adjustment_set_value (gimp_unit_entry_get_adjustment (a), 20);
gimp_unit_adjustment_set_value (gimp_unit_entry_get_adjustment (b), 20);
- gtk_box_pack_start (GTK_BOX (vbox), entryTable->table, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), entries->table, FALSE, TRUE, 0);
/* resolution entry */
- entryTable = GIMP_UNIT_ENTRY_TABLE (gimp_unit_entry_table_new ());
- gimp_unit_entry_table_add_entry_defaults (entryTable, "xres", "X Resolution");
- gimp_unit_entry_table_add_entry_defaults (entryTable, "yres", "Y Resolution");
+ entries = GIMP_UNIT_ENTRIES (gimp_unit_entries_new ());
+ gimp_unit_entries_add_entry_defaults (entries, "xres", "X Resolution");
+ gimp_unit_entries_add_entry_defaults (entries, "yres", "Y Resolution");
/* set some default values */
- a = gimp_unit_entry_table_get_entry (entryTable, "xres");
- b = gimp_unit_entry_table_get_entry (entryTable, "yres");
+ a = gimp_unit_entries_get_entry (entries, "xres");
+ b = gimp_unit_entries_get_entry (entries, "yres");
gimp_unit_entry_set_value (a, 72);
gimp_unit_entry_set_value (b, 72);
gimp_unit_entry_set_mode (a, GIMP_UNIT_ENTRY_MODE_RESOLUTION);
gimp_unit_entry_set_mode (b, GIMP_UNIT_ENTRY_MODE_RESOLUTION);
- gtk_box_pack_end (GTK_BOX (vbox), entryTable->table, FALSE, TRUE, 5);
+ gtk_box_pack_end (GTK_BOX (vbox), entries->table, FALSE, TRUE, 5);
/* signals */
g_signal_connect_swapped (G_OBJECT(window), "destroy",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]