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

« back to all changes in this revision

Viewing changes to plug-ins/common/blinds.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:
34
34
 
35
35
#include <string.h>
36
36
 
37
 
#include <gtk/gtk.h>
38
 
 
39
37
#include <libgimp/gimp.h>
40
38
#include <libgimp/gimpui.h>
41
39
 
43
41
 
44
42
/***** Magic numbers *****/
45
43
 
46
 
#define SCALE_WIDTH  150
47
 
 
48
 
#define MAX_FANS      10
49
 
 
50
 
#define HORIZONTAL     0
51
 
#define VERTICAL       1
 
44
#define PLUG_IN_PROC   "plug-in-blinds"
 
45
#define PLUG_IN_BINARY "blinds"
 
46
 
 
47
#define SCALE_WIDTH    150
 
48
 
 
49
#define MAX_FANS        10
 
50
 
 
51
#define HORIZONTAL       0
 
52
#define VERTICAL         1
52
53
 
53
54
/* Variables set in dialog box */
54
55
typedef struct data
57
58
  gint     numsegs;
58
59
  gint     orientation;
59
60
  gboolean bg_trans;
60
 
  gboolean preview;
61
61
} BlindVals;
62
62
 
63
63
/* Array to hold each size of fans. And no there are not each the
79
79
                                        GimpPreview   *preview);
80
80
static void      apply_blinds          (GimpDrawable  *drawable);
81
81
 
82
 
GimpPlugInInfo PLUG_IN_INFO =
 
82
const GimpPlugInInfo PLUG_IN_INFO =
83
83
{
84
84
  NULL,    /* init_proc */
85
85
  NULL,    /* quit_proc */
93
93
  30,
94
94
  3,
95
95
  HORIZONTAL, /* orientation */
96
 
  FALSE,
97
 
  TRUE        /* preview     */
 
96
  FALSE
98
97
};
99
98
 
100
99
MAIN ()
102
101
static void
103
102
query (void)
104
103
{
105
 
  static GimpParamDef args[] =
 
104
  static const GimpParamDef args[] =
106
105
  {
107
 
    { GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
108
 
    { GIMP_PDB_IMAGE, "image", "Input image (unused)" },
109
 
    { GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
110
 
    { GIMP_PDB_INT32, "angle_dsp", "Angle of Displacement " },
111
 
    { GIMP_PDB_INT32, "number_of_segments", "Number of segments in blinds" },
112
 
    { GIMP_PDB_INT32, "orientation", "orientation; 0 = Horizontal, 1 = Vertical" },
113
 
    { GIMP_PDB_INT32, "backgndg_trans", "background transparent; FALSE,TRUE" }
 
106
    { GIMP_PDB_INT32,    "run-mode",       "Interactive, non-interactive" },
 
107
    { GIMP_PDB_IMAGE,    "image",          "Input image (unused)" },
 
108
    { GIMP_PDB_DRAWABLE, "drawable",       "Input drawable" },
 
109
    { GIMP_PDB_INT32,    "angle-dsp",      "Angle of Displacement " },
 
110
    { GIMP_PDB_INT32,    "num-segments",   "Number of segments in blinds" },
 
111
    { GIMP_PDB_INT32,    "orientation",    "orientation; 0 = Horizontal, 1 = Vertical" },
 
112
    { GIMP_PDB_INT32,    "bg-transparent", "background transparent; FALSE,TRUE" }
114
113
  };
115
114
 
116
 
  gimp_install_procedure ("plug_in_blinds",
117
 
                          "Adds a blinds effect to the image. Rather like "
118
 
                          "putting the image on a set of window blinds and "
119
 
                          "the closing or opening the blinds",
 
115
  gimp_install_procedure (PLUG_IN_PROC,
 
116
                          N_("Simulate an image painted on window blinds"),
120
117
                          "More here later",
121
118
                          "Andy Thomas",
122
119
                          "Andy Thomas",
127
124
                          G_N_ELEMENTS (args), 0,
128
125
                          args, NULL);
129
126
 
130
 
  gimp_plugin_menu_register ("plug_in_blinds", "<Image>/Filters/Distorts");
 
127
  gimp_plugin_menu_register (PLUG_IN_PROC, "<Image>/Filters/Distorts");
131
128
}
132
129
 
133
130
static void
157
154
  switch (run_mode)
158
155
    {
159
156
    case GIMP_RUN_INTERACTIVE:
160
 
      gimp_get_data ("plug_in_blinds", &bvals);
 
157
      gimp_get_data (PLUG_IN_PROC, &bvals);
161
158
      if (! blinds_dialog(drawable))
162
159
        {
163
160
          gimp_drawable_detach (drawable);
178
175
      break;
179
176
 
180
177
    case GIMP_RUN_WITH_LAST_VALS:
181
 
      gimp_get_data ("plug_in_blinds", &bvals);
 
178
      gimp_get_data (PLUG_IN_PROC, &bvals);
182
179
      break;
183
180
 
184
181
    default:
188
185
  if (gimp_drawable_is_rgb (drawable->drawable_id) ||
189
186
      gimp_drawable_is_gray (drawable->drawable_id))
190
187
    {
191
 
      gimp_progress_init ( _("Adding Blinds..."));
 
188
      gimp_progress_init ( _("Adding blinds"));
192
189
 
193
190
      apply_blinds (drawable);
194
191
 
196
193
        gimp_displays_flush ();
197
194
 
198
195
      if (run_mode == GIMP_RUN_INTERACTIVE)
199
 
        gimp_set_data ("plug_in_blinds", &bvals, sizeof (BlindVals));
 
196
        gimp_set_data (PLUG_IN_PROC, &bvals, sizeof (BlindVals));
200
197
    }
201
198
  else
202
199
    {
224
221
  GtkWidget *vertical;
225
222
  gboolean   run;
226
223
 
227
 
  gimp_ui_init ("blinds", TRUE);
 
224
  gimp_ui_init (PLUG_IN_BINARY, TRUE);
228
225
 
229
 
  dialog = gimp_dialog_new (_("Blinds"), "blinds",
 
226
  dialog = gimp_dialog_new (_("Blinds"), PLUG_IN_BINARY,
230
227
                            NULL, 0,
231
 
                            gimp_standard_help_func, "plug-in-blinds",
 
228
                            gimp_standard_help_func, PLUG_IN_PROC,
232
229
 
233
230
                            GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
234
231
                            GTK_STOCK_OK,     GTK_RESPONSE_OK,
235
232
 
236
233
                            NULL);
237
234
 
 
235
  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
 
236
                                           GTK_RESPONSE_OK,
 
237
                                           GTK_RESPONSE_CANCEL,
 
238
                                           -1);
 
239
 
 
240
  gimp_window_set_transient (GTK_WINDOW (dialog));
 
241
 
238
242
  main_vbox = gtk_vbox_new (FALSE, 12);
239
243
  gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
240
244
  gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), main_vbox);
241
245
  gtk_widget_show (main_vbox);
242
246
 
243
 
  preview = gimp_aspect_preview_new (drawable, &bvals.preview);
 
247
  preview = gimp_aspect_preview_new (drawable, NULL);
244
248
  gtk_box_pack_start_defaults (GTK_BOX (main_vbox), preview);
245
249
  gtk_widget_show (preview);
246
250
  g_signal_connect_swapped (preview, "invalidated",
304
308
                                    bvals.angledsp, 1, 90, 1, 15, 0,
305
309
                                    TRUE, 0, 0,
306
310
                                    NULL, NULL);
307
 
  g_signal_connect (size_data, "value_changed",
 
311
  g_signal_connect (size_data, "value-changed",
308
312
                    G_CALLBACK (gimp_int_adjustment_update),
309
313
                    &bvals.angledsp);
310
 
  g_signal_connect_swapped (size_data, "value_changed",
 
314
  g_signal_connect_swapped (size_data, "value-changed",
311
315
                            G_CALLBACK (gimp_preview_invalidate),
312
316
                            preview);
313
317
 
316
320
                                    bvals.numsegs, 1, MAX_FANS, 1, 2, 0,
317
321
                                    TRUE, 0, 0,
318
322
                                    NULL, NULL);
319
 
  g_signal_connect (size_data, "value_changed",
 
323
  g_signal_connect (size_data, "value-changed",
320
324
                    G_CALLBACK (gimp_int_adjustment_update),
321
325
                    &bvals.numsegs);
322
 
  g_signal_connect_swapped (size_data, "value_changed",
 
326
  g_signal_connect_swapped (size_data, "value-changed",
323
327
                            G_CALLBACK (gimp_preview_invalidate),
324
328
                            preview);
325
329
 
451
455
  bpp = gimp_drawable_bpp (drawable->drawable_id);
452
456
  cache = gimp_drawable_get_thumbnail_data (drawable->drawable_id,
453
457
                                            &width, &height, &bpp);
454
 
 
455
458
  p = cache;
456
459
 
457
460
  gimp_context_get_background (&background);
710
713
  gimp_drawable_merge_shadow (drawable->drawable_id, TRUE);
711
714
  gimp_drawable_update (drawable->drawable_id,
712
715
                        sel_x1, sel_y1, sel_width, sel_height);
713
 
 
714
716
}