Commit f3b7f416 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

added a "name" property. Dispatch events only if the controller is

2004-06-16  Michael Natterer  <mitch@gimp.org>

	* libgimpwidgets/gimpcontroller.[ch]: added a "name" property.
	Dispatch events only if the controller is enabled.

	* app/widgets/gimpcontrollerwheel.c: added controller events for
	all possible modifier combinations.

	* etc/Makefile.am
	* etc/controllerrc: default controllerrc which maps all unused
	wheel+modifier combinations to more-or-less usefull stuff.
parent d0117ef5
2004-06-16 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimpcontroller.[ch]: added a "name" property.
Dispatch events only if the controller is enabled.
* app/widgets/gimpcontrollerwheel.c: added controller events for
all possible modifier combinations.
* etc/Makefile.am
* etc/controllerrc: default controllerrc which maps all unused
wheel+modifier combinations to more-or-less usefull stuff.
2004-06-16 Michael Natterer <mitch@gimp.org>
Started to fix bug #106920 in a more genreral way:
......
......@@ -54,25 +54,73 @@ static GimpControllerClass *parent_class = NULL;
static const WheelEvent wheel_events[] =
{
{ GDK_SCROLL_UP, GDK_MOD1_MASK, N_("Alt + Scroll Up") },
{ GDK_SCROLL_UP, GDK_CONTROL_MASK, N_("Control + Scroll Up") },
{ GDK_SCROLL_UP, GDK_SHIFT_MASK, N_("Shift + Scroll Up") },
{ GDK_SCROLL_UP, 0, N_("Scroll Up") },
{ GDK_SCROLL_DOWN, GDK_MOD1_MASK, N_("Alt + Scroll Down") },
{ GDK_SCROLL_DOWN, GDK_CONTROL_MASK, N_("Control + Scroll Down") },
{ GDK_SCROLL_DOWN, GDK_SHIFT_MASK, N_("Shift + Scroll Down") },
{ GDK_SCROLL_DOWN, 0, N_("Scroll Down") },
{ GDK_SCROLL_LEFT, GDK_MOD1_MASK, N_("Alt + Scroll Left") },
{ GDK_SCROLL_LEFT, GDK_CONTROL_MASK, N_("Control + Scroll Left") },
{ GDK_SCROLL_LEFT, GDK_SHIFT_MASK, N_("Shift + Scroll Left") },
{ GDK_SCROLL_LEFT, 0, N_("Scroll Left") },
{ GDK_SCROLL_RIGHT, GDK_MOD1_MASK, N_("Alt + Scroll Right") },
{ GDK_SCROLL_RIGHT, GDK_CONTROL_MASK, N_("Control + Scroll Right") },
{ GDK_SCROLL_RIGHT, GDK_SHIFT_MASK, N_("Shift + Scroll Right") },
{ GDK_SCROLL_RIGHT, 0, N_("Scroll Right") }
{ GDK_SCROLL_UP, GDK_MOD1_MASK | GDK_CONTROL_MASK | GDK_SHIFT_MASK,
N_("Alt + Control + Shift + Scroll Up") },
{ GDK_SCROLL_UP, GDK_MOD1_MASK | GDK_CONTROL_MASK,
N_("Alt + Control + Scroll Up") },
{ GDK_SCROLL_UP, GDK_MOD1_MASK | GDK_SHIFT_MASK,
N_("Alt + Shift + Scroll Up") },
{ GDK_SCROLL_UP, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
N_("Control + Shift + Scroll Up") },
{ GDK_SCROLL_UP, GDK_MOD1_MASK,
N_("Alt + Scroll Up") },
{ GDK_SCROLL_UP, GDK_CONTROL_MASK,
N_("Control + Scroll Up") },
{ GDK_SCROLL_UP, GDK_SHIFT_MASK,
N_("Shift + Scroll Up") },
{ GDK_SCROLL_UP, 0,
N_("Scroll Up") },
{ GDK_SCROLL_DOWN, GDK_MOD1_MASK | GDK_CONTROL_MASK | GDK_SHIFT_MASK,
N_("Alt + Control + Shift + Scroll Down") },
{ GDK_SCROLL_DOWN, GDK_MOD1_MASK | GDK_CONTROL_MASK,
N_("Alt + Control + Scroll Down") },
{ GDK_SCROLL_DOWN, GDK_MOD1_MASK | GDK_SHIFT_MASK,
N_("Alt + Shift + Scroll Down") },
{ GDK_SCROLL_DOWN, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
N_("Control + Shift + Scroll Down") },
{ GDK_SCROLL_DOWN, GDK_MOD1_MASK,
N_("Alt + Scroll Down") },
{ GDK_SCROLL_DOWN, GDK_CONTROL_MASK,
N_("Control + Scroll Down") },
{ GDK_SCROLL_DOWN, GDK_SHIFT_MASK,
N_("Shift + Scroll Down") },
{ GDK_SCROLL_DOWN, 0,
N_("Scroll Down") },
{ GDK_SCROLL_LEFT, GDK_MOD1_MASK | GDK_CONTROL_MASK | GDK_SHIFT_MASK,
N_("Alt + Control + Shift + Scroll Left") },
{ GDK_SCROLL_LEFT, GDK_MOD1_MASK | GDK_CONTROL_MASK,
N_("Alt + Control + Scroll Left") },
{ GDK_SCROLL_LEFT, GDK_MOD1_MASK | GDK_SHIFT_MASK,
N_("Alt + Shift + Scroll Left") },
{ GDK_SCROLL_LEFT, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
N_("Control + Shift + Scroll Left") },
{ GDK_SCROLL_LEFT, GDK_MOD1_MASK,
N_("Alt + Scroll Left") },
{ GDK_SCROLL_LEFT, GDK_CONTROL_MASK,
N_("Control + Scroll Left") },
{ GDK_SCROLL_LEFT, GDK_SHIFT_MASK,
N_("Shift + Scroll Left") },
{ GDK_SCROLL_LEFT, 0,
N_("Scroll Left") },
{ GDK_SCROLL_RIGHT, GDK_MOD1_MASK | GDK_CONTROL_MASK | GDK_SHIFT_MASK,
N_("Alt + Control + Shift + Scroll Right") },
{ GDK_SCROLL_RIGHT, GDK_MOD1_MASK | GDK_CONTROL_MASK,
N_("Alt + Control + Scroll Right") },
{ GDK_SCROLL_RIGHT, GDK_MOD1_MASK | GDK_SHIFT_MASK,
N_("Alt + Shift + Scroll Right") },
{ GDK_SCROLL_RIGHT, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
N_("Control + Shift + Scroll Right") },
{ GDK_SCROLL_RIGHT, GDK_MOD1_MASK,
N_("Alt + Scroll Right") },
{ GDK_SCROLL_RIGHT, GDK_CONTROL_MASK,
N_("Control + Scroll Right") },
{ GDK_SCROLL_RIGHT, GDK_SHIFT_MASK,
N_("Shift + Scroll Right") },
{ GDK_SCROLL_RIGHT, 0,
N_("Scroll Right") }
};
......
......@@ -6,7 +6,8 @@ gimpsysconf_DATA = \
templaterc \
unitrc \
ps-menurc \
sessionrc
sessionrc \
controllerrc
EXTRA_DIST = \
$(gimpsysconf_DATA)
# GIMP controllerrc
(controller "GimpControllerWheel"
(mapping 0 "context-font-next")
(mapping 1 "context-gradient-next")
(mapping 2 "context-pattern-next")
(mapping 3 "context-brush-next")
(mapping 4 "context-opacity-increase")
(mapping 8 "context-font-previous")
(mapping 9 "context-gradient-previous")
(mapping 10 "context-pattern-previous")
(mapping 11 "context-brush-previous")
(mapping 12 "context-opacity-decrease"))
......@@ -35,6 +35,7 @@
enum
{
PROP_0,
PROP_NAME,
PROP_ENABLED
};
......@@ -115,6 +116,11 @@ gimp_controller_class_init (GimpControllerClass *klass)
object_class->set_property = gimp_controller_set_property;
object_class->get_property = gimp_controller_get_property;
g_object_class_install_property (object_class, PROP_NAME,
g_param_spec_string ("name", NULL, NULL,
"Unnamed Controller",
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_ENABLED,
g_param_spec_boolean ("enabled", NULL, NULL,
TRUE,
......@@ -149,6 +155,11 @@ gimp_controller_set_property (GObject *object,
switch (property_id)
{
case PROP_NAME:
if (controller->name)
g_free (controller->name);
controller->name = g_value_dup_string (value);
break;
case PROP_ENABLED:
controller->enabled = g_value_get_boolean (value);
break;
......@@ -168,6 +179,9 @@ gimp_controller_get_property (GObject *object,
switch (property_id)
{
case PROP_NAME:
g_value_set_string (value, controller->name);
break;
case PROP_ENABLED:
g_value_set_boolean (value, controller->enabled);
break;
......@@ -245,8 +259,9 @@ gimp_controller_event (GimpController *controller,
g_return_val_if_fail (GIMP_IS_CONTROLLER (controller), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
g_signal_emit (controller, controller_signals[EVENT], 0,
event, &retval);
if (controller->enabled)
g_signal_emit (controller, controller_signals[EVENT], 0,
event, &retval);
return retval;
}
......@@ -81,9 +81,10 @@ typedef struct _GimpControllerClass GimpControllerClass;
struct _GimpController
{
GObject parent_instance;
GObject parent_instance;
gboolean enabled;
gchar *name;
gboolean enabled;
};
struct _GimpControllerClass
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment