il->loader = il->backend.loader_new(image_loader_area_updated_cb, image_loader_size_cb, image_loader_area_prepared_cb, il);
+#ifdef HAVE_TIFF
+ format = il->backend.get_format_name(il->loader);
+ if (g_strcmp0(format, "tiff") == 0)
+ {
+ il->backend.set_page_num(il->loader, il->fd->page_num);
+ }
+ g_free(format);
+#endif
+
#ifdef HAVE_PDF
format = il->backend.get_format_name(il->loader);
if (g_strcmp0(format, "pdf") == 0)
}
g_free(format);
#endif
+#ifdef HAVE_TIFF
+ format = il->backend.get_format_name(il->loader);
+ if (g_strcmp0(format, "tiff") == 0)
+ {
+ gint i = il->backend.get_page_total(il->loader);
+ file_data_set_page_total(il->fd, i);
+ }
+ g_free(format);
+#endif
il->bytes_read += b;
const guchar *buffer;
toff_t used;
toff_t pos;
+ gint page_num;
+ gint page_total;
};
static void free_buffer (guchar *pixels, gpointer data)
gint width, height, rowstride;
size_t bytes;
uint32 rowsperstrip;
+ gint dircount = 0;
lt->buffer = buf;
lt->used = count;
DEBUG_1("Failed to open TIFF image");
return FALSE;
}
+ else
+ {
+ do
+ {
+ dircount++;
+ } while (TIFFReadDirectory(tiff));
+ lt->page_total = dircount;
+ }
+ if (!TIFFSetDirectory(tiff, lt->page_num))
+ {
+ DEBUG_1("Failed to open TIFF image");
+ TIFFClose(tiff);
+ return FALSE;
+ }
if (!TIFFGetField (tiff, TIFFTAG_IMAGEWIDTH, &width))
{
g_free(lt);
}
+static void image_loader_tiff_set_page_num(gpointer loader, gint page_num)
+{
+ ImageLoader *il = (ImageLoader *) loader;
+ ImageLoaderTiff *lt = (ImageLoaderTiff *) loader;
+
+ lt->page_num = page_num;
+}
+
+static gint image_loader_tiff_get_page_total(gpointer loader)
+{
+ ImageLoaderTiff *lt = (ImageLoaderTiff *) loader;
+
+ return lt->page_total;
+}
void image_loader_backend_set_tiff(ImageLoaderBackend *funcs)
{
funcs->get_format_name = image_loader_tiff_get_format_name;
funcs->get_format_mime_types = image_loader_tiff_get_format_mime_types;
+
+ funcs->set_page_num = image_loader_tiff_set_page_num;
+ funcs->get_page_total = image_loader_tiff_get_page_total;
}
if (page_total > 0)
{
- text = g_strdup_printf(_("( %d x %d ) %s bytes%s%d%s%d%s"), width, height, b, "[", page_num, "/", page_total, "]");
+ text = g_strdup_printf(_("( %d x %d ) %s bytes %s%d%s%d%s"), width, height, b, "[", page_num, "/", page_total, "]");
}
else
{
}
lw->info_details = layout_status_label(NULL, hbox, TRUE, 0, TRUE);
DEBUG_NAME(lw->info_details);
- gtk_widget_set_tooltip_text(GTK_WIDGET(lw->info_details), _("(Image dimensions) Image size"));
+ gtk_widget_set_tooltip_text(GTK_WIDGET(lw->info_details), _("(Image dimensions) Image size [page n of m]"));
toolbar = layout_actions_toolbar(lw, TOOLBAR_STATUS);
toolbar_frame = gtk_frame_new(NULL);