plug-ins/print/print.[ch] plug-ins/print/print-page-layout.c removed

2007-07-23  Sven Neumann  <sven@gimp.org>

	* plug-ins/print/print.[ch]
	* plug-ins/print/print-page-layout.c
	* plug-ins/print/print-settings.[ch]: removed image_ID from the
	PrintData struct and made sure that the parasites are read from
	and attached to the original image, not the export image.


svn path=/trunk/; revision=22978
This commit is contained in:
Sven Neumann 2007-07-23 21:17:47 +00:00 committed by Sven Neumann
parent 1665395f50
commit bacbb23381
6 changed files with 52 additions and 48 deletions

View file

@ -1,3 +1,11 @@
2007-07-23 Sven Neumann <sven@gimp.org>
* plug-ins/print/print.[ch]
* plug-ins/print/print-page-layout.c
* plug-ins/print/print-settings.[ch]: removed image_ID from the
PrintData struct and made sure that the parasites are read from
and attached to the original image, not the export image.
2007-07-23 Sven Neumann <sven@gimp.org>
* plug-ins/print/print.c: don't add an alpha channel.

View file

@ -96,8 +96,8 @@ print_page_layout_gui (PrintData *data)
memset (&info, 0, sizeof (PrintSizeInfo));
info.data = data;
info.image_width = gimp_image_width (data->image_id);
info.image_height = gimp_image_height (data->image_id);
info.image_width = gimp_drawable_width (data->drawable_id);
info.image_height = gimp_drawable_height (data->drawable_id);
main_hbox = gtk_hbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (main_hbox), 12);
@ -310,7 +310,7 @@ print_size_frame (PrintData *data,
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
entry = gimp_size_entry_new (1, gimp_image_get_unit (data->image_id),
entry = gimp_size_entry_new (1, data->image_unit,
_("pixels/%a"),
FALSE, FALSE, FALSE, SB_WIDTH,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);

View file

@ -54,11 +54,10 @@ static GKeyFile * check_version (GKeyFile
* file of the same name
*/
gboolean
load_print_settings (PrintData *data)
load_print_settings (PrintData *data,
gint32 image_ID)
{
GKeyFile *key_file;
key_file = print_settings_key_file_from_parasite (data->image_id);
GKeyFile *key_file = print_settings_key_file_from_parasite (image_ID);
if (! key_file)
key_file = print_settings_key_file_from_resource_file ();
@ -78,7 +77,8 @@ load_print_settings (PrintData *data)
* and as an image parasite
*/
void
save_print_settings (PrintData *data)
save_print_settings (PrintData *data,
gint32 image_ID)
{
GKeyFile *key_file;
@ -93,7 +93,7 @@ save_print_settings (PrintData *data)
g_key_file_set_double (key_file, "image-setup", "x-offset", data->offset_x);
g_key_file_set_double (key_file, "image-setup", "y-offset", data->offset_y);
save_print_settings_as_parasite (key_file, data->image_id);
save_print_settings_as_parasite (key_file, image_ID);
g_key_file_free (key_file);
}

View file

@ -16,6 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
gboolean load_print_settings (PrintData *data);
void save_print_settings (PrintData *data);
gboolean load_print_settings (PrintData *data,
gint32 image_ID);
void save_print_settings (PrintData *data,
gint32 image_ID);

View file

@ -153,10 +153,10 @@ print_image (gint32 image_ID,
gint32 drawable_ID,
gboolean interactive)
{
GtkPrintOperation *operation = gtk_print_operation_new ();
GError *error = NULL;
PrintData *data;
GimpDrawable *drawable;
GtkPrintOperation *operation = gtk_print_operation_new ();
GError *error = NULL;
gint32 orig_image_ID = image_ID;
PrintData data;
GimpExportReturn export;
/* export the image */
@ -167,31 +167,28 @@ print_image (gint32 image_ID,
if (export == GIMP_EXPORT_CANCEL)
return FALSE;
drawable = gimp_drawable_get (drawable_ID);
data.num_pages = 1;
data.drawable_id = drawable_ID;
data.unit = gimp_get_default_unit ();
data.image_unit = gimp_image_get_unit (image_ID);
data.offset_x = 0;
data.offset_y = 0;
data.use_full_page = FALSE;
data.operation = operation;
data = g_new0 (PrintData, 1);
gimp_image_get_resolution (image_ID, &data.xres, &data.yres);
data->num_pages = 1;
data->image_id = image_ID;
data->drawable_id = drawable_ID;
data->operation = operation;
data->unit = gimp_get_default_unit ();
data->offset_x = 0;
data->offset_y = 0;
data->use_full_page = FALSE;
gimp_image_get_resolution (data->image_id, &data->xres, &data->yres);
load_print_settings (data);
load_print_settings (&data, orig_image_ID);
g_signal_connect (operation, "begin-print",
G_CALLBACK (begin_print),
data);
&data);
g_signal_connect (operation, "draw-page",
G_CALLBACK (draw_page),
data);
&data);
g_signal_connect (operation, "end-print",
G_CALLBACK (end_print),
data);
&data);
if (interactive)
{
@ -199,7 +196,7 @@ print_image (gint32 image_ID,
g_signal_connect (operation, "create-custom-widget",
G_CALLBACK (create_custom_widget),
data);
&data);
gtk_print_operation_set_custom_tab_label (operation, _("Image"));
@ -215,7 +212,7 @@ print_image (gint32 image_ID,
{
case GTK_PRINT_OPERATION_RESULT_APPLY:
case GTK_PRINT_OPERATION_RESULT_IN_PROGRESS:
save_print_settings (data);
save_print_settings (&data, orig_image_ID);
break;
case GTK_PRINT_OPERATION_RESULT_ERROR:
@ -232,8 +229,6 @@ print_image (gint32 image_ID,
g_object_unref (operation);
gimp_drawable_detach (drawable);
if (export == GIMP_EXPORT_EXPORT)
gimp_image_delete (image_ID);

View file

@ -18,17 +18,17 @@
typedef struct
{
gint num_pages;
gint32 drawable_id;
gint32 image_id;
GimpUnit unit;
gboolean show_info_header;
GtkPrintOperation *operation;
gdouble xres;
gdouble yres;
gdouble offset_x;
gdouble offset_y;
gboolean use_full_page;
GtkPageOrientation orientation;
gint num_pages;
gint32 drawable_id;
GimpUnit unit;
gboolean show_info_header;
gdouble xres;
gdouble yres;
GimpUnit image_unit;
gdouble offset_x;
gdouble offset_y;
gboolean use_full_page;
GtkPrintOperation *operation;
GtkPageOrientation orientation;
} PrintData;