Commit 3d5b39f7 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

plug-ins/print/* updated to the current CVS version from sourceforge

2000-08-15  Michael Natterer  <mitch@gimp.org>

	* plug-ins/print/*
	* po-plug-ins/POTFILES.in: updated to the current CVS version
	from sourceforge (something after 4.0a1).
parent 0bb72aa6
2000-08-15 Michael Natterer <mitch@gimp.org>
* plug-ins/print/*
* po-plug-ins/POTFILES.in: updated to the current CVS version
from sourceforge (something after 4.0a1).
2000-08-14 Daniel Egger <egger@suse.de>
 
* app/menus.c: Added missing tearoff_delete_cb prototype.
......
......@@ -7,15 +7,22 @@ EXTRA_DIST = print-printers.c
libexec_PROGRAMS = print
print_SOURCES = \
print_gimp.h \
print-canon.c \
print-dither.c \
print-escp2.c \
print-pcl.c \
print-ps.c \
print-util.c \
print.c \
print-weave.c \
print.h \
quickmatrix257.h \
ran.367.179.h \
\
print-image-gimp.c \
print.c \
gimp_color_window.c \
gimp_main_window.c
gimp_main_window.c \
print_gimp.h
INCLUDES = \
-I$(top_srcdir) \
......@@ -23,11 +30,13 @@ INCLUDES = \
-I$(includedir)
AM_CPPFLAGS = \
-DLOCALEDIR=\""$(localedir)"\" \
@LP_DEF@ \
@LPSTAT_DEF@ \
@LPR_DEF@ \
@LPC_DEF@
-DLOCALEDIR=\""$(localedir)"\" \
@LP_DEF@ \
@LPSTAT_DEF@ \
@LPR_DEF@ \
@LPC_DEF@ \
-DVERSION=\"4.0a1\" \
-DRELEASE_DATE=\"11\ Aug\ 2000\"
LDADD = \
$(top_builddir)/libgimp/libgimpui.la \
......
......@@ -21,33 +21,33 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include "print_gimp.h"
#ifndef GIMP_1_0
#include <libgimp/gimpui.h>
#include "libgimp/stdplugins-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[MAX_PLIST]; /* System printers */
extern plist_t *plist; /* System printers */
GtkWidget *gimp_color_adjust_dialog;
GtkObject *brightness_adjustment;
GtkObject *saturation_adjustment;
GtkObject *density_adjustment;
GtkObject *contrast_adjustment;
GtkObject *red_adjustment;
GtkObject *green_adjustment;
GtkObject *blue_adjustment;
GtkObject *gamma_adjustment;
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 *gamma_adjustment;
static GtkWidget *dither_algo_button = NULL;
static GtkWidget *dither_algo_menu = NULL;
static void gimp_brightness_update (GtkAdjustment *adjustment);
static void gimp_saturation_update (GtkAdjustment *adjustment);
......@@ -58,6 +58,10 @@ static void gimp_green_update (GtkAdjustment *adjustment);
static void gimp_blue_update (GtkAdjustment *adjustment);
static void gimp_gamma_update (GtkAdjustment *adjustment);
static void gimp_dither_algo_callback (GtkWidget *widget,
gpointer data);
void gimp_build_dither_menu (void);
/*
* gimp_create_color_adjust_window (void)
......@@ -71,10 +75,10 @@ gimp_create_color_adjust_window (void)
{
GtkWidget *dialog;
GtkWidget *table;
gimp_color_adjust_dialog = dialog =
gimp_dialog_new (_("Print Color Adjust"), "print",
gimp_standard_help_func, "filters/print.html",
gimp_plugin_help_func, "filters/print.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
......@@ -83,10 +87,13 @@ gimp_create_color_adjust_window (void)
NULL);
table = gtk_table_new (8, 3, FALSE);
table = gtk_table_new (9, 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), 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_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), table,
FALSE, FALSE, 0);
gtk_widget_show (table);
......@@ -168,7 +175,7 @@ gimp_create_color_adjust_window (void)
saturation_adjustment =
gimp_scale_entry_new (GTK_TABLE (table), 0, 5,
_("Saturation:"), 200, 0,
vars.saturation, 0.001, 10.0, 0.001, 0.01, 3,
vars.saturation, 0, 10.0, 0.001, 0.01, 3,
TRUE, 0, 0,
NULL, NULL);
gtk_signal_connect (GTK_OBJECT (saturation_adjustment), "value_changed",
......@@ -202,6 +209,16 @@ gimp_create_color_adjust_window (void)
gtk_signal_connect (GTK_OBJECT (gamma_adjustment), "value_changed",
GTK_SIGNAL_FUNC (gimp_gamma_update),
NULL);
/*
* Dither algorithm option menu...
*/
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 ();
}
static void
......@@ -284,4 +301,106 @@ gimp_gamma_update (GtkAdjustment *adjustment)
}
}
void
gimp_do_color_updates(void)
{
gtk_adjustment_set_value (GTK_ADJUSTMENT (brightness_adjustment),
plist[plist_current].v.brightness);
gtk_adjustment_set_value (GTK_ADJUSTMENT (gamma_adjustment),
plist[plist_current].v.gamma);
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 (green_adjustment),
plist[plist_current].v.green);
gtk_adjustment_set_value (GTK_ADJUSTMENT (blue_adjustment),
plist[plist_current].v.blue);
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);
}
void
gimp_build_dither_menu (void)
{
GtkWidget *item;
GtkWidget *item0 = NULL;
gint i;
if (dither_algo_menu != NULL)
{
gtk_widget_destroy (dither_algo_menu);
dither_algo_menu = NULL;
}
dither_algo_menu = gtk_menu_new ();
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");
}
}
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]);
}
#endif /* ! GIMP_1_0 */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* "$Id$"
*
* Print plug-in for the GIMP.
*
* Copyright 1997-2000 Michael Sweet (mike@easysw.com) and
* Robert Krawitz (rlk@alum.mit.edu)
* Copyright 2000 Charles Briscoe-Smith <cpbs@debian.org>
*
* 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.
*
* Contents:
*
* See print.h for prototypes
*
* Revision History:
*
* See ChangeLog
*/
#include "config.h"
#include "print_gimp.h"
#include "libgimp/stdplugins-intl.h"
/*
* "Image" ADT
*
* This file defines an abstract data type called "Image". An Image wraps
* a Gimp drawable (or some other application-level image representation)
* for presentation to the low-level printer drivers (which do CMYK
* separation, dithering and weaving). The Image ADT has the ability
* to perform any combination of flips and rotations on the image,
* and then deliver individual rows to the driver code.
*
* Stuff which might be useful to do in this layer:
*
* - Scaling, optionally with interpolation/filtering.
*
* - Colour-adjustment.
*
* - Multiple-image composition.
*
* Also useful might be to break off a thin application-dependent
* sublayer leaving this layer (which does the interesting stuff)
* application-independent.
*/
/* Concrete type to represent image */
typedef struct
{
GDrawable *drawable;
GPixelRgn rgn;
/*
* Transformations we can impose on the image. The transformations
* are considered to be performed in the order given here.
*/
/* 1: Transpose the x and y axes (flip image over its leading diagonal) */
int columns; /* Set if returning columns instead of rows. */
/* 2: Translate (ox,oy) to the origin */
int ox, oy; /* Origin of image */
/* 3: Flip vertically about the x axis */
int increment; /* +1 or -1 for offset of row n+1 from row n. */
/* 4: Crop to width w, height h */
int w, h; /* Width and height of output image */
/* 5: Flip horizontally about the vertical centre-line of the image */
int mirror; /* Set if mirroring rows end-for-end. */
} Gimp_Image_t;
Image
Image_GDrawable_new(GDrawable *drawable)
{
Gimp_Image_t *i = malloc(sizeof(Gimp_Image_t));
i->drawable = drawable;
gimp_pixel_rgn_init(&(i->rgn), drawable, 0, 0,
drawable->width, drawable->height, FALSE, FALSE);
Image_reset((Image) i);
return i;
}
void
Image_init(Image image)
{
/* Nothing to do. */
}
void
Image_reset(Image image)
{
Gimp_Image_t *i = (Gimp_Image_t *) image;
i->columns = FALSE;
i->ox = 0;
i->oy = 0;
i->increment = 1;
i->w = i->drawable->width;
i->h = i->drawable->height;
i->mirror = FALSE;
}
void
Image_transpose(Image image)
{
Gimp_Image_t *i = (Gimp_Image_t *) image;
int tmp;
if (i->mirror) i->ox += i->w - 1;
i->columns = !i->columns;
tmp = i->ox;
i->ox = i->oy;
i->oy = tmp;
tmp = i->mirror;
i->mirror = i->increment < 0;
i->increment = tmp ? -1 : 1;
tmp = i->w;
i->w = i->h;
i->h = tmp;
if (i->mirror) i->ox -= i->w - 1;
}
void
Image_hflip(Image image)
{
Gimp_Image_t *i = (Gimp_Image_t *) image;
i->mirror = !i->mirror;
}
void
Image_vflip(Image image)
{
Gimp_Image_t *i = (Gimp_Image_t *) image;
i->oy += (i->h-1) * i->increment;
i->increment = -i->increment;
}
/*
* Image_crop:
*
* Crop the given number of pixels off the LEFT, TOP, RIGHT and BOTTOM
* of the image.
*/
void
Image_crop(Image image, int left, int top, int right, int bottom)
{
Gimp_Image_t *i = (Gimp_Image_t *) image;
int xmax = (i->columns ? i->drawable->height : i->drawable->width) - 1;
int ymax = (i->columns ? i->drawable->width : i->drawable->height) - 1;
int nx = i->ox + i->mirror ? right : left;
int ny = i->oy + top * (i->increment);
int nw = i->w - left - right;
int nh = i->h - top - bottom;
int wmax, hmax;
if (nx < 0) nx = 0;
else if (nx > xmax) nx = xmax;
if (ny < 0) ny = 0;
else if (ny > ymax) ny = ymax;
wmax = xmax - nx + 1;
hmax = i->increment ? ny + 1 : ymax - ny + 1;
if (nw < 1) nw = 1;
else if (nw > wmax) nw = wmax;
if (nh < 1) nh = 1;
else if (nh > hmax) nh = hmax;
i->ox = nx;
i->oy = ny;
i->w = nw;
i->h = nh;
}
void
Image_rotate_ccw(Image image)
{
Image_transpose(image);
Image_vflip(image);
}
void
Image_rotate_cw(Image image)
{
Image_transpose(image);
Image_hflip(image);
}
void
Image_rotate_180(Image image)
{
Image_vflip(image);
Image_hflip(image);
}
int
Image_bpp(Image image)
{
Gimp_Image_t *i = (Gimp_Image_t *) image;
return i->drawable->bpp;
}
int
Image_width(Image image)
{
Gimp_Image_t *i = (Gimp_Image_t *) image;
return i->w;
}
int
Image_height(Image image)
{
Gimp_Image_t *i = (Gimp_Image_t *) image;
return i->h;
}
void
Image_get_row(Image image, unsigned char *data, int row)
{
Gimp_Image_t *i = (Gimp_Image_t *) image;
if (i->columns)
gimp_pixel_rgn_get_col(&(i->rgn), data,
i->oy + row * i->increment, i->ox, i->w);
else
gimp_pixel_rgn_get_row(&(i->rgn), data,
i->ox, i->oy + row * i->increment, i->w);
if (i->mirror) {
/* Flip row -- probably inefficiently */
int f, l, b = i->drawable->bpp;
for (f = 0, l = i->w - 1; f < l; f++, l--) {
int c;
unsigned char tmp;
for (c = 0; c < b; c++) {
tmp = data[f*b+c];
data[f*b+c] = data[l*b+c];
data[l*b+c] = tmp;
}
}
}
}
void
Image_progress_init(Image image)
{
gimp_progress_init(_("Printing..."));
}
void
Image_note_progress(Image image, double current, double total)
{
gimp_progress_update(current / total);
}
void
Image_progress_conclude(Image image)
{
gimp_progress_update(1);
}
const char *
Image_get_appname(Image image)
{
static char pluginname[] = PLUG_IN_NAME " plug-in V" PLUG_IN_VERSION
" for GIMP";
return pluginname;
}
/*
* End of "$Id$".
*/
This diff is collapsed.
This diff is collapsed.
......@@ -37,10 +37,12 @@
#include "print.h"
#include <time.h>
#include <glib.h>
#include <string.h>
#include <limits.h>
/*#define DEBUG*/
/*
* Local variables...
*/
......@@ -55,34 +57,24 @@ static char *ps_ppd_file = NULL;
static void ps_hex(FILE *, unsigned short *, int);
static void ps_ascii85(FILE *, unsigned short *, int, int);
static char *ppd_find(char *, char *, char *, int *);
static char *ppd_find(const char *, const char *, const char *, int *);
/*
* 'ps_parameters()' - Return the parameter values for the given parameter.
*/
char ** /* O - Parameter values */
ps_parameters(int model, /* I - Printer model */
char *ppd_file, /* I - PPD file (not used) */
char *name, /* I - Name of parameter */
int *count) /* O - Number of values */
char ** /* O - Parameter values */
ps_parameters(const printer_t *printer, /* I - Printer model */
char *ppd_file, /* I - PPD file (not used) */
char *name, /* I - Name of parameter */
int *count)