File: savePrefs.cxx

package info (click to toggle)
imview 1.1.9c-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,068 kB
  • ctags: 3,686
  • sloc: cpp: 28,834; sh: 2,624; ansic: 1,818; makefile: 767; exp: 112; python: 88
file content (676 lines) | stat: -rw-r--r-- 19,306 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
/*
 * $Id: savePrefs.cxx,v 4.2 2007/12/24 15:47:26 hut66au Exp $
 *
 * Imview, the portable image analysis application
 * http://www.cmis.csiro.au/Hugues.Talbot/imview
 * ----------------------------------------------------------
 *
 *  Imview is an attempt to provide an image display application
 *  suitable for professional image analysis. It was started in
 *  1997 and is mostly the result of the efforts of Hugues Talbot,
 *  Image Analysis Project, CSIRO Mathematical and Information
 *  Sciences, with help from others (see the CREDITS files for
 *  more information)
 *
 *  Imview is Copyrighted (C) 1997-2001 by Hugues Talbot and was
 *  supported in parts by the Australian Commonwealth Science and 
 *  Industry Research Organisation. Please see the COPYRIGHT file 
 *  for full details. Imview also includes the contributions of 
 *  many others. Please see the CREDITS file for full details.
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *  
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *  
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
 * */

/*------------------------------------------------------------------------
 *
 * A save preference panel using fluid
 *
 * Hugues Talbot	27 Apr 1998
 *      
 *-----------------------------------------------------------------------*/

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "imunistd.h"
#include <string.h>
#include <errno.h>
#include <FL/Fl_File_Chooser.H>
#include <FL/fl_ask.H>
#include "imview.hxx"
#include "imageIO.hxx"
#include "imageViewer.hxx"
#include "savePrefs.hxx"
#include "io/savetiff.hxx"
#include "io/saveZimage.hxx"
#include "io/writeMagick.hxx"

// 
typedef void (menucb)(Fl_Menu_ *, void *);

// application components
extern char appName[];
extern imageIO *IOBlackBox;
extern imageViewer *mainViewer;
extern saveprefs   *savePrefsPanel;

// compression names
extern char *comp_schemes[];


static const char *formatExtensionList[] = {
    ".tif",
    "_z",
    ".euro", // not implemented, but come in this number
    ".png",
    ".jpg",
    0
};


saveprefs::saveprefs()
{
    dbgprintf("Save panel constructed\n");
    saveWindow = 0; // fluid depends on that
    return;
}

void saveprefs::setDefaults()
{
    static char          buff[DFLTSTRLEN];
    static Fl_Menu_Item  *newMenu = 0;
    int                   newMenuSize, i;

    dbgprintf("Setting default for save panel\n");
    
    // the choice format menu is now set up within fluid
    latestGreyTiffOption = TIFF_CMP_LZW;
    latestBinaryTiffOption = TIFF_CMP_CCITTG4;
    setCompression(TIFF_FMT);
    
    // we save the whole image by default
    wholeCheck->set();

    // we save the visible image by default
    visibleCheck->set();
    // Let's reactivate the deactivated... Hugues Talbot	 2 Dec 2002
    //underlyingCheck->deactivate();
    //underlyingCheck->labelcolor(40); // deactivated for now...

    // I'm aghast fluid doesn't do that by itself...
    formatMenu = formatChoice->menu();
    newMenuSize = formatMenu->size();
    newMenu = new Fl_Menu_Item[newMenuSize];
    for (i = 0 ; i < newMenuSize ; i++) {
	newMenu[i] = formatMenu[i];
    }
    formatChoice->menu(newMenu);
    
    tiffmenuitem = newMenu + TIFF_FMT;
    pngmenuitem = newMenu + PNG_FMT;
    jpgmenuitem = newMenu + JPG_FMT; // those CAN be modified.
    
    // disable extra formats if ImageMagick not compiled in
#ifndef HAVE_MAGICK
    pngmenuitem->hide();
    jpgmenuitem->hide();
#endif

#ifndef HAVE_TIFF
    tiffmenuitem->hide();
#endif

    // set the default as Z-IMAGE (only format always available)
    formatChoice->value(ZIMAGE_FMT);
    
    // default value for file
    strncpy(buff, IOBlackBox->getImName(), DFLTSTRLEN);
    buff[DFLTSTRLEN-1] = '\0'; 
    filenameInput->value(buff);
    toggleExtension(ZIMAGE_FMT);
    
    
    return;
}


// this functions changes the .tiff in _z, etc...
void saveprefs::toggleExtension(int format)
{
    static char inputContent[DFLTSTRLEN]; 
    char *substr;

    strcpy(inputContent, filenameInput->value());
    
    dbgprintf("Looking for extensions\n");
    if (inputContent != 0) {
	for (int i = 0 ; formatExtensionList[i] != 0 ; i++) {
	    // look for the common extension of the format
	    if (((substr = strstr(inputContent, formatExtensionList[i])) != 0)
		&& (format < LAST_FMT)) {
		strcpy(substr, formatExtensionList[format]);
		filenameInput->value(inputContent);
		dbgprintf("Extension found\n");
		break;
	    }
	}
    }
    
    return;
}



void saveprefs::setCompression(int format)
{
    static const Fl_Menu_Item noCompressionMenu[] = {
	{"None", 0, 0},
	{0}
    };
    static const Fl_Menu_Item binaryTiffCompression[] = {
	{"None", 0, (Fl_Callback *)chosencompression_cb, (void *)TIFF_CMP_NONE},
	{"LZW", 0, (Fl_Callback *)chosencompression_cb, (void *)TIFF_CMP_LZW},
	{"PackBits", 0, (Fl_Callback *)chosencompression_cb, (void *)TIFF_CMP_PACKBITS},
	{"Group 3", 0, (Fl_Callback *)chosencompression_cb, (void *)TIFF_CMP_CCITTG3},
	{"Group 4", 0, (Fl_Callback *)chosencompression_cb, (void *)TIFF_CMP_CCITTG4},
	{"RLE", 0, (Fl_Callback *)chosencompression_cb, (void *)TIFF_CMP_RLE},
	{"RLEW", 0, (Fl_Callback *)chosencompression_cb, (void *)TIFF_CMP_RLEW},
	{"Thunderscan", 0, (Fl_Callback *)chosencompression_cb, (void *)TIFF_CMP_THUNDER},
	{0}
    };
    static const Fl_Menu_Item greyTiffCompression[] = {
	{"None", 0, (Fl_Callback *)chosencompression_cb, (void *)TIFF_CMP_NONE},
	{"LZW", 0, (Fl_Callback *)chosencompression_cb, (void *)TIFF_CMP_LZW},
	{"PackBits", 0, (Fl_Callback *)chosencompression_cb, (void *)TIFF_CMP_PACKBITS},
	{0}
    };

    dbgprintf("Setting up the Choice buttons\n");
    switch (format) {
      case TIFF_FMT:
	compressionChoice->activate();
	compressionChoice->labelcolor(FL_BLACK);
	compressionChoice->textcolor(FL_BLACK);
	if (IOBlackBox->getCurrImgPixType() == IM_BINARY) {
	    compressionChoice->menu(binaryTiffCompression);
	    compressionChoice->value(latestBinaryTiffOption);
	} else {
	    compressionChoice->menu(greyTiffCompression);
	    compressionChoice->value(latestGreyTiffOption);
	}
	saveWindow->redraw();
	break;

      case ZIMAGE_FMT:
      case PNG_FMT:
      case JPG_FMT:
	compressionChoice->menu(noCompressionMenu);
	compressionChoice->deactivate();
	compressionChoice->labelcolor(40); // from FLUID
	compressionChoice->textcolor(40);
	saveWindow->redraw();
	break;
	
      default:
	dbgprintf("Unknown file format\n");
	compressionChoice->menu(noCompressionMenu);
	compressionChoice->deactivate();
	compressionChoice->labelcolor(40); // from FLUID
	compressionChoice->textcolor(40);
	saveWindow->redraw();
	break;
    }

    
    return;
}

void saveprefs::saveFileName(const char *fn)
{
    // this copies it to something more permanent.
    filenameInput->value(fn);
    return;
}




int saveprefs::doTheSaving()
{
    int     retval = 0;
    uchar  *buf0, *buf1, *buf2;
    int     origx, origy, origz, nbrows, nbcols, nbcomps;
    int     val;

    dbgprintf("Doing the saving now\n");
    // we can't go any further until we have a writexxx procedure...

    const char *filename = filenameInput->value();
    if ((filename == 0) || (filename[0] == '\0')) {
	errprintf("Please specify a file to save to\n");
	return(1);
    } else {
	if (access(filename, W_OK) == 0) {
	    // the file already exists
	    static char alrtmsg[DFLTSTRLEN] ;
	    sprintf(alrtmsg,
		    "File %s already exists\n"
		    "Do you want to overwrite?\n",
		    filename);
	    if (fl_ask(alrtmsg) == 0) {
		// no, we don't want to overwrite...
		return(2);
	    }
	}
    }

    buf0 = buf1 = buf2 = 0;
    // are we saving the visible image?
    if (visibleCheck->value() == 1) {
	// we save the whole image
	if (wholeCheck->value() == 1) {
	    origx = IOBlackBox->getXOffset();  // this is a cop-out for the moment
	    origy = IOBlackBox->getYOffset();
            origz = IOBlackBox->getZOffset();
	    nbcols = IOBlackBox->imageWidth();
	    nbrows = IOBlackBox->imageHeight();
	    if ((nbcomps= IOBlackBox->wholeImage(&buf0, &buf1, &buf2)) == 0) {
		errprintf("Can't save image with %d samples per pixel\n",
			  IOBlackBox->imageDepth());
		return(10);
	    } 
	} else {
	    if ((nbcomps= IOBlackBox->subsetImage(&buf0, &buf1, &buf2,
						  origx, origy,
						  nbcols, nbrows)) == 0) {
		errprintf("Can't save image with %d samples per pixel\n",
			  IOBlackBox->imageDepth());
		return(11);
	    }
            origx += IOBlackBox->getXOffset();  // this is a cop-out for the moment
	    origy += IOBlackBox->getYOffset();
            origz = IOBlackBox->getZOffset();
	}

	switch (val = formatChoice->value()) {
	  case TIFF_FMT: {
	    int    pi, sf, spp, bps;
	    int    pixeltype, imagetype;
	    int    start[2], end[2];
	    void  *outbuffp[3];

	    // get the pixtype & imgtype
	    pixeltype = trivmin(IOBlackBox->getCurrImgPixType(), IM_UINT1);
	    imagetype = (nbcomps == 3) ? IM_RGB : IM_SPECTRUM ;
	    spp = nbcomps;
	    setTifftype(pixeltype, imagetype, &pi, &sf, &spp, &bps);
	    // sanity check
	    if (spp != nbcomps) {
		errprintf("This can't happen: spp(%d) != nbcomps(%d)\n",
			  spp, nbcomps);
		break;
	    }
	    outbuffp[0] = buf0;
	    outbuffp[1] = buf1;
	    outbuffp[2] = buf2;
	    start[0] = origx;
	    start[1] = origy;
	    end[0] = origx + nbcols - 1;
	    end[1] = origy + nbrows - 1;
	    retval = save_tiff(outbuffp, 0,
			       start, end,
			       pi, sf, spp, bps,
			       0, 0,
			       filename,
			       compressionChoice->value());
	    break;
	  }

	  case PNG_FMT: 
	    if (buf0 != 0) // no hard at all...
		retval = save_magick(filename, "png", nbcomps, nbcols, nbrows,
				       buf0, buf1, buf2);
	    break;

	  case JPG_FMT:
	    if (buf0 != 0) // no hard at all...
		retval = save_magick(filename, "jpg", nbcomps, nbcols, nbrows,
				       buf0, buf1, buf2);
	    break;
	  
	  case ZIMAGE_FMT: {
	    int nx[3], ny[3], nz[3], x0[3], y0[3], z0[3], ptype[3];
	    void *outbuffp[3];
	    
	    nx[0] = nx[1] = nx[2] = nbcols;
	    ny[0] = ny[1] = ny[2] = nbrows;
	    nz[0] = nz[1] = nz[2] = 1; // not a 3D image...
	    x0[0] = x0[1] = x0[2] = origx;
	    y0[0] = y0[1] = y0[2] = origy;
	    z0[0] = z0[1] = z0[2] = origz;
	    ptype[0] = ptype[1] = ptype[2] = \
		trivmin(IOBlackBox->getCurrImgPixType(), IM_UINT1);
	    outbuffp[0] = buf0;
	    outbuffp[1] = buf1;
	    outbuffp[2] = buf2;

	    retval = save_zimage(filename, nbcomps,
				 nx, ny, nz,
				 x0, y0, z0,
				 ptype,
				 outbuffp);
	    if (retval != 0)
		errprintf("Error in Z-IMAGE saving code\n"
			  "writing %s: %s\n",
			  filename, strerror(errno));
	    
	    break;
	  }

	  default:
	    errprintf("Saving under an unknown format: %d can't do that!\n", val);
	    retval = 5;
	    break;
	}
    } else {
        dbgprintf("Saving the raw data\n");
        switch (val = formatChoice->value()) {

        case TIFF_FMT: {
            int start[2], end[2], nz;
            int pi, sf, spp, bps;
            int ptype, itype;
            void **outbuffp;
                
            // get the pixtype & imgtype
	    ptype = IOBlackBox->getCurrImgPixType();
	    itype = IOBlackBox->getCurrImgImgType();
	    spp = IOBlackBox->getCurrImgNbSamples();
	    setTifftype(ptype, itype, &pi, &sf, &spp, &bps);
            dbgprintf("TIFF types: pi = %d, sf = %d, spp = %d, bps = %d\n",
                      pi, sf, spp, bps);
	    start[0] = IOBlackBox->getXOffset();
	    start[1] = IOBlackBox->getYOffset();
	    end[0] = start[0] + IOBlackBox->imageWidth() - 1;
	    end[1] = start[1] + IOBlackBox->imageHeight() - 1;
            
            outbuffp = IOBlackBox->getCurrBuffp();

	    retval = save_tiff(outbuffp, 0,
			       start, end,
			       pi, sf, spp, bps,
			       0, 0,
			       filename,
			       compressionChoice->value());

            nz = IOBlackBox->imageThickness();

            /* save 3D image as extra images (slices) in the file */
            /* as in a multi-page document */
            if (nz > 1) {
                void **slices;
                int nx, ny, bytespersample;
                
                warnprintf("3D images saved as a multi-page TIFF image\n");
                // Tru64 cxx 6.3 objects with that line for some reason
                slices = new void *[spp];
                nx = IOBlackBox->imageWidth();
                ny = IOBlackBox->imageHeight();
                bytespersample = trivmax(bps/8, 1);

                for (int i = 1 ; i < nz ; ++i) {
                    for (int j = 0 ; j < spp ; ++j) {
                        slices[j] = (void*)((char *)(outbuffp[j]) + i * (nx * ny * bytespersample));
                    }
                    retval = save_tiff(slices, 1,
                                       start, end,
                                       pi, sf, spp, bps,
                                       0, 0,
                                       filename,
                                       compressionChoice->value());
                }

                delete[] slices;
            }
        }
            break;


        case ZIMAGE_FMT: {
            int *nx = 0, *ny = 0, *nz = 0;
            int *x0 = 0, *y0 = 0, *z0 = 0, *ptype = 0;
            int nbcomp = IOBlackBox->getCurrImgNbComps();
            int fixedtype = static_cast<int>(IOBlackBox->getCurrImgPixType());

            if (nbcomp > 0) {
                nx = new int[nbcomp];
                ny = new int[nbcomp];
                nz = new int[nbcomp];
                x0 = new int[nbcomp];
                y0 = new int[nbcomp];
                z0 = new int[nbcomp];
                ptype = new int[nbcomp];

                for (int i = 0 ; i < nbcomp ; ++i) {
                    nx[i] = IOBlackBox->imageWidth();
                    ny[i] = IOBlackBox->imageHeight();
                    nz[i] = IOBlackBox->imageThickness();
                    x0[i] = IOBlackBox->getXOffset();
                    y0[i] = IOBlackBox->getYOffset();
                    z0[i] = IOBlackBox->getZOffset();
                    ptype[i] = fixedtype;
                }
                
                // this function handles type promotion
                retval = save_zimage(filename, 
                                     nbcomp,
                                     nx,
                                     ny,
                                     nz,
                                     x0,
                                     y0,
                                     z0,
                                     ptype,
                                     IOBlackBox->getCurrBuffp());
                if (retval)
                    errprintf("Saving of file %s failed with error %d\n", 
                              filename, retval);

                delete[] nx;
                delete[] ny;
                delete[] nz;
                delete[] x0;
                delete[] y0;
                delete[] z0;
                delete[] ptype;
            }
        }
            break;
        default:
            errprintf("Only TIFF and Z-IMAGE format supported for this\n");
            retval = 20;
            break;
        }

    }
    
    if (buf0 != 0) delete[] buf0;
    if (buf1 != 0) delete[] buf1;
    if (buf2 != 0) delete[] buf2;
    
    return retval;
}

void saveprefs::show()
{
    dbgprintf("Showing save window\n");
    saveWindow->show();
}

void saveprefs::hide()
{
    saveWindow->hide();
}


// save panel associated callbacks

void filenameinput_cb(Fl_Input *, saveprefs *)
{
    dbgprintf("File name input callback\n");
    return;
}


void browsebutton_cb(Fl_Button *, saveprefs *panel)
{
    const char *currentfile;
    static const char *p = 0;
    
    dbgprintf("Browse button pressed on save prefs panel\n");
    
    currentfile = panel->filenameInputValue();
    switch (panel->selectedFileFormat()) {
      case TIFF_FMT:
	p = fl_file_chooser("Save to file", "*.[Tt][Ii][Ff]*", currentfile);
	break;
      case ZIMAGE_FMT:
	p = fl_file_chooser("Save to file", "*_z", currentfile);
	break;
      case PNG_FMT:
	p = fl_file_chooser("Save to file", "*.[Pp][Nn][Gg]", currentfile);
	break;
      case JPG_FMT:
	p = fl_file_chooser("Save to file", "*.[Jj][Pp][Gg]", currentfile);
	break;
      default:
	p = fl_file_chooser("Save to file", "*", currentfile);
	break;
    }
			
    if (p) panel->saveFileName(p);
    
    return;
}

void wholecheck_cb(Fl_Check_Button *, saveprefs *)
{
    dbgprintf("Whole image check button callback\n");
    return;
}

void subsetcheck_cb(Fl_Check_Button *, saveprefs *)
{
    dbgprintf("Subset image check button callback\n");
    return;
}

void visiblecheck_cb(Fl_Check_Button *, saveprefs *)
{
    dbgprintf("Visible image check button callback\n");
    return;
}

void underlyingcheck_cb(Fl_Check_Button *, saveprefs *)
{
    dbgprintf("Underlying image check button callback\n");
    return;
}

void formatchoice_cb(Fl_Choice *, saveprefs *)
{
    dbgprintf("Format choice menu callback\n");
    return;
}

void compressionchoice_cb(Fl_Choice *, saveprefs *)
{
    dbgprintf("Compression choice menu callback\n");
    return;
}

void cancelbutton_cb(Fl_Button *, saveprefs *panel)
{
    dbgprintf("Cancel Button pressed on save prefs panel\n");
    // hide the window
    panel->hide();
    return;
}

void okbutton_cb(Fl_Return_Button *, saveprefs *panel)
{
    dbgprintf("Print Button pressed on save prefs panel\n");
    if (panel->doTheSaving() == 0) {
	// hide the window
	panel->hide();
    }
    return;
}

// callback for the choice menu

void chosenformat_cb(Fl_Menu_ *, void *fmt)
{
    long val = (long)fmt;
    
    switch (val) {
      case TIFF_FMT:
	dbgprintf("TIFF Format selected\n");
	// selects the compressions available for TIFF
	savePrefsPanel->setCompression(TIFF_FMT);
	break;
      case ZIMAGE_FMT:
	dbgprintf("Z-IMAGE format selected\n");
	savePrefsPanel->setCompression(ZIMAGE_FMT);
	break;
      case PNG_FMT:
	dbgprintf("PNG format selected\n");
	savePrefsPanel->setCompression(PNG_FMT);
	break;
      case JPG_FMT:
	dbgprintf("PNG format selected\n");
	savePrefsPanel->setCompression(JPG_FMT);
	break;
	
    }
    savePrefsPanel->toggleExtension(val);
}

void chosencompression_cb(Fl_Menu_ *, void *cmp)
{
    long val = (long)cmp;

    switch(val) {
      case TIFF_CMP_NONE:
      case TIFF_CMP_LZW:
      case TIFF_CMP_PACKBITS:
	savePrefsPanel->setGreyTifComp(val);
      case TIFF_CMP_CCITTG4:
      case TIFF_CMP_CCITTG3:
      case TIFF_CMP_RLE:
      case TIFF_CMP_RLEW:
      case TIFF_CMP_THUNDER:
	savePrefsPanel->setBinTifComp(val);
	dbgprintf("TIFF compression selected: "
		  "%s\n", comp_schemes[val]);
	break;

      default:
	errprintf("Unknown compression scheme: %d\n", val);
	break;
    }

    return;
}