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

« back to all changes in this revision

Viewing changes to app/paint/gimpairbrush.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
 *
4
4
 * This program is free software; you can redistribute it and/or modify
40
40
#include "gimp-intl.h"
41
41
 
42
42
 
43
 
static void       gimp_airbrush_class_init (GimpAirbrushClass *klass);
44
 
static void       gimp_airbrush_init       (GimpAirbrush      *airbrush);
45
 
 
46
 
static void       gimp_airbrush_finalize   (GObject           *object);
47
 
 
48
 
static void       gimp_airbrush_paint      (GimpPaintCore     *paint_core,
49
 
                                            GimpDrawable      *drawable,
50
 
                                            GimpPaintOptions  *paint_options,
51
 
                                            GimpPaintState     paint_state,
52
 
                                            guint32            time);
53
 
static void       gimp_airbrush_motion     (GimpPaintCore     *paint_core,
54
 
                                            GimpDrawable      *drawable,
55
 
                                            GimpPaintOptions  *paint_options);
56
 
static gboolean   gimp_airbrush_timeout    (gpointer           data);
57
 
 
58
 
 
59
 
static GimpPaintbrushClass *parent_class = NULL;
 
43
static void       gimp_airbrush_finalize (GObject          *object);
 
44
 
 
45
static void       gimp_airbrush_paint    (GimpPaintCore    *paint_core,
 
46
                                          GimpDrawable     *drawable,
 
47
                                          GimpPaintOptions *paint_options,
 
48
                                          GimpPaintState    paint_state,
 
49
                                          guint32           time);
 
50
static void       gimp_airbrush_motion   (GimpPaintCore    *paint_core,
 
51
                                          GimpDrawable     *drawable,
 
52
                                          GimpPaintOptions *paint_options);
 
53
static gboolean   gimp_airbrush_timeout  (gpointer          data);
 
54
 
 
55
 
 
56
G_DEFINE_TYPE (GimpAirbrush, gimp_airbrush, GIMP_TYPE_PAINTBRUSH)
 
57
 
 
58
#define parent_class gimp_airbrush_parent_class
60
59
 
61
60
 
62
61
void
66
65
  (* callback) (gimp,
67
66
                GIMP_TYPE_AIRBRUSH,
68
67
                GIMP_TYPE_AIRBRUSH_OPTIONS,
69
 
                _("Airbrush"));
70
 
}
71
 
 
72
 
GType
73
 
gimp_airbrush_get_type (void)
74
 
{
75
 
  static GType type = 0;
76
 
 
77
 
  if (! type)
78
 
    {
79
 
      static const GTypeInfo info =
80
 
      {
81
 
        sizeof (GimpAirbrushClass),
82
 
        (GBaseInitFunc) NULL,
83
 
        (GBaseFinalizeFunc) NULL,
84
 
        (GClassInitFunc) gimp_airbrush_class_init,
85
 
        NULL,           /* class_finalize */
86
 
        NULL,           /* class_data     */
87
 
        sizeof (GimpAirbrush),
88
 
        0,              /* n_preallocs    */
89
 
        (GInstanceInitFunc) gimp_airbrush_init,
90
 
      };
91
 
 
92
 
      type = g_type_register_static (GIMP_TYPE_PAINTBRUSH,
93
 
                                     "GimpAirbrush",
94
 
                                     &info, 0);
95
 
    }
96
 
 
97
 
  return type;
 
68
                "gimp-airbrush",
 
69
                _("Airbrush"),
 
70
                "gimp-tool-airbrush");
98
71
}
99
72
 
100
73
static void
103
76
  GObjectClass       *object_class     = G_OBJECT_CLASS (klass);
104
77
  GimpPaintCoreClass *paint_core_class = GIMP_PAINT_CORE_CLASS (klass);
105
78
 
106
 
  parent_class = g_type_class_peek_parent (klass);
107
 
 
108
79
  object_class->finalize  = gimp_airbrush_finalize;
109
80
 
110
81
  paint_core_class->paint = gimp_airbrush_paint;
144
115
    {
145
116
    case GIMP_PAINT_STATE_INIT:
146
117
      if (airbrush->timeout_id)
147
 
        {
148
 
          g_source_remove (airbrush->timeout_id);
149
 
          airbrush->timeout_id = 0;
150
 
        }
 
118
        {
 
119
          g_source_remove (airbrush->timeout_id);
 
120
          airbrush->timeout_id = 0;
 
121
        }
151
122
 
152
123
      GIMP_PAINT_CORE_CLASS (parent_class)->paint (paint_core, drawable,
153
124
                                                   paint_options,
156
127
 
157
128
    case GIMP_PAINT_STATE_MOTION:
158
129
      if (airbrush->timeout_id)
159
 
        {
160
 
          g_source_remove (airbrush->timeout_id);
161
 
          airbrush->timeout_id = 0;
162
 
        }
 
130
        {
 
131
          g_source_remove (airbrush->timeout_id);
 
132
          airbrush->timeout_id = 0;
 
133
        }
163
134
 
164
135
      gimp_airbrush_motion (paint_core, drawable, paint_options);
165
136
 
166
137
      if (options->rate != 0.0)
167
 
        {
168
 
          gdouble timeout;
 
138
        {
 
139
          gdouble timeout;
169
140
 
170
 
          airbrush->drawable      = drawable;
 
141
          airbrush->drawable      = drawable;
171
142
          airbrush->paint_options = paint_options;
172
143
 
173
 
          timeout = (paint_options->pressure_options->rate ?
174
 
                  (10000 / (options->rate * PRESSURE_SCALE * paint_core->cur_coords.pressure)) :
175
 
            (10000 / options->rate));
 
144
          timeout = (paint_options->pressure_options->rate ?
 
145
                  (10000 / (options->rate * PRESSURE_SCALE * paint_core->cur_coords.pressure)) :
 
146
            (10000 / options->rate));
176
147
 
177
 
          airbrush->timeout_id = g_timeout_add (timeout,
 
148
          airbrush->timeout_id = g_timeout_add (timeout,
178
149
                                                gimp_airbrush_timeout,
179
150
                                                airbrush);
180
 
        }
 
151
        }
181
152
      break;
182
153
 
183
154
    case GIMP_PAINT_STATE_FINISH:
184
155
      if (airbrush->timeout_id)
185
 
        {
186
 
          g_source_remove (airbrush->timeout_id);
187
 
          airbrush->timeout_id = 0;
188
 
        }
 
156
        {
 
157
          g_source_remove (airbrush->timeout_id);
 
158
          airbrush->timeout_id = 0;
 
159
        }
189
160
 
190
161
      GIMP_PAINT_CORE_CLASS (parent_class)->paint (paint_core, drawable,
191
162
                                                   paint_options,