diff -u --new-file --recursive --exclude-from=/tmp/cvs.exclude.gphoto gphoto.orig/src/gallery.c gphoto/src/gallery.c --- gphoto.orig/src/gallery.c Thu Jul 6 20:08:15 2000 +++ gphoto/src/gallery.c Sat Aug 5 11:49:46 2000 @@ -408,6 +412,7 @@ int i=0, j=0, num_selected = 0; char outputdir[1024], theme[32]; char filename[1024], filename2[1024], cp[1024], error[32], statmsg[128]; + int thumbnail_scale, image_scale; struct Image *im; GList *dlist; @@ -416,6 +421,8 @@ GtkWidget *netscape, *shtml, *table_border, *image_border; GtkWidget *galentry; GtkWidget *label, *dirlabel, *dirbutton, *hbox, *hseparator; + GtkWidget *thumb_scale_spinner, *image_scale_spinner; + GtkAdjustment *adj; struct ImageMembers *node = &Thumbnails; @@ -540,6 +547,36 @@ GTK_SIGNAL_FUNC(gallery_change_dir),dirlabel); gtk_box_pack_end(GTK_BOX(hbox), dirbutton, FALSE, FALSE, 0); + hbox = gtk_hbox_new(FALSE, 5); + gtk_widget_show(hbox); + label = gtk_label_new("Thumbnails scale factor (in %):"); + gtk_widget_show(label); + gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + + adj = (GtkAdjustment *) gtk_adjustment_new (50.0, 1.0, 100.0, 1.0, 5.0, 0.0); + thumb_scale_spinner = gtk_spin_button_new (adj, 0, 0); + gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (thumb_scale_spinner), TRUE); + gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON (thumb_scale_spinner), GTK_SHADOW_OUT); + gtk_widget_show (thumb_scale_spinner); + gtk_box_pack_end(GTK_BOX(hbox), thumb_scale_spinner, FALSE, FALSE, 5); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); + + hbox = gtk_hbox_new(FALSE, 5); + gtk_widget_show(hbox); + label = gtk_label_new("Images scale factor (in %):"); + gtk_widget_show(label); + gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + + adj = (GtkAdjustment *) gtk_adjustment_new (50.0, 1.0, 100.0, 1.0, 5.0, 0.0); + image_scale_spinner = gtk_spin_button_new (adj, 0, 0); + gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (image_scale_spinner), TRUE); + gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON (image_scale_spinner), GTK_SHADOW_OUT); + gtk_widget_show (image_scale_spinner); + gtk_box_pack_end(GTK_BOX(hbox), image_scale_spinner, FALSE, FALSE, 5); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); + /* i made this * it should make extra buttons for shtml, table borders, and * image borders @@ -613,8 +650,8 @@ else { strcpy(image_border_width, "1"); } - - + thumbnail_scale = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON(thumb_scale_spinner)); + image_scale = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON(image_scale_spinner)); strcpy(cp, ""); sprintf(theme, "%s",(char*)gtk_object_get_data(GTK_OBJECT(dlist->data), @@ -699,7 +747,7 @@ gtk_widget_destroy(dialog); return; } - save_image(filename2, im); + save_scaled_image(filename2, im, thumbnail_scale); free_image(im); } /* Get the current image */ @@ -725,7 +784,7 @@ gtk_widget_destroy(dialog); return; } - save_image(filename2, im); + save_scaled_image(filename2, im, image_scale); free_image(im); } if (i+1 == num_selected) diff -u --new-file --recursive --exclude-from=/tmp/cvs.exclude.gphoto gphoto.orig/src/util.c gphoto/src/util.c --- gphoto.orig/src/util.c Fri Mar 10 17:16:10 2000 +++ gphoto/src/util.c Sat Aug 5 11:49:46 2000 @@ -243,6 +243,22 @@ free (im); } +void save_scaled_image (char *filename, struct Image *im, int factor) { + GdkImlibImage *imlibimage1, *imlibimage2; + int w,h; + + imlibimage1 = gdk_imlib_load_image_mem(im->image, (size_t)im->image_size); + w = imlibimage1->rgb_width; + h = imlibimage1->rgb_height; + w = ( w * factor)/100; + h = ( h * factor)/100; + + imlibimage2 = gdk_imlib_clone_scaled_image(imlibimage1, w, h); + gdk_imlib_kill_image(imlibimage1); + gdk_imlib_save_image(imlibimage2, filename, NULL); + gdk_imlib_kill_image(imlibimage2); +} + void save_image (char *filename, struct Image *im) { char errormsg[1024]; diff -u --new-file --recursive --exclude-from=/tmp/cvs.exclude.gphoto gphoto.orig/src/util.h gphoto/src/util.h --- gphoto.orig/src/util.h Wed Jul 14 05:32:29 1999 +++ gphoto/src/util.h Sat Aug 5 11:49:46 2000 @@ -33,6 +33,8 @@ void free_image(struct Image *im); +void save_scaled_image (char *filename, struct Image *im, int factor); + void save_image(char *filename, struct Image *im); void free_imagemembers (struct ImageMembers *im);