diff -u --new-file --recursive --exclude-from=/tmp/cvs.exclude.gphoto gphoto.orig/src/callbacks.c gphoto/src/callbacks.c --- gphoto.orig/src/callbacks.c Thu Jul 6 20:08:15 2000 +++ gphoto/src/callbacks.c Fri Aug 4 12:36:49 2000 @@ -126,7 +148,7 @@ return; } - appendpic(picNum, 0, TRUE, NULL); + appendpic(picNum, 0, TRUE, NULL, 100); sprintf(status, "New picture is #%03i", picNum); gtk_notebook_set_page(GTK_NOTEBOOK(notebook), picNum); update_status(status); @@ -383,13 +430,14 @@ update_status(fname); } -void appendpic(gint picNum, gint thumbnail, gint fromCamera, char *fileName) +void appendpic(gint picNum, gint thumbnail, gint fromCamera, char *fileName, int factor) { int w, h; char fname[15], error[32], process[1024], imagename[1024],*openName; GtkWidget *scrwin, *label; + GdkImlibImage *scaledImage; GdkPixmap *pixmap; struct Image *im; @@ -432,8 +487,29 @@ } else node->imlibimage = gdk_imlib_load_image(fileName); + if (node->imlibimage==0) { + sprintf(error, "Could not load image #%i to memory", picNum); + error_dialog(error); + return; + } + w = node->imlibimage->rgb_width; + h = node->imlibimage->rgb_height; + + w = (w * factor)/100; + h = (h * factor)/100; + + scaledImage = gdk_imlib_clone_scaled_image(node->imlibimage,w,h); + gdk_imlib_kill_image(node->imlibimage); + + if (scaledImage==0) { + sprintf(error, "Could not load image #%i to memory", picNum); + error_dialog(error); + return; + } + node->imlibimage = scaledImage; w = node->imlibimage->rgb_width; h = node->imlibimage->rgb_height; + gdk_imlib_render(node->imlibimage, w, h); pixmap = gdk_imlib_move_image(node->imlibimage); node->image = gtk_pixmap_new(pixmap, NULL); @@ -1097,7 +1167,7 @@ /* If the thumbnail is already there, then just load the image */ if (node->image && node->imlibimage) { - appendpic(i, 0, TRUE, NULL); + appendpic(i, 0, TRUE, NULL, 100); return; } @@ -1298,6 +1384,12 @@ /* get selected pictures */ void getpics(char *pictype) { + getpics_with_scale (pictype, 100); +} + +/* get selected pictures at a given scale */ +void getpics_with_scale(char *pictype, int factor) +{ char status[256]; gint i=0; gint x=0, y=0; @@ -1322,11 +1414,11 @@ (strcmp("ti", pictype) == 0)) { sprintf(status, "Getting Image #%03i...", i); update_status(status); - appendpic(i, 0, TRUE, NULL); + appendpic(i, 0, TRUE, NULL, factor); } if ((strcmp("t", pictype) == 0) || (strcmp("ti", pictype) == 0)) { - appendpic(i, 1, TRUE, NULL); + appendpic(i, 1, TRUE, NULL, factor); sprintf(status, "Getting Thumbnail #%03i...", i); update_status(status); } @@ -1484,7 +1578,7 @@ return; appendpic(0, 0, FALSE, gtk_file_selection_get_filename( - GTK_FILE_SELECTION(filew))); + GTK_FILE_SELECTION(filew)), 100); gtk_widget_destroy(filew); } @@ -1904,7 +2005,17 @@ void open_images(gpointer data, guint action, GtkWidget *widget) { - getpics("i"); + getpics_with_scale("i",100); +} + +void open_images_and_scale50(gpointer data, guint action, GtkWidget *widget) +{ + getpics_with_scale("i",50); +} + +void open_images_and_scale25(gpointer data, guint action, GtkWidget *widget) +{ + getpics_with_scale("i",25); } void save_thumbs(gpointer data, guint action, GtkWidget *widget) @@ -1914,7 +2025,7 @@ void open_thumbs(gpointer data, guint action, GtkWidget *widget) { - getpics("t"); + getpics_with_scale("t",100); } void save_both (gpointer data, guint action, GtkWidget *widget) @@ -1925,7 +2036,7 @@ void open_both(gpointer data, guint action, GtkWidget *widget) { - getpics("ti"); + getpics_with_scale("ti",100); } diff -u --new-file --recursive --exclude-from=/tmp/cvs.exclude.gphoto gphoto.orig/src/callbacks.h gphoto/src/callbacks.h --- gphoto.orig/src/callbacks.h Sun Nov 21 17:33:39 1999 +++ gphoto/src/callbacks.h Sat Aug 5 11:49:46 2000 @@ -16,7 +16,7 @@ void del_dialog (int type); void savepictodisk (int picNum, int thumbnail, char *prefix); void saveselectedtodisk (GtkWidget *widget, char *type); -void appendpic (int picNum, int thumbnail, int fromCamera, char *fileName); +void appendpic (int picNum, int thumbnail, int fromCamera, char *fileName, int factor); void destroy (GtkWidget *widget, gpointer data); void port_dialog(); void version_dialog(); @@ -32,6 +32,7 @@ void getindex_empty (); void halt_action (); void getpics (char *type); +void getpics_with_scale (char *type, int factor); void remove_image(int i); void closepic (); void print_pic (); @@ -47,6 +48,8 @@ void scale_double (); void save_images (gpointer data, guint action, GtkWidget *widget); void open_images (gpointer data, guint action, GtkWidget *widget); +void open_images_and_scale25 (gpointer data, guint action, GtkWidget *widget); +void open_images_and_scale50 (gpointer data, guint action, GtkWidget *widget); void save_thumbs (gpointer data, guint action, GtkWidget *widget); void open_thumbs (gpointer data, guint action, GtkWidget *widget); void save_both (gpointer data, guint action, GtkWidget *widget); diff -u --new-file --recursive --exclude-from=/tmp/cvs.exclude.gphoto gphoto.orig/src/menu.c gphoto/src/menu.c --- gphoto.orig/src/menu.c Thu Feb 24 20:50:24 2000 +++ gphoto/src/menu.c Sat Aug 5 11:49:46 2000 @@ -211,6 +211,8 @@ {"/Camera/Download _Selected", NULL, 0, 0, ""}, {"/Camera/Download Selected/_Images", NULL, 0, 0, ""}, {"/Camera/Download Selected/Images/_Open in window", NULL, open_images, 18}, + {"/Camera/Download Selected/Images/_Open in window (scale 50%)",NULL, open_images_and_scale50,18}, + {"/Camera/Download Selected/Images/_Open in window (scale 25%)",NULL, open_images_and_scale25,18}, {"/Camera/Download Selected/Images/_Save to disk...","g", save_images, 19}, {"/Camera/Download Selected/_Thumbnails", NULL, 0, 0, ""}, {"/Camera/Download Selected/Thumbnails/_Open in window", NULL, open_thumbs, 0},