export gimp_get_default_unit() to the PDB.
2006-12-29 Sven Neumann <sven@gimp.org> * tools/pdbgen/pdb/gimprc.pdb: export gimp_get_default_unit() to the PDB. * app/pdb/gimprc_cmds.c * app/pdb/internal_procs.c * libgimp/gimpgimprc_pdb.[ch]: regenerated. * libgimp/gimp.def: updated. * plug-ins/print/print-page-layout.c * plug-ins/print/print.c: initialize units the same way the core Print Size dialog does it.
This commit is contained in:

committed by
Sven Neumann

parent
e0e14e8c48
commit
e3282e64fe
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
|||||||
|
2006-12-29 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* tools/pdbgen/pdb/gimprc.pdb: export gimp_get_default_unit() to
|
||||||
|
the PDB.
|
||||||
|
|
||||||
|
* app/pdb/gimprc_cmds.c
|
||||||
|
* app/pdb/internal_procs.c
|
||||||
|
* libgimp/gimpgimprc_pdb.[ch]: regenerated.
|
||||||
|
|
||||||
|
* libgimp/gimp.def: updated.
|
||||||
|
|
||||||
|
* plug-ins/print/print-page-layout.c
|
||||||
|
* plug-ins/print/print.c: initialize units the same way the core
|
||||||
|
Print Size dialog does it.
|
||||||
|
|
||||||
2006-12-28 Sven Neumann <sven@gimp.org>
|
2006-12-28 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* plug-ins/print/print-settings: removed unused settings, bumped
|
* plug-ins/print/print-settings: removed unused settings, bumped
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
|
||||||
|
#include "libgimpbase/gimpbase.h"
|
||||||
#include "libgimpconfig/gimpconfig.h"
|
#include "libgimpconfig/gimpconfig.h"
|
||||||
#include "libgimpmodule/gimpmodule.h"
|
#include "libgimpmodule/gimpmodule.h"
|
||||||
|
|
||||||
@ -33,6 +34,7 @@
|
|||||||
#include "core/gimpparamspecs.h"
|
#include "core/gimpparamspecs.h"
|
||||||
|
|
||||||
#include "config/gimprc.h"
|
#include "config/gimprc.h"
|
||||||
|
#include "core/gimp-utils.h"
|
||||||
#include "core/gimp.h"
|
#include "core/gimp.h"
|
||||||
#include "core/gimptemplate.h"
|
#include "core/gimptemplate.h"
|
||||||
|
|
||||||
@ -121,6 +123,24 @@ get_default_comment_invoker (GimpProcedure *procedure,
|
|||||||
return return_vals;
|
return return_vals;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GValueArray *
|
||||||
|
get_default_unit_invoker (GimpProcedure *procedure,
|
||||||
|
Gimp *gimp,
|
||||||
|
GimpContext *context,
|
||||||
|
GimpProgress *progress,
|
||||||
|
const GValueArray *args)
|
||||||
|
{
|
||||||
|
GValueArray *return_vals;
|
||||||
|
GimpUnit unit_id = 0;
|
||||||
|
|
||||||
|
unit_id = gimp_get_default_unit ();
|
||||||
|
|
||||||
|
return_vals = gimp_procedure_get_return_values (procedure, TRUE);
|
||||||
|
g_value_set_int (&return_vals->values[1], unit_id);
|
||||||
|
|
||||||
|
return return_vals;
|
||||||
|
}
|
||||||
|
|
||||||
static GValueArray *
|
static GValueArray *
|
||||||
get_monitor_resolution_invoker (GimpProcedure *procedure,
|
get_monitor_resolution_invoker (GimpProcedure *procedure,
|
||||||
Gimp *gimp,
|
Gimp *gimp,
|
||||||
@ -278,13 +298,37 @@ register_gimprc_procs (GimpPDB *pdb)
|
|||||||
gimp_procedure_add_return_value (procedure,
|
gimp_procedure_add_return_value (procedure,
|
||||||
gimp_param_spec_string ("comment",
|
gimp_param_spec_string ("comment",
|
||||||
"comment",
|
"comment",
|
||||||
"Default Image Comment",
|
"Default image comment",
|
||||||
FALSE, FALSE,
|
FALSE, FALSE,
|
||||||
NULL,
|
NULL,
|
||||||
GIMP_PARAM_READWRITE));
|
GIMP_PARAM_READWRITE));
|
||||||
gimp_pdb_register_procedure (pdb, procedure);
|
gimp_pdb_register_procedure (pdb, procedure);
|
||||||
g_object_unref (procedure);
|
g_object_unref (procedure);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gimp-get-default-unit
|
||||||
|
*/
|
||||||
|
procedure = gimp_procedure_new (get_default_unit_invoker);
|
||||||
|
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-get-default-unit");
|
||||||
|
gimp_procedure_set_static_strings (procedure,
|
||||||
|
"gimp-get-default-unit",
|
||||||
|
"Get the default unit (taken from the user's locale).",
|
||||||
|
"Returns the default unit's integer ID.",
|
||||||
|
"Spencer Kimball & Peter Mattis",
|
||||||
|
"Spencer Kimball & Peter Mattis",
|
||||||
|
"1995-1996",
|
||||||
|
NULL);
|
||||||
|
gimp_procedure_add_return_value (procedure,
|
||||||
|
gimp_param_spec_unit ("unit-id",
|
||||||
|
"unit id",
|
||||||
|
"Default unit",
|
||||||
|
TRUE,
|
||||||
|
FALSE,
|
||||||
|
GIMP_UNIT_PIXEL,
|
||||||
|
GIMP_PARAM_READWRITE));
|
||||||
|
gimp_pdb_register_procedure (pdb, procedure);
|
||||||
|
g_object_unref (procedure);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* gimp-get-monitor-resolution
|
* gimp-get-monitor-resolution
|
||||||
*/
|
*/
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "internal_procs.h"
|
#include "internal_procs.h"
|
||||||
|
|
||||||
|
|
||||||
/* 544 procedures registered total */
|
/* 545 procedures registered total */
|
||||||
|
|
||||||
void
|
void
|
||||||
internal_procs_init (GimpPDB *pdb)
|
internal_procs_init (GimpPDB *pdb)
|
||||||
|
@ -227,6 +227,7 @@ EXPORTS
|
|||||||
gimp_gamma
|
gimp_gamma
|
||||||
gimp_get_color_configuration
|
gimp_get_color_configuration
|
||||||
gimp_get_default_comment
|
gimp_get_default_comment
|
||||||
|
gimp_get_default_unit
|
||||||
gimp_get_module_load_inhibit
|
gimp_get_module_load_inhibit
|
||||||
gimp_get_monitor_resolution
|
gimp_get_monitor_resolution
|
||||||
gimp_get_path_by_tattoo
|
gimp_get_path_by_tattoo
|
||||||
|
@ -106,7 +106,7 @@ gimp_gimprc_set (const gchar *token,
|
|||||||
*
|
*
|
||||||
* Returns a copy of the default image comment.
|
* Returns a copy of the default image comment.
|
||||||
*
|
*
|
||||||
* Returns: Default Image Comment.
|
* Returns: Default image comment.
|
||||||
*/
|
*/
|
||||||
gchar *
|
gchar *
|
||||||
gimp_get_default_comment (void)
|
gimp_get_default_comment (void)
|
||||||
@ -127,6 +127,36 @@ gimp_get_default_comment (void)
|
|||||||
return comment;
|
return comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_get_default_unit:
|
||||||
|
*
|
||||||
|
* Get the default unit (taken from the user's locale).
|
||||||
|
*
|
||||||
|
* Returns the default unit's integer ID.
|
||||||
|
*
|
||||||
|
* Returns: Default unit.
|
||||||
|
*
|
||||||
|
* Since: GIMP 2.4
|
||||||
|
*/
|
||||||
|
GimpUnit
|
||||||
|
gimp_get_default_unit (void)
|
||||||
|
{
|
||||||
|
GimpParam *return_vals;
|
||||||
|
gint nreturn_vals;
|
||||||
|
GimpUnit unit_id = 0;
|
||||||
|
|
||||||
|
return_vals = gimp_run_procedure ("gimp-get-default-unit",
|
||||||
|
&nreturn_vals,
|
||||||
|
GIMP_PDB_END);
|
||||||
|
|
||||||
|
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||||
|
unit_id = return_vals[1].data.d_unit;
|
||||||
|
|
||||||
|
gimp_destroy_params (return_vals, nreturn_vals);
|
||||||
|
|
||||||
|
return unit_id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gimp_get_monitor_resolution:
|
* gimp_get_monitor_resolution:
|
||||||
* @xres: X resolution.
|
* @xres: X resolution.
|
||||||
|
@ -33,6 +33,7 @@ gchar* gimp_gimprc_query (const gchar *token);
|
|||||||
gboolean gimp_gimprc_set (const gchar *token,
|
gboolean gimp_gimprc_set (const gchar *token,
|
||||||
const gchar *value);
|
const gchar *value);
|
||||||
gchar* gimp_get_default_comment (void);
|
gchar* gimp_get_default_comment (void);
|
||||||
|
GimpUnit gimp_get_default_unit (void);
|
||||||
gboolean gimp_get_monitor_resolution (gdouble *xres,
|
gboolean gimp_get_monitor_resolution (gdouble *xres,
|
||||||
gdouble *yres);
|
gdouble *yres);
|
||||||
gchar* gimp_get_theme_dir (void);
|
gchar* gimp_get_theme_dir (void);
|
||||||
|
@ -257,7 +257,8 @@ print_size_frame (PrintData *data)
|
|||||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (hbox);
|
gtk_widget_show (hbox);
|
||||||
|
|
||||||
entry = gimp_size_entry_new (1, GIMP_UNIT_INCH, _("pixels/%a"),
|
entry = gimp_size_entry_new (1, gimp_image_get_unit (data->image_id),
|
||||||
|
_("pixels/%a"),
|
||||||
FALSE, FALSE, FALSE, SB_WIDTH,
|
FALSE, FALSE, FALSE, SB_WIDTH,
|
||||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0);
|
||||||
|
@ -160,7 +160,7 @@ print_image (gint32 image_ID,
|
|||||||
data->image_id = image_ID;
|
data->image_id = image_ID;
|
||||||
data->drawable_id = drawable_ID;
|
data->drawable_id = drawable_ID;
|
||||||
data->operation = operation;
|
data->operation = operation;
|
||||||
data->unit = gimp_image_get_unit (data->image_id);
|
data->unit = gimp_get_default_unit ();
|
||||||
gimp_image_get_resolution (data->image_id, &data->xres, &data->yres);
|
gimp_image_get_resolution (data->image_id, &data->xres, &data->yres);
|
||||||
|
|
||||||
load_print_settings (data);
|
load_print_settings (data);
|
||||||
|
@ -135,7 +135,7 @@ sub get_default_comment {
|
|||||||
|
|
||||||
@outargs = (
|
@outargs = (
|
||||||
{ name => 'comment', type => 'string',
|
{ name => 'comment', type => 'string',
|
||||||
desc => 'Default Image Comment' }
|
desc => 'Default image comment' }
|
||||||
);
|
);
|
||||||
|
|
||||||
%invoke = (
|
%invoke = (
|
||||||
@ -148,6 +148,29 @@ CODE
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub get_default_unit {
|
||||||
|
$blurb = 'Get the default unit (taken from the user\'s locale).';
|
||||||
|
$help = 'Returns the default unit\'s integer ID.';
|
||||||
|
|
||||||
|
&std_pdb_misc;
|
||||||
|
$since = '2.4';
|
||||||
|
|
||||||
|
@outargs = (
|
||||||
|
{ name => 'unit_id', type => 'unit',
|
||||||
|
desc => 'Default unit' }
|
||||||
|
);
|
||||||
|
|
||||||
|
%invoke = (
|
||||||
|
headers => [ qw("libgimpbase/gimpbase.h"
|
||||||
|
"core/gimp-utils.h") ],
|
||||||
|
code => <<'CODE'
|
||||||
|
{
|
||||||
|
unit_id = gimp_get_default_unit ();
|
||||||
|
}
|
||||||
|
CODE
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
sub get_theme_dir {
|
sub get_theme_dir {
|
||||||
$blurb = 'Get the directory of the current GUI theme.';
|
$blurb = 'Get the directory of the current GUI theme.';
|
||||||
$help = 'Returns a copy of the current GUI theme dir.';
|
$help = 'Returns a copy of the current GUI theme dir.';
|
||||||
@ -217,8 +240,8 @@ CODE
|
|||||||
"core/gimp.h");
|
"core/gimp.h");
|
||||||
|
|
||||||
@procs = qw(gimprc_query gimprc_set
|
@procs = qw(gimprc_query gimprc_set
|
||||||
get_default_comment get_monitor_resolution get_theme_dir
|
get_default_comment get_default_unit get_monitor_resolution
|
||||||
get_color_configuration get_module_load_inhibit);
|
get_theme_dir get_color_configuration get_module_load_inhibit);
|
||||||
|
|
||||||
%exports = (app => [@procs], lib => [@procs]);
|
%exports = (app => [@procs], lib => [@procs]);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user