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

« back to all changes in this revision

Viewing changes to plug-ins/common/smooth_palette.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:
2
2
   smooth palette - derive smooth palette from image
3
3
   Copyright (C) 1997  Scott Draves <spot@cs.cmu.edu>
4
4
 
5
 
   The GIMP -- an image manipulation program
 
5
   GIMP - The GNU Image Manipulation Program
6
6
   Copyright (C) 1995 Spencer Kimball and Peter Mattis
7
7
 
8
8
   This program is free software; you can redistribute it and/or modify
22
22
 
23
23
#include "config.h"
24
24
 
25
 
#include <stdlib.h>
26
 
#include <stdio.h>
27
25
#include <string.h>
28
26
 
29
 
#include <gtk/gtk.h>
30
 
 
31
27
#include <libgimp/gimp.h>
32
28
#include <libgimp/gimpui.h>
33
29
 
34
30
#include "libgimp/stdplugins-intl.h"
35
31
 
36
32
 
 
33
#define PLUG_IN_PROC   "plug-in-smooth-palette"
 
34
#define PLUG_IN_BINARY "smooth_palette"
 
35
 
 
36
 
37
37
/* Declare local functions. */
38
38
static void      query          (void);
39
39
static void      run            (const gchar      *name,
48
48
                                 gint32           *layer_id);
49
49
 
50
50
 
51
 
GimpPlugInInfo PLUG_IN_INFO =
 
51
const GimpPlugInInfo PLUG_IN_INFO =
52
52
{
53
53
  NULL,  /* init_proc  */
54
54
  NULL,  /* quit_proc  */
62
62
static void
63
63
query (void)
64
64
{
65
 
  static GimpParamDef args[] =
 
65
  static const GimpParamDef args[] =
66
66
  {
67
 
    { GIMP_PDB_INT32,    "run_mode",   "Interactive, non-interactive" },
 
67
    { GIMP_PDB_INT32,    "run-mode",   "Interactive, non-interactive" },
68
68
    { GIMP_PDB_IMAGE,    "image",      "Input image (unused)"         },
69
69
    { GIMP_PDB_DRAWABLE, "drawable",   "Input drawable"               },
70
70
    { GIMP_PDB_INT32,    "width",      "Width"                        },
71
71
    { GIMP_PDB_INT32,    "height",     "Height"                       },
72
72
    { GIMP_PDB_INT32,    "ntries",     "Search Depth"                 },
73
 
    { GIMP_PDB_INT32,    "show_image", "Show Image?"                  }
 
73
    { GIMP_PDB_INT32,    "show-image", "Show Image?"                  }
74
74
  };
75
75
 
76
 
  static GimpParamDef return_vals[] =
 
76
  static const GimpParamDef return_vals[] =
77
77
  {
78
 
    { GIMP_PDB_IMAGE, "new_image", "Output image" },
79
 
    { GIMP_PDB_LAYER, "new_layer", "Output layer" }
 
78
    { GIMP_PDB_IMAGE, "new-image", "Output image" },
 
79
    { GIMP_PDB_LAYER, "new-layer", "Output layer" }
80
80
  };
81
81
 
82
 
  gimp_install_procedure ("plug_in_smooth_palette",
83
 
                          "derive smooth palette from image",
 
82
  gimp_install_procedure (PLUG_IN_PROC,
 
83
                          N_("Derive a smooth color palette from the image"),
84
84
                          "help!",
85
85
                          "Scott Draves",
86
86
                          "Scott Draves",
91
91
                          G_N_ELEMENTS (args), G_N_ELEMENTS (return_vals),
92
92
                          args, return_vals);
93
93
 
94
 
  gimp_plugin_menu_register ("plug_in_smooth_palette",
95
 
                             "<Image>/Filters/Colors");
 
94
  gimp_plugin_menu_register (PLUG_IN_PROC, "<Image>/Colors/Info");
96
95
}
97
96
 
98
97
static struct
140
139
  switch (run_mode)
141
140
    {
142
141
    case GIMP_RUN_INTERACTIVE:
143
 
      gimp_get_data ("plug_in_smooth_palette", &config);
 
142
      gimp_get_data (PLUG_IN_PROC, &config);
144
143
      if (! dialog (drawable))
145
144
        return;
146
145
      break;
166
165
 
167
166
    case GIMP_RUN_WITH_LAST_VALS:
168
167
      /*  Possibly retrieve data  */
169
 
      gimp_get_data ("plug_in_smooth_palette", &config);
 
168
      gimp_get_data (PLUG_IN_PROC, &config);
170
169
      break;
171
170
 
172
171
    default:
177
176
    {
178
177
      if (gimp_drawable_is_rgb (drawable->drawable_id))
179
178
        {
180
 
          gimp_progress_init (_("Deriving Smooth Palette..."));
 
179
          gimp_progress_init (_("Deriving smooth palette"));
181
180
 
182
181
          gimp_tile_cache_ntiles (2 * (drawable->width + 1) /
183
182
                                  gimp_tile_width ());
186
185
                                                   &values[2].data.d_layer);
187
186
 
188
187
          if (run_mode == GIMP_RUN_INTERACTIVE)
189
 
            gimp_set_data ("plug_in_smooth_palette", &config, sizeof (config));
 
188
            gimp_set_data (PLUG_IN_PROC, &config, sizeof (config));
 
189
 
190
190
          if (config.show_image)
191
191
            gimp_display_new (values[1].data.d_image);
192
192
        }
407
407
  gdouble    xres, yres;
408
408
  gboolean   run;
409
409
 
410
 
  gimp_ui_init ("smooth_palette", FALSE);
 
410
  gimp_ui_init (PLUG_IN_BINARY, FALSE);
411
411
 
412
 
  dlg = gimp_dialog_new (_("Smooth Palette"), "smooth_palette",
 
412
  dlg = gimp_dialog_new (_("Smooth Palette"), PLUG_IN_BINARY,
413
413
                         NULL, 0,
414
 
                         gimp_standard_help_func, "plug-in-smooth-palette",
 
414
                         gimp_standard_help_func, PLUG_IN_PROC,
415
415
 
416
416
                         GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
417
417
                         GTK_STOCK_OK,     GTK_RESPONSE_OK,
418
418
 
419
419
                         NULL);
420
420
 
 
421
  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dlg),
 
422
                                           GTK_RESPONSE_OK,
 
423
                                           GTK_RESPONSE_CANCEL,
 
424
                                           -1);
 
425
 
 
426
  gimp_window_set_transient (GTK_WINDOW (dlg));
 
427
 
421
428
  image_id = gimp_drawable_get_image (drawable->drawable_id);
422
429
  unit = gimp_image_get_unit (image_id);
423
430
  gimp_image_get_resolution (image_id, &xres, &yres);
444
451
  gimp_table_attach_aligned (GTK_TABLE (sizeentry), 0, 2,
445
452
                             _("_Search depth:"), 0.0, 0.5,
446
453
                             spinbutton, 1, FALSE);
447
 
  g_signal_connect (adj, "value_changed",
 
454
  g_signal_connect (adj, "value-changed",
448
455
                    G_CALLBACK (gimp_int_adjustment_update),
449
456
                    &config.ntries);
450
457
 
464
471
 
465
472
  return run;
466
473
}
467