mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-19 14:23:33 +00:00
a fresh snapshot of the CVS version from sourceforge. Added new files
2000-10-04 Michael Natterer <mitch@gimp.org> * plug-ins/print/*: a fresh snapshot of the CVS version from sourceforge. Added new files "AUTHORS" and "print-intl.h". The files are identical now (no need any more to add stuff like #include "config.h" to make them work in the GIMP tree).
This commit is contained in:
parent
3c78ed33c3
commit
f0beebbf36
|
@ -1,3 +1,11 @@
|
|||
2000-10-04 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* plug-ins/print/*: a fresh snapshot of the CVS version from
|
||||
sourceforge. Added new files "AUTHORS" and "print-intl.h".
|
||||
|
||||
The files are identical now (no need any more to add stuff like
|
||||
#include "config.h" to make them work in the GIMP tree).
|
||||
|
||||
2000-10-03 Simon Budig <simon@gimp.org>
|
||||
|
||||
* tools/gimppath2svg.py: New file: Script to convert an exported
|
||||
|
|
75
plug-ins/print/AUTHORS
Normal file
75
plug-ins/print/AUTHORS
Normal file
|
@ -0,0 +1,75 @@
|
|||
The original version, up to release 2.0, of the Gimp Print plug-in was
|
||||
written by Mike Sweet <mike@easysw.com>.
|
||||
|
||||
Version 3.0, which is based on version 2, was written by Robert
|
||||
Krawitz <rlk@alum.mit.edu> in late 1999, and frozen in early 2000.
|
||||
|
||||
Version 4.0 was developed by a team led by Robert Krawitz. We hosted
|
||||
the development on SourceForge, a service provided to the free source
|
||||
community by VA Linux Systems. The complete hosting service provided
|
||||
by SourceForge permitted the development team to concentrate on
|
||||
improving the software rather than having to worry about maintaining a
|
||||
development system.
|
||||
|
||||
The list of contributors to release 4.0, in alphabetical order, is as
|
||||
follows. The principal areas that each contributed to are listed in
|
||||
addition.
|
||||
|
||||
Andy Thaller <thaller@ph.tum.de>
|
||||
Canon driver
|
||||
|
||||
Charles Briscoe-Smith <cpbs@debian.org>
|
||||
Epson driver
|
||||
Internals
|
||||
UI
|
||||
|
||||
Dave Hill <dave@minnie.demon.co.uk>
|
||||
PCL driver
|
||||
|
||||
Eric Sharkey <sharkey@ale.physics.sunysb.edu>
|
||||
Debian support
|
||||
Epson unprinter
|
||||
|
||||
Eugene Anikin <eugene@anikin.com>
|
||||
Performance instrumentation
|
||||
Sharp-eyed bug fixer
|
||||
|
||||
Grant Taylor <gtaylor@picante.com>
|
||||
Implementor of the "foomatic" spooler configuration system
|
||||
|
||||
Henryk "Buggs" Richter <tfa652@cks1.rz.uni-rostock.de>
|
||||
Initial implementation of the Ghostscript driver
|
||||
|
||||
Ian Young <ian@iay.org.uk>
|
||||
Documentation of the Epson driver
|
||||
Experimental inks/color management
|
||||
|
||||
Jean-Marc Verbavatz <verbavatz@ifrance.fr>
|
||||
Dithering and color management
|
||||
|
||||
Karl Heinz Kremer <khk@khk.net>
|
||||
Liaison with Epson
|
||||
Engineering and design
|
||||
|
||||
Michael Natterer <mitschel@cs.tu-berlin.de>
|
||||
New user interface
|
||||
Liaison with the Gimp development team
|
||||
|
||||
Mike Sweet <mike@easysw.com>
|
||||
CUPS work
|
||||
Portability
|
||||
Lots o'details
|
||||
|
||||
Robert Krawitz <rlk@alum.mit.edu>
|
||||
Epson driver
|
||||
Dithering and color management
|
||||
User interface
|
||||
Engineering/Project lead
|
||||
Documentation
|
||||
Ghostscript driver
|
||||
|
||||
Steve Miller <smiller@rni.net>
|
||||
User interface
|
||||
|
||||
Thomas Tonino <ttonino@bio.vu.nl>
|
||||
Vastly improved dithering and color management
|
|
@ -22,18 +22,20 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "print_gimp.h"
|
||||
|
||||
#ifndef GIMP_1_0
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
#include "print-intl.h"
|
||||
|
||||
extern vars_t vars;
|
||||
extern gint plist_count; /* Number of system printers */
|
||||
extern gint plist_current; /* Current system printer */
|
||||
extern plist_t *plist; /* System printers */
|
||||
extern plist_t *plist; /* System printers */
|
||||
|
||||
GtkWidget *gimp_color_adjust_dialog;
|
||||
|
||||
|
@ -41,27 +43,77 @@ static GtkObject *brightness_adjustment;
|
|||
static GtkObject *saturation_adjustment;
|
||||
static GtkObject *density_adjustment;
|
||||
static GtkObject *contrast_adjustment;
|
||||
static GtkObject *red_adjustment;
|
||||
static GtkObject *green_adjustment;
|
||||
static GtkObject *blue_adjustment;
|
||||
static GtkObject *cyan_adjustment;
|
||||
static GtkObject *magenta_adjustment;
|
||||
static GtkObject *yellow_adjustment;
|
||||
static GtkObject *gamma_adjustment;
|
||||
|
||||
static GtkWidget *dither_algo_button = NULL;
|
||||
static GtkWidget *dither_algo_menu = NULL;
|
||||
GtkWidget *dither_algo_combo = NULL;
|
||||
static gint dither_algo_callback_id = -1;
|
||||
|
||||
static void gimp_brightness_update (GtkAdjustment *adjustment);
|
||||
static void gimp_saturation_update (GtkAdjustment *adjustment);
|
||||
static void gimp_density_update (GtkAdjustment *adjustment);
|
||||
static void gimp_contrast_update (GtkAdjustment *adjustment);
|
||||
static void gimp_red_update (GtkAdjustment *adjustment);
|
||||
static void gimp_green_update (GtkAdjustment *adjustment);
|
||||
static void gimp_blue_update (GtkAdjustment *adjustment);
|
||||
static void gimp_gamma_update (GtkAdjustment *adjustment);
|
||||
static void gimp_brightness_update (GtkAdjustment *adjustment);
|
||||
static void gimp_saturation_update (GtkAdjustment *adjustment);
|
||||
static void gimp_density_update (GtkAdjustment *adjustment);
|
||||
static void gimp_contrast_update (GtkAdjustment *adjustment);
|
||||
static void gimp_cyan_update (GtkAdjustment *adjustment);
|
||||
static void gimp_magenta_update (GtkAdjustment *adjustment);
|
||||
static void gimp_yellow_update (GtkAdjustment *adjustment);
|
||||
static void gimp_gamma_update (GtkAdjustment *adjustment);
|
||||
static void gimp_set_color_defaults (void);
|
||||
|
||||
static void gimp_dither_algo_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void gimp_build_dither_menu (void);
|
||||
|
||||
extern void gimp_update_adjusted_thumbnail (void);
|
||||
extern void gimp_plist_build_combo (GtkWidget *combo,
|
||||
gint num_items,
|
||||
gchar **items,
|
||||
gchar *cur_item,
|
||||
GtkSignalFunc callback,
|
||||
gint *callback_id);
|
||||
|
||||
void gimp_build_dither_combo (void);
|
||||
void gimp_redraw_color_swatch (void);
|
||||
|
||||
static GtkDrawingArea *swatch = NULL;
|
||||
|
||||
#define SWATCH_W (128)
|
||||
#define SWATCH_H (128)
|
||||
|
||||
extern gint thumbnail_w, thumbnail_h, thumbnail_bpp;
|
||||
extern guchar *thumbnail_data;
|
||||
extern gint adjusted_thumbnail_bpp;
|
||||
extern guchar *adjusted_thumbnail_data;
|
||||
|
||||
|
||||
void
|
||||
gimp_redraw_color_swatch (void)
|
||||
{
|
||||
static GdkGC *gc = NULL;
|
||||
static GdkColormap *cmap;
|
||||
|
||||
if (swatch == NULL || swatch->widget.window == NULL)
|
||||
return;
|
||||
|
||||
#if 0
|
||||
gdk_window_clear (swatch->widget.window);
|
||||
#endif
|
||||
|
||||
if (gc == NULL)
|
||||
{
|
||||
gc = gdk_gc_new (swatch->widget.window);
|
||||
cmap = gtk_widget_get_colormap (GTK_WIDGET(swatch));
|
||||
}
|
||||
|
||||
(adjusted_thumbnail_bpp == 1
|
||||
? gdk_draw_gray_image
|
||||
: gdk_draw_rgb_image) (swatch->widget.window, gc,
|
||||
(SWATCH_W - thumbnail_w) / 2,
|
||||
(SWATCH_H - thumbnail_h) / 2,
|
||||
thumbnail_w, thumbnail_h, GDK_RGB_DITHER_NORMAL,
|
||||
adjusted_thumbnail_data,
|
||||
adjusted_thumbnail_bpp * thumbnail_w);
|
||||
}
|
||||
|
||||
/*
|
||||
* gimp_create_color_adjust_window (void)
|
||||
|
@ -75,38 +127,58 @@ gimp_create_color_adjust_window (void)
|
|||
{
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *table;
|
||||
const vars_t *lower = print_minimum_settings ();
|
||||
const vars_t *upper = print_maximum_settings ();
|
||||
const vars_t *defvars = print_default_settings ();
|
||||
|
||||
gimp_color_adjust_dialog = dialog =
|
||||
gimp_dialog_new (_("Print Color Adjust"), "print",
|
||||
gimp_plugin_help_func, "filters/print.html",
|
||||
gimp_standard_help_func, "filters/print.html",
|
||||
GTK_WIN_POS_MOUSE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Set Defaults"), gimp_set_color_defaults,
|
||||
NULL, NULL, NULL, FALSE, FALSE,
|
||||
_("Close"), gtk_widget_hide,
|
||||
NULL, 1, NULL, TRUE, TRUE,
|
||||
|
||||
NULL);
|
||||
|
||||
table = gtk_table_new (9, 3, FALSE);
|
||||
table = gtk_table_new (10, 3, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), 6);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 1, 6);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 4, 6);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 7, 6);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 2, 6);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 5, 6);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (table), 8, 6);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), table,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
/*
|
||||
* Drawing area for colour swatch feedback display...
|
||||
*/
|
||||
|
||||
swatch = (GtkDrawingArea *) gtk_drawing_area_new ();
|
||||
gtk_drawing_area_size (swatch, SWATCH_W, SWATCH_H);
|
||||
gtk_table_attach (GTK_TABLE (table), GTK_WIDGET (swatch),
|
||||
0, 3, 0, 1, 0, 0, 0, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (swatch), "expose_event",
|
||||
GTK_SIGNAL_FUNC (gimp_redraw_color_swatch),
|
||||
NULL);
|
||||
gtk_widget_show (GTK_WIDGET (swatch));
|
||||
gtk_widget_set_events (GTK_WIDGET (swatch), GDK_EXPOSURE_MASK);
|
||||
|
||||
/*
|
||||
* Brightness slider...
|
||||
*/
|
||||
|
||||
brightness_adjustment =
|
||||
gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
|
||||
gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
|
||||
_("Brightness:"), 200, 0,
|
||||
vars.brightness, 0.0, 400.0, 1.0, 10.0, 0,
|
||||
TRUE, 0, 0,
|
||||
vars.brightness, lower->brightness,
|
||||
upper->brightness, defvars->brightness / 100,
|
||||
defvars->brightness / 10, 3, TRUE, 0, 0,
|
||||
NULL, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (brightness_adjustment), "value_changed",
|
||||
GTK_SIGNAL_FUNC (gimp_brightness_update),
|
||||
|
@ -117,55 +189,59 @@ gimp_create_color_adjust_window (void)
|
|||
*/
|
||||
|
||||
contrast_adjustment =
|
||||
gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
|
||||
gimp_scale_entry_new (GTK_TABLE (table), 0, 2,
|
||||
_("Contrast:"), 200, 0,
|
||||
vars.contrast, 25.0, 400.0, 1.0, 10.0, 0,
|
||||
TRUE, 0, 0,
|
||||
NULL, NULL);
|
||||
vars.contrast, lower->contrast, upper->contrast,
|
||||
defvars->contrast / 100, defvars->contrast / 10,
|
||||
3, TRUE, 0, 0,
|
||||
NULL, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (contrast_adjustment), "value_changed",
|
||||
GTK_SIGNAL_FUNC (gimp_contrast_update),
|
||||
NULL);
|
||||
|
||||
/*
|
||||
* Red slider...
|
||||
* Cyan slider...
|
||||
*/
|
||||
|
||||
red_adjustment =
|
||||
gimp_scale_entry_new (GTK_TABLE (table), 0, 2,
|
||||
_("Red:"), 200, 0,
|
||||
vars.red, 0.0, 200.0, 1.0, 10.0, 0,
|
||||
TRUE, 0, 0,
|
||||
NULL, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (red_adjustment), "value_changed",
|
||||
GTK_SIGNAL_FUNC (gimp_red_update),
|
||||
NULL);
|
||||
|
||||
/*
|
||||
* Green slider...
|
||||
*/
|
||||
|
||||
green_adjustment =
|
||||
cyan_adjustment =
|
||||
gimp_scale_entry_new (GTK_TABLE (table), 0, 3,
|
||||
_("Green:"), 200, 0,
|
||||
vars.green, 0.0, 200.0, 1.0, 10.0, 0,
|
||||
_("Cyan:"), 200, 0,
|
||||
vars.cyan, lower->cyan, upper->cyan,
|
||||
defvars->cyan / 100, defvars->cyan / 10, 3,
|
||||
TRUE, 0, 0,
|
||||
NULL, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (green_adjustment), "value_changed",
|
||||
GTK_SIGNAL_FUNC (gimp_green_update),
|
||||
gtk_signal_connect (GTK_OBJECT (cyan_adjustment), "value_changed",
|
||||
GTK_SIGNAL_FUNC (gimp_cyan_update),
|
||||
NULL);
|
||||
|
||||
/*
|
||||
* Blue slider...
|
||||
* Magenta slider...
|
||||
*/
|
||||
|
||||
blue_adjustment =
|
||||
magenta_adjustment =
|
||||
gimp_scale_entry_new (GTK_TABLE (table), 0, 4,
|
||||
_("Blue:"), 200, 0,
|
||||
vars.blue, 0.0, 200.0, 1.0, 10.0, 0,
|
||||
_("Magenta:"), 200, 0,
|
||||
vars.magenta, lower->magenta, upper->magenta,
|
||||
defvars->magenta / 100, defvars->magenta / 10, 3,
|
||||
TRUE, 0, 0,
|
||||
NULL, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (blue_adjustment), "value_changed",
|
||||
GTK_SIGNAL_FUNC (gimp_blue_update),
|
||||
gtk_signal_connect (GTK_OBJECT (magenta_adjustment), "value_changed",
|
||||
GTK_SIGNAL_FUNC (gimp_magenta_update),
|
||||
NULL);
|
||||
|
||||
/*
|
||||
* Yellow slider...
|
||||
*/
|
||||
|
||||
yellow_adjustment =
|
||||
gimp_scale_entry_new (GTK_TABLE (table), 0, 5,
|
||||
_("Yellow:"), 200, 0,
|
||||
vars.yellow, lower->yellow, upper->yellow,
|
||||
defvars->yellow / 100, defvars->yellow / 10, 3,
|
||||
TRUE, 0, 0,
|
||||
NULL, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (yellow_adjustment), "value_changed",
|
||||
GTK_SIGNAL_FUNC (gimp_yellow_update),
|
||||
NULL);
|
||||
|
||||
/*
|
||||
|
@ -173,9 +249,11 @@ gimp_create_color_adjust_window (void)
|
|||
*/
|
||||
|
||||
saturation_adjustment =
|
||||
gimp_scale_entry_new (GTK_TABLE (table), 0, 5,
|
||||
gimp_scale_entry_new (GTK_TABLE (table), 0, 6,
|
||||
_("Saturation:"), 200, 0,
|
||||
vars.saturation, 0, 10.0, 0.001, 0.01, 3,
|
||||
vars.saturation, lower->saturation,
|
||||
upper->saturation, defvars->saturation / 1000,
|
||||
defvars->saturation / 100, 3,
|
||||
TRUE, 0, 0,
|
||||
NULL, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (saturation_adjustment), "value_changed",
|
||||
|
@ -187,9 +265,11 @@ gimp_create_color_adjust_window (void)
|
|||
*/
|
||||
|
||||
density_adjustment =
|
||||
gimp_scale_entry_new (GTK_TABLE (table), 0, 6,
|
||||
gimp_scale_entry_new (GTK_TABLE (table), 0, 7,
|
||||
_("Density:"), 200, 0,
|
||||
vars.density, 0.1, 3.0, 0.001, 0.01, 3,
|
||||
vars.density, lower->density,
|
||||
upper->density, defvars->density / 1000,
|
||||
defvars->density / 100, 3,
|
||||
TRUE, 0, 0,
|
||||
NULL, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (density_adjustment), "value_changed",
|
||||
|
@ -201,9 +281,11 @@ gimp_create_color_adjust_window (void)
|
|||
*/
|
||||
|
||||
gamma_adjustment =
|
||||
gimp_scale_entry_new (GTK_TABLE (table), 0, 7,
|
||||
gimp_scale_entry_new (GTK_TABLE (table), 0, 8,
|
||||
_("Gamma:"), 200, 0,
|
||||
vars.gamma, 0.1, 4.0, 0.001, 0.01, 3,
|
||||
vars.gamma, lower->gamma,
|
||||
upper->gamma, defvars->gamma / 1000,
|
||||
defvars->gamma / 100, 3,
|
||||
TRUE, 0, 0,
|
||||
NULL, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (gamma_adjustment), "value_changed",
|
||||
|
@ -211,14 +293,14 @@ gimp_create_color_adjust_window (void)
|
|||
NULL);
|
||||
|
||||
/*
|
||||
* Dither algorithm option menu...
|
||||
* Dither algorithm option combo...
|
||||
*/
|
||||
dither_algo_combo = gtk_combo_new ();
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 9,
|
||||
_("Dither Algorithm:"), 1.0, 0.5,
|
||||
dither_algo_combo, 1, TRUE);
|
||||
|
||||
dither_algo_button = gtk_option_menu_new ();
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 8,
|
||||
_("Dither Algorithm:"), 1.0, 0.5,
|
||||
dither_algo_button, 1, TRUE);
|
||||
gimp_build_dither_menu ();
|
||||
gimp_build_dither_combo ();
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -228,6 +310,7 @@ gimp_brightness_update (GtkAdjustment *adjustment)
|
|||
{
|
||||
vars.brightness = adjustment->value;
|
||||
plist[plist_current].v.brightness = adjustment->value;
|
||||
gimp_update_adjusted_thumbnail ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -238,36 +321,40 @@ gimp_contrast_update (GtkAdjustment *adjustment)
|
|||
{
|
||||
vars.contrast = adjustment->value;
|
||||
plist[plist_current].v.contrast = adjustment->value;
|
||||
gimp_update_adjusted_thumbnail ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_red_update (GtkAdjustment *adjustment)
|
||||
gimp_cyan_update (GtkAdjustment *adjustment)
|
||||
{
|
||||
if (vars.red != adjustment->value)
|
||||
if (vars.cyan != adjustment->value)
|
||||
{
|
||||
vars.red = adjustment->value;
|
||||
plist[plist_current].v.red = adjustment->value;
|
||||
vars.cyan = adjustment->value;
|
||||
plist[plist_current].v.cyan = adjustment->value;
|
||||
gimp_update_adjusted_thumbnail ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_green_update (GtkAdjustment *adjustment)
|
||||
gimp_magenta_update (GtkAdjustment *adjustment)
|
||||
{
|
||||
if (vars.green != adjustment->value)
|
||||
if (vars.magenta != adjustment->value)
|
||||
{
|
||||
vars.green = adjustment->value;
|
||||
plist[plist_current].v.green = adjustment->value;
|
||||
vars.magenta = adjustment->value;
|
||||
plist[plist_current].v.magenta = adjustment->value;
|
||||
gimp_update_adjusted_thumbnail ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_blue_update (GtkAdjustment *adjustment)
|
||||
gimp_yellow_update (GtkAdjustment *adjustment)
|
||||
{
|
||||
if (vars.blue != adjustment->value)
|
||||
if (vars.yellow != adjustment->value)
|
||||
{
|
||||
vars.blue = adjustment->value;
|
||||
plist[plist_current].v.blue = adjustment->value;
|
||||
vars.yellow = adjustment->value;
|
||||
plist[plist_current].v.yellow = adjustment->value;
|
||||
gimp_update_adjusted_thumbnail ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -278,6 +365,7 @@ gimp_saturation_update (GtkAdjustment *adjustment)
|
|||
{
|
||||
vars.saturation = adjustment->value;
|
||||
plist[plist_current].v.saturation = adjustment->value;
|
||||
gimp_update_adjusted_thumbnail ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -298,11 +386,12 @@ gimp_gamma_update (GtkAdjustment *adjustment)
|
|||
{
|
||||
vars.gamma = adjustment->value;
|
||||
plist[plist_current].v.gamma = adjustment->value;
|
||||
gimp_update_adjusted_thumbnail ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_do_color_updates(void)
|
||||
gimp_do_color_updates (void)
|
||||
{
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (brightness_adjustment),
|
||||
plist[plist_current].v.brightness);
|
||||
|
@ -313,94 +402,61 @@ gimp_do_color_updates(void)
|
|||
gtk_adjustment_set_value (GTK_ADJUSTMENT (contrast_adjustment),
|
||||
plist[plist_current].v.contrast);
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (red_adjustment),
|
||||
plist[plist_current].v.red);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (cyan_adjustment),
|
||||
plist[plist_current].v.cyan);
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (green_adjustment),
|
||||
plist[plist_current].v.green);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (magenta_adjustment),
|
||||
plist[plist_current].v.magenta);
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (blue_adjustment),
|
||||
plist[plist_current].v.blue);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (yellow_adjustment),
|
||||
plist[plist_current].v.yellow);
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (saturation_adjustment),
|
||||
plist[plist_current].v.saturation);
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (density_adjustment),
|
||||
plist[plist_current].v.density);
|
||||
|
||||
gimp_update_adjusted_thumbnail();
|
||||
}
|
||||
|
||||
void
|
||||
gimp_build_dither_menu (void)
|
||||
gimp_set_color_defaults (void)
|
||||
{
|
||||
GtkWidget *item;
|
||||
GtkWidget *item0 = NULL;
|
||||
gint i;
|
||||
const vars_t *defvars = print_default_settings ();
|
||||
|
||||
if (dither_algo_menu != NULL)
|
||||
{
|
||||
gtk_widget_destroy (dither_algo_menu);
|
||||
dither_algo_menu = NULL;
|
||||
}
|
||||
plist[plist_current].v.brightness = defvars->brightness;
|
||||
plist[plist_current].v.gamma = defvars->gamma;
|
||||
plist[plist_current].v.contrast = defvars->contrast;
|
||||
plist[plist_current].v.cyan = defvars->cyan;
|
||||
plist[plist_current].v.magenta = defvars->magenta;
|
||||
plist[plist_current].v.yellow = defvars->yellow;
|
||||
plist[plist_current].v.saturation = defvars->saturation;
|
||||
plist[plist_current].v.density = defvars->density;
|
||||
|
||||
dither_algo_menu = gtk_menu_new ();
|
||||
gimp_do_color_updates ();
|
||||
}
|
||||
|
||||
if (num_dither_algos == 0)
|
||||
{
|
||||
item = gtk_menu_item_new_with_label (_("Standard"));
|
||||
gtk_menu_append (GTK_MENU (dither_algo_menu), item);
|
||||
gtk_widget_show (item);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (dither_algo_button),
|
||||
dither_algo_menu);
|
||||
gtk_widget_set_sensitive (dither_algo_button, FALSE);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_set_sensitive (dither_algo_button, TRUE);
|
||||
}
|
||||
|
||||
for (i = 0; i < num_dither_algos; i++)
|
||||
{
|
||||
item = gtk_menu_item_new_with_label (gettext (dither_algo_names[i]));
|
||||
if (i == 0)
|
||||
item0 = item;
|
||||
gtk_menu_append (GTK_MENU (dither_algo_menu), item);
|
||||
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
||||
GTK_SIGNAL_FUNC (gimp_dither_algo_callback),
|
||||
(gpointer) i);
|
||||
gtk_widget_show (item);
|
||||
}
|
||||
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (dither_algo_button),
|
||||
dither_algo_menu);
|
||||
|
||||
for (i = 0; i < num_dither_algos; i++)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
g_print ("item[%d] = \'%s\'\n", i, dither_algo_names[i]);
|
||||
#endif /* DEBUG */
|
||||
|
||||
if (strcmp (dither_algo_names[i], plist[plist_current].v.dither_algorithm) == 0)
|
||||
{
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (dither_algo_button), i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == num_dither_algos)
|
||||
{
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (dither_algo_button), 0);
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (item0), "activate");
|
||||
}
|
||||
void
|
||||
gimp_build_dither_combo (void)
|
||||
{
|
||||
gimp_plist_build_combo (dither_algo_combo,
|
||||
num_dither_algos,
|
||||
dither_algo_names,
|
||||
plist[plist_current].v.dither_algorithm,
|
||||
&gimp_dither_algo_callback,
|
||||
&dither_algo_callback_id);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dither_algo_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
strcpy(vars.dither_algorithm, dither_algo_names[(gint) data]);
|
||||
strcpy(plist[plist_current].v.dither_algorithm,
|
||||
dither_algo_names[(gint) data]);
|
||||
const gchar *new_algo =
|
||||
gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (dither_algo_combo)->entry));
|
||||
|
||||
strcpy (vars.dither_algorithm, new_algo);
|
||||
strcpy (plist[plist_current].v.dither_algorithm, new_algo);
|
||||
}
|
||||
|
||||
#endif /* ! GIMP_1_0 */
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -19,18 +19,11 @@
|
|||
* 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.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* canon_parameters() - Return the parameter values for the given
|
||||
* parameter.
|
||||
* canon_imageable_area() - Return the imageable area of the page.
|
||||
* canon_print() - Print an image to a CANON printer.
|
||||
* canon_write() - Send 6-color graphics using compression.
|
||||
*
|
||||
* Revision History:
|
||||
*
|
||||
* See ChangeLog
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file must include only standard C header files. The core code must
|
||||
* compile on generic platforms that don't support glib, gimp, gtk, etc.
|
||||
*/
|
||||
|
||||
|
||||
|
@ -344,12 +337,15 @@ canon_size_type(const vars_t *v, canon_cap_t caps)
|
|||
if (!strcmp(name,"Letter+")) return 0x2a;
|
||||
if (!strcmp(name,"A4+")) return 0x2b;
|
||||
if (!strcmp(name,"Canon 4x2")) return 0x2d;
|
||||
}
|
||||
/* custom */
|
||||
/* custom */
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,"canon: Unknown paper size '%s' - using custom\n",name);
|
||||
fprintf(stderr,"canon: Unknown paper size '%s' - using custom\n",name);
|
||||
} else {
|
||||
fprintf(stderr,"canon: Couldn't look up paper size %dx%d - "
|
||||
"using custom\n",v->page_height, v->page_width);
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -610,9 +606,9 @@ canon_cmd(FILE *prn, /* I - the printer */
|
|||
|
||||
static void
|
||||
canon_init_printer(FILE *prn, canon_cap_t caps,
|
||||
int output_type, char *media_str,
|
||||
int output_type, const char *media_str,
|
||||
const vars_t *v, int print_head,
|
||||
char *source_str,
|
||||
const char *source_str,
|
||||
int xdpi, int ydpi,
|
||||
int page_width, int page_height,
|
||||
int top, int left,
|
||||
|
@ -711,7 +707,7 @@ canon_init_printer(FILE *prn, canon_cap_t caps,
|
|||
|
||||
canon_cmd(prn,ESC5b,0x4b, 2, 0x00,0x0f);
|
||||
if (caps.features & CANON_CAP_CMD61)
|
||||
canon_cmd(prn,ESC5b,0x61, 1, 0x00,0x01);
|
||||
canon_cmd(prn,ESC28,0x61, 1, 0x01);
|
||||
canon_cmd(prn,ESC28,0x62, 1, 0x01);
|
||||
canon_cmd(prn,ESC28,0x71, 1, 0x01);
|
||||
|
||||
|
@ -745,6 +741,20 @@ canon_init_printer(FILE *prn, canon_cap_t caps,
|
|||
canon_cmd(prn,ESC28,0x65, 2, (top >> 8 ),(top & 255));
|
||||
}
|
||||
|
||||
void canon_deinit_printer(FILE *prn, canon_cap_t caps)
|
||||
{
|
||||
/* eject page */
|
||||
fputc(0x0c,prn);
|
||||
|
||||
/* say goodbye */
|
||||
canon_cmd(prn,ESC28,0x62,1,0);
|
||||
if (caps.features & CANON_CAP_CMD61)
|
||||
canon_cmd(prn,ESC28,0x61, 1, 0x00);
|
||||
canon_cmd(prn,ESC40,0,0);
|
||||
fflush(prn);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'alloc_buffer()' allocates buffer and fills it with 0
|
||||
*/
|
||||
|
@ -782,13 +792,13 @@ canon_print(const printer_t *printer, /* I - Model */
|
|||
{
|
||||
unsigned char *cmap = v->cmap;
|
||||
int model = printer->model;
|
||||
char *resolution = v->resolution;
|
||||
char *media_type = v->media_type;
|
||||
char *media_source = v->media_source;
|
||||
const char *resolution = v->resolution;
|
||||
const char *media_type = v->media_type;
|
||||
const char *media_source = v->media_source;
|
||||
int output_type = v->output_type;
|
||||
int orientation = v->orientation;
|
||||
char *ink_type = v->ink_type;
|
||||
float scaling = v->scaling;
|
||||
const char *ink_type = v->ink_type;
|
||||
double scaling = v->scaling;
|
||||
int top = v->top;
|
||||
int left = v->left;
|
||||
int y; /* Looping vars */
|
||||
|
@ -866,8 +876,6 @@ canon_print(const printer_t *printer, /* I - Model */
|
|||
|
||||
if (printhead == 0 || caps.inks == CANON_INK_K)
|
||||
output_type = OUTPUT_GRAY;
|
||||
else if (image_bpp < 3 && cmap == NULL && output_type == OUTPUT_COLOR)
|
||||
output_type = OUTPUT_GRAY_COLOR;
|
||||
|
||||
/*
|
||||
* Choose the correct color conversion function...
|
||||
|
@ -1021,6 +1029,7 @@ canon_print(const printer_t *printer, /* I - Model */
|
|||
lyellow = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,"canon: driver will use colors ");
|
||||
if (cyan) fputc('C',stderr);
|
||||
|
@ -1033,11 +1042,19 @@ canon_print(const printer_t *printer, /* I - Model */
|
|||
fprintf(stderr,"\n");
|
||||
#endif
|
||||
|
||||
nv.density *= ydpi / xdpi;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,"density is %f\n",nv.density);
|
||||
#endif
|
||||
|
||||
nv.density = (nv.density * ydpi) / (xdpi * 1.0);
|
||||
if (nv.density > 1.0)
|
||||
nv.density = 1.0;
|
||||
compute_lut(256, &nv);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,"density is %f\n",nv.density);
|
||||
#endif
|
||||
|
||||
if (xdpi > ydpi)
|
||||
dither = init_dither(image_width, out_width, 1, xdpi / ydpi, &nv);
|
||||
else
|
||||
|
@ -1097,27 +1114,25 @@ canon_print(const printer_t *printer, /* I - Model */
|
|||
|
||||
for (y = 0; y < out_height; y ++)
|
||||
{
|
||||
if ((y & 255) == 0)
|
||||
int duplicate_line = 1;
|
||||
if ((y & 63) == 0)
|
||||
Image_note_progress(image, y, out_height);
|
||||
|
||||
if (errline != errlast)
|
||||
{
|
||||
errlast = errline;
|
||||
duplicate_line = 0;
|
||||
Image_get_row(image, in, errline);
|
||||
(*colorfunc)(in, out, image_width, image_bpp, cmap, &nv);
|
||||
}
|
||||
|
||||
(*colorfunc)(in, out, image_width, image_bpp, cmap, &nv);
|
||||
|
||||
if (output_type == OUTPUT_GRAY)
|
||||
{
|
||||
if (nv.image_type == IMAGE_MONOCHROME)
|
||||
dither_fastblack(out, y, dither, black);
|
||||
else
|
||||
dither_black(out, y, dither, black);
|
||||
} else {
|
||||
dither_cmyk(out, y, dither, cyan, lcyan, magenta, lmagenta,
|
||||
yellow, lyellow, black);
|
||||
}
|
||||
if (nv.image_type == IMAGE_MONOCHROME)
|
||||
dither_monochrome(out, y, dither, black, duplicate_line);
|
||||
else if (output_type == OUTPUT_GRAY)
|
||||
dither_black(out, y, dither, black, duplicate_line);
|
||||
else
|
||||
dither_cmyk(out, y, dither, cyan, lcyan, magenta, lmagenta,
|
||||
yellow, 0, black, duplicate_line);
|
||||
|
||||
#ifdef DEBUG
|
||||
/* fprintf(stderr,","); */
|
||||
|
@ -1208,15 +1223,7 @@ canon_print(const printer_t *printer, /* I - Model */
|
|||
if (lmagenta != NULL) free(lmagenta);
|
||||
if (lyellow != NULL) free(lyellow);
|
||||
|
||||
/* eject page */
|
||||
fputc(0x0c,prn);
|
||||
|
||||
/* say goodbye */
|
||||
canon_cmd(prn,ESC28,0x62,1,0);
|
||||
if (caps.features & CANON_CAP_CMD61)
|
||||
canon_cmd(prn,ESC5b,0x61, 1, 0x00,0x00);
|
||||
canon_cmd(prn,ESC40,0,0);
|
||||
fflush(prn);
|
||||
canon_deinit_printer(prn, caps);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -20,21 +20,15 @@
|
|||
* 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.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* See print.h for prototypes
|
||||
*
|
||||
* Revision History:
|
||||
*
|
||||
* See ChangeLog
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "print_gimp.h"
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
#include "print-intl.h"
|
||||
|
||||
|
||||
/*
|
||||
|
|
6
plug-ins/print/print-intl.h
Normal file
6
plug-ins/print/print-intl.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
#ifndef __PRINT_INTL_H__
|
||||
#define __PRINT_INTL_H__
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
||||
#endif /* __PRINT_INTL_H__ */
|
|
@ -3,8 +3,9 @@
|
|||
*
|
||||
* Print plug-in HP PCL driver for the GIMP.
|
||||
*
|
||||
* Copyright 1997-2000 Michael Sweet (mike@easysw.com) and
|
||||
* Robert Krawitz (rlk@alum.mit.edu)
|
||||
* Copyright 1997-2000 Michael Sweet (mike@easysw.com),
|
||||
* Robert Krawitz (rlk@alum.mit.edu) and
|
||||
* Dave Hill (dave@minnie.demon.co.uk)
|
||||
*
|
||||
* 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
|
||||
|
@ -19,23 +20,11 @@
|
|||
* 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.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* pcl_parameters() - Return the parameter values for the given
|
||||
* parameter.
|
||||
* pcl_imageable_area() - Return the imageable area of the page.
|
||||
* pcl_get_model_capabilities()
|
||||
* - Return the capabilities of the printer.
|
||||
* pcl_convert_media_size()
|
||||
* - Convert media size name into PCL code.
|
||||
* pcl_print() - Print an image to an HP printer.
|
||||
* pcl_mode0() - Send PCL graphics using mode 0 (no) compression.
|
||||
* pcl_mode2() - Send PCL graphics using mode 2 (TIFF) compression.
|
||||
*
|
||||
* Revision History:
|
||||
*
|
||||
* See ChangeLog
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file must include only standard C header files. The core code must
|
||||
* compile on generic platforms that don't support glib, gimp, gtk, etc.
|
||||
*/
|
||||
|
||||
#include "print.h"
|
||||
|
@ -167,6 +156,7 @@ const static pcl_t pcl_media_types[] =
|
|||
|
||||
#define PAPERSOURCE_MOD 16
|
||||
|
||||
#define PCL_PAPERSOURCE_STANDARD 0 /* Don't output code */
|
||||
#define PCL_PAPERSOURCE_MANUAL 2
|
||||
#define PCL_PAPERSOURCE_ENVELOPE 3 /* Not used */
|
||||
|
||||
|
@ -193,6 +183,7 @@ const static pcl_t pcl_media_types[] =
|
|||
|
||||
const static pcl_t pcl_media_sources[] =
|
||||
{
|
||||
{"Standard", PCL_PAPERSOURCE_STANDARD},
|
||||
{"Manual", PCL_PAPERSOURCE_MANUAL},
|
||||
/* {"Envelope", PCL_PAPERSOURCE_ENVELOPE}, */
|
||||
{"Tray 1", PCL_PAPERSOURCE_LJ_TRAY1},
|
||||
|
@ -212,9 +203,9 @@ const static pcl_t pcl_media_sources[] =
|
|||
#define PCL_RES_300_300 2
|
||||
#define PCL_RES_600_300 4 /* DJ 600 series */
|
||||
#define PCL_RES_600_600_MONO 8 /* DJ 600/800/1100/2000 b/w only */
|
||||
#define PCL_RES_600_600 16 /* DJ 9xx ??*/
|
||||
#define PCL_RES_1200_1200 32 /* DJ 9xx ??*/
|
||||
#define PCL_RES_2400_1200 64 /* DJ 9xx */
|
||||
#define PCL_RES_600_600 16 /* DJ 9xx/1220C/PhotoSmart */
|
||||
#define PCL_RES_1200_600 32 /* DJ 9xx/1220C/PhotoSmart */
|
||||
#define PCL_RES_2400_600 64 /* DJ 9xx/1220C/PhotoSmart */
|
||||
|
||||
const static pcl_t pcl_resolutions[] =
|
||||
{
|
||||
|
@ -223,8 +214,8 @@ const static pcl_t pcl_resolutions[] =
|
|||
{"600x300 DPI", PCL_RES_600_300},
|
||||
{"600x600 DPI monochrome", PCL_RES_600_600_MONO},
|
||||
{"600x600 DPI", PCL_RES_600_600},
|
||||
{"1200x1200 DPI", PCL_RES_1200_1200},
|
||||
{"2400x1200 DPI", PCL_RES_2400_1200},
|
||||
{"1200x600 DPI", PCL_RES_1200_600},
|
||||
{"2400x600 DPI", PCL_RES_2400_600},
|
||||
};
|
||||
#define NUM_RESOLUTIONS (sizeof(pcl_resolutions) / sizeof (pcl_t))
|
||||
|
||||
|
@ -327,6 +318,7 @@ static pcl_cap_t pcl_model_capabilities[] =
|
|||
-1,
|
||||
},
|
||||
{
|
||||
PCL_PAPERSOURCE_STANDARD,
|
||||
PCL_PAPERSOURCE_MANUAL,
|
||||
PCL_PAPERSOURCE_340_PCSF,
|
||||
PCL_PAPERSOURCE_340_DCSF,
|
||||
|
@ -384,6 +376,7 @@ static pcl_cap_t pcl_model_capabilities[] =
|
|||
-1,
|
||||
},
|
||||
{
|
||||
PCL_PAPERSOURCE_STANDARD,
|
||||
PCL_PAPERSOURCE_MANUAL,
|
||||
PCL_PAPERSOURCE_DJ_TRAY,
|
||||
-1,
|
||||
|
@ -412,6 +405,7 @@ static pcl_cap_t pcl_model_capabilities[] =
|
|||
-1,
|
||||
},
|
||||
{
|
||||
PCL_PAPERSOURCE_STANDARD,
|
||||
PCL_PAPERSOURCE_MANUAL,
|
||||
PCL_PAPERSOURCE_DJ_TRAY,
|
||||
-1,
|
||||
|
@ -450,6 +444,7 @@ static pcl_cap_t pcl_model_capabilities[] =
|
|||
-1,
|
||||
},
|
||||
{
|
||||
PCL_PAPERSOURCE_STANDARD,
|
||||
PCL_PAPERSOURCE_MANUAL,
|
||||
PCL_PAPERSOURCE_DJ_TRAY,
|
||||
-1,
|
||||
|
@ -480,6 +475,7 @@ static pcl_cap_t pcl_model_capabilities[] =
|
|||
-1,
|
||||
},
|
||||
{
|
||||
PCL_PAPERSOURCE_STANDARD,
|
||||
PCL_PAPERSOURCE_MANUAL,
|
||||
PCL_PAPERSOURCE_DJ_TRAY,
|
||||
-1,
|
||||
|
@ -520,7 +516,7 @@ static pcl_cap_t pcl_model_capabilities[] =
|
|||
{ -1, /* No selectable paper sources */
|
||||
},
|
||||
},
|
||||
/* Deskjet 6xx series */
|
||||
/* Deskjet 6xx series, plus 810/812/840/842/895 */
|
||||
{ 601,
|
||||
17 * 72 / 2, 14 * 72,
|
||||
PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_300 | PCL_RES_600_600_MONO,
|
||||
|
@ -556,7 +552,7 @@ static pcl_cap_t pcl_model_capabilities[] =
|
|||
-1,
|
||||
},
|
||||
},
|
||||
/* Deskjet 69x series */
|
||||
/* Deskjet 69x series (Photo Capable) */
|
||||
{ 690,
|
||||
17 * 72 / 2, 14 * 72,
|
||||
PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_300 | PCL_RES_600_600,
|
||||
|
@ -592,10 +588,10 @@ static pcl_cap_t pcl_model_capabilities[] =
|
|||
-1,
|
||||
},
|
||||
},
|
||||
/* Deskjet 800 series */
|
||||
/* Deskjet 850/855/870/890 (C-RET) */
|
||||
{ 800,
|
||||
17 * 72 / 2, 14 * 72,
|
||||
PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600_MONO | PCL_RES_600_600_MONO,
|
||||
PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600_MONO,
|
||||
3, 33, 18, 18,
|
||||
PCL_COLOR_CMYK | PCL_COLOR_CMYK4,
|
||||
PCL_PRINTER_DJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_MEDIATYPE |
|
||||
|
@ -628,12 +624,12 @@ static pcl_cap_t pcl_model_capabilities[] =
|
|||
-1,
|
||||
},
|
||||
},
|
||||
/* Deskjet 900 series */
|
||||
/* Deskjet 900 series, 1220C, PhotoSmart P1000/P1100 */
|
||||
{ 900,
|
||||
17 * 72 / 2, 14 * 72,
|
||||
PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600 | PCL_RES_1200_1200 | PCL_RES_2400_1200,
|
||||
PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600 /* | PCL_RES_1200_600 | PCL_RES_2400_600 */,
|
||||
3, 33, 18, 18,
|
||||
PCL_COLOR_CMYK | PCL_COLOR_CMYK4,
|
||||
PCL_COLOR_CMYK,
|
||||
PCL_PRINTER_DJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_MEDIATYPE |
|
||||
PCL_PRINTER_CUSTOM_SIZE,
|
||||
{
|
||||
|
@ -663,7 +659,56 @@ static pcl_cap_t pcl_model_capabilities[] =
|
|||
{ -1, /* No selectable paper sources */
|
||||
},
|
||||
},
|
||||
/* Deskjet 1100C, 1120C, 1220C */
|
||||
/* Deskjet 1220C (or other large format 900) */
|
||||
{ 901,
|
||||
13 * 72, 19 * 72,
|
||||
PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600 /* | PCL_RES_1200_600 | PCL_RES_2400_600 */,
|
||||
3, 33, 18, 18,
|
||||
PCL_COLOR_CMYK,
|
||||
PCL_PRINTER_DJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_MEDIATYPE |
|
||||
PCL_PRINTER_CUSTOM_SIZE,
|
||||
{
|
||||
PCL_PAPERSIZE_EXECUTIVE,
|
||||
PCL_PAPERSIZE_LETTER,
|
||||
PCL_PAPERSIZE_LEGAL,
|
||||
PCL_PAPERSIZE_TABLOID,
|
||||
PCL_PAPERSIZE_STATEMENT,
|
||||
PCL_PAPERSIZE_SUPER_B,
|
||||
PCL_PAPERSIZE_A5,
|
||||
PCL_PAPERSIZE_A4,
|
||||
PCL_PAPERSIZE_A3,
|
||||
PCL_PAPERSIZE_JIS_B5,
|
||||
PCL_PAPERSIZE_JIS_B4,
|
||||
PCL_PAPERSIZE_HAGAKI_CARD,
|
||||
PCL_PAPERSIZE_OUFUKU_CARD,
|
||||
PCL_PAPERSIZE_A6_CARD,
|
||||
PCL_PAPERSIZE_4x6,
|
||||
PCL_PAPERSIZE_5x8,
|
||||
PCL_PAPERSIZE_3x5,
|
||||
PCL_PAPERSIZE_HP_CARD,
|
||||
PCL_PAPERSIZE_MONARCH_ENV,
|
||||
PCL_PAPERSIZE_COMMERCIAL10_ENV,
|
||||
PCL_PAPERSIZE_DL_ENV,
|
||||
PCL_PAPERSIZE_C5_ENV,
|
||||
PCL_PAPERSIZE_C6_ENV,
|
||||
PCL_PAPERSIZE_INVITATION_ENV,
|
||||
PCL_PAPERSIZE_JAPANESE_3_ENV,
|
||||
PCL_PAPERSIZE_JAPANESE_4_ENV,
|
||||
PCL_PAPERSIZE_KAKU_ENV,
|
||||
-1,
|
||||
},
|
||||
{
|
||||
PCL_PAPERTYPE_PLAIN,
|
||||
PCL_PAPERTYPE_BOND,
|
||||
PCL_PAPERTYPE_PREMIUM,
|
||||
PCL_PAPERTYPE_GLOSSY,
|
||||
PCL_PAPERTYPE_TRANS,
|
||||
-1,
|
||||
},
|
||||
{ -1, /* No selectable paper sources */
|
||||
},
|
||||
},
|
||||
/* Deskjet 1100C, 1120C */
|
||||
{ 1100,
|
||||
13 * 72, 19 * 72,
|
||||
PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600_MONO,
|
||||
|
@ -684,16 +729,11 @@ static pcl_cap_t pcl_model_capabilities[] =
|
|||
PCL_PAPERSIZE_JIS_B5,
|
||||
PCL_PAPERSIZE_JIS_B4,
|
||||
PCL_PAPERSIZE_HAGAKI_CARD,
|
||||
/* PCL_PAPERSIZE_OUFUKU_CARD, 1220C supports, rest don't */
|
||||
PCL_PAPERSIZE_A6_CARD,
|
||||
PCL_PAPERSIZE_4x6,
|
||||
PCL_PAPERSIZE_5x8,
|
||||
/* PCL_PAPERSIZE_3x5, 1220C supports, rest don't */
|
||||
/* PCL_PAPERSIZE_HP_CARD, 1220C supports, rest don't */
|
||||
/* PCL_PAPERSIZE_MONARCH_ENV, 1220C supports, rest don't */
|
||||
PCL_PAPERSIZE_COMMERCIAL10_ENV,
|
||||
PCL_PAPERSIZE_DL_ENV,
|
||||
/* PCL_PAPERSIZE_C5_ENV, 1220C supports, rest don't */
|
||||
PCL_PAPERSIZE_C6_ENV,
|
||||
PCL_PAPERSIZE_INVITATION_ENV,
|
||||
PCL_PAPERSIZE_JAPANESE_3_ENV,
|
||||
|
@ -710,6 +750,7 @@ static pcl_cap_t pcl_model_capabilities[] =
|
|||
-1,
|
||||
},
|
||||
{
|
||||
PCL_PAPERSOURCE_STANDARD,
|
||||
PCL_PAPERSOURCE_MANUAL,
|
||||
PCL_PAPERSOURCE_DJ_TRAY,
|
||||
-1,
|
||||
|
@ -744,6 +785,7 @@ static pcl_cap_t pcl_model_capabilities[] =
|
|||
-1,
|
||||
},
|
||||
{
|
||||
PCL_PAPERSOURCE_STANDARD,
|
||||
PCL_PAPERSOURCE_MANUAL,
|
||||
PCL_PAPERSOURCE_DJ_TRAY,
|
||||
-1,
|
||||
|
@ -752,7 +794,7 @@ static pcl_cap_t pcl_model_capabilities[] =
|
|||
/* Deskjet 2000 */
|
||||
{ 2000,
|
||||
17 * 72 / 2, 14 * 72,
|
||||
PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600_MONO,
|
||||
PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600,
|
||||
12, 12, 18, 18,
|
||||
PCL_COLOR_CMYK,
|
||||
PCL_PRINTER_DJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_MEDIATYPE |
|
||||
|
@ -785,6 +827,7 @@ static pcl_cap_t pcl_model_capabilities[] =
|
|||
-1,
|
||||
},
|
||||
{
|
||||
PCL_PAPERSOURCE_STANDARD,
|
||||
PCL_PAPERSOURCE_MANUAL,
|
||||
PCL_PAPERSOURCE_DJ_TRAY,
|
||||
-1,
|
||||
|
@ -793,7 +836,7 @@ static pcl_cap_t pcl_model_capabilities[] =
|
|||
/* Deskjet 2500 */
|
||||
{ 2500,
|
||||
13 * 72, 19 * 72,
|
||||
PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600_MONO,
|
||||
PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600,
|
||||
12, 12, 18, 18,
|
||||
PCL_COLOR_CMYK,
|
||||
PCL_PRINTER_DJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_MEDIATYPE |
|
||||
|
@ -828,6 +871,7 @@ static pcl_cap_t pcl_model_capabilities[] =
|
|||
-1,
|
||||
},
|
||||
{
|
||||
PCL_PAPERSOURCE_STANDARD,
|
||||
PCL_PAPERSOURCE_MANUAL,
|
||||
PCL_PAPERSOURCE_DJ_AUTO,
|
||||
PCL_PAPERSOURCE_DJ_TRAY,
|
||||
|
@ -852,6 +896,7 @@ static pcl_cap_t pcl_model_capabilities[] =
|
|||
{ -1, /* No selectable paper types */
|
||||
},
|
||||
{
|
||||
PCL_PAPERSOURCE_STANDARD,
|
||||
PCL_PAPERSOURCE_MANUAL,
|
||||
PCL_PAPERSOURCE_LJ_TRAY1,
|
||||
PCL_PAPERSOURCE_LJ_TRAY2,
|
||||
|
@ -876,6 +921,7 @@ static pcl_cap_t pcl_model_capabilities[] =
|
|||
{ -1, /* No selectable paper types */
|
||||
},
|
||||
{
|
||||
PCL_PAPERSOURCE_STANDARD,
|
||||
PCL_PAPERSOURCE_MANUAL,
|
||||
PCL_PAPERSOURCE_LJ_TRAY1,
|
||||
PCL_PAPERSOURCE_LJ_TRAY2,
|
||||
|
@ -884,7 +930,7 @@ static pcl_cap_t pcl_model_capabilities[] =
|
|||
-1,
|
||||
},
|
||||
},
|
||||
/* LaserJet 4 series, 5 series, 6 series */
|
||||
/* LaserJet 4 series */
|
||||
{ 4,
|
||||
17 * 72 / 2, 14 * 72,
|
||||
PCL_RES_150_150 | PCL_RES_300_300,
|
||||
|
@ -900,6 +946,7 @@ static pcl_cap_t pcl_model_capabilities[] =
|
|||
{ -1, /* No selectable paper types */
|
||||
},
|
||||
{
|
||||
PCL_PAPERSOURCE_STANDARD,
|
||||
PCL_PAPERSOURCE_MANUAL,
|
||||
PCL_PAPERSOURCE_LJ_TRAY1,
|
||||
PCL_PAPERSOURCE_LJ_TRAY2,
|
||||
|
@ -931,6 +978,64 @@ static pcl_cap_t pcl_model_capabilities[] =
|
|||
{ -1, /* No selectable paper types */
|
||||
},
|
||||
{
|
||||
PCL_PAPERSOURCE_STANDARD,
|
||||
PCL_PAPERSOURCE_MANUAL,
|
||||
PCL_PAPERSOURCE_LJ_TRAY1,
|
||||
PCL_PAPERSOURCE_LJ_TRAY2,
|
||||
PCL_PAPERSOURCE_LJ_TRAY3,
|
||||
PCL_PAPERSOURCE_LJ_TRAY4,
|
||||
-1,
|
||||
},
|
||||
},
|
||||
/* LaserJet 5 series, 6 series */
|
||||
{ 6,
|
||||
17 * 72 / 2, 14 * 72,
|
||||
PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600,
|
||||
12, 12, 18, 18,
|
||||
PCL_COLOR_NONE,
|
||||
PCL_PRINTER_LJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF,
|
||||
{
|
||||
PCL_PAPERSIZE_LETTER,
|
||||
PCL_PAPERSIZE_LEGAL,
|
||||
PCL_PAPERSIZE_A4,
|
||||
-1,
|
||||
},
|
||||
{ -1, /* No selectable paper types */
|
||||
},
|
||||
{
|
||||
PCL_PAPERSOURCE_STANDARD,
|
||||
PCL_PAPERSOURCE_MANUAL,
|
||||
PCL_PAPERSOURCE_LJ_TRAY1,
|
||||
PCL_PAPERSOURCE_LJ_TRAY2,
|
||||
PCL_PAPERSOURCE_LJ_TRAY3,
|
||||
PCL_PAPERSOURCE_LJ_TRAY4,
|
||||
-1,
|
||||
},
|
||||
},
|
||||
/* LaserJet 5Si */
|
||||
{ 7,
|
||||
13 * 72, 19 * 72,
|
||||
PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600,
|
||||
12, 12, 18, 18,
|
||||
PCL_COLOR_NONE,
|
||||
PCL_PRINTER_LJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF,
|
||||
{
|
||||
PCL_PAPERSIZE_LETTER,
|
||||
PCL_PAPERSIZE_LEGAL,
|
||||
PCL_PAPERSIZE_TABLOID,
|
||||
PCL_PAPERSIZE_A5,
|
||||
PCL_PAPERSIZE_A4,
|
||||
PCL_PAPERSIZE_A3,
|
||||
PCL_PAPERSIZE_JIS_B5,
|
||||
PCL_PAPERSIZE_JIS_B4, /* Guess */
|
||||
PCL_PAPERSIZE_4x6,
|
||||
PCL_PAPERSIZE_5x8,
|
||||
-1,
|
||||
},
|
||||
{ -1, /* No selectable paper types */
|
||||
},
|
||||
{
|
||||
PCL_PAPERSOURCE_STANDARD,
|
||||
PCL_PAPERSOURCE_MANUAL,
|
||||
PCL_PAPERSOURCE_LJ_TRAY1,
|
||||
PCL_PAPERSOURCE_LJ_TRAY2,
|
||||
|
@ -1274,14 +1379,14 @@ pcl_print(const printer_t *printer, /* I - Model */
|
|||
{
|
||||
unsigned char *cmap = v->cmap;
|
||||
int model = printer->model;
|
||||
char *resolution = v->resolution;
|
||||
const char *resolution = v->resolution;
|
||||
const char *media_size;
|
||||
char *media_type = v->media_type;
|
||||
char *media_source = v->media_source;
|
||||
char *ink_type = v->ink_type;
|
||||
const char *media_type = v->media_type;
|
||||
const char *media_source = v->media_source;
|
||||
const char *ink_type = v->ink_type;
|
||||
int output_type = v->output_type;
|
||||
int orientation = v->orientation;
|
||||
float scaling = v->scaling;
|
||||
double scaling = v->scaling;
|
||||
int top = v->top;
|
||||
int left = v->left;
|
||||
int y; /* Looping vars */
|
||||
|
@ -1338,21 +1443,6 @@ pcl_print(const printer_t *printer, /* I - Model */
|
|||
image_width = Image_width(image);
|
||||
image_bpp = Image_bpp(image);
|
||||
|
||||
/*
|
||||
* Choose the correct color conversion function...
|
||||
*/
|
||||
if (nv.image_type == IMAGE_MONOCHROME)
|
||||
{
|
||||
output_type = OUTPUT_GRAY;
|
||||
}
|
||||
|
||||
if (caps.color_type == PCL_COLOR_NONE)
|
||||
output_type = OUTPUT_GRAY;
|
||||
else if (image_bpp < 3 && cmap == NULL && output_type == OUTPUT_COLOR)
|
||||
output_type = OUTPUT_GRAY_COLOR; /* Force grayscale output */
|
||||
|
||||
colorfunc = choose_colorfunc(output_type, image_bpp, cmap, &out_bpp, &nv);
|
||||
|
||||
/*
|
||||
* Figure out the output resolution...
|
||||
*/
|
||||
|
@ -1363,13 +1453,25 @@ pcl_print(const printer_t *printer, /* I - Model */
|
|||
fprintf(stderr,"pcl: resolution=%dx%d\n",xdpi,ydpi);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Choose the correct color conversion function...
|
||||
*/
|
||||
if (((caps.resolutions & PCL_RES_600_600_MONO) == PCL_RES_600_600_MONO) &&
|
||||
output_type != OUTPUT_GRAY && xdpi == 600 && ydpi == 600) {
|
||||
fprintf(stderr, "600x600 resolution only available in MONO, changed to 300x300\n");
|
||||
xdpi = 300;
|
||||
ydpi = 300;
|
||||
fprintf(stderr, "600x600 resolution only available in MONO\n");
|
||||
output_type = OUTPUT_GRAY;
|
||||
}
|
||||
|
||||
if (nv.image_type == IMAGE_MONOCHROME)
|
||||
{
|
||||
output_type = OUTPUT_GRAY;
|
||||
}
|
||||
|
||||
if (caps.color_type == PCL_COLOR_NONE)
|
||||
output_type = OUTPUT_GRAY;
|
||||
|
||||
colorfunc = choose_colorfunc(output_type, image_bpp, cmap, &out_bpp, &nv);
|
||||
|
||||
do_cret = (xdpi >= 300 && ((caps.color_type & PCL_COLOR_CMYK4) == PCL_COLOR_CMYK4) &&
|
||||
nv.image_type != IMAGE_MONOCHROME);
|
||||
|
||||
|
@ -1464,7 +1566,7 @@ pcl_print(const printer_t *printer, /* I - Model */
|
|||
fputs("\033&l0E", prn); /* Reset top margin to 0 */
|
||||
|
||||
/*
|
||||
* Convert media type string to the code, if specified.
|
||||
* Convert media source string to the code, if specified.
|
||||
*/
|
||||
|
||||
if (strlen(media_source) != 0) {
|
||||
|
@ -1478,7 +1580,7 @@ pcl_print(const printer_t *printer, /* I - Model */
|
|||
|
||||
if (pcl_media_source == -1)
|
||||
fprintf(stderr, "Unknown media source %s, ignored.\n", media_source);
|
||||
else {
|
||||
else if (pcl_media_source != PCL_PAPERSOURCE_STANDARD) {
|
||||
|
||||
/* Correct the value by taking the modulus */
|
||||
|
||||
|
@ -1761,22 +1863,22 @@ pcl_print(const printer_t *printer, /* I - Model */
|
|||
|
||||
for (y = 0; y < out_height; y ++)
|
||||
{
|
||||
int duplicate_line = 1;
|
||||
#ifdef DEBUG
|
||||
printf("pcl_print: y = %d, line = %d, val = %d, mod = %d, height = %d\n",
|
||||
y, errline, errval, errmod, out_height);
|
||||
#endif /* DEBUG */
|
||||
|
||||
if ((y & 255) == 0)
|
||||
if ((y & 63) == 0)
|
||||
Image_note_progress(image, y, out_height);
|
||||
|
||||
if (errline != errlast)
|
||||
{
|
||||
errlast = errline;
|
||||
duplicate_line = 0;
|
||||
Image_get_row(image, in, errline);
|
||||
(*colorfunc)(in, out, image_width, image_bpp, cmap, &nv);
|
||||
}
|
||||
|
||||
(*colorfunc)(in, out, image_width, image_bpp, cmap, &nv);
|
||||
|
||||
if (do_cret)
|
||||
{
|
||||
/*
|
||||
|
@ -1785,14 +1887,14 @@ pcl_print(const printer_t *printer, /* I - Model */
|
|||
|
||||
if (output_type == OUTPUT_GRAY)
|
||||
{
|
||||
dither_black(out, y, dither, black);
|
||||
dither_black(out, y, dither, black, duplicate_line);
|
||||
(*writefunc)(prn, black + length / 2, length / 2, 0);
|
||||
(*writefunc)(prn, black, length / 2, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
dither_cmyk(out, y, dither, cyan, lcyan, magenta, lmagenta,
|
||||
yellow, NULL, black);
|
||||
dither_cmyk(out, y, dither, cyan, lcyan, magenta, lmagenta,
|
||||
yellow, NULL, black, duplicate_line);
|
||||
|
||||
(*writefunc)(prn, black + length / 2, length / 2, 0);
|
||||
(*writefunc)(prn, black, length / 2, 0);
|
||||
|
@ -1822,15 +1924,15 @@ pcl_print(const printer_t *printer, /* I - Model */
|
|||
if (output_type == OUTPUT_GRAY)
|
||||
{
|
||||
if (nv.image_type == IMAGE_MONOCHROME)
|
||||
dither_fastblack(out, y, dither, black);
|
||||
dither_monochrome(out, y, dither, black, duplicate_line);
|
||||
else
|
||||
dither_black(out, y, dither, black);
|
||||
dither_black(out, y, dither, black, duplicate_line);
|
||||
(*writefunc)(prn, black, length, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
dither_cmyk(out, y, dither, cyan, lcyan, magenta, lmagenta,
|
||||
yellow, NULL, black);
|
||||
dither_cmyk(out, y, dither, cyan, lcyan, magenta, lmagenta,
|
||||
yellow, NULL, black, duplicate_line);
|
||||
|
||||
if (black != NULL)
|
||||
(*writefunc)(prn, black, length, 0);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -19,20 +19,11 @@
|
|||
* 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.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* ps_parameters() - Return the parameter values for the given
|
||||
* parameter.
|
||||
* ps_media_size() - Return the size of the page.
|
||||
* ps_imageable_area() - Return the imageable area of the page.
|
||||
* ps_print() - Print an image to a PostScript printer.
|
||||
* ps_hex() - Print binary data as a series of hexadecimal numbers.
|
||||
* ps_ascii85() - Print binary data as a series of base-85 numbers.
|
||||
*
|
||||
* Revision History:
|
||||
*
|
||||
* See ChangeLog
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file must include only standard C header files. The core code must
|
||||
* compile on generic platforms that don't support glib, gimp, gtk, etc.
|
||||
*/
|
||||
|
||||
#include "print.h"
|
||||
|
@ -48,7 +39,7 @@
|
|||
*/
|
||||
|
||||
static FILE *ps_ppd = NULL;
|
||||
static char *ps_ppd_file = NULL;
|
||||
static const char *ps_ppd_file = NULL;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -132,7 +123,7 @@ ps_parameters(const printer_t *printer, /* I - Printer model */
|
|||
if (sscanf(line, "*%s %[^/:]", lname, loption) != 2)
|
||||
continue;
|
||||
|
||||
if (g_strcasecmp(lname, name) == 0)
|
||||
if (strcasecmp(lname, name) == 0)
|
||||
{
|
||||
valptrs[(*count)] = malloc(strlen(loption) + 1);
|
||||
strcpy(valptrs[(*count)], loption);
|
||||
|
@ -251,14 +242,14 @@ ps_print(const printer_t *printer, /* I - Model (Level 1 or 2) */
|
|||
{
|
||||
unsigned char *cmap = v->cmap;
|
||||
int model = printer->model;
|
||||
char *ppd_file = v->ppd_file;
|
||||
char *resolution = v->resolution;
|
||||
char *media_size = v->media_size;
|
||||
char *media_type = v->media_type;
|
||||
char *media_source = v->media_source;
|
||||
const char *ppd_file = v->ppd_file;
|
||||
const char *resolution = v->resolution;
|
||||
const char *media_size = v->media_size;
|
||||
const char *media_type = v->media_type;
|
||||
const char *media_source = v->media_source;
|
||||
int output_type = v->output_type;
|
||||
int orientation = v->orientation;
|
||||
float scaling = v->scaling;
|
||||
double scaling = v->scaling;
|
||||
int top = v->top;
|
||||
int left = v->left;
|
||||
int i, j; /* Looping vars */
|
||||
|
@ -305,9 +296,6 @@ ps_print(const printer_t *printer, /* I - Model (Level 1 or 2) */
|
|||
* Choose the correct color conversion function...
|
||||
*/
|
||||
|
||||
if (image_bpp < 3 && cmap == NULL && output_type == OUTPUT_COLOR)
|
||||
output_type = OUTPUT_GRAY_COLOR; /* Force grayscale output */
|
||||
|
||||
colorfunc = choose_colorfunc(output_type, image_bpp, cmap, &out_bpp, &nv);
|
||||
|
||||
/*
|
||||
|
@ -453,8 +441,8 @@ ps_print(const printer_t *printer, /* I - Model (Level 1 or 2) */
|
|||
|
||||
fprintf(prn, "%d %d translate\n", left, top);
|
||||
fprintf(prn, "%.3f %.3f scale\n",
|
||||
(float)out_width / ((float)image_width),
|
||||
(float)out_height / ((float)image_height));
|
||||
(double)out_width / ((double)image_width),
|
||||
(double)out_height / ((double)image_height));
|
||||
|
||||
in = malloc(image_width * image_bpp);
|
||||
out = malloc((image_width * out_bpp + 3) * 2);
|
||||
|
@ -705,7 +693,7 @@ ppd_find(const char *ppd_file, /* I - Name of PPD file */
|
|||
if (line[0] != '*')
|
||||
continue;
|
||||
|
||||
if (g_strncasecmp(line, "*OrderDependency:", 17) == 0 && order != NULL)
|
||||
if (strncasecmp(line, "*OrderDependency:", 17) == 0 && order != NULL)
|
||||
{
|
||||
sscanf(line, "%*s%d", order);
|
||||
continue;
|
||||
|
@ -713,8 +701,8 @@ ppd_find(const char *ppd_file, /* I - Name of PPD file */
|
|||
else if (sscanf(line, "*%s %[^/:]", lname, loption) != 2)
|
||||
continue;
|
||||
|
||||
if (g_strcasecmp(lname, name) == 0 &&
|
||||
g_strcasecmp(loption, option) == 0)
|
||||
if (strcasecmp(lname, name) == 0 &&
|
||||
strcasecmp(loption, option) == 0)
|
||||
{
|
||||
opt = strchr(line, ':') + 1;
|
||||
while (*opt == ' ' || *opt == '\t')
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -20,8 +20,15 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file must include only standard C header files. The core code must
|
||||
* compile on generic platforms that don't support glib, gimp, gtk, etc.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "print.h"
|
||||
|
||||
#if 0
|
||||
#define TEST_RAW
|
||||
|
@ -77,13 +84,33 @@ typedef struct raw {
|
|||
int advancebasis;
|
||||
int subblocksperpassblock;
|
||||
int passespersubblock;
|
||||
int strategy;
|
||||
} raw_t;
|
||||
|
||||
/*
|
||||
* Strategy types currently defined:
|
||||
*
|
||||
* 0: microweave (intercepted at the escp2 driver level so we never
|
||||
* see it here)
|
||||
* 1: zig-zag type pass block filling
|
||||
* 2: ascending pass block filling
|
||||
* 3: descending pass block filling
|
||||
* 4: ascending fill with 2x expansion
|
||||
* 5: ascending fill with 3x expansion
|
||||
* 6: staggered zig-zag neighbour-avoidance fill
|
||||
*
|
||||
* In theory, strategy 1 should be optimal; in practice, it can lead
|
||||
* to visible areas of banding. If it's necessary to avoid filling
|
||||
* neighbouring rows in neighbouring passes, strategy 6 should be optimal,
|
||||
* at least for some weaves.
|
||||
*/
|
||||
|
||||
static void
|
||||
initialize_raw_weave(raw_t *w, /* I - weave struct to be filled in */
|
||||
int S, /* I - jet separation */
|
||||
int J, /* I - number of jets */
|
||||
int H) /* I - oversampling factor */
|
||||
int H, /* I - oversampling factor */
|
||||
int strat) /* I - weave pattern variation to use */
|
||||
{
|
||||
w->separation = S;
|
||||
w->jets = J;
|
||||
|
@ -91,6 +118,7 @@ initialize_raw_weave(raw_t *w, /* I - weave struct to be filled in */
|
|||
w->advancebasis = J / H;
|
||||
w->subblocksperpassblock = gcd(S, w->advancebasis);
|
||||
w->passespersubblock = S / w->subblocksperpassblock;
|
||||
w->strategy = strat;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -106,11 +134,56 @@ calculate_raw_pass_parameters(raw_t *w, /* I - weave parameters */
|
|||
subpassblock = pass % w->separation
|
||||
* w->subblocksperpassblock / w->separation;
|
||||
|
||||
if (subpassblock * 2 < w->subblocksperpassblock)
|
||||
subpassoffset = 2 * subpassblock;
|
||||
else
|
||||
subpassoffset = 2 * (w->subblocksperpassblock - subpassblock)
|
||||
- 1;
|
||||
switch (w->strategy) {
|
||||
case 1:
|
||||
if (subpassblock * 2 < w->subblocksperpassblock)
|
||||
subpassoffset = 2 * subpassblock;
|
||||
else
|
||||
subpassoffset = 2 * (w->subblocksperpassblock
|
||||
- subpassblock) - 1;
|
||||
break;
|
||||
case 2:
|
||||
subpassoffset = subpassblock;
|
||||
break;
|
||||
case 3:
|
||||
subpassoffset = w->subblocksperpassblock - 1 - subpassblock;
|
||||
break;
|
||||
case 4:
|
||||
if (subpassblock * 2 < w->subblocksperpassblock)
|
||||
subpassoffset = 2 * subpassblock;
|
||||
else
|
||||
subpassoffset = 1 + 2 * (subpassblock
|
||||
- (w->subblocksperpassblock
|
||||
+ 1) / 2);
|
||||
break;
|
||||
case 5:
|
||||
if (subpassblock * 3 < w->subblocksperpassblock)
|
||||
subpassoffset = 3 * subpassblock;
|
||||
else if (3 * (subpassblock - (w->subblocksperpassblock + 2) / 3)
|
||||
< w->subblocksperpassblock - 2)
|
||||
subpassoffset = 2 + 3 * (subpassblock
|
||||
- (w->subblocksperpassblock
|
||||
+ 2) / 3);
|
||||
else
|
||||
subpassoffset = 1 + 3 * (subpassblock
|
||||
- (w->subblocksperpassblock
|
||||
+ 2) / 3
|
||||
- w->subblocksperpassblock
|
||||
/ 3);
|
||||
break;
|
||||
case 6:
|
||||
if (subpassblock * 2 < w->subblocksperpassblock)
|
||||
subpassoffset = 2 * subpassblock;
|
||||
else if (subpassblock * 2 < w->subblocksperpassblock + 2)
|
||||
subpassoffset = 1;
|
||||
else
|
||||
subpassoffset = 2 * (w->subblocksperpassblock
|
||||
- subpassblock) + 1;
|
||||
break;
|
||||
default:
|
||||
subpassoffset = subpassblock;
|
||||
break;
|
||||
}
|
||||
|
||||
*startrow = w->separation * w->jets * band
|
||||
+ w->advancebasis * passinband + subpassoffset;
|
||||
|
@ -128,11 +201,50 @@ calculate_raw_row_parameters(raw_t *w, /* I - weave parameters */
|
|||
int subblockoffset, subpassblock, band, baserow, passinband, offset;
|
||||
|
||||
subblockoffset = row % w->subblocksperpassblock;
|
||||
if (subblockoffset % 2 == 0)
|
||||
subpassblock = subblockoffset / 2;
|
||||
else
|
||||
subpassblock = w->subblocksperpassblock
|
||||
- (subblockoffset + 1) / 2;
|
||||
switch (w->strategy) {
|
||||
case 1:
|
||||
if (subblockoffset % 2 == 0)
|
||||
subpassblock = subblockoffset / 2;
|
||||
else
|
||||
subpassblock = w->subblocksperpassblock
|
||||
- (subblockoffset + 1) / 2;
|
||||
break;
|
||||
case 2:
|
||||
subpassblock = subblockoffset;
|
||||
break;
|
||||
case 3:
|
||||
subpassblock = w->subblocksperpassblock - 1 - subblockoffset;
|
||||
break;
|
||||
case 4:
|
||||
if (subblockoffset % 2 == 0)
|
||||
subpassblock = subblockoffset / 2;
|
||||
else
|
||||
subpassblock = (subblockoffset - 1) / 2
|
||||
+ (w->subblocksperpassblock + 1) / 2;
|
||||
break;
|
||||
case 5:
|
||||
if (subblockoffset % 3 == 0)
|
||||
subpassblock = subblockoffset / 3;
|
||||
else if (subblockoffset % 3 == 1)
|
||||
subpassblock = (subblockoffset - 1) / 3
|
||||
+ (w->subblocksperpassblock + 2) / 3;
|
||||
else
|
||||
subpassblock = (subblockoffset - 2) / 3
|
||||
+ (w->subblocksperpassblock + 2) / 3
|
||||
+ (w->subblocksperpassblock + 1) / 3;
|
||||
break;
|
||||
case 6:
|
||||
if (subblockoffset % 2 == 0)
|
||||
subpassblock = subblockoffset / 2;
|
||||
else if (subblockoffset == 1)
|
||||
subpassblock = w->subblocksperpassblock / 2;
|
||||
else
|
||||
subpassblock = w->subblocksperpassblock
|
||||
- (subblockoffset - 1) / 2;
|
||||
default:
|
||||
subpassblock = subblockoffset;
|
||||
break;
|
||||
}
|
||||
|
||||
band = row / (w->separation * w->jets);
|
||||
baserow = row - subblockoffset - band * w->separation * w->jets;
|
||||
|
@ -223,8 +335,10 @@ static void
|
|||
invert_map(int *map, int *stagger, int count, int oldfirstpass,
|
||||
int newfirstpass)
|
||||
{
|
||||
int newmap[count], newstagger[count];
|
||||
int i;
|
||||
int *newmap, *newstagger;
|
||||
newmap = malloc(count * sizeof(int));
|
||||
newstagger = malloc(count * sizeof(int));
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
newmap[map[i] - oldfirstpass] = i + newfirstpass;
|
||||
|
@ -233,6 +347,8 @@ invert_map(int *map, int *stagger, int count, int oldfirstpass,
|
|||
|
||||
memcpy(map, newmap, count * sizeof(int));
|
||||
memcpy(stagger, newstagger, count * sizeof(int));
|
||||
free(newstagger);
|
||||
free(newmap);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -391,13 +507,14 @@ initialize_weave_params(int S, /* I - jet separation */
|
|||
int H, /* I - oversampling factor */
|
||||
int firstrow, /* I - first row number to print */
|
||||
int lastrow, /* I - last row number to print */
|
||||
int pagelength) /* I - number of rows on the whole
|
||||
int pagelength, /* I - number of rows on the whole
|
||||
page, without using any
|
||||
expanded margin facilities */
|
||||
int strategy) /* I - weave pattern variant to use */
|
||||
{
|
||||
cooked_t *w = malloc(sizeof(cooked_t));
|
||||
if (w) {
|
||||
initialize_raw_weave(&w->rw, S, J, H);
|
||||
initialize_raw_weave(&w->rw, S, J, H, strategy);
|
||||
calculate_pass_map(w, pagelength, firstrow, lastrow);
|
||||
}
|
||||
return w;
|
||||
|
@ -623,6 +740,7 @@ main(int ac, char *av[])
|
|||
int firstrow =ac>4 ? atoi(av[4]) : 1;
|
||||
int lastrow =ac>5 ? atoi(av[5]) : 100;
|
||||
int pagelength=ac>6 ? atoi(av[6]) : 1000;
|
||||
int strategy =ac>7 ? atoi(av[7]) : 1;
|
||||
cooked_t *weave;
|
||||
int passes;
|
||||
|
||||
|
@ -632,10 +750,12 @@ main(int ac, char *av[])
|
|||
|
||||
memset(collect, 0, MAXCOLLECT*sizeof(int));
|
||||
memset(prints, 0, MAXCOLLECT*sizeof(int));
|
||||
printf("S=%d J=%d H=%d firstrow=%d lastrow=%d pagelength=%d\n",
|
||||
S, J, H, firstrow, lastrow, pagelength);
|
||||
printf("S=%d J=%d H=%d firstrow=%d lastrow=%d "
|
||||
"pagelength=%d strategy=%d\n",
|
||||
S, J, H, firstrow, lastrow, pagelength, strategy);
|
||||
|
||||
weave = initialize_weave_params(S, J, H, firstrow, lastrow, pagelength);
|
||||
weave = initialize_weave_params(S, J, H, firstrow, lastrow,
|
||||
pagelength, strategy);
|
||||
passes = weave->first_unused_pass - weave->first_premapped_pass;
|
||||
|
||||
for (pass = 0; pass < passes; pass++) {
|
||||
|
@ -762,7 +882,7 @@ main(int ac, char *av[])
|
|||
}
|
||||
putchar('\n');
|
||||
}
|
||||
/*putchar('\n');*/
|
||||
//putchar('\n');
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -19,30 +19,11 @@
|
|||
* 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.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Main entry - just call gimp_main()...
|
||||
* query() - Respond to a plug-in query...
|
||||
* run() - Run the plug-in...
|
||||
* print_dialog() - Pop up the print dialog...
|
||||
* dialog_create_ivalue() - Create an integer value control...
|
||||
* dialog_iscale_update() - Update the value field using the scale.
|
||||
* dialog_ientry_update() - Update the value field using the text entry.
|
||||
* print_driver_callback() - Update the current printer driver...
|
||||
* media_size_callback() - Update the current media size...
|
||||
* print_command_callback() - Update the print command...
|
||||
* output_type_callback() - Update the current output type...
|
||||
* print_callback() - Start the print...
|
||||
* cancel_callback() - Cancel the print...
|
||||
* close_callback() - Exit the print dialog application.
|
||||
*
|
||||
* Revision History:
|
||||
*
|
||||
* See ChangeLog
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "print_gimp.h"
|
||||
|
||||
|
@ -51,6 +32,7 @@
|
|||
#endif
|
||||
|
||||
#include <signal.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/wait.h>
|
||||
#ifdef __EMX__
|
||||
#define INCL_DOSDEVICES
|
||||
|
@ -58,8 +40,9 @@
|
|||
#include <os2.h>
|
||||
#endif
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
#include <unistd.h>
|
||||
|
||||
#include "print-intl.h"
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
|
@ -74,7 +57,12 @@ static void query (void);
|
|||
static void run (char *, int, GParam *, int *, GParam **);
|
||||
static int do_print_dialog (char *proc_name);
|
||||
|
||||
#ifndef GIMP_1_0
|
||||
extern void gimp_create_main_window (void);
|
||||
#endif
|
||||
#ifndef NEW_UI_ONLY
|
||||
extern void gtk_create_main_window (void);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
static void cleanupfunc(void);
|
||||
|
@ -104,17 +92,17 @@ vars_t vars =
|
|||
"", /* Source of output media */
|
||||
"", /* Ink type */
|
||||
"", /* Dither algorithm */
|
||||
100, /* Output brightness */
|
||||
1.0, /* Output brightness */
|
||||
100.0, /* Scaling (100% means entire printable area, */
|
||||
/* -XXX means scale by PPI) */
|
||||
-1, /* Orientation (-1 = automatic) */
|
||||
-1, /* X offset (-1 = center) */
|
||||
-1, /* Y offset (-1 = center) */
|
||||
1.0, /* Screen gamma */
|
||||
100, /* Contrast */
|
||||
100, /* Red */
|
||||
100, /* Green */
|
||||
100, /* Blue */
|
||||
1.0, /* Contrast */
|
||||
1.0, /* Cyan */
|
||||
1.0, /* Magenta */
|
||||
1.0, /* Yellow */
|
||||
0, /* Linear */
|
||||
1.0, /* Output saturation */
|
||||
1.0, /* Density */
|
||||
|
@ -202,16 +190,16 @@ query (void)
|
|||
{ PARAM_STRING, "media_size", "Media size (\"Letter\", \"A4\", etc.)" },
|
||||
{ PARAM_STRING, "media_type", "Media type (\"Plain\", \"Glossy\", etc.)" },
|
||||
{ PARAM_STRING, "media_source", "Media source (\"Tray1\", \"Manual\", etc.)" },
|
||||
{ PARAM_INT32, "brightness", "Brightness (0-400%)" },
|
||||
{ PARAM_FLOAT, "brightness", "Brightness (0-400%)" },
|
||||
{ PARAM_FLOAT, "scaling", "Output scaling (0-100%, -PPI)" },
|
||||
{ PARAM_INT32, "orientation", "Output orientation (-1 = auto, 0 = portrait, 1 = landscape)" },
|
||||
{ PARAM_INT32, "left", "Left offset (points, -1 = centered)" },
|
||||
{ PARAM_INT32, "top", "Top offset (points, -1 = centered)" },
|
||||
{ PARAM_FLOAT, "gamma", "Output gamma (0.1 - 3.0)" },
|
||||
{ PARAM_INT32, "contrast", "Contrast" },
|
||||
{ PARAM_INT32, "red", "Red level" },
|
||||
{ PARAM_INT32, "green", "Green level" },
|
||||
{ PARAM_INT32, "blue", "Blue level" },
|
||||
{ PARAM_FLOAT, "contrast", "Contrast" },
|
||||
{ PARAM_FLOAT, "cyan", "Cyan level" },
|
||||
{ PARAM_FLOAT, "magenta", "Magenta level" },
|
||||
{ PARAM_FLOAT, "yellow", "Yellow level" },
|
||||
{ PARAM_INT32, "linear", "Linear output (0 = normal, 1 = linear)" },
|
||||
{ PARAM_INT32, "image_type", "Image type (0 = line art, 1 = solid tones, 2 = continuous tone, 3 = monochrome)"},
|
||||
{ PARAM_FLOAT, "saturation", "Saturation (0-1000%)" },
|
||||
|
@ -228,6 +216,16 @@ query (void)
|
|||
static gchar *copy = "Copyright 1997-2000 by Michael Sweet and Robert Krawitz";
|
||||
static gchar *types = "RGB*,GRAY*,INDEXED*";
|
||||
|
||||
#ifdef NEW_UI_ONLY
|
||||
gimp_install_procedure ("file_print_gimp",
|
||||
blurb, help, auth, copy,
|
||||
PLUG_IN_VERSION,
|
||||
N_("<Image>/File/Print..."),
|
||||
types,
|
||||
PROC_PLUG_IN,
|
||||
nargs, 0,
|
||||
args, NULL);
|
||||
#elif defined(GIMP_1_0)
|
||||
gimp_install_procedure ("file_print",
|
||||
blurb, help, auth, copy,
|
||||
PLUG_IN_VERSION,
|
||||
|
@ -236,6 +234,24 @@ query (void)
|
|||
PROC_PLUG_IN,
|
||||
nargs, 0,
|
||||
args, NULL);
|
||||
#else
|
||||
gimp_install_procedure ("file_print_gtk",
|
||||
blurb, help, auth, copy,
|
||||
PLUG_IN_VERSION,
|
||||
N_("<Image>/File/Print (Gtk)..."),
|
||||
types,
|
||||
PROC_PLUG_IN,
|
||||
nargs, 0,
|
||||
args, NULL);
|
||||
gimp_install_procedure ("file_print_gimp",
|
||||
blurb, help, auth, copy,
|
||||
PLUG_IN_VERSION,
|
||||
N_("<Image>/File/Print (Gimp)..."),
|
||||
types,
|
||||
PROC_PLUG_IN,
|
||||
nargs, 0,
|
||||
args, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -318,7 +334,7 @@ run (char *name, /* I - Name of print program. */
|
|||
*/
|
||||
|
||||
current_printer = get_printer_by_index (0);
|
||||
run_mode = param[0].data.d_int32;
|
||||
run_mode = (GRunModeType)param[0].data.d_int32;
|
||||
|
||||
values = g_new (GParam, 1);
|
||||
|
||||
|
@ -375,15 +391,6 @@ run (char *name, /* I - Name of print program. */
|
|||
switch (run_mode)
|
||||
{
|
||||
case RUN_INTERACTIVE:
|
||||
/*
|
||||
* Possibly retrieve data...
|
||||
*/
|
||||
gimp_get_data (PLUG_IN_NAME, &vars);
|
||||
vars.page_width = 0;
|
||||
vars.page_height = 0;
|
||||
|
||||
current_printer = get_printer_by_driver (vars.driver);
|
||||
|
||||
/*
|
||||
* Get information from the dialog...
|
||||
*/
|
||||
|
@ -445,19 +452,19 @@ run (char *name, /* I - Name of print program. */
|
|||
vars.contrast = 100;
|
||||
|
||||
if (nparams > 18)
|
||||
vars.red = param[18].data.d_int32;
|
||||
vars.cyan = param[18].data.d_int32;
|
||||
else
|
||||
vars.red = 100;
|
||||
vars.cyan = 100;
|
||||
|
||||
if (nparams > 19)
|
||||
vars.green = param[19].data.d_int32;
|
||||
vars.magenta = param[19].data.d_int32;
|
||||
else
|
||||
vars.green = 100;
|
||||
vars.magenta = 100;
|
||||
|
||||
if (nparams > 20)
|
||||
vars.blue = param[20].data.d_int32;
|
||||
vars.yellow = param[20].data.d_int32;
|
||||
else
|
||||
vars.blue = 100;
|
||||
vars.yellow = 100;
|
||||
|
||||
if (nparams > 21)
|
||||
vars.linear = param[21].data.d_int32;
|
||||
|
@ -681,6 +688,8 @@ run (char *name, /* I - Name of print program. */
|
|||
#ifndef GIMP_1_0
|
||||
if (export == EXPORT_EXPORT)
|
||||
gimp_image_delete (image_ID);
|
||||
#else
|
||||
; /* MRS: empty statement to suppress compiler warning */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -713,7 +722,16 @@ do_print_dialog (gchar *proc_name)
|
|||
/*
|
||||
* Print dialog window...
|
||||
*/
|
||||
gimp_create_main_window ();
|
||||
#ifdef NEW_UI_ONLY
|
||||
gimp_create_main_window();
|
||||
#elif defined(GIMP_1_0)
|
||||
gtk_create_main_window ();
|
||||
#else
|
||||
if (!strcmp (proc_name, "file_print_gimp"))
|
||||
gimp_create_main_window ();
|
||||
else
|
||||
gtk_create_main_window ();
|
||||
#endif
|
||||
|
||||
gtk_main ();
|
||||
gdk_flush ();
|
||||
|
@ -733,9 +751,10 @@ do_print_dialog (gchar *proc_name)
|
|||
static void
|
||||
initialize_printer(plist_t *printer)
|
||||
{
|
||||
const vars_t *def = print_default_settings();
|
||||
printer->name[0] = '\0';
|
||||
printer->active=0;
|
||||
memcpy(&(printer->v), &vars, sizeof(vars));
|
||||
memcpy(&(printer->v), def, sizeof(vars_t));
|
||||
}
|
||||
|
||||
#define GET_MANDATORY_STRING_PARAM(param) \
|
||||
|
@ -792,7 +811,14 @@ do { \
|
|||
} \
|
||||
else \
|
||||
{ \
|
||||
const vars_t *maxvars = print_maximum_settings(); \
|
||||
const vars_t *minvars = print_minimum_settings(); \
|
||||
const vars_t *defvars = print_default_settings(); \
|
||||
key.v.param = atof(lineptr); \
|
||||
if (key.v.param > 0 && \
|
||||
(key.v.param > 2 * maxvars->param || \
|
||||
key.v.param < minvars->param)) \
|
||||
key.v.param = defvars->param; \
|
||||
lineptr = commaptr + 1; \
|
||||
} \
|
||||
} while (0)
|
||||
|
@ -809,11 +835,14 @@ printrc_load(void)
|
|||
char line[1024], /* Line in printrc file */
|
||||
*lineptr, /* Pointer in line */
|
||||
*commaptr; /* Pointer to next comma */
|
||||
plist_t *p, /* Current printer */
|
||||
plist_t *p = 0, /* Current printer */
|
||||
key; /* Search key */
|
||||
#if (GIMP_MINOR_VERSION == 0)
|
||||
char *home; /* Home dir */
|
||||
#endif
|
||||
int format = 0; /* rc file format version */
|
||||
int system_printers; /* printer count before reading printrc */
|
||||
char * current_printer = 0; /* printer to select */
|
||||
|
||||
check_plist(1);
|
||||
|
||||
|
@ -823,6 +852,8 @@ printrc_load(void)
|
|||
|
||||
get_system_printers();
|
||||
|
||||
system_printers = plist_count - 1;
|
||||
|
||||
/*
|
||||
* Generate the filename for the current user...
|
||||
*/
|
||||
|
@ -852,93 +883,289 @@ printrc_load(void)
|
|||
* File exists - read the contents and update the printer list...
|
||||
*/
|
||||
|
||||
(void) memset(&key, 0, sizeof(plist_t));
|
||||
(void) memset(line, 0, 1024);
|
||||
while (fgets(line, sizeof(line), fp) != NULL)
|
||||
{
|
||||
int keepgoing = 1;
|
||||
if (line[0] == '#')
|
||||
{
|
||||
if (strncmp("#PRINTRCv", line, 9) == 0)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("Found printrc version tag: `%s'\n", line);
|
||||
printf("Version number: `%s'\n", &(line[9]));
|
||||
#endif
|
||||
(void) sscanf(&(line[9]), "%d", &format);
|
||||
}
|
||||
continue; /* Comment */
|
||||
initialize_printer(&key);
|
||||
lineptr = line;
|
||||
/*
|
||||
* Read the command-delimited printer definition data. Note that
|
||||
* we can't use sscanf because %[^,] fails if the string is empty...
|
||||
*/
|
||||
}
|
||||
if (format == 0)
|
||||
{
|
||||
/*
|
||||
* Read old format printrc lines...
|
||||
*/
|
||||
|
||||
GET_MANDATORY_STRING_PARAM(name);
|
||||
GET_MANDATORY_STRING_PARAM(v.output_to);
|
||||
GET_MANDATORY_STRING_PARAM(v.driver);
|
||||
initialize_printer(&key);
|
||||
lineptr = line;
|
||||
|
||||
if (! get_printer_by_driver(key.v.driver))
|
||||
continue;
|
||||
/*
|
||||
* Read the command-delimited printer definition data. Note that
|
||||
* we can't use sscanf because %[^,] fails if the string is empty...
|
||||
*/
|
||||
|
||||
GET_MANDATORY_STRING_PARAM(v.ppd_file);
|
||||
GET_MANDATORY_INT_PARAM(v.output_type);
|
||||
GET_MANDATORY_STRING_PARAM(v.resolution);
|
||||
GET_MANDATORY_STRING_PARAM(v.media_size);
|
||||
GET_MANDATORY_STRING_PARAM(v.media_type);
|
||||
GET_MANDATORY_STRING_PARAM(name);
|
||||
GET_MANDATORY_STRING_PARAM(v.output_to);
|
||||
GET_MANDATORY_STRING_PARAM(v.driver);
|
||||
|
||||
GET_OPTIONAL_STRING_PARAM(media_source);
|
||||
GET_OPTIONAL_INT_PARAM(brightness);
|
||||
GET_OPTIONAL_FLOAT_PARAM(scaling);
|
||||
GET_OPTIONAL_INT_PARAM(orientation);
|
||||
GET_OPTIONAL_INT_PARAM(left);
|
||||
GET_OPTIONAL_INT_PARAM(top);
|
||||
GET_OPTIONAL_FLOAT_PARAM(gamma);
|
||||
GET_OPTIONAL_INT_PARAM(contrast);
|
||||
GET_OPTIONAL_INT_PARAM(red);
|
||||
GET_OPTIONAL_INT_PARAM(green);
|
||||
GET_OPTIONAL_INT_PARAM(blue);
|
||||
GET_OPTIONAL_INT_PARAM(linear);
|
||||
GET_OPTIONAL_INT_PARAM(image_type);
|
||||
GET_OPTIONAL_FLOAT_PARAM(saturation);
|
||||
GET_OPTIONAL_FLOAT_PARAM(density);
|
||||
GET_OPTIONAL_STRING_PARAM(ink_type);
|
||||
GET_OPTIONAL_STRING_PARAM(dither_algorithm);
|
||||
GET_OPTIONAL_INT_PARAM(unit);
|
||||
if (! get_printer_by_driver(key.v.driver))
|
||||
continue;
|
||||
|
||||
GET_MANDATORY_STRING_PARAM(v.ppd_file);
|
||||
GET_MANDATORY_INT_PARAM(v.output_type);
|
||||
GET_MANDATORY_STRING_PARAM(v.resolution);
|
||||
GET_MANDATORY_STRING_PARAM(v.media_size);
|
||||
GET_MANDATORY_STRING_PARAM(v.media_type);
|
||||
|
||||
GET_OPTIONAL_STRING_PARAM(media_source);
|
||||
GET_OPTIONAL_FLOAT_PARAM(brightness);
|
||||
GET_OPTIONAL_FLOAT_PARAM(scaling);
|
||||
GET_OPTIONAL_INT_PARAM(orientation);
|
||||
GET_OPTIONAL_INT_PARAM(left);
|
||||
GET_OPTIONAL_INT_PARAM(top);
|
||||
GET_OPTIONAL_FLOAT_PARAM(gamma);
|
||||
GET_OPTIONAL_FLOAT_PARAM(contrast);
|
||||
GET_OPTIONAL_FLOAT_PARAM(cyan);
|
||||
GET_OPTIONAL_FLOAT_PARAM(magenta);
|
||||
GET_OPTIONAL_FLOAT_PARAM(yellow);
|
||||
GET_OPTIONAL_INT_PARAM(linear);
|
||||
GET_OPTIONAL_INT_PARAM(image_type);
|
||||
GET_OPTIONAL_FLOAT_PARAM(saturation);
|
||||
GET_OPTIONAL_FLOAT_PARAM(density);
|
||||
GET_OPTIONAL_STRING_PARAM(ink_type);
|
||||
GET_OPTIONAL_STRING_PARAM(dither_algorithm);
|
||||
GET_OPTIONAL_INT_PARAM(unit);
|
||||
|
||||
/*
|
||||
* The format of the list is the File printer followed by a qsort'ed list
|
||||
* of system printers. So, if we want to update the file printer, it is
|
||||
* always first in the list, else call bsearch.
|
||||
*/
|
||||
if ((strcmp(key.name, _("File")) == 0) && (strcmp(plist[0].name,
|
||||
_("File")) == 0))
|
||||
{
|
||||
if ((strcmp(key.name, _("File")) == 0) && (strcmp(plist[0].name,
|
||||
_("File")) == 0))
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("Updated File printer directly\n");
|
||||
printf("Updated File printer directly\n");
|
||||
#endif
|
||||
p = &plist[0];
|
||||
memcpy(p, &key, sizeof(plist_t));
|
||||
p->active = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((p = bsearch(&key, plist + 1, plist_count - 1, sizeof(plist_t),
|
||||
(int (*)(const void *, const void *))compare_printers))
|
||||
!= NULL)
|
||||
{
|
||||
p = &plist[0];
|
||||
memcpy(p, &key, sizeof(plist_t));
|
||||
p->active = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((p = bsearch(&key, plist + 1, plist_count - 1, sizeof(plist_t),
|
||||
(int (*)(const void *, const void *))compare_printers))
|
||||
!= NULL)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("Updating printer %s.\n", key.name);
|
||||
printf("Updating printer %s.\n", key.name);
|
||||
#endif
|
||||
memcpy(p, &key, sizeof(plist_t));
|
||||
p->active = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(p, &key, sizeof(plist_t));
|
||||
p->active = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Adding new printer from printrc file: %s\n",
|
||||
key.name);
|
||||
fprintf(stderr, "Adding new printer from printrc file: %s\n",
|
||||
key.name);
|
||||
#endif
|
||||
check_plist(plist_count + 1);
|
||||
p = plist + plist_count;
|
||||
memcpy(p, &key, sizeof(plist_t));
|
||||
p->active = 0;
|
||||
plist_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
check_plist(plist_count + 1);
|
||||
p = plist + plist_count;
|
||||
memcpy(p, &key, sizeof(plist_t));
|
||||
p->active = 0;
|
||||
plist_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (format == 1)
|
||||
{
|
||||
/*
|
||||
* Read new format printrc lines...
|
||||
*/
|
||||
|
||||
char *keyword, *end, *value;
|
||||
|
||||
keyword = line;
|
||||
for (keyword = line; isspace(*keyword); keyword++)
|
||||
{
|
||||
/* skip initial spaces... */
|
||||
}
|
||||
if (!isalpha(*keyword))
|
||||
continue;
|
||||
for (end = keyword; isalnum(*end) || *end == '-'; end++)
|
||||
{
|
||||
/* find end of keyword... */
|
||||
}
|
||||
value = end;
|
||||
while (isspace(*value)) {
|
||||
/* skip over white space... */
|
||||
value++;
|
||||
}
|
||||
if (*value != ':')
|
||||
continue;
|
||||
value++;
|
||||
*end = '\0';
|
||||
while (isspace(*value)) {
|
||||
/* skip over white space... */
|
||||
value++;
|
||||
}
|
||||
for (end = value; *end && *end != '\n'; end++)
|
||||
{
|
||||
/* find end of line... */
|
||||
}
|
||||
*end = '\0';
|
||||
#ifdef DEBUG
|
||||
printf("Keyword = `%s', value = `%s'\n", keyword, value);
|
||||
#endif
|
||||
if (strcasecmp("current-printer", keyword) == 0) {
|
||||
if (current_printer)
|
||||
free (current_printer);
|
||||
current_printer = strdup(value);
|
||||
} else if (strcasecmp("printer", keyword) == 0) {
|
||||
/* Switch to printer named VALUE */
|
||||
if (strcmp(_("File"), key.name) == 0
|
||||
&& strcmp(plist[0].name, _("File")) == 0)
|
||||
{
|
||||
if (get_printer_by_driver(key.v.driver))
|
||||
{
|
||||
p = &plist[0];
|
||||
memcpy(p, &key, sizeof(plist_t));
|
||||
p->active = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (get_printer_by_driver(key.v.driver))
|
||||
{
|
||||
p = bsearch(&key, plist + 1, plist_count - 1,
|
||||
sizeof(plist_t),
|
||||
(int (*)(const void *, const void *)) compare_printers);
|
||||
if (p == NULL)
|
||||
{
|
||||
check_plist(plist_count + 1);
|
||||
p = plist + plist_count;
|
||||
plist_count++;
|
||||
memcpy(p, &key, sizeof(plist_t));
|
||||
p->active = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(p, &key, sizeof(plist_t));
|
||||
p->active = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
initialize_printer(&key);
|
||||
strncpy(key.name, value, 127);
|
||||
} else if (strcasecmp("destination", keyword) == 0) {
|
||||
strncpy(key.v.output_to, value, 255);
|
||||
} else if (strcasecmp("driver", keyword) == 0) {
|
||||
strncpy(key.v.driver, value, 63);
|
||||
} else if (strcasecmp("ppd-file", keyword) == 0) {
|
||||
strncpy(key.v.ppd_file, value, 256);
|
||||
} else if (strcasecmp("output-type", keyword) == 0) {
|
||||
key.v.output_type = atoi(value);
|
||||
} else if (strcasecmp("resolution", keyword) == 0) {
|
||||
strncpy(key.v.resolution, value, 63);
|
||||
} else if (strcasecmp("media-size", keyword) == 0) {
|
||||
strncpy(key.v.media_size, value, 63);
|
||||
} else if (strcasecmp("media-type", keyword) == 0) {
|
||||
strncpy(key.v.media_type, value, 63);
|
||||
} else if (strcasecmp("media-source", keyword) == 0) {
|
||||
strncpy(key.v.media_source, value, 63);
|
||||
} else if (strcasecmp("brightness", keyword) == 0) {
|
||||
key.v.brightness = atof(value);
|
||||
} else if (strcasecmp("scaling", keyword) == 0) {
|
||||
key.v.scaling = atof(value);
|
||||
} else if (strcasecmp("orientation", keyword) == 0) {
|
||||
key.v.orientation = atoi(value);
|
||||
} else if (strcasecmp("left", keyword) == 0) {
|
||||
key.v.left = atoi(value);
|
||||
} else if (strcasecmp("top", keyword) == 0) {
|
||||
key.v.top = atoi(value);
|
||||
} else if (strcasecmp("gamma", keyword) == 0) {
|
||||
key.v.gamma = atof(value);
|
||||
} else if (strcasecmp("contrast", keyword) == 0) {
|
||||
key.v.contrast = atof(value);
|
||||
} else if (strcasecmp("cyan", keyword) == 0) {
|
||||
key.v.cyan = atof(value);
|
||||
} else if (strcasecmp("magenta", keyword) == 0) {
|
||||
key.v.magenta = atof(value);
|
||||
} else if (strcasecmp("yellow", keyword) == 0) {
|
||||
key.v.yellow = atof(value);
|
||||
} else if (strcasecmp("linear", keyword) == 0) {
|
||||
key.v.linear = atoi(value);
|
||||
} else if (strcasecmp("image-type", keyword) == 0) {
|
||||
key.v.image_type = atoi(value);
|
||||
} else if (strcasecmp("saturation", keyword) == 0) {
|
||||
key.v.saturation = atof(value);
|
||||
} else if (strcasecmp("density", keyword) == 0) {
|
||||
key.v.density = atof(value);
|
||||
} else if (strcasecmp("ink-type", keyword) == 0) {
|
||||
strncpy(key.v.ink_type, value, 63);
|
||||
} else if (strcasecmp("dither-algorithm", keyword) == 0) {
|
||||
strncpy(key.v.dither_algorithm, value, 63);
|
||||
} else if (strcasecmp("unit", keyword) == 0) {
|
||||
key.v.unit = atoi(value);
|
||||
} else {
|
||||
/* Unrecognised keyword; ignore it... */
|
||||
#if 1
|
||||
printf("Unrecognised keyword `%s' in printrc; value `%s'\n", keyword, value);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* We cannot read this file format...
|
||||
*/
|
||||
}
|
||||
}
|
||||
if (format > 0)
|
||||
{
|
||||
if (strcmp(_("File"), key.name) == 0
|
||||
&& strcmp(plist[0].name, _("File")) == 0)
|
||||
{
|
||||
if (get_printer_by_driver(key.v.driver))
|
||||
{
|
||||
p = &plist[0];
|
||||
memcpy(p, &key, sizeof(plist_t));
|
||||
p->active = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (get_printer_by_driver(key.v.driver))
|
||||
{
|
||||
p = bsearch(&key, plist + 1, plist_count - 1,
|
||||
sizeof(plist_t),
|
||||
(int (*)(const void *, const void *)) compare_printers);
|
||||
if (p == NULL)
|
||||
{
|
||||
check_plist(plist_count + 1);
|
||||
p = plist + plist_count;
|
||||
plist_count++;
|
||||
memcpy(p, &key, sizeof(plist_t));
|
||||
p->active = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(p, &key, sizeof(plist_t));
|
||||
p->active = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
|
@ -948,14 +1175,26 @@ printrc_load(void)
|
|||
* Select the current printer as necessary...
|
||||
*/
|
||||
|
||||
if (vars.output_to[0] != '\0')
|
||||
if (format == 1)
|
||||
{
|
||||
for (i = 0; i < plist_count; i ++)
|
||||
if (strcmp(vars.output_to, plist[i].v.output_to) == 0)
|
||||
break;
|
||||
if (current_printer)
|
||||
{
|
||||
for (i = 0; i < plist_count; i ++)
|
||||
if (strcmp(current_printer, plist[i].name) == 0)
|
||||
plist_current = i;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (vars.output_to[0] != '\0')
|
||||
{
|
||||
for (i = 0; i < plist_count; i ++)
|
||||
if (strcmp(vars.output_to, plist[i].v.output_to) == 0)
|
||||
break;
|
||||
|
||||
if (i < plist_count)
|
||||
plist_current = i;
|
||||
if (i < plist_count)
|
||||
plist_current = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1008,6 +1247,7 @@ printrc_save(void)
|
|||
fprintf(stderr, "Number of printers: %d\n", plist_count);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
fputs("#PRINTRC " PLUG_IN_VERSION "\n", fp);
|
||||
|
||||
for (i = 0, p = plist; i < plist_count; i ++, p ++)
|
||||
|
@ -1016,11 +1256,11 @@ printrc_save(void)
|
|||
p->name, p->v.output_to, p->v.driver, p->v.ppd_file,
|
||||
p->v.output_type, p->v.resolution, p->v.media_size,
|
||||
p->v.media_type, p->v.media_source);
|
||||
fprintf(fp, "%d,%.3f,%d,%d,%d,%.3f,",
|
||||
fprintf(fp, "%.3f,%.3f,%d,%d,%d,%.3f,",
|
||||
p->v.brightness, p->v.scaling, p->v.orientation, p->v.left,
|
||||
p->v.top, p->v.gamma);
|
||||
fprintf(fp, "%d,%d,%d,%d,%d,%d,%.3f,%.3f,%s,%s,%d,\n",
|
||||
p->v.contrast, p->v.red, p->v.green, p->v.blue,
|
||||
fprintf(fp, "%.3f,%.3f,%.3f,%.3f,%d,%d,%.3f,%.3f,%s,%s,%d,\n",
|
||||
p->v.contrast, p->v.cyan, p->v.magenta, p->v.yellow,
|
||||
p->v.linear, p->v.image_type, p->v.saturation, p->v.density,
|
||||
p->v.ink_type, p->v.dither_algorithm, p->v.unit);
|
||||
|
||||
|
@ -1029,6 +1269,46 @@ printrc_save(void)
|
|||
#endif
|
||||
|
||||
}
|
||||
#else
|
||||
fputs("#PRINTRCv1 written by GIMP-PRINT " PLUG_IN_VERSION "\n", fp);
|
||||
|
||||
fprintf(fp, "Current-Printer: %s\n", plist[plist_current].name);
|
||||
|
||||
for (i = 0, p = plist; i < plist_count; i ++, p ++)
|
||||
{
|
||||
fprintf(fp, "\nPrinter: %s\n", p->name);
|
||||
fprintf(fp, "Destination: %s\n", p->v.output_to);
|
||||
fprintf(fp, "Driver: %s\n", p->v.driver);
|
||||
fprintf(fp, "PPD-File: %s\n", p->v.ppd_file);
|
||||
fprintf(fp, "Output-Type: %d\n", p->v.output_type);
|
||||
fprintf(fp, "Resolution: %s\n", p->v.resolution);
|
||||
fprintf(fp, "Media-Size: %s\n", p->v.media_size);
|
||||
fprintf(fp, "Media-Type: %s\n", p->v.media_type);
|
||||
fprintf(fp, "Media-Source: %s\n", p->v.media_source);
|
||||
fprintf(fp, "Brightness: %.3f\n", p->v.brightness);
|
||||
fprintf(fp, "Scaling: %.3f\n", p->v.scaling);
|
||||
fprintf(fp, "Orientation: %d\n", p->v.orientation);
|
||||
fprintf(fp, "Left: %d\n", p->v.left);
|
||||
fprintf(fp, "Top: %d\n", p->v.top);
|
||||
fprintf(fp, "Gamma: %.3f\n", p->v.gamma);
|
||||
fprintf(fp, "Contrast: %.3f\n", p->v.contrast);
|
||||
fprintf(fp, "Cyan: %.3f\n", p->v.cyan);
|
||||
fprintf(fp, "Magenta: %.3f\n", p->v.magenta);
|
||||
fprintf(fp, "Yellow: %.3f\n", p->v.yellow);
|
||||
fprintf(fp, "Linear: %d\n", p->v.linear);
|
||||
fprintf(fp, "Image-Type: %d\n", p->v.image_type);
|
||||
fprintf(fp, "Saturation: %.3f\n", p->v.saturation);
|
||||
fprintf(fp, "Density: %.3f\n", p->v.density);
|
||||
fprintf(fp, "Ink-Type: %s\n", p->v.ink_type);
|
||||
fprintf(fp, "Dither-Algorithm: %s\n", p->v.dither_algorithm);
|
||||
fprintf(fp, "Unit: %d\n", p->v.unit);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Wrote printer %d: %s\n", i, p->name);
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif
|
||||
fclose(fp);
|
||||
} else {
|
||||
fprintf(stderr,"could not open printrc file \"%s\"\n",filename);
|
||||
|
@ -1045,7 +1325,7 @@ static int
|
|||
compare_printers(plist_t *p1, /* I - First printer to compare */
|
||||
plist_t *p2) /* I - Second printer to compare */
|
||||
{
|
||||
return (strcmp(p1->v.output_to, p2->v.output_to));
|
||||
return (strcmp(p1->name, p2->name));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1053,23 +1333,38 @@ compare_printers(plist_t *p1, /* I - First printer to compare */
|
|||
* 'get_system_printers()' - Get a complete list of printers from the spooler.
|
||||
*/
|
||||
|
||||
#define PRINTERS_NONE 0
|
||||
#define PRINTERS_LPC 1
|
||||
#define PRINTERS_LPSTAT 2
|
||||
|
||||
static void
|
||||
get_system_printers(void)
|
||||
{
|
||||
int i;
|
||||
char defname[17];
|
||||
#if defined(LPC_COMMAND) || defined(LPSTAT_COMMAND)
|
||||
FILE *pfile;
|
||||
char line[129];
|
||||
#endif
|
||||
#if defined(LPSTAT_COMMAND)
|
||||
char name[17];
|
||||
#endif
|
||||
int i; /* Looping var */
|
||||
int type; /* 0 = none, 1 = lpc, 2 = lpstat */
|
||||
char command[255]; /* Command to run */
|
||||
char defname[128]; /* Default printer name */
|
||||
FILE *pfile; /* Pipe to status command */
|
||||
char line[255]; /* Line from status command */
|
||||
char *ptr; /* Pointer into line */
|
||||
char name[128]; /* Printer name from status command */
|
||||
#ifdef __EMX__
|
||||
BYTE pnum;
|
||||
#endif
|
||||
static char *lpcs[] = /* Possible locations of LPC... */
|
||||
{
|
||||
"/etc"
|
||||
"/usr/bsd",
|
||||
"/usr/etc",
|
||||
"/usr/libexec",
|
||||
"/usr/sbin"
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Setup defaults...
|
||||
*/
|
||||
|
||||
defname[0] = '\0';
|
||||
|
||||
check_plist(1);
|
||||
|
@ -1080,52 +1375,90 @@ get_system_printers(void)
|
|||
strcpy(plist[0].v.driver, "ps2");
|
||||
plist[0].v.output_type = OUTPUT_COLOR;
|
||||
|
||||
#ifdef LPC_COMMAND
|
||||
if ((pfile = popen(LPC_COMMAND " status < /dev/null", "r")) != NULL)
|
||||
{
|
||||
while (fgets(line, sizeof(line), pfile) != NULL) {
|
||||
if (!strncmp(line,"Press RETURN to continue",24)) {
|
||||
char *ptr= index(line,':')+2;
|
||||
if (ptr && strlen(ptr)<(ptr-line))
|
||||
strcpy(line,ptr);
|
||||
}
|
||||
if (strchr(line, ':') != NULL && line[0] != ' ' && line[0] != '\t')
|
||||
{
|
||||
check_plist(plist_count + 1);
|
||||
*strchr(line, ':') = '\0';
|
||||
initialize_printer(&plist[plist_count]);
|
||||
strcpy(plist[plist_count].name, line);
|
||||
sprintf(plist[plist_count].v.output_to,LPR_COMMAND" -P%s -l",line);
|
||||
strcpy(plist[plist_count].v.driver, "ps2");
|
||||
plist_count ++;
|
||||
}
|
||||
}
|
||||
pclose(pfile);
|
||||
}
|
||||
#endif /* LPC_COMMAND */
|
||||
/*
|
||||
* Figure out what command to run... We use lpstat if it is available over
|
||||
* lpc since Solaris, CUPS, etc. provide both commands. No need to list
|
||||
* each printer twice...
|
||||
*/
|
||||
|
||||
#ifdef LPSTAT_COMMAND
|
||||
if ((pfile = popen(LPSTAT_COMMAND " -d -p", "r")) != NULL)
|
||||
if (!access("/usr/bin/lpstat", X_OK))
|
||||
{
|
||||
while (fgets(line, sizeof(line), pfile) != NULL)
|
||||
strcpy(command, "/usr/bin/lpstat -d -p");
|
||||
type = PRINTERS_LPSTAT;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < (sizeof(lpcs) / sizeof(lpcs[0])); i ++)
|
||||
{
|
||||
if ((sscanf(line, "printer %s", name) == 1) ||
|
||||
(sscanf(line, "Printer: %s", name) == 1))
|
||||
{
|
||||
check_plist(plist_count + 1);
|
||||
initialize_printer(&plist[plist_count]);
|
||||
strcpy(plist[plist_count].name, name);
|
||||
sprintf(plist[plist_count].v.output_to, LP_COMMAND " -s -d%s", name);
|
||||
strcpy(plist[plist_count].v.driver, "ps2");
|
||||
plist_count ++;
|
||||
}
|
||||
else
|
||||
sscanf(line, "system default destination: %s", defname);
|
||||
sprintf(command, "%s/lpc", lpcs[i]);
|
||||
|
||||
if (!access(command, X_OK))
|
||||
break;
|
||||
}
|
||||
|
||||
pclose(pfile);
|
||||
if (i < (sizeof(lpcs) / sizeof(lpcs[0])))
|
||||
{
|
||||
strcat(command, " status < /dev/null");
|
||||
type = PRINTERS_LPC;
|
||||
}
|
||||
else
|
||||
type = PRINTERS_NONE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Run the command, if any, to get the available printers...
|
||||
*/
|
||||
|
||||
if (type > PRINTERS_NONE)
|
||||
{
|
||||
if ((pfile = popen(command, "r")) != NULL)
|
||||
{
|
||||
/*
|
||||
* Read input as needed...
|
||||
*/
|
||||
|
||||
while (fgets(line, sizeof(line), pfile) != NULL)
|
||||
switch (type)
|
||||
{
|
||||
case PRINTERS_LPC :
|
||||
if (!strncmp(line, "Press RETURN to continue", 24) &&
|
||||
(ptr = strchr(line, ':')) != NULL &&
|
||||
(strlen(ptr) - 2) < (ptr - line))
|
||||
strcpy(line, ptr + 2);
|
||||
|
||||
if ((ptr = strchr(line, ':')) != NULL &&
|
||||
line[0] != ' ' && line[0] != '\t')
|
||||
{
|
||||
check_plist(plist_count + 1);
|
||||
*ptr = '\0';
|
||||
initialize_printer(&plist[plist_count]);
|
||||
strncpy(plist[plist_count].name, line, sizeof(plist[0].name) - 1);
|
||||
plist[plist_count].name[sizeof(plist[0].name) - 1] = '\0';
|
||||
sprintf(plist[plist_count].v.output_to, "lpr -P%s -l", line);
|
||||
strcpy(plist[plist_count].v.driver, "ps2");
|
||||
plist_count ++;
|
||||
}
|
||||
break;
|
||||
|
||||
case PRINTERS_LPSTAT :
|
||||
if ((sscanf(line, "printer %127s", name) == 1) ||
|
||||
(sscanf(line, "Printer: %127s", name) == 1))
|
||||
{
|
||||
check_plist(plist_count + 1);
|
||||
initialize_printer(&plist[plist_count]);
|
||||
strcpy(plist[plist_count].name, name);
|
||||
sprintf(plist[plist_count].v.output_to, "lp -s -d%s -oraw", name);
|
||||
strcpy(plist[plist_count].v.driver, "ps2");
|
||||
plist_count ++;
|
||||
}
|
||||
else
|
||||
sscanf(line, "system default destination: %127s", defname);
|
||||
break;
|
||||
}
|
||||
|
||||
pclose(pfile);
|
||||
}
|
||||
}
|
||||
#endif /* LPSTAT_COMMAND */
|
||||
|
||||
#ifdef __EMX__
|
||||
if (DosDevConfig(&pnum, DEVINFO_PRINTER) == NO_ERROR)
|
||||
|
|
|
@ -26,36 +26,21 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* This file must not include any gimp, glib, gtk, etc. headers.
|
||||
*
|
||||
* Eventually I intend to port this to GhostScript and/or CUPS. The only
|
||||
* file that should have GIMP-specific code is print.c. The rest of this
|
||||
* program should be completely generic.
|
||||
*
|
||||
* rlk 20000112
|
||||
* This file must include only standard C header files. The core code must
|
||||
* compile on generic platforms that don't support glib, gimp, gtk, etc.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef PRINT_HEADER
|
||||
#define PRINT_HEADER
|
||||
|
||||
/*
|
||||
* Include necessary header files...
|
||||
*/
|
||||
#ifndef HAVE_UNISTD_H
|
||||
#define HAVE_UNISTD_H
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Constants...
|
||||
|
@ -68,6 +53,8 @@
|
|||
#define ORIENT_AUTO -1 /* Best orientation */
|
||||
#define ORIENT_PORTRAIT 0 /* Portrait orientation */
|
||||
#define ORIENT_LANDSCAPE 1 /* Landscape orientation */
|
||||
#define ORIENT_UPSIDEDOWN 2 /* Reverse portrait orientation */
|
||||
#define ORIENT_SEASCAPE 3 /* Reverse landscape orientation */
|
||||
|
||||
#define MAX_CARRIAGE_WIDTH 80 /* This really needs to go away */
|
||||
/* For now, this is wide enough for 4B ISO */
|
||||
|
@ -76,22 +63,28 @@
|
|||
#define IMAGE_SOLID_TONE 1
|
||||
#define IMAGE_CONTINUOUS 2
|
||||
#define IMAGE_MONOCHROME 3
|
||||
#define NIMAGE_TYPES 4
|
||||
|
||||
/* Uncomment the next line to get performance statistics:
|
||||
* look for QUANT(#) in the code. At the end of escp2-print
|
||||
* run, it will print out how long and how many time did
|
||||
* certain pieces of code take. Of course, don't forget about
|
||||
* overhead of call to gettimeofday - it's not zero.
|
||||
* If you need more detailed performance stats, just put
|
||||
* QUANT() calls in the interesting spots in the code */
|
||||
/*#define QUANTIFY*/
|
||||
#ifdef QUANTIFY
|
||||
#include <assert.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#define QUANT(n)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Printer driver control structure. See "print.c" for the actual list...
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned steps;
|
||||
unsigned short *composite;
|
||||
unsigned short *red;
|
||||
unsigned short *green;
|
||||
unsigned short *blue;
|
||||
} lut_t;
|
||||
|
||||
|
||||
typedef struct /* Plug-in variables */
|
||||
{
|
||||
char output_to[256], /* Name of file or command to print to */
|
||||
|
@ -104,17 +97,17 @@ typedef struct /* Plug-in variables */
|
|||
media_source[64], /* Media source */
|
||||
ink_type[64], /* Ink or cartridge */
|
||||
dither_algorithm[64]; /* Dithering algorithm */
|
||||
int brightness; /* Output brightness */
|
||||
float brightness; /* Output brightness */
|
||||
float scaling; /* Scaling, percent of printable area */
|
||||
int orientation, /* Orientation - 0 = port., 1 = land.,
|
||||
-1 = auto */
|
||||
left, /* Offset from lower-lefthand corner, points */
|
||||
top; /* ... */
|
||||
float gamma; /* Gamma */
|
||||
int contrast, /* Output Contrast */
|
||||
red, /* Output red level */
|
||||
green, /* Output green level */
|
||||
blue; /* Output blue level */
|
||||
float contrast, /* Output Contrast */
|
||||
cyan, /* Output red level */
|
||||
magenta, /* Output green level */
|
||||
yellow; /* Output blue level */
|
||||
int linear; /* Linear density (mostly for testing!) */
|
||||
float saturation; /* Output saturation */
|
||||
float density; /* Maximum output density */
|
||||
|
@ -123,14 +116,14 @@ typedef struct /* Plug-in variables */
|
|||
float app_gamma; /* Application gamma */
|
||||
int page_width; /* Width of page in points */
|
||||
int page_height; /* Height of page in points */
|
||||
lut_t *lut; /* Look-up table */
|
||||
void *lut; /* Look-up table */
|
||||
unsigned char *cmap; /* Color map */
|
||||
} vars_t;
|
||||
|
||||
typedef struct /**** Printer List ****/
|
||||
{
|
||||
int active; /* Do we know about this printer? */
|
||||
char name[17]; /* Name of printer */
|
||||
char name[128]; /* Name of printer */
|
||||
vars_t v;
|
||||
} plist_t;
|
||||
|
||||
|
@ -287,7 +280,6 @@ extern void dither_set_max_ink(void *vd, int, double);
|
|||
extern void dither_set_x_oversample(void *vd, int os);
|
||||
extern void dither_set_y_oversample(void *vd, int os);
|
||||
extern void dither_set_adaptive_divisor(void *vd, unsigned divisor);
|
||||
extern void dither_set_error_mix(void *vd, double);
|
||||
|
||||
|
||||
extern void free_dither(void *);
|
||||
|
@ -295,21 +287,25 @@ extern void free_dither(void *);
|
|||
|
||||
extern void * initialize_weave_params(int S, int J, int O,
|
||||
int firstrow, int lastrow,
|
||||
int pagelength);
|
||||
int pagelength, int strategy);
|
||||
extern void calculate_row_parameters(void *w, int row, int subpass,
|
||||
int *pass, int *jet, int *startrow,
|
||||
int *phantomrows, int *jetsused);
|
||||
extern void destroy_weave_params(void *vw);
|
||||
|
||||
|
||||
extern void dither_fastblack(unsigned short *, int, void *, unsigned char *);
|
||||
extern void dither_monochrome(const unsigned short *, int, void *,
|
||||
unsigned char *, int duplicate_line);
|
||||
|
||||
extern void dither_black(unsigned short *, int, void *, unsigned char *);
|
||||
extern void dither_black(const unsigned short *, int, void *,
|
||||
unsigned char *, int duplicate_line);
|
||||
|
||||
extern void dither_cmyk(unsigned short *, int, void *, unsigned char *,
|
||||
extern void dither_cmyk(const unsigned short *, int, void *,
|
||||
unsigned char *,
|
||||
unsigned char *, unsigned char *,
|
||||
unsigned char *, unsigned char *,
|
||||
unsigned char *, unsigned char *);
|
||||
unsigned char *, unsigned char *,
|
||||
int duplicate_line);
|
||||
|
||||
extern void merge_printvars(vars_t *user, const vars_t *print);
|
||||
extern void free_lut(vars_t *v);
|
||||
|
@ -389,13 +385,57 @@ extern convert_t choose_colorfunc(int, int, const unsigned char *, int *,
|
|||
const vars_t *);
|
||||
extern void
|
||||
compute_page_parameters(int page_right, int page_left, int page_top,
|
||||
int page_bottom, int scaling, int image_width,
|
||||
int page_bottom, double scaling, int image_width,
|
||||
int image_height, Image image, int *orientation,
|
||||
int *page_width, int *page_height, int *out_width,
|
||||
int *out_height, int *left, int *top);
|
||||
|
||||
extern int
|
||||
verify_printer_params(const printer_t *, const vars_t *);
|
||||
extern const vars_t *print_default_settings(void);
|
||||
extern const vars_t *print_maximum_settings(void);
|
||||
extern const vars_t *print_minimum_settings(void);
|
||||
|
||||
#ifdef QUANTIFY
|
||||
/* Used for performance analysis - to be called before and after
|
||||
* the interval to be quantified */
|
||||
#define NUM_QUANTIFY_BUCKETS 1024
|
||||
extern unsigned quantify_counts[NUM_QUANTIFY_BUCKETS];
|
||||
extern struct timeval quantify_buckets[NUM_QUANTIFY_BUCKETS];
|
||||
extern int quantify_high_index;
|
||||
extern int quantify_first_time;
|
||||
extern struct timeval quantify_cur_time;
|
||||
extern struct timeval quantify_prev_time;
|
||||
|
||||
#define QUANT(number) \
|
||||
{\
|
||||
gettimeofday(&quantify_cur_time, NULL);\
|
||||
assert(number < NUM_QUANTIFY_BUCKETS);\
|
||||
quantify_counts[number]++;\
|
||||
\
|
||||
if (quantify_first_time) {\
|
||||
quantify_first_time = 0;\
|
||||
} else {\
|
||||
if (number > quantify_high_index) quantify_high_index = number;\
|
||||
if (quantify_prev_time.tv_usec > quantify_cur_time.tv_usec) {\
|
||||
quantify_buckets[number].tv_usec += ((quantify_cur_time.tv_usec + 1000000) - quantify_prev_time.tv_usec);\
|
||||
quantify_buckets[number].tv_sec += (quantify_cur_time.tv_sec - quantify_prev_time.tv_sec - 1);\
|
||||
} else {\
|
||||
quantify_buckets[number].tv_sec += quantify_cur_time.tv_sec - quantify_prev_time.tv_sec;\
|
||||
quantify_buckets[number].tv_usec += quantify_cur_time.tv_usec - quantify_prev_time.tv_usec;\
|
||||
}\
|
||||
if (quantify_buckets[number].tv_usec >= 1000000)\
|
||||
{\
|
||||
quantify_buckets[number].tv_usec -= 1000000;\
|
||||
quantify_buckets[number].tv_sec++;\
|
||||
}\
|
||||
}\
|
||||
\
|
||||
gettimeofday(&quantify_prev_time, NULL);\
|
||||
}
|
||||
|
||||
extern void print_timers(void );
|
||||
#endif
|
||||
|
||||
#endif /* PRINT_HEADER */
|
||||
/*
|
||||
|
|
|
@ -31,7 +31,14 @@
|
|||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define GIMP_ENABLE_COMPAT_CRUFT /* should go away soon */
|
||||
/*
|
||||
* We define GIMP_ENABLE_COMPAT_CRUFT here because we are still using
|
||||
* the old API names. This is because we have to support 1.0 as well.
|
||||
* This define is required as the default in Gimp was changed 24 Aug 00.
|
||||
* This should be removed when we stop supporting 1.0.
|
||||
*/
|
||||
|
||||
#define GIMP_ENABLE_COMPAT_CRUFT
|
||||
|
||||
#include <libgimp/gimp.h>
|
||||
#include <libgimp/gimpui.h>
|
||||
|
@ -48,13 +55,15 @@
|
|||
/*
|
||||
* Constants for GUI...
|
||||
*/
|
||||
#define PREVIEW_SIZE_VERT 240 /* Assuming max media size of 24" A2 */
|
||||
#define PREVIEW_SIZE_HORIZ 240 /* Assuming max media size of 24" A2 */
|
||||
|
||||
#if !defined(GIMP_MINOR_VERSION) || (GIMP_MAJOR_VERSION == 1 && GIMP_MINOR_VERSION == 0) || (GIMP_MAJOR_VERSION == 1 && GIMP_MINOR_VERSION == 1 && GIMP_MICRO_VERSION < 21)
|
||||
#define GIMP_1_0
|
||||
#endif
|
||||
|
||||
#if !defined(GIMP_PRINT_MAINT) && !defined(GIMP_1_0)
|
||||
#define NEW_UI_ONLY
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Function prototypes
|
||||
*/
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* Square dither matrix file for the gimp-print plugin.
|
||||
*
|
||||
* Copyright 1997-2000 Thomas Tonino
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
0, 60156, 18026, 33367, 58690, 13036, 36074, 45186, 5958, 41948, 17257, 47820,
|
||||
37695, 13228, 46128, 3065, 64984, 7250, 26229, 49266, 23368, 8664, 56745,
|
||||
31521, 62556, 7478, 58566, 28989, 52640, 25808, 36977, 7940, 50833, 3330,
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* 2:1 square dither matrix file for the gimp-print plugin.
|
||||
*
|
||||
* Copyright 1997-2000 Thomas Tonino
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
0, 48278, 37723, 17025, 50819, 28890, 7865, 64580, 37510, 20077,
|
||||
52886, 13212, 46891, 31060, 652, 57462, 27340, 16506, 55167, 36759,
|
||||
6916, 45562, 23744, 52563, 2901, 41512, 21474, 32446, 53710, 4752,
|
||||
|
|
Loading…
Reference in a new issue