gimpunit

Name

gimpunit -- Provides a collection of predefined units and functions for creating user-defined units.

Synopsis



gint        gimp_unit_get_number_of_units   (void);
gint        gimp_unit_get_number_of_built_in_units
                                            (void);
GimpUnit    gimp_unit_new                   (gchar *identifier,
                                             gdouble factor,
                                             gint digits,
                                             gchar *symbol,
                                             gchar *abbreviation,
                                             gchar *singular,
                                             gchar *plural);
gboolean    gimp_unit_get_deletion_flag     (GimpUnit unit);
void        gimp_unit_set_deletion_flag     (GimpUnit unit,
                                             gboolean deletion_flag);
gdouble     gimp_unit_get_factor            (GimpUnit unit);
gint        gimp_unit_get_digits            (GimpUnit unit);
const gchar* gimp_unit_get_identifier       (GimpUnit unit);
const gchar* gimp_unit_get_symbol           (GimpUnit unit);
const gchar* gimp_unit_get_abbreviation     (GimpUnit unit);
const gchar* gimp_unit_get_singular         (GimpUnit unit);
const gchar* gimp_unit_get_plural           (GimpUnit unit);

Description

Provides a collection of predefined units and functions for creating user-defined units.

Details

gimp_unit_get_number_of_units ()

gint        gimp_unit_get_number_of_units   (void);

Returns the number of units which are known to the GimpUnit system.


gimp_unit_get_number_of_built_in_units ()

gint        gimp_unit_get_number_of_built_in_units
                                            (void);

Returns the number of GimpUnit's which are hardcoded in the unit system (UNIT_INCH, UNIT_MM, UNIT_POINT, UNIT_PICA and the "pseudo unit" UNIT_PIXEL).


gimp_unit_new ()

GimpUnit    gimp_unit_new                   (gchar *identifier,
                                             gdouble factor,
                                             gint digits,
                                             gchar *symbol,
                                             gchar *abbreviation,
                                             gchar *singular,
                                             gchar *plural);

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.


gimp_unit_get_deletion_flag ()

gboolean    gimp_unit_get_deletion_flag     (GimpUnit unit);


gimp_unit_set_deletion_flag ()

void        gimp_unit_set_deletion_flag     (GimpUnit unit,
                                             gboolean 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.


gimp_unit_get_factor ()

gdouble     gimp_unit_get_factor            (GimpUnit unit);

A GimpUnit's factor is defined to be:

distance_in_units == (factor * distance_in_inches)

Returns 0 for unit == GIMP_UNIT_PIXEL.


gimp_unit_get_digits ()

gint        gimp_unit_get_digits            (GimpUnit unit);

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.


gimp_unit_get_identifier ()

const gchar* gimp_unit_get_identifier       (GimpUnit unit);

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.


gimp_unit_get_symbol ()

const gchar* gimp_unit_get_symbol           (GimpUnit unit);

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.


gimp_unit_get_abbreviation ()

const gchar* gimp_unit_get_abbreviation     (GimpUnit unit);

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.


gimp_unit_get_singular ()

const gchar* gimp_unit_get_singular         (GimpUnit unit);

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.


gimp_unit_get_plural ()

const gchar* gimp_unit_get_plural           (GimpUnit unit);

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.

See Also

GimpUnitMenu

GimpSizeEntry