Backported the UI changes of the 3.1.x gimp-print plugin to the stable

2000-04-01  Michael Natterer  <mitch@gimp.org>

	Backported the UI changes of the 3.1.x gimp-print plugin to the
	stable 3.0.x version.
	Put the printer definitions to a separate file and added the 3.1.x
	access functions. This way the new dialog files can be used with
	minimal changes.
	Bumped version number to 3.0.10.

	* po-plug-ins/POTFILES.in
	* plug-ins/print/Makefile.am
	* plug-ins/print/print_gimp.h
	* plug-ins/print/gimp_color_window.c
	* plug-ins/print/gimp_main_window.c: new files containing the
	dialog code.

	* plug-ins/print/print-printers.c: new file containing the printer
	definitions.

	* plug-ins/print/print-util.c: added printer list access functions.

	* plug-ins/print/print.[ch]: removed the dialog stuff and use the
	list access functions.
This commit is contained in:
Michael Natterer
2000-04-01 18:03:18 +00:00
committed by Michael Natterer
parent 817d062747
commit 300aa31cc8
10 changed files with 2466 additions and 1843 deletions

View File

@ -1,3 +1,27 @@
2000-04-01 Michael Natterer <mitch@gimp.org>
Backported the UI changes of the 3.1.x gimp-print plugin to the
stable 3.0.x version.
Put the printer definitions to a separate file and added the 3.1.x
access functions. This way the new dialog files can be used with
minimal changes.
Bumped version number to 3.0.10.
* po-plug-ins/POTFILES.in
* plug-ins/print/Makefile.am
* plug-ins/print/print_gimp.h
* plug-ins/print/gimp_color_window.c
* plug-ins/print/gimp_main_window.c: new files containing the
dialog code.
* plug-ins/print/print-printers.c: new file containing the printer
definitions.
* plug-ins/print/print-util.c: added printer list access functions.
* plug-ins/print/print.[ch]: removed the dialog stuff and use the
list access functions.
2000-04-01 Michael Natterer <mitch@gimp.org>
* plug-ins/flame/Makefile.am

View File

@ -5,12 +5,14 @@ libexecdir = $(gimpplugindir)/plug-ins
libexec_PROGRAMS = print
print_SOURCES = \
print-escp2.c \
print-pcl.c \
print-ps.c \
print-util.c \
print.c \
print.h
print-escp2.c \
print-pcl.c \
print-ps.c \
print-util.c \
print.c \
print.h \
gimp_color_window.c \
gimp_main_window.c
INCLUDES = \
-I$(top_srcdir) \

View File

@ -0,0 +1,286 @@
/*
* "$Id$"
*
* Main window code for Print plug-in for the GIMP.
*
* Copyright 1997-2000 Michael Sweet (mike@easysw.com),
* Robert Krawitz (rlk@alum.mit.edu), Steve Miller (smiller@rni.net)
* and Michael Natterer (mitch@gimp.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.
*/
#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 */
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 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);
/*
* gimp_create_color_adjust_window (void)
*
* NOTES:
* creates the color adjuster popup, allowing the user to adjust brightness,
* contrast, saturation, etc.
*/
void
gimp_create_color_adjust_window (void)
{
GtkWidget *dialog;
GtkWidget *table;
gimp_color_adjust_dialog = dialog =
gimp_dialog_new (_("Print Color Adjust"), "print",
gimp_plugin_help_func, "filters/print.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
_("Close"), gtk_widget_hide,
NULL, 1, NULL, TRUE, TRUE,
NULL);
table = gtk_table_new (8, 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_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), table,
FALSE, FALSE, 0);
gtk_widget_show (table);
/*
* Brightness slider...
*/
brightness_adjustment =
gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
_("Brightness:"), 200, 0,
vars.brightness, 0.0, 400.0, 1.0, 10.0, 0,
TRUE, 0, 0,
NULL, NULL);
gtk_signal_connect (GTK_OBJECT (brightness_adjustment), "value_changed",
GTK_SIGNAL_FUNC (gimp_brightness_update),
NULL);
/*
* Contrast slider...
*/
contrast_adjustment =
gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
_("Contrast:"), 200, 0,
vars.contrast, 25.0, 400.0, 1.0, 10.0, 0,
TRUE, 0, 0,
NULL, NULL);
gtk_signal_connect (GTK_OBJECT (contrast_adjustment), "value_changed",
GTK_SIGNAL_FUNC (gimp_contrast_update),
NULL);
/*
* Red 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 =
gimp_scale_entry_new (GTK_TABLE (table), 0, 3,
_("Green:"), 200, 0,
vars.green, 0.0, 200.0, 1.0, 10.0, 0,
TRUE, 0, 0,
NULL, NULL);
gtk_signal_connect (GTK_OBJECT (green_adjustment), "value_changed",
GTK_SIGNAL_FUNC (gimp_green_update),
NULL);
/*
* Blue slider...
*/
blue_adjustment =
gimp_scale_entry_new (GTK_TABLE (table), 0, 4,
_("Blue:"), 200, 0,
vars.blue, 0.0, 200.0, 1.0, 10.0, 0,
TRUE, 0, 0,
NULL, NULL);
gtk_signal_connect (GTK_OBJECT (blue_adjustment), "value_changed",
GTK_SIGNAL_FUNC (gimp_blue_update),
NULL);
/*
* Saturation slider...
*/
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,
TRUE, 0, 0,
NULL, NULL);
gtk_signal_connect (GTK_OBJECT (saturation_adjustment), "value_changed",
GTK_SIGNAL_FUNC (gimp_saturation_update),
NULL);
/*
* Density slider...
*/
density_adjustment =
gimp_scale_entry_new (GTK_TABLE (table), 0, 6,
_("Density:"), 200, 0,
vars.density, 0.1, 3.0, 0.001, 0.01, 3,
TRUE, 0, 0,
NULL, NULL);
gtk_signal_connect (GTK_OBJECT (density_adjustment), "value_changed",
GTK_SIGNAL_FUNC (gimp_density_update),
NULL);
/*
* Gamma slider...
*/
gamma_adjustment =
gimp_scale_entry_new (GTK_TABLE (table), 0, 7,
_("Gamma:"), 200, 0,
vars.gamma, 0.1, 4.0, 0.001, 0.01, 3,
TRUE, 0, 0,
NULL, NULL);
gtk_signal_connect (GTK_OBJECT (gamma_adjustment), "value_changed",
GTK_SIGNAL_FUNC (gimp_gamma_update),
NULL);
}
static void
gimp_brightness_update (GtkAdjustment *adjustment)
{
if (vars.brightness != adjustment->value)
{
vars.brightness = adjustment->value;
plist[plist_current].v.brightness = adjustment->value;
}
}
static void
gimp_contrast_update (GtkAdjustment *adjustment)
{
if (vars.contrast != adjustment->value)
{
vars.contrast = adjustment->value;
plist[plist_current].v.contrast = adjustment->value;
}
}
static void
gimp_red_update (GtkAdjustment *adjustment)
{
if (vars.red != adjustment->value)
{
vars.red = adjustment->value;
plist[plist_current].v.red = adjustment->value;
}
}
static void
gimp_green_update (GtkAdjustment *adjustment)
{
if (vars.green != adjustment->value)
{
vars.green = adjustment->value;
plist[plist_current].v.green = adjustment->value;
}
}
static void
gimp_blue_update (GtkAdjustment *adjustment)
{
if (vars.blue != adjustment->value)
{
vars.blue = adjustment->value;
plist[plist_current].v.blue = adjustment->value;
}
}
static void
gimp_saturation_update (GtkAdjustment *adjustment)
{
if (vars.saturation != adjustment->value)
{
vars.saturation = adjustment->value;
plist[plist_current].v.saturation = adjustment->value;
}
}
static void
gimp_density_update (GtkAdjustment *adjustment)
{
if (vars.density != adjustment->value)
{
vars.density = adjustment->value;
plist[plist_current].v.density = adjustment->value;
}
}
static void
gimp_gamma_update (GtkAdjustment *adjustment)
{
if (vars.gamma != adjustment->value)
{
vars.gamma = adjustment->value;
plist[plist_current].v.gamma = adjustment->value;
}
}
#endif /* ! GIMP_1_0 */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,353 @@
#include "libgimp/stdplugins-intl.h"
printer_t printers[] = /* List of supported printer types */
{
{
N_("PostScript Level 1"),
"ps",
1,
0,
1.000,
1.000,
ps_parameters,
ps_media_size,
ps_imageable_area,
ps_print
},
{
N_("PostScript Level 2"),
"ps2",
1,
1,
1.000,
1.000,
ps_parameters,
ps_media_size,
ps_imageable_area,
ps_print
},
{
N_("HP DeskJet 500, 520"),
"pcl-500",
0,
500,
0.818,
0.786,
pcl_parameters,
default_media_size,
pcl_imageable_area,
pcl_print
},
{
N_("HP DeskJet 500C, 540C"),
"pcl-501",
1,
501,
0.818,
0.786,
pcl_parameters,
default_media_size,
pcl_imageable_area,
pcl_print
},
{
N_("HP DeskJet 550C, 560C"),
"pcl-550",
1,
550,
0.818,
0.786,
pcl_parameters,
default_media_size,
pcl_imageable_area,
pcl_print
},
{
N_("HP DeskJet 600 series"),
"pcl-600",
1,
600,
0.818,
0.786,
pcl_parameters,
default_media_size,
pcl_imageable_area,
pcl_print },
{
N_("HP DeskJet 800 series"),
"pcl-800",
1,
800,
0.818,
0.786,
pcl_parameters,
default_media_size,
pcl_imageable_area,
pcl_print
},
{
N_("HP DeskJet 1100C, 1120C"),
"pcl-1100",
1,
1100,
0.818,
0.786,
pcl_parameters,
default_media_size,
pcl_imageable_area,
pcl_print
},
{
N_("HP DeskJet 1200C, 1600C"),
"pcl-1200",
1,
1200,
0.818,
0.786,
pcl_parameters,
default_media_size,
pcl_imageable_area,
pcl_print
},
{
N_("HP LaserJet II series"),
"pcl-2",
0,
2,
1.000,
0.596,
pcl_parameters,
default_media_size,
pcl_imageable_area,
pcl_print
},
{
N_("HP LaserJet III series"),
"pcl-3",
0,
3,
1.000,
0.596,
pcl_parameters,
default_media_size,
pcl_imageable_area,
pcl_print
},
{
N_("HP LaserJet 4 series"),
"pcl-4",
0,
4,
1.000,
0.615,
pcl_parameters,
default_media_size,
pcl_imageable_area,
pcl_print
},
{
N_("HP LaserJet 4V, 4Si"),
"pcl-4v",
0,
5,
1.000,
0.615,
pcl_parameters,
default_media_size,
pcl_imageable_area,
pcl_print
},
{
N_("HP LaserJet 5 series"),
"pcl-5",
0,
4,
1.000,
0.615,
pcl_parameters,
default_media_size,
pcl_imageable_area,
pcl_print
},
{
N_("HP LaserJet 5Si"),
"pcl-5si",
0,
5,
1.000,
0.615,
pcl_parameters,
default_media_size,
pcl_imageable_area,
pcl_print
},
{
N_("HP LaserJet 6 series"),
"pcl-6",
0,
4,
1.000,
0.615,
pcl_parameters,
default_media_size,
pcl_imageable_area,
pcl_print
},
{
N_("EPSON Stylus Color"),
"escp2",
1,
0,
0.597,
0.568,
escp2_parameters,
default_media_size,
escp2_imageable_area,
escp2_print
},
{
N_("EPSON Stylus Color Pro"),
"escp2-pro",
1,
1,
0.597,
0.631,
escp2_parameters,
default_media_size,
escp2_imageable_area,
escp2_print
},
{
N_("EPSON Stylus Color Pro XL"),
"escp2-proxl",
1,
1,
0.597,
0.631,
escp2_parameters,
default_media_size,
escp2_imageable_area,
escp2_print
},
{
N_("EPSON Stylus Color 1500"),
"escp2-1500",
1,
2,
0.597,
0.631,
escp2_parameters,
default_media_size,
escp2_imageable_area,
escp2_print
},
{
N_("EPSON Stylus Color 400"),
"escp2-400",
1,
1,
0.585,
0.646,
escp2_parameters,
default_media_size,
escp2_imageable_area,
escp2_print
},
{
N_("EPSON Stylus Color 500"),
"escp2-500",
1,
1,
0.597,
0.631,
escp2_parameters,
default_media_size,
escp2_imageable_area,
escp2_print
},
{
N_("EPSON Stylus Color 600"),
"escp2-600",
1,
3,
0.585,
0.646,
escp2_parameters,
default_media_size,
escp2_imageable_area,
escp2_print
},
{
N_("EPSON Stylus Color 800"),
"escp2-800",
1,
4,
0.585,
0.646,
escp2_parameters,
default_media_size,
escp2_imageable_area,
escp2_print
},
{
N_("EPSON Stylus Color 1520"),
"escp2-1520",
1,
5,
0.585,
0.646,
escp2_parameters,
default_media_size,
escp2_imageable_area,
escp2_print
},
{
N_("EPSON Stylus Color 3000"),
"escp2-3000",
1,
5,
0.585,
0.646,
escp2_parameters,
default_media_size,
escp2_imageable_area,
escp2_print
},
{
N_("EPSON Stylus Photo 700"),
"escp2-700",
1,
6,
0.585,
0.646,
escp2_parameters,
default_media_size,
escp2_imageable_area,
escp2_print
},
{
N_("EPSON Stylus Photo EX"),
"escp2-ex",
1,
7,
0.585,
0.646,
escp2_parameters,
default_media_size,
escp2_imageable_area,
escp2_print
},
{
N_("EPSON Stylus Photo"),
"escp2-photo",
1,
8,
0.585,
0.646,
escp2_parameters,
default_media_size,
escp2_imageable_area,
escp2_print
}
};
const static int printer_count = sizeof(printers) / sizeof(printer_t);

View File

@ -1956,5 +1956,66 @@ default_media_size(int model, /* I - Printer model */
}
/*
* End of "$Id$".
* The list of printers has been moved to printers.c
*/
#include "print-printers.c"
int
known_printers(void)
{
return printer_count;
}
const printer_t *
get_printers(void)
{
return printers;
}
const printer_t *
get_printer_by_index(int idx)
{
return &(printers[idx]);
}
const printer_t *
get_printer_by_long_name(const char *long_name)
{
const printer_t *val = &(printers[0]);
int i;
for (i = 0; i < known_printers(); i++)
{
if (!strcmp(val->long_name, long_name))
return val;
val++;
}
return NULL;
}
const printer_t *
get_printer_by_driver(const char *driver)
{
const printer_t *val = &(printers[0]);
int i;
for (i = 0; i < known_printers(); i++)
{
if (!strcmp(val->driver, driver))
return val;
val++;
}
return NULL;
}
int
get_printer_index_by_driver(const char *driver)
{
int idx = 0;
const printer_t *val = &(printers[0]);
for (idx = 0; idx < known_printers(); idx++)
{
if (!strcmp(val->driver, driver))
return idx;
val++;
}
return -1;
}

File diff suppressed because it is too large Load Diff

View File

@ -236,6 +236,13 @@ extern void indexed_to_gray(unsigned char *, unsigned char *, int, int,
lut_t *, unsigned char *, float);
#endif
int known_printers(void);
const printer_t *get_printers(void);
const printer_t *get_printer_by_index(int);
const printer_t *get_printer_by_long_name(const char *);
const printer_t *get_printer_by_driver(const char *);
int get_printer_index_by_driver(const char *);
/*
* End of "$Id$".
*/

View File

@ -0,0 +1,51 @@
/*
* "$Id$"
*
* Print plug-in for the GIMP.
*
* Copyright 1997-2000 Michael Sweet (mike@easysw.com),
* Robert Krawitz (rlk@alum.mit.edu). and Steve Miller (smiller@rni.net
*
* 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.
*
*
* Revision History:
*
* See ChangeLog
*/
#ifndef PRINT_GIMP_HEADER
#define PRINT_GIMP_HEADER
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#include "print.h"
/*
* All Gimp-specific code is in this file.
*/
#define PLUG_IN_VERSION "3.0.10 - 01 Apr 2000"
#define PLUG_IN_NAME "Print"
/*
* 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 */
#define MAX_PLIST 100
#endif

View File

@ -235,7 +235,10 @@ plug-ins/maze/maze.c
plug-ins/maze/maze_face.c
plug-ins/mosaic/mosaic.c
plug-ins/pagecurl/pagecurl.c
plug-ins/print/gimp_color_window.c
plug-ins/print/gimp_main_window.c
plug-ins/print/print.c
plug-ins/print/print-printers.c
plug-ins/rcm/rcm.c
plug-ins/rcm/rcm_callback.c
plug-ins/rcm/rcm_dialog.c