~ubuntu-branches/ubuntu/maverick/gimp/maverick-updates

« back to all changes in this revision

Viewing changes to app/tools/gimpsmudgetool.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2005-12-09 19:44:52 UTC
  • Revision ID: james.westby@ubuntu.com-20051209194452-yggpemjlofpjqyf4
Tags: upstream-2.2.9
ImportĀ upstreamĀ versionĀ 2.2.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* The GIMP -- an image manipulation program
 
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
17
 */
 
18
 
 
19
#include "config.h"
 
20
 
 
21
#include <gtk/gtk.h>
 
22
 
 
23
#include "libgimpwidgets/gimpwidgets.h"
 
24
 
 
25
#include "tools-types.h"
 
26
 
 
27
#include "core/gimptoolinfo.h"
 
28
 
 
29
#include "paint/gimpsmudgeoptions.h"
 
30
 
 
31
#include "widgets/gimphelp-ids.h"
 
32
#include "widgets/gimppropwidgets.h"
 
33
 
 
34
#include "gimpsmudgetool.h"
 
35
#include "gimppaintoptions-gui.h"
 
36
#include "gimptoolcontrol.h"
 
37
 
 
38
#include "gimp-intl.h"
 
39
 
 
40
 
 
41
static void        gimp_smudge_tool_init   (GimpSmudgeTool  *tool);
 
42
static GtkWidget * gimp_smudge_options_gui (GimpToolOptions *tool_options);
 
43
 
 
44
 
 
45
void
 
46
gimp_smudge_tool_register (GimpToolRegisterCallback  callback,
 
47
                           gpointer                  data)
 
48
{
 
49
  (* callback) (GIMP_TYPE_SMUDGE_TOOL,
 
50
                GIMP_TYPE_SMUDGE_OPTIONS,
 
51
                gimp_smudge_options_gui,
 
52
                GIMP_PAINT_OPTIONS_CONTEXT_MASK,
 
53
                "gimp-smudge-tool",
 
54
                _("Smudge"),
 
55
                _("Smudge image"),
 
56
                N_("_Smudge"), "S",
 
57
                NULL, GIMP_HELP_TOOL_SMUDGE,
 
58
                GIMP_STOCK_TOOL_SMUDGE,
 
59
                data);
 
60
}
 
61
 
 
62
GType
 
63
gimp_smudge_tool_get_type (void)
 
64
{
 
65
  static GType tool_type = 0;
 
66
 
 
67
  if (! tool_type)
 
68
    {
 
69
      static const GTypeInfo tool_info =
 
70
      {
 
71
        sizeof (GimpSmudgeToolClass),
 
72
        (GBaseInitFunc) NULL,
 
73
        (GBaseFinalizeFunc) NULL,
 
74
        NULL,           /* class_init     */
 
75
        NULL,           /* class_finalize */
 
76
        NULL,           /* class_data     */
 
77
        sizeof (GimpSmudgeTool),
 
78
        0,              /* n_preallocs    */
 
79
        (GInstanceInitFunc) gimp_smudge_tool_init,
 
80
      };
 
81
 
 
82
      tool_type = g_type_register_static (GIMP_TYPE_PAINT_TOOL,
 
83
                                          "GimpSmudgeTool",
 
84
                                          &tool_info, 0);
 
85
    }
 
86
 
 
87
  return tool_type;
 
88
}
 
89
 
 
90
static void
 
91
gimp_smudge_tool_init (GimpSmudgeTool *smudge)
 
92
{
 
93
  GimpTool *tool = GIMP_TOOL (smudge);
 
94
 
 
95
  gimp_tool_control_set_tool_cursor (tool->control, GIMP_TOOL_CURSOR_SMUDGE);
 
96
 
 
97
  gimp_paint_tool_enable_color_picker (GIMP_PAINT_TOOL (smudge),
 
98
                                       GIMP_COLOR_PICK_MODE_FOREGROUND);
 
99
}
 
100
 
 
101
 
 
102
/*  tool options stuff  */
 
103
 
 
104
static GtkWidget *
 
105
gimp_smudge_options_gui (GimpToolOptions *tool_options)
 
106
{
 
107
  GObject   *config;
 
108
  GtkWidget *vbox;
 
109
  GtkWidget *table;
 
110
 
 
111
  config = G_OBJECT (tool_options);
 
112
 
 
113
  vbox = gimp_paint_options_gui (tool_options);
 
114
 
 
115
  /*  the rate scale  */
 
116
  table = gtk_table_new (1, 3, FALSE);
 
117
  gtk_table_set_col_spacings (GTK_TABLE (table), 2);
 
118
  gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
 
119
  gtk_widget_show (table);
 
120
 
 
121
  gimp_prop_scale_entry_new (config, "rate",
 
122
                             GTK_TABLE (table), 0, 0,
 
123
                             _("Rate:"),
 
124
                             1.0, 10.0, 1,
 
125
                             FALSE, 0.0, 0.0);
 
126
 
 
127
  return vbox;
 
128
}