mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 09:23:24 +00:00

2000-05-31 Michael Natterer <mitch@gimp.org> Sven Neumann <sven@gimp.org> Episode IV... * app/Makefile.am * app/message_cmds.c: new name * app/interface_cmds.c: removed * app/help_cmds.c: new name * app/gimphelp_cmds.c: removed * app/internal_procs.c * app/gimphelp_cmds.c * app/plug_in_cmds.c: moved gimp_plugin_help_register to plug_in_cmds.c, s/gimp_plugin_domain_add/gimp_plugin_domain_register/ * libgimp/Makefile.am * libgimp/gimp_pdb.h * libgimp/gimpfileops_pdb.[ch] * libgimp/gimpguides_pdb.[ch] * libgimp/gimpmessage_pdb.[ch] * libgimp/gimpprocedural_db_pdb.[ch] * libgimp/gimpplugin_pdb.[ch]: new files containing PDB wrappers moved out of libgimp/gimp.[ch] * libgimp/gimpchannel_pdb.c * libgimp/gimpdisplay_pdb.[ch] * libgimp/gimpdrawable_pdb.[ch] * libgimp/gimphelp_pdb.[ch] * libgimp/gimpimage_pdb.[ch] * libgimp/gimplayer_pdb.c * libgimp/gimpparasite_pdb.c * libgimp/gimpselection_pdb.c: various changes. * libgimp/gimpunit.c: new file * libgimp/gimpunit_pdb.[ch]: contains only PDB wrappers prefixed with "_" which are called from libgimp/gimpunit.c only. * libgimp/gimpunit.h: minor stuff * libgimp/gimpcompat.h: declared the following functions obsolete: gimp_query_database gimp_query_images * libgimp/gimp.[ch]: removed all PDB wrappers. * tools/pdbgen/Makefile.am * tools/pdbgen/groups.pl: changed * tools/pdbgen/lib.pl: tried to fix libgimp autogeneration and fixed just a few comments. * tools/pdbgen/pdb/interface.pdb * tools/pdbgen/pdb/gimphelp.pdb: removed * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/message.pdb: new names * plug-ins/script-fu/script-fu.c * plug-ins/perl/Gimp/Lib.xs: s/gimp_plugin_domain_add/gimp_plugin_domain_register/ 2000-05-31 Michael Natterer <mitch@gimp.org> * POTFILES.in: s/gimpunit_pdb/gimpunit/
297 lines
6.6 KiB
C
297 lines
6.6 KiB
C
/* LIBGIMP - The GIMP Library
|
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
|
*
|
|
* gimpunit_pdb.c
|
|
* Copyright (C) 1999-2000 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
|
|
* 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 Lesser 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.
|
|
*/
|
|
|
|
#include "gimp.h"
|
|
|
|
|
|
gint
|
|
_gimp_unit_get_number_of_units (void)
|
|
{
|
|
GParam *return_vals;
|
|
gint nreturn_vals;
|
|
|
|
gint number;
|
|
|
|
return_vals = gimp_run_procedure ("gimp_unit_get_number_of_units",
|
|
&nreturn_vals,
|
|
PARAM_END);
|
|
|
|
number = GIMP_UNIT_END;
|
|
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
|
number = return_vals[1].data.d_int32;
|
|
|
|
gimp_destroy_params (return_vals, nreturn_vals);
|
|
|
|
return number;
|
|
}
|
|
|
|
gint
|
|
_gimp_unit_get_number_of_built_in_units (void)
|
|
{
|
|
GParam *return_vals;
|
|
gint nreturn_vals;
|
|
|
|
gint number;
|
|
|
|
return_vals = gimp_run_procedure ("gimp_unit_get_number_of_built_in_units",
|
|
&nreturn_vals,
|
|
PARAM_END);
|
|
|
|
number = GIMP_UNIT_END;
|
|
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
|
number = return_vals[1].data.d_int32;
|
|
|
|
gimp_destroy_params (return_vals, nreturn_vals);
|
|
|
|
return number;
|
|
}
|
|
|
|
GimpUnit
|
|
_gimp_unit_new (gchar *identifier,
|
|
gdouble factor,
|
|
gint digits,
|
|
gchar *symbol,
|
|
gchar *abbreviation,
|
|
gchar *singular,
|
|
gchar *plural)
|
|
{
|
|
GParam *return_vals;
|
|
gint nreturn_vals;
|
|
|
|
GimpUnit unit;
|
|
|
|
return_vals = gimp_run_procedure ("gimp_unit_new",
|
|
&nreturn_vals,
|
|
PARAM_STRING, identifier,
|
|
PARAM_FLOAT, factor,
|
|
PARAM_INT32, digits,
|
|
PARAM_STRING, symbol,
|
|
PARAM_STRING, abbreviation,
|
|
PARAM_STRING, singular,
|
|
PARAM_STRING, plural,
|
|
PARAM_END);
|
|
|
|
unit = GIMP_UNIT_INCH;
|
|
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
|
unit = return_vals[1].data.d_int32;
|
|
|
|
gimp_destroy_params (return_vals, nreturn_vals);
|
|
|
|
return unit;
|
|
}
|
|
|
|
gboolean
|
|
_gimp_unit_get_deletion_flag (GimpUnit unit)
|
|
{
|
|
GParam *return_vals;
|
|
gint nreturn_vals;
|
|
|
|
gboolean flag;
|
|
|
|
g_return_val_if_fail (unit >= GIMP_UNIT_PIXEL, TRUE);
|
|
|
|
if (unit < GIMP_UNIT_END)
|
|
return FALSE;
|
|
|
|
return_vals = gimp_run_procedure ("gimp_unit_get_deletion_flag",
|
|
&nreturn_vals,
|
|
PARAM_INT32, unit,
|
|
PARAM_END);
|
|
|
|
flag = TRUE;
|
|
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
|
flag = return_vals[1].data.d_int32 ? TRUE : FALSE;
|
|
|
|
gimp_destroy_params (return_vals, nreturn_vals);
|
|
|
|
return flag;
|
|
}
|
|
|
|
void
|
|
_gimp_unit_set_deletion_flag (GimpUnit unit,
|
|
gboolean deletion_flag)
|
|
{
|
|
GParam *return_vals;
|
|
gint nreturn_vals;
|
|
|
|
return_vals = gimp_run_procedure ("gimp_unit_set_deletion_flag",
|
|
&nreturn_vals,
|
|
PARAM_INT32, unit,
|
|
PARAM_INT32, deletion_flag,
|
|
PARAM_END);
|
|
|
|
gimp_destroy_params (return_vals, nreturn_vals);
|
|
}
|
|
|
|
gdouble
|
|
_gimp_unit_get_factor (GimpUnit unit)
|
|
{
|
|
GParam *return_vals;
|
|
gint nreturn_vals;
|
|
|
|
gdouble factor;
|
|
|
|
return_vals = gimp_run_procedure ("gimp_unit_get_factor",
|
|
&nreturn_vals,
|
|
PARAM_INT32, unit,
|
|
PARAM_END);
|
|
|
|
factor = 1.0;
|
|
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
|
factor = return_vals[1].data.d_float;
|
|
|
|
gimp_destroy_params (return_vals, nreturn_vals);
|
|
|
|
return factor;
|
|
}
|
|
|
|
gint
|
|
_gimp_unit_get_digits (GimpUnit unit)
|
|
{
|
|
GParam *return_vals;
|
|
gint nreturn_vals;
|
|
|
|
gint digits;
|
|
|
|
return_vals = gimp_run_procedure ("gimp_unit_get_digits",
|
|
&nreturn_vals,
|
|
PARAM_INT32, unit,
|
|
PARAM_END);
|
|
|
|
digits = 2; /* == gimp_unit_defs[GIMP_UNIT_INCH].digits */
|
|
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
|
digits = return_vals[1].data.d_int32;
|
|
|
|
gimp_destroy_params (return_vals, nreturn_vals);
|
|
|
|
return digits;
|
|
}
|
|
|
|
gchar *
|
|
_gimp_unit_get_identifier (GimpUnit unit)
|
|
{
|
|
GParam *return_vals;
|
|
gint nreturn_vals;
|
|
|
|
gchar *identifier;
|
|
|
|
return_vals = gimp_run_procedure ("gimp_unit_get_identifier",
|
|
&nreturn_vals,
|
|
PARAM_INT32, unit,
|
|
PARAM_END);
|
|
|
|
identifier = NULL;
|
|
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
|
identifier = g_strdup (return_vals[1].data.d_string);
|
|
|
|
gimp_destroy_params (return_vals, nreturn_vals);
|
|
|
|
return identifier ? identifier : g_strdup ("");
|
|
}
|
|
|
|
gchar *
|
|
_gimp_unit_get_symbol (GimpUnit unit)
|
|
{
|
|
GParam *return_vals;
|
|
gint nreturn_vals;
|
|
|
|
gchar *symbol;
|
|
|
|
return_vals = gimp_run_procedure ("gimp_unit_get_symbol",
|
|
&nreturn_vals,
|
|
PARAM_INT32, unit,
|
|
PARAM_END);
|
|
|
|
symbol = NULL;
|
|
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
|
symbol = g_strdup (return_vals[1].data.d_string);
|
|
|
|
gimp_destroy_params (return_vals, nreturn_vals);
|
|
|
|
return symbol ? symbol : g_strdup ("");
|
|
}
|
|
|
|
gchar *
|
|
_gimp_unit_get_abbreviation (GimpUnit unit)
|
|
{
|
|
GParam *return_vals;
|
|
gint nreturn_vals;
|
|
|
|
gchar *abbreviation;
|
|
|
|
return_vals = gimp_run_procedure ("gimp_unit_get_abbreviation",
|
|
&nreturn_vals,
|
|
PARAM_INT32, unit,
|
|
PARAM_END);
|
|
|
|
abbreviation = NULL;
|
|
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
|
abbreviation = g_strdup (return_vals[1].data.d_string);
|
|
|
|
gimp_destroy_params (return_vals, nreturn_vals);
|
|
|
|
return abbreviation ? abbreviation : g_strdup ("");
|
|
}
|
|
|
|
gchar *
|
|
_gimp_unit_get_singular (GimpUnit unit)
|
|
{
|
|
GParam *return_vals;
|
|
gint nreturn_vals;
|
|
|
|
gchar *singular;
|
|
|
|
return_vals = gimp_run_procedure ("gimp_unit_get_singular",
|
|
&nreturn_vals,
|
|
PARAM_INT32, unit,
|
|
PARAM_END);
|
|
|
|
singular = NULL;
|
|
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
|
singular = g_strdup (return_vals[1].data.d_string);
|
|
|
|
gimp_destroy_params (return_vals, nreturn_vals);
|
|
|
|
return singular ? singular : g_strdup ("");
|
|
}
|
|
|
|
gchar *
|
|
_gimp_unit_get_plural (GimpUnit unit)
|
|
{
|
|
GParam *return_vals;
|
|
gint nreturn_vals;
|
|
|
|
gchar *plural;
|
|
|
|
return_vals = gimp_run_procedure ("gimp_unit_get_plural",
|
|
&nreturn_vals,
|
|
PARAM_INT32, unit,
|
|
PARAM_END);
|
|
|
|
plural = NULL;
|
|
if (return_vals[0].data.d_status == STATUS_SUCCESS)
|
|
plural = g_strdup (return_vals[1].data.d_string);
|
|
|
|
gimp_destroy_params (return_vals, nreturn_vals);
|
|
|
|
return plural ? plural : g_strdup ("");
|
|
}
|