~ubuntu-branches/ubuntu/hoary/gimp/hoary

« back to all changes in this revision

Viewing changes to app/tools/gimpmeasureoptions.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-04-04 14:51:23 UTC
  • Revision ID: james.westby@ubuntu.com-20050404145123-9py049eeelfymur8
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

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
 * gimpmeasuretool.c
 
5
 * Copyright (C) 1999 Sven Neumann <sven@gimp.org>
 
6
 *
 
7
 * This program is free software; you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License as published by
 
9
 * the Free Software Foundation; either version 2 of the License, or
 
10
 * (at your option) any later version.
 
11
 *
 
12
 * This program is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 * GNU General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU General Public License
 
18
 * along with this program; if not, write to the Free Software
 
19
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
20
 */
 
21
 
 
22
#include "config.h"
 
23
 
 
24
#include <gtk/gtk.h>
 
25
 
 
26
#include "libgimpwidgets/gimpwidgets.h"
 
27
 
 
28
#include "tools-types.h"
 
29
 
 
30
#include "config/gimpconfig-params.h"
 
31
 
 
32
#include "core/gimptoolinfo.h"
 
33
 
 
34
#include "widgets/gimppropwidgets.h"
 
35
 
 
36
#include "gimpmeasureoptions.h"
 
37
#include "gimptooloptions-gui.h"
 
38
 
 
39
#include "gimp-intl.h"
 
40
 
 
41
 
 
42
enum
 
43
{
 
44
  PROP_0,
 
45
  PROP_USE_INFO_WINDOW
 
46
};
 
47
 
 
48
 
 
49
static void   gimp_measure_options_class_init (GimpMeasureOptionsClass *klass);
 
50
 
 
51
static void   gimp_measure_options_set_property (GObject         *object,
 
52
                                                 guint            property_id,
 
53
                                                 const GValue    *value,
 
54
                                                 GParamSpec      *pspec);
 
55
static void   gimp_measure_options_get_property (GObject         *object,
 
56
                                                 guint            property_id,
 
57
                                                 GValue          *value,
 
58
                                                 GParamSpec      *pspec);
 
59
 
 
60
 
 
61
static GimpToolOptionsClass *parent_class = NULL;
 
62
 
 
63
 
 
64
GType
 
65
gimp_measure_options_get_type (void)
 
66
{
 
67
  static GType type = 0;
 
68
 
 
69
  if (! type)
 
70
    {
 
71
      static const GTypeInfo info =
 
72
      {
 
73
        sizeof (GimpMeasureOptionsClass),
 
74
        (GBaseInitFunc) NULL,
 
75
        (GBaseFinalizeFunc) NULL,
 
76
        (GClassInitFunc) gimp_measure_options_class_init,
 
77
        NULL,           /* class_finalize */
 
78
        NULL,           /* class_data     */
 
79
        sizeof (GimpMeasureOptions),
 
80
        0,              /* n_preallocs    */
 
81
        (GInstanceInitFunc) NULL
 
82
      };
 
83
 
 
84
      type = g_type_register_static (GIMP_TYPE_TOOL_OPTIONS,
 
85
                                     "GimpMeasureOptions",
 
86
                                     &info, 0);
 
87
    }
 
88
 
 
89
  return type;
 
90
}
 
91
 
 
92
static void
 
93
gimp_measure_options_class_init (GimpMeasureOptionsClass *klass)
 
94
{
 
95
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
96
 
 
97
  parent_class = g_type_class_peek_parent (klass);
 
98
 
 
99
  object_class->set_property = gimp_measure_options_set_property;
 
100
  object_class->get_property = gimp_measure_options_get_property;
 
101
 
 
102
  GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_USE_INFO_WINDOW,
 
103
                                    "use-info-window", NULL,
 
104
                                    FALSE,
 
105
                                    0);
 
106
}
 
107
 
 
108
static void
 
109
gimp_measure_options_set_property (GObject      *object,
 
110
                                   guint         property_id,
 
111
                                   const GValue *value,
 
112
                                   GParamSpec   *pspec)
 
113
{
 
114
  GimpMeasureOptions *options = GIMP_MEASURE_OPTIONS (object);
 
115
 
 
116
  switch (property_id)
 
117
    {
 
118
    case PROP_USE_INFO_WINDOW:
 
119
      options->use_info_window = g_value_get_boolean (value);
 
120
      break;
 
121
    default:
 
122
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
123
      break;
 
124
    }
 
125
}
 
126
 
 
127
static void
 
128
gimp_measure_options_get_property (GObject    *object,
 
129
                                   guint       property_id,
 
130
                                   GValue     *value,
 
131
                                   GParamSpec *pspec)
 
132
{
 
133
  GimpMeasureOptions *options = GIMP_MEASURE_OPTIONS (object);
 
134
 
 
135
  switch (property_id)
 
136
    {
 
137
    case PROP_USE_INFO_WINDOW:
 
138
      g_value_set_boolean (value, options->use_info_window);
 
139
      break;
 
140
    default:
 
141
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
142
      break;
 
143
    }
 
144
}
 
145
 
 
146
GtkWidget *
 
147
gimp_measure_options_gui (GimpToolOptions *tool_options)
 
148
{
 
149
  GObject   *config = G_OBJECT (tool_options);
 
150
  GtkWidget *vbox;
 
151
  GtkWidget *button;
 
152
 
 
153
  vbox = gimp_tool_options_gui (tool_options);
 
154
 
 
155
  /*  the use_info_window toggle button  */
 
156
  button = gimp_prop_check_button_new (config, "use-info-window",
 
157
                                       _("Use info window"));
 
158
  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
 
159
  gtk_widget_show (button);
 
160
 
 
161
  return vbox;
 
162
}