mirror of https://github.com/GNOME/gimp.git
app/* libgimp/* plug-ins/* did a global s/GUnit/GimpUnit/ and
2000-02-07 Michael Natterer <mitch@gimp.org> * app/* * libgimp/* * plug-ins/* * tools/pdbgen/*: did a global s/GUnit/GimpUnit/ and s/GimpSizeEntryUP/GimpSizeEntryUpdatePolicy/ * libgimp/gimpcolorspace.c: renamed the parameter names to match the names in the header. * libgimp/gimphelpui.h * libgimp/gimpimage.c * libgimp/gimpmatrix.h * libgimp/gimpsizeentry.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimpunit.[ch] * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: added documentation and use g* types all over the place (enables cross-referencing with the glib and gtk+ html documentation). * plug-ins/common/exchange.c * plug-ins/common/max_rgb.c: small cleanups. * plug-ins/common/mapcolor.c: the color buttons were attached in the wrong order.
This commit is contained in:
parent
820c8f4109
commit
ef17866973
30
ChangeLog
30
ChangeLog
|
@ -1,3 +1,31 @@
|
|||
2000-02-07 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/*
|
||||
* libgimp/*
|
||||
* plug-ins/*
|
||||
* tools/pdbgen/*: did a global s/GUnit/GimpUnit/ and
|
||||
s/GimpSizeEntryUP/GimpSizeEntryUpdatePolicy/
|
||||
|
||||
* libgimp/gimpcolorspace.c: renamed the parameter names to match
|
||||
the names in the header.
|
||||
|
||||
* libgimp/gimphelpui.h
|
||||
* libgimp/gimpimage.c
|
||||
* libgimp/gimpmatrix.h
|
||||
* libgimp/gimpsizeentry.[ch]
|
||||
* libgimp/gimpsizeentry.[ch]
|
||||
* libgimp/gimpunit.[ch]
|
||||
* libgimp/gimpunitmenu.[ch]
|
||||
* libgimp/gimpwidgets.[ch]: added documentation and use g* types
|
||||
all over the place (enables cross-referencing with the glib and
|
||||
gtk+ html documentation).
|
||||
|
||||
* plug-ins/common/exchange.c
|
||||
* plug-ins/common/max_rgb.c: small cleanups.
|
||||
|
||||
* plug-ins/common/mapcolor.c: the color buttons were attached in
|
||||
the wrong order.
|
||||
|
||||
Mon Feb 7 21:00:34 CET 2000 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/info_window.c: Got rid of the "Shades of Colors" info
|
||||
|
@ -123,7 +151,7 @@ Sun Feb 6 20:46:36 CET 2000 Sven Neumann <sven@gimp.org>
|
|||
* plug-ins/common/unsharp.c
|
||||
* plug-ins/gflare/gflare.c
|
||||
* plug-ins/sinus/sinus.c
|
||||
* plug-ins/struc/struc.c: soem more consistency stuff.
|
||||
* plug-ins/struc/struc.c: some more consistency stuff.
|
||||
|
||||
2000-02-05 Asbjorn Pettersen <asbjornP@dualog.no>
|
||||
|
||||
|
|
|
@ -1405,20 +1405,20 @@ gimage_mask_feather_callback (GtkWidget *widget,
|
|||
gpointer client_data,
|
||||
gpointer call_data)
|
||||
{
|
||||
GImage *gimage;
|
||||
GUnit unit;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
GImage *gimage;
|
||||
GimpUnit unit;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
gimage = GIMP_IMAGE (client_data);
|
||||
|
||||
selection_feather_radius = *(gdouble *) call_data;
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
unit = (GimpUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
|
||||
radius_x = radius_y = selection_feather_radius;
|
||||
|
||||
if (unit != UNIT_PIXEL)
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble factor;
|
||||
|
||||
|
@ -1440,20 +1440,20 @@ gimage_mask_border_callback (GtkWidget *widget,
|
|||
gpointer client_data,
|
||||
gpointer call_data)
|
||||
{
|
||||
GImage *gimage;
|
||||
GUnit unit;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
GImage *gimage;
|
||||
GimpUnit unit;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
gimage = GIMP_IMAGE (client_data);
|
||||
|
||||
selection_border_radius = (gint) (*(gdouble *) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
unit = (GimpUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
|
||||
radius_x = radius_y = selection_border_radius;
|
||||
|
||||
if (unit != UNIT_PIXEL)
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble factor;
|
||||
|
||||
|
@ -1475,20 +1475,20 @@ gimage_mask_grow_callback (GtkWidget *widget,
|
|||
gpointer client_data,
|
||||
gpointer call_data)
|
||||
{
|
||||
GImage *gimage;
|
||||
GUnit unit;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
GImage *gimage;
|
||||
GimpUnit unit;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
gimage = GIMP_IMAGE (client_data);
|
||||
|
||||
selection_grow_pixels = (gint) (*(gdouble *) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
unit = (GimpUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
|
||||
radius_x = radius_y = selection_grow_pixels;
|
||||
|
||||
if (unit != UNIT_PIXEL)
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble factor;
|
||||
|
||||
|
@ -1511,7 +1511,7 @@ gimage_mask_shrink_callback (GtkWidget *widget,
|
|||
gpointer call_data)
|
||||
{
|
||||
GImage *gimage;
|
||||
GUnit unit;
|
||||
GimpUnit unit;
|
||||
gint radius_x;
|
||||
gint radius_y;
|
||||
|
||||
|
@ -1519,7 +1519,7 @@ gimage_mask_shrink_callback (GtkWidget *widget,
|
|||
|
||||
selection_shrink_pixels = (gint) (*(gdouble *) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
unit = (GimpUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
|
||||
radius_x = radius_y = selection_shrink_pixels;
|
||||
|
||||
|
@ -1527,7 +1527,7 @@ gimage_mask_shrink_callback (GtkWidget *widget,
|
|||
! GTK_TOGGLE_BUTTON (gtk_object_get_data (GTK_OBJECT (widget),
|
||||
"edge_lock_toggle"))->active;
|
||||
|
||||
if (unit != UNIT_PIXEL)
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble factor;
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ channel_ops_offset (GimpImage* gimage)
|
|||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (off_d->off_se);
|
||||
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (off_d->off_se), UNIT_PIXEL);
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (off_d->off_se), GIMP_UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (off_d->off_se), 0,
|
||||
gimage->xresolution, FALSE);
|
||||
|
|
|
@ -1405,20 +1405,20 @@ gimage_mask_feather_callback (GtkWidget *widget,
|
|||
gpointer client_data,
|
||||
gpointer call_data)
|
||||
{
|
||||
GImage *gimage;
|
||||
GUnit unit;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
GImage *gimage;
|
||||
GimpUnit unit;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
gimage = GIMP_IMAGE (client_data);
|
||||
|
||||
selection_feather_radius = *(gdouble *) call_data;
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
unit = (GimpUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
|
||||
radius_x = radius_y = selection_feather_radius;
|
||||
|
||||
if (unit != UNIT_PIXEL)
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble factor;
|
||||
|
||||
|
@ -1440,20 +1440,20 @@ gimage_mask_border_callback (GtkWidget *widget,
|
|||
gpointer client_data,
|
||||
gpointer call_data)
|
||||
{
|
||||
GImage *gimage;
|
||||
GUnit unit;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
GImage *gimage;
|
||||
GimpUnit unit;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
gimage = GIMP_IMAGE (client_data);
|
||||
|
||||
selection_border_radius = (gint) (*(gdouble *) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
unit = (GimpUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
|
||||
radius_x = radius_y = selection_border_radius;
|
||||
|
||||
if (unit != UNIT_PIXEL)
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble factor;
|
||||
|
||||
|
@ -1475,20 +1475,20 @@ gimage_mask_grow_callback (GtkWidget *widget,
|
|||
gpointer client_data,
|
||||
gpointer call_data)
|
||||
{
|
||||
GImage *gimage;
|
||||
GUnit unit;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
GImage *gimage;
|
||||
GimpUnit unit;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
gimage = GIMP_IMAGE (client_data);
|
||||
|
||||
selection_grow_pixels = (gint) (*(gdouble *) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
unit = (GimpUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
|
||||
radius_x = radius_y = selection_grow_pixels;
|
||||
|
||||
if (unit != UNIT_PIXEL)
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble factor;
|
||||
|
||||
|
@ -1511,7 +1511,7 @@ gimage_mask_shrink_callback (GtkWidget *widget,
|
|||
gpointer call_data)
|
||||
{
|
||||
GImage *gimage;
|
||||
GUnit unit;
|
||||
GimpUnit unit;
|
||||
gint radius_x;
|
||||
gint radius_y;
|
||||
|
||||
|
@ -1519,7 +1519,7 @@ gimage_mask_shrink_callback (GtkWidget *widget,
|
|||
|
||||
selection_shrink_pixels = (gint) (*(gdouble *) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
unit = (GimpUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
|
||||
radius_x = radius_y = selection_shrink_pixels;
|
||||
|
||||
|
@ -1527,7 +1527,7 @@ gimage_mask_shrink_callback (GtkWidget *widget,
|
|||
! GTK_TOGGLE_BUTTON (gtk_object_get_data (GTK_OBJECT (widget),
|
||||
"edge_lock_toggle"))->active;
|
||||
|
||||
if (unit != UNIT_PIXEL)
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble factor;
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ channel_ops_offset (GimpImage* gimage)
|
|||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (off_d->off_se);
|
||||
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (off_d->off_se), UNIT_PIXEL);
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (off_d->off_se), GIMP_UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (off_d->off_se), 0,
|
||||
gimage->xresolution, FALSE);
|
||||
|
|
|
@ -136,7 +136,7 @@ channel_ops_offset (GimpImage* gimage)
|
|||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (off_d->off_se);
|
||||
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (off_d->off_se), UNIT_PIXEL);
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (off_d->off_se), GIMP_UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (off_d->off_se), 0,
|
||||
gimage->xresolution, FALSE);
|
||||
|
|
|
@ -388,14 +388,14 @@ gimp_image_get_resolution (GimpImage *gimage,
|
|||
|
||||
void
|
||||
gimp_image_set_unit (GimpImage *gimage,
|
||||
GUnit unit)
|
||||
GimpUnit unit)
|
||||
{
|
||||
undo_push_resolution (gimage);
|
||||
|
||||
gimage->unit = unit;
|
||||
}
|
||||
|
||||
GUnit
|
||||
GimpUnit
|
||||
gimp_image_get_unit (GimpImage *gimage)
|
||||
{
|
||||
return gimage->unit;
|
||||
|
|
|
@ -116,8 +116,8 @@ void gimp_image_set_resolution (GimpImage *,
|
|||
gdouble, gdouble);
|
||||
void gimp_image_get_resolution (GimpImage *,
|
||||
gdouble *, gdouble *);
|
||||
void gimp_image_set_unit (GimpImage *, GUnit);
|
||||
GUnit gimp_image_get_unit (GimpImage *);
|
||||
void gimp_image_set_unit (GimpImage *, GimpUnit);
|
||||
GimpUnit gimp_image_get_unit (GimpImage *);
|
||||
void gimp_image_set_save_proc (GimpImage *,
|
||||
PlugInProcDef *);
|
||||
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
|
||||
|
|
|
@ -388,14 +388,14 @@ gimp_image_get_resolution (GimpImage *gimage,
|
|||
|
||||
void
|
||||
gimp_image_set_unit (GimpImage *gimage,
|
||||
GUnit unit)
|
||||
GimpUnit unit)
|
||||
{
|
||||
undo_push_resolution (gimage);
|
||||
|
||||
gimage->unit = unit;
|
||||
}
|
||||
|
||||
GUnit
|
||||
GimpUnit
|
||||
gimp_image_get_unit (GimpImage *gimage)
|
||||
{
|
||||
return gimage->unit;
|
||||
|
|
|
@ -116,8 +116,8 @@ void gimp_image_set_resolution (GimpImage *,
|
|||
gdouble, gdouble);
|
||||
void gimp_image_get_resolution (GimpImage *,
|
||||
gdouble *, gdouble *);
|
||||
void gimp_image_set_unit (GimpImage *, GUnit);
|
||||
GUnit gimp_image_get_unit (GimpImage *);
|
||||
void gimp_image_set_unit (GimpImage *, GimpUnit);
|
||||
GimpUnit gimp_image_get_unit (GimpImage *);
|
||||
void gimp_image_set_save_proc (GimpImage *,
|
||||
PlugInProcDef *);
|
||||
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
|
||||
|
|
|
@ -388,14 +388,14 @@ gimp_image_get_resolution (GimpImage *gimage,
|
|||
|
||||
void
|
||||
gimp_image_set_unit (GimpImage *gimage,
|
||||
GUnit unit)
|
||||
GimpUnit unit)
|
||||
{
|
||||
undo_push_resolution (gimage);
|
||||
|
||||
gimage->unit = unit;
|
||||
}
|
||||
|
||||
GUnit
|
||||
GimpUnit
|
||||
gimp_image_get_unit (GimpImage *gimage)
|
||||
{
|
||||
return gimage->unit;
|
||||
|
|
|
@ -116,8 +116,8 @@ void gimp_image_set_resolution (GimpImage *,
|
|||
gdouble, gdouble);
|
||||
void gimp_image_get_resolution (GimpImage *,
|
||||
gdouble *, gdouble *);
|
||||
void gimp_image_set_unit (GimpImage *, GUnit);
|
||||
GUnit gimp_image_get_unit (GimpImage *);
|
||||
void gimp_image_set_unit (GimpImage *, GimpUnit);
|
||||
GimpUnit gimp_image_get_unit (GimpImage *);
|
||||
void gimp_image_set_save_proc (GimpImage *,
|
||||
PlugInProcDef *);
|
||||
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
|
||||
|
|
|
@ -388,14 +388,14 @@ gimp_image_get_resolution (GimpImage *gimage,
|
|||
|
||||
void
|
||||
gimp_image_set_unit (GimpImage *gimage,
|
||||
GUnit unit)
|
||||
GimpUnit unit)
|
||||
{
|
||||
undo_push_resolution (gimage);
|
||||
|
||||
gimage->unit = unit;
|
||||
}
|
||||
|
||||
GUnit
|
||||
GimpUnit
|
||||
gimp_image_get_unit (GimpImage *gimage)
|
||||
{
|
||||
return gimage->unit;
|
||||
|
|
|
@ -116,8 +116,8 @@ void gimp_image_set_resolution (GimpImage *,
|
|||
gdouble, gdouble);
|
||||
void gimp_image_get_resolution (GimpImage *,
|
||||
gdouble *, gdouble *);
|
||||
void gimp_image_set_unit (GimpImage *, GUnit);
|
||||
GUnit gimp_image_get_unit (GimpImage *);
|
||||
void gimp_image_set_unit (GimpImage *, GimpUnit);
|
||||
GimpUnit gimp_image_get_unit (GimpImage *);
|
||||
void gimp_image_set_save_proc (GimpImage *,
|
||||
PlugInProcDef *);
|
||||
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
|
||||
|
|
|
@ -388,14 +388,14 @@ gimp_image_get_resolution (GimpImage *gimage,
|
|||
|
||||
void
|
||||
gimp_image_set_unit (GimpImage *gimage,
|
||||
GUnit unit)
|
||||
GimpUnit unit)
|
||||
{
|
||||
undo_push_resolution (gimage);
|
||||
|
||||
gimage->unit = unit;
|
||||
}
|
||||
|
||||
GUnit
|
||||
GimpUnit
|
||||
gimp_image_get_unit (GimpImage *gimage)
|
||||
{
|
||||
return gimage->unit;
|
||||
|
|
|
@ -116,8 +116,8 @@ void gimp_image_set_resolution (GimpImage *,
|
|||
gdouble, gdouble);
|
||||
void gimp_image_get_resolution (GimpImage *,
|
||||
gdouble *, gdouble *);
|
||||
void gimp_image_set_unit (GimpImage *, GUnit);
|
||||
GUnit gimp_image_get_unit (GimpImage *);
|
||||
void gimp_image_set_unit (GimpImage *, GimpUnit);
|
||||
GimpUnit gimp_image_get_unit (GimpImage *);
|
||||
void gimp_image_set_save_proc (GimpImage *,
|
||||
PlugInProcDef *);
|
||||
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
|
||||
|
|
|
@ -2396,9 +2396,9 @@ typedef struct _ResolutionUndo ResolutionUndo;
|
|||
|
||||
struct _ResolutionUndo
|
||||
{
|
||||
gdouble xres;
|
||||
gdouble yres;
|
||||
GUnit unit;
|
||||
gdouble xres;
|
||||
gdouble yres;
|
||||
GimpUnit unit;
|
||||
};
|
||||
|
||||
int
|
||||
|
@ -2434,8 +2434,8 @@ undo_pop_resolution (GImage *gimage,
|
|||
void *data_ptr)
|
||||
{
|
||||
ResolutionUndo *data;
|
||||
gdouble tmpres;
|
||||
GUnit tmpunit;
|
||||
gdouble tmpres;
|
||||
GimpUnit tmpunit;
|
||||
|
||||
data = data_ptr;
|
||||
|
||||
|
@ -2853,54 +2853,57 @@ undo_free_cantundo (UndoState state,
|
|||
|
||||
/* A "ok" to the name means I've checked where it's used and
|
||||
it seems plausible. -- austin 23/9/99 */
|
||||
static struct undo_name_t {
|
||||
UndoType type;
|
||||
const char *name;
|
||||
} undo_name[] = {
|
||||
{UNDO_NULL, N_("<<invalid>>")},
|
||||
{IMAGE_UNDO, N_("image")},
|
||||
{IMAGE_MOD_UNDO, N_("image mod")},
|
||||
{MASK_UNDO, N_("mask")},
|
||||
{LAYER_DISPLACE_UNDO, N_("layer move")}, /* ok */
|
||||
{TRANSFORM_UNDO, N_("transform")},
|
||||
{PAINT_UNDO, N_("paint")},
|
||||
{LAYER_ADD_UNDO, N_("new layer")},
|
||||
{LAYER_REMOVE_UNDO, N_("delete layer")},
|
||||
{LAYER_MOD, N_("layer mod")},
|
||||
{LAYER_MASK_ADD_UNDO, N_("add layer mask")}, /* ok */
|
||||
{LAYER_MASK_REMOVE_UNDO, N_("delete layer mask")}, /* ok */
|
||||
{LAYER_RENAME_UNDO, N_("rename layer")},
|
||||
{LAYER_REPOSITION_UNDO, N_("layer reposition")}, /* ok */
|
||||
{CHANNEL_ADD_UNDO, N_("new channel")},
|
||||
{CHANNEL_REMOVE_UNDO, N_("delete channel")},
|
||||
{CHANNEL_MOD, N_("channel mod")},
|
||||
{FS_TO_LAYER_UNDO, N_("FS to layer")}, /* ok */
|
||||
{GIMAGE_MOD, N_("gimage")},
|
||||
{FS_RIGOR, N_("FS rigor")},
|
||||
{FS_RELAX, N_("FS relax")},
|
||||
{GUIDE_UNDO, N_("guide")},
|
||||
{TEXT_UNDO, N_("text")},
|
||||
{FLOAT_MASK_UNDO, N_("float selection")},
|
||||
{EDIT_PASTE_UNDO, N_("paste")},
|
||||
{EDIT_CUT_UNDO, N_("cut")},
|
||||
{TRANSFORM_CORE_UNDO, N_("transform core")},
|
||||
{PAINT_CORE_UNDO, N_("paint core")},
|
||||
{FLOATING_LAYER_UNDO, N_("floating layer")}, /* unused! */
|
||||
{LINKED_LAYER_UNDO, N_("linked layer")},
|
||||
{LAYER_APPLY_MASK_UNDO, N_("apply layer mask")}, /* ok */
|
||||
{LAYER_MERGE_UNDO, N_("layer merge")},
|
||||
{FS_ANCHOR_UNDO, N_("FS anchor")},
|
||||
{GIMAGE_MOD_UNDO, N_("gimage mod")},
|
||||
{CROP_UNDO, N_("crop")},
|
||||
{LAYER_SCALE_UNDO, N_("layer scale")},
|
||||
{LAYER_RESIZE_UNDO, N_("layer resize")},
|
||||
{QMASK_UNDO, N_("quickmask")},
|
||||
{PARASITE_ATTACH_UNDO, N_("attach parasite")},
|
||||
{PARASITE_REMOVE_UNDO, N_("remove parasite")},
|
||||
{RESOLUTION_UNDO, N_("resolution change")},
|
||||
{IMAGE_SCALE_UNDO, N_("image scale")},
|
||||
{IMAGE_RESIZE_UNDO, N_("image resize")},
|
||||
{MISC_UNDO, N_("misc")}
|
||||
static struct undo_name_t
|
||||
{
|
||||
UndoType type;
|
||||
const gchar *name;
|
||||
}
|
||||
undo_name[] =
|
||||
{
|
||||
{ UNDO_NULL, N_("<<invalid>>") },
|
||||
{ IMAGE_UNDO, N_("image") },
|
||||
{ IMAGE_MOD_UNDO, N_("image mod") },
|
||||
{ MASK_UNDO, N_("mask") },
|
||||
{ LAYER_DISPLACE_UNDO, N_("layer move") }, /* ok */
|
||||
{ TRANSFORM_UNDO, N_("transform") },
|
||||
{ PAINT_UNDO, N_("paint") },
|
||||
{ LAYER_ADD_UNDO, N_("new layer") },
|
||||
{ LAYER_REMOVE_UNDO, N_("delete layer") },
|
||||
{ LAYER_MOD, N_("layer mod") },
|
||||
{ LAYER_MASK_ADD_UNDO, N_("add layer mask") }, /* ok */
|
||||
{ LAYER_MASK_REMOVE_UNDO, N_("delete layer mask") }, /* ok */
|
||||
{ LAYER_RENAME_UNDO, N_("rename layer") },
|
||||
{ LAYER_REPOSITION_UNDO, N_("layer reposition") }, /* ok */
|
||||
{ CHANNEL_ADD_UNDO, N_("new channel") },
|
||||
{ CHANNEL_REMOVE_UNDO, N_("delete channel") },
|
||||
{ CHANNEL_MOD, N_("channel mod") },
|
||||
{ FS_TO_LAYER_UNDO, N_("FS to layer") }, /* ok */
|
||||
{ GIMAGE_MOD, N_("gimage") },
|
||||
{ FS_RIGOR, N_("FS rigor") },
|
||||
{ FS_RELAX, N_("FS relax") },
|
||||
{ GUIDE_UNDO, N_("guide") },
|
||||
{ TEXT_UNDO, N_("text") },
|
||||
{ FLOAT_MASK_UNDO, N_("float selection") },
|
||||
{ EDIT_PASTE_UNDO, N_("paste") },
|
||||
{ EDIT_CUT_UNDO, N_("cut") },
|
||||
{ TRANSFORM_CORE_UNDO, N_("transform core") },
|
||||
{ PAINT_CORE_UNDO, N_("paint core") },
|
||||
{ FLOATING_LAYER_UNDO, N_("floating layer") }, /* unused! */
|
||||
{ LINKED_LAYER_UNDO, N_("linked layer") },
|
||||
{ LAYER_APPLY_MASK_UNDO, N_("apply layer mask") }, /* ok */
|
||||
{ LAYER_MERGE_UNDO, N_("layer merge") },
|
||||
{ FS_ANCHOR_UNDO, N_("FS anchor") },
|
||||
{ GIMAGE_MOD_UNDO, N_("gimage mod") },
|
||||
{ CROP_UNDO, N_("crop") },
|
||||
{ LAYER_SCALE_UNDO, N_("layer scale") },
|
||||
{ LAYER_RESIZE_UNDO, N_("layer resize") },
|
||||
{ QMASK_UNDO, N_("quickmask") },
|
||||
{ PARASITE_ATTACH_UNDO, N_("attach parasite") },
|
||||
{ PARASITE_REMOVE_UNDO, N_("remove parasite") },
|
||||
{ RESOLUTION_UNDO, N_("resolution change") },
|
||||
{ IMAGE_SCALE_UNDO, N_("image scale") },
|
||||
{ IMAGE_RESIZE_UNDO, N_("image resize") },
|
||||
{ MISC_UNDO, N_("misc") }
|
||||
};
|
||||
#define NUM_NAMES (sizeof (undo_name) / sizeof (struct undo_name_t))
|
||||
|
||||
|
|
|
@ -388,14 +388,14 @@ gimp_image_get_resolution (GimpImage *gimage,
|
|||
|
||||
void
|
||||
gimp_image_set_unit (GimpImage *gimage,
|
||||
GUnit unit)
|
||||
GimpUnit unit)
|
||||
{
|
||||
undo_push_resolution (gimage);
|
||||
|
||||
gimage->unit = unit;
|
||||
}
|
||||
|
||||
GUnit
|
||||
GimpUnit
|
||||
gimp_image_get_unit (GimpImage *gimage)
|
||||
{
|
||||
return gimage->unit;
|
||||
|
|
|
@ -116,8 +116,8 @@ void gimp_image_set_resolution (GimpImage *,
|
|||
gdouble, gdouble);
|
||||
void gimp_image_get_resolution (GimpImage *,
|
||||
gdouble *, gdouble *);
|
||||
void gimp_image_set_unit (GimpImage *, GUnit);
|
||||
GUnit gimp_image_get_unit (GimpImage *);
|
||||
void gimp_image_set_unit (GimpImage *, GimpUnit);
|
||||
GimpUnit gimp_image_get_unit (GimpImage *);
|
||||
void gimp_image_set_save_proc (GimpImage *,
|
||||
PlugInProcDef *);
|
||||
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
|
||||
|
|
|
@ -388,14 +388,14 @@ gimp_image_get_resolution (GimpImage *gimage,
|
|||
|
||||
void
|
||||
gimp_image_set_unit (GimpImage *gimage,
|
||||
GUnit unit)
|
||||
GimpUnit unit)
|
||||
{
|
||||
undo_push_resolution (gimage);
|
||||
|
||||
gimage->unit = unit;
|
||||
}
|
||||
|
||||
GUnit
|
||||
GimpUnit
|
||||
gimp_image_get_unit (GimpImage *gimage)
|
||||
{
|
||||
return gimage->unit;
|
||||
|
|
|
@ -116,8 +116,8 @@ void gimp_image_set_resolution (GimpImage *,
|
|||
gdouble, gdouble);
|
||||
void gimp_image_get_resolution (GimpImage *,
|
||||
gdouble *, gdouble *);
|
||||
void gimp_image_set_unit (GimpImage *, GUnit);
|
||||
GUnit gimp_image_get_unit (GimpImage *);
|
||||
void gimp_image_set_unit (GimpImage *, GimpUnit);
|
||||
GimpUnit gimp_image_get_unit (GimpImage *);
|
||||
void gimp_image_set_save_proc (GimpImage *,
|
||||
PlugInProcDef *);
|
||||
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
|
||||
|
|
|
@ -143,7 +143,7 @@ selection_options_init (SelectionOptions *options,
|
|||
options->fixed_size = options->fixed_size_d = FALSE;
|
||||
options->fixed_height = options->fixed_height_d = 1;
|
||||
options->fixed_width = options->fixed_width_d = 1;
|
||||
options->fixed_unit = options->fixed_unit_d = UNIT_PIXEL;
|
||||
options->fixed_unit = options->fixed_unit_d = GIMP_UNIT_PIXEL;
|
||||
|
||||
options->feather_w = NULL;
|
||||
options->feather_radius_w = NULL;
|
||||
|
@ -385,8 +385,8 @@ selection_options_reset (SelectionOptions *options)
|
|||
options->fixed_unit_d);
|
||||
|
||||
digits =
|
||||
((options->fixed_unit_d == UNIT_PIXEL) ? 0 :
|
||||
((options->fixed_unit_d == UNIT_PERCENT) ? 2 :
|
||||
((options->fixed_unit_d == GIMP_UNIT_PIXEL) ? 0 :
|
||||
((options->fixed_unit_d == GIMP_UNIT_PERCENT) ? 2 :
|
||||
(MIN (6, MAX (3, gimp_unit_get_digits (options->fixed_unit_d))))));
|
||||
|
||||
spinbutton =
|
||||
|
|
|
@ -39,20 +39,21 @@
|
|||
|
||||
/* internal structures */
|
||||
|
||||
typedef struct {
|
||||
guint delete_on_exit;
|
||||
gdouble factor;
|
||||
gint digits;
|
||||
gchar *identifier;
|
||||
gchar *symbol;
|
||||
gchar *abbreviation;
|
||||
gchar *singular;
|
||||
gchar *plural;
|
||||
typedef struct
|
||||
{
|
||||
gboolean delete_on_exit;
|
||||
gdouble factor;
|
||||
gint digits;
|
||||
gchar *identifier;
|
||||
gchar *symbol;
|
||||
gchar *abbreviation;
|
||||
gchar *singular;
|
||||
gchar *plural;
|
||||
} GimpUnitDef;
|
||||
|
||||
/* these are the built-in units
|
||||
*/
|
||||
static GimpUnitDef gimp_unit_defs[UNIT_END] =
|
||||
static GimpUnitDef gimp_unit_defs[GIMP_UNIT_END] =
|
||||
{
|
||||
/* pseudo unit */
|
||||
{ FALSE, 0.0, 0, "pixels", "px", "px", N_("pixel"), N_("pixels") },
|
||||
|
@ -79,9 +80,9 @@ static gint number_of_user_units = 0;
|
|||
/* private functions */
|
||||
|
||||
static GimpUnitDef *
|
||||
gimp_unit_get_user_unit (GUnit unit)
|
||||
gimp_unit_get_user_unit (GimpUnit unit)
|
||||
{
|
||||
return g_slist_nth_data (user_units, unit - UNIT_END);
|
||||
return g_slist_nth_data (user_units, unit - GIMP_UNIT_END);
|
||||
}
|
||||
|
||||
|
||||
|
@ -90,17 +91,17 @@ gimp_unit_get_user_unit (GUnit unit)
|
|||
gint
|
||||
gimp_unit_get_number_of_units (void)
|
||||
{
|
||||
return UNIT_END + number_of_user_units;
|
||||
return GIMP_UNIT_END + number_of_user_units;
|
||||
}
|
||||
|
||||
gint
|
||||
gimp_unit_get_number_of_built_in_units (void)
|
||||
{
|
||||
return UNIT_END;
|
||||
return GIMP_UNIT_END;
|
||||
}
|
||||
|
||||
|
||||
GUnit
|
||||
GimpUnit
|
||||
gimp_unit_new (gchar *identifier,
|
||||
gdouble factor,
|
||||
gint digits,
|
||||
|
@ -111,41 +112,41 @@ gimp_unit_new (gchar *identifier,
|
|||
{
|
||||
GimpUnitDef *user_unit;
|
||||
|
||||
user_unit = g_malloc (sizeof (GimpUnitDef));
|
||||
user_unit = g_new (GimpUnitDef, 1);
|
||||
user_unit->delete_on_exit = TRUE;
|
||||
user_unit->factor = factor;
|
||||
user_unit->digits = digits;
|
||||
user_unit->identifier = g_strdup (identifier);
|
||||
user_unit->symbol = g_strdup (symbol);
|
||||
user_unit->abbreviation = g_strdup (abbreviation);
|
||||
user_unit->singular = g_strdup (singular);
|
||||
user_unit->plural = g_strdup (plural);
|
||||
user_unit->factor = factor;
|
||||
user_unit->digits = digits;
|
||||
user_unit->identifier = g_strdup (identifier);
|
||||
user_unit->symbol = g_strdup (symbol);
|
||||
user_unit->abbreviation = g_strdup (abbreviation);
|
||||
user_unit->singular = g_strdup (singular);
|
||||
user_unit->plural = g_strdup (plural);
|
||||
|
||||
user_units = g_slist_append (user_units, user_unit);
|
||||
number_of_user_units++;
|
||||
|
||||
return UNIT_END + number_of_user_units - 1;
|
||||
return GIMP_UNIT_END + number_of_user_units - 1;
|
||||
}
|
||||
|
||||
|
||||
guint
|
||||
gimp_unit_get_deletion_flag (GUnit unit)
|
||||
gboolean
|
||||
gimp_unit_get_deletion_flag (GimpUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)), FALSE);
|
||||
g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) &&
|
||||
(unit < (GIMP_UNIT_END + number_of_user_units)), FALSE);
|
||||
|
||||
if (unit < UNIT_END)
|
||||
if (unit < GIMP_UNIT_END)
|
||||
return FALSE;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->delete_on_exit;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_unit_set_deletion_flag (GUnit unit,
|
||||
guint deletion_flag)
|
||||
gimp_unit_set_deletion_flag (GimpUnit unit,
|
||||
gboolean deletion_flag)
|
||||
{
|
||||
g_return_if_fail ( (unit >= UNIT_END) &&
|
||||
(unit < (UNIT_END + number_of_user_units)));
|
||||
g_return_if_fail ((unit >= GIMP_UNIT_END) &&
|
||||
(unit < (GIMP_UNIT_END + number_of_user_units)));
|
||||
|
||||
gimp_unit_get_user_unit (unit)->delete_on_exit =
|
||||
deletion_flag ? TRUE : FALSE;
|
||||
|
@ -153,13 +154,13 @@ gimp_unit_set_deletion_flag (GUnit unit,
|
|||
|
||||
|
||||
gdouble
|
||||
gimp_unit_get_factor (GUnit unit)
|
||||
gimp_unit_get_factor (GimpUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)),
|
||||
gimp_unit_defs[UNIT_INCH].factor );
|
||||
g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) &&
|
||||
(unit < (GIMP_UNIT_END + number_of_user_units)),
|
||||
gimp_unit_defs[GIMP_UNIT_INCH].factor);
|
||||
|
||||
if (unit < UNIT_END)
|
||||
if (unit < GIMP_UNIT_END)
|
||||
return gimp_unit_defs[unit].factor;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->factor;
|
||||
|
@ -167,13 +168,13 @@ gimp_unit_get_factor (GUnit unit)
|
|||
|
||||
|
||||
gint
|
||||
gimp_unit_get_digits (GUnit unit)
|
||||
gimp_unit_get_digits (GimpUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)),
|
||||
gimp_unit_defs[UNIT_INCH].digits );
|
||||
g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) &&
|
||||
(unit < (GIMP_UNIT_END + number_of_user_units)),
|
||||
gimp_unit_defs[GIMP_UNIT_INCH].digits);
|
||||
|
||||
if (unit < UNIT_END)
|
||||
if (unit < GIMP_UNIT_END)
|
||||
return gimp_unit_defs[unit].digits;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->digits;
|
||||
|
@ -181,17 +182,17 @@ gimp_unit_get_digits (GUnit unit)
|
|||
|
||||
|
||||
gchar *
|
||||
gimp_unit_get_identifier (GUnit unit)
|
||||
gimp_unit_get_identifier (GimpUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)) ||
|
||||
(unit == UNIT_PERCENT),
|
||||
gimp_unit_defs[UNIT_INCH].identifier );
|
||||
g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) &&
|
||||
(unit < (GIMP_UNIT_END + number_of_user_units)) ||
|
||||
(unit == GIMP_UNIT_PERCENT),
|
||||
gimp_unit_defs[GIMP_UNIT_INCH].identifier);
|
||||
|
||||
if (unit < UNIT_END)
|
||||
if (unit < GIMP_UNIT_END)
|
||||
return gimp_unit_defs[unit].identifier;
|
||||
|
||||
if (unit == UNIT_PERCENT)
|
||||
if (unit == GIMP_UNIT_PERCENT)
|
||||
return gimp_unit_percent.identifier;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->identifier;
|
||||
|
@ -199,17 +200,17 @@ gimp_unit_get_identifier (GUnit unit)
|
|||
|
||||
|
||||
gchar *
|
||||
gimp_unit_get_symbol (GUnit unit)
|
||||
gimp_unit_get_symbol (GimpUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)) ||
|
||||
(unit == UNIT_PERCENT),
|
||||
gimp_unit_defs[UNIT_INCH].symbol );
|
||||
g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) &&
|
||||
(unit < (GIMP_UNIT_END + number_of_user_units)) ||
|
||||
(unit == GIMP_UNIT_PERCENT),
|
||||
gimp_unit_defs[GIMP_UNIT_INCH].symbol);
|
||||
|
||||
if (unit < UNIT_END)
|
||||
if (unit < GIMP_UNIT_END)
|
||||
return gimp_unit_defs[unit].symbol;
|
||||
|
||||
if (unit == UNIT_PERCENT)
|
||||
if (unit == GIMP_UNIT_PERCENT)
|
||||
return gimp_unit_percent.symbol;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->symbol;
|
||||
|
@ -217,17 +218,17 @@ gimp_unit_get_symbol (GUnit unit)
|
|||
|
||||
|
||||
gchar *
|
||||
gimp_unit_get_abbreviation (GUnit unit)
|
||||
gimp_unit_get_abbreviation (GimpUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)) ||
|
||||
(unit == UNIT_PERCENT),
|
||||
gimp_unit_defs[UNIT_INCH].abbreviation );
|
||||
g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) &&
|
||||
(unit < (GIMP_UNIT_END + number_of_user_units)) ||
|
||||
(unit == GIMP_UNIT_PERCENT),
|
||||
gimp_unit_defs[GIMP_UNIT_INCH].abbreviation);
|
||||
|
||||
if (unit < UNIT_END)
|
||||
if (unit < GIMP_UNIT_END)
|
||||
return gimp_unit_defs[unit].abbreviation;
|
||||
|
||||
if (unit == UNIT_PERCENT)
|
||||
if (unit == GIMP_UNIT_PERCENT)
|
||||
return gimp_unit_percent.abbreviation;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->abbreviation;
|
||||
|
@ -235,17 +236,17 @@ gimp_unit_get_abbreviation (GUnit unit)
|
|||
|
||||
|
||||
gchar *
|
||||
gimp_unit_get_singular (GUnit unit)
|
||||
gimp_unit_get_singular (GimpUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)) ||
|
||||
(unit == UNIT_PERCENT),
|
||||
gettext(gimp_unit_defs[UNIT_INCH].singular) );
|
||||
g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) &&
|
||||
(unit < (GIMP_UNIT_END + number_of_user_units)) ||
|
||||
(unit == GIMP_UNIT_PERCENT),
|
||||
gettext (gimp_unit_defs[GIMP_UNIT_INCH].singular));
|
||||
|
||||
if (unit < UNIT_END)
|
||||
if (unit < GIMP_UNIT_END)
|
||||
return gettext (gimp_unit_defs[unit].singular);
|
||||
|
||||
if (unit == UNIT_PERCENT)
|
||||
if (unit == GIMP_UNIT_PERCENT)
|
||||
return gettext (gimp_unit_percent.singular);
|
||||
|
||||
return gettext (gimp_unit_get_user_unit (unit)->singular);
|
||||
|
@ -253,17 +254,17 @@ gimp_unit_get_singular (GUnit unit)
|
|||
|
||||
|
||||
gchar *
|
||||
gimp_unit_get_plural (GUnit unit)
|
||||
gimp_unit_get_plural (GimpUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)) ||
|
||||
(unit == UNIT_PERCENT),
|
||||
gettext(gimp_unit_defs[UNIT_INCH].plural) );
|
||||
g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) &&
|
||||
(unit < (GIMP_UNIT_END + number_of_user_units)) ||
|
||||
(unit == GIMP_UNIT_PERCENT),
|
||||
gettext (gimp_unit_defs[GIMP_UNIT_INCH].plural));
|
||||
|
||||
if (unit < UNIT_END)
|
||||
if (unit < GIMP_UNIT_END)
|
||||
return gettext (gimp_unit_defs[unit].plural);
|
||||
|
||||
if (unit == UNIT_PERCENT)
|
||||
if (unit == GIMP_UNIT_PERCENT)
|
||||
return gettext (gimp_unit_percent.plural);
|
||||
|
||||
return gettext (gimp_unit_get_user_unit (unit)->plural);
|
||||
|
@ -272,22 +273,24 @@ gimp_unit_get_plural (GUnit unit)
|
|||
|
||||
/* unitrc functions **********/
|
||||
|
||||
void parse_unitrc (void)
|
||||
void
|
||||
parse_unitrc (void)
|
||||
{
|
||||
char *filename;
|
||||
gchar *filename;
|
||||
|
||||
filename = gimp_personal_rc_file ("unitrc");
|
||||
app_init_update_status(NULL, filename, -1);
|
||||
app_init_update_status (NULL, filename, -1);
|
||||
parse_gimprc_file (filename);
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
|
||||
void save_unitrc (void)
|
||||
void
|
||||
save_unitrc (void)
|
||||
{
|
||||
int i;
|
||||
char *filename;
|
||||
FILE *fp;
|
||||
gint i;
|
||||
gchar *filename;
|
||||
FILE *fp;
|
||||
|
||||
filename = gimp_personal_rc_file ("unitrc");
|
||||
|
||||
|
@ -302,9 +305,9 @@ void save_unitrc (void)
|
|||
"# supposed to edit it manually, but of course you can do.\n"
|
||||
"# This file will be entirely rewritten every time you\n"
|
||||
"# quit the gimp.\n\n");
|
||||
|
||||
|
||||
/* save user defined units */
|
||||
for (i = gimp_unit_get_number_of_built_in_units();
|
||||
for (i = gimp_unit_get_number_of_built_in_units ();
|
||||
i < gimp_unit_get_number_of_units ();
|
||||
i++)
|
||||
if (gimp_unit_get_deletion_flag (i) == FALSE)
|
||||
|
@ -317,12 +320,6 @@ void save_unitrc (void)
|
|||
fprintf (fp," (singular \"%s\")\n", gimp_unit_get_singular (i));
|
||||
fprintf (fp," (plural \"%s\"))\n\n", gimp_unit_get_plural (i));
|
||||
}
|
||||
|
||||
|
||||
fclose (fp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1005,9 +1005,9 @@ crop_start (Tool *tool,
|
|||
if (gdisp->dot_for_dot)
|
||||
{
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (origin_sizeentry),
|
||||
UNIT_PIXEL);
|
||||
GIMP_UNIT_PIXEL);
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (size_sizeentry),
|
||||
UNIT_PIXEL);
|
||||
GIMP_UNIT_PIXEL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1062,7 +1062,7 @@ crop_info_create (Tool *tool)
|
|||
origin_sizeentry =
|
||||
info_dialog_add_sizeentry (crop_info, _("Y:"), orig_vals, 1,
|
||||
gdisp->dot_for_dot ?
|
||||
UNIT_PIXEL : gdisp->gimage->unit, "%a",
|
||||
GIMP_UNIT_PIXEL : gdisp->gimage->unit, "%a",
|
||||
TRUE, TRUE, FALSE, GIMP_SIZE_ENTRY_UPDATE_SIZE,
|
||||
crop_orig_changed, crop_info);
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (origin_sizeentry),
|
||||
|
@ -1078,7 +1078,7 @@ crop_info_create (Tool *tool)
|
|||
size_sizeentry =
|
||||
info_dialog_add_sizeentry (crop_info, _("Height:"), size_vals, 1,
|
||||
gdisp->dot_for_dot ?
|
||||
UNIT_PIXEL : gdisp->gimage->unit, "%a",
|
||||
GIMP_UNIT_PIXEL : gdisp->gimage->unit, "%a",
|
||||
TRUE, TRUE, FALSE, GIMP_SIZE_ENTRY_UPDATE_SIZE,
|
||||
crop_size_changed, crop_info);
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (size_sizeentry),
|
||||
|
|
|
@ -402,18 +402,18 @@ info_dialog_add_spinbutton (InfoDialog *idialog,
|
|||
}
|
||||
|
||||
GtkWidget *
|
||||
info_dialog_add_sizeentry (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gdouble *value_ptr,
|
||||
gint nfields,
|
||||
GUnit unit,
|
||||
gchar *unit_format,
|
||||
gboolean menu_show_pixels,
|
||||
gboolean menu_show_percent,
|
||||
gboolean show_refval,
|
||||
GimpSizeEntryUP update_policy,
|
||||
GtkSignalFunc callback,
|
||||
gpointer data)
|
||||
info_dialog_add_sizeentry (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gdouble *value_ptr,
|
||||
gint nfields,
|
||||
GimpUnit unit,
|
||||
gchar *unit_format,
|
||||
gboolean menu_show_pixels,
|
||||
gboolean menu_show_percent,
|
||||
gboolean show_refval,
|
||||
GimpSizeEntryUpdatePolicy update_policy,
|
||||
GtkSignalFunc callback,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *alignment;
|
||||
GtkWidget *sizeentry;
|
||||
|
|
|
@ -115,12 +115,12 @@ GtkWidget *info_dialog_add_sizeentry (InfoDialog *idialog,
|
|||
gchar *title,
|
||||
gdouble *value_ptr,
|
||||
gint nfields,
|
||||
GUnit unit,
|
||||
GimpUnit unit,
|
||||
gchar *unit_format,
|
||||
gboolean menu_show_pixels,
|
||||
gboolean menu_show_percent,
|
||||
gboolean show_refval,
|
||||
GimpSizeEntryUP update_policy,
|
||||
GimpSizeEntryUpdatePolicy update_policy,
|
||||
GtkSignalFunc callback,
|
||||
gpointer data);
|
||||
|
||||
|
|
|
@ -92,10 +92,10 @@ static gint old_save_device_status;
|
|||
static gint old_always_restore_session;
|
||||
static gint old_default_width;
|
||||
static gint old_default_height;
|
||||
static GUnit old_default_units;
|
||||
static GimpUnit old_default_units;
|
||||
static gdouble old_default_xresolution;
|
||||
static gdouble old_default_yresolution;
|
||||
static GUnit old_default_resolution_units;
|
||||
static GimpUnit old_default_resolution_units;
|
||||
static gint old_default_type;
|
||||
static gint old_default_dot_for_dot;
|
||||
static gint old_stingy_memory_use;
|
||||
|
@ -259,7 +259,7 @@ file_prefs_check_settings (void)
|
|||
default_height = old_default_height;
|
||||
return PREFS_CORRUPT;
|
||||
}
|
||||
if (default_units < UNIT_INCH ||
|
||||
if (default_units < GIMP_UNIT_INCH ||
|
||||
default_units >= gimp_unit_get_number_of_units ())
|
||||
{
|
||||
g_message (_("Error: Default unit must be within unit range."));
|
||||
|
@ -274,7 +274,7 @@ file_prefs_check_settings (void)
|
|||
default_yresolution = old_default_yresolution;
|
||||
return PREFS_CORRUPT;
|
||||
}
|
||||
if (default_resolution_units < UNIT_INCH ||
|
||||
if (default_resolution_units < GIMP_UNIT_INCH ||
|
||||
default_resolution_units >= gimp_unit_get_number_of_units ())
|
||||
{
|
||||
g_message (_("Error: Default resolution unit must be within unit range."));
|
||||
|
@ -2337,7 +2337,8 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
|
||||
sizeentry =
|
||||
gimp_size_entry_new (2, UNIT_INCH, pixels_per_unit, FALSE, FALSE, TRUE, 75,
|
||||
gimp_size_entry_new (2, GIMP_UNIT_INCH, pixels_per_unit,
|
||||
FALSE, FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
|
||||
g_free (pixels_per_unit);
|
||||
|
@ -2429,7 +2430,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
{ N_("Temp Dir:"), N_("Select Temp Dir"), &edit_temp_path },
|
||||
{ N_("Swap Dir:"), N_("Select Swap Dir"), &edit_swap_path },
|
||||
};
|
||||
static int ndirs = sizeof (dirs) / sizeof (dirs[0]);
|
||||
static gint ndirs = sizeof (dirs) / sizeof (dirs[0]);
|
||||
|
||||
table = gtk_table_new (ndirs + 1, 2, FALSE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
|
@ -2492,7 +2493,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
N_("Select Modules Dir"),
|
||||
&edit_module_path }
|
||||
};
|
||||
static int npaths = sizeof (paths) / sizeof (paths[0]);
|
||||
static gint npaths = sizeof (paths) / sizeof (paths[0]);
|
||||
|
||||
for (i = 0; i < npaths; i++)
|
||||
{
|
||||
|
|
|
@ -87,7 +87,7 @@ resize_widget_new (ResizeType type,
|
|||
gint height,
|
||||
gdouble resolution_x,
|
||||
gdouble resolution_y,
|
||||
GUnit unit,
|
||||
GimpUnit unit,
|
||||
gboolean dot_for_dot,
|
||||
GtkSignalFunc ok_cb,
|
||||
GtkSignalFunc cancel_cb,
|
||||
|
@ -289,7 +289,8 @@ resize_widget_new (ResizeType type,
|
|||
gtk_widget_show (private->size_se);
|
||||
|
||||
if (dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->size_se), UNIT_PIXEL);
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->size_se),
|
||||
GIMP_UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->size_se), 0,
|
||||
resolution_x, FALSE);
|
||||
|
@ -439,7 +440,7 @@ resize_widget_new (ResizeType type,
|
|||
|
||||
if (dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->offset_se),
|
||||
UNIT_PIXEL);
|
||||
GIMP_UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->offset_se), 0,
|
||||
resolution_x, FALSE);
|
||||
|
@ -777,25 +778,25 @@ static void
|
|||
orig_labels_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
Resize *resize;
|
||||
Resize *resize;
|
||||
ResizePrivate *private;
|
||||
GUnit unit;
|
||||
gchar format_buf[16];
|
||||
gchar buf[32];
|
||||
GimpUnit unit;
|
||||
gchar format_buf[16];
|
||||
gchar buf[32];
|
||||
|
||||
static GUnit label_unit = UNIT_PIXEL;
|
||||
static GimpUnit label_unit = GIMP_UNIT_PIXEL;
|
||||
|
||||
resize = (Resize *) data;
|
||||
private = (ResizePrivate *) resize->private_part;
|
||||
|
||||
unit = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget));
|
||||
|
||||
if (unit != UNIT_PERCENT)
|
||||
if (unit != GIMP_UNIT_PERCENT)
|
||||
label_unit = unit;
|
||||
|
||||
if (label_unit) /* unit != UNIT_PIXEL */
|
||||
if (label_unit) /* unit != GIMP_UNIT_PIXEL */
|
||||
{
|
||||
double unit_factor = gimp_unit_get_factor (label_unit);
|
||||
gdouble unit_factor = gimp_unit_get_factor (label_unit);
|
||||
|
||||
g_snprintf (format_buf, sizeof (format_buf), "%%.%df %s",
|
||||
gimp_unit_get_digits (label_unit) + 1,
|
||||
|
@ -807,7 +808,7 @@ orig_labels_update (GtkWidget *widget,
|
|||
private->old_height * unit_factor / private->old_res_y);
|
||||
gtk_label_set_text (GTK_LABEL (private->orig_height_label), buf);
|
||||
}
|
||||
else /* unit == UNIT_PIXEL */
|
||||
else /* unit == GIMP_UNIT_PIXEL */
|
||||
{
|
||||
g_snprintf (buf, sizeof (buf), "%d", private->old_width);
|
||||
gtk_label_set_text (GTK_LABEL (private->orig_width_label), buf);
|
||||
|
|
|
@ -47,7 +47,7 @@ struct _Resize
|
|||
|
||||
gdouble resolution_x;
|
||||
gdouble resolution_y;
|
||||
GUnit unit;
|
||||
GimpUnit unit;
|
||||
|
||||
gdouble ratio_x;
|
||||
gdouble ratio_y;
|
||||
|
@ -69,7 +69,7 @@ Resize * resize_widget_new (ResizeType type,
|
|||
gint height,
|
||||
gdouble resolution_x,
|
||||
gdouble resolution_y,
|
||||
GUnit unit,
|
||||
GimpUnit unit,
|
||||
gboolean dot_for_dot,
|
||||
GtkSignalFunc ok_cb,
|
||||
GtkSignalFunc cancel_cb,
|
||||
|
|
|
@ -3443,14 +3443,14 @@ image_set_unit_invoker (Argument *args)
|
|||
{
|
||||
gboolean success = TRUE;
|
||||
GimpImage *gimage;
|
||||
GUnit unit;
|
||||
GimpUnit unit;
|
||||
|
||||
gimage = pdb_id_to_image (args[0].value.pdb_int);
|
||||
if (gimage == NULL)
|
||||
success = FALSE;
|
||||
|
||||
unit = args[1].value.pdb_int;
|
||||
if (unit < UNIT_INCH || unit >= gimp_unit_get_number_of_units ())
|
||||
if (unit < GIMP_UNIT_INCH || unit >= gimp_unit_get_number_of_units ())
|
||||
success = FALSE;
|
||||
|
||||
if (success)
|
||||
|
|
|
@ -136,7 +136,7 @@ channel_ops_offset (GimpImage* gimage)
|
|||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (off_d->off_se);
|
||||
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (off_d->off_se), UNIT_PIXEL);
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (off_d->off_se), GIMP_UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (off_d->off_se), 0,
|
||||
gimage->xresolution, FALSE);
|
||||
|
|
|
@ -136,7 +136,7 @@ channel_ops_offset (GimpImage* gimage)
|
|||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (off_d->off_se);
|
||||
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (off_d->off_se), UNIT_PIXEL);
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (off_d->off_se), GIMP_UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (off_d->off_se), 0,
|
||||
gimage->xresolution, FALSE);
|
||||
|
|
|
@ -388,14 +388,14 @@ gimp_image_get_resolution (GimpImage *gimage,
|
|||
|
||||
void
|
||||
gimp_image_set_unit (GimpImage *gimage,
|
||||
GUnit unit)
|
||||
GimpUnit unit)
|
||||
{
|
||||
undo_push_resolution (gimage);
|
||||
|
||||
gimage->unit = unit;
|
||||
}
|
||||
|
||||
GUnit
|
||||
GimpUnit
|
||||
gimp_image_get_unit (GimpImage *gimage)
|
||||
{
|
||||
return gimage->unit;
|
||||
|
|
|
@ -116,8 +116,8 @@ void gimp_image_set_resolution (GimpImage *,
|
|||
gdouble, gdouble);
|
||||
void gimp_image_get_resolution (GimpImage *,
|
||||
gdouble *, gdouble *);
|
||||
void gimp_image_set_unit (GimpImage *, GUnit);
|
||||
GUnit gimp_image_get_unit (GimpImage *);
|
||||
void gimp_image_set_unit (GimpImage *, GimpUnit);
|
||||
GimpUnit gimp_image_get_unit (GimpImage *);
|
||||
void gimp_image_set_save_proc (GimpImage *,
|
||||
PlugInProcDef *);
|
||||
PlugInProcDef * gimp_image_get_save_proc (GimpImage *);
|
||||
|
|
|
@ -40,11 +40,11 @@ struct _GimpImage
|
|||
gboolean has_filename; /* has a valid filename */
|
||||
PlugInProcDef *save_proc; /* last PDB save proc used */
|
||||
|
||||
gint width, height; /* width and height attributes */
|
||||
gdouble xresolution; /* image x-res, in dpi */
|
||||
gdouble yresolution; /* image y-res, in dpi */
|
||||
GUnit unit; /* image unit */
|
||||
GimpImageBaseType base_type; /* base gimp_image type */
|
||||
gint width, height; /* width and height attributes */
|
||||
gdouble xresolution; /* image x-res, in dpi */
|
||||
gdouble yresolution; /* image y-res, in dpi */
|
||||
GimpUnit unit; /* image unit */
|
||||
GimpImageBaseType base_type; /* base gimp_image type */
|
||||
|
||||
guchar *cmap; /* colormap--for indexed */
|
||||
int num_cols; /* number of cols--for indexed */
|
||||
|
|
14
app/gimprc.c
14
app/gimprc.c
|
@ -133,7 +133,7 @@ int preview_size = 32;
|
|||
int nav_preview_size = 112;
|
||||
int show_rulers = TRUE;
|
||||
int show_statusbar = TRUE;
|
||||
GUnit default_units = UNIT_INCH;
|
||||
GimpUnit default_units = GIMP_UNIT_INCH;
|
||||
int auto_save = TRUE;
|
||||
InterpolationType interpolation_type = LINEAR_INTERPOLATION;
|
||||
int confirm_on_close = TRUE;
|
||||
|
@ -146,7 +146,7 @@ int default_height = 857;
|
|||
int default_type = RGB;
|
||||
double default_xresolution = 72.0;
|
||||
double default_yresolution = 72.0;
|
||||
GUnit default_resolution_units = UNIT_INCH;
|
||||
GimpUnit default_resolution_units = GIMP_UNIT_INCH;
|
||||
int default_dot_for_dot = TRUE;
|
||||
int show_tips = TRUE;
|
||||
int last_tip = -1;
|
||||
|
@ -1337,11 +1337,11 @@ parse_units (gpointer val1p,
|
|||
return ERROR;
|
||||
token = get_next_token ();
|
||||
|
||||
*((GUnit *) val1p) = UNIT_INCH;
|
||||
for (i = UNIT_INCH; i < gimp_unit_get_number_of_units (); i++)
|
||||
*((GimpUnit *) val1p) = GIMP_UNIT_INCH;
|
||||
for (i = GIMP_UNIT_INCH; i < gimp_unit_get_number_of_units (); i++)
|
||||
if (strcmp (token_sym, gimp_unit_get_identifier (i)) == 0)
|
||||
{
|
||||
*((GUnit *) val1p) = i;
|
||||
*((GimpUnit *) val1p) = i;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2242,7 +2242,7 @@ parse_unit_info (gpointer val1p,
|
|||
{
|
||||
gint token;
|
||||
|
||||
GUnit unit;
|
||||
GimpUnit unit;
|
||||
|
||||
gchar *identifier = NULL;
|
||||
gdouble factor = 1.0;
|
||||
|
@ -2687,7 +2687,7 @@ static inline char *
|
|||
units_to_str (gpointer val1p,
|
||||
gpointer val2p)
|
||||
{
|
||||
return g_strdup (gimp_unit_get_identifier (*((GUnit*)val1p)));
|
||||
return g_strdup (gimp_unit_get_identifier (*((GimpUnit*)val1p)));
|
||||
}
|
||||
|
||||
static inline char *
|
||||
|
|
|
@ -55,14 +55,14 @@ extern int no_cursor_updating;
|
|||
extern int preview_size;
|
||||
extern int nav_preview_size;
|
||||
extern int show_rulers;
|
||||
extern GUnit default_units;
|
||||
extern GimpUnit default_units;
|
||||
extern int show_statusbar;
|
||||
extern int auto_save;
|
||||
extern InterpolationType interpolation_type;
|
||||
extern int confirm_on_close;
|
||||
extern int default_width, default_height;
|
||||
extern int default_type;
|
||||
extern GUnit default_resolution_units;
|
||||
extern GimpUnit default_resolution_units;
|
||||
extern double default_xresolution;
|
||||
extern double default_yresolution;
|
||||
extern int default_dot_for_dot;
|
||||
|
|
|
@ -221,7 +221,7 @@ gimp_query_size_box (gchar *title,
|
|||
gdouble lower,
|
||||
gdouble upper,
|
||||
gint digits,
|
||||
GUnit unit,
|
||||
GimpUnit unit,
|
||||
gdouble resolution,
|
||||
gboolean dot_for_dot,
|
||||
GtkObject *object,
|
||||
|
@ -239,7 +239,7 @@ gimp_query_size_box (gchar *title,
|
|||
sizeentry = gimp_size_entry_new (1, unit, "%p", TRUE, FALSE, FALSE, 100,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
if (dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), GIMP_UNIT_PIXEL);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
resolution, FALSE);
|
||||
gimp_size_entry_set_refval_digits (GIMP_SIZE_ENTRY (sizeentry), 0, digits);
|
||||
|
|
|
@ -82,7 +82,7 @@ GtkWidget * gimp_query_size_box (gchar *title,
|
|||
gdouble lower,
|
||||
gdouble upper,
|
||||
gint digits,
|
||||
GUnit unit,
|
||||
GimpUnit unit,
|
||||
gdouble resolution,
|
||||
gboolean dot_for_dot,
|
||||
GtkObject *object,
|
||||
|
|
185
app/gimpunit.c
185
app/gimpunit.c
|
@ -39,20 +39,21 @@
|
|||
|
||||
/* internal structures */
|
||||
|
||||
typedef struct {
|
||||
guint delete_on_exit;
|
||||
gdouble factor;
|
||||
gint digits;
|
||||
gchar *identifier;
|
||||
gchar *symbol;
|
||||
gchar *abbreviation;
|
||||
gchar *singular;
|
||||
gchar *plural;
|
||||
typedef struct
|
||||
{
|
||||
gboolean delete_on_exit;
|
||||
gdouble factor;
|
||||
gint digits;
|
||||
gchar *identifier;
|
||||
gchar *symbol;
|
||||
gchar *abbreviation;
|
||||
gchar *singular;
|
||||
gchar *plural;
|
||||
} GimpUnitDef;
|
||||
|
||||
/* these are the built-in units
|
||||
*/
|
||||
static GimpUnitDef gimp_unit_defs[UNIT_END] =
|
||||
static GimpUnitDef gimp_unit_defs[GIMP_UNIT_END] =
|
||||
{
|
||||
/* pseudo unit */
|
||||
{ FALSE, 0.0, 0, "pixels", "px", "px", N_("pixel"), N_("pixels") },
|
||||
|
@ -79,9 +80,9 @@ static gint number_of_user_units = 0;
|
|||
/* private functions */
|
||||
|
||||
static GimpUnitDef *
|
||||
gimp_unit_get_user_unit (GUnit unit)
|
||||
gimp_unit_get_user_unit (GimpUnit unit)
|
||||
{
|
||||
return g_slist_nth_data (user_units, unit - UNIT_END);
|
||||
return g_slist_nth_data (user_units, unit - GIMP_UNIT_END);
|
||||
}
|
||||
|
||||
|
||||
|
@ -90,17 +91,17 @@ gimp_unit_get_user_unit (GUnit unit)
|
|||
gint
|
||||
gimp_unit_get_number_of_units (void)
|
||||
{
|
||||
return UNIT_END + number_of_user_units;
|
||||
return GIMP_UNIT_END + number_of_user_units;
|
||||
}
|
||||
|
||||
gint
|
||||
gimp_unit_get_number_of_built_in_units (void)
|
||||
{
|
||||
return UNIT_END;
|
||||
return GIMP_UNIT_END;
|
||||
}
|
||||
|
||||
|
||||
GUnit
|
||||
GimpUnit
|
||||
gimp_unit_new (gchar *identifier,
|
||||
gdouble factor,
|
||||
gint digits,
|
||||
|
@ -111,41 +112,41 @@ gimp_unit_new (gchar *identifier,
|
|||
{
|
||||
GimpUnitDef *user_unit;
|
||||
|
||||
user_unit = g_malloc (sizeof (GimpUnitDef));
|
||||
user_unit = g_new (GimpUnitDef, 1);
|
||||
user_unit->delete_on_exit = TRUE;
|
||||
user_unit->factor = factor;
|
||||
user_unit->digits = digits;
|
||||
user_unit->identifier = g_strdup (identifier);
|
||||
user_unit->symbol = g_strdup (symbol);
|
||||
user_unit->abbreviation = g_strdup (abbreviation);
|
||||
user_unit->singular = g_strdup (singular);
|
||||
user_unit->plural = g_strdup (plural);
|
||||
user_unit->factor = factor;
|
||||
user_unit->digits = digits;
|
||||
user_unit->identifier = g_strdup (identifier);
|
||||
user_unit->symbol = g_strdup (symbol);
|
||||
user_unit->abbreviation = g_strdup (abbreviation);
|
||||
user_unit->singular = g_strdup (singular);
|
||||
user_unit->plural = g_strdup (plural);
|
||||
|
||||
user_units = g_slist_append (user_units, user_unit);
|
||||
number_of_user_units++;
|
||||
|
||||
return UNIT_END + number_of_user_units - 1;
|
||||
return GIMP_UNIT_END + number_of_user_units - 1;
|
||||
}
|
||||
|
||||
|
||||
guint
|
||||
gimp_unit_get_deletion_flag (GUnit unit)
|
||||
gboolean
|
||||
gimp_unit_get_deletion_flag (GimpUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)), FALSE);
|
||||
g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) &&
|
||||
(unit < (GIMP_UNIT_END + number_of_user_units)), FALSE);
|
||||
|
||||
if (unit < UNIT_END)
|
||||
if (unit < GIMP_UNIT_END)
|
||||
return FALSE;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->delete_on_exit;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_unit_set_deletion_flag (GUnit unit,
|
||||
guint deletion_flag)
|
||||
gimp_unit_set_deletion_flag (GimpUnit unit,
|
||||
gboolean deletion_flag)
|
||||
{
|
||||
g_return_if_fail ( (unit >= UNIT_END) &&
|
||||
(unit < (UNIT_END + number_of_user_units)));
|
||||
g_return_if_fail ((unit >= GIMP_UNIT_END) &&
|
||||
(unit < (GIMP_UNIT_END + number_of_user_units)));
|
||||
|
||||
gimp_unit_get_user_unit (unit)->delete_on_exit =
|
||||
deletion_flag ? TRUE : FALSE;
|
||||
|
@ -153,13 +154,13 @@ gimp_unit_set_deletion_flag (GUnit unit,
|
|||
|
||||
|
||||
gdouble
|
||||
gimp_unit_get_factor (GUnit unit)
|
||||
gimp_unit_get_factor (GimpUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)),
|
||||
gimp_unit_defs[UNIT_INCH].factor );
|
||||
g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) &&
|
||||
(unit < (GIMP_UNIT_END + number_of_user_units)),
|
||||
gimp_unit_defs[GIMP_UNIT_INCH].factor);
|
||||
|
||||
if (unit < UNIT_END)
|
||||
if (unit < GIMP_UNIT_END)
|
||||
return gimp_unit_defs[unit].factor;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->factor;
|
||||
|
@ -167,13 +168,13 @@ gimp_unit_get_factor (GUnit unit)
|
|||
|
||||
|
||||
gint
|
||||
gimp_unit_get_digits (GUnit unit)
|
||||
gimp_unit_get_digits (GimpUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)),
|
||||
gimp_unit_defs[UNIT_INCH].digits );
|
||||
g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) &&
|
||||
(unit < (GIMP_UNIT_END + number_of_user_units)),
|
||||
gimp_unit_defs[GIMP_UNIT_INCH].digits);
|
||||
|
||||
if (unit < UNIT_END)
|
||||
if (unit < GIMP_UNIT_END)
|
||||
return gimp_unit_defs[unit].digits;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->digits;
|
||||
|
@ -181,17 +182,17 @@ gimp_unit_get_digits (GUnit unit)
|
|||
|
||||
|
||||
gchar *
|
||||
gimp_unit_get_identifier (GUnit unit)
|
||||
gimp_unit_get_identifier (GimpUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)) ||
|
||||
(unit == UNIT_PERCENT),
|
||||
gimp_unit_defs[UNIT_INCH].identifier );
|
||||
g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) &&
|
||||
(unit < (GIMP_UNIT_END + number_of_user_units)) ||
|
||||
(unit == GIMP_UNIT_PERCENT),
|
||||
gimp_unit_defs[GIMP_UNIT_INCH].identifier);
|
||||
|
||||
if (unit < UNIT_END)
|
||||
if (unit < GIMP_UNIT_END)
|
||||
return gimp_unit_defs[unit].identifier;
|
||||
|
||||
if (unit == UNIT_PERCENT)
|
||||
if (unit == GIMP_UNIT_PERCENT)
|
||||
return gimp_unit_percent.identifier;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->identifier;
|
||||
|
@ -199,17 +200,17 @@ gimp_unit_get_identifier (GUnit unit)
|
|||
|
||||
|
||||
gchar *
|
||||
gimp_unit_get_symbol (GUnit unit)
|
||||
gimp_unit_get_symbol (GimpUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)) ||
|
||||
(unit == UNIT_PERCENT),
|
||||
gimp_unit_defs[UNIT_INCH].symbol );
|
||||
g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) &&
|
||||
(unit < (GIMP_UNIT_END + number_of_user_units)) ||
|
||||
(unit == GIMP_UNIT_PERCENT),
|
||||
gimp_unit_defs[GIMP_UNIT_INCH].symbol);
|
||||
|
||||
if (unit < UNIT_END)
|
||||
if (unit < GIMP_UNIT_END)
|
||||
return gimp_unit_defs[unit].symbol;
|
||||
|
||||
if (unit == UNIT_PERCENT)
|
||||
if (unit == GIMP_UNIT_PERCENT)
|
||||
return gimp_unit_percent.symbol;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->symbol;
|
||||
|
@ -217,17 +218,17 @@ gimp_unit_get_symbol (GUnit unit)
|
|||
|
||||
|
||||
gchar *
|
||||
gimp_unit_get_abbreviation (GUnit unit)
|
||||
gimp_unit_get_abbreviation (GimpUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)) ||
|
||||
(unit == UNIT_PERCENT),
|
||||
gimp_unit_defs[UNIT_INCH].abbreviation );
|
||||
g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) &&
|
||||
(unit < (GIMP_UNIT_END + number_of_user_units)) ||
|
||||
(unit == GIMP_UNIT_PERCENT),
|
||||
gimp_unit_defs[GIMP_UNIT_INCH].abbreviation);
|
||||
|
||||
if (unit < UNIT_END)
|
||||
if (unit < GIMP_UNIT_END)
|
||||
return gimp_unit_defs[unit].abbreviation;
|
||||
|
||||
if (unit == UNIT_PERCENT)
|
||||
if (unit == GIMP_UNIT_PERCENT)
|
||||
return gimp_unit_percent.abbreviation;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->abbreviation;
|
||||
|
@ -235,17 +236,17 @@ gimp_unit_get_abbreviation (GUnit unit)
|
|||
|
||||
|
||||
gchar *
|
||||
gimp_unit_get_singular (GUnit unit)
|
||||
gimp_unit_get_singular (GimpUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)) ||
|
||||
(unit == UNIT_PERCENT),
|
||||
gettext(gimp_unit_defs[UNIT_INCH].singular) );
|
||||
g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) &&
|
||||
(unit < (GIMP_UNIT_END + number_of_user_units)) ||
|
||||
(unit == GIMP_UNIT_PERCENT),
|
||||
gettext (gimp_unit_defs[GIMP_UNIT_INCH].singular));
|
||||
|
||||
if (unit < UNIT_END)
|
||||
if (unit < GIMP_UNIT_END)
|
||||
return gettext (gimp_unit_defs[unit].singular);
|
||||
|
||||
if (unit == UNIT_PERCENT)
|
||||
if (unit == GIMP_UNIT_PERCENT)
|
||||
return gettext (gimp_unit_percent.singular);
|
||||
|
||||
return gettext (gimp_unit_get_user_unit (unit)->singular);
|
||||
|
@ -253,17 +254,17 @@ gimp_unit_get_singular (GUnit unit)
|
|||
|
||||
|
||||
gchar *
|
||||
gimp_unit_get_plural (GUnit unit)
|
||||
gimp_unit_get_plural (GimpUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)) ||
|
||||
(unit == UNIT_PERCENT),
|
||||
gettext(gimp_unit_defs[UNIT_INCH].plural) );
|
||||
g_return_val_if_fail ((unit >= GIMP_UNIT_PIXEL) &&
|
||||
(unit < (GIMP_UNIT_END + number_of_user_units)) ||
|
||||
(unit == GIMP_UNIT_PERCENT),
|
||||
gettext (gimp_unit_defs[GIMP_UNIT_INCH].plural));
|
||||
|
||||
if (unit < UNIT_END)
|
||||
if (unit < GIMP_UNIT_END)
|
||||
return gettext (gimp_unit_defs[unit].plural);
|
||||
|
||||
if (unit == UNIT_PERCENT)
|
||||
if (unit == GIMP_UNIT_PERCENT)
|
||||
return gettext (gimp_unit_percent.plural);
|
||||
|
||||
return gettext (gimp_unit_get_user_unit (unit)->plural);
|
||||
|
@ -272,22 +273,24 @@ gimp_unit_get_plural (GUnit unit)
|
|||
|
||||
/* unitrc functions **********/
|
||||
|
||||
void parse_unitrc (void)
|
||||
void
|
||||
parse_unitrc (void)
|
||||
{
|
||||
char *filename;
|
||||
gchar *filename;
|
||||
|
||||
filename = gimp_personal_rc_file ("unitrc");
|
||||
app_init_update_status(NULL, filename, -1);
|
||||
app_init_update_status (NULL, filename, -1);
|
||||
parse_gimprc_file (filename);
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
|
||||
void save_unitrc (void)
|
||||
void
|
||||
save_unitrc (void)
|
||||
{
|
||||
int i;
|
||||
char *filename;
|
||||
FILE *fp;
|
||||
gint i;
|
||||
gchar *filename;
|
||||
FILE *fp;
|
||||
|
||||
filename = gimp_personal_rc_file ("unitrc");
|
||||
|
||||
|
@ -302,9 +305,9 @@ void save_unitrc (void)
|
|||
"# supposed to edit it manually, but of course you can do.\n"
|
||||
"# This file will be entirely rewritten every time you\n"
|
||||
"# quit the gimp.\n\n");
|
||||
|
||||
|
||||
/* save user defined units */
|
||||
for (i = gimp_unit_get_number_of_built_in_units();
|
||||
for (i = gimp_unit_get_number_of_built_in_units ();
|
||||
i < gimp_unit_get_number_of_units ();
|
||||
i++)
|
||||
if (gimp_unit_get_deletion_flag (i) == FALSE)
|
||||
|
@ -317,12 +320,6 @@ void save_unitrc (void)
|
|||
fprintf (fp," (singular \"%s\")\n", gimp_unit_get_singular (i));
|
||||
fprintf (fp," (plural \"%s\"))\n\n", gimp_unit_get_plural (i));
|
||||
}
|
||||
|
||||
|
||||
fclose (fp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1405,20 +1405,20 @@ gimage_mask_feather_callback (GtkWidget *widget,
|
|||
gpointer client_data,
|
||||
gpointer call_data)
|
||||
{
|
||||
GImage *gimage;
|
||||
GUnit unit;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
GImage *gimage;
|
||||
GimpUnit unit;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
gimage = GIMP_IMAGE (client_data);
|
||||
|
||||
selection_feather_radius = *(gdouble *) call_data;
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
unit = (GimpUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
|
||||
radius_x = radius_y = selection_feather_radius;
|
||||
|
||||
if (unit != UNIT_PIXEL)
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble factor;
|
||||
|
||||
|
@ -1440,20 +1440,20 @@ gimage_mask_border_callback (GtkWidget *widget,
|
|||
gpointer client_data,
|
||||
gpointer call_data)
|
||||
{
|
||||
GImage *gimage;
|
||||
GUnit unit;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
GImage *gimage;
|
||||
GimpUnit unit;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
gimage = GIMP_IMAGE (client_data);
|
||||
|
||||
selection_border_radius = (gint) (*(gdouble *) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
unit = (GimpUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
|
||||
radius_x = radius_y = selection_border_radius;
|
||||
|
||||
if (unit != UNIT_PIXEL)
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble factor;
|
||||
|
||||
|
@ -1475,20 +1475,20 @@ gimage_mask_grow_callback (GtkWidget *widget,
|
|||
gpointer client_data,
|
||||
gpointer call_data)
|
||||
{
|
||||
GImage *gimage;
|
||||
GUnit unit;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
GImage *gimage;
|
||||
GimpUnit unit;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
gimage = GIMP_IMAGE (client_data);
|
||||
|
||||
selection_grow_pixels = (gint) (*(gdouble *) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
unit = (GimpUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
|
||||
radius_x = radius_y = selection_grow_pixels;
|
||||
|
||||
if (unit != UNIT_PIXEL)
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble factor;
|
||||
|
||||
|
@ -1511,7 +1511,7 @@ gimage_mask_shrink_callback (GtkWidget *widget,
|
|||
gpointer call_data)
|
||||
{
|
||||
GImage *gimage;
|
||||
GUnit unit;
|
||||
GimpUnit unit;
|
||||
gint radius_x;
|
||||
gint radius_y;
|
||||
|
||||
|
@ -1519,7 +1519,7 @@ gimage_mask_shrink_callback (GtkWidget *widget,
|
|||
|
||||
selection_shrink_pixels = (gint) (*(gdouble *) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
unit = (GimpUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
|
||||
radius_x = radius_y = selection_shrink_pixels;
|
||||
|
||||
|
@ -1527,7 +1527,7 @@ gimage_mask_shrink_callback (GtkWidget *widget,
|
|||
! GTK_TOGGLE_BUTTON (gtk_object_get_data (GTK_OBJECT (widget),
|
||||
"edge_lock_toggle"))->active;
|
||||
|
||||
if (unit != UNIT_PIXEL)
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble factor;
|
||||
|
||||
|
|
|
@ -1405,20 +1405,20 @@ gimage_mask_feather_callback (GtkWidget *widget,
|
|||
gpointer client_data,
|
||||
gpointer call_data)
|
||||
{
|
||||
GImage *gimage;
|
||||
GUnit unit;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
GImage *gimage;
|
||||
GimpUnit unit;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
gimage = GIMP_IMAGE (client_data);
|
||||
|
||||
selection_feather_radius = *(gdouble *) call_data;
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
unit = (GimpUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
|
||||
radius_x = radius_y = selection_feather_radius;
|
||||
|
||||
if (unit != UNIT_PIXEL)
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble factor;
|
||||
|
||||
|
@ -1440,20 +1440,20 @@ gimage_mask_border_callback (GtkWidget *widget,
|
|||
gpointer client_data,
|
||||
gpointer call_data)
|
||||
{
|
||||
GImage *gimage;
|
||||
GUnit unit;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
GImage *gimage;
|
||||
GimpUnit unit;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
gimage = GIMP_IMAGE (client_data);
|
||||
|
||||
selection_border_radius = (gint) (*(gdouble *) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
unit = (GimpUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
|
||||
radius_x = radius_y = selection_border_radius;
|
||||
|
||||
if (unit != UNIT_PIXEL)
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble factor;
|
||||
|
||||
|
@ -1475,20 +1475,20 @@ gimage_mask_grow_callback (GtkWidget *widget,
|
|||
gpointer client_data,
|
||||
gpointer call_data)
|
||||
{
|
||||
GImage *gimage;
|
||||
GUnit unit;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
GImage *gimage;
|
||||
GimpUnit unit;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
gimage = GIMP_IMAGE (client_data);
|
||||
|
||||
selection_grow_pixels = (gint) (*(gdouble *) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
unit = (GimpUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
|
||||
radius_x = radius_y = selection_grow_pixels;
|
||||
|
||||
if (unit != UNIT_PIXEL)
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble factor;
|
||||
|
||||
|
@ -1511,7 +1511,7 @@ gimage_mask_shrink_callback (GtkWidget *widget,
|
|||
gpointer call_data)
|
||||
{
|
||||
GImage *gimage;
|
||||
GUnit unit;
|
||||
GimpUnit unit;
|
||||
gint radius_x;
|
||||
gint radius_y;
|
||||
|
||||
|
@ -1519,7 +1519,7 @@ gimage_mask_shrink_callback (GtkWidget *widget,
|
|||
|
||||
selection_shrink_pixels = (gint) (*(gdouble *) call_data + 0.5);
|
||||
g_free (call_data);
|
||||
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
unit = (GimpUnit) gtk_object_get_data (GTK_OBJECT (widget), "size_query_unit");
|
||||
|
||||
radius_x = radius_y = selection_shrink_pixels;
|
||||
|
||||
|
@ -1527,7 +1527,7 @@ gimage_mask_shrink_callback (GtkWidget *widget,
|
|||
! GTK_TOGGLE_BUTTON (gtk_object_get_data (GTK_OBJECT (widget),
|
||||
"edge_lock_toggle"))->active;
|
||||
|
||||
if (unit != UNIT_PIXEL)
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble factor;
|
||||
|
||||
|
|
|
@ -402,18 +402,18 @@ info_dialog_add_spinbutton (InfoDialog *idialog,
|
|||
}
|
||||
|
||||
GtkWidget *
|
||||
info_dialog_add_sizeentry (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gdouble *value_ptr,
|
||||
gint nfields,
|
||||
GUnit unit,
|
||||
gchar *unit_format,
|
||||
gboolean menu_show_pixels,
|
||||
gboolean menu_show_percent,
|
||||
gboolean show_refval,
|
||||
GimpSizeEntryUP update_policy,
|
||||
GtkSignalFunc callback,
|
||||
gpointer data)
|
||||
info_dialog_add_sizeentry (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gdouble *value_ptr,
|
||||
gint nfields,
|
||||
GimpUnit unit,
|
||||
gchar *unit_format,
|
||||
gboolean menu_show_pixels,
|
||||
gboolean menu_show_percent,
|
||||
gboolean show_refval,
|
||||
GimpSizeEntryUpdatePolicy update_policy,
|
||||
GtkSignalFunc callback,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *alignment;
|
||||
GtkWidget *sizeentry;
|
||||
|
|
|
@ -115,12 +115,12 @@ GtkWidget *info_dialog_add_sizeentry (InfoDialog *idialog,
|
|||
gchar *title,
|
||||
gdouble *value_ptr,
|
||||
gint nfields,
|
||||
GUnit unit,
|
||||
GimpUnit unit,
|
||||
gchar *unit_format,
|
||||
gboolean menu_show_pixels,
|
||||
gboolean menu_show_percent,
|
||||
gboolean show_refval,
|
||||
GimpSizeEntryUP update_policy,
|
||||
GimpSizeEntryUpdatePolicy update_policy,
|
||||
GtkSignalFunc callback,
|
||||
gpointer data);
|
||||
|
||||
|
|
|
@ -3402,7 +3402,7 @@ layers_dialog_new_layer_query (GimpImage* gimage)
|
|||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (options->size_se);
|
||||
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (options->size_se), UNIT_PIXEL);
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (options->size_se), GIMP_UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options->size_se), 0,
|
||||
gimage->xresolution, FALSE);
|
||||
|
|
|
@ -92,10 +92,10 @@ static gint old_save_device_status;
|
|||
static gint old_always_restore_session;
|
||||
static gint old_default_width;
|
||||
static gint old_default_height;
|
||||
static GUnit old_default_units;
|
||||
static GimpUnit old_default_units;
|
||||
static gdouble old_default_xresolution;
|
||||
static gdouble old_default_yresolution;
|
||||
static GUnit old_default_resolution_units;
|
||||
static GimpUnit old_default_resolution_units;
|
||||
static gint old_default_type;
|
||||
static gint old_default_dot_for_dot;
|
||||
static gint old_stingy_memory_use;
|
||||
|
@ -259,7 +259,7 @@ file_prefs_check_settings (void)
|
|||
default_height = old_default_height;
|
||||
return PREFS_CORRUPT;
|
||||
}
|
||||
if (default_units < UNIT_INCH ||
|
||||
if (default_units < GIMP_UNIT_INCH ||
|
||||
default_units >= gimp_unit_get_number_of_units ())
|
||||
{
|
||||
g_message (_("Error: Default unit must be within unit range."));
|
||||
|
@ -274,7 +274,7 @@ file_prefs_check_settings (void)
|
|||
default_yresolution = old_default_yresolution;
|
||||
return PREFS_CORRUPT;
|
||||
}
|
||||
if (default_resolution_units < UNIT_INCH ||
|
||||
if (default_resolution_units < GIMP_UNIT_INCH ||
|
||||
default_resolution_units >= gimp_unit_get_number_of_units ())
|
||||
{
|
||||
g_message (_("Error: Default resolution unit must be within unit range."));
|
||||
|
@ -2337,7 +2337,8 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
|
||||
sizeentry =
|
||||
gimp_size_entry_new (2, UNIT_INCH, pixels_per_unit, FALSE, FALSE, TRUE, 75,
|
||||
gimp_size_entry_new (2, GIMP_UNIT_INCH, pixels_per_unit,
|
||||
FALSE, FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
|
||||
g_free (pixels_per_unit);
|
||||
|
@ -2429,7 +2430,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
{ N_("Temp Dir:"), N_("Select Temp Dir"), &edit_temp_path },
|
||||
{ N_("Swap Dir:"), N_("Select Swap Dir"), &edit_swap_path },
|
||||
};
|
||||
static int ndirs = sizeof (dirs) / sizeof (dirs[0]);
|
||||
static gint ndirs = sizeof (dirs) / sizeof (dirs[0]);
|
||||
|
||||
table = gtk_table_new (ndirs + 1, 2, FALSE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
|
@ -2492,7 +2493,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
N_("Select Modules Dir"),
|
||||
&edit_module_path }
|
||||
};
|
||||
static int npaths = sizeof (paths) / sizeof (paths[0]);
|
||||
static gint npaths = sizeof (paths) / sizeof (paths[0]);
|
||||
|
||||
for (i = 0; i < npaths; i++)
|
||||
{
|
||||
|
|
|
@ -87,7 +87,7 @@ resize_widget_new (ResizeType type,
|
|||
gint height,
|
||||
gdouble resolution_x,
|
||||
gdouble resolution_y,
|
||||
GUnit unit,
|
||||
GimpUnit unit,
|
||||
gboolean dot_for_dot,
|
||||
GtkSignalFunc ok_cb,
|
||||
GtkSignalFunc cancel_cb,
|
||||
|
@ -289,7 +289,8 @@ resize_widget_new (ResizeType type,
|
|||
gtk_widget_show (private->size_se);
|
||||
|
||||
if (dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->size_se), UNIT_PIXEL);
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->size_se),
|
||||
GIMP_UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->size_se), 0,
|
||||
resolution_x, FALSE);
|
||||
|
@ -439,7 +440,7 @@ resize_widget_new (ResizeType type,
|
|||
|
||||
if (dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->offset_se),
|
||||
UNIT_PIXEL);
|
||||
GIMP_UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->offset_se), 0,
|
||||
resolution_x, FALSE);
|
||||
|
@ -777,25 +778,25 @@ static void
|
|||
orig_labels_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
Resize *resize;
|
||||
Resize *resize;
|
||||
ResizePrivate *private;
|
||||
GUnit unit;
|
||||
gchar format_buf[16];
|
||||
gchar buf[32];
|
||||
GimpUnit unit;
|
||||
gchar format_buf[16];
|
||||
gchar buf[32];
|
||||
|
||||
static GUnit label_unit = UNIT_PIXEL;
|
||||
static GimpUnit label_unit = GIMP_UNIT_PIXEL;
|
||||
|
||||
resize = (Resize *) data;
|
||||
private = (ResizePrivate *) resize->private_part;
|
||||
|
||||
unit = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget));
|
||||
|
||||
if (unit != UNIT_PERCENT)
|
||||
if (unit != GIMP_UNIT_PERCENT)
|
||||
label_unit = unit;
|
||||
|
||||
if (label_unit) /* unit != UNIT_PIXEL */
|
||||
if (label_unit) /* unit != GIMP_UNIT_PIXEL */
|
||||
{
|
||||
double unit_factor = gimp_unit_get_factor (label_unit);
|
||||
gdouble unit_factor = gimp_unit_get_factor (label_unit);
|
||||
|
||||
g_snprintf (format_buf, sizeof (format_buf), "%%.%df %s",
|
||||
gimp_unit_get_digits (label_unit) + 1,
|
||||
|
@ -807,7 +808,7 @@ orig_labels_update (GtkWidget *widget,
|
|||
private->old_height * unit_factor / private->old_res_y);
|
||||
gtk_label_set_text (GTK_LABEL (private->orig_height_label), buf);
|
||||
}
|
||||
else /* unit == UNIT_PIXEL */
|
||||
else /* unit == GIMP_UNIT_PIXEL */
|
||||
{
|
||||
g_snprintf (buf, sizeof (buf), "%d", private->old_width);
|
||||
gtk_label_set_text (GTK_LABEL (private->orig_width_label), buf);
|
||||
|
|
|
@ -47,7 +47,7 @@ struct _Resize
|
|||
|
||||
gdouble resolution_x;
|
||||
gdouble resolution_y;
|
||||
GUnit unit;
|
||||
GimpUnit unit;
|
||||
|
||||
gdouble ratio_x;
|
||||
gdouble ratio_y;
|
||||
|
@ -69,7 +69,7 @@ Resize * resize_widget_new (ResizeType type,
|
|||
gint height,
|
||||
gdouble resolution_x,
|
||||
gdouble resolution_y,
|
||||
GUnit unit,
|
||||
GimpUnit unit,
|
||||
gboolean dot_for_dot,
|
||||
GtkSignalFunc ok_cb,
|
||||
GtkSignalFunc cancel_cb,
|
||||
|
|
|
@ -42,18 +42,18 @@ typedef struct
|
|||
{
|
||||
gint width;
|
||||
gint height;
|
||||
GUnit unit;
|
||||
GimpUnit unit;
|
||||
|
||||
gdouble xresolution;
|
||||
gdouble yresolution;
|
||||
GUnit res_unit;
|
||||
GimpUnit res_unit;
|
||||
|
||||
GimpImageBaseType type;
|
||||
GimpFillType fill_type;
|
||||
} GimpImageNewValues;
|
||||
|
||||
GList* image_new_get_fill_type_names (void);
|
||||
GList* image_new_get_image_base_type_names (void);
|
||||
GList * image_new_get_fill_type_names (void);
|
||||
GList * image_new_get_image_base_type_names (void);
|
||||
|
||||
void image_new_create_window (const GimpImageNewValues *values,
|
||||
const GimpImage *image);
|
||||
|
|
|
@ -402,18 +402,18 @@ info_dialog_add_spinbutton (InfoDialog *idialog,
|
|||
}
|
||||
|
||||
GtkWidget *
|
||||
info_dialog_add_sizeentry (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gdouble *value_ptr,
|
||||
gint nfields,
|
||||
GUnit unit,
|
||||
gchar *unit_format,
|
||||
gboolean menu_show_pixels,
|
||||
gboolean menu_show_percent,
|
||||
gboolean show_refval,
|
||||
GimpSizeEntryUP update_policy,
|
||||
GtkSignalFunc callback,
|
||||
gpointer data)
|
||||
info_dialog_add_sizeentry (InfoDialog *idialog,
|
||||
gchar *title,
|
||||
gdouble *value_ptr,
|
||||
gint nfields,
|
||||
GimpUnit unit,
|
||||
gchar *unit_format,
|
||||
gboolean menu_show_pixels,
|
||||
gboolean menu_show_percent,
|
||||
gboolean show_refval,
|
||||
GimpSizeEntryUpdatePolicy update_policy,
|
||||
GtkSignalFunc callback,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *alignment;
|
||||
GtkWidget *sizeentry;
|
||||
|
|
|
@ -115,12 +115,12 @@ GtkWidget *info_dialog_add_sizeentry (InfoDialog *idialog,
|
|||
gchar *title,
|
||||
gdouble *value_ptr,
|
||||
gint nfields,
|
||||
GUnit unit,
|
||||
GimpUnit unit,
|
||||
gchar *unit_format,
|
||||
gboolean menu_show_pixels,
|
||||
gboolean menu_show_percent,
|
||||
gboolean show_refval,
|
||||
GimpSizeEntryUP update_policy,
|
||||
GimpSizeEntryUpdatePolicy update_policy,
|
||||
GtkSignalFunc callback,
|
||||
gpointer data);
|
||||
|
||||
|
|
|
@ -3402,7 +3402,7 @@ layers_dialog_new_layer_query (GimpImage* gimage)
|
|||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (options->size_se);
|
||||
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (options->size_se), UNIT_PIXEL);
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (options->size_se), GIMP_UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options->size_se), 0,
|
||||
gimage->xresolution, FALSE);
|
||||
|
|
|
@ -46,10 +46,10 @@
|
|||
#define PAINTBRUSH_DEFAULT_INCREMENTAL FALSE
|
||||
#define PAINTBRUSH_DEFAULT_USE_FADE FALSE
|
||||
#define PAINTBRUSH_DEFAULT_FADE_OUT 100.0
|
||||
#define PAINTBRUSH_DEFAULT_FADE_UNIT UNIT_PIXEL
|
||||
#define PAINTBRUSH_DEFAULT_FADE_UNIT GIMP_UNIT_PIXEL
|
||||
#define PAINTBRUSH_DEFAULT_USE_GRADIENT FALSE
|
||||
#define PAINTBRUSH_DEFAULT_GRADIENT_LENGTH 100.0
|
||||
#define PAINTBRUSH_DEFAULT_GRADIENT_UNIT UNIT_PIXEL
|
||||
#define PAINTBRUSH_DEFAULT_GRADIENT_UNIT GIMP_UNIT_PIXEL
|
||||
#define PAINTBRUSH_DEFAULT_GRADIENT_TYPE LOOP_TRIANGLE
|
||||
|
||||
/* the paintbrush structures */
|
||||
|
@ -67,8 +67,8 @@ struct _PaintbrushOptions
|
|||
gdouble fade_out_d;
|
||||
GtkObject *fade_out_w;
|
||||
|
||||
GUnit fade_unit;
|
||||
GUnit fade_unit_d;
|
||||
GimpUnit fade_unit;
|
||||
GimpUnit fade_unit_d;
|
||||
GtkWidget *fade_unit_w;
|
||||
|
||||
gboolean use_gradient;
|
||||
|
@ -79,8 +79,8 @@ struct _PaintbrushOptions
|
|||
gdouble gradient_length_d;
|
||||
GtkObject *gradient_length_w;
|
||||
|
||||
GUnit gradient_unit;
|
||||
GUnit gradient_unit_d;
|
||||
GimpUnit gradient_unit;
|
||||
GimpUnit gradient_unit_d;
|
||||
GtkWidget *gradient_unit_w;
|
||||
|
||||
gint gradient_type;
|
||||
|
@ -92,12 +92,12 @@ struct _PaintbrushOptions
|
|||
static PaintbrushOptions * paintbrush_options = NULL;
|
||||
|
||||
/* local variables */
|
||||
static gdouble non_gui_fade_out;
|
||||
static gdouble non_gui_gradient_length;
|
||||
static gint non_gui_gradient_type;
|
||||
static gdouble non_gui_incremental;
|
||||
static GUnit non_gui_fade_unit;
|
||||
static GUnit non_gui_gradient_unit;
|
||||
static gdouble non_gui_fade_out;
|
||||
static gdouble non_gui_gradient_length;
|
||||
static gint non_gui_gradient_type;
|
||||
static gdouble non_gui_incremental;
|
||||
static GimpUnit non_gui_fade_unit;
|
||||
static GimpUnit non_gui_gradient_unit;
|
||||
|
||||
|
||||
/* forward function declarations */
|
||||
|
@ -156,8 +156,8 @@ paintbrush_options_reset (void)
|
|||
options->fade_out_d);
|
||||
gimp_unit_menu_set_unit (GIMP_UNIT_MENU (options->fade_unit_w),
|
||||
options->fade_unit_d);
|
||||
digits = ((options->fade_unit_d == UNIT_PIXEL) ? 0 :
|
||||
((options->fade_unit_d == UNIT_PERCENT) ? 2 :
|
||||
digits = ((options->fade_unit_d == GIMP_UNIT_PIXEL) ? 0 :
|
||||
((options->fade_unit_d == GIMP_UNIT_PERCENT) ? 2 :
|
||||
(MIN (6, MAX (3, gimp_unit_get_digits (options->fade_unit_d))))));
|
||||
spinbutton = gtk_object_get_data (GTK_OBJECT (options->fade_unit_w), "set_digits");
|
||||
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spinbutton), digits);
|
||||
|
@ -168,8 +168,8 @@ paintbrush_options_reset (void)
|
|||
options->gradient_length_d);
|
||||
gimp_unit_menu_set_unit (GIMP_UNIT_MENU (options->gradient_unit_w),
|
||||
options->gradient_unit_d);
|
||||
digits = ((options->gradient_unit_d == UNIT_PIXEL) ? 0 :
|
||||
((options->gradient_unit_d == UNIT_PERCENT) ? 2 :
|
||||
digits = ((options->gradient_unit_d == GIMP_UNIT_PIXEL) ? 0 :
|
||||
((options->gradient_unit_d == GIMP_UNIT_PERCENT) ? 2 :
|
||||
(MIN (6, MAX (3, gimp_unit_get_digits (options->gradient_unit_d))))));
|
||||
spinbutton = gtk_object_get_data (GTK_OBJECT (options->gradient_unit_w), "set_digits");
|
||||
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spinbutton), digits);
|
||||
|
@ -390,10 +390,10 @@ paintbrush_paint_func (PaintCore *paint_core,
|
|||
case MOTION_PAINT :
|
||||
switch (paintbrush_options->fade_unit)
|
||||
{
|
||||
case UNIT_PIXEL:
|
||||
case GIMP_UNIT_PIXEL:
|
||||
fade_out = paintbrush_options->fade_out;
|
||||
break;
|
||||
case UNIT_PERCENT:
|
||||
case GIMP_UNIT_PERCENT:
|
||||
fade_out = MAX (gdisp->gimage->width, gdisp->gimage->height) *
|
||||
paintbrush_options->fade_out / 100;
|
||||
break;
|
||||
|
@ -406,10 +406,10 @@ paintbrush_paint_func (PaintCore *paint_core,
|
|||
|
||||
switch (paintbrush_options->gradient_unit)
|
||||
{
|
||||
case UNIT_PIXEL:
|
||||
case GIMP_UNIT_PIXEL:
|
||||
gradient_length = paintbrush_options->gradient_length;
|
||||
break;
|
||||
case UNIT_PERCENT:
|
||||
case GIMP_UNIT_PERCENT:
|
||||
gradient_length = MAX (gdisp->gimage->width, gdisp->gimage->height) *
|
||||
paintbrush_options->gradient_length / 100;
|
||||
break;
|
||||
|
@ -603,10 +603,10 @@ paintbrush_non_gui_paint_func (PaintCore *paint_core,
|
|||
|
||||
switch (non_gui_fade_unit)
|
||||
{
|
||||
case UNIT_PIXEL:
|
||||
case GIMP_UNIT_PIXEL:
|
||||
fade_out = non_gui_fade_out;
|
||||
break;
|
||||
case UNIT_PERCENT:
|
||||
case GIMP_UNIT_PERCENT:
|
||||
fade_out = MAX (gimage->width, gimage->height) *
|
||||
non_gui_fade_out / 100;
|
||||
break;
|
||||
|
@ -619,10 +619,10 @@ paintbrush_non_gui_paint_func (PaintCore *paint_core,
|
|||
|
||||
switch (non_gui_gradient_unit)
|
||||
{
|
||||
case UNIT_PIXEL:
|
||||
case GIMP_UNIT_PIXEL:
|
||||
gradient_length = non_gui_gradient_length;
|
||||
break;
|
||||
case UNIT_PERCENT:
|
||||
case GIMP_UNIT_PERCENT:
|
||||
gradient_length = MAX (gimage->width, gimage->height) *
|
||||
non_gui_gradient_length / 100;
|
||||
break;
|
||||
|
@ -649,15 +649,15 @@ paintbrush_non_gui_default (GimpDrawable *drawable,
|
|||
double *stroke_array)
|
||||
{
|
||||
PaintbrushOptions *options = paintbrush_options;
|
||||
double fade_out = PAINTBRUSH_DEFAULT_FADE_OUT;
|
||||
gdouble fade_out = PAINTBRUSH_DEFAULT_FADE_OUT;
|
||||
gboolean incremental = PAINTBRUSH_DEFAULT_INCREMENTAL;
|
||||
gboolean use_gradient = PAINTBRUSH_DEFAULT_USE_GRADIENT;
|
||||
gboolean use_fade = PAINTBRUSH_DEFAULT_USE_FADE;
|
||||
double gradient_length = PAINTBRUSH_DEFAULT_GRADIENT_LENGTH;
|
||||
int gradient_type = PAINTBRUSH_DEFAULT_GRADIENT_TYPE;
|
||||
GUnit fade_unit = PAINTBRUSH_DEFAULT_FADE_UNIT;
|
||||
GUnit gradient_unit = PAINTBRUSH_DEFAULT_GRADIENT_UNIT;
|
||||
int i;
|
||||
gdouble gradient_length = PAINTBRUSH_DEFAULT_GRADIENT_LENGTH;
|
||||
gint gradient_type = PAINTBRUSH_DEFAULT_GRADIENT_TYPE;
|
||||
GimpUnit fade_unit = PAINTBRUSH_DEFAULT_FADE_UNIT;
|
||||
GimpUnit gradient_unit = PAINTBRUSH_DEFAULT_GRADIENT_UNIT;
|
||||
gint i;
|
||||
|
||||
if (options)
|
||||
{
|
||||
|
|
|
@ -92,10 +92,10 @@ static gint old_save_device_status;
|
|||
static gint old_always_restore_session;
|
||||
static gint old_default_width;
|
||||
static gint old_default_height;
|
||||
static GUnit old_default_units;
|
||||
static GimpUnit old_default_units;
|
||||
static gdouble old_default_xresolution;
|
||||
static gdouble old_default_yresolution;
|
||||
static GUnit old_default_resolution_units;
|
||||
static GimpUnit old_default_resolution_units;
|
||||
static gint old_default_type;
|
||||
static gint old_default_dot_for_dot;
|
||||
static gint old_stingy_memory_use;
|
||||
|
@ -259,7 +259,7 @@ file_prefs_check_settings (void)
|
|||
default_height = old_default_height;
|
||||
return PREFS_CORRUPT;
|
||||
}
|
||||
if (default_units < UNIT_INCH ||
|
||||
if (default_units < GIMP_UNIT_INCH ||
|
||||
default_units >= gimp_unit_get_number_of_units ())
|
||||
{
|
||||
g_message (_("Error: Default unit must be within unit range."));
|
||||
|
@ -274,7 +274,7 @@ file_prefs_check_settings (void)
|
|||
default_yresolution = old_default_yresolution;
|
||||
return PREFS_CORRUPT;
|
||||
}
|
||||
if (default_resolution_units < UNIT_INCH ||
|
||||
if (default_resolution_units < GIMP_UNIT_INCH ||
|
||||
default_resolution_units >= gimp_unit_get_number_of_units ())
|
||||
{
|
||||
g_message (_("Error: Default resolution unit must be within unit range."));
|
||||
|
@ -2337,7 +2337,8 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
|
||||
sizeentry =
|
||||
gimp_size_entry_new (2, UNIT_INCH, pixels_per_unit, FALSE, FALSE, TRUE, 75,
|
||||
gimp_size_entry_new (2, GIMP_UNIT_INCH, pixels_per_unit,
|
||||
FALSE, FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
|
||||
g_free (pixels_per_unit);
|
||||
|
@ -2429,7 +2430,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
{ N_("Temp Dir:"), N_("Select Temp Dir"), &edit_temp_path },
|
||||
{ N_("Swap Dir:"), N_("Select Swap Dir"), &edit_swap_path },
|
||||
};
|
||||
static int ndirs = sizeof (dirs) / sizeof (dirs[0]);
|
||||
static gint ndirs = sizeof (dirs) / sizeof (dirs[0]);
|
||||
|
||||
table = gtk_table_new (ndirs + 1, 2, FALSE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
|
@ -2492,7 +2493,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
N_("Select Modules Dir"),
|
||||
&edit_module_path }
|
||||
};
|
||||
static int npaths = sizeof (paths) / sizeof (paths[0]);
|
||||
static gint npaths = sizeof (paths) / sizeof (paths[0]);
|
||||
|
||||
for (i = 0; i < npaths; i++)
|
||||
{
|
||||
|
|
|
@ -94,12 +94,12 @@ rect_select_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
RectSelect * rect_sel;
|
||||
gchar select_mode[STATUSBAR_SIZE];
|
||||
int x, y;
|
||||
GUnit unit = UNIT_PIXEL;
|
||||
double unit_factor;
|
||||
GDisplay *gdisp;
|
||||
RectSelect *rect_sel;
|
||||
gchar select_mode[STATUSBAR_SIZE];
|
||||
gint x, y;
|
||||
GimpUnit unit = GIMP_UNIT_PIXEL;
|
||||
gdouble unit_factor;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
rect_sel = (RectSelect *) tool->private;
|
||||
|
@ -128,9 +128,9 @@ rect_select_button_press (Tool *tool,
|
|||
|
||||
switch (unit)
|
||||
{
|
||||
case UNIT_PIXEL:
|
||||
case GIMP_UNIT_PIXEL:
|
||||
break;
|
||||
case UNIT_PERCENT:
|
||||
case GIMP_UNIT_PERCENT:
|
||||
rect_sel->fixed_width =
|
||||
gdisp->gimage->width * rect_sel->fixed_width / 100;
|
||||
rect_sel->fixed_height =
|
||||
|
|
25
app/resize.c
25
app/resize.c
|
@ -87,7 +87,7 @@ resize_widget_new (ResizeType type,
|
|||
gint height,
|
||||
gdouble resolution_x,
|
||||
gdouble resolution_y,
|
||||
GUnit unit,
|
||||
GimpUnit unit,
|
||||
gboolean dot_for_dot,
|
||||
GtkSignalFunc ok_cb,
|
||||
GtkSignalFunc cancel_cb,
|
||||
|
@ -289,7 +289,8 @@ resize_widget_new (ResizeType type,
|
|||
gtk_widget_show (private->size_se);
|
||||
|
||||
if (dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->size_se), UNIT_PIXEL);
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->size_se),
|
||||
GIMP_UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->size_se), 0,
|
||||
resolution_x, FALSE);
|
||||
|
@ -439,7 +440,7 @@ resize_widget_new (ResizeType type,
|
|||
|
||||
if (dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->offset_se),
|
||||
UNIT_PIXEL);
|
||||
GIMP_UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->offset_se), 0,
|
||||
resolution_x, FALSE);
|
||||
|
@ -777,25 +778,25 @@ static void
|
|||
orig_labels_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
Resize *resize;
|
||||
Resize *resize;
|
||||
ResizePrivate *private;
|
||||
GUnit unit;
|
||||
gchar format_buf[16];
|
||||
gchar buf[32];
|
||||
GimpUnit unit;
|
||||
gchar format_buf[16];
|
||||
gchar buf[32];
|
||||
|
||||
static GUnit label_unit = UNIT_PIXEL;
|
||||
static GimpUnit label_unit = GIMP_UNIT_PIXEL;
|
||||
|
||||
resize = (Resize *) data;
|
||||
private = (ResizePrivate *) resize->private_part;
|
||||
|
||||
unit = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget));
|
||||
|
||||
if (unit != UNIT_PERCENT)
|
||||
if (unit != GIMP_UNIT_PERCENT)
|
||||
label_unit = unit;
|
||||
|
||||
if (label_unit) /* unit != UNIT_PIXEL */
|
||||
if (label_unit) /* unit != GIMP_UNIT_PIXEL */
|
||||
{
|
||||
double unit_factor = gimp_unit_get_factor (label_unit);
|
||||
gdouble unit_factor = gimp_unit_get_factor (label_unit);
|
||||
|
||||
g_snprintf (format_buf, sizeof (format_buf), "%%.%df %s",
|
||||
gimp_unit_get_digits (label_unit) + 1,
|
||||
|
@ -807,7 +808,7 @@ orig_labels_update (GtkWidget *widget,
|
|||
private->old_height * unit_factor / private->old_res_y);
|
||||
gtk_label_set_text (GTK_LABEL (private->orig_height_label), buf);
|
||||
}
|
||||
else /* unit == UNIT_PIXEL */
|
||||
else /* unit == GIMP_UNIT_PIXEL */
|
||||
{
|
||||
g_snprintf (buf, sizeof (buf), "%d", private->old_width);
|
||||
gtk_label_set_text (GTK_LABEL (private->orig_width_label), buf);
|
||||
|
|
|
@ -47,7 +47,7 @@ struct _Resize
|
|||
|
||||
gdouble resolution_x;
|
||||
gdouble resolution_y;
|
||||
GUnit unit;
|
||||
GimpUnit unit;
|
||||
|
||||
gdouble ratio_x;
|
||||
gdouble ratio_y;
|
||||
|
@ -69,7 +69,7 @@ Resize * resize_widget_new (ResizeType type,
|
|||
gint height,
|
||||
gdouble resolution_x,
|
||||
gdouble resolution_y,
|
||||
GUnit unit,
|
||||
GimpUnit unit,
|
||||
gboolean dot_for_dot,
|
||||
GtkSignalFunc ok_cb,
|
||||
GtkSignalFunc cancel_cb,
|
||||
|
|
|
@ -124,7 +124,7 @@ rotate_tool_transform (Tool *tool,
|
|||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry),
|
||||
gdisp->gimage->unit);
|
||||
if (gdisp->dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), GIMP_UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
|
|
|
@ -111,7 +111,7 @@ scale_tool_transform (Tool *tool,
|
|||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry),
|
||||
gdisp->gimage->unit);
|
||||
if (gdisp->dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), GIMP_UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
|
@ -207,11 +207,11 @@ scale_info_update (Tool *tool)
|
|||
TransformCore *transform_core;
|
||||
gdouble ratio_x, ratio_y;
|
||||
gint x1, y1, x2, y2, x3, y3, x4, y4;
|
||||
GUnit unit;
|
||||
GimpUnit unit;
|
||||
gdouble unit_factor;
|
||||
gchar format_buf[16];
|
||||
|
||||
static GUnit label_unit = UNIT_PIXEL;
|
||||
static GimpUnit label_unit = GIMP_UNIT_PIXEL;
|
||||
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
@ -223,12 +223,12 @@ scale_info_update (Tool *tool)
|
|||
x2 = transform_core->x2;
|
||||
y2 = transform_core->y2;
|
||||
|
||||
if (unit != UNIT_PERCENT)
|
||||
if (unit != GIMP_UNIT_PERCENT)
|
||||
label_unit = unit;
|
||||
|
||||
unit_factor = gimp_unit_get_factor (label_unit);
|
||||
|
||||
if (label_unit) /* unit != UNIT_PIXEL */
|
||||
if (label_unit) /* unit != GIMP_UNIT_PIXEL */
|
||||
{
|
||||
g_snprintf (format_buf, sizeof (format_buf), "%%.%df %s",
|
||||
gimp_unit_get_digits (label_unit) + 1,
|
||||
|
@ -238,7 +238,7 @@ scale_info_update (Tool *tool)
|
|||
g_snprintf (orig_height_buf, MAX_INFO_BUF, format_buf,
|
||||
(y2 - y1) * unit_factor / gdisp->gimage->yresolution);
|
||||
}
|
||||
else /* unit == UNIT_PIXEL */
|
||||
else /* unit == GIMP_UNIT_PIXEL */
|
||||
{
|
||||
g_snprintf (orig_width_buf, MAX_INFO_BUF, "%d", x2 - x1);
|
||||
g_snprintf (orig_height_buf, MAX_INFO_BUF, "%d", y2 - y1);
|
||||
|
|
|
@ -62,8 +62,8 @@ struct _SelectionOptions
|
|||
gdouble fixed_height_d;
|
||||
GtkObject *fixed_height_w;
|
||||
|
||||
GUnit fixed_unit;
|
||||
GUnit fixed_unit_d;
|
||||
GimpUnit fixed_unit;
|
||||
GimpUnit fixed_unit_d;
|
||||
GtkWidget *fixed_unit_w;
|
||||
|
||||
/* used by bezier selection */
|
||||
|
|
|
@ -143,7 +143,7 @@ selection_options_init (SelectionOptions *options,
|
|||
options->fixed_size = options->fixed_size_d = FALSE;
|
||||
options->fixed_height = options->fixed_height_d = 1;
|
||||
options->fixed_width = options->fixed_width_d = 1;
|
||||
options->fixed_unit = options->fixed_unit_d = UNIT_PIXEL;
|
||||
options->fixed_unit = options->fixed_unit_d = GIMP_UNIT_PIXEL;
|
||||
|
||||
options->feather_w = NULL;
|
||||
options->feather_radius_w = NULL;
|
||||
|
@ -385,8 +385,8 @@ selection_options_reset (SelectionOptions *options)
|
|||
options->fixed_unit_d);
|
||||
|
||||
digits =
|
||||
((options->fixed_unit_d == UNIT_PIXEL) ? 0 :
|
||||
((options->fixed_unit_d == UNIT_PERCENT) ? 2 :
|
||||
((options->fixed_unit_d == GIMP_UNIT_PIXEL) ? 0 :
|
||||
((options->fixed_unit_d == GIMP_UNIT_PERCENT) ? 2 :
|
||||
(MIN (6, MAX (3, gimp_unit_get_digits (options->fixed_unit_d))))));
|
||||
|
||||
spinbutton =
|
||||
|
|
|
@ -1005,9 +1005,9 @@ crop_start (Tool *tool,
|
|||
if (gdisp->dot_for_dot)
|
||||
{
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (origin_sizeentry),
|
||||
UNIT_PIXEL);
|
||||
GIMP_UNIT_PIXEL);
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (size_sizeentry),
|
||||
UNIT_PIXEL);
|
||||
GIMP_UNIT_PIXEL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1062,7 +1062,7 @@ crop_info_create (Tool *tool)
|
|||
origin_sizeentry =
|
||||
info_dialog_add_sizeentry (crop_info, _("Y:"), orig_vals, 1,
|
||||
gdisp->dot_for_dot ?
|
||||
UNIT_PIXEL : gdisp->gimage->unit, "%a",
|
||||
GIMP_UNIT_PIXEL : gdisp->gimage->unit, "%a",
|
||||
TRUE, TRUE, FALSE, GIMP_SIZE_ENTRY_UPDATE_SIZE,
|
||||
crop_orig_changed, crop_info);
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (origin_sizeentry),
|
||||
|
@ -1078,7 +1078,7 @@ crop_info_create (Tool *tool)
|
|||
size_sizeentry =
|
||||
info_dialog_add_sizeentry (crop_info, _("Height:"), size_vals, 1,
|
||||
gdisp->dot_for_dot ?
|
||||
UNIT_PIXEL : gdisp->gimage->unit, "%a",
|
||||
GIMP_UNIT_PIXEL : gdisp->gimage->unit, "%a",
|
||||
TRUE, TRUE, FALSE, GIMP_SIZE_ENTRY_UPDATE_SIZE,
|
||||
crop_size_changed, crop_info);
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (size_sizeentry),
|
||||
|
|
|
@ -1005,9 +1005,9 @@ crop_start (Tool *tool,
|
|||
if (gdisp->dot_for_dot)
|
||||
{
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (origin_sizeentry),
|
||||
UNIT_PIXEL);
|
||||
GIMP_UNIT_PIXEL);
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (size_sizeentry),
|
||||
UNIT_PIXEL);
|
||||
GIMP_UNIT_PIXEL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1062,7 +1062,7 @@ crop_info_create (Tool *tool)
|
|||
origin_sizeentry =
|
||||
info_dialog_add_sizeentry (crop_info, _("Y:"), orig_vals, 1,
|
||||
gdisp->dot_for_dot ?
|
||||
UNIT_PIXEL : gdisp->gimage->unit, "%a",
|
||||
GIMP_UNIT_PIXEL : gdisp->gimage->unit, "%a",
|
||||
TRUE, TRUE, FALSE, GIMP_SIZE_ENTRY_UPDATE_SIZE,
|
||||
crop_orig_changed, crop_info);
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (origin_sizeentry),
|
||||
|
@ -1078,7 +1078,7 @@ crop_info_create (Tool *tool)
|
|||
size_sizeentry =
|
||||
info_dialog_add_sizeentry (crop_info, _("Height:"), size_vals, 1,
|
||||
gdisp->dot_for_dot ?
|
||||
UNIT_PIXEL : gdisp->gimage->unit, "%a",
|
||||
GIMP_UNIT_PIXEL : gdisp->gimage->unit, "%a",
|
||||
TRUE, TRUE, FALSE, GIMP_SIZE_ENTRY_UPDATE_SIZE,
|
||||
crop_size_changed, crop_info);
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (size_sizeentry),
|
||||
|
|
|
@ -94,12 +94,12 @@ rect_select_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
RectSelect * rect_sel;
|
||||
gchar select_mode[STATUSBAR_SIZE];
|
||||
int x, y;
|
||||
GUnit unit = UNIT_PIXEL;
|
||||
double unit_factor;
|
||||
GDisplay *gdisp;
|
||||
RectSelect *rect_sel;
|
||||
gchar select_mode[STATUSBAR_SIZE];
|
||||
gint x, y;
|
||||
GimpUnit unit = GIMP_UNIT_PIXEL;
|
||||
gdouble unit_factor;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
rect_sel = (RectSelect *) tool->private;
|
||||
|
@ -128,9 +128,9 @@ rect_select_button_press (Tool *tool,
|
|||
|
||||
switch (unit)
|
||||
{
|
||||
case UNIT_PIXEL:
|
||||
case GIMP_UNIT_PIXEL:
|
||||
break;
|
||||
case UNIT_PERCENT:
|
||||
case GIMP_UNIT_PERCENT:
|
||||
rect_sel->fixed_width =
|
||||
gdisp->gimage->width * rect_sel->fixed_width / 100;
|
||||
rect_sel->fixed_height =
|
||||
|
|
|
@ -124,7 +124,7 @@ rotate_tool_transform (Tool *tool,
|
|||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry),
|
||||
gdisp->gimage->unit);
|
||||
if (gdisp->dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), GIMP_UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
|
|
|
@ -111,7 +111,7 @@ scale_tool_transform (Tool *tool,
|
|||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry),
|
||||
gdisp->gimage->unit);
|
||||
if (gdisp->dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), GIMP_UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
|
@ -207,11 +207,11 @@ scale_info_update (Tool *tool)
|
|||
TransformCore *transform_core;
|
||||
gdouble ratio_x, ratio_y;
|
||||
gint x1, y1, x2, y2, x3, y3, x4, y4;
|
||||
GUnit unit;
|
||||
GimpUnit unit;
|
||||
gdouble unit_factor;
|
||||
gchar format_buf[16];
|
||||
|
||||
static GUnit label_unit = UNIT_PIXEL;
|
||||
static GimpUnit label_unit = GIMP_UNIT_PIXEL;
|
||||
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
@ -223,12 +223,12 @@ scale_info_update (Tool *tool)
|
|||
x2 = transform_core->x2;
|
||||
y2 = transform_core->y2;
|
||||
|
||||
if (unit != UNIT_PERCENT)
|
||||
if (unit != GIMP_UNIT_PERCENT)
|
||||
label_unit = unit;
|
||||
|
||||
unit_factor = gimp_unit_get_factor (label_unit);
|
||||
|
||||
if (label_unit) /* unit != UNIT_PIXEL */
|
||||
if (label_unit) /* unit != GIMP_UNIT_PIXEL */
|
||||
{
|
||||
g_snprintf (format_buf, sizeof (format_buf), "%%.%df %s",
|
||||
gimp_unit_get_digits (label_unit) + 1,
|
||||
|
@ -238,7 +238,7 @@ scale_info_update (Tool *tool)
|
|||
g_snprintf (orig_height_buf, MAX_INFO_BUF, format_buf,
|
||||
(y2 - y1) * unit_factor / gdisp->gimage->yresolution);
|
||||
}
|
||||
else /* unit == UNIT_PIXEL */
|
||||
else /* unit == GIMP_UNIT_PIXEL */
|
||||
{
|
||||
g_snprintf (orig_width_buf, MAX_INFO_BUF, "%d", x2 - x1);
|
||||
g_snprintf (orig_height_buf, MAX_INFO_BUF, "%d", y2 - y1);
|
||||
|
|
|
@ -62,8 +62,8 @@ struct _SelectionOptions
|
|||
gdouble fixed_height_d;
|
||||
GtkObject *fixed_height_w;
|
||||
|
||||
GUnit fixed_unit;
|
||||
GUnit fixed_unit_d;
|
||||
GimpUnit fixed_unit;
|
||||
GimpUnit fixed_unit_d;
|
||||
GtkWidget *fixed_unit_w;
|
||||
|
||||
/* used by bezier selection */
|
||||
|
|
|
@ -46,10 +46,10 @@
|
|||
#define PAINTBRUSH_DEFAULT_INCREMENTAL FALSE
|
||||
#define PAINTBRUSH_DEFAULT_USE_FADE FALSE
|
||||
#define PAINTBRUSH_DEFAULT_FADE_OUT 100.0
|
||||
#define PAINTBRUSH_DEFAULT_FADE_UNIT UNIT_PIXEL
|
||||
#define PAINTBRUSH_DEFAULT_FADE_UNIT GIMP_UNIT_PIXEL
|
||||
#define PAINTBRUSH_DEFAULT_USE_GRADIENT FALSE
|
||||
#define PAINTBRUSH_DEFAULT_GRADIENT_LENGTH 100.0
|
||||
#define PAINTBRUSH_DEFAULT_GRADIENT_UNIT UNIT_PIXEL
|
||||
#define PAINTBRUSH_DEFAULT_GRADIENT_UNIT GIMP_UNIT_PIXEL
|
||||
#define PAINTBRUSH_DEFAULT_GRADIENT_TYPE LOOP_TRIANGLE
|
||||
|
||||
/* the paintbrush structures */
|
||||
|
@ -67,8 +67,8 @@ struct _PaintbrushOptions
|
|||
gdouble fade_out_d;
|
||||
GtkObject *fade_out_w;
|
||||
|
||||
GUnit fade_unit;
|
||||
GUnit fade_unit_d;
|
||||
GimpUnit fade_unit;
|
||||
GimpUnit fade_unit_d;
|
||||
GtkWidget *fade_unit_w;
|
||||
|
||||
gboolean use_gradient;
|
||||
|
@ -79,8 +79,8 @@ struct _PaintbrushOptions
|
|||
gdouble gradient_length_d;
|
||||
GtkObject *gradient_length_w;
|
||||
|
||||
GUnit gradient_unit;
|
||||
GUnit gradient_unit_d;
|
||||
GimpUnit gradient_unit;
|
||||
GimpUnit gradient_unit_d;
|
||||
GtkWidget *gradient_unit_w;
|
||||
|
||||
gint gradient_type;
|
||||
|
@ -92,12 +92,12 @@ struct _PaintbrushOptions
|
|||
static PaintbrushOptions * paintbrush_options = NULL;
|
||||
|
||||
/* local variables */
|
||||
static gdouble non_gui_fade_out;
|
||||
static gdouble non_gui_gradient_length;
|
||||
static gint non_gui_gradient_type;
|
||||
static gdouble non_gui_incremental;
|
||||
static GUnit non_gui_fade_unit;
|
||||
static GUnit non_gui_gradient_unit;
|
||||
static gdouble non_gui_fade_out;
|
||||
static gdouble non_gui_gradient_length;
|
||||
static gint non_gui_gradient_type;
|
||||
static gdouble non_gui_incremental;
|
||||
static GimpUnit non_gui_fade_unit;
|
||||
static GimpUnit non_gui_gradient_unit;
|
||||
|
||||
|
||||
/* forward function declarations */
|
||||
|
@ -156,8 +156,8 @@ paintbrush_options_reset (void)
|
|||
options->fade_out_d);
|
||||
gimp_unit_menu_set_unit (GIMP_UNIT_MENU (options->fade_unit_w),
|
||||
options->fade_unit_d);
|
||||
digits = ((options->fade_unit_d == UNIT_PIXEL) ? 0 :
|
||||
((options->fade_unit_d == UNIT_PERCENT) ? 2 :
|
||||
digits = ((options->fade_unit_d == GIMP_UNIT_PIXEL) ? 0 :
|
||||
((options->fade_unit_d == GIMP_UNIT_PERCENT) ? 2 :
|
||||
(MIN (6, MAX (3, gimp_unit_get_digits (options->fade_unit_d))))));
|
||||
spinbutton = gtk_object_get_data (GTK_OBJECT (options->fade_unit_w), "set_digits");
|
||||
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spinbutton), digits);
|
||||
|
@ -168,8 +168,8 @@ paintbrush_options_reset (void)
|
|||
options->gradient_length_d);
|
||||
gimp_unit_menu_set_unit (GIMP_UNIT_MENU (options->gradient_unit_w),
|
||||
options->gradient_unit_d);
|
||||
digits = ((options->gradient_unit_d == UNIT_PIXEL) ? 0 :
|
||||
((options->gradient_unit_d == UNIT_PERCENT) ? 2 :
|
||||
digits = ((options->gradient_unit_d == GIMP_UNIT_PIXEL) ? 0 :
|
||||
((options->gradient_unit_d == GIMP_UNIT_PERCENT) ? 2 :
|
||||
(MIN (6, MAX (3, gimp_unit_get_digits (options->gradient_unit_d))))));
|
||||
spinbutton = gtk_object_get_data (GTK_OBJECT (options->gradient_unit_w), "set_digits");
|
||||
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spinbutton), digits);
|
||||
|
@ -390,10 +390,10 @@ paintbrush_paint_func (PaintCore *paint_core,
|
|||
case MOTION_PAINT :
|
||||
switch (paintbrush_options->fade_unit)
|
||||
{
|
||||
case UNIT_PIXEL:
|
||||
case GIMP_UNIT_PIXEL:
|
||||
fade_out = paintbrush_options->fade_out;
|
||||
break;
|
||||
case UNIT_PERCENT:
|
||||
case GIMP_UNIT_PERCENT:
|
||||
fade_out = MAX (gdisp->gimage->width, gdisp->gimage->height) *
|
||||
paintbrush_options->fade_out / 100;
|
||||
break;
|
||||
|
@ -406,10 +406,10 @@ paintbrush_paint_func (PaintCore *paint_core,
|
|||
|
||||
switch (paintbrush_options->gradient_unit)
|
||||
{
|
||||
case UNIT_PIXEL:
|
||||
case GIMP_UNIT_PIXEL:
|
||||
gradient_length = paintbrush_options->gradient_length;
|
||||
break;
|
||||
case UNIT_PERCENT:
|
||||
case GIMP_UNIT_PERCENT:
|
||||
gradient_length = MAX (gdisp->gimage->width, gdisp->gimage->height) *
|
||||
paintbrush_options->gradient_length / 100;
|
||||
break;
|
||||
|
@ -603,10 +603,10 @@ paintbrush_non_gui_paint_func (PaintCore *paint_core,
|
|||
|
||||
switch (non_gui_fade_unit)
|
||||
{
|
||||
case UNIT_PIXEL:
|
||||
case GIMP_UNIT_PIXEL:
|
||||
fade_out = non_gui_fade_out;
|
||||
break;
|
||||
case UNIT_PERCENT:
|
||||
case GIMP_UNIT_PERCENT:
|
||||
fade_out = MAX (gimage->width, gimage->height) *
|
||||
non_gui_fade_out / 100;
|
||||
break;
|
||||
|
@ -619,10 +619,10 @@ paintbrush_non_gui_paint_func (PaintCore *paint_core,
|
|||
|
||||
switch (non_gui_gradient_unit)
|
||||
{
|
||||
case UNIT_PIXEL:
|
||||
case GIMP_UNIT_PIXEL:
|
||||
gradient_length = non_gui_gradient_length;
|
||||
break;
|
||||
case UNIT_PERCENT:
|
||||
case GIMP_UNIT_PERCENT:
|
||||
gradient_length = MAX (gimage->width, gimage->height) *
|
||||
non_gui_gradient_length / 100;
|
||||
break;
|
||||
|
@ -649,15 +649,15 @@ paintbrush_non_gui_default (GimpDrawable *drawable,
|
|||
double *stroke_array)
|
||||
{
|
||||
PaintbrushOptions *options = paintbrush_options;
|
||||
double fade_out = PAINTBRUSH_DEFAULT_FADE_OUT;
|
||||
gdouble fade_out = PAINTBRUSH_DEFAULT_FADE_OUT;
|
||||
gboolean incremental = PAINTBRUSH_DEFAULT_INCREMENTAL;
|
||||
gboolean use_gradient = PAINTBRUSH_DEFAULT_USE_GRADIENT;
|
||||
gboolean use_fade = PAINTBRUSH_DEFAULT_USE_FADE;
|
||||
double gradient_length = PAINTBRUSH_DEFAULT_GRADIENT_LENGTH;
|
||||
int gradient_type = PAINTBRUSH_DEFAULT_GRADIENT_TYPE;
|
||||
GUnit fade_unit = PAINTBRUSH_DEFAULT_FADE_UNIT;
|
||||
GUnit gradient_unit = PAINTBRUSH_DEFAULT_GRADIENT_UNIT;
|
||||
int i;
|
||||
gdouble gradient_length = PAINTBRUSH_DEFAULT_GRADIENT_LENGTH;
|
||||
gint gradient_type = PAINTBRUSH_DEFAULT_GRADIENT_TYPE;
|
||||
GimpUnit fade_unit = PAINTBRUSH_DEFAULT_FADE_UNIT;
|
||||
GimpUnit gradient_unit = PAINTBRUSH_DEFAULT_GRADIENT_UNIT;
|
||||
gint i;
|
||||
|
||||
if (options)
|
||||
{
|
||||
|
|
|
@ -94,12 +94,12 @@ rect_select_button_press (Tool *tool,
|
|||
GdkEventButton *bevent,
|
||||
gpointer gdisp_ptr)
|
||||
{
|
||||
GDisplay * gdisp;
|
||||
RectSelect * rect_sel;
|
||||
gchar select_mode[STATUSBAR_SIZE];
|
||||
int x, y;
|
||||
GUnit unit = UNIT_PIXEL;
|
||||
double unit_factor;
|
||||
GDisplay *gdisp;
|
||||
RectSelect *rect_sel;
|
||||
gchar select_mode[STATUSBAR_SIZE];
|
||||
gint x, y;
|
||||
GimpUnit unit = GIMP_UNIT_PIXEL;
|
||||
gdouble unit_factor;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
rect_sel = (RectSelect *) tool->private;
|
||||
|
@ -128,9 +128,9 @@ rect_select_button_press (Tool *tool,
|
|||
|
||||
switch (unit)
|
||||
{
|
||||
case UNIT_PIXEL:
|
||||
case GIMP_UNIT_PIXEL:
|
||||
break;
|
||||
case UNIT_PERCENT:
|
||||
case GIMP_UNIT_PERCENT:
|
||||
rect_sel->fixed_width =
|
||||
gdisp->gimage->width * rect_sel->fixed_width / 100;
|
||||
rect_sel->fixed_height =
|
||||
|
|
|
@ -124,7 +124,7 @@ rotate_tool_transform (Tool *tool,
|
|||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry),
|
||||
gdisp->gimage->unit);
|
||||
if (gdisp->dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), GIMP_UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
|
|
|
@ -111,7 +111,7 @@ scale_tool_transform (Tool *tool,
|
|||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry),
|
||||
gdisp->gimage->unit);
|
||||
if (gdisp->dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), GIMP_UNIT_PIXEL);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
gdisp->gimage->xresolution, FALSE);
|
||||
|
@ -207,11 +207,11 @@ scale_info_update (Tool *tool)
|
|||
TransformCore *transform_core;
|
||||
gdouble ratio_x, ratio_y;
|
||||
gint x1, y1, x2, y2, x3, y3, x4, y4;
|
||||
GUnit unit;
|
||||
GimpUnit unit;
|
||||
gdouble unit_factor;
|
||||
gchar format_buf[16];
|
||||
|
||||
static GUnit label_unit = UNIT_PIXEL;
|
||||
static GimpUnit label_unit = GIMP_UNIT_PIXEL;
|
||||
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
transform_core = (TransformCore *) tool->private;
|
||||
|
@ -223,12 +223,12 @@ scale_info_update (Tool *tool)
|
|||
x2 = transform_core->x2;
|
||||
y2 = transform_core->y2;
|
||||
|
||||
if (unit != UNIT_PERCENT)
|
||||
if (unit != GIMP_UNIT_PERCENT)
|
||||
label_unit = unit;
|
||||
|
||||
unit_factor = gimp_unit_get_factor (label_unit);
|
||||
|
||||
if (label_unit) /* unit != UNIT_PIXEL */
|
||||
if (label_unit) /* unit != GIMP_UNIT_PIXEL */
|
||||
{
|
||||
g_snprintf (format_buf, sizeof (format_buf), "%%.%df %s",
|
||||
gimp_unit_get_digits (label_unit) + 1,
|
||||
|
@ -238,7 +238,7 @@ scale_info_update (Tool *tool)
|
|||
g_snprintf (orig_height_buf, MAX_INFO_BUF, format_buf,
|
||||
(y2 - y1) * unit_factor / gdisp->gimage->yresolution);
|
||||
}
|
||||
else /* unit == UNIT_PIXEL */
|
||||
else /* unit == GIMP_UNIT_PIXEL */
|
||||
{
|
||||
g_snprintf (orig_width_buf, MAX_INFO_BUF, "%d", x2 - x1);
|
||||
g_snprintf (orig_height_buf, MAX_INFO_BUF, "%d", y2 - y1);
|
||||
|
|
|
@ -62,8 +62,8 @@ struct _SelectionOptions
|
|||
gdouble fixed_height_d;
|
||||
GtkObject *fixed_height_w;
|
||||
|
||||
GUnit fixed_unit;
|
||||
GUnit fixed_unit_d;
|
||||
GimpUnit fixed_unit;
|
||||
GimpUnit fixed_unit_d;
|
||||
GtkWidget *fixed_unit_w;
|
||||
|
||||
/* used by bezier selection */
|
||||
|
|
|
@ -143,7 +143,7 @@ selection_options_init (SelectionOptions *options,
|
|||
options->fixed_size = options->fixed_size_d = FALSE;
|
||||
options->fixed_height = options->fixed_height_d = 1;
|
||||
options->fixed_width = options->fixed_width_d = 1;
|
||||
options->fixed_unit = options->fixed_unit_d = UNIT_PIXEL;
|
||||
options->fixed_unit = options->fixed_unit_d = GIMP_UNIT_PIXEL;
|
||||
|
||||
options->feather_w = NULL;
|
||||
options->feather_radius_w = NULL;
|
||||
|
@ -385,8 +385,8 @@ selection_options_reset (SelectionOptions *options)
|
|||
options->fixed_unit_d);
|
||||
|
||||
digits =
|
||||
((options->fixed_unit_d == UNIT_PIXEL) ? 0 :
|
||||
((options->fixed_unit_d == UNIT_PERCENT) ? 2 :
|
||||
((options->fixed_unit_d == GIMP_UNIT_PIXEL) ? 0 :
|
||||
((options->fixed_unit_d == GIMP_UNIT_PERCENT) ? 2 :
|
||||
(MIN (6, MAX (3, gimp_unit_get_digits (options->fixed_unit_d))))));
|
||||
|
||||
spinbutton =
|
||||
|
|
109
app/undo.c
109
app/undo.c
|
@ -2396,9 +2396,9 @@ typedef struct _ResolutionUndo ResolutionUndo;
|
|||
|
||||
struct _ResolutionUndo
|
||||
{
|
||||
gdouble xres;
|
||||
gdouble yres;
|
||||
GUnit unit;
|
||||
gdouble xres;
|
||||
gdouble yres;
|
||||
GimpUnit unit;
|
||||
};
|
||||
|
||||
int
|
||||
|
@ -2434,8 +2434,8 @@ undo_pop_resolution (GImage *gimage,
|
|||
void *data_ptr)
|
||||
{
|
||||
ResolutionUndo *data;
|
||||
gdouble tmpres;
|
||||
GUnit tmpunit;
|
||||
gdouble tmpres;
|
||||
GimpUnit tmpunit;
|
||||
|
||||
data = data_ptr;
|
||||
|
||||
|
@ -2853,54 +2853,57 @@ undo_free_cantundo (UndoState state,
|
|||
|
||||
/* A "ok" to the name means I've checked where it's used and
|
||||
it seems plausible. -- austin 23/9/99 */
|
||||
static struct undo_name_t {
|
||||
UndoType type;
|
||||
const char *name;
|
||||
} undo_name[] = {
|
||||
{UNDO_NULL, N_("<<invalid>>")},
|
||||
{IMAGE_UNDO, N_("image")},
|
||||
{IMAGE_MOD_UNDO, N_("image mod")},
|
||||
{MASK_UNDO, N_("mask")},
|
||||
{LAYER_DISPLACE_UNDO, N_("layer move")}, /* ok */
|
||||
{TRANSFORM_UNDO, N_("transform")},
|
||||
{PAINT_UNDO, N_("paint")},
|
||||
{LAYER_ADD_UNDO, N_("new layer")},
|
||||
{LAYER_REMOVE_UNDO, N_("delete layer")},
|
||||
{LAYER_MOD, N_("layer mod")},
|
||||
{LAYER_MASK_ADD_UNDO, N_("add layer mask")}, /* ok */
|
||||
{LAYER_MASK_REMOVE_UNDO, N_("delete layer mask")}, /* ok */
|
||||
{LAYER_RENAME_UNDO, N_("rename layer")},
|
||||
{LAYER_REPOSITION_UNDO, N_("layer reposition")}, /* ok */
|
||||
{CHANNEL_ADD_UNDO, N_("new channel")},
|
||||
{CHANNEL_REMOVE_UNDO, N_("delete channel")},
|
||||
{CHANNEL_MOD, N_("channel mod")},
|
||||
{FS_TO_LAYER_UNDO, N_("FS to layer")}, /* ok */
|
||||
{GIMAGE_MOD, N_("gimage")},
|
||||
{FS_RIGOR, N_("FS rigor")},
|
||||
{FS_RELAX, N_("FS relax")},
|
||||
{GUIDE_UNDO, N_("guide")},
|
||||
{TEXT_UNDO, N_("text")},
|
||||
{FLOAT_MASK_UNDO, N_("float selection")},
|
||||
{EDIT_PASTE_UNDO, N_("paste")},
|
||||
{EDIT_CUT_UNDO, N_("cut")},
|
||||
{TRANSFORM_CORE_UNDO, N_("transform core")},
|
||||
{PAINT_CORE_UNDO, N_("paint core")},
|
||||
{FLOATING_LAYER_UNDO, N_("floating layer")}, /* unused! */
|
||||
{LINKED_LAYER_UNDO, N_("linked layer")},
|
||||
{LAYER_APPLY_MASK_UNDO, N_("apply layer mask")}, /* ok */
|
||||
{LAYER_MERGE_UNDO, N_("layer merge")},
|
||||
{FS_ANCHOR_UNDO, N_("FS anchor")},
|
||||
{GIMAGE_MOD_UNDO, N_("gimage mod")},
|
||||
{CROP_UNDO, N_("crop")},
|
||||
{LAYER_SCALE_UNDO, N_("layer scale")},
|
||||
{LAYER_RESIZE_UNDO, N_("layer resize")},
|
||||
{QMASK_UNDO, N_("quickmask")},
|
||||
{PARASITE_ATTACH_UNDO, N_("attach parasite")},
|
||||
{PARASITE_REMOVE_UNDO, N_("remove parasite")},
|
||||
{RESOLUTION_UNDO, N_("resolution change")},
|
||||
{IMAGE_SCALE_UNDO, N_("image scale")},
|
||||
{IMAGE_RESIZE_UNDO, N_("image resize")},
|
||||
{MISC_UNDO, N_("misc")}
|
||||
static struct undo_name_t
|
||||
{
|
||||
UndoType type;
|
||||
const gchar *name;
|
||||
}
|
||||
undo_name[] =
|
||||
{
|
||||
{ UNDO_NULL, N_("<<invalid>>") },
|
||||
{ IMAGE_UNDO, N_("image") },
|
||||
{ IMAGE_MOD_UNDO, N_("image mod") },
|
||||
{ MASK_UNDO, N_("mask") },
|
||||
{ LAYER_DISPLACE_UNDO, N_("layer move") }, /* ok */
|
||||
{ TRANSFORM_UNDO, N_("transform") },
|
||||
{ PAINT_UNDO, N_("paint") },
|
||||
{ LAYER_ADD_UNDO, N_("new layer") },
|
||||
{ LAYER_REMOVE_UNDO, N_("delete layer") },
|
||||
{ LAYER_MOD, N_("layer mod") },
|
||||
{ LAYER_MASK_ADD_UNDO, N_("add layer mask") }, /* ok */
|
||||
{ LAYER_MASK_REMOVE_UNDO, N_("delete layer mask") }, /* ok */
|
||||
{ LAYER_RENAME_UNDO, N_("rename layer") },
|
||||
{ LAYER_REPOSITION_UNDO, N_("layer reposition") }, /* ok */
|
||||
{ CHANNEL_ADD_UNDO, N_("new channel") },
|
||||
{ CHANNEL_REMOVE_UNDO, N_("delete channel") },
|
||||
{ CHANNEL_MOD, N_("channel mod") },
|
||||
{ FS_TO_LAYER_UNDO, N_("FS to layer") }, /* ok */
|
||||
{ GIMAGE_MOD, N_("gimage") },
|
||||
{ FS_RIGOR, N_("FS rigor") },
|
||||
{ FS_RELAX, N_("FS relax") },
|
||||
{ GUIDE_UNDO, N_("guide") },
|
||||
{ TEXT_UNDO, N_("text") },
|
||||
{ FLOAT_MASK_UNDO, N_("float selection") },
|
||||
{ EDIT_PASTE_UNDO, N_("paste") },
|
||||
{ EDIT_CUT_UNDO, N_("cut") },
|
||||
{ TRANSFORM_CORE_UNDO, N_("transform core") },
|
||||
{ PAINT_CORE_UNDO, N_("paint core") },
|
||||
{ FLOATING_LAYER_UNDO, N_("floating layer") }, /* unused! */
|
||||
{ LINKED_LAYER_UNDO, N_("linked layer") },
|
||||
{ LAYER_APPLY_MASK_UNDO, N_("apply layer mask") }, /* ok */
|
||||
{ LAYER_MERGE_UNDO, N_("layer merge") },
|
||||
{ FS_ANCHOR_UNDO, N_("FS anchor") },
|
||||
{ GIMAGE_MOD_UNDO, N_("gimage mod") },
|
||||
{ CROP_UNDO, N_("crop") },
|
||||
{ LAYER_SCALE_UNDO, N_("layer scale") },
|
||||
{ LAYER_RESIZE_UNDO, N_("layer resize") },
|
||||
{ QMASK_UNDO, N_("quickmask") },
|
||||
{ PARASITE_ATTACH_UNDO, N_("attach parasite") },
|
||||
{ PARASITE_REMOVE_UNDO, N_("remove parasite") },
|
||||
{ RESOLUTION_UNDO, N_("resolution change") },
|
||||
{ IMAGE_SCALE_UNDO, N_("image scale") },
|
||||
{ IMAGE_RESIZE_UNDO, N_("image resize") },
|
||||
{ MISC_UNDO, N_("misc") }
|
||||
};
|
||||
#define NUM_NAMES (sizeof (undo_name) / sizeof (struct undo_name_t))
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ unit_new_invoker (Argument *args)
|
|||
gchar *abbreviation;
|
||||
gchar *singular;
|
||||
gchar *plural;
|
||||
GUnit unit = 0;
|
||||
GimpUnit unit = 0;
|
||||
|
||||
identifier = (gchar *) args[0].value.pdb_pointer;
|
||||
if (identifier == NULL)
|
||||
|
@ -205,10 +205,10 @@ unit_get_deletion_flag_invoker (Argument *args)
|
|||
{
|
||||
gboolean success = TRUE;
|
||||
Argument *return_args;
|
||||
GUnit unit;
|
||||
GimpUnit unit;
|
||||
|
||||
unit = args[0].value.pdb_int;
|
||||
if (unit < UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ())
|
||||
if (unit < GIMP_UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ())
|
||||
success = FALSE;
|
||||
|
||||
return_args = procedural_db_return_args (&unit_get_deletion_flag_proc, success);
|
||||
|
@ -257,11 +257,11 @@ static Argument *
|
|||
unit_set_deletion_flag_invoker (Argument *args)
|
||||
{
|
||||
gboolean success = TRUE;
|
||||
GUnit unit;
|
||||
GimpUnit unit;
|
||||
gboolean deletion_flag;
|
||||
|
||||
unit = args[0].value.pdb_int;
|
||||
if (unit < UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ())
|
||||
if (unit < GIMP_UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ())
|
||||
success = FALSE;
|
||||
|
||||
deletion_flag = args[1].value.pdb_int ? TRUE : FALSE;
|
||||
|
@ -307,10 +307,10 @@ unit_get_identifier_invoker (Argument *args)
|
|||
{
|
||||
gboolean success = TRUE;
|
||||
Argument *return_args;
|
||||
GUnit unit;
|
||||
GimpUnit unit;
|
||||
|
||||
unit = args[0].value.pdb_int;
|
||||
if (unit < UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ())
|
||||
if (unit < GIMP_UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ())
|
||||
success = FALSE;
|
||||
|
||||
return_args = procedural_db_return_args (&unit_get_identifier_proc, success);
|
||||
|
@ -360,10 +360,10 @@ unit_get_factor_invoker (Argument *args)
|
|||
{
|
||||
gboolean success = TRUE;
|
||||
Argument *return_args;
|
||||
GUnit unit;
|
||||
GimpUnit unit;
|
||||
|
||||
unit = args[0].value.pdb_int;
|
||||
if (unit < UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ())
|
||||
if (unit < GIMP_UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ())
|
||||
success = FALSE;
|
||||
|
||||
return_args = procedural_db_return_args (&unit_get_factor_proc, success);
|
||||
|
@ -413,10 +413,10 @@ unit_get_digits_invoker (Argument *args)
|
|||
{
|
||||
gboolean success = TRUE;
|
||||
Argument *return_args;
|
||||
GUnit unit;
|
||||
GimpUnit unit;
|
||||
|
||||
unit = args[0].value.pdb_int;
|
||||
if (unit < UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ())
|
||||
if (unit < GIMP_UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ())
|
||||
success = FALSE;
|
||||
|
||||
return_args = procedural_db_return_args (&unit_get_digits_proc, success);
|
||||
|
@ -466,10 +466,10 @@ unit_get_symbol_invoker (Argument *args)
|
|||
{
|
||||
gboolean success = TRUE;
|
||||
Argument *return_args;
|
||||
GUnit unit;
|
||||
GimpUnit unit;
|
||||
|
||||
unit = args[0].value.pdb_int;
|
||||
if (unit < UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ())
|
||||
if (unit < GIMP_UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ())
|
||||
success = FALSE;
|
||||
|
||||
return_args = procedural_db_return_args (&unit_get_symbol_proc, success);
|
||||
|
@ -519,10 +519,10 @@ unit_get_abbreviation_invoker (Argument *args)
|
|||
{
|
||||
gboolean success = TRUE;
|
||||
Argument *return_args;
|
||||
GUnit unit;
|
||||
GimpUnit unit;
|
||||
|
||||
unit = args[0].value.pdb_int;
|
||||
if (unit < UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ())
|
||||
if (unit < GIMP_UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ())
|
||||
success = FALSE;
|
||||
|
||||
return_args = procedural_db_return_args (&unit_get_abbreviation_proc, success);
|
||||
|
@ -572,10 +572,10 @@ unit_get_singular_invoker (Argument *args)
|
|||
{
|
||||
gboolean success = TRUE;
|
||||
Argument *return_args;
|
||||
GUnit unit;
|
||||
GimpUnit unit;
|
||||
|
||||
unit = args[0].value.pdb_int;
|
||||
if (unit < UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ())
|
||||
if (unit < GIMP_UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ())
|
||||
success = FALSE;
|
||||
|
||||
return_args = procedural_db_return_args (&unit_get_singular_proc, success);
|
||||
|
@ -625,10 +625,10 @@ unit_get_plural_invoker (Argument *args)
|
|||
{
|
||||
gboolean success = TRUE;
|
||||
Argument *return_args;
|
||||
GUnit unit;
|
||||
GimpUnit unit;
|
||||
|
||||
unit = args[0].value.pdb_int;
|
||||
if (unit < UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ())
|
||||
if (unit < GIMP_UNIT_PIXEL || unit >= gimp_unit_get_number_of_units ())
|
||||
success = FALSE;
|
||||
|
||||
return_args = procedural_db_return_args (&unit_get_plural_proc, success);
|
||||
|
|
|
@ -221,7 +221,7 @@ gimp_query_size_box (gchar *title,
|
|||
gdouble lower,
|
||||
gdouble upper,
|
||||
gint digits,
|
||||
GUnit unit,
|
||||
GimpUnit unit,
|
||||
gdouble resolution,
|
||||
gboolean dot_for_dot,
|
||||
GtkObject *object,
|
||||
|
@ -239,7 +239,7 @@ gimp_query_size_box (gchar *title,
|
|||
sizeentry = gimp_size_entry_new (1, unit, "%p", TRUE, FALSE, FALSE, 100,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
if (dot_for_dot)
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), GIMP_UNIT_PIXEL);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (sizeentry), 0,
|
||||
resolution, FALSE);
|
||||
gimp_size_entry_set_refval_digits (GIMP_SIZE_ENTRY (sizeentry), 0, digits);
|
||||
|
|
|
@ -82,7 +82,7 @@ GtkWidget * gimp_query_size_box (gchar *title,
|
|||
gdouble lower,
|
||||
gdouble upper,
|
||||
gint digits,
|
||||
GUnit unit,
|
||||
GimpUnit unit,
|
||||
gdouble resolution,
|
||||
gboolean dot_for_dot,
|
||||
GtkObject *object,
|
||||
|
|
27
app/xcf.c
27
app/xcf.c
|
@ -1207,10 +1207,10 @@ xcf_save_prop (XcfInfo *info,
|
|||
break;
|
||||
case PROP_USER_UNIT:
|
||||
{
|
||||
GUnit unit;
|
||||
gchar *unit_strings[5];
|
||||
float factor;
|
||||
guint32 digits;
|
||||
GimpUnit unit;
|
||||
gchar *unit_strings[5];
|
||||
gfloat factor;
|
||||
guint32 digits;
|
||||
|
||||
unit = va_arg (args, guint32);
|
||||
|
||||
|
@ -1878,11 +1878,12 @@ xcf_load_image_props (XcfInfo *info,
|
|||
guint32 unit;
|
||||
|
||||
info->cp += xcf_read_int32 (info->fp, &unit, 1);
|
||||
|
||||
if ((unit >= gimp_unit_get_number_of_units()) )
|
||||
|
||||
if ((unit <= GIMP_UNIT_PIXEL) ||
|
||||
(unit >= gimp_unit_get_number_of_units()))
|
||||
{
|
||||
g_message ("Warning, unit out of range in XCF file, falling back to inches");
|
||||
unit = UNIT_INCH;
|
||||
unit = GIMP_UNIT_INCH;
|
||||
}
|
||||
|
||||
gimage->unit = unit;
|
||||
|
@ -1897,12 +1898,12 @@ xcf_load_image_props (XcfInfo *info,
|
|||
break;
|
||||
case PROP_USER_UNIT:
|
||||
{
|
||||
gchar *unit_strings[5];
|
||||
float factor;
|
||||
guint32 digits;
|
||||
GUnit unit;
|
||||
gint num_units;
|
||||
gint i;
|
||||
gchar *unit_strings[5];
|
||||
float factor;
|
||||
guint32 digits;
|
||||
GimpUnit unit;
|
||||
gint num_units;
|
||||
gint i;
|
||||
|
||||
info->cp += xcf_read_float (info->fp, &factor, 1);
|
||||
info->cp += xcf_read_int32 (info->fp, &digits, 1);
|
||||
|
|
|
@ -1207,10 +1207,10 @@ xcf_save_prop (XcfInfo *info,
|
|||
break;
|
||||
case PROP_USER_UNIT:
|
||||
{
|
||||
GUnit unit;
|
||||
gchar *unit_strings[5];
|
||||
float factor;
|
||||
guint32 digits;
|
||||
GimpUnit unit;
|
||||
gchar *unit_strings[5];
|
||||
gfloat factor;
|
||||
guint32 digits;
|
||||
|
||||
unit = va_arg (args, guint32);
|
||||
|
||||
|
@ -1878,11 +1878,12 @@ xcf_load_image_props (XcfInfo *info,
|
|||
guint32 unit;
|
||||
|
||||
info->cp += xcf_read_int32 (info->fp, &unit, 1);
|
||||
|
||||
if ((unit >= gimp_unit_get_number_of_units()) )
|
||||
|
||||
if ((unit <= GIMP_UNIT_PIXEL) ||
|
||||
(unit >= gimp_unit_get_number_of_units()))
|
||||
{
|
||||
g_message ("Warning, unit out of range in XCF file, falling back to inches");
|
||||
unit = UNIT_INCH;
|
||||
unit = GIMP_UNIT_INCH;
|
||||
}
|
||||
|
||||
gimage->unit = unit;
|
||||
|
@ -1897,12 +1898,12 @@ xcf_load_image_props (XcfInfo *info,
|
|||
break;
|
||||
case PROP_USER_UNIT:
|
||||
{
|
||||
gchar *unit_strings[5];
|
||||
float factor;
|
||||
guint32 digits;
|
||||
GUnit unit;
|
||||
gint num_units;
|
||||
gint i;
|
||||
gchar *unit_strings[5];
|
||||
float factor;
|
||||
guint32 digits;
|
||||
GimpUnit unit;
|
||||
gint num_units;
|
||||
gint i;
|
||||
|
||||
info->cp += xcf_read_float (info->fp, &factor, 1);
|
||||
info->cp += xcf_read_int32 (info->fp, &digits, 1);
|
||||
|
|
|
@ -1,3 +1,17 @@
|
|||
2000-02-07 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* libgimp/libgimp-decl.txt
|
||||
* libgimp/libgimp-sections.txt
|
||||
* libgimp/tmpl/gimpcolorbutton.sgml
|
||||
* libgimp/tmpl/gimpfileselection.sgml
|
||||
* libgimp/tmpl/gimphelpui.sgml
|
||||
* libgimp/tmpl/gimppatheditor.sgml
|
||||
* libgimp/tmpl/gimpsizeentry.sgml
|
||||
* libgimp/tmpl/gimpunit.sgml
|
||||
* libgimp/tmpl/gimpunitmenu.sgml
|
||||
* libgimp/tmpl/libgimp-unused.sgml: updated from the libgimp
|
||||
sources. Added some more documentation to the sgml templates.
|
||||
|
||||
Mon Feb 7 14:47:04 CET 2000 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* README: add a link to "DocBook: The Definitive Guide"
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -694,7 +694,7 @@ GIMP_IS_PATH_EDITOR_CLASS
|
|||
<FILE>gimpsizeentry</FILE>
|
||||
GimpSizeEntry
|
||||
GIMP_SIZE_ENTRY
|
||||
GimpSizeEntryUP
|
||||
GimpSizeEntryUpdatePolicy
|
||||
GimpSizeEntryField
|
||||
<TITLE>GimpSizeEntry</TITLE>
|
||||
gimp_size_entry_new
|
||||
|
@ -795,7 +795,7 @@ gimp_gradient_close_popup
|
|||
|
||||
<SECTION>
|
||||
<FILE>gimpunit</FILE>
|
||||
GUnit
|
||||
GimpUnit
|
||||
gimp_unit_get_number_of_units
|
||||
gimp_unit_get_number_of_built_in_units
|
||||
gimp_unit_new
|
||||
|
|
|
@ -6,12 +6,17 @@ Widget for selecting a color.
|
|||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
This widget provides a simple button with a preview showing the color.
|
||||
This widget provides a simple button with a preview showing the
|
||||
color.
|
||||
</para>
|
||||
<para>
|
||||
On click a GtkColorSelectionDialog is opened. Additionally the button
|
||||
supports Drag and Drop and has a right-click menu that allows to choose
|
||||
the color from the current FG or BG color. If the user changes the
|
||||
color, the "color_changed" signal is emitted. Note that the color is
|
||||
changed in place.
|
||||
color, the "color_changed" signal is emitted.
|
||||
</para>
|
||||
<para>
|
||||
Note that the color is changed in place.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
|
@ -27,10 +32,11 @@ changed in place.
|
|||
|
||||
<!-- ##### MACRO GIMP_COLOR_BUTTON ##### -->
|
||||
<para>
|
||||
|
||||
Checks if the passed pointer is a pointer to a #GimpColorButton and
|
||||
performes the cast if valid.
|
||||
</para>
|
||||
|
||||
@obj:
|
||||
@obj: The pointer to cast.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gimp_color_button_new ##### -->
|
||||
|
|
|
@ -11,7 +11,7 @@ GimpFileSelection
|
|||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
#GimpPathEditor
|
||||
</para>
|
||||
|
||||
<!-- ##### STRUCT GimpFileSelection ##### -->
|
||||
|
@ -25,7 +25,7 @@ GimpFileSelection
|
|||
|
||||
</para>
|
||||
|
||||
@obj:
|
||||
@obj: The pointer to cast.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gimp_file_selection_new ##### -->
|
||||
|
|
|
@ -19,6 +19,8 @@ gimphelpui
|
|||
|
||||
</para>
|
||||
|
||||
@help_data:
|
||||
<!-- # Unused Parameters # -->
|
||||
@Param1:
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ GimpPathEditor
|
|||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
#GimpFileSelection
|
||||
</para>
|
||||
|
||||
<!-- ##### STRUCT GimpPathEditor ##### -->
|
||||
|
@ -25,7 +25,7 @@ GimpPathEditor
|
|||
|
||||
</para>
|
||||
|
||||
@obj:
|
||||
@obj: The pointer to cast.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gimp_path_editor_new ##### -->
|
||||
|
|
|
@ -2,16 +2,41 @@
|
|||
GimpSizeEntry
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
|
||||
Widget for entering pixel values and resolutions.
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
|
||||
This widget is used to enter pixel distances/sizes and resolutions.
|
||||
</para>
|
||||
<para>
|
||||
You can specify the number of fields the widget should provide. For
|
||||
each field automatic mappings are performed between the field's
|
||||
"reference value" and it's "value".
|
||||
</para>
|
||||
<para>
|
||||
There is a #GimpUnitMenu right of the entry fields which lets you
|
||||
specify the #GimpUnit of the displayed values.
|
||||
</para>
|
||||
<para>
|
||||
For each field, there can be one or two #GtkSpinButton's to enter
|
||||
"value" and "reference value". If you specify @show_refval as #FALSE
|
||||
in gimp_size_entry_new() there will be only one #GtkSpinButton and the
|
||||
#GimpUnitMenu will contain an item for selecting GIMP_UNIT_PIXEL.
|
||||
</para>
|
||||
<para>
|
||||
The "reference value" is either of GIMP_UNIT_PIXEL or dpi, depending
|
||||
on which #GimpSizeEntryUpdatePolicy you specify in gimp_size_entry_new().
|
||||
The "value" is either the size in pixels mapped to the size in a
|
||||
real-world-unit (see #GimpUnit) or the dpi value mapped to pixels per
|
||||
real-world-unit.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
#GimpUnit
|
||||
</para>
|
||||
<para>
|
||||
#GimpUnitMenu
|
||||
</para>
|
||||
|
||||
<!-- ##### STRUCT GimpSizeEntry ##### -->
|
||||
|
@ -22,13 +47,14 @@ GimpSizeEntry
|
|||
|
||||
<!-- ##### MACRO GIMP_SIZE_ENTRY ##### -->
|
||||
<para>
|
||||
|
||||
Checks if the passed pointer is a pointer to a #GimpSizeEntry and
|
||||
performes the cast if valid.
|
||||
</para>
|
||||
|
||||
@obj:
|
||||
@obj: The pointer to cast.
|
||||
|
||||
|
||||
<!-- ##### ENUM GimpSizeEntryUP ##### -->
|
||||
<!-- ##### ENUM GimpSizeEntryUpdatePolicy ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<!-- ##### SECTION Title ##### -->
|
||||
gimpunit
|
||||
GimpUnit
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
|
||||
Provides a collection of predefined units and functions for creating
|
||||
user-defined units.
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
|
@ -11,21 +12,29 @@ gimpunit
|
|||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
#GimpUnitMenu
|
||||
</para>
|
||||
<para>
|
||||
#GimpSizeEntry
|
||||
</para>
|
||||
|
||||
<!-- ##### ENUM GUnit ##### -->
|
||||
<!-- ##### ENUM GimpUnit ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@UNIT_PIXEL:
|
||||
@UNIT_INCH:
|
||||
@UNIT_MM:
|
||||
@UNIT_POINT:
|
||||
@UNIT_PICA:
|
||||
@UNIT_END:
|
||||
@UNIT_PERCENT:
|
||||
@GIMP_UNIT_PIXEL: This is a "pseudo unit" which needs a resolution to
|
||||
be transformed into inches, millimeters etc.
|
||||
@GIMP_UNIT_INCH: The GIMP base unit.
|
||||
@GIMP_UNIT_MM: There are 25.4 millimeters in an inch.
|
||||
@GIMP_UNIT_POINT: There are 72.0 points in an inch.
|
||||
@GIMP_UNIT_PICA: There are 6.0 picas in an inch.
|
||||
@GIMP_UNIT_END: This is an internal value. Please use
|
||||
gimp_unit_get_number_of_built_in_units() instead.
|
||||
@GIMP_UNIT_PERCENT: This is a "pseudo unit" which does not really
|
||||
belong here. You can ask for it's strings but
|
||||
asking for @factor, @digits or @deletion_flag fill
|
||||
fail with an error.
|
||||
|
||||
<!-- ##### FUNCTION gimp_unit_get_number_of_units ##### -->
|
||||
<para>
|
||||
|
|
|
@ -2,16 +2,32 @@
|
|||
GimpUnitMenu
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
|
||||
Widget for selecting a #GimpUnit.
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
|
||||
This widget provides a #GtkOptionMenu which contains a list of #GimpUnit's.
|
||||
</para>
|
||||
<para>
|
||||
You can specify the string that will be displayed for each unit by
|
||||
passing a printf-like @format string to gimp_unit_menu_new().
|
||||
</para>
|
||||
<para>
|
||||
The constructor also lets you choose if the menu should contain items
|
||||
for GIMP_UNIT_PIXEL, GIMP_UNIT_PERCENT and a "More..." item which will
|
||||
pop up a dialog for selecting user-defined units.
|
||||
</para>
|
||||
<para>
|
||||
Whenever the user selects a unit from the menu or the dialog, the
|
||||
"unit_changed" signal will be emitted.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
#GimpUnit
|
||||
</para>
|
||||
<para>
|
||||
#GimpSizeEntry
|
||||
</para>
|
||||
|
||||
<!-- ##### STRUCT GimpUnitMenu ##### -->
|
||||
|
@ -22,15 +38,52 @@ GimpUnitMenu
|
|||
|
||||
<!-- ##### MACRO GIMP_UNIT_MENU ##### -->
|
||||
<para>
|
||||
|
||||
Checks if the passed pointer is a pointer to a #GimpUnitMenu and
|
||||
performes the cast if valid.
|
||||
</para>
|
||||
|
||||
@obj:
|
||||
@obj: The pointer to cast.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gimp_unit_menu_new ##### -->
|
||||
<para>
|
||||
|
||||
<informaltable pgwide=1 frame="none" role="enum">
|
||||
<tgroup cols="2"><colspec colwidth="1*"><colspec colwidth="8*">
|
||||
<tbody>
|
||||
|
||||
<row>
|
||||
<entry>% f</entry>
|
||||
<entry>Factor (how many units make up an inch)</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>% y</entry>
|
||||
<entry>Symbol (e.g. "''" for GIMP_UNIT_INCH)</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>% a</entry>
|
||||
<entry>Abbreviation</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>% s</entry>
|
||||
<entry>Singular</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>% p</entry>
|
||||
<entry>Plural</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>%%</entry>
|
||||
<entry>Literal percent</entry>
|
||||
</row>
|
||||
|
||||
</tbody></tgroup></informaltable>
|
||||
|
||||
</para>
|
||||
|
||||
@format:
|
||||
|
@ -61,7 +114,8 @@ GimpUnitMenu
|
|||
|
||||
<!-- ##### SIGNAL GimpUnitMenu::unit-changed ##### -->
|
||||
<para>
|
||||
|
||||
This signal is emitted whenever the user selects a #GimpUnit from the
|
||||
#GimpUnitMenu.
|
||||
</para>
|
||||
|
||||
@gimpunitmenu: the object which received the signal.
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
<!-- ##### MACRO UNIT_MM ##### -->
|
||||
<para>
|
||||
FIXME: Scheduled for removal.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### ENUM GimpSizeEntryUP ##### -->
|
||||
<para>
|
||||
The update policy determines how the #GimpSizeEntry will do the
|
||||
automatic reference_value <-> value mapping.
|
||||
</para>
|
||||
|
||||
@GIMP_SIZE_ENTRY_UPDATE_NONE: Don't do any automatic mapping.
|
||||
@GIMP_SIZE_ENTRY_UPDATE_SIZE: Consider the values to be distances. The
|
||||
reference value equals to pixels.
|
||||
@GIMP_SIZE_ENTRY_UPDATE_RESOLUTION: Consider the values to be
|
||||
resolutions. The reference value equals to dpi.
|
||||
|
||||
<!-- ##### MACRO UNIT_POINT ##### -->
|
||||
<para>
|
||||
FIXME: Scheduled for removal.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### MACRO UNIT_PIXEL ##### -->
|
||||
<para>
|
||||
FIXME: Scheduled for removal.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### MACRO UNIT_END ##### -->
|
||||
<para>
|
||||
FIXME: Scheduled for removal.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### MACRO GUnit ##### -->
|
||||
<para>
|
||||
FIXME: Scheduled for removal.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### MACRO UNIT_INCH ##### -->
|
||||
<para>
|
||||
FIXME: Scheduled for removal.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### MACRO UNIT_PICA ##### -->
|
||||
<para>
|
||||
FIXME: Scheduled for removal.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### MACRO UNIT_PERCENT ##### -->
|
||||
<para>
|
||||
FIXME: Scheduled for removal.
|
||||
</para>
|
||||
|
||||
|
|
@ -524,8 +524,8 @@ void gimp_image_get_resolution (gint32 image_ID,
|
|||
double *xresolution,
|
||||
double *yresolution);
|
||||
void gimp_image_set_unit (gint32 image_ID,
|
||||
GUnit unit);
|
||||
GUnit gimp_image_get_unit (gint32 image_ID);
|
||||
GimpUnit unit);
|
||||
GimpUnit gimp_image_get_unit (gint32 image_ID);
|
||||
gint32 gimp_image_get_layer_by_tattoo (gint32 image_ID,
|
||||
gint32 tattoo);
|
||||
gint32 gimp_image_get_channel_by_tattoo (gint32 image_ID,
|
||||
|
|
|
@ -19,37 +19,37 @@
|
|||
|
||||
#include <glib.h>
|
||||
|
||||
#include <libgimp/gimpcolorspace.h>
|
||||
#include "gimpcolorspace.h"
|
||||
|
||||
/*********************************
|
||||
* color conversion routines *
|
||||
*********************************/
|
||||
|
||||
void
|
||||
gimp_rgb_to_hsv (gint *r,
|
||||
gint *g,
|
||||
gint *b)
|
||||
gimp_rgb_to_hsv (gint *red,
|
||||
gint *green,
|
||||
gint *blue)
|
||||
{
|
||||
gint red, green, blue;
|
||||
gint r, g, b;
|
||||
gdouble h, s, v;
|
||||
gint min, max;
|
||||
gint delta;
|
||||
|
||||
h = 0.0;
|
||||
|
||||
red = *r;
|
||||
green = *g;
|
||||
blue = *b;
|
||||
r = *red;
|
||||
g = *green;
|
||||
b = *blue;
|
||||
|
||||
if (red > green)
|
||||
if (r > g)
|
||||
{
|
||||
max = MAX (red, blue);
|
||||
min = MIN (green, blue);
|
||||
max = MAX (r, b);
|
||||
min = MIN (g, b);
|
||||
}
|
||||
else
|
||||
{
|
||||
max = MAX (green, blue);
|
||||
min = MIN (red, blue);
|
||||
max = MAX (g, b);
|
||||
min = MIN (r, b);
|
||||
}
|
||||
|
||||
v = max;
|
||||
|
@ -64,12 +64,12 @@ gimp_rgb_to_hsv (gint *r,
|
|||
else
|
||||
{
|
||||
delta = max - min;
|
||||
if (red == max)
|
||||
h = (green - blue) / (gdouble) delta;
|
||||
else if (green == max)
|
||||
h = 2 + (blue - red) / (gdouble) delta;
|
||||
else if (blue == max)
|
||||
h = 4 + (red - green) / (gdouble) delta;
|
||||
if (r == max)
|
||||
h = (g - b) / (gdouble) delta;
|
||||
else if (g == max)
|
||||
h = 2 + (b - r) / (gdouble) delta;
|
||||
else if (b == max)
|
||||
h = 4 + (r - g) / (gdouble) delta;
|
||||
h *= 42.5;
|
||||
|
||||
if (h < 0)
|
||||
|
@ -78,100 +78,100 @@ gimp_rgb_to_hsv (gint *r,
|
|||
h -= 255;
|
||||
}
|
||||
|
||||
*r = h;
|
||||
*g = s;
|
||||
*b = v;
|
||||
*red = h;
|
||||
*green = s;
|
||||
*blue = v;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_hsv_to_rgb (gint *h,
|
||||
gint *s,
|
||||
gint *v)
|
||||
gimp_hsv_to_rgb (gint *hue,
|
||||
gint *saturation,
|
||||
gint *value)
|
||||
{
|
||||
gdouble hue, saturation, value;
|
||||
gdouble h, s, v;
|
||||
gdouble f, p, q, t;
|
||||
|
||||
if (*s == 0)
|
||||
if (*saturation == 0)
|
||||
{
|
||||
*h = *v;
|
||||
*s = *v;
|
||||
*v = *v;
|
||||
*hue = *value;
|
||||
*saturation = *value;
|
||||
*value = *value;
|
||||
}
|
||||
else
|
||||
{
|
||||
hue = *h * 6.0 / 255.0;
|
||||
saturation = *s / 255.0;
|
||||
value = *v / 255.0;
|
||||
h = *hue * 6.0 / 255.0;
|
||||
s = *saturation / 255.0;
|
||||
v = *value / 255.0;
|
||||
|
||||
f = hue - (int) hue;
|
||||
p = value * (1.0 - saturation);
|
||||
q = value * (1.0 - (saturation * f));
|
||||
t = value * (1.0 - (saturation * (1.0 - f)));
|
||||
f = h - (gint) h;
|
||||
p = v * (1.0 - s);
|
||||
q = v * (1.0 - (s * f));
|
||||
t = v * (1.0 - (s * (1.0 - f)));
|
||||
|
||||
switch ((int) hue)
|
||||
switch ((gint) h)
|
||||
{
|
||||
case 0:
|
||||
*h = value * 255;
|
||||
*s = t * 255;
|
||||
*v = p * 255;
|
||||
*hue = v * 255;
|
||||
*saturation = t * 255;
|
||||
*value = p * 255;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
*h = q * 255;
|
||||
*s = value * 255;
|
||||
*v = p * 255;
|
||||
*hue = q * 255;
|
||||
*saturation = v * 255;
|
||||
*value = p * 255;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
*h = p * 255;
|
||||
*s = value * 255;
|
||||
*v = t * 255;
|
||||
*hue = p * 255;
|
||||
*saturation = v * 255;
|
||||
*value = t * 255;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
*h = p * 255;
|
||||
*s = q * 255;
|
||||
*v = value * 255;
|
||||
*hue = p * 255;
|
||||
*saturation = q * 255;
|
||||
*value = v * 255;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
*h = t * 255;
|
||||
*s = p * 255;
|
||||
*v = value * 255;
|
||||
*hue = t * 255;
|
||||
*saturation = p * 255;
|
||||
*value = v * 255;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
*h = value * 255;
|
||||
*s = p * 255;
|
||||
*v = q * 255;
|
||||
*hue = v * 255;
|
||||
*saturation = p * 255;
|
||||
*value = q * 255;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_rgb_to_hls (gint *r,
|
||||
gint *g,
|
||||
gint *b)
|
||||
gimp_rgb_to_hls (gint *red,
|
||||
gint *green,
|
||||
gint *blue)
|
||||
{
|
||||
gint red, green, blue;
|
||||
gint r, g, b;
|
||||
gdouble h, l, s;
|
||||
gint min, max;
|
||||
gint delta;
|
||||
|
||||
red = *r;
|
||||
green = *g;
|
||||
blue = *b;
|
||||
r = *red;
|
||||
g = *green;
|
||||
b = *blue;
|
||||
|
||||
if (red > green)
|
||||
if (r > g)
|
||||
{
|
||||
max = MAX (red, blue);
|
||||
min = MIN (green, blue);
|
||||
max = MAX (r, b);
|
||||
min = MIN (g, b);
|
||||
}
|
||||
else
|
||||
{
|
||||
max = MAX (green, blue);
|
||||
min = MIN (red, blue);
|
||||
max = MAX (g, b);
|
||||
min = MIN (r, b);
|
||||
}
|
||||
|
||||
l = (max + min) / 2.0;
|
||||
|
@ -190,12 +190,12 @@ gimp_rgb_to_hls (gint *r,
|
|||
else
|
||||
s = 255 * (gdouble) delta / (gdouble) (511 - max - min);
|
||||
|
||||
if (red == max)
|
||||
h = (green - blue) / (gdouble) delta;
|
||||
else if (green == max)
|
||||
h = 2 + (blue - red) / (gdouble) delta;
|
||||
if (r == max)
|
||||
h = (g - b) / (gdouble) delta;
|
||||
else if (g == max)
|
||||
h = 2 + (b - r) / (gdouble) delta;
|
||||
else
|
||||
h = 4 + (red - green) / (gdouble) delta;
|
||||
h = 4 + (r - g) / (gdouble) delta;
|
||||
|
||||
h = h * 42.5;
|
||||
|
||||
|
@ -205,9 +205,9 @@ gimp_rgb_to_hls (gint *r,
|
|||
h -= 255;
|
||||
}
|
||||
|
||||
*r = h;
|
||||
*g = l;
|
||||
*b = s;
|
||||
*red = h;
|
||||
*green = l;
|
||||
*blue = s;
|
||||
}
|
||||
|
||||
gint
|
||||
|
@ -255,65 +255,65 @@ gimp_hls_value (gdouble n1,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_hls_to_rgb (gint *h,
|
||||
gint *l,
|
||||
gint *s)
|
||||
gimp_hls_to_rgb (gint *hue,
|
||||
gint *lightness,
|
||||
gint *saturation)
|
||||
{
|
||||
gdouble hue, lightness, saturation;
|
||||
gdouble h, l, s;
|
||||
gdouble m1, m2;
|
||||
|
||||
hue = *h;
|
||||
lightness = *l;
|
||||
saturation = *s;
|
||||
h = *hue;
|
||||
l = *lightness;
|
||||
s = *saturation;
|
||||
|
||||
if (saturation == 0)
|
||||
if (s == 0)
|
||||
{
|
||||
/* achromatic case */
|
||||
*h = lightness;
|
||||
*l = lightness;
|
||||
*s = lightness;
|
||||
*hue = l;
|
||||
*lightness = l;
|
||||
*saturation = l;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lightness < 128)
|
||||
m2 = (lightness * (255 + saturation)) / 65025.0;
|
||||
if (l < 128)
|
||||
m2 = (l * (255 + s)) / 65025.0;
|
||||
else
|
||||
m2 = (lightness + saturation - (lightness * saturation)/255.0) / 255.0;
|
||||
m2 = (l + s - (l * s) / 255.0) / 255.0;
|
||||
|
||||
m1 = (lightness / 127.5) - m2;
|
||||
m1 = (l / 127.5) - m2;
|
||||
|
||||
/* chromatic case */
|
||||
*h = gimp_hls_value (m1, m2, hue + 85);
|
||||
*l = gimp_hls_value (m1, m2, hue);
|
||||
*s = gimp_hls_value (m1, m2, hue - 85);
|
||||
*hue = gimp_hls_value (m1, m2, h + 85);
|
||||
*lightness = gimp_hls_value (m1, m2, h);
|
||||
*saturation = gimp_hls_value (m1, m2, h - 85);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_rgb_to_hsv_double (gdouble *r,
|
||||
gdouble *g,
|
||||
gdouble *b)
|
||||
gimp_rgb_to_hsv_double (gdouble *red,
|
||||
gdouble *green,
|
||||
gdouble *blue)
|
||||
{
|
||||
gdouble red, green, blue;
|
||||
gdouble r, g, b;
|
||||
gdouble h, s, v;
|
||||
gdouble min, max;
|
||||
gdouble delta;
|
||||
|
||||
red = *r;
|
||||
green = *g;
|
||||
blue = *b;
|
||||
r = *red;
|
||||
g = *green;
|
||||
b = *blue;
|
||||
|
||||
h = 0.0; /* Shut up -Wall */
|
||||
|
||||
if (red > green)
|
||||
if (r > g)
|
||||
{
|
||||
max = MAX (red, blue);
|
||||
min = MIN (green, blue);
|
||||
max = MAX (r, b);
|
||||
min = MIN (g, b);
|
||||
}
|
||||
else
|
||||
{
|
||||
max = MAX (green, blue);
|
||||
min = MIN (red, blue);
|
||||
max = MAX (g, b);
|
||||
min = MIN (r, b);
|
||||
}
|
||||
|
||||
v = max;
|
||||
|
@ -331,12 +331,12 @@ gimp_rgb_to_hsv_double (gdouble *r,
|
|||
{
|
||||
delta = max - min;
|
||||
|
||||
if (red == max)
|
||||
h = (green - blue) / delta;
|
||||
else if (green == max)
|
||||
h = 2 + (blue - red) / delta;
|
||||
else if (blue == max)
|
||||
h = 4 + (red - green) / delta;
|
||||
if (r == max)
|
||||
h = (g - b) / delta;
|
||||
else if (g == max)
|
||||
h = 2 + (b - r) / delta;
|
||||
else if (b == max)
|
||||
h = 4 + (r - g) / delta;
|
||||
|
||||
h /= 6.0;
|
||||
|
||||
|
@ -346,75 +346,75 @@ gimp_rgb_to_hsv_double (gdouble *r,
|
|||
h -= 1.0;
|
||||
}
|
||||
|
||||
*r = h;
|
||||
*g = s;
|
||||
*b = v;
|
||||
*red = h;
|
||||
*green = s;
|
||||
*blue = v;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_hsv_to_rgb_double (gdouble *h,
|
||||
gdouble *s,
|
||||
gdouble *v)
|
||||
gimp_hsv_to_rgb_double (gdouble *hue,
|
||||
gdouble *saturation,
|
||||
gdouble *value)
|
||||
{
|
||||
gdouble hue, saturation, value;
|
||||
gdouble h, s, v;
|
||||
gdouble f, p, q, t;
|
||||
|
||||
if (*s == 0.0)
|
||||
if (*saturation == 0.0)
|
||||
{
|
||||
*h = *v;
|
||||
*s = *v;
|
||||
*v = *v; /* heh */
|
||||
*hue = *value;
|
||||
*saturation = *value;
|
||||
*value = *value;
|
||||
}
|
||||
else
|
||||
{
|
||||
hue = *h * 6.0;
|
||||
saturation = *s;
|
||||
value = *v;
|
||||
h = *hue * 6.0;
|
||||
s = *saturation;
|
||||
v = *value;
|
||||
|
||||
if (hue == 6.0)
|
||||
hue = 0.0;
|
||||
if (h == 6.0)
|
||||
h = 0.0;
|
||||
|
||||
f = hue - (gint) hue;
|
||||
p = value * (1.0 - saturation);
|
||||
q = value * (1.0 - saturation * f);
|
||||
t = value * (1.0 - saturation * (1.0 - f));
|
||||
f = h - (gint) h;
|
||||
p = v * (1.0 - s);
|
||||
q = v * (1.0 - s * f);
|
||||
t = v * (1.0 - s * (1.0 - f));
|
||||
|
||||
switch ((gint) hue)
|
||||
switch ((gint) h)
|
||||
{
|
||||
case 0:
|
||||
*h = value;
|
||||
*s = t;
|
||||
*v = p;
|
||||
*hue = v;
|
||||
*saturation = t;
|
||||
*value = p;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
*h = q;
|
||||
*s = value;
|
||||
*v = p;
|
||||
*hue = q;
|
||||
*saturation = v;
|
||||
*value = p;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
*h = p;
|
||||
*s = value;
|
||||
*v = t;
|
||||
*hue = p;
|
||||
*saturation = v;
|
||||
*value = t;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
*h = p;
|
||||
*s = q;
|
||||
*v = value;
|
||||
*hue = p;
|
||||
*saturation = q;
|
||||
*value = v;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
*h = t;
|
||||
*s = p;
|
||||
*v = value;
|
||||
*hue = t;
|
||||
*saturation = p;
|
||||
*value = v;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
*h = value;
|
||||
*s = p;
|
||||
*v = q;
|
||||
*hue = v;
|
||||
*saturation = p;
|
||||
*value = q;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -423,8 +423,8 @@ gimp_hsv_to_rgb_double (gdouble *h,
|
|||
void
|
||||
gimp_rgb_to_hsv4 (guchar *rgb,
|
||||
gdouble *hue,
|
||||
gdouble *sat,
|
||||
gdouble *val)
|
||||
gdouble *saturation,
|
||||
gdouble *value)
|
||||
{
|
||||
gdouble red, green, blue;
|
||||
gdouble h, s, v;
|
||||
|
@ -439,27 +439,13 @@ gimp_rgb_to_hsv4 (guchar *rgb,
|
|||
|
||||
if (red > green)
|
||||
{
|
||||
if (red > blue)
|
||||
max = red;
|
||||
else
|
||||
max = blue;
|
||||
|
||||
if (green < blue)
|
||||
min = green;
|
||||
else
|
||||
min = blue;
|
||||
max = MAX (red, blue);
|
||||
min = MIN (green, blue);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (green > blue)
|
||||
max = green;
|
||||
else
|
||||
max = blue;
|
||||
|
||||
if (red < blue)
|
||||
min = red;
|
||||
else
|
||||
min = blue;
|
||||
max = MAX (green, blue);
|
||||
min = MIN (red, blue);
|
||||
}
|
||||
|
||||
v = max;
|
||||
|
@ -490,82 +476,81 @@ gimp_rgb_to_hsv4 (guchar *rgb,
|
|||
h -= 1.0;
|
||||
}
|
||||
|
||||
*hue = h;
|
||||
*sat = s;
|
||||
*val = v;
|
||||
*hue = h;
|
||||
*saturation = s;
|
||||
*value = v;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_hsv_to_rgb4 (guchar *rgb,
|
||||
gdouble h,
|
||||
gdouble s,
|
||||
gdouble v)
|
||||
gdouble hue,
|
||||
gdouble saturation,
|
||||
gdouble value)
|
||||
{
|
||||
gdouble hue, saturation, value;
|
||||
gdouble h, s, v;
|
||||
gdouble f, p, q, t;
|
||||
|
||||
if (s == 0.0)
|
||||
if (saturation == 0.0)
|
||||
{
|
||||
h = v;
|
||||
s = v;
|
||||
v = v; /* heh */
|
||||
hue = value;
|
||||
saturation = value;
|
||||
value = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
hue = h * 6.0;
|
||||
saturation = s;
|
||||
value = v;
|
||||
h = hue * 6.0;
|
||||
s = saturation;
|
||||
v = value;
|
||||
|
||||
if (hue == 6.0)
|
||||
hue = 0.0;
|
||||
if (h == 6.0)
|
||||
h = 0.0;
|
||||
|
||||
f = hue - (int) hue;
|
||||
p = value * (1.0 - saturation);
|
||||
q = value * (1.0 - saturation * f);
|
||||
t = value * (1.0 - saturation * (1.0 - f));
|
||||
f = h - (gint) h;
|
||||
p = v * (1.0 - s);
|
||||
q = v * (1.0 - s * f);
|
||||
t = v * (1.0 - s * (1.0 - f));
|
||||
|
||||
switch ((int) hue)
|
||||
switch ((int) h)
|
||||
{
|
||||
case 0:
|
||||
h = value;
|
||||
s = t;
|
||||
v = p;
|
||||
hue = v;
|
||||
saturation = t;
|
||||
value = p;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
h = q;
|
||||
s = value;
|
||||
v = p;
|
||||
hue = q;
|
||||
saturation = v;
|
||||
value = p;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
h = p;
|
||||
s = value;
|
||||
v = t;
|
||||
hue = p;
|
||||
saturation = v;
|
||||
value = t;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
h = p;
|
||||
s = q;
|
||||
v = value;
|
||||
hue = p;
|
||||
saturation = q;
|
||||
value = v;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
h = t;
|
||||
s = p;
|
||||
v = value;
|
||||
hue = t;
|
||||
saturation = p;
|
||||
value = v;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
h = value;
|
||||
s = p;
|
||||
v = q;
|
||||
hue = v;
|
||||
saturation = p;
|
||||
value = q;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
rgb[0] = h * 255;
|
||||
rgb[1] = s * 255;
|
||||
rgb[2] = v * 255;
|
||||
|
||||
rgb[0] = hue * 255;
|
||||
rgb[1] = saturation * 255;
|
||||
rgb[2] = value * 255;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
typedef void (* GimpHelpFunc) (gchar *);
|
||||
typedef void (* GimpHelpFunc) (gchar *help_data);
|
||||
|
||||
|
||||
void gimp_help_init (void);
|
||||
|
|
|
@ -1105,12 +1105,12 @@ gimp_image_set_resolution (gint32 image_ID,
|
|||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
}
|
||||
|
||||
GUnit
|
||||
GimpUnit
|
||||
gimp_image_get_unit (gint32 image_ID)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
GUnit unit;
|
||||
GimpUnit unit;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_image_get_unit",
|
||||
&nreturn_vals,
|
||||
|
@ -1118,7 +1118,7 @@ gimp_image_get_unit (gint32 image_ID)
|
|||
PARAM_END);
|
||||
|
||||
/* error return value */
|
||||
unit = UNIT_INCH;
|
||||
unit = GIMP_UNIT_INCH;
|
||||
|
||||
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
||||
unit = return_vals[1].data.d_int32;
|
||||
|
@ -1129,8 +1129,8 @@ gimp_image_get_unit (gint32 image_ID)
|
|||
}
|
||||
|
||||
void
|
||||
gimp_image_set_unit (gint32 image_ID,
|
||||
GUnit unit)
|
||||
gimp_image_set_unit (gint32 image_ID,
|
||||
GimpUnit unit)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
|
|
|
@ -1105,12 +1105,12 @@ gimp_image_set_resolution (gint32 image_ID,
|
|||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
}
|
||||
|
||||
GUnit
|
||||
GimpUnit
|
||||
gimp_image_get_unit (gint32 image_ID)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
GUnit unit;
|
||||
GimpUnit unit;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_image_get_unit",
|
||||
&nreturn_vals,
|
||||
|
@ -1118,7 +1118,7 @@ gimp_image_get_unit (gint32 image_ID)
|
|||
PARAM_END);
|
||||
|
||||
/* error return value */
|
||||
unit = UNIT_INCH;
|
||||
unit = GIMP_UNIT_INCH;
|
||||
|
||||
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
||||
unit = return_vals[1].data.d_int32;
|
||||
|
@ -1129,8 +1129,8 @@ gimp_image_get_unit (gint32 image_ID)
|
|||
}
|
||||
|
||||
void
|
||||
gimp_image_set_unit (gint32 image_ID,
|
||||
GUnit unit)
|
||||
gimp_image_set_unit (gint32 image_ID,
|
||||
GimpUnit unit)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef double GimpMatrix[3][3];
|
||||
typedef gdouble GimpMatrix[3][3];
|
||||
|
||||
void gimp_matrix_transform_point (GimpMatrix matrix,
|
||||
gdouble x,
|
||||
|
@ -52,9 +52,9 @@ void gimp_matrix_invert (GimpMatrix matrix,
|
|||
void gimp_matrix_duplicate (GimpMatrix src,
|
||||
GimpMatrix target);
|
||||
|
||||
gboolean gimp_matrix_is_diagonal (GimpMatrix matrix);
|
||||
gboolean gimp_matrix_is_identity (GimpMatrix matrix);
|
||||
gboolean gimp_matrix_is_simple (GimpMatrix matrix);
|
||||
gboolean gimp_matrix_is_diagonal (GimpMatrix matrix);
|
||||
gboolean gimp_matrix_is_identity (GimpMatrix matrix);
|
||||
gboolean gimp_matrix_is_simple (GimpMatrix matrix);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "gimplimits.h"
|
||||
#include "gimpsizeentry.h"
|
||||
#include "gimpunitmenu.h"
|
||||
|
||||
|
@ -27,16 +29,9 @@ static void gimp_size_entry_value_callback (GtkWidget *widget,
|
|||
gpointer data);
|
||||
static void gimp_size_entry_refval_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
/*
|
||||
static int gimp_size_entry_focus_in_callback (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data);
|
||||
static int gimp_size_entry_focus_out_callback (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data);
|
||||
*/
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
VALUE_CHANGED,
|
||||
REFVAL_CHANGED,
|
||||
UNIT_CHANGED,
|
||||
|
@ -140,7 +135,7 @@ gimp_size_entry_init (GimpSizeEntry *gse)
|
|||
gse->fields = NULL;
|
||||
gse->number_of_fields = 0;
|
||||
gse->unitmenu = NULL;
|
||||
gse->unit = UNIT_PIXEL;
|
||||
gse->unit = GIMP_UNIT_PIXEL;
|
||||
gse->menu_show_pixels = TRUE;
|
||||
gse->menu_show_percent = TRUE;
|
||||
gse->show_refval = FALSE;
|
||||
|
@ -148,7 +143,7 @@ gimp_size_entry_init (GimpSizeEntry *gse)
|
|||
}
|
||||
|
||||
GtkType
|
||||
gimp_size_entry_get_type ()
|
||||
gimp_size_entry_get_type (void)
|
||||
{
|
||||
static guint gse_type = 0;
|
||||
|
||||
|
@ -172,15 +167,60 @@ gimp_size_entry_get_type ()
|
|||
return gse_type;
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
gimp_size_entry_new (gint number_of_fields,
|
||||
GUnit unit,
|
||||
gchar *unit_format,
|
||||
gboolean menu_show_pixels,
|
||||
gboolean menu_show_percent,
|
||||
gboolean show_refval,
|
||||
gint spinbutton_usize,
|
||||
GimpSizeEntryUP update_policy)
|
||||
/**
|
||||
* gimp_size_entry_new:
|
||||
* @number_of_fields: The number of input fields.
|
||||
* @unit: The initial unit.
|
||||
* @unit_format: A printf-like unit-format string (see #GimpUnitMenu).
|
||||
* @menu_show_pixels: #TRUE if the unit menu shold contain an item for
|
||||
* GIMP_UNIT_PIXEL (ignored if the @update_policy is not
|
||||
* GIMP_SIZE_ENTRY_UPDATE_NONE).
|
||||
* @menu_show_percent: #TRUE if the unit menu shold contain an item for
|
||||
* GIMP_UNIT_PERCENT.
|
||||
* @show_refval: #TRUE if you want an extra "refenence value" spinbutton per
|
||||
input field.
|
||||
* @spinbutton_usize: The minimal horizontal size of the #GtkSpinButton's.
|
||||
* @update_policy: How the automatic pixel <-> real-world-unit calculations
|
||||
* should be performed.
|
||||
*
|
||||
* Creates a new #GimpSizeEntry widget.
|
||||
*
|
||||
* To have all automatic calculations performed correctly, set up the
|
||||
* widget in the following order:
|
||||
*
|
||||
* 1. gimp_size_entry_new()
|
||||
*
|
||||
* 2. (for each additional input field) gimp_size_entry_add_field()
|
||||
*
|
||||
* 3. gimp_size_entry_set_unit()
|
||||
*
|
||||
* For each input field:
|
||||
*
|
||||
* 4. gimp_size_entry_set_resolution()
|
||||
*
|
||||
* 5. gimp_size_entry_set_refval_boundaries()
|
||||
* (or gimp_size_entry_set_value_boundaries())
|
||||
*
|
||||
* 6. gimp_size_entry_set_size()
|
||||
*
|
||||
* 7. gimp_size_entry_set_refval() (or gimp_size_entry_set_value())
|
||||
*
|
||||
* The #GimpSizeEntry is derived from #GtkTable and will have
|
||||
* an empty border of one cell width on each side plus an empty column left
|
||||
* of the #GimpUnitMenu to allow the caller to add labels or a #GimpChainButton.
|
||||
*
|
||||
* Returns: A Pointer to the new #GimpSizeEntry widget.
|
||||
*
|
||||
*/
|
||||
GtkWidget *
|
||||
gimp_size_entry_new (gint number_of_fields,
|
||||
GimpUnit unit,
|
||||
gchar *unit_format,
|
||||
gboolean menu_show_pixels,
|
||||
gboolean menu_show_percent,
|
||||
gboolean show_refval,
|
||||
gint spinbutton_usize,
|
||||
GimpSizeEntryUpdatePolicy update_policy)
|
||||
{
|
||||
GimpSizeEntry *gse;
|
||||
gint i;
|
||||
|
@ -244,7 +284,7 @@ gimp_size_entry_new (gint number_of_fields,
|
|||
1.0, 10.0, 0.0);
|
||||
gsef->value_spinbutton =
|
||||
gtk_spin_button_new (GTK_ADJUSTMENT (gsef->value_adjustment), 1.0,
|
||||
(unit == UNIT_PERCENT) ? 2 :
|
||||
(unit == GIMP_UNIT_PERCENT) ? 2 :
|
||||
(MIN (gimp_unit_get_digits (unit), 5) + 1));
|
||||
gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON(gsef->value_spinbutton),
|
||||
GTK_SHADOW_NONE);
|
||||
|
@ -255,17 +295,6 @@ gimp_size_entry_new (gint number_of_fields,
|
|||
gtk_signal_connect (GTK_OBJECT (gsef->value_adjustment), "value_changed",
|
||||
(GtkSignalFunc) gimp_size_entry_value_callback, gsef);
|
||||
|
||||
/* these callbacks are not used
|
||||
gtk_signal_connect (GTK_OBJECT (gsef->value_spinbutton),
|
||||
"focus_in_event",
|
||||
(GdkEventFunc) gimp_size_entry_focus_in_callback,
|
||||
gsef);
|
||||
gtk_signal_connect (GTK_OBJECT (gsef->value_spinbutton),
|
||||
"focus_out_event",
|
||||
(GdkEventFunc) gimp_size_entry_focus_out_callback,
|
||||
gsef);
|
||||
*/
|
||||
|
||||
gtk_widget_show (gsef->value_spinbutton);
|
||||
|
||||
if (gse->show_refval)
|
||||
|
@ -288,21 +317,10 @@ gimp_size_entry_new (gint number_of_fields,
|
|||
(GtkSignalFunc) gimp_size_entry_refval_callback,
|
||||
gsef);
|
||||
|
||||
/* these callbacks are not used
|
||||
gtk_signal_connect (GTK_OBJECT (gsef->refval_spinbutton),
|
||||
"focus_in_event",
|
||||
(GdkEventFunc) gimp_size_entry_focus_in_callback,
|
||||
gsef);
|
||||
gtk_signal_connect (GTK_OBJECT (gsef->refval_spinbutton),
|
||||
"focus_out_event",
|
||||
(GdkEventFunc) gimp_size_entry_focus_out_callback,
|
||||
gsef);
|
||||
*/
|
||||
|
||||
gtk_widget_show (gsef->refval_spinbutton);
|
||||
}
|
||||
|
||||
if (gse->menu_show_pixels && !gse->show_refval && (unit == UNIT_PIXEL))
|
||||
if (gse->menu_show_pixels && !gse->show_refval && (unit == GIMP_UNIT_PIXEL))
|
||||
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (gsef->value_spinbutton),
|
||||
gsef->refval_digits);
|
||||
}
|
||||
|
@ -322,11 +340,24 @@ gimp_size_entry_new (gint number_of_fields,
|
|||
}
|
||||
|
||||
|
||||
/* add a field to the sizeentry */
|
||||
/**
|
||||
* gimp_size_entry_add_field:
|
||||
* @gse: The sizeentry you want to add a field to.
|
||||
* @value_spinbutton: The spinbutton to display the field's value.
|
||||
* @refval_spinbutton: The spinbutton to display the field's reference value.
|
||||
*
|
||||
* Adds an input field to the #GimpSizeEntry.
|
||||
*
|
||||
* The new input field will have the index 0. If you specified @show_refval
|
||||
* as #TRUE in gimp_size_entry_new() you have to pass an additional
|
||||
* #GtkSpinButton to hold the reference value. If @show_refval was #FALSE,
|
||||
* @refval_spinbutton will be ignored.
|
||||
*
|
||||
*/
|
||||
void
|
||||
gimp_size_entry_add_field (GimpSizeEntry *gse,
|
||||
GtkSpinButton *value_spinbutton,
|
||||
GtkSpinButton *refval_spinbutton)
|
||||
gimp_size_entry_add_field (GimpSizeEntry *gse,
|
||||
GtkSpinButton *value_spinbutton,
|
||||
GtkSpinButton *refval_spinbutton)
|
||||
{
|
||||
GimpSizeEntryField *gsef;
|
||||
|
||||
|
@ -364,17 +395,6 @@ gimp_size_entry_add_field (GimpSizeEntry *gse,
|
|||
gtk_signal_connect (GTK_OBJECT (gsef->value_adjustment), "value_changed",
|
||||
(GtkSignalFunc) gimp_size_entry_value_callback, gsef);
|
||||
|
||||
/* these callbacks are not used
|
||||
gtk_signal_connect (GTK_OBJECT (value_spinbutton),
|
||||
"focus_in_event",
|
||||
(GdkEventFunc) gimp_size_entry_focus_in_callback,
|
||||
gsef);
|
||||
gtk_signal_connect (GTK_OBJECT (value_spinbutton),
|
||||
"focus_out_event",
|
||||
(GdkEventFunc) gimp_size_entry_focus_out_callback,
|
||||
gsef);
|
||||
*/
|
||||
|
||||
if (gse->show_refval)
|
||||
{
|
||||
gsef->refval_adjustment =
|
||||
|
@ -383,29 +403,26 @@ gimp_size_entry_add_field (GimpSizeEntry *gse,
|
|||
gtk_signal_connect (GTK_OBJECT (gsef->refval_adjustment), "value_changed",
|
||||
(GtkSignalFunc) gimp_size_entry_refval_callback,
|
||||
gsef);
|
||||
|
||||
/* these callbacks are not used
|
||||
gtk_signal_connect (GTK_OBJECT (refval_spinbutton),
|
||||
"focus_in_event",
|
||||
(GdkEventFunc) gimp_size_entry_focus_in_callback,
|
||||
gsef);
|
||||
gtk_signal_connect (GTK_OBJECT (refval_spinbutton),
|
||||
"focus_out_event",
|
||||
(GdkEventFunc) gimp_size_entry_focus_out_callback,
|
||||
gsef);
|
||||
*/
|
||||
}
|
||||
|
||||
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (value_spinbutton),
|
||||
MIN (gimp_unit_get_digits (gse->unit), 5) + 1);
|
||||
|
||||
if (gse->menu_show_pixels && !gse->show_refval && (gse->unit == UNIT_PIXEL))
|
||||
if (gse->menu_show_pixels && !gse->show_refval && (gse->unit == GIMP_UNIT_PIXEL))
|
||||
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (gsef->value_spinbutton),
|
||||
gsef->refval_digits);
|
||||
}
|
||||
|
||||
/* convenience function for labeling the widget ***********/
|
||||
|
||||
/**
|
||||
* gimp_size_entry_attach_label:
|
||||
* @gse: The sizeentry you want to add a label to.
|
||||
* @text: The text of the label.
|
||||
* @row: The row where the label will be attached.
|
||||
* @column: The column where the label will be attached.
|
||||
* @alignment: The horizontal alignment of the label.
|
||||
*
|
||||
* Attaches a #GtkLabel to the #GimpSizeEntry (which is a #GtkTable).
|
||||
*/
|
||||
void
|
||||
gimp_size_entry_attach_label (GimpSizeEntry *gse,
|
||||
gchar *text,
|
||||
|
@ -427,21 +444,37 @@ gimp_size_entry_attach_label (GimpSizeEntry *gse,
|
|||
}
|
||||
|
||||
|
||||
/* resolution stuff ***********/
|
||||
|
||||
/**
|
||||
* gimp_size_entry_set_resolution:
|
||||
* @gse: The sizeentry you want to set a resolution for.
|
||||
* @field: The index of the field you want to set the resolution for.
|
||||
* @resolution: The new resolution (in dpi) for the chosen @field.
|
||||
* @keep_size: #TRUE if the @field's size in pixels should stay the same.
|
||||
* #FALSE if the @field's size in units should stay the same.
|
||||
*
|
||||
* Sets the resolution (in dpi) for field # @field of the #GimpSizeEntry.
|
||||
*
|
||||
* The @resolution passed will be clamped to fit in
|
||||
* [#GIMP_MIN_RESOLUTION..#GIMP_MAX_RESOLUTION].
|
||||
*
|
||||
* This function does nothing if the #GimpSizeEntryUpdatePolicy specified in
|
||||
* gimp_size_entry_new() doesn't equal to GIMP_SIZE_ENTRY_UPDATE_SIZE.
|
||||
*
|
||||
*/
|
||||
void
|
||||
gimp_size_entry_set_resolution (GimpSizeEntry *gse,
|
||||
gint field,
|
||||
gdouble resolution,
|
||||
guint keep_size)
|
||||
gboolean keep_size)
|
||||
{
|
||||
GimpSizeEntryField *gsef;
|
||||
float val;
|
||||
gfloat val;
|
||||
|
||||
g_return_if_fail (gse != NULL);
|
||||
g_return_if_fail (GIMP_IS_SIZE_ENTRY (gse));
|
||||
g_return_if_fail ((field >= 0) && (field < gse->number_of_fields));
|
||||
g_return_if_fail (resolution > 0.0);
|
||||
|
||||
resolution = CLAMP (resolution, GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
|
||||
|
||||
gsef = (GimpSizeEntryField*) g_slist_nth_data (gse->fields, field);
|
||||
gsef->resolution = resolution;
|
||||
|
@ -457,8 +490,24 @@ gimp_size_entry_set_resolution (GimpSizeEntry *gse,
|
|||
}
|
||||
|
||||
|
||||
/* percent stuff ***********/
|
||||
|
||||
/**
|
||||
* gimp_size_entry_set_size:
|
||||
* @gse: The sizeentry you want to set a size for.
|
||||
* @field: The index of the field you want to set the size for.
|
||||
* @lower: The reference value which will be treated as 0%.
|
||||
* @upper: The reference value which will be treated as 100%.
|
||||
*
|
||||
* Sets the pixel values for field # @field of the #GimpSizeEntry
|
||||
* which will be treated as 0% and 100%.
|
||||
*
|
||||
* These values will be used if you specified @menu_show_percent as #TRUE
|
||||
* in gimp_size_entry_new() and the user has selected GIMP_UNIT_PERCENT in
|
||||
* the #GimpSizeEntry's #GimpUnitMenu.
|
||||
*
|
||||
* This function does nothing if the #GimpSizeEntryUpdatePolicy specified in
|
||||
* gimp_size_entry_new() doesn't equal to GIMP_SIZE_ENTRY_UPDATE_SIZE.
|
||||
*
|
||||
*/
|
||||
void
|
||||
gimp_size_entry_set_size (GimpSizeEntry *gse,
|
||||
gint field,
|
||||
|
@ -480,8 +529,24 @@ gimp_size_entry_set_size (GimpSizeEntry *gse,
|
|||
}
|
||||
|
||||
|
||||
/* value stuff ***********/
|
||||
|
||||
/**
|
||||
* gimp_size_entry_set_value_boundaries:
|
||||
* @gse: The sizeentry you want to set value boundaries for.
|
||||
* @field: The index of the field you want to set value boundaries for.
|
||||
* @lower: The new lower boundary of the value of the chosen @field.
|
||||
* @upper: The new upper boundary of the value of the chosen @field.
|
||||
*
|
||||
* Limits the range of possible values which can be entered in field # @field
|
||||
* of the #GimpSizeEntry.
|
||||
*
|
||||
* The current value of the @field will be clamped to fit in the @field's
|
||||
* new boundaries.
|
||||
*
|
||||
* NOTE: In most cases you won't be interested in these values because the
|
||||
* #GimpSizeEntry's purpose is to shield the programmer from unit
|
||||
* calculations. Use gimp_size_entry_set_refval_boundaries() instead.
|
||||
*
|
||||
*/
|
||||
void
|
||||
gimp_size_entry_set_value_boundaries (GimpSizeEntry *gse,
|
||||
gint field,
|
||||
|
@ -513,12 +578,12 @@ gimp_size_entry_set_value_boundaries (GimpSizeEntry *gse,
|
|||
case GIMP_SIZE_ENTRY_UPDATE_SIZE:
|
||||
switch (gse->unit)
|
||||
{
|
||||
case UNIT_PIXEL:
|
||||
case GIMP_UNIT_PIXEL:
|
||||
gimp_size_entry_set_refval_boundaries (gse, field,
|
||||
gsef->min_value,
|
||||
gsef->max_value);
|
||||
break;
|
||||
case UNIT_PERCENT:
|
||||
case GIMP_UNIT_PERCENT:
|
||||
gimp_size_entry_set_refval_boundaries (gse, field,
|
||||
gsef->lower +
|
||||
(gsef->upper - gsef->lower) *
|
||||
|
@ -553,6 +618,24 @@ gimp_size_entry_set_value_boundaries (GimpSizeEntry *gse,
|
|||
gimp_size_entry_set_value (gse, field, gsef->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_size_entry_get_value;
|
||||
* @gse: The sizeentry you want to know a value of.
|
||||
* @field: The index of the filed you want to know the value of.
|
||||
*
|
||||
* Returns the value of field # @field of the #GimpSizeEntry.
|
||||
*
|
||||
* The @value returned is a distance or resolution
|
||||
* in the #GimpUnit the user has selected in the #GimpSizeEntry's
|
||||
* #GimpUnitMenu.
|
||||
*
|
||||
* NOTE: In most cases you won't be interested in this value because the
|
||||
* #GimpSizeEntry's purpose is to shield the programmer from unit
|
||||
* calculations. Use gimp_size_entry_get_refval() instead.
|
||||
*
|
||||
* Returns: The value of the chosen @field.
|
||||
*
|
||||
*/
|
||||
gdouble
|
||||
gimp_size_entry_get_value (GimpSizeEntry *gse,
|
||||
gint field)
|
||||
|
@ -584,10 +667,10 @@ gimp_size_entry_update_value (GimpSizeEntryField *gsef,
|
|||
case GIMP_SIZE_ENTRY_UPDATE_SIZE:
|
||||
switch (gsef->gse->unit)
|
||||
{
|
||||
case UNIT_PIXEL:
|
||||
case GIMP_UNIT_PIXEL:
|
||||
gsef->refval = value;
|
||||
break;
|
||||
case UNIT_PERCENT:
|
||||
case GIMP_UNIT_PERCENT:
|
||||
gsef->refval =
|
||||
CLAMP (gsef->lower + (gsef->upper - gsef->lower) * value / 100,
|
||||
gsef->min_refval, gsef->max_refval);
|
||||
|
@ -617,6 +700,23 @@ gimp_size_entry_update_value (GimpSizeEntryField *gsef,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_size_entry_set_value;
|
||||
* @gse: The sizeentry you want to set a value for.
|
||||
* @field: The index of the field you want to set a value for.
|
||||
* @value: The new value for @field.
|
||||
*
|
||||
* Sets the value for field # @field of the #GimpSizeEntry.
|
||||
*
|
||||
* The @value passed is treated to be a distance or resolution
|
||||
* in the #GimpUnit the user has selected in the #GimpSizeEntry's
|
||||
* #GimpUnitMenu.
|
||||
*
|
||||
* NOTE: In most cases you won't be interested in this value because the
|
||||
* #GimpSizeEntry's purpose is to shield the programmer from unit
|
||||
* calculations. Use gimp_size_entry_set_refval() instead.
|
||||
*
|
||||
*/
|
||||
void
|
||||
gimp_size_entry_set_value (GimpSizeEntry *gse,
|
||||
gint field,
|
||||
|
@ -658,8 +758,21 @@ gimp_size_entry_value_callback (GtkWidget *widget,
|
|||
}
|
||||
|
||||
|
||||
/* refval stuff ***********/
|
||||
|
||||
/**
|
||||
* gimp_size_entry_set_refval_boundaries:
|
||||
* @gse: The sizeentry you want to set the reference value boundaries for.
|
||||
* @field: The index of the field you want to set the reference value
|
||||
* boundaries for.
|
||||
* @lower: The new lower boundary of the reference value of the chosen @field.
|
||||
* @upper: The new upper boundary of the reference value of the chosen @field.
|
||||
*
|
||||
* Limits the range of possible reference values which can be entered in
|
||||
* field # @field of the #GimpSizeEntry.
|
||||
*
|
||||
* The current reference value of the @field will be clamped to fit in the
|
||||
* @field's new boundaries.
|
||||
*
|
||||
*/
|
||||
void
|
||||
gimp_size_entry_set_refval_boundaries (GimpSizeEntry *gse,
|
||||
gint field,
|
||||
|
@ -695,12 +808,12 @@ gimp_size_entry_set_refval_boundaries (GimpSizeEntry *gse,
|
|||
case GIMP_SIZE_ENTRY_UPDATE_SIZE:
|
||||
switch (gse->unit)
|
||||
{
|
||||
case UNIT_PIXEL:
|
||||
case GIMP_UNIT_PIXEL:
|
||||
gimp_size_entry_set_value_boundaries (gse, field,
|
||||
gsef->min_refval,
|
||||
gsef->max_refval);
|
||||
break;
|
||||
case UNIT_PERCENT:
|
||||
case GIMP_UNIT_PERCENT:
|
||||
gimp_size_entry_set_value_boundaries (gse, field,
|
||||
100 * (gsef->min_refval -
|
||||
gsef->lower) /
|
||||
|
@ -736,6 +849,21 @@ gimp_size_entry_set_refval_boundaries (GimpSizeEntry *gse,
|
|||
gimp_size_entry_set_refval (gse, field, gsef->refval);
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_size_entry_set_refval_digits:
|
||||
* @gse: The sizeentry you want to set the reference value digits for.
|
||||
* @field: The index of the field you want to set the reference value for.
|
||||
* @digits: The new number of decimal digits for the #GtkSpinButton which
|
||||
* displays @field's reference value.
|
||||
*
|
||||
* Sets the decimal digits of field # @field of the #GimpSizeEntry to
|
||||
* @digits.
|
||||
*
|
||||
* If you don't specify this value explicitly, the reference value's number
|
||||
* of digits will equal to 0 for GIMP_SIZE_ENTRY_UPDATE_SIZE and to 2 for
|
||||
* GIMP_SIZE_ENTRY_UPDATE_RESOLUTION.
|
||||
*
|
||||
*/
|
||||
void
|
||||
gimp_size_entry_set_refval_digits (GimpSizeEntry *gse,
|
||||
gint field,
|
||||
|
@ -756,12 +884,26 @@ gimp_size_entry_set_refval_digits (GimpSizeEntry *gse,
|
|||
if (gse->show_refval)
|
||||
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (gsef->refval_spinbutton),
|
||||
gsef->refval_digits);
|
||||
else if (gse->unit == UNIT_PIXEL)
|
||||
else if (gse->unit == GIMP_UNIT_PIXEL)
|
||||
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (gsef->value_spinbutton),
|
||||
gsef->refval_digits);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_size_entry_get_refval;
|
||||
* @gse: The sizeentry you want to know a reference value of.
|
||||
* @field: The index of the field you want to know the reference value of.
|
||||
*
|
||||
* Returns the reference value for field # @field of the #GimpSizeEntry.
|
||||
*
|
||||
* The reference value is either a distance in pixels or a resolution
|
||||
* in dpi, depending on which #GimpSizeEntryUpdatePolicy you chose in
|
||||
* gimp_size_entry_new().
|
||||
*
|
||||
* Returns: The reference value of the chosen @field.
|
||||
*
|
||||
*/
|
||||
gdouble
|
||||
gimp_size_entry_get_refval (GimpSizeEntry *gse,
|
||||
gint field)
|
||||
|
@ -794,10 +936,10 @@ gimp_size_entry_update_refval (GimpSizeEntryField *gsef,
|
|||
case GIMP_SIZE_ENTRY_UPDATE_SIZE:
|
||||
switch (gsef->gse->unit)
|
||||
{
|
||||
case UNIT_PIXEL:
|
||||
case GIMP_UNIT_PIXEL:
|
||||
gsef->value = refval;
|
||||
break;
|
||||
case UNIT_PERCENT:
|
||||
case GIMP_UNIT_PERCENT:
|
||||
gsef->value =
|
||||
CLAMP (100 * (refval - gsef->lower) / (gsef->upper - gsef->lower),
|
||||
gsef->min_value, gsef->max_value);
|
||||
|
@ -825,6 +967,19 @@ gimp_size_entry_update_refval (GimpSizeEntryField *gsef,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_size_entry_set_refval;
|
||||
* @gse: The sizeentry you want to set a reference value for.
|
||||
* @field: The index of the field you want to set the reference value for.
|
||||
* @refval: The new reference value for @field.
|
||||
*
|
||||
* Sets the reference value for field # @field of the #GimpSizeEntry.
|
||||
*
|
||||
* The @refval passed is either a distance in pixels or a resolution in dpi,
|
||||
* depending on which #GimpSizeEntryUpdatePolicy you chose in
|
||||
* gimp_size_entry_new().
|
||||
*
|
||||
*/
|
||||
void
|
||||
gimp_size_entry_set_refval (GimpSizeEntry *gse,
|
||||
gint field,
|
||||
|
@ -869,20 +1024,28 @@ gimp_size_entry_refval_callback (GtkWidget *widget,
|
|||
}
|
||||
|
||||
|
||||
/* unit stuff ***********/
|
||||
|
||||
GUnit
|
||||
/**
|
||||
* gimp_size_entry_get_unit:
|
||||
* @gse: The sizeentry you want to know the unit of.
|
||||
*
|
||||
* Returns the #GimpUnit the user has selected in the #GimpSizeEntry's
|
||||
* #GimpUnitMenu.
|
||||
*
|
||||
* Returns: The sizeentry's unit.
|
||||
*
|
||||
*/
|
||||
GimpUnit
|
||||
gimp_size_entry_get_unit (GimpSizeEntry *gse)
|
||||
{
|
||||
g_return_val_if_fail (gse != NULL, UNIT_INCH);
|
||||
g_return_val_if_fail (GIMP_IS_SIZE_ENTRY (gse), UNIT_INCH);
|
||||
g_return_val_if_fail (gse != NULL, GIMP_UNIT_INCH);
|
||||
g_return_val_if_fail (GIMP_IS_SIZE_ENTRY (gse), GIMP_UNIT_INCH);
|
||||
|
||||
return gse->unit;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_size_entry_update_unit (GimpSizeEntry *gse,
|
||||
GUnit unit)
|
||||
GimpUnit unit)
|
||||
{
|
||||
GimpSizeEntryField *gsef;
|
||||
gint i;
|
||||
|
@ -896,10 +1059,10 @@ gimp_size_entry_update_unit (GimpSizeEntry *gse,
|
|||
|
||||
if (gse->update_policy == GIMP_SIZE_ENTRY_UPDATE_SIZE)
|
||||
{
|
||||
if (unit == UNIT_PIXEL)
|
||||
if (unit == GIMP_UNIT_PIXEL)
|
||||
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (gsef->value_spinbutton),
|
||||
gsef->refval_digits);
|
||||
else if (unit == UNIT_PERCENT)
|
||||
else if (unit == GIMP_UNIT_PERCENT)
|
||||
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (gsef->value_spinbutton),
|
||||
2);
|
||||
else
|
||||
|
@ -909,7 +1072,7 @@ gimp_size_entry_update_unit (GimpSizeEntry *gse,
|
|||
else if (gse->update_policy == GIMP_SIZE_ENTRY_UPDATE_RESOLUTION)
|
||||
{
|
||||
digits =
|
||||
-(gimp_unit_get_digits (unit) - gimp_unit_get_digits (UNIT_INCH));
|
||||
-(gimp_unit_get_digits (unit) - gimp_unit_get_digits (GIMP_UNIT_INCH));
|
||||
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (gsef->value_spinbutton),
|
||||
MAX(3 + digits, 3));
|
||||
}
|
||||
|
@ -930,14 +1093,25 @@ gimp_size_entry_update_unit (GimpSizeEntry *gse,
|
|||
gimp_size_entry_signals[VALUE_CHANGED]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_size_entry_set_unit:
|
||||
* @gse: The sizeentry you want to change the unit for.
|
||||
* @unit: The new unit.
|
||||
*
|
||||
* Sets the #GimpSizeEntry's unit. The reference value for all fields will
|
||||
* stay the same but the value in units or pixels per unit will change
|
||||
* according to which #GimpSizeEntryUpdatePolicy you chose in
|
||||
* gimp_size_entry_new().
|
||||
*
|
||||
*/
|
||||
void
|
||||
gimp_size_entry_set_unit (GimpSizeEntry *gse,
|
||||
GUnit unit)
|
||||
GimpUnit unit)
|
||||
{
|
||||
g_return_if_fail (gse != NULL);
|
||||
g_return_if_fail (GIMP_IS_SIZE_ENTRY (gse));
|
||||
g_return_if_fail (gse->menu_show_pixels || (unit != UNIT_PIXEL));
|
||||
g_return_if_fail (gse->menu_show_percent || (unit != UNIT_PERCENT));
|
||||
g_return_if_fail (gse->menu_show_pixels || (unit != GIMP_UNIT_PIXEL));
|
||||
g_return_if_fail (gse->menu_show_percent || (unit != GIMP_UNIT_PERCENT));
|
||||
|
||||
gimp_unit_menu_set_unit (GIMP_UNIT_MENU (gse->unitmenu), unit);
|
||||
gimp_size_entry_update_unit (gse, unit);
|
||||
|
@ -953,7 +1127,14 @@ gimp_size_entry_unit_callback (GtkWidget *widget,
|
|||
gimp_size_entry_signals[UNIT_CHANGED]);
|
||||
}
|
||||
|
||||
/* focus stuff **********/
|
||||
/**
|
||||
* gimp_size_entry_grab_focus:
|
||||
* @gse: The sizeentry you want to grab the keyboard focus.
|
||||
*
|
||||
* This function is rather ugly and just a workaround for the fact that
|
||||
* it's impossible to implement gtk_widget_grab_focus() for a #GtkTable.
|
||||
*
|
||||
*/
|
||||
void
|
||||
gimp_size_entry_grab_focus (GimpSizeEntry *gse)
|
||||
{
|
||||
|
@ -967,25 +1148,3 @@ gimp_size_entry_grab_focus (GimpSizeEntry *gse)
|
|||
gtk_widget_grab_focus (gse->show_refval ?
|
||||
gsef->refval_spinbutton : gsef->value_spinbutton);
|
||||
}
|
||||
|
||||
/*
|
||||
static int
|
||||
gimp_size_entry_focus_in_callback (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_editable_select_region (GTK_EDITABLE (widget), 0, -1);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
gimp_size_entry_focus_out_callback (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_editable_select_region (GTK_EDITABLE (widget), 0, 0);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -41,24 +41,24 @@ typedef enum
|
|||
GIMP_SIZE_ENTRY_UPDATE_NONE = 0,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE = 1,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION = 2
|
||||
} GimpSizeEntryUP;
|
||||
} GimpSizeEntryUpdatePolicy;
|
||||
|
||||
typedef struct _GimpSizeEntryField GimpSizeEntryField;
|
||||
|
||||
struct _GimpSizeEntry
|
||||
{
|
||||
GtkTable table;
|
||||
GtkTable table;
|
||||
|
||||
GSList *fields;
|
||||
gint number_of_fields;
|
||||
GSList *fields;
|
||||
gint number_of_fields;
|
||||
|
||||
GtkWidget *unitmenu;
|
||||
GUnit unit;
|
||||
gboolean menu_show_pixels;
|
||||
gboolean menu_show_percent;
|
||||
GtkWidget *unitmenu;
|
||||
GimpUnit unit;
|
||||
gboolean menu_show_pixels;
|
||||
gboolean menu_show_percent;
|
||||
|
||||
gboolean show_refval;
|
||||
GimpSizeEntryUP update_policy;
|
||||
gboolean show_refval;
|
||||
GimpSizeEntryUpdatePolicy update_policy;
|
||||
};
|
||||
|
||||
struct _GimpSizeEntryClass
|
||||
|
@ -70,110 +70,50 @@ struct _GimpSizeEntryClass
|
|||
void (* unit_changed) (GimpSizeEntry *gse);
|
||||
};
|
||||
|
||||
GtkType gimp_size_entry_get_type (void);
|
||||
/* For information look into the C source or the html documentation */
|
||||
|
||||
/* creates a new GimpSizeEntry widget
|
||||
* number_of_fields -- how many spinbuttons to show
|
||||
* unit -- unit to show initially
|
||||
* unit_format -- printf-like unit-format (see GimpUnitMenu)
|
||||
* menu_show_pixels -- should the unit menu contain 'pixels'
|
||||
* this parameter is ignored if you select an update_policy
|
||||
* show_refval -- TRUE if you want the extra 'reference value' row
|
||||
* spinbutton_usize -- the minimal horizontal size the spinbuttons will have
|
||||
* update_policy -- how calculations should be performed
|
||||
* GIMP_SIZE_ENTRY_UPDATE_NONE --> no calculations
|
||||
* GIMP_SIZE_ENTRY_UPDATE_SIZE --> consider the values to
|
||||
* be distances. The reference value equals to pixels
|
||||
* GIMP_SIZE_ENTRY_UPDATE_RESOLUTION --> consider the values
|
||||
* to be resolutions. The reference value equals to dpi
|
||||
*
|
||||
* to have all automatic calculations performed correctly, set up the
|
||||
* widget in the following order:
|
||||
* 1. gimp_size_entry_new
|
||||
* 2. (for each additional input field) gimp_size_entry_add_field
|
||||
* 3. gimp_size_entry_set_unit
|
||||
* for each input field:
|
||||
* 4. gimp_size_entry_set_resolution
|
||||
* 5. gimp_size_entry_set_value_boundaries (or _set_refval_boundaries)
|
||||
* 6. gimp_size_entry_set_size
|
||||
* 7. gimp_size_entry_set_value (or _set_refval)
|
||||
*
|
||||
* the newly created GimpSizeEntry table will have an empty border
|
||||
* of one cell width on each side plus an empty column left of the
|
||||
* unit menu to allow the caller to add labels
|
||||
*/
|
||||
GtkWidget* gimp_size_entry_new (gint number_of_fields,
|
||||
GUnit unit,
|
||||
gchar *unit_format,
|
||||
gboolean menu_show_pixels,
|
||||
gboolean menu_show_percent,
|
||||
gboolean show_refval,
|
||||
gint spinbutton_usize,
|
||||
GimpSizeEntryUP update_policy);
|
||||
GtkType gimp_size_entry_get_type (void);
|
||||
|
||||
GtkWidget * gimp_size_entry_new (gint number_of_fields,
|
||||
GimpUnit unit,
|
||||
gchar *unit_format,
|
||||
gboolean menu_show_pixels,
|
||||
gboolean menu_show_percent,
|
||||
gboolean show_refval,
|
||||
gint spinbutton_usize,
|
||||
GimpSizeEntryUpdatePolicy update_policy);
|
||||
|
||||
/* add a field to the sizeentry
|
||||
* if show_refval if FALSE, then the refval pointers will be ignored
|
||||
*
|
||||
* the new field will have the index 0
|
||||
*/
|
||||
void gimp_size_entry_add_field (GimpSizeEntry *gse,
|
||||
GtkSpinButton *value_spinbutton,
|
||||
GtkSpinButton *refval_spinbutton);
|
||||
|
||||
/* this one is just a convenience function if you want to add labels
|
||||
* to the empty cells of the widget
|
||||
*/
|
||||
void gimp_size_entry_attach_label (GimpSizeEntry *gse,
|
||||
gchar *text,
|
||||
gint row,
|
||||
gint column,
|
||||
gfloat alignment);
|
||||
|
||||
/* this one sets the resolution (in dpi)
|
||||
*
|
||||
* does nothing if update_policy != GIMP_SIZE_ENTRY_UPDATE_SIZE
|
||||
*
|
||||
* keep_size is a boolean value. If TRUE, the size in pixels will stay
|
||||
* the same, otherwise the size in units will stay the same.
|
||||
*/
|
||||
void gimp_size_entry_set_resolution (GimpSizeEntry *gse,
|
||||
gint field,
|
||||
gdouble resolution,
|
||||
guint keep_size);
|
||||
gboolean keep_size);
|
||||
|
||||
/* this one sets the values (in pixels) which will be treated as
|
||||
* 0% and 100% when we want "percent" in the unit menu
|
||||
*
|
||||
* does nothing if update_policy != GIMP_SIZE_ENTRY_UPDATE_SIZE
|
||||
*/
|
||||
void gimp_size_entry_set_size (GimpSizeEntry *gse,
|
||||
gint field,
|
||||
gdouble lower,
|
||||
gdouble upper);
|
||||
|
||||
/* these functions set/return the value in the units the user selected
|
||||
* note that in some cases where the caller chooses not to have the
|
||||
* reference value row and the user selected the reference unit
|
||||
* the both values 'value' and 'refval' will be the same
|
||||
*/
|
||||
void gimp_size_entry_set_value_boundaries (GimpSizeEntry *gse,
|
||||
gint field,
|
||||
gdouble lower,
|
||||
gdouble upper);
|
||||
|
||||
gdouble gimp_size_entry_get_value (GimpSizeEntry *gse,
|
||||
gint field);
|
||||
void gimp_size_entry_set_value (GimpSizeEntry *gse,
|
||||
gint field,
|
||||
gdouble value);
|
||||
|
||||
/* these functions set/return the value in the 'reference unit' for the
|
||||
* current update policy
|
||||
* for GIMP_SIZE_ENTRY_UPDATE_SIZE it's the value in pixels
|
||||
* for GIMP_SIZE_ENTRY_UPDATE_RESOLUTION it's the resolution in dpi
|
||||
* for GIMP_SIZE_ENTRY_UPDATE_NONE it's up to the caller as he has to
|
||||
* provide a correct value<->refval
|
||||
* mapping
|
||||
*/
|
||||
void gimp_size_entry_set_refval_boundaries (GimpSizeEntry *gse,
|
||||
gint field,
|
||||
gdouble lower,
|
||||
|
@ -181,22 +121,17 @@ void gimp_size_entry_set_refval_boundaries (GimpSizeEntry *gse,
|
|||
void gimp_size_entry_set_refval_digits (GimpSizeEntry *gse,
|
||||
gint field,
|
||||
gint digits);
|
||||
|
||||
gdouble gimp_size_entry_get_refval (GimpSizeEntry *gse,
|
||||
gint field);
|
||||
void gimp_size_entry_set_refval (GimpSizeEntry *gse,
|
||||
gint field,
|
||||
gdouble refval);
|
||||
|
||||
/* these functions set/return the currently used unit
|
||||
* note that for GIMP_SIZE_ENTRY_UPDATE_SIZE a value of UNIT_PIXEL
|
||||
* will be silently ignored if we have the extra refvalue line
|
||||
*/
|
||||
GUnit gimp_size_entry_get_unit (GimpSizeEntry *gse);
|
||||
GimpUnit gimp_size_entry_get_unit (GimpSizeEntry *gse);
|
||||
void gimp_size_entry_set_unit (GimpSizeEntry *gse,
|
||||
GUnit unit);
|
||||
GimpUnit unit);
|
||||
|
||||
/* this makes the first spinbutton grab the focus
|
||||
*/
|
||||
void gimp_size_entry_grab_focus (GimpSizeEntry *gse);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -29,18 +29,19 @@
|
|||
|
||||
/* internal structures */
|
||||
|
||||
typedef struct {
|
||||
guint delete_on_exit;
|
||||
gdouble factor;
|
||||
gint digits;
|
||||
gchar *identifier;
|
||||
gchar *symbol;
|
||||
gchar *abbreviation;
|
||||
gchar *singular;
|
||||
gchar *plural;
|
||||
typedef struct
|
||||
{
|
||||
gboolean delete_on_exit;
|
||||
gdouble factor;
|
||||
gint digits;
|
||||
gchar *identifier;
|
||||
gchar *symbol;
|
||||
gchar *abbreviation;
|
||||
gchar *singular;
|
||||
gchar *plural;
|
||||
} GimpUnitDef;
|
||||
|
||||
static GimpUnitDef gimp_unit_defs[UNIT_END] =
|
||||
static GimpUnitDef gimp_unit_defs[GIMP_UNIT_END] =
|
||||
{
|
||||
/* pseudo unit */
|
||||
{ FALSE, 0.0, 0, "pixels", "px", "px", N_("pixel"), N_("pixels") },
|
||||
|
@ -61,21 +62,28 @@ static GimpUnitDef gimp_unit_percent =
|
|||
FALSE, 0.0, 0, "percent", "%", "%", N_("percent"), N_("percent")
|
||||
};
|
||||
|
||||
/* public functions */
|
||||
|
||||
/**
|
||||
* gimp_unit_get_number_of_units:
|
||||
*
|
||||
* Returns the number of units which are known to the #GimpUnit system.
|
||||
*
|
||||
* Returns: The number of defined units.
|
||||
*
|
||||
*/
|
||||
gint
|
||||
gimp_unit_get_number_of_units (void)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
gint nreturn_vals;
|
||||
|
||||
int number;
|
||||
gint number;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_unit_get_number_of_units",
|
||||
&nreturn_vals,
|
||||
PARAM_END);
|
||||
|
||||
number = UNIT_END;
|
||||
number = GIMP_UNIT_END;
|
||||
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
||||
number = return_vals[1].data.d_int32;
|
||||
|
||||
|
@ -84,14 +92,42 @@ gimp_unit_get_number_of_units (void)
|
|||
return number;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_unit_get_number_of_built_in_units:
|
||||
*
|
||||
* Returns the number of #GimpUnit's which are hardcoded in the unit system
|
||||
* (UNIT_INCH, UNIT_MM, UNIT_POINT, UNIT_PICA and the two "pseudo units"
|
||||
* UNIT_PIXEL and UNIT_PERCENT).
|
||||
*
|
||||
* Returns: The number of built-in units.
|
||||
*
|
||||
*/
|
||||
gint
|
||||
gimp_unit_get_number_of_built_in_units (void)
|
||||
{
|
||||
return UNIT_END;
|
||||
return GIMP_UNIT_END;
|
||||
}
|
||||
|
||||
|
||||
GUnit
|
||||
/**
|
||||
* gimp_unit_new:
|
||||
* @identifier: The unit's identifier string.
|
||||
* @factor: The unit's factor (how many units are in one inch).
|
||||
* @digits: The unit's suggested number of digits (see gimp_unit_get_digits()).
|
||||
* @symbol: The symbol of the unit (e.g. "''" for inch).
|
||||
* @abbreviation: The abbreviation of the unit.
|
||||
* @singular: The singular form of the unit.
|
||||
* @plural: The plural form of the unit.
|
||||
*
|
||||
* Returns the integer ID of the new #GimpUnit.
|
||||
*
|
||||
* Note that a new unit is always created with it's deletion flag
|
||||
* set to #TRUE. You will have to set it to #FALSE with
|
||||
* gimp_unit_set_deletion_flag() to make the unit definition persistent.
|
||||
*
|
||||
* Returns: The ID of the new unit.
|
||||
*
|
||||
*/
|
||||
GimpUnit
|
||||
gimp_unit_new (gchar *identifier,
|
||||
gdouble factor,
|
||||
gint digits,
|
||||
|
@ -101,22 +137,22 @@ gimp_unit_new (gchar *identifier,
|
|||
gchar *plural)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
gint nreturn_vals;
|
||||
|
||||
GUnit unit;
|
||||
GimpUnit unit;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_unit_new",
|
||||
&nreturn_vals,
|
||||
PARAM_STRING, g_strdup (identifier),
|
||||
PARAM_FLOAT, factor,
|
||||
PARAM_INT32, digits,
|
||||
PARAM_FLOAT, factor,
|
||||
PARAM_INT32, digits,
|
||||
PARAM_STRING, g_strdup (symbol),
|
||||
PARAM_STRING, g_strdup (abbreviation),
|
||||
PARAM_STRING, g_strdup (singular),
|
||||
PARAM_STRING, g_strdup (plural),
|
||||
PARAM_END);
|
||||
|
||||
unit = UNIT_INCH;
|
||||
unit = GIMP_UNIT_INCH;
|
||||
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
||||
unit = return_vals[1].data.d_int32;
|
||||
|
||||
|
@ -125,18 +161,24 @@ gimp_unit_new (gchar *identifier,
|
|||
return unit;
|
||||
}
|
||||
|
||||
|
||||
guint
|
||||
gimp_unit_get_deletion_flag (GUnit unit)
|
||||
/**
|
||||
* gimp_unit_get_deletion_flag:
|
||||
* @unit: The unit you want to know the @deletion_flag of.
|
||||
*
|
||||
* Returns: The unit's @deletion_flag.
|
||||
*
|
||||
*/
|
||||
gboolean
|
||||
gimp_unit_get_deletion_flag (GimpUnit unit)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
gint nreturn_vals;
|
||||
|
||||
guint flag;
|
||||
gboolean flag;
|
||||
|
||||
g_return_val_if_fail (unit >= UNIT_PIXEL, TRUE);
|
||||
g_return_val_if_fail (unit >= GIMP_UNIT_PIXEL, TRUE);
|
||||
|
||||
if (unit < UNIT_END)
|
||||
if (unit < GIMP_UNIT_END)
|
||||
return FALSE;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_unit_get_deletion_flag",
|
||||
|
@ -146,23 +188,36 @@ gimp_unit_get_deletion_flag (GUnit unit)
|
|||
|
||||
flag = TRUE;
|
||||
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
||||
flag = return_vals[1].data.d_int32;
|
||||
flag = return_vals[1].data.d_int32 ? TRUE : FALSE;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_unit_set_deletion_flag:
|
||||
* @unit: The unit you want to set the @deletion_flag for.
|
||||
* @deletion_flag: The new deletion_flag.
|
||||
*
|
||||
* Sets a #GimpUnit's @deletion_flag. If the @deletion_flag of a unit is
|
||||
* #TRUE when GIMP exits, this unit will not be saved in the uses's
|
||||
* "unitrc" file.
|
||||
*
|
||||
* Trying to change the @deletion_flag of a built-in unit will be silently
|
||||
* ignored.
|
||||
*
|
||||
*/
|
||||
void
|
||||
gimp_unit_set_deletion_flag (GUnit unit,
|
||||
guint deletion_flag)
|
||||
gimp_unit_set_deletion_flag (GimpUnit unit,
|
||||
gboolean deletion_flag)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
gint nreturn_vals;
|
||||
|
||||
g_return_if_fail (unit >= UNIT_PIXEL);
|
||||
g_return_if_fail (unit >= GIMP_UNIT_PIXEL);
|
||||
|
||||
if (unit < UNIT_END)
|
||||
if (unit < GIMP_UNIT_END)
|
||||
return;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_unit_set_deletion_flag",
|
||||
|
@ -174,18 +229,30 @@ gimp_unit_set_deletion_flag (GUnit unit,
|
|||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gimp_unit_get_factor:
|
||||
* @unit: The unit you want to know the factor of.
|
||||
*
|
||||
* A #GimpUnit's @factor is defined to be:
|
||||
*
|
||||
* distance_in_units == (@factor * distance_in_inches)
|
||||
*
|
||||
* Returns 0 for @unit == GIMP_UNIT_PIXEL.
|
||||
*
|
||||
* Returns: The unit's factor.
|
||||
*
|
||||
*/
|
||||
gdouble
|
||||
gimp_unit_get_factor (GUnit unit)
|
||||
gimp_unit_get_factor (GimpUnit unit)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
gint nreturn_vals;
|
||||
|
||||
gdouble factor;
|
||||
|
||||
g_return_val_if_fail (unit >= UNIT_INCH, 1.0);
|
||||
g_return_val_if_fail (unit >= GIMP_UNIT_INCH, 1.0);
|
||||
|
||||
if (unit < UNIT_END)
|
||||
if (unit < GIMP_UNIT_END)
|
||||
return gimp_unit_defs[unit].factor;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_unit_get_factor",
|
||||
|
@ -202,19 +269,30 @@ gimp_unit_get_factor (GUnit unit)
|
|||
return factor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gimp_unit_get_digits:
|
||||
* @unit: The unit you want to know the digits.
|
||||
*
|
||||
* Returns the number of digits an entry field should provide to get
|
||||
* approximately the same accuracy as an inch input field with two digits.
|
||||
*
|
||||
* Returns 0 for @unit == GIMP_UNIT_PIXEL.
|
||||
*
|
||||
* Returns: The suggested number of digits.
|
||||
*
|
||||
*/
|
||||
gint
|
||||
gimp_unit_get_digits (GUnit unit)
|
||||
gimp_unit_get_digits (GimpUnit unit)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
gint nreturn_vals;
|
||||
|
||||
gint digits;
|
||||
|
||||
if (unit < 0)
|
||||
return 0;
|
||||
|
||||
if (unit < UNIT_END)
|
||||
if (unit < GIMP_UNIT_END)
|
||||
return gimp_unit_defs[unit].digits;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_unit_get_digits",
|
||||
|
@ -222,7 +300,7 @@ gimp_unit_get_digits (GUnit unit)
|
|||
PARAM_INT32, unit,
|
||||
PARAM_END);
|
||||
|
||||
digits = gimp_unit_defs[UNIT_INCH].digits;
|
||||
digits = gimp_unit_defs[GIMP_UNIT_INCH].digits;
|
||||
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
||||
digits = return_vals[1].data.d_int32;
|
||||
|
||||
|
@ -231,21 +309,32 @@ gimp_unit_get_digits (GUnit unit)
|
|||
return digits;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gimp_unit_get_identifier:
|
||||
* @unit: The unit you want to know the identifier of.
|
||||
*
|
||||
* This is an unstranslated string.
|
||||
*
|
||||
* NOTE: This string has to be g_free()'d by plugins but is a pointer to a
|
||||
* constant string when this function is used from inside the GIMP.
|
||||
*
|
||||
* Returns: The unit's identifier.
|
||||
*
|
||||
*/
|
||||
gchar *
|
||||
gimp_unit_get_identifier (GUnit unit)
|
||||
gimp_unit_get_identifier (GimpUnit unit)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
gint nreturn_vals;
|
||||
|
||||
gchar *identifier;
|
||||
|
||||
g_return_val_if_fail (unit >= UNIT_PIXEL, g_strdup (""));
|
||||
g_return_val_if_fail (unit >= GIMP_UNIT_PIXEL, g_strdup (""));
|
||||
|
||||
if (unit < UNIT_END)
|
||||
if (unit < GIMP_UNIT_END)
|
||||
return g_strdup (gimp_unit_defs[unit].identifier);
|
||||
|
||||
if (unit == UNIT_PERCENT)
|
||||
if (unit == GIMP_UNIT_PERCENT)
|
||||
return g_strdup (gimp_unit_percent.identifier);
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_unit_get_identifier",
|
||||
|
@ -262,21 +351,32 @@ gimp_unit_get_identifier (GUnit unit)
|
|||
return identifier ? identifier : g_strdup ("");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gimp_unit_get_symbol:
|
||||
* @unit: The unit you want to know the symbol of.
|
||||
*
|
||||
* This is e.g. "''" for UNIT_INCH.
|
||||
*
|
||||
* NOTE: This string has to be g_free()'d by plugins but is a pointer to a
|
||||
* constant string when this function is used from inside the GIMP.
|
||||
*
|
||||
* Returns: The unit's symbol.
|
||||
*
|
||||
*/
|
||||
gchar *
|
||||
gimp_unit_get_symbol (GUnit unit)
|
||||
gimp_unit_get_symbol (GimpUnit unit)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
gint nreturn_vals;
|
||||
|
||||
gchar *symbol;
|
||||
|
||||
g_return_val_if_fail (unit >= UNIT_PIXEL, g_strdup (""));
|
||||
g_return_val_if_fail (unit >= GIMP_UNIT_PIXEL, g_strdup (""));
|
||||
|
||||
if (unit < UNIT_END)
|
||||
if (unit < GIMP_UNIT_END)
|
||||
return g_strdup (gimp_unit_defs[unit].symbol);
|
||||
|
||||
if (unit == UNIT_PERCENT)
|
||||
if (unit == GIMP_UNIT_PERCENT)
|
||||
return g_strdup (gimp_unit_percent.symbol);
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_unit_get_symbol",
|
||||
|
@ -294,20 +394,33 @@ gimp_unit_get_symbol (GUnit unit)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* gimp_unit_get_abbreviation:
|
||||
* @unit: The unit you want to know the abbreviation of.
|
||||
*
|
||||
* For built-in units, this function returns the translated abbreviation
|
||||
* of the unit.
|
||||
*
|
||||
* NOTE: This string has to be g_free()'d by plugins but is a pointer to a
|
||||
* constant string when this function is used from inside the GIMP.
|
||||
*
|
||||
* Returns: The unit's abbreviation.
|
||||
*
|
||||
*/
|
||||
gchar *
|
||||
gimp_unit_get_abbreviation (GUnit unit)
|
||||
gimp_unit_get_abbreviation (GimpUnit unit)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
gint nreturn_vals;
|
||||
|
||||
gchar *abbreviation;
|
||||
|
||||
g_return_val_if_fail (unit >= UNIT_PIXEL, g_strdup (""));
|
||||
g_return_val_if_fail (unit >= GIMP_UNIT_PIXEL, g_strdup (""));
|
||||
|
||||
if (unit < UNIT_END)
|
||||
if (unit < GIMP_UNIT_END)
|
||||
return g_strdup (gimp_unit_defs[unit].abbreviation);
|
||||
|
||||
if (unit == UNIT_PERCENT)
|
||||
if (unit == GIMP_UNIT_PERCENT)
|
||||
return g_strdup (gimp_unit_percent.abbreviation);
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_unit_get_abbreviation",
|
||||
|
@ -325,20 +438,33 @@ gimp_unit_get_abbreviation (GUnit unit)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* gimp_unit_get_singular:
|
||||
* @unit: The unit you want to know the singular form of.
|
||||
*
|
||||
* For built-in units, this function returns the translated singular form
|
||||
* of the unit's name.
|
||||
*
|
||||
* NOTE: This string has to be g_free()'d by plugins but is a pointer to a
|
||||
* constant string when this function is used from inside the GIMP.
|
||||
*
|
||||
* Returns: The unit's singular form.
|
||||
*
|
||||
*/
|
||||
gchar *
|
||||
gimp_unit_get_singular (GUnit unit)
|
||||
gimp_unit_get_singular (GimpUnit unit)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
gint nreturn_vals;
|
||||
|
||||
gchar *singular;
|
||||
|
||||
g_return_val_if_fail (unit >= UNIT_PIXEL, g_strdup (""));
|
||||
g_return_val_if_fail (unit >= GIMP_UNIT_PIXEL, g_strdup (""));
|
||||
|
||||
if (unit < UNIT_END)
|
||||
if (unit < GIMP_UNIT_END)
|
||||
return g_strdup (gettext (gimp_unit_defs[unit].singular));
|
||||
|
||||
if (unit == UNIT_PERCENT)
|
||||
if (unit == GIMP_UNIT_PERCENT)
|
||||
return g_strdup (gettext (gimp_unit_percent.singular));
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_unit_get_singular",
|
||||
|
@ -355,21 +481,33 @@ gimp_unit_get_singular (GUnit unit)
|
|||
return singular ? singular : g_strdup ("");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gimp_unit_get_plural:
|
||||
* @unit: The unit you want to know the plural form of.
|
||||
*
|
||||
* For built-in units, this function returns the translated plural form
|
||||
* of the unit's name.
|
||||
*
|
||||
* NOTE: This string has to be g_free()'d by plugins but is a pointer to a
|
||||
* constant string when this function is used from inside the GIMP.
|
||||
*
|
||||
* Returns: The unit's plural form.
|
||||
*
|
||||
*/
|
||||
gchar *
|
||||
gimp_unit_get_plural (GUnit unit)
|
||||
gimp_unit_get_plural (GimpUnit unit)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
gint nreturn_vals;
|
||||
|
||||
gchar *plural;
|
||||
|
||||
g_return_val_if_fail (unit >= UNIT_PIXEL, g_strdup (""));
|
||||
g_return_val_if_fail (unit >= GIMP_UNIT_PIXEL, g_strdup (""));
|
||||
|
||||
if (unit < UNIT_END)
|
||||
if (unit < GIMP_UNIT_END)
|
||||
return g_strdup (gettext (gimp_unit_defs[unit].plural));
|
||||
|
||||
if (unit == UNIT_PERCENT)
|
||||
if (unit == GIMP_UNIT_PERCENT)
|
||||
return g_strdup (gettext (gimp_unit_percent.plural));
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_unit_get_plural",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||
*
|
||||
* gimpunit.h
|
||||
* Copyright (C) 1999 Michael Natterer <mitschel@cs.tu-berlin.de>
|
||||
* Copyright (C) 1999 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -38,84 +38,45 @@ extern "C" {
|
|||
|
||||
typedef enum
|
||||
{
|
||||
UNIT_PIXEL = 0,
|
||||
UNIT_INCH = 1,
|
||||
UNIT_MM = 2,
|
||||
UNIT_POINT = 3,
|
||||
UNIT_PICA = 4,
|
||||
UNIT_END = 5, /* never use UNIT_END but
|
||||
* gimp_unit_get_number_of_units() instead
|
||||
*/
|
||||
GIMP_UNIT_PIXEL = 0,
|
||||
|
||||
UNIT_PERCENT = 65536 /* this one does not really belong here but it's
|
||||
* convenient to use the unit system for the
|
||||
* various strings (symbol, singular, ...)
|
||||
*
|
||||
* you can only ask it for it's strings, asking for
|
||||
* factor, digits or deletion_flag will produce
|
||||
* an error.
|
||||
*/
|
||||
} GUnit;
|
||||
GIMP_UNIT_INCH = 1,
|
||||
GIMP_UNIT_MM = 2,
|
||||
GIMP_UNIT_POINT = 3,
|
||||
GIMP_UNIT_PICA = 4,
|
||||
|
||||
GIMP_UNIT_END = 5,
|
||||
|
||||
gint gimp_unit_get_number_of_units (void);
|
||||
gint gimp_unit_get_number_of_built_in_units (void);
|
||||
GIMP_UNIT_PERCENT = 65536
|
||||
} GimpUnit;
|
||||
|
||||
/* Create a new user unit and returns it's ID.
|
||||
*
|
||||
* Note that a new unit is always created with it's deletion flag
|
||||
* set to TRUE. You will have to set it to FALSE after creation to make
|
||||
* the unit definition persistant.
|
||||
*/
|
||||
GUnit gimp_unit_new (gchar *identifier,
|
||||
gdouble factor,
|
||||
gint digits,
|
||||
gchar *symbol,
|
||||
gchar *abbreviation,
|
||||
gchar *singular,
|
||||
gchar *plural);
|
||||
/* For information look into the C source or the html documentation */
|
||||
|
||||
/* The following functions fall back to inch (not pixel, as pixel is not
|
||||
* a 'real' unit) if the value passed is out of range.
|
||||
*
|
||||
* Trying to change the deletion flag of built-in units will be ignored.
|
||||
*/
|
||||
gint gimp_unit_get_number_of_units (void);
|
||||
gint gimp_unit_get_number_of_built_in_units (void);
|
||||
|
||||
/* If the deletion flag for a unit is TRUE on GIMP exit, this unit
|
||||
* will not be saved in the user units database.
|
||||
*/
|
||||
guint gimp_unit_get_deletion_flag (GUnit unit);
|
||||
void gimp_unit_set_deletion_flag (GUnit unit,
|
||||
guint deletion_flag);
|
||||
GimpUnit gimp_unit_new (gchar *identifier,
|
||||
gdouble factor,
|
||||
gint digits,
|
||||
gchar *symbol,
|
||||
gchar *abbreviation,
|
||||
gchar *singular,
|
||||
gchar *plural);
|
||||
|
||||
/* The meaning of 'factor' is:
|
||||
* distance_in_units == ( factor * distance_in_inches )
|
||||
*
|
||||
* Returns 0 for unit == UNIT_PIXEL as we don't have resolution info here
|
||||
*/
|
||||
gdouble gimp_unit_get_factor (GUnit unit);
|
||||
gboolean gimp_unit_get_deletion_flag (GimpUnit unit);
|
||||
void gimp_unit_set_deletion_flag (GimpUnit unit,
|
||||
gboolean deletion_flag);
|
||||
|
||||
/* The following function gives a hint how many digits a spinbutton
|
||||
* should provide to get approximately the accuracy of an inch-spinbutton
|
||||
* with two digits.
|
||||
*
|
||||
* Returns 0 for unit == UNIT_PIXEL as we don't have resolution info here.
|
||||
*/
|
||||
gint gimp_unit_get_digits (GUnit unit);
|
||||
gdouble gimp_unit_get_factor (GimpUnit unit);
|
||||
|
||||
/* NOTE:
|
||||
*
|
||||
* the gchar pointer returned is constant in the gimp application but must
|
||||
* be g_free()'d by plug-ins.
|
||||
*/
|
||||
gint gimp_unit_get_digits (GimpUnit unit);
|
||||
|
||||
/* This one is an untranslated string for gimprc */
|
||||
gchar * gimp_unit_get_identifier (GUnit unit);
|
||||
gchar * gimp_unit_get_identifier (GimpUnit unit);
|
||||
|
||||
gchar * gimp_unit_get_symbol (GUnit unit);
|
||||
gchar * gimp_unit_get_abbreviation (GUnit unit);
|
||||
gchar * gimp_unit_get_singular (GUnit unit);
|
||||
gchar * gimp_unit_get_plural (GUnit unit);
|
||||
gchar * gimp_unit_get_symbol (GimpUnit unit);
|
||||
gchar * gimp_unit_get_abbreviation (GimpUnit unit);
|
||||
gchar * gimp_unit_get_singular (GimpUnit unit);
|
||||
gchar * gimp_unit_get_plural (GimpUnit unit);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue