~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to plug-ins/common/film.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* The GIMP -- an image manipulation program
 
1
/* GIMP - The GNU Image Manipulation Program
2
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
3
 * Film plug-in (C) 1997 Peter Kirchgessner
4
4
 * e-mail: pkirchg@aol.com, WWW: http://members.aol.com/pkirchg
22
22
 * This plug-in generates a film roll with several images
23
23
 */
24
24
 
25
 
static char ident[] = "@(#) GIMP Film plug-in v1.04 1999-10-08";
26
 
 
27
25
#include "config.h"
28
26
 
29
 
#include <stdio.h>
30
 
#include <stdlib.h>
31
27
#include <string.h>
32
28
 
33
 
#include <gtk/gtk.h>
34
 
 
35
29
#include <libgimp/gimp.h>
36
30
#include <libgimp/gimpui.h>
37
31
 
38
32
#include "libgimp/stdplugins-intl.h"
39
33
 
40
34
 
 
35
#define PLUG_IN_PROC        "plug-in-film"
 
36
#define PLUG_IN_BINARY      "film"
 
37
 
41
38
/* Maximum number of pictures per film */
42
39
#define MAX_FILM_PICTURES   64
43
40
#define COLOR_BUTTON_WIDTH  50
80
77
 */
81
78
static void      query  (void);
82
79
static void      run    (const gchar      *name,
83
 
                         gint              nparams,
84
 
                         const GimpParam  *param,
85
 
                         gint             *nreturn_vals,
86
 
                         GimpParam       **return_vals);
 
80
                         gint              nparams,
 
81
                         const GimpParam  *param,
 
82
                         gint             *nreturn_vals,
 
83
                         GimpParam       **return_vals);
87
84
 
88
85
 
89
86
static gint32    create_new_image   (const gchar    *filename,
90
 
                                     guint           width,
91
 
                                     guint           height,
92
 
                                     GimpImageType   gdtype,
93
 
                                     gint32         *layer_ID,
94
 
                                     GimpDrawable  **drawable,
95
 
                                     GimpPixelRgn   *pixel_rgn);
 
87
                                     guint           width,
 
88
                                     guint           height,
 
89
                                     GimpImageType   gdtype,
 
90
                                     gint32         *layer_ID,
 
91
                                     GimpDrawable  **drawable,
 
92
                                     GimpPixelRgn   *pixel_rgn);
96
93
 
97
94
static gchar   * compose_image_name (gint32          image_ID);
98
95
 
100
97
 
101
98
static gboolean  check_filmvals     (void);
102
99
 
103
 
static void      convert_to_rgb     (GimpDrawable   *srcdrawable,
104
 
                                     gint            numpix,
105
 
                                     guchar         *src,
106
 
                                     guchar         *dst);
107
 
 
108
100
static void      set_pixels         (gint            numpix,
109
 
                                     guchar         *dst,
110
 
                                     GimpRGB        *color);
111
 
 
112
 
static gboolean  scale_layer        (gint32          src_layer,
113
 
                                     gint            src_x0,
114
 
                                     gint            src_y0,
115
 
                                     gint            src_width,
116
 
                                     gint            src_height,
117
 
                                     gint32          dst_layer,
118
 
                                     gint            dst_x0,
119
 
                                     gint            dst_y0,
120
 
                                     gint            dst_width,
121
 
                                     gint            dst_height);
 
101
                                     guchar         *dst,
 
102
                                     GimpRGB        *color);
122
103
 
123
104
static guchar  * create_hole_rgb    (gint            width,
124
 
                                     gint            height);
 
105
                                     gint            height);
125
106
 
126
107
static void      draw_hole_rgb      (GimpDrawable   *drw,
127
 
                                     gint            x,
128
 
                                     gint            y,
129
 
                                     gint            width,
130
 
                                     gint            height,
131
 
                                     guchar         *hole);
 
108
                                     gint            x,
 
109
                                     gint            y,
 
110
                                     gint            width,
 
111
                                     gint            height,
 
112
                                     guchar         *hole);
132
113
 
133
114
static void      draw_number        (gint32          layer_ID,
134
 
                                     gint            num,
135
 
                                     gint            x,
136
 
                                     gint            y,
137
 
                                     gint            height);
 
115
                                     gint            num,
 
116
                                     gint            x,
 
117
                                     gint            y,
 
118
                                     gint            height);
138
119
 
139
120
 
140
121
static void        add_list_item_callback (GtkWidget        *widget,
141
 
                                           GtkTreeSelection *sel);
 
122
                                           GtkTreeSelection *sel);
142
123
static void        del_list_item_callback (GtkWidget        *widget,
143
 
                                           GtkTreeSelection *sel);
 
124
                                           GtkTreeSelection *sel);
144
125
 
145
126
static GtkTreeModel * add_image_list      (gboolean        add_box_flag,
146
 
                                           gint            n,
147
 
                                           gint32         *image_id,
148
 
                                           GtkWidget      *hbox);
149
 
 
150
 
static gboolean    film_dialog               (gint32       image_ID);
151
 
static void        film_reset_callback       (GtkWidget   *widget,
152
 
                                              gpointer     data);
153
 
static void        film_font_select_callback (const gchar *name,
154
 
                                              gboolean     closing,
155
 
                                              gpointer     data);
156
 
 
157
 
 
158
 
GimpPlugInInfo PLUG_IN_INFO =
 
127
                                           gint            n,
 
128
                                           gint32         *image_id,
 
129
                                           GtkWidget      *hbox);
 
130
 
 
131
static gboolean    film_dialog               (gint32                image_ID);
 
132
static void        film_reset_callback       (GtkWidget            *widget,
 
133
                                              gpointer              data);
 
134
static void        film_font_select_callback (GimpFontSelectButton *button,
 
135
                                              const gchar          *name,
 
136
                                              gboolean              closing,
 
137
                                              gpointer              data);
 
138
 
 
139
 
 
140
const GimpPlugInInfo PLUG_IN_INFO =
159
141
{
160
142
  NULL,  /* init_proc  */
161
143
  NULL,  /* quit_proc  */
210
192
static void
211
193
query (void)
212
194
{
213
 
  static GimpParamDef args[] =
214
 
  {
215
 
    { GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
216
 
    { GIMP_PDB_IMAGE, "image", "Input image (only used as default image in interactive mode)" },
217
 
    { GIMP_PDB_DRAWABLE, "drawable", "Input drawable (not used)" },
218
 
    { GIMP_PDB_INT32, "film_height", "Height of film (0: fit to images)" },
219
 
    { GIMP_PDB_COLOR, "film_color", "Color of the film" },
220
 
    { GIMP_PDB_INT32, "number_start", "Start index for numbering" },
221
 
    { GIMP_PDB_STRING, "number_font", "Font for drawing numbers" },
222
 
    { GIMP_PDB_COLOR, "number_color", "Color for numbers" },
223
 
    { GIMP_PDB_INT32, "at_top", "Flag for drawing numbers at top of film" },
224
 
    { GIMP_PDB_INT32, "at_bottom", "Flag for drawing numbers at bottom of film" },
225
 
    { GIMP_PDB_INT32, "num_images", "Number of images to be used for film" },
226
 
    { GIMP_PDB_INT32ARRAY, "image_ids", "num_images image IDs to be used for film"}
227
 
  };
228
 
 
229
 
  static GimpParamDef return_vals[] =
230
 
  {
231
 
    { GIMP_PDB_IMAGE, "new_image", "Output image" }
232
 
  };
233
 
 
234
 
  gimp_install_procedure ("plug_in_film",
235
 
                          "Compose several images to a roll film",
236
 
                          "Compose several images to a roll film",
237
 
                          "Peter Kirchgessner",
238
 
                          "Peter Kirchgessner (peter@kirchgessner.net)",
239
 
                          "1997",
240
 
                          N_("_Film..."),
241
 
                          "INDEXED*, GRAY*, RGB*",
242
 
                          GIMP_PLUGIN,
243
 
                          G_N_ELEMENTS (args),
 
195
  static const GimpParamDef args[] =
 
196
  {
 
197
    { GIMP_PDB_INT32,      "run-mode",     "Interactive, non-interactive" },
 
198
    { GIMP_PDB_IMAGE,      "image",        "Input image (only used as default image in interactive mode)" },
 
199
    { GIMP_PDB_DRAWABLE,   "drawable",     "Input drawable (not used)" },
 
200
    { GIMP_PDB_INT32,      "film-height",  "Height of film (0: fit to images)" },
 
201
    { GIMP_PDB_COLOR,      "film-color",   "Color of the film" },
 
202
    { GIMP_PDB_INT32,      "number-start", "Start index for numbering" },
 
203
    { GIMP_PDB_STRING,     "number-font",  "Font for drawing numbers" },
 
204
    { GIMP_PDB_COLOR,      "number-color", "Color for numbers" },
 
205
    { GIMP_PDB_INT32,      "at-top",       "Flag for drawing numbers at top of film" },
 
206
    { GIMP_PDB_INT32,      "at-bottom",    "Flag for drawing numbers at bottom of film" },
 
207
    { GIMP_PDB_INT32,      "num-images",   "Number of images to be used for film" },
 
208
    { GIMP_PDB_INT32ARRAY, "image-ids",    "num_images image IDs to be used for film"}
 
209
  };
 
210
 
 
211
  static const GimpParamDef return_vals[] =
 
212
  {
 
213
    { GIMP_PDB_IMAGE, "new-image", "Output image" }
 
214
  };
 
215
 
 
216
  gimp_install_procedure (PLUG_IN_PROC,
 
217
                          N_("Combine several images on a film strip"),
 
218
                          "Compose several images to a roll film",
 
219
                          "Peter Kirchgessner",
 
220
                          "Peter Kirchgessner (peter@kirchgessner.net)",
 
221
                          "1997",
 
222
                          N_("_Filmstrip..."),
 
223
                          "INDEXED*, GRAY*, RGB*",
 
224
                          GIMP_PLUGIN,
 
225
                          G_N_ELEMENTS (args),
244
226
                          G_N_ELEMENTS (return_vals),
245
 
                          args, return_vals);
 
227
                          args, return_vals);
246
228
 
247
 
  gimp_plugin_menu_register ("plug_in_film", "<Image>/Filters/Combine");
 
229
  gimp_plugin_menu_register (PLUG_IN_PROC, "<Image>/Filters/Combine");
248
230
}
249
231
 
250
232
static void
275
257
    {
276
258
    case GIMP_RUN_INTERACTIVE:
277
259
      /*  Possibly retrieve data  */
278
 
      gimp_get_data ("plug_in_film", &filmvals);
 
260
      gimp_get_data (PLUG_IN_PROC, &filmvals);
279
261
 
280
262
      /*  First acquire information with a dialog  */
281
263
      if (! film_dialog (param[1].data.d_int32))
282
 
        return;
 
264
        return;
283
265
      break;
284
266
 
285
267
    case GIMP_RUN_NONINTERACTIVE:
286
268
      /*  Make sure all the arguments are there!  */
287
269
      /* Also we want to have some images to compose */
288
270
      if ((nparams != 12) || (param[10].data.d_int32 < 1))
289
 
        {
290
 
          status = GIMP_PDB_CALLING_ERROR;
291
 
        }
 
271
        {
 
272
          status = GIMP_PDB_CALLING_ERROR;
 
273
        }
292
274
      else
293
 
        {
 
275
        {
294
276
          filmvals.keep_height       = (param[3].data.d_int32 <= 0);
295
277
          filmvals.film_height       = (filmvals.keep_height ?
296
 
                                        128 : param[3].data.d_int32);
297
 
          filmvals.film_color        = param[4].data.d_color;
 
278
                                        128 : param[3].data.d_int32);
 
279
          filmvals.film_color        = param[4].data.d_color;
298
280
          filmvals.number_start      = param[5].data.d_int32;
299
281
          g_strlcpy (filmvals.number_font, param[6].data.d_string, FONT_LEN);
300
 
          filmvals.number_color      = param[7].data.d_color;
 
282
          filmvals.number_color      = param[7].data.d_color;
301
283
          filmvals.number_pos[0]     = param[8].data.d_int32;
302
284
          filmvals.number_pos[1]     = param[9].data.d_int32;
303
285
          filmvals.num_images        = param[10].data.d_int32;
305
287
            filmvals.num_images = MAX_FILM_PICTURES;
306
288
          for (k = 0; k < filmvals.num_images; k++)
307
289
            filmvals.image[k] = param[11].data.d_int32array[k];
308
 
        }
 
290
        }
309
291
      break;
310
292
 
311
293
    case GIMP_RUN_WITH_LAST_VALS:
312
294
      /*  Possibly retrieve data  */
313
 
      gimp_get_data ("plug_in_film", &filmvals);
 
295
      gimp_get_data (PLUG_IN_PROC, &filmvals);
314
296
      break;
315
297
 
316
298
    default:
322
304
 
323
305
  if (status == GIMP_PDB_SUCCESS)
324
306
    {
325
 
      gimp_progress_init (_("Composing Images..."));
 
307
      gimp_progress_init (_("Composing images"));
326
308
 
327
309
      image_ID = film ();
328
310
 
329
311
      if (image_ID < 0)
330
 
        {
331
 
          status = GIMP_PDB_EXECUTION_ERROR;
332
 
        }
 
312
        {
 
313
          status = GIMP_PDB_EXECUTION_ERROR;
 
314
        }
333
315
      else
334
 
        {
335
 
          values[1].data.d_int32 = image_ID;
336
 
          gimp_image_undo_enable (image_ID);
337
 
          gimp_image_clean_all (image_ID);
338
 
          if (run_mode != GIMP_RUN_NONINTERACTIVE)
339
 
            gimp_display_new (image_ID);
340
 
        }
 
316
        {
 
317
          values[1].data.d_int32 = image_ID;
 
318
          gimp_image_undo_enable (image_ID);
 
319
          gimp_image_clean_all (image_ID);
 
320
          if (run_mode != GIMP_RUN_NONINTERACTIVE)
 
321
            gimp_display_new (image_ID);
 
322
        }
341
323
 
342
324
      /*  Store data  */
343
325
      if (run_mode == GIMP_RUN_INTERACTIVE)
344
 
        gimp_set_data ("plug_in_film", &filmvals, sizeof (FilmVals));
 
326
        gimp_set_data (PLUG_IN_PROC, &filmvals, sizeof (FilmVals));
345
327
    }
346
328
 
347
329
  values[0].data.d_status = status;
351
333
static gint32
352
334
film (void)
353
335
{
354
 
  gint width, height, tile_height, scan_lines;
355
 
  guchar *dst, *hole;
356
 
  gint film_height, film_width;
357
 
  gint picture_width, picture_height, picture_space, picture_x0, picture_y0;
358
 
  gint hole_offset, hole_width, hole_height, hole_space, hole_x;
359
 
  gint number_height, num_images, num_pictures;
360
 
  gint i, j, k, picture_count;
361
 
  gdouble f;
362
 
  gint num_layers;
363
 
  gint32 *image_ID_src, image_ID_dst, layer_ID_src, layer_ID_dst;
364
 
  gint32 *layers;
 
336
  gint          width, height, tile_height;
 
337
  guchar       *hole;
 
338
  gint          film_height, film_width;
 
339
  gint          picture_width, picture_height;
 
340
  gint          picture_space, picture_x0, picture_y0;
 
341
  gint          hole_offset, hole_width, hole_height, hole_space, hole_x;
 
342
  gint          number_height, num_images, num_pictures;
 
343
  gint          j, k, picture_count;
 
344
  gdouble       f;
 
345
  gint          num_layers;
 
346
  gint32       *image_ID_src, image_ID_dst, layer_ID_src, layer_ID_dst;
 
347
  gint          image_ID_tmp;
 
348
  gint32       *layers;
365
349
  GimpDrawable *drawable_dst;
366
 
  GimpPixelRgn pixel_rgn_dst;
 
350
  GimpPixelRgn  pixel_rgn_dst;
 
351
  gint          new_layer;
 
352
  gint          floating_sel;
367
353
 
368
354
  /* initialize */
369
355
 
377
363
 
378
364
  gimp_context_push ();
379
365
  gimp_context_set_foreground (&filmvals.number_color);
 
366
  gimp_context_set_background (&filmvals.film_color);
380
367
 
381
368
  tile_height = gimp_tile_height ();
382
369
 
384
371
    {
385
372
      picture_height = 0;
386
373
      for (j = 0; j < num_images; j++)
387
 
        {
388
 
          height = gimp_image_height (image_ID_src[j]);
389
 
          if (height > picture_height) picture_height = height;
390
 
        }
 
374
        {
 
375
          height = gimp_image_height (image_ID_src[j]);
 
376
          if (height > picture_height) picture_height = height;
 
377
        }
391
378
      film_height = (int)(picture_height / filmvals.picture_height + 0.5);
392
379
      filmvals.film_height = film_height;
393
380
    }
415
402
      picture_width = width * f;
416
403
 
417
404
      for (k = 0; k < num_layers; k++)
418
 
        {
419
 
          if (gimp_layer_is_floating_sel (layers[k]))
420
 
            continue;
 
405
        {
 
406
          if (gimp_layer_is_floating_sel (layers[k]))
 
407
            continue;
421
408
 
422
 
          film_width += (picture_space/2);  /* Leading space */
423
 
          film_width += picture_width;      /* Scaled image width */
424
 
          film_width += (picture_space/2);  /* Trailing space */
425
 
          num_pictures++;
426
 
        }
 
409
          film_width += (picture_space/2);  /* Leading space */
 
410
          film_width += picture_width;      /* Scaled image width */
 
411
          film_width += (picture_space/2);  /* Trailing space */
 
412
          num_pictures++;
 
413
        }
427
414
 
428
415
      g_free (layers);
429
416
    }
436
423
#endif
437
424
 
438
425
  image_ID_dst = create_new_image (_("Untitled"),
439
 
                                   (guint) film_width, (guint) film_height,
440
 
                                   GIMP_RGB_IMAGE, &layer_ID_dst,
441
 
                                   &drawable_dst, &pixel_rgn_dst);
442
 
 
443
 
  dst = g_new (guchar, film_width * tile_height * 3);
 
426
                                   (guint) film_width, (guint) film_height,
 
427
                                   GIMP_RGB_IMAGE, &layer_ID_dst,
 
428
                                   &drawable_dst, &pixel_rgn_dst);
444
429
 
445
430
  /* Fill film background */
446
 
  i = 0;
447
 
  while (i < film_height)
448
 
    {
449
 
      scan_lines =
450
 
        (i + tile_height - 1 < film_height) ? tile_height : (film_height - i);
451
 
 
452
 
      set_pixels (film_width * scan_lines, dst, &filmvals.film_color);
453
 
 
454
 
      gimp_pixel_rgn_set_rect (&pixel_rgn_dst, dst, 0, i,
455
 
                               film_width, scan_lines);
456
 
      i += scan_lines;
457
 
    }
458
 
  g_free (dst);
 
431
  gimp_drawable_fill (layer_ID_dst, GIMP_BACKGROUND_FILL);
459
432
 
460
433
  /* Draw all the holes */
461
434
  hole_offset = film_height * filmvals.hole_offset;
473
446
  if (hole)
474
447
    {
475
448
      while (hole_x < film_width)
476
 
        {
477
 
          draw_hole_rgb (drawable_dst, hole_x,
478
 
                         hole_offset,
479
 
                         hole_width, hole_height, hole);
480
 
          draw_hole_rgb (drawable_dst, hole_x,
481
 
                         film_height-hole_offset-hole_height,
482
 
                         hole_width, hole_height, hole);
 
449
        {
 
450
          draw_hole_rgb (drawable_dst, hole_x,
 
451
                         hole_offset,
 
452
                         hole_width, hole_height, hole);
 
453
          draw_hole_rgb (drawable_dst, hole_x,
 
454
                         film_height-hole_offset-hole_height,
 
455
                         hole_width, hole_height, hole);
483
456
 
484
 
          hole_x += hole_width + hole_space;
485
 
        }
 
457
          hole_x += hole_width + hole_space;
 
458
        }
486
459
      g_free (hole);
487
460
    }
488
461
  gimp_drawable_detach (drawable_dst);
489
462
 
 
463
 
490
464
  /* Compose all images and layers */
491
465
  picture_x0 = 0;
492
466
  picture_count = 0;
493
467
  for (j = 0; j < num_images; j++)
494
468
    {
495
 
      width = gimp_image_width (image_ID_src[j]);
496
 
      height = gimp_image_height (image_ID_src[j]);
 
469
      image_ID_tmp = gimp_image_duplicate (image_ID_src[j]);
 
470
      width = gimp_image_width (image_ID_tmp);
 
471
      height = gimp_image_height (image_ID_tmp);
497
472
      f = ((gdouble) picture_height) / (gdouble) height;
498
473
      picture_width = width * f;
499
 
 
500
 
      layers = gimp_image_get_layers (image_ID_src[j], &num_layers);
501
 
 
 
474
      if (gimp_image_base_type (image_ID_tmp) != GIMP_RGB_IMAGE)
 
475
        gimp_image_convert_rgb (image_ID_tmp);
 
476
      gimp_image_scale (image_ID_tmp, picture_width, picture_height);
 
477
 
 
478
      layers = gimp_image_get_layers (image_ID_tmp, &num_layers);
502
479
      for (k = 0; k < num_layers; k++)
503
 
        {
504
 
          if (gimp_layer_is_floating_sel (layers[k]))
505
 
            continue;
506
 
 
507
 
          picture_x0 += picture_space / 2;
508
 
 
509
 
          layer_ID_src = layers[k];
510
 
          /* Scale the layer and insert int new image */
511
 
          if (! scale_layer (layer_ID_src, 0, 0, width, height,
512
 
                             layer_ID_dst, picture_x0, picture_y0,
513
 
                             picture_width, picture_height))
514
 
            {
515
 
              g_warning ("film: error during scale_layer\n");
516
 
              return -1;
517
 
            }
518
 
 
519
 
          /* Draw picture numbers */
520
 
          if ((number_height > 0) &&
521
 
              (filmvals.number_pos[0] || filmvals.number_pos[1]))
522
 
            {
523
 
              if (filmvals.number_pos[0])
524
 
                draw_number (layer_ID_dst, filmvals.number_start + picture_count,
525
 
                             picture_x0 + picture_width/2,
526
 
                             (hole_offset-number_height)/2, number_height);
527
 
              if (filmvals.number_pos[1])
528
 
                draw_number (layer_ID_dst, filmvals.number_start + picture_count,
529
 
                             picture_x0 + picture_width/2,
530
 
                             film_height - (hole_offset + number_height)/2,
531
 
                             number_height);
532
 
            }
533
 
 
534
 
          picture_x0 += picture_width + (picture_space/2);
 
480
        {
 
481
          if (gimp_layer_is_floating_sel (layers[k]))
 
482
            continue;
 
483
 
 
484
          picture_x0 += picture_space / 2;
 
485
 
 
486
          layer_ID_src = layers[k];
 
487
          gimp_layer_resize_to_image_size (layer_ID_src);
 
488
          new_layer = gimp_layer_new_from_drawable (layer_ID_src,
 
489
                                                    image_ID_dst);
 
490
          gimp_image_add_layer (image_ID_dst, new_layer, -1);
 
491
          gimp_layer_set_offsets (new_layer, picture_x0, picture_y0);
 
492
 
 
493
          /* Draw picture numbers */
 
494
          if ((number_height > 0) &&
 
495
              (filmvals.number_pos[0] || filmvals.number_pos[1]))
 
496
            {
 
497
              if (filmvals.number_pos[0])
 
498
                draw_number (layer_ID_dst,
 
499
                             filmvals.number_start + picture_count,
 
500
                             picture_x0 + picture_width/2,
 
501
                             (hole_offset-number_height)/2, number_height);
 
502
              if (filmvals.number_pos[1])
 
503
                draw_number (layer_ID_dst,
 
504
                             filmvals.number_start + picture_count,
 
505
                             picture_x0 + picture_width/2,
 
506
                             film_height - (hole_offset + number_height)/2,
 
507
                             number_height);
 
508
            }
 
509
 
 
510
          picture_x0 += picture_width + (picture_space/2);
535
511
 
536
512
          gimp_progress_update (((gdouble) (picture_count + 1)) /
537
513
                                (gdouble) num_pictures);
538
514
 
539
 
          picture_count++;
540
 
        }
 
515
          picture_count++;
 
516
        }
 
517
 
 
518
      g_free (layers);
 
519
      gimp_image_delete (image_ID_tmp);
541
520
    }
542
521
 
543
 
  g_free (layers);
 
522
  gimp_image_flatten (image_ID_dst);
544
523
 
545
524
  /* Drawing text/numbers leaves us with a floating selection. Stop it */
546
 
  gimp_floating_sel_anchor (gimp_image_get_floating_sel (image_ID_dst));
 
525
  floating_sel = gimp_image_get_floating_sel (image_ID_dst);
 
526
  if (floating_sel != -1)
 
527
    gimp_floating_sel_anchor (floating_sel);
547
528
 
548
529
  gimp_context_pop ();
549
530
 
570
551
  return TRUE;
571
552
}
572
553
 
573
 
/* Converts numpix pixels from src to RGB at dst */
574
 
static void
575
 
convert_to_rgb (GimpDrawable *srcdrawable,
576
 
                gint          numpix,
577
 
                guchar       *src,
578
 
                guchar       *dst)
579
 
{
580
 
 register guchar *from = src, *to = dst;
581
 
 register gint k;
582
 
 register guchar *cmap, *colour;
583
 
 gint ncols;
584
 
 
585
 
 switch (gimp_drawable_type (srcdrawable->drawable_id))
586
 
   {
587
 
   case GIMP_RGB_IMAGE:
588
 
     memcpy ((char *)dst, (char *)src, numpix*3);
589
 
     break;
590
 
 
591
 
   case GIMP_RGBA_IMAGE:
592
 
     from = src;
593
 
     to = dst;
594
 
     k = numpix;
595
 
     while (k-- > 0)
596
 
       {
597
 
         *(to++) = *(from++); *(to++) = *(from++); *(to++) = *(from++);
598
 
         from++;
599
 
       }
600
 
     break;
601
 
 
602
 
   case GIMP_GRAY_IMAGE:
603
 
     from = src;
604
 
     to = dst;
605
 
     k = numpix;
606
 
     while (k-- > 0)
607
 
       {
608
 
         to[0] = to[1] = to[2] = *(from++);
609
 
         to += 3;
610
 
       }
611
 
     break;
612
 
 
613
 
   case GIMP_GRAYA_IMAGE:
614
 
     from = src;
615
 
     to = dst;
616
 
     k = numpix;
617
 
     while (k-- > 0)
618
 
       {
619
 
         to[0] = to[1] = to[2] = *from;
620
 
         from += 2;
621
 
         to += 3;
622
 
       }
623
 
     break;
624
 
 
625
 
   case GIMP_INDEXED_IMAGE:
626
 
   case GIMP_INDEXEDA_IMAGE:
627
 
     cmap = gimp_image_get_colormap (gimp_drawable_get_image (srcdrawable->drawable_id),
628
 
                                     &ncols);
629
 
     if (cmap)
630
 
       {
631
 
         from = src;
632
 
         to = dst;
633
 
         k = numpix;
634
 
         while (k-- > 0)
635
 
           {
636
 
             colour = cmap + 3*(int)(*from);
637
 
             *(to++) = *(colour++);
638
 
             *(to++) = *(colour++);
639
 
             *(to++) = *(colour++);
640
 
             from += srcdrawable->bpp;
641
 
           }
642
 
       }
643
 
     break;
644
 
 
645
 
   default:
646
 
     g_printerr ("convert_to_rgb: unknown image type\n");
647
 
     break;
648
 
   }
649
 
}
650
 
 
651
554
/* Assigns numpix pixels starting at dst with color r,g,b */
652
555
static void
653
556
set_pixels (gint     numpix,
654
557
            guchar  *dst,
655
558
            GimpRGB *color)
656
559
{
657
 
  register gint k;
 
560
  register gint   k;
658
561
  register guchar ur, ug, ub, *udest;
659
562
 
660
563
  ur = color->r * 255.999;
671
574
    }
672
575
}
673
576
 
674
 
/* Scales a portion of a layer and places it in another layer. */
675
 
/* On success, TRUE is returned. Otherwise FALSE is returned */
676
 
static gboolean
677
 
scale_layer (gint32  src_layer,
678
 
             gint    src_x0,
679
 
             gint    src_y0,
680
 
             gint    src_width,
681
 
             gint    src_height,
682
 
             gint32  dst_layer,
683
 
             gint    dst_x0,
684
 
             gint    dst_y0,
685
 
             gint    dst_width,
686
 
             gint    dst_height)
687
 
{
688
 
  gint tile_height, i, scan_lines, numpix;
689
 
  guchar *src, *tmp = (guchar *) ident; /* Just to satisfy gcc */
690
 
  gint32 tmp_image, tmp_layer;
691
 
  GimpDrawable *tmp_drawable, *src_drawable, *dst_drawable;
692
 
  GimpPixelRgn tmp_pixel_rgn, src_pixel_rgn, dst_pixel_rgn;
693
 
 
694
 
  tile_height = gimp_tile_height ();
695
 
 
696
 
  src_drawable = gimp_drawable_get (src_layer);
697
 
 
698
 
  /*** Get a RGB copy of the source region ***/
699
 
 
700
 
  tmp_image = create_new_image (_("Temporary"), src_width, src_height,
701
 
                                GIMP_RGB_IMAGE,
702
 
                                &tmp_layer, &tmp_drawable, &tmp_pixel_rgn);
703
 
 
704
 
  src = g_new (guchar, src_width * tile_height * src_drawable->bpp);
705
 
  tmp = g_new (guchar, src_width * tile_height * tmp_drawable->bpp);
706
 
 
707
 
  gimp_pixel_rgn_init (&src_pixel_rgn, src_drawable, src_x0, src_y0,
708
 
                       src_width, src_height, FALSE, FALSE);
709
 
 
710
 
  i = 0;
711
 
  while (i < src_height)
712
 
    {
713
 
      scan_lines = (i+tile_height-1 < src_height) ? tile_height : (src_height-i);
714
 
      numpix = scan_lines*src_width;
715
 
 
716
 
      /* Get part of source image */
717
 
      gimp_pixel_rgn_get_rect (&src_pixel_rgn, src, src_x0, src_y0+i,
718
 
                               src_width, scan_lines);
719
 
 
720
 
      convert_to_rgb (src_drawable, numpix, src, tmp);
721
 
 
722
 
      /* Set part of temporary image */
723
 
      gimp_pixel_rgn_set_rect (&tmp_pixel_rgn, tmp, 0, i, src_width, scan_lines);
724
 
 
725
 
      i += scan_lines;
726
 
    }
727
 
 
728
 
  /* Now we have an image that is a copy of the */
729
 
  /* source region and has been converted to RGB. */
730
 
  /* We dont need any more access to the source image. */
731
 
  gimp_drawable_detach (src_drawable);
732
 
  g_free (src);
733
 
 
734
 
  /*** Resize the temporary image if necessary ***/
735
 
  if ((src_width != dst_width) || (src_height != dst_height))
736
 
    {
737
 
      gimp_drawable_detach (tmp_drawable);
738
 
 
739
 
      gimp_layer_scale (tmp_layer, dst_width, dst_height, 0);
740
 
 
741
 
      tmp_drawable = gimp_drawable_get (tmp_layer);
742
 
    }
743
 
 
744
 
  /*** Copy temporary image to destination image */
745
 
  gimp_pixel_rgn_init (&tmp_pixel_rgn, tmp_drawable, 0, 0,
746
 
                       dst_width, dst_height, FALSE, FALSE);
747
 
  g_free (tmp);
748
 
 
749
 
  tmp = g_new (guchar, dst_width * tile_height * tmp_drawable->bpp);
750
 
 
751
 
  dst_drawable = gimp_drawable_get (dst_layer);
752
 
  gimp_pixel_rgn_init (&dst_pixel_rgn, dst_drawable, dst_x0, dst_y0,
753
 
                       dst_width, dst_height, TRUE, FALSE);
754
 
  i = 0;
755
 
  while (i < dst_height)
756
 
    {
757
 
      scan_lines = (i+tile_height-1 < dst_height) ? tile_height : (dst_height-i);
758
 
 
759
 
      /* Get strip of temporary image */
760
 
      gimp_pixel_rgn_get_rect (&tmp_pixel_rgn, tmp, 0, i,
761
 
                               dst_width, scan_lines);
762
 
 
763
 
      /* Set strip of destination image */
764
 
      gimp_pixel_rgn_set_rect (&dst_pixel_rgn, tmp, dst_x0, dst_y0+i,
765
 
                               dst_width, scan_lines);
766
 
      i += scan_lines;
767
 
    }
768
 
 
769
 
  /* No more access to the temporary image */
770
 
  gimp_drawable_detach (tmp_drawable);
771
 
  g_free (tmp);
772
 
  gimp_image_delete (tmp_image);
773
 
 
774
 
  gimp_drawable_detach (dst_drawable);
775
 
 
776
 
  return TRUE;
777
 
}
778
 
 
779
577
/* Create the RGB-pixels that make up the hole */
780
578
static guchar *
781
579
create_hole_rgb (gint width,
782
 
                 gint height)
 
580
                 gint height)
783
581
{
784
582
  guchar *hole, *top, *bottom;
785
 
  gint radius, length, k;
 
583
  gint    radius, length, k;
786
584
 
787
585
  hole = g_new (guchar, width * height * 3);
788
586
 
795
593
  bottom = hole + (height-1)*width*3;
796
594
  for (k = radius-1; k > 0; k--)  /* Rounding corners */
797
595
    {
798
 
      length = (int)(radius - sqrt ((gdouble) (radius * radius - k * k)) - 0.5);
 
596
      length = (int)(radius - sqrt ((gdouble) (radius * radius - k * k))
 
597
                     - 0.5);
799
598
      if (length > 0)
800
 
        {
801
 
          set_pixels (length, top, &filmvals.film_color);
802
 
          set_pixels (length, top + (width-length)*3, &filmvals.film_color);
803
 
          set_pixels (length, bottom, &filmvals.film_color);
804
 
          set_pixels (length, bottom + (width-length)*3, &filmvals.film_color);
805
 
        }
 
599
        {
 
600
          set_pixels (length, top, &filmvals.film_color);
 
601
          set_pixels (length, top + (width-length)*3, &filmvals.film_color);
 
602
          set_pixels (length, bottom, &filmvals.film_color);
 
603
          set_pixels (length, bottom + (width-length)*3, &filmvals.film_color);
 
604
        }
806
605
      top += width*3;
807
606
      bottom -= width*3;
808
607
    }
819
618
               gint          height,
820
619
               guchar       *hole)
821
620
{
822
 
  GimpPixelRgn rgn;
823
 
  guchar *data;
824
 
  gint tile_height = gimp_tile_height ();
825
 
  gint i, j, scan_lines, d_width = gimp_drawable_width (drw->drawable_id);
826
 
  gint length;
 
621
  GimpPixelRgn    rgn;
 
622
  guchar         *data;
 
623
  gint            tile_height = gimp_tile_height ();
 
624
  gint            i, j, scan_lines;
 
625
  gint            d_width = gimp_drawable_width (drw->drawable_id);
 
626
  gint            length;
827
627
 
828
628
  if ((width <= 0) || (height <= 0))
829
629
    return;
842
642
    {
843
643
      scan_lines = (i+tile_height-1 < height) ? tile_height : (height-i);
844
644
      if (length == width)
845
 
        {
846
 
          memcpy (data, hole + 3*width*i, width*scan_lines*3);
847
 
        }
 
645
        {
 
646
          memcpy (data, hole + 3*width*i, width*scan_lines*3);
 
647
        }
848
648
      else  /* We have to do some clipping */
849
 
        {
850
 
          for (j = 0; j < scan_lines; j++)
851
 
            memcpy (data + j*length*3, hole + (i+j)*width*3, length*3);
852
 
        }
 
649
        {
 
650
          for (j = 0; j < scan_lines; j++)
 
651
            memcpy (data + j*length*3, hole + (i+j)*width*3, length*3);
 
652
        }
853
653
      gimp_pixel_rgn_set_rect (&rgn, data, x, y+i, length, scan_lines);
854
654
 
855
655
      i += scan_lines;
866
666
             gint   y,
867
667
             gint   height)
868
668
{
869
 
  gchar buf[32];
 
669
  gchar         buf[32];
870
670
  GimpDrawable *drw;
871
 
  gint k, delta, max_delta;
872
 
  gint32 image_ID;
873
 
  gint32 text_layer_ID;
874
 
  gint   text_width, text_height, text_ascent, descent;
875
 
  gchar *fontname = filmvals.number_font;
 
671
  gint          k, delta, max_delta;
 
672
  gint32        image_ID;
 
673
  gint32        text_layer_ID;
 
674
  gint          text_width, text_height, text_ascent, descent;
 
675
  gchar        *fontname = filmvals.number_font;
876
676
 
877
677
  g_snprintf (buf, sizeof (buf), "%d", num);
878
678
 
892
692
      delta = (k+1) / 2;
893
693
 
894
694
      if ((k & 1) == 0)
895
 
        delta = -delta;
 
695
        delta = -delta;
896
696
 
897
697
      success = gimp_text_get_extents_fontname (buf,
898
 
                                                height + delta, GIMP_PIXELS,
899
 
                                                fontname,
900
 
                                                &text_width, &text_height,
901
 
                                                &text_ascent, &descent);
 
698
                                                height + delta, GIMP_PIXELS,
 
699
                                                fontname,
 
700
                                                &text_width, &text_height,
 
701
                                                &text_ascent, &descent);
902
702
 
903
703
      if (success)
904
 
        {
905
 
          height += delta;
906
 
          break;
907
 
        }
 
704
        {
 
705
          height += delta;
 
706
          break;
 
707
        }
908
708
    }
909
709
 
910
710
  text_layer_ID = gimp_text_fontname (image_ID, layer_ID,
911
 
                                      x, y + descent / 2,
912
 
                                      buf, 1, FALSE,
913
 
                                      height, GIMP_PIXELS,
914
 
                                      fontname);
 
711
                                      x, y + descent / 2,
 
712
                                      buf, 1, FALSE,
 
713
                                      height, GIMP_PIXELS,
 
714
                                      fontname);
915
715
 
916
716
  if (text_layer_ID == -1)
917
717
    g_message ("draw_number: Error in drawing text\n");
944
744
 
945
745
  gimp_image_undo_disable (image_ID);
946
746
  *layer_ID = gimp_layer_new (image_ID, _("Background"), width, height,
947
 
                              gdtype, 100, GIMP_NORMAL_MODE);
 
747
                              gdtype, 100, GIMP_NORMAL_MODE);
948
748
  gimp_image_add_layer (image_ID, *layer_ID, 0);
949
749
 
950
750
  if (drawable)
951
751
    {
952
752
      *drawable = gimp_drawable_get (*layer_ID);
953
753
      if (pixel_rgn != NULL)
954
 
        gimp_pixel_rgn_init (pixel_rgn, *drawable, 0, 0, (*drawable)->width,
955
 
                             (*drawable)->height, TRUE, FALSE);
 
754
        gimp_pixel_rgn_init (pixel_rgn, *drawable, 0, 0, (*drawable)->width,
 
755
                             (*drawable)->height, TRUE, FALSE);
956
756
    }
957
757
 
958
758
  return image_ID;
991
791
 
992
792
      if (gtk_tree_model_get_iter (model, &iter, list->data))
993
793
        {
994
 
          gint32  image_ID;
 
794
          gint32  image_ID;
995
795
          gchar  *name;
996
796
 
997
797
          gtk_tree_model_get (model, &iter,
1009
809
                              -1);
1010
810
 
1011
811
          g_free (name);
1012
 
        }
 
812
        }
1013
813
 
1014
814
      gtk_tree_path_free (list->data);
1015
815
    }
1076
876
  gtk_widget_show (vbox);
1077
877
 
1078
878
  label = gtk_label_new (add_box_flag ?
1079
 
                         _("Available Images:") :
1080
 
                         _("On Film:"));
 
879
                         _("Available images:") :
 
880
                         _("On film:"));
1081
881
  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
1082
882
  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
1083
883
  gtk_widget_show (label);
1143
943
 
1144
944
static void
1145
945
create_selection_tab (GtkWidget *notebook,
1146
 
                      gint32     image_ID)
 
946
                      gint32     image_ID)
1147
947
{
1148
948
  GtkSizeGroup *group;
1149
949
  GtkWidget    *vbox;
1156
956
  GtkWidget    *spinbutton;
1157
957
  GtkObject    *adj;
1158
958
  GtkWidget    *button;
1159
 
  GtkWidget    *font_sel;
 
959
  GtkWidget    *font_button;
1160
960
  gint32       *image_id_list;
1161
961
  gint          nimages, j;
1162
962
 
1173
973
  group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
1174
974
 
1175
975
  /* Film height/colour */
1176
 
  frame = gimp_frame_new (_("Film"));
 
976
  frame = gimp_frame_new (_("Filmstrip"));
1177
977
  gtk_box_pack_start (GTK_BOX (vbox2), frame, FALSE, FALSE, 0);
1178
978
  gtk_widget_show (frame);
1179
979
 
1198
998
 
1199
999
  /* Film height */
1200
1000
  spinbutton = gimp_spin_button_new (&adj, filmvals.film_height, 10,
1201
 
                                     GIMP_MAX_IMAGE_SIZE, 1, 10, 0, 1, 0);
 
1001
                                     GIMP_MAX_IMAGE_SIZE, 1, 10, 0, 1, 0);
1202
1002
  label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
1203
1003
                                     _("_Height:"), 0.0, 0.5,
1204
1004
                                     spinbutton, 1, TRUE);
1205
1005
  gtk_size_group_add_widget (group, label);
1206
1006
  g_object_unref (group);
1207
1007
 
1208
 
  g_signal_connect (adj, "value_changed",
 
1008
  g_signal_connect (adj, "value-changed",
1209
1009
                    G_CALLBACK (gimp_int_adjustment_update),
1210
1010
                    &filmvals.film_height);
1211
1011
 
1215
1015
     /* FIXME: eeeeeek */
1216
1016
     g_list_nth_data (gtk_container_get_children (GTK_CONTAINER (table)), 1));
1217
1017
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
1218
 
                                filmvals.keep_height);
 
1018
                                filmvals.keep_height);
1219
1019
 
1220
1020
  /* Film color */
1221
1021
  button = gimp_color_button_new (_("Select Film Color"),
1222
 
                                  COLOR_BUTTON_WIDTH, COLOR_BUTTON_HEIGHT,
1223
 
                                  &filmvals.film_color,
1224
 
                                  GIMP_COLOR_AREA_FLAT);
 
1022
                                  COLOR_BUTTON_WIDTH, COLOR_BUTTON_HEIGHT,
 
1023
                                  &filmvals.film_color,
 
1024
                                  GIMP_COLOR_AREA_FLAT);
1225
1025
  label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
1226
1026
                                     _("Co_lor:"), 0.0, 0.5,
1227
1027
                                     button, 1, FALSE);
1228
1028
  gtk_size_group_add_widget (group, label);
1229
1029
 
1230
 
  g_signal_connect (button, "color_changed",
 
1030
  g_signal_connect (button, "color-changed",
1231
1031
                    G_CALLBACK (gimp_color_button_get_color),
1232
1032
                    &filmvals.film_color);
1233
1033
 
1248
1048
 
1249
1049
  /* Startindex */
1250
1050
  spinbutton = gimp_spin_button_new (&adj, filmvals.number_start, 0,
1251
 
                                     GIMP_MAX_IMAGE_SIZE, 1, 10, 0, 1, 0);
 
1051
                                     GIMP_MAX_IMAGE_SIZE, 1, 10, 0, 1, 0);
1252
1052
  label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
1253
1053
                                     _("Start _index:"), 0.0, 0.5,
1254
1054
                                     spinbutton, 1, TRUE);
1255
1055
  gtk_size_group_add_widget (group, label);
1256
1056
 
1257
 
  g_signal_connect (adj, "value_changed",
 
1057
  g_signal_connect (adj, "value-changed",
1258
1058
                    G_CALLBACK (gimp_int_adjustment_update),
1259
1059
                    &filmvals.number_start);
1260
1060
 
1261
1061
  /* Fontfamily for numbering */
1262
 
  font_sel = gimp_font_select_widget_new (NULL,
1263
 
                                          filmvals.number_font,
1264
 
                                          film_font_select_callback,
1265
 
                                          &filmvals);
 
1062
  font_button = gimp_font_select_button_new (NULL, filmvals.number_font);
 
1063
  g_signal_connect (font_button, "font-set",
 
1064
                    G_CALLBACK (film_font_select_callback), &filmvals);
1266
1065
  label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
1267
1066
                                     _("_Font:"), 0.0, 0.5,
1268
 
                                     font_sel, 1, FALSE);
 
1067
                                     font_button, 1, FALSE);
1269
1068
  gtk_size_group_add_widget (group, label);
1270
1069
 
1271
1070
  /* Numbering color */
1272
1071
  button = gimp_color_button_new (_("Select Number Color"),
1273
 
                                  COLOR_BUTTON_WIDTH, COLOR_BUTTON_HEIGHT,
1274
 
                                  &filmvals.number_color,
1275
 
                                  GIMP_COLOR_AREA_FLAT);
 
1072
                                  COLOR_BUTTON_WIDTH, COLOR_BUTTON_HEIGHT,
 
1073
                                  &filmvals.number_color,
 
1074
                                  GIMP_COLOR_AREA_FLAT);
1276
1075
  label = gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
1277
1076
                                     _("Co_lor:"), 0.0, 0.5,
1278
1077
                                     button, 1, FALSE);
1279
1078
  gtk_size_group_add_widget (group, label);
1280
1079
 
1281
 
  g_signal_connect (button, "color_changed",
 
1080
  g_signal_connect (button, "color-changed",
1282
1081
                    G_CALLBACK (gimp_color_button_get_color),
1283
1082
                    &filmvals.number_color);
1284
1083
 
1288
1087
                                                   : _("At _top"));
1289
1088
      gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
1290
1089
      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
1291
 
                                    filmvals.number_pos[j]);
 
1090
                                    filmvals.number_pos[j]);
1292
1091
      gtk_widget_show (toggle);
1293
1092
 
1294
1093
      g_signal_connect (toggle, "toggled",
1326
1125
  GtkWidget *button;
1327
1126
  gint       row;
1328
1127
 
1329
 
  frame = gimp_frame_new (_("All Values are Fractions of the Film Height"));
 
1128
  frame = gimp_frame_new (_("All Values are Fractions of the Strip Height"));
1330
1129
  gtk_container_set_border_width (GTK_CONTAINER (frame), 12);
1331
1130
  gtk_notebook_append_page (GTK_NOTEBOOK (notebook), frame,
1332
1131
                            gtk_label_new_with_mnemonic (_("Ad_vanced")));
1348
1147
 
1349
1148
  filmint.advanced_adj[0] = adj =
1350
1149
    gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
1351
 
                          _("Image _height:"), 0, 0,
1352
 
                          filmvals.picture_height,
1353
 
                          0.0, 1.0, 0.001, 0.01, 3,
1354
 
                          TRUE, 0, 0,
1355
 
                          NULL, NULL);
1356
 
  g_signal_connect (adj, "value_changed",
 
1150
                          _("Image _height:"), 0, 0,
 
1151
                          filmvals.picture_height,
 
1152
                          0.0, 1.0, 0.001, 0.01, 3,
 
1153
                          TRUE, 0, 0,
 
1154
                          NULL, NULL);
 
1155
  g_signal_connect (adj, "value-changed",
1357
1156
                    G_CALLBACK (gimp_double_adjustment_update),
1358
1157
                    &filmvals.picture_height);
1359
1158
 
1360
1159
  filmint.advanced_adj[1] = adj =
1361
1160
    gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
1362
 
                          _("Image spac_ing:"), 0, 0,
1363
 
                          filmvals.picture_space,
1364
 
                          0.0, 1.0, 0.001, 0.01, 3,
1365
 
                          TRUE, 0, 0,
1366
 
                          NULL, NULL);
1367
 
  g_signal_connect (adj, "value_changed",
 
1161
                          _("Image spac_ing:"), 0, 0,
 
1162
                          filmvals.picture_space,
 
1163
                          0.0, 1.0, 0.001, 0.01, 3,
 
1164
                          TRUE, 0, 0,
 
1165
                          NULL, NULL);
 
1166
  g_signal_connect (adj, "value-changed",
1368
1167
                    G_CALLBACK (gimp_double_adjustment_update),
1369
1168
                    &filmvals.picture_space);
1370
1169
 
1371
1170
  filmint.advanced_adj[2] = adj =
1372
1171
    gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
1373
 
                          _("_Hole offset:"), 0, 0,
1374
 
                          filmvals.hole_offset,
1375
 
                          0.0, 1.0, 0.001, 0.01, 3,
1376
 
                          TRUE, 0, 0,
1377
 
                          NULL, NULL);
1378
 
  g_signal_connect (adj, "value_changed",
 
1172
                          _("_Hole offset:"), 0, 0,
 
1173
                          filmvals.hole_offset,
 
1174
                          0.0, 1.0, 0.001, 0.01, 3,
 
1175
                          TRUE, 0, 0,
 
1176
                          NULL, NULL);
 
1177
  g_signal_connect (adj, "value-changed",
1379
1178
                    G_CALLBACK (gimp_double_adjustment_update),
1380
1179
                    &filmvals.hole_offset);
1381
1180
 
1382
1181
  filmint.advanced_adj[3] = adj =
1383
1182
    gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
1384
 
                          _("Ho_le width:"), 0, 0,
1385
 
                          filmvals.hole_width,
1386
 
                          0.0, 1.0, 0.001, 0.01, 3,
1387
 
                          TRUE, 0, 0,
1388
 
                          NULL, NULL);
1389
 
  g_signal_connect (adj, "value_changed",
 
1183
                          _("Ho_le width:"), 0, 0,
 
1184
                          filmvals.hole_width,
 
1185
                          0.0, 1.0, 0.001, 0.01, 3,
 
1186
                          TRUE, 0, 0,
 
1187
                          NULL, NULL);
 
1188
  g_signal_connect (adj, "value-changed",
1390
1189
                    G_CALLBACK (gimp_double_adjustment_update),
1391
1190
                    &filmvals.hole_width);
1392
1191
 
1393
1192
  filmint.advanced_adj[4] = adj =
1394
1193
    gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
1395
 
                          _("Hol_e height:"), 0, 0,
1396
 
                          filmvals.hole_height,
1397
 
                          0.0, 1.0, 0.001, 0.01, 3,
1398
 
                          TRUE, 0, 0,
1399
 
                          NULL, NULL);
1400
 
  g_signal_connect (adj, "value_changed",
 
1194
                          _("Hol_e height:"), 0, 0,
 
1195
                          filmvals.hole_height,
 
1196
                          0.0, 1.0, 0.001, 0.01, 3,
 
1197
                          TRUE, 0, 0,
 
1198
                          NULL, NULL);
 
1199
  g_signal_connect (adj, "value-changed",
1401
1200
                    G_CALLBACK (gimp_double_adjustment_update),
1402
1201
                    &filmvals.hole_height);
1403
1202
 
1404
1203
  filmint.advanced_adj[5] = adj =
1405
1204
    gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
1406
 
                          _("Hole sp_acing:"), 0, 0,
1407
 
                          filmvals.hole_space,
1408
 
                          0.0, 1.0, 0.001, 0.01, 3,
1409
 
                          TRUE, 0, 0,
1410
 
                          NULL, NULL);
1411
 
  g_signal_connect (adj, "value_changed",
 
1205
                          _("Hole sp_acing:"), 0, 0,
 
1206
                          filmvals.hole_space,
 
1207
                          0.0, 1.0, 0.001, 0.01, 3,
 
1208
                          TRUE, 0, 0,
 
1209
                          NULL, NULL);
 
1210
  g_signal_connect (adj, "value-changed",
1412
1211
                    G_CALLBACK (gimp_double_adjustment_update),
1413
1212
                    &filmvals.hole_space);
1414
1213
 
1415
1214
  filmint.advanced_adj[6] = adj =
1416
1215
    gimp_scale_entry_new (GTK_TABLE (table), 0, row++,
1417
 
                          _("_Number height:"), 0, 0,
1418
 
                          filmvals.number_height,
1419
 
                          0.0, 1.0, 0.001, 0.01, 3,
1420
 
                          TRUE, 0, 0,
1421
 
                          NULL, NULL);
1422
 
  g_signal_connect (adj, "value_changed",
 
1216
                          _("_Number height:"), 0, 0,
 
1217
                          filmvals.number_height,
 
1218
                          0.0, 1.0, 0.001, 0.01, 3,
 
1219
                          TRUE, 0, 0,
 
1220
                          NULL, NULL);
 
1221
  g_signal_connect (adj, "value-changed",
1423
1222
                    G_CALLBACK (gimp_double_adjustment_update),
1424
1223
                    &filmvals.number_height);
1425
1224
 
1444
1243
  GtkWidget *notebook;
1445
1244
  gboolean   run;
1446
1245
 
1447
 
  gimp_ui_init ("film", TRUE);
 
1246
  gimp_ui_init (PLUG_IN_BINARY, TRUE);
1448
1247
 
1449
 
  dlg = gimp_dialog_new (_("Film"), "film",
 
1248
  dlg = gimp_dialog_new (_("Filmstrip"), PLUG_IN_BINARY,
1450
1249
                         NULL, 0,
1451
 
                         gimp_standard_help_func, "plug-in-film",
1452
 
 
1453
 
                         GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
1454
 
                         GTK_STOCK_OK,     GTK_RESPONSE_OK,
1455
 
 
1456
 
                         NULL);
 
1250
                         gimp_standard_help_func, PLUG_IN_PROC,
 
1251
 
 
1252
                         GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 
1253
                         GTK_STOCK_OK,     GTK_RESPONSE_OK,
 
1254
 
 
1255
                         NULL);
 
1256
 
 
1257
  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dlg),
 
1258
                                           GTK_RESPONSE_OK,
 
1259
                                           GTK_RESPONSE_CANCEL,
 
1260
                                           -1);
 
1261
 
 
1262
  gimp_window_set_transient (GTK_WINDOW (dlg));
1457
1263
 
1458
1264
  main_vbox = gtk_vbox_new (FALSE, 12);
1459
1265
  gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
1504
1310
 
1505
1311
static void
1506
1312
film_reset_callback (GtkWidget *widget,
1507
 
                     gpointer   data)
 
1313
                     gpointer   data)
1508
1314
{
1509
1315
  gint i;
1510
1316
 
1511
1317
  for (i = 0; i < G_N_ELEMENTS (advanced_defaults) ; i++)
1512
1318
    gtk_adjustment_set_value (GTK_ADJUSTMENT (filmint.advanced_adj[i]),
1513
 
                              advanced_defaults[i]);
 
1319
                              advanced_defaults[i]);
1514
1320
}
1515
1321
 
1516
1322
static void
1517
 
film_font_select_callback (const gchar *name,
1518
 
                           gboolean     closing,
1519
 
                           gpointer     data)
 
1323
film_font_select_callback (GimpFontSelectButton *button,
 
1324
                           const gchar          *name,
 
1325
                           gboolean              closing,
 
1326
                           gpointer              data)
1520
1327
{
1521
1328
  FilmVals *vals = (FilmVals *) data;
1522
1329