set a different filename when the number of pages loaded is lower than the

2007-04-25  Mukund Sivaraman  <muks@mukund.org>

        * plug-ins/common/tiff-load.c: set a different filename when           
        the number of pages loaded is lower than the number of pages
        in the TIFF file.


svn path=/trunk/; revision=22334
This commit is contained in:
Mukund Sivaraman
2007-04-25 15:14:52 +00:00
committed by Mukund Sivaraman
parent 3d4b8267ed
commit 2524776c36
2 changed files with 13 additions and 12 deletions

View File

@ -1,3 +1,9 @@
2007-04-25 Mukund Sivaraman <muks@mukund.org>
* plug-ins/common/tiff-load.c: set a different filename when
the number of pages loaded is lower than the number of pages
in the TIFF file.
2007-04-25 Mukund Sivaraman <muks@mukund.org> 2007-04-25 Mukund Sivaraman <muks@mukund.org>
* plug-ins/common/tiff-load.c: set the filename to the original * plug-ins/common/tiff-load.c: set the filename to the original

View File

@ -77,6 +77,7 @@ typedef struct
typedef struct typedef struct
{ {
gint o_pages;
gint n_pages; gint n_pages;
gint *pages; gint *pages;
} TiffSelectedPages; } TiffSelectedPages;
@ -273,7 +274,7 @@ run (const gchar *name,
} }
else else
{ {
pages.n_pages = TIFFNumberOfDirectories (tif); pages.n_pages = pages.o_pages = TIFFNumberOfDirectories (tif);
if (pages.n_pages == 0) if (pages.n_pages == 0)
{ {
@ -507,7 +508,6 @@ load_image (const gchar *filename,
gchar *name; gchar *name;
GList *images_list = NULL, *images_list_temp; GList *images_list = NULL, *images_list_temp;
gboolean do_images;
gint li; gint li;
gboolean flip_horizontal = FALSE; gboolean flip_horizontal = FALSE;
@ -520,11 +520,6 @@ load_image (const gchar *filename,
gimp_rgb_set (&color, 0.0, 0.0, 0.0); gimp_rgb_set (&color, 0.0, 0.0, 0.0);
if ((pages->n_pages > 1) && (target == GIMP_PAGE_SELECTOR_TARGET_IMAGES))
do_images = TRUE;
else
do_images = FALSE;
gimp_progress_init_printf (_("Opening '%s'"), gimp_progress_init_printf (_("Opening '%s'"),
gimp_filename_to_utf8 (filename)); gimp_filename_to_utf8 (filename));
/* We will loop through the all pages in case of multipage TIFF /* We will loop through the all pages in case of multipage TIFF
@ -671,7 +666,7 @@ load_image (const gchar *filename,
layer_type = GIMP_RGBA_IMAGE; layer_type = GIMP_RGBA_IMAGE;
} }
if (do_images || (! image)) if ((target == GIMP_PAGE_SELECTOR_TARGET_IMAGES) || (! image))
{ {
if ((image = gimp_image_new (cols, rows, image_type)) == -1) if ((image = gimp_image_new (cols, rows, image_type)) == -1)
{ {
@ -681,7 +676,7 @@ load_image (const gchar *filename,
gimp_image_undo_disable (image); gimp_image_undo_disable (image);
if (do_images) if (target == GIMP_PAGE_SELECTOR_TARGET_IMAGES)
{ {
gchar *fname; gchar *fname;
fname = g_strdup_printf ("%s-%d", filename, ilayer); fname = g_strdup_printf ("%s-%d", filename, ilayer);
@ -690,7 +685,7 @@ load_image (const gchar *filename,
images_list = g_list_append (images_list, GINT_TO_POINTER (image)); images_list = g_list_append (images_list, GINT_TO_POINTER (image));
} }
else else if (pages->o_pages == pages->n_pages)
{ {
gimp_image_set_filename (image, filename); gimp_image_set_filename (image, filename);
} }
@ -1020,7 +1015,7 @@ load_image (const gchar *filename,
gimp_image_add_layer (image, layer, -1); gimp_image_add_layer (image, layer, -1);
if (do_images) if (target == GIMP_PAGE_SELECTOR_TARGET_IMAGES)
{ {
gimp_image_undo_enable (image); gimp_image_undo_enable (image);
gimp_image_clean_all (image); gimp_image_clean_all (image);
@ -1029,7 +1024,7 @@ load_image (const gchar *filename,
gimp_progress_update (1.0); gimp_progress_update (1.0);
} }
if (! do_images) if (target != GIMP_PAGE_SELECTOR_TARGET_IMAGES)
{ {
/* resize image to bounding box of all layers */ /* resize image to bounding box of all layers */
gimp_image_resize (image, gimp_image_resize (image,