Commit 732e01b7 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

INSTALL added a check for libgnomeprintui.

2005-09-22  Sven Neumann  <sven@gimp.org>

	* INSTALL
	* configure.in: added a check for libgnomeprintui.

	* plug-ins/common/gnomeprint.c: added a simple Print plug-in that
	uses libgnomeprint and libgnomeprintui. Needs more work.

	* plug-ins/common/plugin-defs.pl: added the new plug-in.

	* plug-ins/common/Makefile.am: regenerated.
parent a4baae32
2005-09-22 Sven Neumann <sven@gimp.org>
* INSTALL
* configure.in: added a check for libgnomeprintui.
* plug-ins/common/gnomeprint.c: added a simple Print plug-in that
uses libgnomeprint and libgnomeprintui. Needs more work.
* plug-ins/common/plugin-defs.pl: added the new plug-in.
* plug-ins/common/Makefile.am: regenerated.
2005-09-22 DindinX <dindinx@gimp.org>
* libgimpwidgets/gimpzoommodel.c: renamed the properties "value",
......
......@@ -140,6 +140,9 @@ These are:
--without-poppler. If for some reason you don't want to build the PDF
import plug-in that uses libpoppler, you can use --without-poppler.
--without-gnomeprint. If you don't want to build the Print plug-in
that uses libgnomeprint, you can use --without-gnomeprint.
--with-gif-compression=[lzw|rle|none]. Allows to tune the compression
algorithm used by the GIF plug-in. If you are afraid of Unisys' LZW
patent (which should have expired in most countries by now), you
......
......@@ -57,6 +57,8 @@ m4_define([pygtk_required_version], [1.99.15])
m4_define([poppler_required_version], [0.3.1])
m4_define([gnome_vfs_required_version], [2.10.0])
m4_define([gnomeui_required_version], [2.10.0])
m4_define([gnome_print_required_version], [2.10.0])
AC_INIT([GIMP], [gimp_version],
[http://bugzilla.gnome.org/enter_bug.cgi?product=GIMP],
......@@ -1241,6 +1243,30 @@ if test "x$have_gnomeui" = xyes; then
fi
#######################
# Check for gnome-print
#######################
AC_ARG_WITH(gnomeprint,[ --without-gnomeprint disable build of gnomeprint plug-in])
if test "x$with_gnomeprint" != xno; then
PKG_CHECK_MODULES(GNOMEPRINT,
libgnomeprintui-2.2 >= gnome_print_required_version,
have_gnomeprint=yes)
fi
AM_CONDITIONAL(HAVE_GNOMEPRINT, test x$have_gnomeprint = xyes)
if test "x$have_gnomeprint" = xyes; then
GNOMEPRINT='gnomeprint$(EXEEXT)'
LIBGNOMEPRINT=$GNOMEPRINT_LIBS
AC_DEFINE(HAVE_GNOME_PRINT, 1, [Define to 1 if libgnomeprintui is available])
fi
AC_SUBST(GNOMEPRINT)
AC_SUBST(LIBGNOMEPRINT)
######################
# Check for gimp-print
######################
......
......@@ -56,6 +56,7 @@ gifload
gih
glasstile
glob
gnomeprint
gqbist
gradmap
grid
......
......@@ -88,6 +88,7 @@ libexec_PROGRAMS = \
gih \
glasstile \
glob \
$(GNOMEPRINT) \
gqbist \
gradmap \
grid \
......@@ -178,6 +179,7 @@ libexec_PROGRAMS = \
EXTRA_PROGRAMS = \
aa \
gnomeprint \
mail \
mng \
png \
......@@ -936,7 +938,7 @@ gifload_LDADD = \
$(libgimp) \
$(libgimpcolor) \
$(libgimpbase) \
$(GTK_LIBS) \
$(GLIB_LIBS) \
$(RT_LIBS) \
$(INTLLIBS)
......@@ -981,6 +983,24 @@ glob_LDADD = \
$(RT_LIBS) \
$(INTLLIBS)
gnomeprint_CFLAGS = $(GNOMEPRINT_CFLAGS)
gnomeprint_SOURCES = \
gnomeprint.c
gnomeprint_LDADD = \
$(libgimpui) \
$(libgimpconfig) \
$(libgimpwidgets) \
$(libgimp) \
$(libgimpcolor) \
$(libgimpmath) \
$(libgimpbase) \
$(LIBGNOMEPRINT) \
$(GTK_LIBS) \
$(RT_LIBS) \
$(INTLLIBS)
gqbist_SOURCES = \
gqbist.c
......
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (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
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <string.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include <libgnomeprint/gnome-print.h>
#include <libgnomeprint/gnome-print-job.h>
#include <libgnomeprintui/gnome-print-dialog.h>
#include <libgnomeprintui/gnome-print-job-preview.h>
#include "libgimp/stdplugins-intl.h"
#define PROC_NAME "file-print-gnome"
#define PLUG_IN_BINARY "gnomeprint"
static void query (void);
static void run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals);
static gboolean print_image (gint32 image_ID,
gint32 drawable_ID,
gboolean interactive);
static GnomePrintJob * print_job_new (void);
static gboolean print_job_do (GnomePrintJob *job,
gint32 drawable_ID);
static void print_drawable (GnomePrintContext *context,
GnomePrintConfig *config,
gint32 drawable_ID);
static void print_fit_size (GnomePrintConfig *config,
gint width,
gint height,
gdouble *scale_x,
gdouble *scale_y,
gdouble *trans_x,
gdouble *trans_y);
GimpPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
NULL, /* quit_proc */
query, /* query_proc */
run, /* run_proc */
};
MAIN ()
static void
query (void)
{
static GimpParamDef print_args[] =
{
{ GIMP_PDB_INT32, "run-mode", "Interactive, non-interactive" },
{ GIMP_PDB_IMAGE, "image", "Input image" },
{ GIMP_PDB_DRAWABLE, "drawable", "Drawable to print" }
};
gimp_install_procedure (PROC_NAME,
"Prints an image using the GNOME Print architecture",
"FIXME: write help",
"Sven Neumann <sven@gimp.org>",
"Sven Neumann <sven@gimp.org>",
"2005",
N_("_GNOME Print..."),
"GRAY, RGB*",
GIMP_PLUGIN,
G_N_ELEMENTS (print_args), 0,
print_args, NULL);
gimp_plugin_menu_register (PROC_NAME, "<Image>/File/Send");
gimp_plugin_icon_register (PROC_NAME,
GIMP_ICON_TYPE_STOCK_ID, GTK_STOCK_PRINT);
}
static void
run (const gchar *name,
gint nparams,
const GimpParam *param,
gint *nreturn_vals,
GimpParam **return_vals)
{
static GimpParam values[2];
GimpRunMode run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
gint32 image_ID;
gint32 drawable_ID;
run_mode = param[0].data.d_int32;
INIT_I18N ();
*nreturn_vals = 1;
*return_vals = values;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
image_ID = param[1].data.d_int32;
drawable_ID = param[2].data.d_int32;
if (strcmp (name, PROC_NAME) == 0)
{
if (run_mode == GIMP_RUN_INTERACTIVE)
gimp_ui_init (PLUG_IN_BINARY, FALSE);
if (! print_image (image_ID, drawable_ID,
run_mode == GIMP_RUN_INTERACTIVE))
{
status = GIMP_PDB_EXECUTION_ERROR;
}
}
else
{
status = GIMP_PDB_CALLING_ERROR;
}
values[0].data.d_status = status;
}
static gboolean
print_image (gint32 image_ID,
gint32 drawable_ID,
gboolean interactive)
{
GnomePrintJob *job = print_job_new ();
gboolean done = FALSE;
if (interactive)
{
GtkWidget *dialog;
gint response;
dialog = gnome_print_dialog_new (job, (const guchar *) _("Print"),
GNOME_PRINT_DIALOG_COPIES);
gimp_window_set_transient (GTK_WINDOW (dialog));
do
{
switch (response = gtk_dialog_run (GTK_DIALOG (dialog)))
{
case GNOME_PRINT_DIALOG_RESPONSE_PRINT:
break;
case GNOME_PRINT_DIALOG_RESPONSE_PREVIEW:
{
GtkWidget *preview;
if (! done)
done = print_job_do (job, drawable_ID);
preview = gnome_print_job_preview_new (job,
_("Print Preview"));
gtk_window_set_transient_for (GTK_WINDOW (preview),
GTK_WINDOW (dialog));
gtk_window_set_modal (GTK_WINDOW (preview), TRUE);
gtk_widget_show (preview);
g_signal_connect (preview, "destroy",
G_CALLBACK (gtk_main_quit),
NULL);
gtk_main();
}
break;
case GNOME_PRINT_DIALOG_RESPONSE_CANCEL:
break;
}
}
while (response == GNOME_PRINT_DIALOG_RESPONSE_PREVIEW);
gtk_widget_destroy (dialog);
if (response == GNOME_PRINT_DIALOG_RESPONSE_CANCEL)
{
g_object_unref (job);
return FALSE;
}
}
if (! done)
done = print_job_do (job, drawable_ID);
gnome_print_job_print (job);
g_object_unref (job);
return TRUE;
}
static GnomePrintJob *
print_job_new (void)
{
GnomePrintConfig *config;
GnomePrintJob *job;
config = gnome_print_config_default ();
job = gnome_print_job_new (config);
g_object_unref (config);
return job;
}
static gboolean
print_job_do (GnomePrintJob *job,
gint32 drawable_ID)
{
GnomePrintContext *context;
GnomePrintConfig *config;
context = gnome_print_job_get_context (job);
config = gnome_print_job_get_config (job);
print_drawable (context, config, drawable_ID);
g_object_unref (config);
g_object_unref (context);
gnome_print_job_close (job);
return TRUE;
}
static void
print_drawable (GnomePrintContext *context,
GnomePrintConfig *config,
gint32 drawable_ID)
{
GimpDrawable *drawable = gimp_drawable_get (drawable_ID);
GimpPixelRgn region;
gint width;
gint height;
gint rowstride;
guchar *pixels;
gchar *name;
gdouble scale_x;
gdouble scale_y;
gdouble trans_x;
gdouble trans_y;
width = drawable->width;
height = drawable->height;
rowstride = width * drawable->bpp;
pixels = g_new (guchar, height * rowstride);
gimp_pixel_rgn_init (&region, drawable, 0, 0, width, height, FALSE, FALSE);
gimp_pixel_rgn_get_rect (&region, pixels, 0, 0, width, height);
gimp_drawable_detach (drawable);
name = gimp_drawable_get_name (drawable_ID);
gnome_print_beginpage (context, (const guchar *) name);
g_free (name);
print_fit_size (config, width, height,
&scale_x, &scale_y, &trans_x, &trans_y);
gnome_print_gsave (context);
gnome_print_scale (context, scale_x, scale_y);
gnome_print_translate (context, trans_x, trans_y);
gnome_print_moveto (context, 0, 0);
gnome_print_lineto (context, 1, 0);
gnome_print_lineto (context, 1, 1);
gnome_print_lineto (context, 0, 1);
gnome_print_lineto (context, 0, 0);
gnome_print_stroke (context);
switch (gimp_drawable_type (drawable_ID))
{
case GIMP_RGB_IMAGE:
gnome_print_rgbimage (context, pixels, width, height, rowstride);
break;
case GIMP_RGBA_IMAGE:
gnome_print_rgbaimage (context, pixels, width, height, rowstride);
break;
case GIMP_GRAY_IMAGE:
gnome_print_grayimage (context, pixels, width, height, rowstride);
break;
default:
g_warning ("drawable type not implemented");
break;
}
g_free (pixels);
gnome_print_grestore (context);
gnome_print_showpage (context);
}
static void
print_fit_size (GnomePrintConfig *config,
gint width,
gint height,
gdouble *scale_x,
gdouble *scale_y,
gdouble *trans_x,
gdouble *trans_y)
{
const GnomePrintUnit *base;
GnomePrintUnit *unit;
gdouble paper_width;
gdouble paper_height;
gdouble margin_bottom;
gdouble margin_right;
gdouble margin_left;
gdouble margin_top;
base = gnome_print_unit_get_identity (GNOME_PRINT_UNIT_DIMENSIONLESS);
gnome_print_config_get_length (config, GNOME_PRINT_KEY_PAPER_WIDTH,
&paper_width, &unit);
gnome_print_convert_distance (&paper_width, unit, base);
gnome_print_config_get_length (config, GNOME_PRINT_KEY_PAPER_HEIGHT,
&paper_height, &unit);
gnome_print_convert_distance (&paper_height, unit, base);
gnome_print_config_get_length (config, GNOME_PRINT_KEY_PAPER_MARGIN_BOTTOM,
&margin_bottom, &unit);
gnome_print_convert_distance (&margin_bottom, unit, base);
gnome_print_config_get_length (config, GNOME_PRINT_KEY_PAPER_MARGIN_TOP,
&margin_top, &unit);
gnome_print_convert_distance (&margin_top, unit, base);
gnome_print_config_get_length (config, GNOME_PRINT_KEY_PAPER_MARGIN_LEFT,
&margin_left, &unit);
gnome_print_convert_distance (&margin_left, unit, base);
gnome_print_config_get_length (config, GNOME_PRINT_KEY_PAPER_MARGIN_RIGHT,
&margin_right, &unit);
gnome_print_convert_distance (&margin_right, unit, base);
#if 0
g_printerr ("margins: %g %g %g %g\n",
margin_left, margin_bottom, margin_right, margin_top);
#endif
*scale_x = paper_width - margin_left - margin_right;
*scale_y = paper_height - margin_top - margin_bottom;
*trans_x = margin_left;
*trans_y = margin_bottom;
}
......@@ -49,10 +49,11 @@
'gee' => { libdep => 'gtk', ui => 1 },
'gee_zoom' => { libdep => 'gtk', ui => 1 },
'gif' => { libdep => 'gtk', ui => 1 },
'gifload' => { libdep => 'gtk' },
'gifload' => { libdep => 'glib' },
'gih' => { libdep => 'gtk', ui => 1 },
'glasstile' => { libdep => 'gtk', ui => 1 },
'glob' => { libdep => 'glib' },
'gnomeprint' => { libdep => 'gtk', ui => 1, optional => 1, cflags => 1 },
'gqbist' => { libdep => 'gtk', ui => 1 },
'gradmap' => { libdep => 'glib', ui => 1 },
'grid' => { libdep => 'gtk', ui => 1 },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment