Enlightenment CVS committal
Author : rbdpngn
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src
Modified Files:
ewl_entry.c ewl_entry.h
Log Message:
Patch from Nicholas Curran to add support for using text selection in the
entry from the keyboard.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_entry.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -3 -r1.83 -r1.84
--- ewl_entry.c 18 Mar 2004 03:41:23 -0000 1.83
+++ ewl_entry.c 30 Apr 2004 05:43:59 -0000 1.84
@@ -39,6 +39,8 @@
w = EWL_WIDGET(e);
+ e->in_select_mode = FALSE;
+
if (!ewl_container_init(EWL_CONTAINER(w), "entry"))
DRETURN_INT(FALSE, DLEVEL_STABLE);
@@ -279,6 +281,8 @@
e = EWL_ENTRY(w);
ev = ev_data;
+ e->in_select_mode = (ev->modifiers & EWL_KEY_MODIFIER_SHIFT);
+
if (!strcmp(ev->keyname, "Left"))
ewl_entry_move_cursor_to_left(e);
else if (!strcmp(ev->keyname, "Right"))
@@ -453,7 +457,11 @@
if (pos > 1)
--pos;
- ewl_cursor_set_base(EWL_CURSOR(e->cursor), pos);
+ if (e->in_select_mode)
+ ewl_cursor_select_to(EWL_CURSOR(e->cursor), pos);
+ else
+ ewl_cursor_set_base(EWL_CURSOR(e->cursor), pos);
+
ewl_widget_configure(EWL_WIDGET(e));
DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -478,7 +486,11 @@
if (pos <= len)
++pos;
- ewl_cursor_set_base(EWL_CURSOR(e->cursor), pos);
+ if (e->in_select_mode)
+ ewl_cursor_select_to(EWL_CURSOR(e->cursor), pos);
+ else
+ ewl_cursor_set_base(EWL_CURSOR(e->cursor), pos);
+
ewl_widget_configure(EWL_WIDGET(e));
DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -492,7 +504,11 @@
{
DENTER_FUNCTION(DLEVEL_STABLE);
- ewl_cursor_set_base(EWL_CURSOR(e->cursor), 1);
+ if (e->in_select_mode)
+ ewl_cursor_select_to(EWL_CURSOR(e->cursor), 1);
+ else
+ ewl_cursor_set_base(EWL_CURSOR(e->cursor), 1);
+
ewl_widget_configure(EWL_WIDGET(e));
DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -516,7 +532,11 @@
FREE(s);
}
- ewl_cursor_set_base(EWL_CURSOR(e->cursor), l + 1);
+ if (e->in_select_mode)
+ ewl_cursor_select_to(EWL_CURSOR(e->cursor), l);
+ else
+ ewl_cursor_set_base(EWL_CURSOR(e->cursor), l + 1);
+
ewl_widget_configure(EWL_WIDGET(e));
DLEAVE_FUNCTION(DLEVEL_STABLE);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_entry.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -3 -r1.32 -r1.33
--- ewl_entry.h 18 Mar 2004 03:41:23 -0000 1.32
+++ ewl_entry.h 30 Apr 2004 05:43:59 -0000 1.33
@@ -40,6 +40,7 @@
int editable; /**< Flag to indicate if user can edit text */
Ecore_Timer *timer; /**< Time until scrolling text on select */
double start_time; /**< Time timer started */
+ int in_select_mode; /**< Do keyboard cursor movements select? */
};
Ewl_Widget *ewl_entry_new(char *text);
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs