diff --git a/ChangeLog b/ChangeLog index 52be787f51..53125d8bd7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2006-06-20 Sven Neumann + + * INSTALL + * configure.in + * plug-ins/common/plugin-defs.pl + * plug-ins/common/Makefile.am + * plug-ins/common/gnomeprint.c + * plug-ins/common/winprint.c: removed gnomeprint and winprint + plug-ins. We will have a plug-in based on GtkPrint for GIMP 2.4. + 2006-06-20 Sven Neumann * INSTALL diff --git a/INSTALL b/INSTALL index 0da487c290..b8aaced5fc 100644 --- a/INSTALL +++ b/INSTALL @@ -144,9 +144,6 @@ 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 diff --git a/configure.in b/configure.in index 15b6be2d5c..44fea7a78b 100644 --- a/configure.in +++ b/configure.in @@ -55,7 +55,6 @@ 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_keyring_required_version], [0.4.5]) -m4_define([gnome_print_required_version], [2.10.0]) AC_INIT([GIMP], [gimp_version], @@ -1254,31 +1253,6 @@ if test "x$have_gnome_keyring" = 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, - have_gnomeprint="no (libgnomeprintui not found!)") -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 libwmf2 ################### @@ -1479,15 +1453,11 @@ AM_CONDITIONAL(BUILD_PYTHON, test "x$enable_python" != xno) # Some plug-ins don't build on Win32, others are Win32-only ########################################################### -if test x"$os_win32" = xyes; then - WINPRINT='winprint$(EXEEXT)' -else +if test x"$os_win32" = xno; then MAIL='mail$(EXEEXT)' fi AC_SUBST(MAIL) -AC_SUBST(WINPRINT) -AC_SUBST(WMF) ############################################################ @@ -1856,7 +1826,6 @@ Extra Binaries: Optional Plug-Ins: Ascii Art: $have_libaa Help Browser: $have_gtkhtml2 - GNOME Print: $have_gnomeprint JPEG: $jpeg_ok MNG: $have_libmng PDF: $have_poppler @@ -1866,7 +1835,6 @@ Optional Plug-Ins: TIFF: $have_libtiff MacOS X TWAIN: $mac_twain_ok URI: $uri_plugin - Win Print: $os_win32 Win Snap: $os_win32 WMF: $have_libwmf XJT: $have_xjt diff --git a/plug-ins/common/.cvsignore b/plug-ins/common/.cvsignore index efec7aec9e..7b0f9b7c00 100644 --- a/plug-ins/common/.cvsignore +++ b/plug-ins/common/.cvsignore @@ -58,7 +58,6 @@ gifload gih glasstile glob -gnomeprint gqbist gradmap grid @@ -141,7 +140,6 @@ waves webbrowser whirlpinch wind -winprint wmf xbm xpm diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am index 4f350f7ca1..2d81fe0ea2 100644 --- a/plug-ins/common/Makefile.am +++ b/plug-ins/common/Makefile.am @@ -90,7 +90,6 @@ libexec_PROGRAMS = \ gih \ glasstile \ glob \ - $(GNOMEPRINT) \ gqbist \ gradmap \ grid \ @@ -173,7 +172,6 @@ libexec_PROGRAMS = \ webbrowser \ whirlpinch \ wind \ - $(WINPRINT) \ $(WMF) \ xbm \ $(XPM) \ @@ -182,7 +180,6 @@ libexec_PROGRAMS = \ EXTRA_PROGRAMS = \ aa \ - gnomeprint \ mail \ mng \ png \ @@ -190,7 +187,6 @@ EXTRA_PROGRAMS = \ psp \ svg \ tiff \ - winprint \ wmf \ xpm @@ -1020,24 +1016,6 @@ 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 @@ -2260,22 +2238,6 @@ wind_LDADD = \ $(RT_LIBS) \ $(INTLLIBS) -winprint_SOURCES = \ - winprint.c - -winprint_LDADD = \ - $(libgimpui) \ - $(libgimpconfig) \ - $(libgimpwidgets) \ - $(libgimp) \ - $(libgimpcolor) \ - $(libgimpmath) \ - $(libgimpbase) \ - $(LIBWINPRINT) \ - $(GLIB_LIBS) \ - $(RT_LIBS) \ - $(INTLLIBS) - wmf_CFLAGS = $(WMF_CFLAGS) wmf_SOURCES = \ diff --git a/plug-ins/common/gnomeprint.c b/plug-ins/common/gnomeprint.c deleted file mode 100644 index 06c1ea4e56..0000000000 --- a/plug-ins/common/gnomeprint.c +++ /dev/null @@ -1,399 +0,0 @@ -/* 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 - -#include -#include - -#include -#include - -#include -#include - -#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); - - -const GimpPlugInInfo PLUG_IN_INFO = -{ - NULL, /* init_proc */ - NULL, /* quit_proc */ - query, /* query_proc */ - run, /* run_proc */ -}; - - -MAIN () - -static void -query (void) -{ - static const 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, - N_("Print the image using the GNOME Print system"), - "FIXME: write help", - "Sven Neumann ", - "Sven Neumann ", - "2005", - N_("_GNOME Print..."), - "GRAY, RGB*", - GIMP_PLUGIN, - G_N_ELEMENTS (print_args), 0, - print_args, NULL); - - gimp_plugin_menu_register (PROC_NAME, "/File/Send"); - gimp_plugin_icon_register (PROC_NAME, GIMP_ICON_TYPE_STOCK_ID, - (const guint8 *) 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, - (const guchar *) - _("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; - gdouble r1, r2; - - width = drawable->width; - height = drawable->height; - rowstride = width * drawable->bpp; - pixels = g_new (guchar, height * rowstride); - - gimp_pixel_rgn_init (®ion, drawable, 0, 0, width, height, FALSE, FALSE); - - gimp_pixel_rgn_get_rect (®ion, 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); - - r1 = scale_x / width; - r2 = scale_y / height; - - if (r2 > r1) - { - trans_y += scale_y * (1 - r1 / r2) / 2; - scale_y *= r1 / r2; - } - else - { - trans_x += scale_x * (1 - r2 / r1) / 2; - scale_x *= r2 / r1; - } - - gnome_print_gsave (context); - gnome_print_translate (context, trans_x, trans_y); - gnome_print_scale (context, scale_x, scale_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; - const 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, - (const guchar *) GNOME_PRINT_KEY_PAPER_WIDTH, - &paper_width, &unit); - gnome_print_convert_distance (&paper_width, unit, base); - - gnome_print_config_get_length (config, - (const guchar *) GNOME_PRINT_KEY_PAPER_HEIGHT, - &paper_height, &unit); - gnome_print_convert_distance (&paper_height, unit, base); - - gnome_print_config_get_length (config, - (const guchar *) GNOME_PRINT_KEY_PAPER_MARGIN_BOTTOM, - &margin_bottom, &unit); - gnome_print_convert_distance (&margin_bottom, unit, base); - - gnome_print_config_get_length (config, - (const guchar *) GNOME_PRINT_KEY_PAPER_MARGIN_TOP, - &margin_top, &unit); - gnome_print_convert_distance (&margin_top, unit, base); - - gnome_print_config_get_length (config, - (const guchar *) GNOME_PRINT_KEY_PAPER_MARGIN_LEFT, - &margin_left, &unit); - gnome_print_convert_distance (&margin_left, unit, base); - - gnome_print_config_get_length (config, - (const guchar *) GNOME_PRINT_KEY_PAPER_MARGIN_RIGHT, - &margin_right, &unit); - gnome_print_convert_distance (&margin_right, unit, base); - - paper_width -= margin_left + margin_right; - paper_height -= margin_top + margin_left; - - *scale_x = paper_width; - *scale_y = paper_height; - *trans_x = margin_left; - *trans_y = margin_bottom; -} diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl index ea8870b526..6e32c3077f 100644 --- a/plug-ins/common/plugin-defs.pl +++ b/plug-ins/common/plugin-defs.pl @@ -55,7 +55,6 @@ '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 }, @@ -138,7 +137,6 @@ 'webbrowser' => { libdep => 'glib' }, 'whirlpinch' => { libdep => 'gtk', ui => 1 }, 'wind' => { libdep => 'gtk', ui => 1 }, - 'winprint' => { libdep => 'glib', ui => 1, optional => 1 }, 'wmf' => { libdep => 'gtk', ui => 1, optional => 1, cflags => 1 }, 'xbm' => { libdep => 'gtk', ui => 1 }, 'xpm' => { libdep => 'gtk', ui => 1, optional => 1 }, diff --git a/plug-ins/common/winprint.c b/plug-ins/common/winprint.c deleted file mode 100644 index 5a930e36f5..0000000000 --- a/plug-ins/common/winprint.c +++ /dev/null @@ -1,727 +0,0 @@ -/* Print plug-in for the GIMP on Windows. - * Copyright 1999 Tor Lillqvist - * - * 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. - */ - -/* - * TODO: - * - * Own dialog box, with similar options as the Unix print plug-in? - * (at least those that aren't already covered in the Windows standard - * page setup and/or print dialogs): - * - brighness and gamma adjustment - * - scaling - * - image placement on paper (at least centering should be offered) - * - * Speed up the StretchBlt'ing. Now we StretchBlt one pixel row at - * a time, and in pieces. Quite ad hoc. - * - * Handle the file_print procedure's parameters as much as possible - * like the print plug-in does. (They are currently cheerfully ignored.) - * - * Etc. - */ - -#include "config.h" - -#include -#include - -#include - -#include "libgimp/stdplugins-intl.h" - - -#define PRINT_PROC "file-print" -#define PAGE_SETUP_PROC "file-page-setup" - -#define PING() g_message ("%s: %d", __FILE__, __LINE__) - -static struct -{ - PRINTDLG prDlg; - PAGESETUPDLG psDlg; - int devmodeSize; -} vars = -{ - { 0, }, - { 0, }, - 0 -}; - -/* These two functions lifted from the print plug-in and modified - * to build BGR format pixel rows. - */ - -static void -indexed_to_bgr(guchar *indexed, - guchar *bgrout, - int width, - int bpp, - guchar *cmap, - int ncolours) -{ - if (bpp == 1) - { - /* No alpha in image. */ - - while (width > 0) - { - bgrout[2] = cmap[*indexed * 3 + 0]; - bgrout[1] = cmap[*indexed * 3 + 1]; - bgrout[0] = cmap[*indexed * 3 + 2]; - bgrout += 3; - indexed ++; - width --; - } - } - else - { - /* Indexed alpha image. */ - - while (width > 0) - { - bgrout[2] = cmap[indexed[0] * 3 + 0] * indexed[1] / 255 + - 255 - indexed[1]; - bgrout[1] = cmap[indexed[0] * 3 + 1] * indexed[1] / 255 + - 255 - indexed[1]; - bgrout[0] = cmap[indexed[0] * 3 + 2] * indexed[1] / 255 + - 255 - indexed[1]; - bgrout += 3; - indexed += bpp; - width --; - } - } -} - -static void -gray_to_bgr(guchar *indexed, - guchar *bgrout, - int width, - int bpp, - guchar *cmap, - int ncolours) -{ - if (bpp == 1) - { - /* No alpha in image. */ - - while (width > 0) - { - bgrout[2] = - bgrout[1] = - bgrout[0] = *indexed; /* identity */ - bgrout += 3; - indexed ++; - width --; - } - } - else - { - /* Indexed alpha image. */ - - while (width > 0) - { - bgrout[2] = - bgrout[1] = - bgrout[0] = indexed[0] * indexed[1] / 255 + 255 - indexed[1]; - bgrout += 3; - indexed += bpp; - width --; - } - } -} - -static void -rgb_to_bgr(guchar *rgbin, - guchar *bgrout, - int width, - int bpp, - guchar *cmap, - int ncolours) - -{ - if (bpp == 3) - { - /* No alpha in image. */ - - while (width > 0) - { - bgrout[2] = rgbin[0]; - bgrout[1] = rgbin[1]; - bgrout[0] = rgbin[2]; - rgbin += 3; - bgrout += 3; - width --; - } - } - else - { - /* RGBA image. */ - - while (width > 0) - { - bgrout[2] = rgbin[0] * rgbin[3] / 255 + 255 - rgbin[3]; - bgrout[1] = rgbin[1] * rgbin[3] / 255 + 255 - rgbin[3]; - bgrout[0] = rgbin[2] * rgbin[3] / 255 + 255 - rgbin[3]; - rgbin += bpp; - bgrout += 3; - width --; - } - } -} - -/* Respond to a plug-in query. */ - -static void -query (void) -{ - static const GimpParamDef print_args[] = - { - { GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" }, - { GIMP_PDB_IMAGE, "image", "Input image" }, - { GIMP_PDB_DRAWABLE, "drawable", "Input drawable" }, - { GIMP_PDB_STRING, "printer", "Printer" }, - { GIMP_PDB_STRING, "ppd_file", "PPD file" }, - { GIMP_PDB_INT32, "output_type", "Output type (0 = gray, 1 = color)" }, - { GIMP_PDB_STRING, "resolution", "Resolution (\"300\", \"720\", etc.)" }, - { GIMP_PDB_STRING, "media_size", "Media size (\"Letter\", \"A4\", etc.)" }, - { GIMP_PDB_STRING, "media_type", "Media type (\"Plain\", \"Glossy\", etc.)" }, - { GIMP_PDB_STRING, "media_source", "Media source (\"Tray1\", \"Manual\", etc.)" }, - { GIMP_PDB_INT32, "brightness", "Brightness (0-200%)" }, - { GIMP_PDB_FLOAT, "scaling", "Output scaling (0-100%, -PPI)" }, - { GIMP_PDB_INT32, "orientation", "Output orientation (-1 = auto, 0 = portrait, 1 = landscape)" }, - { GIMP_PDB_INT32, "left", "Left offset (points, -1 = centered)" }, - { GIMP_PDB_INT32, "top", "Top offset (points, -1 = centered)" } - }; - - static const GimpParamDef pagesetup_args[] = - { - { GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" }, - { GIMP_PDB_IMAGE, "image", "Input image" }, - { GIMP_PDB_DRAWABLE, "drawable", "Input drawable" } - }; - - gimp_install_procedure (PRINT_PROC, - N_("Print the image"), - "Prints images to any printer recognized by Windows.", - "Tor Lillqvist ", - "Copyright 1999 Tor Lillqvist", - "$Id$", - N_("_Print..."), - "RGB*,GRAY*,INDEXED*", - GIMP_PLUGIN, - G_N_ELEMENTS (print_args), 0, - print_args, NULL); - - gimp_install_procedure (PAGE_SETUP_PROC, - N_("Set up page layout for printing"), - "Sets up the page parameters for printing to a Windows printer.", - "Tor Lillqvist ", - "Copyright 1999 Tor Lillqvist", - "$Id$", - N_("Page Setup"), - "RGB*,GRAY*,INDEXED*", - GIMP_PLUGIN, - G_N_ELEMENTS (pagesetup_args), 0, - pagesetup_args, NULL); - - gimp_plugin_menu_register (PRINT_PROC, "/File/Send"); - gimp_plugin_menu_register (PAGE_SETUP_PROC, "/File/Send"); -} - -/* - * 'run()' - Run the plug-in... - */ - -static void -run (const gchar *name, - gint nparams, - const GimpParam *param, - gint *nreturn_vals, - GimpParam **return_vals) -{ - GimpDrawable *drawable; - GimpRunMode run_mode; - GimpPDBStatusType status = GIMP_PDB_SUCCESS; - GimpParam *values; - GimpPixelRgn rgn; - guchar *cmap = NULL; /* Colourmap (indexed images only) */ - DEVMODE *dmp; - int ncolours; - int width, height; - int devWidth, devHeight; - int y; - double devY, devYstep; - int iDevY, iDevYstep; - int iDevLeftMargin, iDevTopMargin; - guchar *inRow; - guchar *bgrRow; - HGLOBAL hDevMode, hDevNames; - DOCINFO docInfo; - double devResX, devResY; - double imgResX, imgResY; - HDC hdcMem; - HBITMAP hBitmap; - HANDLE oldBm; - BITMAPV4HEADER bmHeader; - - INIT_I18N (); - - run_mode = param[0].data.d_int32; - - values = g_new(GimpParam, 1); - - values[0].type = GIMP_PDB_STATUS; - - *nreturn_vals = 1; - *return_vals = values; - - hDevMode = NULL; - hDevNames = NULL; - - drawable = gimp_drawable_get(param[2].data.d_drawable); - - width = drawable->width; - height = drawable->height; - - if (strcmp (name, PRINT_PROC) == 0) - { - switch (run_mode) - { - case GIMP_RUN_INTERACTIVE: - if (gimp_get_data_size (PRINT_PROC) > 0) - { - g_assert (gimp_get_data_size (PRINT_PROC) == sizeof (vars)); - gimp_get_data (PRINT_PROC, &vars); - if (vars.devmodeSize > 0) - { - /* Restore saved DEVMODE. */ - g_assert (gimp_get_data_size (PRINT_PROC "devmode") - == vars.devmodeSize); - hDevMode = GlobalAlloc (GMEM_MOVEABLE, vars.devmodeSize); - g_assert (hDevMode != NULL); - dmp = GlobalLock (hDevMode); - g_assert (dmp != NULL); - gimp_get_data (PRINT_PROC "devmode", dmp); - GlobalUnlock (hDevMode); - vars.prDlg.hDevMode = hDevMode; - } - else - { - vars.prDlg.hDevMode = NULL; - } - } - else - vars.prDlg.Flags = 0; - vars.prDlg.hwndOwner = NULL; - vars.prDlg.hDevNames = NULL; - vars.prDlg.Flags |= - PD_RETURNDC | PD_DISABLEPRINTTOFILE | PD_HIDEPRINTTOFILE - | PD_NOSELECTION; - vars.prDlg.nMinPage = vars.prDlg.nMaxPage = 0; - vars.prDlg.nCopies = 1; - vars.prDlg.lStructSize = sizeof (PRINTDLG); - if (!PrintDlg (&vars.prDlg)) - { - if (CommDlgExtendedError ()) - g_message (_("PrintDlg failed: %d"), - CommDlgExtendedError ()); - status = GIMP_PDB_EXECUTION_ERROR; - break; - } - hDevMode = vars.prDlg.hDevMode; - hDevNames = vars.prDlg.hDevNames; - break; - - case GIMP_RUN_NONINTERACTIVE: - if (nparams >= 3) /* Printer name? */ - { - - } - if (nparams >= 5) /* PPD file */ - { - /* Ignored */ - } - status = GIMP_PDB_EXECUTION_ERROR; - break; - - default: - status = GIMP_PDB_CALLING_ERROR; - break; - } - - /* - * Print the image. - */ - - if (status == GIMP_PDB_SUCCESS) - { - /* Check if support for BitBlt */ - if (!(GetDeviceCaps(vars.prDlg.hDC, RASTERCAPS) & RC_BITBLT)) - { - status = GIMP_PDB_EXECUTION_ERROR; - g_message (_("Printer doesn't support bitmaps")); - } - } - - if (status == GIMP_PDB_SUCCESS) - { - /* Set the tile cache size. */ - - if (height > width) - gimp_tile_cache_ntiles((drawable->height + gimp_tile_width() - 1) / - gimp_tile_width() + 1); - else - gimp_tile_cache_ntiles((width + gimp_tile_width() - 1) / - gimp_tile_width() + 1); - - /* Is the image indexed? If so we need the colourmap. */ - - if (gimp_image_base_type(param[1].data.d_image) == GIMP_INDEXED) - cmap = gimp_image_get_colormap(param[1].data.d_image, &ncolours); - else if (gimp_image_base_type(param[1].data.d_image) == GIMP_GRAY) - ncolours = 256; - else - ncolours = 0; - - /* Start print job. */ - docInfo.cbSize = sizeof (DOCINFO); - docInfo.lpszDocName = gimp_image_get_name (param[1].data.d_image); - docInfo.lpszOutput = NULL; - docInfo.lpszDatatype = NULL; - docInfo.fwType = 0; - - if (StartDoc (vars.prDlg.hDC, &docInfo) == SP_ERROR) - status = GIMP_PDB_EXECUTION_ERROR; - } - - if (status == GIMP_PDB_SUCCESS) - { - /* Prepare printer to accept a page. */ - if (StartPage (vars.prDlg.hDC) <= 0) - { - status = GIMP_PDB_EXECUTION_ERROR; - g_message (_("StartPage failed")); - AbortDoc (vars.prDlg.hDC); - } - } - - /* Actually print. */ - - if (status == GIMP_PDB_SUCCESS) - { - gimp_progress_init(_("Printing")); - - gimp_pixel_rgn_init(&rgn, drawable, 0, 0, - width, height, - FALSE, FALSE); - - inRow = g_malloc (width * drawable->bpp); - - hdcMem = CreateCompatibleDC (vars.prDlg.hDC); - - bmHeader.bV4Size = sizeof (BITMAPV4HEADER); - bmHeader.bV4Width = width; - bmHeader.bV4Height = -1; - bmHeader.bV4Planes = 1; - bmHeader.bV4BitCount = 24; - bmHeader.bV4V4Compression = BI_RGB; - bmHeader.bV4SizeImage = 0; - bmHeader.bV4XPelsPerMeter = 0; - bmHeader.bV4YPelsPerMeter = 0; - bmHeader.bV4ClrUsed = 0; - bmHeader.bV4ClrImportant = 0; - bmHeader.bV4CSType = 0; - - hBitmap = CreateDIBSection (hdcMem, - (BITMAPINFO *) &bmHeader, - DIB_RGB_COLORS, - (PVOID *) &bgrRow, - NULL, - 0); - if (hBitmap == NULL) - { - status = GIMP_PDB_EXECUTION_ERROR; - g_message (_("CreateDIBSection failed")); - AbortDoc (vars.prDlg.hDC); - } - } - - if (status == GIMP_PDB_SUCCESS) - { - void (*pixel_transfer)(guchar *, guchar *, int, int, guchar *, int); - - if (cmap != NULL) - pixel_transfer = indexed_to_bgr; - else if (ncolours > 0) - pixel_transfer = gray_to_bgr; - else - pixel_transfer = rgb_to_bgr; - - devResX = GetDeviceCaps(vars.prDlg.hDC, LOGPIXELSX); - devResY = GetDeviceCaps(vars.prDlg.hDC, LOGPIXELSY); - gimp_image_get_resolution (param[1].data.d_image, - &imgResX, &imgResY); - - /* Here we assume that the printer's resolution is many - * times higher than the image's. Otherwise we probably - * get strange artefacts from StretchBlt'ing a row at - * a time, if each image row maps to a little over one - * printer row (or even less than one)? - */ - - devWidth = (devResX / imgResX) * width; - devHeight = (devResY / imgResY) * height; - devYstep = (double) devHeight / height; -#if 0 - g_message ("devWidth = %d, devHeight = %d, devYstep = %g", - devWidth, devHeight, devYstep); -#endif - if (!SetStretchBltMode (vars.prDlg.hDC, HALFTONE)) - g_message (_("SetStretchBltMode failed (warning only)")); - - oldBm = SelectObject (hdcMem, hBitmap); - - if (vars.psDlg.Flags & PSD_MARGINS) - if (vars.psDlg.Flags & PSD_INHUNDREDTHSOFMILLIMETERS) - { - /* Hundreths of millimeters */ - iDevLeftMargin = vars.psDlg.rtMargin.left / 2540.0 * devResX; - iDevTopMargin = vars.psDlg.rtMargin.top / 2540.0 * devResY; - } - else - { - /* Thousandths of inches */ - iDevLeftMargin = vars.psDlg.rtMargin.left / 1000.0 * devResX; - iDevTopMargin = vars.psDlg.rtMargin.top / 1000.0 * devResY; - } - else - iDevLeftMargin = iDevTopMargin = 0; - - devY = 0.0; - iDevY = 0; - for (y = 0; y < height; y++) - { - if ((y & 0x0F) == 0) - gimp_progress_update ((double)y / (double)drawable->height); - - gimp_pixel_rgn_get_row (&rgn, inRow, 0, y, width); - - (* pixel_transfer) (inRow, bgrRow, width, drawable->bpp, cmap, ncolours); - iDevYstep = ((int) (devY + devYstep)) - iDevY; - if (iDevYstep > 0) - { - /* StretchBlt seems to fail if we do it in "too large" - * pieces at a time, a least with my printer. - * Arbitrarily limit to 4000 destination columns - * at a time... - */ - int x, iDevX, xstep, iDevXstep; - - iDevX = 0; - x = 0; - iDevXstep = 4000; - xstep = (imgResX / devResX ) * iDevXstep; - while (x <= width) - { - int w, devW; - - if (x + xstep > width) - w = width - x; - else - w = xstep; - if (iDevX + iDevXstep > devWidth) - devW = devWidth - iDevX; - else - devW = iDevXstep; - if (!StretchBlt (vars.prDlg.hDC, - iDevX + iDevLeftMargin, - iDevY + iDevTopMargin, - devW, iDevYstep, - hdcMem, x, 0, w, 1, SRCCOPY)) - { - status = GIMP_PDB_EXECUTION_ERROR; - g_message (_("StretchBlt (hDC, %d, %d, " - "%d, %d, " - "hdcMem, %d, 0, %d, 1, SRCCOPY) " - "failed, error = %d, y = %d"), - iDevX, iDevY, - devW, iDevYstep, - x, w, - GetLastError (), y); - AbortDoc (vars.prDlg.hDC); - break; - } - x += xstep; - iDevX += iDevXstep; - } - } - devY += devYstep; - iDevY += iDevYstep; - } - - SelectObject (hdcMem, oldBm); - DeleteObject (hBitmap); - gimp_progress_update (1.0); - } - - if (status == GIMP_PDB_SUCCESS) - { - if (EndPage (vars.prDlg.hDC) <= 0) - { - status = GIMP_PDB_EXECUTION_ERROR; - g_message (_("EndPage failed")); - EndDoc (vars.prDlg.hDC); - } - } - - if (status == GIMP_PDB_SUCCESS) - { - EndDoc (vars.prDlg.hDC); - } - - DeleteDC (vars.prDlg.hDC); - } - else if (strcmp (name, PAGE_SETUP_PROC) == 0) - { - switch (run_mode) - { - case GIMP_RUN_INTERACTIVE: - if (gimp_get_data_size (PRINT_PROC) > 0) - { - g_assert (gimp_get_data_size (PRINT_PROC) == sizeof (vars)); - gimp_get_data (PRINT_PROC, &vars); - if (vars.devmodeSize > 0) - { - /* Restore saved DEVMODE. */ - g_assert (gimp_get_data_size (PRINT_PROC "devmode") - == vars.devmodeSize); - hDevMode = GlobalAlloc (GMEM_MOVEABLE, vars.devmodeSize); - g_assert (hDevMode != NULL); - dmp = GlobalLock (hDevMode); - g_assert (dmp != NULL); - gimp_get_data (PRINT_PROC "devmode", dmp); - GlobalUnlock (hDevMode); - vars.psDlg.hDevMode = hDevMode; - } - else - { - vars.psDlg.hDevMode = NULL; - } - } - else - vars.psDlg.Flags = 0; - vars.psDlg.hwndOwner = NULL; - vars.psDlg.hDevNames = NULL; - vars.psDlg.lStructSize = sizeof (PAGESETUPDLG); - if (!PageSetupDlg (&vars.psDlg)) - { - if (CommDlgExtendedError ()) - g_message (_("PageSetupDlg failed: %d"), - CommDlgExtendedError ()); - status = GIMP_PDB_EXECUTION_ERROR; - break; - } - vars.psDlg.Flags |= PSD_MARGINS; - hDevMode = vars.psDlg.hDevMode; - hDevNames = vars.psDlg.hDevNames; - break; - - default: - status = GIMP_PDB_CALLING_ERROR; - break; - } - } - else - status = GIMP_PDB_CALLING_ERROR; - - - /* Store data. */ - if (status == GIMP_PDB_SUCCESS && run_mode == GIMP_RUN_INTERACTIVE) - { - /* Save DEVMODE */ - dmp = GlobalLock (hDevMode); - vars.devmodeSize = dmp->dmSize + dmp->dmDriverExtra; -#if 0 - g_message("vars.devmodeSize = %d, DeviceName = %.*s, Orientation = %s, PaperSize = %s, " - "Scale = %d%%, Copies = %d, PrintQuality = %s, " - "%s, ICMMethod = %s, ICMIntent = %s, MediaType = %s, " - "DitherType = %s", - vars.devmodeSize, - CCHDEVICENAME, dmp->dmDeviceName, - (dmp->dmOrientation == DMORIENT_PORTRAIT ? "PORTRAIT" : - (dmp->dmOrientation == DMORIENT_LANDSCAPE ? "LANDSCAPE" : - "?")), - (dmp->dmPaperSize == DMPAPER_LETTER ? "LETTER" : - (dmp->dmPaperSize == DMPAPER_LEGAL ? "LEGAL" : - (dmp->dmPaperSize == DMPAPER_A3 ? "A3" : - (dmp->dmPaperSize == DMPAPER_A4 ? "A4" : - "?")))) - , - dmp->dmScale, dmp->dmCopies, - (dmp->dmPrintQuality == DMRES_HIGH ? "HIGH" : - (dmp->dmPrintQuality == DMRES_MEDIUM ? "MEDIUM" : - (dmp->dmPrintQuality == DMRES_LOW ? "LOW" : - (dmp->dmPrintQuality == DMRES_DRAFT ? "DRAFT" : - "?")))), - (dmp->dmColor == DMCOLOR_COLOR ? "COLOR" : - (dmp->dmColor == DMCOLOR_MONOCHROME ? "MONOCHROME" : - "?")), - (dmp->dmICMMethod == DMICMMETHOD_NONE ? "NONE" : - (dmp->dmICMMethod == DMICMMETHOD_SYSTEM ? "SYSTEM" : - (dmp->dmICMMethod == DMICMMETHOD_DRIVER ? "DRIVER" : - (dmp->dmICMMethod == DMICMMETHOD_DEVICE ? "DEVICE" : - "?")))), - (dmp->dmICMIntent == DMICM_CONTRAST ? "CONTRAST" : - (dmp->dmICMIntent == DMICM_SATURATE ? "SATURATE" : - "?")), - (dmp->dmMediaType == DMMEDIA_STANDARD ? "STANDARD" : - (dmp->dmMediaType == DMMEDIA_GLOSSY ? "GLOSSY" : - (dmp->dmMediaType == DMMEDIA_TRANSPARENCY ? "TRANSPARENCY" : - "?"))), - (dmp->dmDitherType == DMDITHER_NONE ? "NONE" : - (dmp->dmDitherType == DMDITHER_COARSE ? "COARSE" : - (dmp->dmDitherType == DMDITHER_FINE ? "FINE" : - (dmp->dmDitherType == DMDITHER_LINEART ? "LINEART" : - (dmp->dmDitherType == DMDITHER_ERRORDIFFUSION ? "ERRORDIFFUSION" : - (dmp->dmDitherType == DMDITHER_GRAYSCALE ? "GRAYSCALE" : - - "?"))))))); -#endif - gimp_set_data (PRINT_PROC "devmode", dmp, vars.devmodeSize); - GlobalUnlock (hDevMode); - gimp_set_data (PRINT_PROC, &vars, sizeof(vars)); - } - - if (hDevMode != NULL) - GlobalFree (hDevMode); - if (hDevNames != NULL) - GlobalFree (hDevNames); - - values[0].data.d_status = status; - gimp_drawable_detach(drawable); -} - -const GimpPlugInInfo PLUG_IN_INFO = /* Plug-in information */ -{ - NULL, /* init_proc */ - NULL, /* quit_proc */ - query, /* query_proc */ - run, /* run_proc */ -}; - -MAIN () diff --git a/po-plug-ins/ChangeLog b/po-plug-ins/ChangeLog index e07e394b8e..df6fbf66a4 100644 --- a/po-plug-ins/ChangeLog +++ b/po-plug-ins/ChangeLog @@ -1,6 +1,7 @@ 2006-06-20 Sven Neumann - * POTFILES.in: added desktop-link.c, removed print plug-in. + * POTFILES.in: added desktop-link plug-in, removed print, gnomeprint + and winprint plug-ins. 2006-06-20 Jakub Friedl diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in index 922971214c..2a2ff6a469 100644 --- a/po-plug-ins/POTFILES.in +++ b/po-plug-ins/POTFILES.in @@ -70,7 +70,6 @@ plug-ins/common/gifload.c plug-ins/common/gih.c plug-ins/common/gih.c plug-ins/common/glasstile.c -plug-ins/common/gnomeprint.c plug-ins/common/gqbist.c plug-ins/common/gradmap.c plug-ins/common/grid.c @@ -153,7 +152,6 @@ plug-ins/common/waves.c plug-ins/common/webbrowser.c plug-ins/common/whirlpinch.c plug-ins/common/wind.c -plug-ins/common/winprint.c plug-ins/common/wmf.c plug-ins/common/xbm.c plug-ins/common/xpm.c