~ubuntu-branches/ubuntu/hoary/gimp/hoary

« back to all changes in this revision

Viewing changes to plug-ins/sgi/sgi.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-04-04 14:51:23 UTC
  • Revision ID: james.westby@ubuntu.com-20050404145123-9py049eeelfymur8
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * "$Id: sgi.c,v 1.47 2004/10/28 12:12:52 neo Exp $"
 
3
 *
 
4
 *   SGI image file plug-in for the GIMP.
 
5
 *
 
6
 *   Copyright 1997-1998 Michael Sweet (mike@easysw.com)
 
7
 *
 
8
 *   This program is free software; you can redistribute it and/or modify it
 
9
 *   under the terms of the GNU General Public License as published by the Free
 
10
 *   Software Foundation; either version 2 of the License, or (at your option)
 
11
 *   any later version.
 
12
 *
 
13
 *   This program is distributed in the hope that it will be useful, but
 
14
 *   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 
15
 *   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 
16
 *   for more details.
 
17
 *
 
18
 *   You should have received a copy of the GNU General Public License
 
19
 *   along with this program; if not, write to the Free Software
 
20
 *   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
21
 *
 
22
 * Contents:
 
23
 *
 
24
 *   main()                      - Main entry - just call gimp_main()...
 
25
 *   query()                     - Respond to a plug-in query...
 
26
 *   run()                       - Run the plug-in...
 
27
 *   load_image()                - Load a PNG image into a new image window.
 
28
 *   save_image()                - Save the specified image to a PNG file.
 
29
 *   save_ok_callback()          - Destroy the save dialog and save the image.
 
30
 *   save_dialog()               - Pop up the save dialog.
 
31
 *
 
32
 */
 
33
 
 
34
#include "config.h"
 
35
 
 
36
#include <stdio.h>
 
37
#include <stdlib.h>
 
38
#include <signal.h>
 
39
 
 
40
#include <gtk/gtk.h>
 
41
 
 
42
#include <libgimp/gimp.h>
 
43
#include <libgimp/gimpui.h>
 
44
 
 
45
#include "sgi.h"                /* SGI image library definitions */
 
46
 
 
47
#include "libgimp/stdplugins-intl.h"
 
48
 
 
49
 
 
50
/*
 
51
 * Constants...
 
52
 */
 
53
 
 
54
#define PLUG_IN_VERSION  "1.1.1 - 17 May 1998"
 
55
 
 
56
 
 
57
/*
 
58
 * Local functions...
 
59
 */
 
60
 
 
61
static void     query       (void);
 
62
static void     run         (const gchar      *name,
 
63
                             gint              nparams,
 
64
                             const GimpParam  *param,
 
65
                             gint             *nreturn_vals,
 
66
                             GimpParam       **return_vals);
 
67
 
 
68
static gint32   load_image  (const gchar      *filename);
 
69
static gint     save_image  (const gchar      *filename,
 
70
                             gint32            image_ID,
 
71
                             gint32            drawable_ID);
 
72
 
 
73
static gboolean save_dialog (void);
 
74
 
 
75
/*
 
76
 * Globals...
 
77
 */
 
78
 
 
79
GimpPlugInInfo  PLUG_IN_INFO =
 
80
{
 
81
  NULL,  /* init_proc  */
 
82
  NULL,  /* quit_proc  */
 
83
  query, /* query_proc */
 
84
  run,   /* run_proc   */
 
85
};
 
86
 
 
87
static gint  compression = SGI_COMP_RLE;
 
88
 
 
89
 
 
90
MAIN ()
 
91
 
 
92
static void
 
93
query (void)
 
94
{
 
95
  static GimpParamDef load_args[] =
 
96
  {
 
97
    { GIMP_PDB_INT32,      "run_mode",     "Interactive, non-interactive" },
 
98
    { GIMP_PDB_STRING,     "filename",     "The name of the file to load" },
 
99
    { GIMP_PDB_STRING,     "raw_filename", "The name of the file to load" },
 
100
  };
 
101
  static GimpParamDef load_return_vals[] =
 
102
  {
 
103
    { GIMP_PDB_IMAGE,      "image",        "Output image" },
 
104
  };
 
105
 
 
106
  static GimpParamDef save_args[] =
 
107
  {
 
108
    { GIMP_PDB_INT32,   "run_mode",     "Interactive, non-interactive" },
 
109
    { GIMP_PDB_IMAGE,   "image",        "Input image" },
 
110
    { GIMP_PDB_DRAWABLE,        "drawable",     "Drawable to save" },
 
111
    { GIMP_PDB_STRING,  "filename",     "The name of the file to save the image in" },
 
112
    { GIMP_PDB_STRING,  "raw_filename", "The name of the file to save the image in" },
 
113
    { GIMP_PDB_INT32,   "compression",  "Compression level (0 = none, 1 = RLE, 2 = ARLE)" }
 
114
  };
 
115
 
 
116
  gimp_install_procedure ("file_sgi_load",
 
117
                          "Loads files in SGI image file format",
 
118
                          "This plug-in loads SGI image files.",
 
119
                          "Michael Sweet <mike@easysw.com>",
 
120
                          "Copyright 1997-1998 by Michael Sweet",
 
121
                          PLUG_IN_VERSION,
 
122
                          N_("Silicon Graphics IRIS image"),
 
123
                          NULL,
 
124
                          GIMP_PLUGIN,
 
125
                          G_N_ELEMENTS (load_args),
 
126
                          G_N_ELEMENTS (load_return_vals),
 
127
                          load_args,
 
128
                          load_return_vals);
 
129
 
 
130
  gimp_register_file_handler_mime ("file_sgi_load", "image/x-sgi");
 
131
  gimp_register_magic_load_handler ("file_sgi_load",
 
132
                                    "sgi,rgb,bw,icon",
 
133
                                    "",
 
134
                                    "0,short,474");
 
135
 
 
136
  gimp_install_procedure ("file_sgi_save",
 
137
                          "Saves files in SGI image file format",
 
138
                          "This plug-in saves SGI image files.",
 
139
                          "Michael Sweet <mike@easysw.com>",
 
140
                          "Copyright 1997-1998 by Michael Sweet",
 
141
                          PLUG_IN_VERSION,
 
142
                          N_("Silicon Graphics IRIS image"),
 
143
                          "RGB*,GRAY*",
 
144
                          GIMP_PLUGIN,
 
145
                          G_N_ELEMENTS (save_args),
 
146
                          0,
 
147
                          save_args,
 
148
                          NULL);
 
149
 
 
150
  gimp_register_file_handler_mime ("file_sgi_save", "image/x-sgi");
 
151
  gimp_register_save_handler ("file_sgi_save", "sgi,rgb,bw,icon", "");
 
152
}
 
153
 
 
154
static void
 
155
run (const gchar      *name,
 
156
     gint              nparams,
 
157
     const GimpParam  *param,
 
158
     gint             *nreturn_vals,
 
159
     GimpParam       **return_vals)
 
160
{
 
161
  static GimpParam  values[2];
 
162
  GimpRunMode       run_mode;
 
163
  GimpPDBStatusType status = GIMP_PDB_SUCCESS;
 
164
  gint32            image_ID;
 
165
  gint32            drawable_ID;
 
166
  GimpExportReturn  export = GIMP_EXPORT_CANCEL;
 
167
 
 
168
  run_mode = param[0].data.d_int32;
 
169
 
 
170
  *nreturn_vals = 1;
 
171
  *return_vals  = values;
 
172
  values[0].type          = GIMP_PDB_STATUS;
 
173
  values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
 
174
 
 
175
  INIT_I18N ();
 
176
 
 
177
  if (strcmp (name, "file_sgi_load") == 0)
 
178
    {
 
179
      image_ID = load_image (param[1].data.d_string);
 
180
 
 
181
      if (image_ID != -1)
 
182
        {
 
183
          *nreturn_vals = 2;
 
184
          values[1].type         = GIMP_PDB_IMAGE;
 
185
          values[1].data.d_image = image_ID;
 
186
        }
 
187
      else
 
188
        {
 
189
          status = GIMP_PDB_EXECUTION_ERROR;
 
190
        }
 
191
    }
 
192
  else if (strcmp (name, "file_sgi_save") == 0)
 
193
    {
 
194
      image_ID    = param[1].data.d_int32;
 
195
      drawable_ID = param[2].data.d_int32;
 
196
 
 
197
      /*  eventually export the image */
 
198
      switch (run_mode)
 
199
        {
 
200
        case GIMP_RUN_INTERACTIVE:
 
201
        case GIMP_RUN_WITH_LAST_VALS:
 
202
          gimp_ui_init ("sgi", FALSE);
 
203
          export = gimp_export_image (&image_ID, &drawable_ID, "SGI",
 
204
                                      (GIMP_EXPORT_CAN_HANDLE_RGB  |
 
205
                                       GIMP_EXPORT_CAN_HANDLE_GRAY |
 
206
                                       GIMP_EXPORT_CAN_HANDLE_ALPHA));
 
207
          if (export == GIMP_EXPORT_CANCEL)
 
208
            {
 
209
              values[0].data.d_status = GIMP_PDB_CANCEL;
 
210
              return;
 
211
            }
 
212
          break;
 
213
        default:
 
214
          break;
 
215
        }
 
216
 
 
217
      switch (run_mode)
 
218
        {
 
219
        case GIMP_RUN_INTERACTIVE:
 
220
          /*
 
221
           * Possibly retrieve data...
 
222
           */
 
223
          gimp_get_data ("file_sgi_save", &compression);
 
224
 
 
225
          /*
 
226
           * Then acquire information with a dialog...
 
227
           */
 
228
          if (!save_dialog ())
 
229
            status = GIMP_PDB_CANCEL;
 
230
          break;
 
231
 
 
232
        case GIMP_RUN_NONINTERACTIVE:
 
233
          /*
 
234
           * Make sure all the arguments are there!
 
235
           */
 
236
          if (nparams != 6)
 
237
            {
 
238
              status = GIMP_PDB_CALLING_ERROR;
 
239
            }
 
240
          else
 
241
            {
 
242
              compression = param[5].data.d_int32;
 
243
 
 
244
              if (compression < 0 || compression > 2)
 
245
                status = GIMP_PDB_CALLING_ERROR;
 
246
            };
 
247
          break;
 
248
 
 
249
        case GIMP_RUN_WITH_LAST_VALS:
 
250
          /*
 
251
           * Possibly retrieve data...
 
252
           */
 
253
          gimp_get_data ("file_sgi_save", &compression);
 
254
          break;
 
255
 
 
256
        default:
 
257
          break;
 
258
        };
 
259
 
 
260
      if (status == GIMP_PDB_SUCCESS)
 
261
        {
 
262
          if (save_image (param[3].data.d_string, image_ID, drawable_ID))
 
263
            {
 
264
              gimp_set_data ("file_sgi_save",
 
265
                             &compression, sizeof (compression));
 
266
            }
 
267
          else
 
268
            {
 
269
              status = GIMP_PDB_EXECUTION_ERROR;
 
270
            }
 
271
        }
 
272
 
 
273
      if (export == GIMP_EXPORT_EXPORT)
 
274
        gimp_image_delete (image_ID);
 
275
    }
 
276
  else
 
277
    {
 
278
      status = GIMP_PDB_CALLING_ERROR;
 
279
    }
 
280
 
 
281
  values[0].data.d_status = status;
 
282
}
 
283
 
 
284
 
 
285
/*
 
286
 * 'load_image()' - Load a PNG image into a new image window.
 
287
 */
 
288
 
 
289
static gint32
 
290
load_image (const gchar *filename)  /* I - File to load */
 
291
{
 
292
  int            i,           /* Looping var */
 
293
                 x,           /* Current X coordinate */
 
294
                 y,           /* Current Y coordinate */
 
295
                 image_type,  /* Type of image */
 
296
                 layer_type,  /* Type of drawable/layer */
 
297
                 tile_height, /* Height of tile in GIMP */
 
298
                 count,       /* Count of rows to put in image */
 
299
                 bytes;       /* Number of channels to use */
 
300
  sgi_t         *sgip;        /* File pointer */
 
301
  gint32         image,       /* Image */
 
302
                 layer;       /* Layer */
 
303
  GimpDrawable  *drawable;    /* Drawable for layer */
 
304
  GimpPixelRgn   pixel_rgn;   /* Pixel region for layer */
 
305
  guchar       **pixels,      /* Pixel rows */
 
306
                *pixel,       /* Pixel data */
 
307
                *pptr;        /* Current pixel */
 
308
  gushort      **rows;        /* SGI image data */
 
309
  gchar         *progress;    /* Title for progress display... */
 
310
 
 
311
 /*
 
312
  * Open the file for reading...
 
313
  */
 
314
 
 
315
  sgip = sgiOpen ((char *) filename, SGI_READ, 0, 0, 0, 0, 0);
 
316
  if (sgip == NULL)
 
317
    {
 
318
      g_message (_("Could not open '%s' for reading."),
 
319
                 gimp_filename_to_utf8 (filename));
 
320
      return -1;
 
321
    };
 
322
 
 
323
  progress = g_strdup_printf (_("Opening '%s'..."),
 
324
                               gimp_filename_to_utf8 (filename));
 
325
  gimp_progress_init (progress);
 
326
  g_free (progress);
 
327
 
 
328
  /*
 
329
   * Get the image dimensions and create the image...
 
330
   */
 
331
 
 
332
  bytes = sgip->zsize;
 
333
  
 
334
  switch (sgip->zsize)
 
335
    {
 
336
    case 1 :    /* Grayscale */
 
337
      image_type = GIMP_GRAY;
 
338
      layer_type = GIMP_GRAY_IMAGE;
 
339
      break;
 
340
 
 
341
    case 2 :    /* Grayscale + alpha */
 
342
      image_type = GIMP_GRAY;
 
343
      layer_type = GIMP_GRAYA_IMAGE;
 
344
      break;
 
345
 
 
346
    case 3 :    /* RGB */
 
347
      image_type = GIMP_RGB;
 
348
      layer_type = GIMP_RGB_IMAGE;
 
349
      break;
 
350
 
 
351
    case 4 :    /* RGBA */
 
352
      image_type = GIMP_RGB;
 
353
      layer_type = GIMP_RGBA_IMAGE;
 
354
      break;
 
355
    
 
356
    default:
 
357
      image_type = GIMP_RGB;
 
358
      layer_type = GIMP_RGBA_IMAGE;
 
359
      bytes = 4;
 
360
      break;
 
361
    }
 
362
 
 
363
  image = gimp_image_new (sgip->xsize, sgip->ysize, image_type);
 
364
  if (image == -1)
 
365
    {
 
366
      g_message ("Could not allocate new image");
 
367
      return -1;
 
368
    }
 
369
 
 
370
  gimp_image_set_filename (image, filename);
 
371
 
 
372
  /*
 
373
   * Create the "background" layer to hold the image...
 
374
   */
 
375
 
 
376
  layer = gimp_layer_new (image, _("Background"), sgip->xsize, sgip->ysize,
 
377
                          layer_type, 100, GIMP_NORMAL_MODE);
 
378
  gimp_image_add_layer (image, layer, 0);
 
379
 
 
380
  /*
 
381
   * Get the drawable and set the pixel region for our load...
 
382
   */
 
383
 
 
384
  drawable = gimp_drawable_get (layer);
 
385
 
 
386
  gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, drawable->width,
 
387
                       drawable->height, TRUE, FALSE);
 
388
 
 
389
  /*
 
390
   * Temporary buffers...
 
391
   */
 
392
 
 
393
  tile_height = gimp_tile_height ();
 
394
  pixel       = g_new (guchar, tile_height * sgip->xsize * bytes);
 
395
  pixels      = g_new (guchar *, tile_height);
 
396
 
 
397
  for (i = 0; i < tile_height; i ++)
 
398
    pixels[i] = pixel + sgip->xsize * bytes * i;
 
399
 
 
400
  rows    = g_new (unsigned short *, sgip->zsize);
 
401
  rows[0] = g_new (unsigned short, sgip->xsize * sgip->zsize);
 
402
 
 
403
  for (i = 1; i < sgip->zsize; i ++)
 
404
    rows[i] = rows[0] + i * sgip->xsize;
 
405
 
 
406
  /*
 
407
   * Load the image...
 
408
   */
 
409
 
 
410
  for (y = 0, count = 0;
 
411
       y < sgip->ysize;
 
412
       y ++, count ++)
 
413
    {
 
414
      if (count >= tile_height)
 
415
        {
 
416
          gimp_pixel_rgn_set_rect (&pixel_rgn, pixel,
 
417
                                   0, y - count, drawable->width, count);
 
418
          count = 0;
 
419
 
 
420
          gimp_progress_update ((double) y / (double) sgip->ysize);
 
421
        }
 
422
 
 
423
      for (i = 0; i < sgip->zsize; i ++)
 
424
        if (sgiGetRow (sgip, rows[i], sgip->ysize - 1 - y, i) < 0)
 
425
          printf("sgiGetRow(sgip, rows[i], %d, %d) failed!\n",
 
426
                 sgip->ysize - 1 - y, i);
 
427
 
 
428
      if (sgip->bpp == 1)
 
429
        {
 
430
          /*
 
431
           * 8-bit (unsigned) pixels...
 
432
           */
 
433
 
 
434
          for (x = 0, pptr = pixels[count]; x < sgip->xsize; x ++)
 
435
            for (i = 0; i < bytes; i ++, pptr ++)
 
436
              *pptr = rows[i][x];
 
437
        }
 
438
      else
 
439
        {
 
440
          /*
 
441
           * 16-bit (unsigned) pixels...
 
442
           */
 
443
 
 
444
          for (x = 0, pptr = pixels[count]; x < sgip->xsize; x ++)
 
445
            for (i = 0; i < bytes; i ++, pptr ++)
 
446
              *pptr = rows[i][x] >> 8;
 
447
        }
 
448
    }
 
449
 
 
450
  /*
 
451
   * Do the last n rows (count always > 0)
 
452
   */
 
453
 
 
454
  gimp_pixel_rgn_set_rect (&pixel_rgn, pixel, 0,
 
455
                           y - count, drawable->width, count);
 
456
 
 
457
  /*
 
458
   * Done with the file...
 
459
   */
 
460
 
 
461
  sgiClose (sgip);
 
462
 
 
463
  g_free (pixel);
 
464
  g_free (pixels);
 
465
  g_free (rows[0]);
 
466
  g_free (rows);
 
467
 
 
468
  /*
 
469
   * Update the display...
 
470
   */
 
471
 
 
472
  gimp_drawable_flush (drawable);
 
473
  gimp_drawable_detach (drawable);
 
474
 
 
475
  return image;
 
476
}
 
477
 
 
478
 
 
479
/*
 
480
 * 'save_image()' - Save the specified image to a SGI file.
 
481
 */
 
482
 
 
483
static gint
 
484
save_image (const gchar *filename,
 
485
            gint32       image_ID,
 
486
            gint32       drawable_ID)
 
487
{
 
488
  gint        i, j,        /* Looping var */
 
489
              x,           /* Current X coordinate */
 
490
              y,           /* Current Y coordinate */
 
491
              tile_height, /* Height of tile in GIMP */
 
492
              count,       /* Count of rows to put in image */
 
493
              zsize;       /* Number of channels in file */
 
494
  sgi_t      *sgip;        /* File pointer */
 
495
  GimpDrawable  *drawable;    /* Drawable for layer */
 
496
  GimpPixelRgn   pixel_rgn;   /* Pixel region for layer */
 
497
  guchar    **pixels,      /* Pixel rows */
 
498
             *pixel,       /* Pixel data */
 
499
             *pptr;        /* Current pixel */
 
500
  gushort   **rows;        /* SGI image data */
 
501
  gchar      *progress;    /* Title for progress display... */
 
502
 
 
503
  /*
 
504
   * Get the drawable for the current image...
 
505
   */
 
506
 
 
507
  drawable = gimp_drawable_get (drawable_ID);
 
508
 
 
509
  gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, drawable->width,
 
510
                       drawable->height, FALSE, FALSE);
 
511
 
 
512
  zsize = 0;
 
513
  switch (gimp_drawable_type (drawable_ID))
 
514
    {
 
515
    case GIMP_GRAY_IMAGE :
 
516
      zsize = 1;
 
517
      break;
 
518
    case GIMP_GRAYA_IMAGE :
 
519
      zsize = 2;
 
520
      break;
 
521
    case GIMP_RGB_IMAGE :
 
522
      zsize = 3;
 
523
      break;
 
524
    case GIMP_RGBA_IMAGE :
 
525
      zsize = 4;
 
526
      break;
 
527
    default:
 
528
      g_message (_("Cannot operate on indexed color images."));
 
529
      return FALSE;
 
530
    }
 
531
 
 
532
  /*
 
533
   * Open the file for writing...
 
534
   */
 
535
 
 
536
  sgip = sgiOpen ((char *) filename, SGI_WRITE, compression, 1,
 
537
                  drawable->width, drawable->height, zsize);
 
538
  if (sgip == NULL)
 
539
    {
 
540
      g_message (_("Could not open '%s' for writing."),
 
541
                  gimp_filename_to_utf8 (filename));
 
542
      return FALSE;
 
543
    };
 
544
 
 
545
  progress = g_strdup_printf (_("Saving '%s'..."),
 
546
                               gimp_filename_to_utf8 (filename));
 
547
  gimp_progress_init (progress);
 
548
  g_free (progress);
 
549
 
 
550
  /*
 
551
   * Allocate memory for "tile_height" rows...
 
552
   */
 
553
 
 
554
  tile_height = gimp_tile_height ();
 
555
  pixel       = g_new (guchar, tile_height * drawable->width * zsize);
 
556
  pixels      = g_new (guchar *, tile_height);
 
557
 
 
558
  for (i = 0; i < tile_height; i ++)
 
559
    pixels[i]= pixel + drawable->width * zsize * i;
 
560
 
 
561
  rows    = g_new (gushort *, sgip->zsize);
 
562
  rows[0] = g_new (gushort, sgip->xsize * sgip->zsize);
 
563
 
 
564
  for (i = 1; i < sgip->zsize; i ++)
 
565
    rows[i] = rows[0] + i * sgip->xsize;
 
566
 
 
567
  /*
 
568
   * Save the image...
 
569
   */
 
570
 
 
571
  for (y = 0; y < drawable->height; y += count)
 
572
    {
 
573
      /*
 
574
       * Grab more pixel data...
 
575
       */
 
576
 
 
577
      if ((y + tile_height) >= drawable->height)
 
578
        count = drawable->height - y;
 
579
      else
 
580
        count = tile_height;
 
581
 
 
582
      gimp_pixel_rgn_get_rect (&pixel_rgn, pixel, 0, y, drawable->width, count);
 
583
 
 
584
      /*
 
585
       * Convert to shorts and write each color plane separately...
 
586
       */
 
587
 
 
588
      for (i = 0, pptr = pixels[0]; i < count; i ++)
 
589
        {
 
590
          for (x = 0; x < drawable->width; x ++)
 
591
            for (j = 0; j < zsize; j ++, pptr ++)
 
592
              rows[j][x] = *pptr;
 
593
 
 
594
          for (j = 0; j < zsize; j ++)
 
595
            sgiPutRow (sgip, rows[j], drawable->height - 1 - y - i, j);
 
596
        };
 
597
 
 
598
      gimp_progress_update ((double) y / (double) drawable->height);
 
599
    };
 
600
 
 
601
  /*
 
602
   * Done with the file...
 
603
   */
 
604
 
 
605
  sgiClose (sgip);
 
606
 
 
607
  g_free (pixel);
 
608
  g_free (pixels);
 
609
  g_free (rows[0]);
 
610
  g_free (rows);
 
611
 
 
612
  return TRUE;
 
613
}
 
614
 
 
615
static gboolean
 
616
save_dialog (void)
 
617
{
 
618
  GtkWidget *dlg;
 
619
  GtkWidget *frame;
 
620
  gboolean   run;
 
621
 
 
622
  dlg = gimp_dialog_new (_("Save as SGI"), "sgi",
 
623
                         NULL, 0,
 
624
                         gimp_standard_help_func, "file-sgi-save",
 
625
 
 
626
                         GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 
627
                         GTK_STOCK_OK,     GTK_RESPONSE_OK,
 
628
 
 
629
                         NULL);
 
630
 
 
631
  frame = gimp_int_radio_group_new (TRUE, _("Compression type"),
 
632
                                    G_CALLBACK (gimp_radio_button_update),
 
633
                                    &compression, compression,
 
634
 
 
635
                                    _("No compression"),
 
636
                                    SGI_COMP_NONE, NULL,
 
637
                                    _("RLE compression"),
 
638
                                    SGI_COMP_RLE, NULL,
 
639
                                    _("Aggressive RLE\n(not supported by SGI)"),
 
640
                                    SGI_COMP_ARLE, NULL,
 
641
 
 
642
                                    NULL);
 
643
 
 
644
  gtk_container_set_border_width (GTK_CONTAINER (frame), 12);
 
645
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame, TRUE, TRUE, 0);
 
646
  gtk_widget_show (frame);
 
647
 
 
648
  gtk_widget_show (dlg);
 
649
 
 
650
  run = (gimp_dialog_run (GIMP_DIALOG (dlg)) == GTK_RESPONSE_OK);
 
651
 
 
652
  gtk_widget_destroy (dlg);
 
653
 
 
654
  return run;
 
655
}