~ubuntu-branches/ubuntu/karmic/gimp/karmic-security

« back to all changes in this revision

Viewing changes to app/actions/drawable-commands.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2008-10-06 13:30:41 UTC
  • mfrom: (1.1.15 upstream)
  • Revision ID: james.westby@ubuntu.com-20081006133041-axco233xt49jobn7
Tags: 2.6.0-1ubuntu1
* Sync on debian and new version (lp: #276839)
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch:
  - updated some strings for ubuntu
* debian/rules:
  - updated translation templates

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
#include "core/gimpitem-linked.h"
35
35
#include "core/gimpitemundo.h"
36
36
#include "core/gimplayermask.h"
 
37
#include "core/gimpprogress.h"
37
38
 
38
 
#include "dialogs/desaturate-dialog.h"
39
39
#include "dialogs/offset-dialog.h"
40
40
 
41
41
#include "actions.h"
44
44
#include "gimp-intl.h"
45
45
 
46
46
 
47
 
/*  local function prototypes  */
48
 
 
49
 
static void   desaturate_response (GtkWidget        *widget,
50
 
                                   gint              response_id,
51
 
                                   DesaturateDialog *dialog);
52
 
 
53
 
 
54
 
/*  private variables  */
55
 
 
56
 
static GimpDesaturateMode  desaturate_mode = GIMP_DESATURATE_LIGHTNESS;
57
 
 
58
 
 
59
47
/*  public functions  */
60
48
 
61
49
void
62
 
drawable_desaturate_cmd_callback (GtkAction *action,
63
 
                                  gpointer   data)
64
 
{
65
 
  DesaturateDialog *dialog;
66
 
  GimpImage        *image;
67
 
  GimpDrawable     *drawable;
68
 
  GtkWidget        *widget;
69
 
  return_if_no_drawable (image, drawable, data);
70
 
  return_if_no_widget (widget, data);
71
 
 
72
 
  if (! gimp_drawable_is_rgb (drawable))
73
 
    {
74
 
      gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING,
75
 
                    _("Desaturate operates only on RGB color layers."));
76
 
      return;
77
 
    }
78
 
 
79
 
  dialog = desaturate_dialog_new (drawable,
80
 
                                  action_data_get_context (data),
81
 
                                  widget, desaturate_mode);
82
 
 
83
 
  g_signal_connect (dialog->dialog, "response",
84
 
                    G_CALLBACK (desaturate_response),
85
 
                    dialog);
86
 
 
87
 
  gtk_widget_show (dialog->dialog);
88
 
}
89
 
 
90
 
void
91
50
drawable_equalize_cmd_callback (GtkAction *action,
92
51
                                gpointer   data)
93
52
{
114
73
{
115
74
  GimpImage    *image;
116
75
  GimpDrawable *drawable;
 
76
  GimpDisplay  *display;
117
77
  GtkWidget    *widget;
118
78
  return_if_no_drawable (image, drawable, data);
 
79
  return_if_no_display (display, data);
119
80
  return_if_no_widget (widget, data);
120
81
 
121
82
  if (gimp_drawable_is_indexed (drawable))
125
86
      return;
126
87
    }
127
88
 
128
 
  gimp_drawable_invert (drawable);
 
89
  gimp_drawable_invert (drawable, GIMP_PROGRESS (display));
129
90
  gimp_image_flush (image);
130
91
}
131
92
 
135
96
{
136
97
  GimpImage    *image;
137
98
  GimpDrawable *drawable;
138
 
  GimpContext  *context;
 
99
  GimpDisplay  *display;
139
100
  GtkWidget    *widget;
140
101
  return_if_no_drawable (image, drawable, data);
141
 
  return_if_no_context (context, data);
 
102
  return_if_no_display (display, data);
142
103
  return_if_no_widget (widget, data);
143
104
 
144
105
  if (! gimp_drawable_is_rgb (drawable))
148
109
      return;
149
110
    }
150
111
 
151
 
  gimp_drawable_levels_stretch (drawable, context);
 
112
  gimp_drawable_levels_stretch (drawable, GIMP_PROGRESS (display));
152
113
  gimp_image_flush (image);
153
114
}
154
115
 
322
283
 
323
284
  gimp_image_flush (image);
324
285
}
325
 
 
326
 
/*  private functions  */
327
 
 
328
 
static void
329
 
desaturate_response (GtkWidget        *widget,
330
 
                     gint              response_id,
331
 
                     DesaturateDialog *dialog)
332
 
{
333
 
  if (response_id == GTK_RESPONSE_OK)
334
 
    {
335
 
      GimpDrawable *drawable = dialog->drawable;
336
 
      GimpImage    *image   = gimp_item_get_image (GIMP_ITEM (drawable));
337
 
 
338
 
      /*  remember for next invocation of the dialog  */
339
 
      desaturate_mode = dialog->mode;
340
 
 
341
 
      gimp_drawable_desaturate (drawable, desaturate_mode);
342
 
 
343
 
      gimp_image_flush (image);
344
 
    }
345
 
 
346
 
  gtk_widget_destroy (dialog->dialog);
347
 
}