From 4ac908c6ffa505ae3978eec809bf50fc7cb88e90 Mon Sep 17 00:00:00 2001 From: Chris Lahey Date: Fri, 14 Jan 2000 05:18:59 +0000 Subject: 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 --- e-util/e-text-event-processor-emacs-like.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'e-util/e-text-event-processor-emacs-like.c') diff --git a/e-util/e-text-event-processor-emacs-like.c b/e-util/e-text-event-processor-emacs-like.c index 6c7c86afdc..d2bf524401 100644 --- a/e-util/e-text-event-processor-emacs-like.c +++ b/e-util/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: -- cgit v1.2.3