Files
gimp/libgimpbase/gimpunit.h
Michael Natterer 5e8ee554a2 This implements the rest of the unit system (unitrc loading and saving and
1999-03-16  Michael Natterer  <mitschel@cs.tu-berlin.de>

        This implements the rest of the unit system (unitrc loading and
        saving and full PDB interface)

        * Makefile.am
        * gimp.1
        * user_install
        * user_install.bat
        * unitrc: new file (default unit database) and some documentation

        * app/Makefile.am
        * app/gimpunit.c
        * app/gimpunit_cmds.h
        * app/unitrc.h: new files enabling the unit database and PDB
        access to the unit system

        * app/app_procs.c: parse and save unitrc
        * app/gimprc.[ch]: enable unit parsing. New function
        init_parse_buffers() to enable unitrc to be loaded before gimprc

        * app/gimage_cmds.[ch]: new PDB procedures which set/return an
        image's unit

        * app/install.c: mention unitrc installation

        * app/xcf.c: new xcf property for user defined units. An image's
        unit is saved as either an integer ID (built in units) or as
        a full unit definition without any ID

        * libgimp/Makefile.am: moved gimpunit.o from libgimpi.a to
        libgimp.a

        * libgimp/gimp.h
        * libgimp/gimpimage.c: get/set an image's unit with PDB calls

        * libgimp/gimpunit.h: this file is now the header for both
        app/gimpunit.c and libgimp/gimpunit.c

        * libgimp/gimpunit.c: does the unit calls as PDB calls now

        * libgimp/gimpunitmenu.[ch]: enable user unit functionality and a
        unit selection dialog

        * libgimp/gimpsizeentry.c: disble hilighting on focus_in_event and
        minor bugfixes

        * plug-ins/tiff/tiff.c: set image unit to "mm" if tiff unit is
        "cm", save "cm" if image unit is metric
1999-03-16 20:14:07 +00:00

116 lines
3.5 KiB
C

/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* gimpunit.h
* Copyright (C) 1999 Michael Natterer <mitschel@cs.tu-berlin.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* NOTE:
*
* This file serves as header for both app/gimpunit.c and libgimp/gimpunit.c
* because the unit functions are needed by widgets which are used by both
* the gimp app and plugins.
*/
#ifndef __GIMPUNIT_H__
#define __GIMPUNIT_H__
#include <glib.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
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 */
} GUnit;
gint gimp_unit_get_number_of_units (void);
gint gimp_unit_get_number_of_built_in_units (void);
/* 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,
gfloat factor,
gint digits,
gchar *symbol,
gchar *abbreviation,
gchar *singular,
gchar *plural);
/* 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.
*/
/* 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);
/* 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
*/
gfloat gimp_unit_get_factor (GUnit unit);
/* 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);
/* NOTE:
*
* the gchar pointer returned is constant in the gimp application but must
* be g_free()'d by plug-ins.
*/
/* This one is an untranslated string for gimprc */
gchar * gimp_unit_get_identifier (GUnit 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);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __GIMPUNIT_H__ */