2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2003-11-16 06:53:28 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2003-11-16 06:53:28 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2003-11-16 06:53:28 +08:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2003-11-16 06:53:28 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <glib-object.h>
|
|
|
|
|
|
|
|
#include "libgimpbase/gimpbase.h"
|
|
|
|
#include "libgimpbase/gimpbase-private.h"
|
|
|
|
|
|
|
|
#include "core/core-types.h"
|
|
|
|
|
|
|
|
#include "core/gimp.h"
|
|
|
|
#include "core/gimpunit.h"
|
|
|
|
|
|
|
|
#include "units.h"
|
|
|
|
|
|
|
|
|
|
|
|
static Gimp *the_unit_gimp = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
static gint
|
|
|
|
units_get_number_of_units (void)
|
|
|
|
{
|
|
|
|
return _gimp_unit_get_number_of_units (the_unit_gimp);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
units_get_number_of_built_in_units (void)
|
|
|
|
{
|
|
|
|
return GIMP_UNIT_END;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GimpUnit
|
|
|
|
units_unit_new (gchar *identifier,
|
2006-04-11 20:54:09 +08:00
|
|
|
gdouble factor,
|
|
|
|
gint digits,
|
|
|
|
gchar *symbol,
|
|
|
|
gchar *abbreviation,
|
|
|
|
gchar *singular,
|
|
|
|
gchar *plural)
|
2003-11-16 06:53:28 +08:00
|
|
|
{
|
|
|
|
return _gimp_unit_new (the_unit_gimp,
|
2006-04-11 20:54:09 +08:00
|
|
|
identifier,
|
|
|
|
factor,
|
|
|
|
digits,
|
|
|
|
symbol,
|
|
|
|
abbreviation,
|
|
|
|
singular,
|
|
|
|
plural);
|
2003-11-16 06:53:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
units_unit_get_deletion_flag (GimpUnit unit)
|
|
|
|
{
|
|
|
|
return _gimp_unit_get_deletion_flag (the_unit_gimp, unit);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
units_unit_set_deletion_flag (GimpUnit unit,
|
2005-01-13 21:08:00 +08:00
|
|
|
gboolean deletion_flag)
|
2003-11-16 06:53:28 +08:00
|
|
|
{
|
|
|
|
_gimp_unit_set_deletion_flag (the_unit_gimp, unit, deletion_flag);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gdouble
|
|
|
|
units_unit_get_factor (GimpUnit unit)
|
|
|
|
{
|
|
|
|
return _gimp_unit_get_factor (the_unit_gimp, unit);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
units_unit_get_digits (GimpUnit unit)
|
|
|
|
{
|
|
|
|
return _gimp_unit_get_digits (the_unit_gimp, unit);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const gchar *
|
|
|
|
units_unit_get_identifier (GimpUnit unit)
|
|
|
|
{
|
|
|
|
return _gimp_unit_get_identifier (the_unit_gimp, unit);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const gchar *
|
|
|
|
units_unit_get_symbol (GimpUnit unit)
|
|
|
|
{
|
|
|
|
return _gimp_unit_get_symbol (the_unit_gimp, unit);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const gchar *
|
|
|
|
units_unit_get_abbreviation (GimpUnit unit)
|
|
|
|
{
|
|
|
|
return _gimp_unit_get_abbreviation (the_unit_gimp, unit);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const gchar *
|
|
|
|
units_unit_get_singular (GimpUnit unit)
|
|
|
|
{
|
|
|
|
return _gimp_unit_get_singular (the_unit_gimp, unit);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const gchar *
|
|
|
|
units_unit_get_plural (GimpUnit unit)
|
|
|
|
{
|
|
|
|
return _gimp_unit_get_plural (the_unit_gimp, unit);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
units_init (Gimp *gimp)
|
|
|
|
{
|
2005-09-10 20:21:37 +08:00
|
|
|
GimpUnitVtable vtable;
|
2003-11-16 06:53:28 +08:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
|
|
|
g_return_if_fail (the_unit_gimp == NULL);
|
|
|
|
|
|
|
|
the_unit_gimp = gimp;
|
|
|
|
|
|
|
|
vtable.unit_get_number_of_units = units_get_number_of_units;
|
|
|
|
vtable.unit_get_number_of_built_in_units = units_get_number_of_built_in_units;
|
2005-01-13 21:08:00 +08:00
|
|
|
vtable.unit_new = units_unit_new;
|
|
|
|
vtable.unit_get_deletion_flag = units_unit_get_deletion_flag;
|
|
|
|
vtable.unit_set_deletion_flag = units_unit_set_deletion_flag;
|
|
|
|
vtable.unit_get_factor = units_unit_get_factor;
|
|
|
|
vtable.unit_get_digits = units_unit_get_digits;
|
|
|
|
vtable.unit_get_identifier = units_unit_get_identifier;
|
|
|
|
vtable.unit_get_symbol = units_unit_get_symbol;
|
|
|
|
vtable.unit_get_abbreviation = units_unit_get_abbreviation;
|
|
|
|
vtable.unit_get_singular = units_unit_get_singular;
|
|
|
|
vtable.unit_get_plural = units_unit_get_plural;
|
2003-11-16 06:53:28 +08:00
|
|
|
|
|
|
|
gimp_base_init (&vtable);
|
|
|
|
}
|