1
/* LIBGIMP - The GIMP Library
1
/* GIMP - The GNU Image Manipulation Program
2
2
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
4
4
* gimpcontrollerwheel.c
5
5
* Copyright (C) 2004 Michael Natterer <mitch@gimp.org>
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public
9
* License as published by the Free Software Foundation; either
10
* version 2 of the License, or (at your option) any later version.
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.
12
* This library is distributed in the hope that it will be useful,
12
* This program is distributed in the hope that it will be useful,
13
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Lesser General Public License for more details.
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with this library; if not, write to the
19
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20
* Boston, MA 02111-1307, USA.
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.
23
22
#include "config.h"
62
static GimpControllerClass *parent_class = NULL;
64
static const WheelEvent wheel_events[] =
59
G_DEFINE_TYPE (GimpControllerWheel, gimp_controller_wheel,
62
#define parent_class gimp_controller_wheel_parent_class
65
static WheelEvent wheel_events[] =
66
67
{ GDK_SCROLL_UP, GDK_MOD1_MASK | GDK_CONTROL_MASK | GDK_SHIFT_MASK,
67
68
"scroll-up-shift-control-alt",
68
N_("Scroll Up (Shift + Control + Alt)") },
69
70
{ GDK_SCROLL_UP, GDK_MOD1_MASK | GDK_CONTROL_MASK,
70
71
"scroll-up-control-alt",
71
N_("Scroll Up (Control + Alt)") },
72
73
{ GDK_SCROLL_UP, GDK_MOD1_MASK | GDK_SHIFT_MASK,
73
74
"scroll-up-shift-alt",
74
N_("Scroll Up (Shift + Alt)") },
75
76
{ GDK_SCROLL_UP, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
76
77
"scroll-up-shift-control",
77
N_("Scroll Up (Shift + Control)") },
78
79
{ GDK_SCROLL_UP, GDK_MOD1_MASK,
80
N_("Scroll Up (Alt)") },
81
82
{ GDK_SCROLL_UP, GDK_CONTROL_MASK,
82
83
"scroll-up-control",
83
N_("Scroll Up (Control)") },
84
85
{ GDK_SCROLL_UP, GDK_SHIFT_MASK,
86
N_("Scroll Up (Shift)") },
87
88
{ GDK_SCROLL_UP, 0,
91
92
{ GDK_SCROLL_DOWN, GDK_MOD1_MASK | GDK_CONTROL_MASK | GDK_SHIFT_MASK,
92
93
"scroll-down-shift-control-alt",
93
N_("Scroll Down (Shift + Control + Alt)") },
94
95
{ GDK_SCROLL_DOWN, GDK_MOD1_MASK | GDK_CONTROL_MASK,
95
96
"scroll-down-control-alt",
96
N_("Scroll Down (Control + Alt)") },
97
98
{ GDK_SCROLL_DOWN, GDK_MOD1_MASK | GDK_SHIFT_MASK,
98
99
"scroll-down-shift-alt",
99
N_("Scroll Down (Shift + Alt)") },
100
101
{ GDK_SCROLL_DOWN, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
101
102
"scroll-down-shift-control",
102
N_("Scroll Down (Shift + Control)") },
103
104
{ GDK_SCROLL_DOWN, GDK_MOD1_MASK,
104
105
"scroll-down-alt",
105
N_("Scroll Down (Alt)") },
106
107
{ GDK_SCROLL_DOWN, GDK_CONTROL_MASK,
107
108
"scroll-down-control",
108
N_("Scroll Down (Control)") },
109
110
{ GDK_SCROLL_DOWN, GDK_SHIFT_MASK,
110
111
"scroll-down-shift",
111
N_("Scroll Down (Shift)") },
112
113
{ GDK_SCROLL_DOWN, 0,
114
115
N_("Scroll Down") },
116
117
{ GDK_SCROLL_LEFT, GDK_MOD1_MASK | GDK_CONTROL_MASK | GDK_SHIFT_MASK,
117
118
"scroll-left-shift-control-alt",
118
N_("Scroll Left (Shift + Control + Alt)") },
119
120
{ GDK_SCROLL_LEFT, GDK_MOD1_MASK | GDK_CONTROL_MASK,
120
121
"scroll-left-control-alt",
121
N_("Scroll Left (Control + Alt)") },
122
123
{ GDK_SCROLL_LEFT, GDK_MOD1_MASK | GDK_SHIFT_MASK,
123
124
"scroll-left-shift-alt",
124
N_("Scroll Left (Shift + Alt)") },
125
126
{ GDK_SCROLL_LEFT, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
126
127
"scroll-left-shift-control",
127
N_("Scroll Left (Shift + Control)") },
128
129
{ GDK_SCROLL_LEFT, GDK_MOD1_MASK,
129
130
"scroll-left-alt",
130
N_("Scroll Left (Alt)") },
131
132
{ GDK_SCROLL_LEFT, GDK_CONTROL_MASK,
132
133
"scroll-left-control",
133
N_("Scroll Left (Control)") },
134
135
{ GDK_SCROLL_LEFT, GDK_SHIFT_MASK,
135
136
"scroll-left-shift",
136
N_("Scroll Left (Shift)") },
137
138
{ GDK_SCROLL_LEFT, 0,
139
140
N_("Scroll Left") },
141
142
{ GDK_SCROLL_RIGHT, GDK_MOD1_MASK | GDK_CONTROL_MASK | GDK_SHIFT_MASK,
142
143
"scroll-right-shift-control-alt",
143
N_("Scroll Right (Shift + Control + Alt)") },
144
N_("Scroll Right") },
144
145
{ GDK_SCROLL_RIGHT, GDK_MOD1_MASK | GDK_CONTROL_MASK,
145
146
"scroll-right-control-alt",
146
N_("Scroll Right (Control + Alt)") },
147
N_("Scroll Right") },
147
148
{ GDK_SCROLL_RIGHT, GDK_MOD1_MASK | GDK_SHIFT_MASK,
148
149
"scroll-right-shift-alt",
149
N_("Scroll Right (Shift + Alt)") },
150
N_("Scroll Right") },
150
151
{ GDK_SCROLL_RIGHT, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
151
152
"scroll-right-shift-control",
152
N_("Scroll Right (Shift + Control)") },
153
N_("Scroll Right") },
153
154
{ GDK_SCROLL_RIGHT, GDK_MOD1_MASK,
154
155
"scroll-right-alt",
155
N_("Scroll Right (Alt)") },
156
N_("Scroll Right") },
156
157
{ GDK_SCROLL_RIGHT, GDK_CONTROL_MASK,
157
158
"scroll-right-control",
158
N_("Scroll Right (Control)") },
159
N_("Scroll Right") },
159
160
{ GDK_SCROLL_RIGHT, GDK_SHIFT_MASK,
160
161
"scroll-right-shift",
161
N_("Scroll Right (Shift)") },
162
N_("Scroll Right") },
162
163
{ GDK_SCROLL_RIGHT, 0,
164
165
N_("Scroll Right") }
169
gimp_controller_wheel_get_type (void)
171
static GType controller_type = 0;
173
if (! controller_type)
175
static const GTypeInfo controller_info =
177
sizeof (GimpControllerWheelClass),
178
(GBaseInitFunc) NULL,
179
(GBaseFinalizeFunc) NULL,
180
(GClassInitFunc) gimp_controller_wheel_class_init,
181
NULL, /* class_finalize */
182
NULL, /* class_data */
183
sizeof (GimpControllerWheel),
185
(GInstanceInitFunc) gimp_controller_wheel_init,
188
controller_type = g_type_register_static (GIMP_TYPE_CONTROLLER,
189
"GimpControllerWheel",
190
&controller_info, 0);
193
return controller_type;
197
170
gimp_controller_wheel_class_init (GimpControllerWheelClass *klass)
199
172
GObjectClass *object_class = G_OBJECT_CLASS (klass);
200
173
GimpControllerClass *controller_class = GIMP_CONTROLLER_CLASS (klass);
202
parent_class = g_type_class_peek_parent (klass);
204
175
object_class->constructor = gimp_controller_wheel_constructor;
206
177
controller_class->name = _("Mouse Wheel");
207
178
controller_class->help_id = GIMP_HELP_CONTROLLER_WHEEL;
179
controller_class->stock_id = GIMP_STOCK_CONTROLLER_WHEEL;
209
181
controller_class->get_n_events = gimp_controller_wheel_get_n_events;
210
182
controller_class->get_event_name = gimp_controller_wheel_get_event_name;