made the monitor resolution accessible through a PDB function

* tools/pdbgen/pdb/gimprc.pdb: made the monitor resolution
        accessible through a PDB function

        * app/internal_procs.c
        * app/gimprc_cmds.c: changed the autogenerated files

        * plug-ins/common/screenshot.c: set the image resolution to the
        monitor resolution and unset the image name

--Sven
This commit is contained in:
Sven Neumann 1999-08-12 16:54:53 +00:00
parent 01200bfad7
commit 522f4b345a
5 changed files with 153 additions and 32 deletions

View File

@ -1,3 +1,14 @@
Thu Aug 12 18:54:38 MEST 1999 Sven Neumann <sven@gimp.org>
* tools/pdbgen/pdb/gimprc.pdb: made the monitor resolution
accessible through a PDB function
* app/internal_procs.c
* app/gimprc_cmds.c: changed the autogenerated files
* plug-ins/common/screenshot.c: set the image resolution to the
monitor resolution and unset the image name
Tue Aug 10 01:15:59 1999 Adrian Likins <alikins@redhat.com>
* app/pixmapbrush.c: fixed the weirdness with drawing

View File

@ -24,12 +24,14 @@
static ProcRecord gimprc_query_proc;
static ProcRecord gimprc_set_proc;
static ProcRecord get_monitor_resolution_proc;
void
register_gimprc_procs (void)
{
procedural_db_register (&gimprc_query_proc);
procedural_db_register (&gimprc_set_proc);
procedural_db_register (&get_monitor_resolution_proc);
}
static Argument *
@ -144,3 +146,56 @@ static ProcRecord gimprc_set_proc =
NULL,
{ { gimprc_set_invoker } }
};
static Argument *
get_monitor_resolution_invoker (Argument *args)
{
gboolean success = TRUE;
Argument *return_args;
gdouble xres;
gdouble yres;
xres = monitor_xres;
yres = monitor_yres;
success = TRUE;
return_args = procedural_db_return_args (&get_monitor_resolution_proc, success);
if (success)
{
return_args[1].value.pdb_float = xres;
return_args[2].value.pdb_float = yres;
}
return return_args;
}
static ProcArg get_monitor_resolution_outargs[] =
{
{
PDB_FLOAT,
"xres",
"X resolution"
},
{
PDB_FLOAT,
"yres",
"Y resolution"
}
};
static ProcRecord get_monitor_resolution_proc =
{
"gimp_get_monitor_resolution",
"Get the monitor resolution as specified in the Preferences.",
"Returns the resolution of the monitor in pixels/inch. This value is taken from the Preferences (or the X-Server if this is set in the Preferences) and there's no guarantee for the value to be reasonable.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
PDB_INTERNAL,
0,
NULL,
2,
get_monitor_resolution_outargs,
{ { get_monitor_resolution_invoker } }
};

View File

@ -59,7 +59,7 @@ void register_tools_procs (void);
void register_undo_procs (void);
void register_unit_procs (void);
/* 307 procedures registered total */
/* 308 procedures registered total */
void
internal_procs_init (void)
@ -70,85 +70,85 @@ internal_procs_init (void)
app_init_update_status (NULL, _("Brushes"), 0.01);
register_brushes_procs ();
app_init_update_status (NULL, _("Channel"), 0.046);
app_init_update_status (NULL, _("Channel"), 0.045);
register_channel_procs ();
app_init_update_status (NULL, _("Channel Ops"), 0.091);
register_channel_ops_procs ();
app_init_update_status (NULL, _("Color"), 0.098);
app_init_update_status (NULL, _("Color"), 0.097);
register_color_procs ();
app_init_update_status (NULL, _("Convert"), 0.137);
app_init_update_status (NULL, _("Convert"), 0.136);
register_convert_procs ();
app_init_update_status (NULL, _("Drawable procedures"), 0.15);
app_init_update_status (NULL, _("Drawable procedures"), 0.149);
register_drawable_procs ();
app_init_update_status (NULL, _("Edit procedures"), 0.221);
register_edit_procs ();
app_init_update_status (NULL, _("File Operations"), 0.241);
app_init_update_status (NULL, _("File Operations"), 0.24);
register_fileops_procs ();
app_init_update_status (NULL, _("Floating selections"), 0.261);
app_init_update_status (NULL, _("Floating selections"), 0.26);
register_floating_sel_procs ();
app_init_update_status (NULL, _("GDisplay procedures"), 0.28);
app_init_update_status (NULL, _("GDisplay procedures"), 0.279);
register_gdisplay_procs ();
app_init_update_status (NULL, _("Image"), 0.29);
app_init_update_status (NULL, _("Image"), 0.289);
register_gimage_procs ();
app_init_update_status (NULL, _("Image mask"), 0.466);
app_init_update_status (NULL, _("Image mask"), 0.464);
register_gimage_mask_procs ();
app_init_update_status (NULL, _("Gimprc procedures"), 0.521);
app_init_update_status (NULL, _("Gimprc procedures"), 0.519);
register_gimprc_procs ();
app_init_update_status (NULL, _("Gradients"), 0.528);
app_init_update_status (NULL, _("Gradients"), 0.529);
register_gradient_procs ();
app_init_update_status (NULL, _("Gradient UI"), 0.544);
app_init_update_status (NULL, _("Gradient UI"), 0.545);
register_gradient_select_procs ();
app_init_update_status (NULL, _("Guide procedures"), 0.557);
app_init_update_status (NULL, _("Guide procedures"), 0.558);
register_guides_procs ();
app_init_update_status (NULL, _("Interface"), 0.577);
app_init_update_status (NULL, _("Interface"), 0.578);
register_interface_procs ();
app_init_update_status (NULL, _("Layer"), 0.586);
app_init_update_status (NULL, _("Layer"), 0.588);
register_layer_procs ();
app_init_update_status (NULL, _("Miscellaneous"), 0.684);
app_init_update_status (NULL, _("Miscellaneous"), 0.685);
register_misc_procs ();
app_init_update_status (NULL, _("Palette"), 0.691);
app_init_update_status (NULL, _("Palette"), 0.692);
register_palette_procs ();
app_init_update_status (NULL, _("Parasite procedures"), 0.713);
app_init_update_status (NULL, _("Parasite procedures"), 0.714);
register_parasite_procs ();
app_init_update_status (NULL, _("Paths"), 0.756);
register_paths_procs ();
app_init_update_status (NULL, _("Pattern UI"), 0.788);
app_init_update_status (NULL, _("Pattern UI"), 0.789);
register_pattern_select_procs ();
app_init_update_status (NULL, _("Patterns"), 0.798);
app_init_update_status (NULL, _("Patterns"), 0.799);
register_patterns_procs ();
app_init_update_status (NULL, _("Plug-in"), 0.811);
app_init_update_status (NULL, _("Plug-in"), 0.812);
register_plug_in_procs ();
app_init_update_status (NULL, _("Procedural database"), 0.824);
app_init_update_status (NULL, _("Procedural database"), 0.825);
register_procedural_db_procs ();
app_init_update_status (NULL, _("Text procedures"), 0.85);
app_init_update_status (NULL, _("Text procedures"), 0.851);
register_text_tool_procs ();
app_init_update_status (NULL, _("Tool procedures"), 0.863);
app_init_update_status (NULL, _("Tool procedures"), 0.864);
register_tools_procs ();
app_init_update_status (NULL, _("Undo"), 0.958);

View File

@ -1,7 +1,7 @@
/*
* ScreenShot plug-in v0.9
* ScreenShot plug-in v0.9.1
* Sven Neumann, neumanns@uni-duesseldorf.de
* 1998/06/06
* 1999/08/12
*
* Any suggestions, bug-reports or patches are very welcome.
*
@ -40,6 +40,8 @@
* (98/05/28) v0.7 use g_message for error output
* (98/06/04) v0.8 added delay-time for root window shot
* (98/06/06) v0.9 fixed a stupid bug in the dialog
* (99/08/12) v0.9.1 somebody changed the dialog,
* unset the image name and set the resolution
*/
#include <stdio.h>
@ -55,7 +57,7 @@
/* Defines */
#define PLUG_IN_NAME "extension_screenshot"
#define PLUG_IN_PRINT_NAME "Screen Shot"
#define PLUG_IN_VERSION "v0.9 (98/06/06)"
#define PLUG_IN_VERSION "v0.9.1 (99/08/12)"
#define PLUG_IN_MENU_PATH "<Toolbox>/Xtns/Screen Shot"
#define PLUG_IN_AUTHOR "Sven Neumann (neumanns@uni-duesseldorf.de)"
#define PLUG_IN_COPYRIGHT "Sven Neumann"
@ -254,6 +256,7 @@ shoot (void)
gint retvals;
char *tmpname;
char *xwdargv[7]; /* only need a maximum of 7 arguments to xwd */
gdouble xres, yres;
gint pid;
gint status;
gint i = 0;
@ -324,10 +327,32 @@ shoot (void)
PARAM_STRING, tmpname,
PARAM_END);
image_ID = params[1].data.d_image;
gimp_destroy_params (params, retvals);
/* get rid of the tmpfile */
unlink (tmpname);
/* figure out the monitor resolution and set the image to it */
params = gimp_run_procedure ("gimp_get_monitor_resolution",
&retvals,
PARAM_END);
if (params[0].data.d_status == STATUS_SUCCESS)
{
xres = params[1].data.d_float;
yres = params[2].data.d_float;
}
else
{
xres = 72.0;
yres = 72.0;
}
gimp_destroy_params (params, retvals);
gimp_image_set_resolution (image_ID, xres, yres);
/* unset the image filename */
gimp_image_set_filename (image_ID, "");
return;
}

View File

@ -52,7 +52,6 @@ HELP
);
%invoke = (
headers => [ qw("gimprc.h") ],
vars => [ 'gchar *value = NULL' ],
code => <<'CODE'
{
@ -90,13 +89,44 @@ HELP
);
%invoke = (
headers => [ qw("gimprc.h") ],
code => 'save_gimprc_strings(token, value);'
);
}
sub get_monitor_resolution {
$blurb = 'Get the monitor resolution as specified in the Preferences.';
@procs = qw(gimprc_query gimprc_set);
$help = <<'HELP';
Returns the resolution of the monitor in pixels/inch. This value
is taken from the Preferences (or the X-Server if this is set in the
Preferences) and there's no guarantee for the value to be reasonable.
HELP
&std_pdb_misc;
@inargs = ( );
@outargs = (
{ name => 'xres', type => 'float',
desc => 'X resolution', alias => 'xres' },
{ name => 'yres', type => 'float',
desc => 'Y resolution', alias => 'yres' },
);
%invoke = (
code => <<'CODE'
{
xres = monitor_xres;
yres = monitor_yres;
success = TRUE;
}
CODE
);
}
@headers = qw("gimprc.h");
@procs = qw(gimprc_query gimprc_set get_monitor_resolution);
%exports = (app => [@procs]);
$desc = 'Gimprc procedures';