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

« back to all changes in this revision

Viewing changes to plug-ins/common/autocrop.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:
3
3
 * by Tim Newsome <drz@froody.bloke.com>
4
4
 */
5
5
 
6
 
/* The GIMP -- an image manipulation program
 
6
/* GIMP - The GNU Image Manipulation Program
7
7
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
8
8
 *
9
9
 * This program is free software; you can redistribute it and/or modify
30
30
#include "libgimp/stdplugins-intl.h"
31
31
 
32
32
 
 
33
#define AUTOCROP_PROC       "plug-in-autocrop"
 
34
#define AUTOCROP_LAYER_PROC "plug-in-autocrop-layer"
 
35
 
 
36
 
33
37
/* Declare local functions. */
34
38
static void      query         (void);
35
39
static void      run           (const gchar      *name,
53
57
                                gboolean      layer_only);
54
58
 
55
59
 
56
 
GimpPlugInInfo PLUG_IN_INFO =
 
60
const GimpPlugInInfo PLUG_IN_INFO =
57
61
{
58
62
  NULL,   /* init_proc  */
59
63
  NULL,   /* quit_proc  */
69
73
static void
70
74
query (void)
71
75
{
72
 
  static GimpParamDef args[] =
 
76
  static const GimpParamDef args[] =
73
77
  {
74
 
    { GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
75
 
    { GIMP_PDB_IMAGE, "image", "Input image" },
76
 
    { GIMP_PDB_DRAWABLE, "drawable", "Input drawable" }
 
78
    { GIMP_PDB_INT32,    "run-mode", "Interactive, non-interactive" },
 
79
    { GIMP_PDB_IMAGE,    "image",    "Input image"                  },
 
80
    { GIMP_PDB_DRAWABLE, "drawable", "Input drawable"               }
77
81
  };
78
82
 
79
 
  gimp_install_procedure ("plug_in_autocrop",
80
 
                          "Automagically crops an image.",
81
 
                          "",
82
 
                          "Tim Newsome",
83
 
                          "Tim Newsome",
84
 
                          "1997",
85
 
                          N_("_Autocrop Image"),
86
 
                          "RGB*, GRAY*, INDEXED*",
87
 
                          GIMP_PLUGIN,
88
 
                          G_N_ELEMENTS (args), 0,
89
 
                          args, NULL);
90
 
 
91
 
  gimp_plugin_menu_register ("plug_in_autocrop", "<Image>/Image/Crop");
92
 
 
93
 
  gimp_install_procedure ("plug_in_autocrop_layer",
94
 
                          "Automagically crops a layer.",
95
 
                          "",
96
 
                          "Tim Newsome",
97
 
                          "Tim Newsome",
98
 
                          "1997",
99
 
                          N_("_Autocrop Layer"),
100
 
                          "RGB*, GRAY*, INDEXED*",
101
 
                          GIMP_PLUGIN,
102
 
                          G_N_ELEMENTS (args), 0,
103
 
                          args, NULL);
104
 
 
105
 
  gimp_plugin_menu_register ("plug_in_autocrop_layer", "<Image>/Layer/Crop");
 
83
  gimp_install_procedure (AUTOCROP_PROC,
 
84
                          N_("Remove empty borders from the image"),
 
85
                          "",
 
86
                          "Tim Newsome",
 
87
                          "Tim Newsome",
 
88
                          "1997",
 
89
                          N_("Autocrop Imag_e"),
 
90
                          "RGB*, GRAY*, INDEXED*",
 
91
                          GIMP_PLUGIN,
 
92
                          G_N_ELEMENTS (args), 0,
 
93
                          args, NULL);
 
94
 
 
95
  gimp_plugin_menu_register (AUTOCROP_PROC, "<Image>/Image/Crop");
 
96
 
 
97
  gimp_install_procedure (AUTOCROP_LAYER_PROC,
 
98
                          N_("Remove empty borders from the layer"),
 
99
                          "",
 
100
                          "Tim Newsome",
 
101
                          "Tim Newsome",
 
102
                          "1997",
 
103
                          N_("Autocrop Lay_er"),
 
104
                          "RGB*, GRAY*, INDEXED*",
 
105
                          GIMP_PLUGIN,
 
106
                          G_N_ELEMENTS (args), 0,
 
107
                          args, NULL);
 
108
 
 
109
  gimp_plugin_menu_register (AUTOCROP_LAYER_PROC, "<Image>/Layer/Crop");
106
110
}
107
111
 
108
112
static void
141
145
  if (gimp_drawable_is_rgb (drawable->drawable_id) ||
142
146
      gimp_drawable_is_gray (drawable->drawable_id)  ||
143
147
      gimp_drawable_is_indexed (drawable->drawable_id))
144
 
  {
145
 
    if (interactive)
146
 
      gimp_progress_init (_("Cropping..."));
147
 
 
148
 
    gimp_tile_cache_ntiles (2 * (drawable->width / gimp_tile_width() + 1));
149
 
 
150
 
    autocrop (drawable, image_id, interactive,
151
 
              ! strcmp (name, "plug_in_autocrop_layer"));
152
 
 
153
 
    if (interactive)
154
 
      gimp_displays_flush ();
155
 
  }
 
148
    {
 
149
      if (interactive)
 
150
        gimp_progress_init (_("Cropping"));
 
151
 
 
152
      gimp_tile_cache_ntiles (MAX (drawable->width / gimp_tile_width (),
 
153
                                   drawable->height / gimp_tile_height ()) + 1);
 
154
 
 
155
      autocrop (drawable, image_id, interactive,
 
156
                strcmp (name, AUTOCROP_LAYER_PROC) == 0);
 
157
 
 
158
      if (interactive)
 
159
        gimp_displays_flush ();
 
160
    }
156
161
  else
157
 
  {
 
162
    {
158
163
      status = GIMP_PDB_EXECUTION_ERROR;
159
 
  }
 
164
    }
160
165
 
161
166
 out:
162
167
  values[0].type = GIMP_PDB_STATUS;