aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/e-text-event-processor-emacs-like.c
diff options
context:
space:
mode:
authorChris Lahey <clahey@src.gnome.org>2000-01-14 13:18:59 +0800
committerChris Lahey <clahey@src.gnome.org>2000-01-14 13:18:59 +0800
commit4ac908c6ffa505ae3978eec809bf50fc7cb88e90 (patch)
treeec44e0269b86ab31e5b3c0a4aa5e10d591fb0d7c /widgets/e-text-event-processor-emacs-like.c
parentf21a1a70bdcdf055e889a3ab736d76153ca2f760 (diff)
downloadgsoc2013-evolution-4ac908c6ffa505ae3978eec809bf50fc7cb88e90.tar
gsoc2013-evolution-4ac908c6ffa505ae3978eec809bf50fc7cb88e90.tar.gz
gsoc2013-evolution-4ac908c6ffa505ae3978eec809bf50fc7cb88e90.tar.bz2
gsoc2013-evolution-4ac908c6ffa505ae3978eec809bf50fc7cb88e90.tar.lz
gsoc2013-evolution-4ac908c6ffa505ae3978eec809bf50fc7cb88e90.tar.xz
gsoc2013-evolution-4ac908c6ffa505ae3978eec809bf50fc7cb88e90.tar.zst
gsoc2013-evolution-4ac908c6ffa505ae3978eec809bf50fc7cb88e90.zip
Added selection and clipboard support. Added up and down arrow keys. Fixed
* widgets/e-text-event-processor-types.h, widgets/e-text-event-processor-emacs-like.c, widgets/e-text.c, widgets/e-text.h: Added selection and clipboard support. Added up and down arrow keys. Fixed choice of font colors for the selection to be based on the current style. * widgets/e-minicard.c: Caused a click to grab the focus. Changed the fake information added. * widgets/e-minicard-label.c: Forward mouse events to the field EText item. svn path=/trunk/; revision=1568
Diffstat (limited to 'widgets/e-text-event-processor-emacs-like.c')
-rw-r--r--widgets/e-text-event-processor-emacs-like.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/widgets/e-text-event-processor-emacs-like.c b/widgets/e-text-event-processor-emacs-like.c
index 6c7c86afdc..d2bf524401 100644
--- a/widgets/e-text-event-processor-emacs-like.c
+++ b/widgets/e-text-event-processor-emacs-like.c
@@ -57,7 +57,7 @@ static const ETextEventProcessorCommand control_keys[26] =
{ E_TEP_START_OF_LINE, E_TEP_DELETE, 0, "" }, /* u */
{ E_TEP_SELECTION, E_TEP_PASTE, 0, "" }, /* v */
{ E_TEP_BACKWARD_WORD, E_TEP_DELETE, 0, "" }, /* w */
- { E_TEP_SELECTION, E_TEP_PASTE, 0, "" }, /* x */
+ { E_TEP_SELECTION, E_TEP_DELETE, 0, "" }, /* x */
{ E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* y */
{ E_TEP_SELECTION, E_TEP_NOP, 0, "" } /* z */
};
@@ -142,6 +142,7 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventPro
{
ETextEventProcessorCommand command;
ETextEventProcessorEmacsLike *tep_el = E_TEXT_EVENT_PROCESSOR_EMACS_LIKE(tep);
+ command.action = E_TEP_NOP;
switch (event->type) {
case GDK_BUTTON_PRESS:
if (event->button.button == 1) {
@@ -151,24 +152,39 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventPro
command.action = E_TEP_MOVE;
command.position = E_TEP_VALUE;
command.value = event->button.position;
+ command.time = event->button.time;
tep_el->mouse_down = TRUE;
}
break;
case GDK_BUTTON_RELEASE:
if (event->button.button == 1) {
+ command.time = event->button.time;
tep_el->mouse_down = FALSE;
+ } else if (event->button.button == 2) {
+ command.action = E_TEP_MOVE;
+ command.position = E_TEP_VALUE;
+ command.value = event->button.position;
+ command.time = event->button.time;
+ gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command);
+
+ command.action = E_TEP_GET_SELECTION;
+ command.position = E_TEP_SELECTION;
+ command.value = 0;
+ command.time = event->button.time;
}
break;
case GDK_MOTION_NOTIFY:
if (tep_el->mouse_down) {
command.action = E_TEP_SELECT;
command.position = E_TEP_VALUE;
+ command.time = event->motion.time;
command.value = event->motion.position;
}
break;
case GDK_KEY_PRESS:
{
ETextEventProcessorEventKey key = event->key;
+ command.time = event->key.time;
if (key.state & GDK_SHIFT_MASK)
command.action = E_TEP_SELECT;
else
@@ -232,6 +248,8 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventPro
command.position = E_TEP_FORWARD_WORD;
} else if (key.state & GDK_SHIFT_MASK) {
command.action = E_TEP_COPY;
+ command.position = E_TEP_SELECTION;
+ gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command);
command.action = E_TEP_DELETE;
command.position = E_TEP_SELECTION;
@@ -276,6 +294,12 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventPro
}
if (key.keyval == 'x') {
+ command.action = E_TEP_COPY;
+ command.position = E_TEP_SELECTION;
+ gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command);
+
+ command.action = E_TEP_DELETE;
+ command.position = E_TEP_SELECTION;
}
break;
@@ -302,6 +326,7 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventPro
}
break;
case GDK_KEY_RELEASE:
+ command.time = event->key.time;
command.action = E_TEP_NOP;
break;
default: