[evolution-patches] Seeking review for bug 45623, "enable keyboard selection in mail reader"



Hi,

This patch fixes bug #45623, which aims to "enable keyboard selection in mail reader". The patch applies to gtkhtml (from trunk), it makes keyboard selection available when
caret mode is enabled (F7 in evo).

Please give comments, thanks.

--
Best Regards
Maxx

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
retrieving revision 1.1847
diff -u -r1.1847 ChangeLog
--- ChangeLog	30 Jul 2003 21:26:42 -0000	1.1847
+++ ChangeLog	31 Jul 2003 02:21:25 -0000
@@ -1,3 +1,18 @@
+2003-07-31  Maxx Cao  <maxx cao sun com>
+
+	* gtkhtml.c (focus): reset selection when focus moved
+	(move_selection):  add consideration for caret mode
+	(command): handle selection command for caret mode
+	
+	* htmlengine-edit-cursor.c (clip_cursor): fixed some calculation
+	error
+	
+	* htmlengine-edit.c (html_engine_set_mark): consider caret mode
+	
+	* htmlengine.c (html_engine_draw_real): consider caret mode
+	
+	* htmlselection.c (remove_mark): consider caret mode
+
 2003-07-30  Larry Ewing  <lewing ximian com>
 
 	* htmlengine.c: fix logic that was causing some extra p breaks on
Index: gtkhtml.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/gtkhtml.c,v
retrieving revision 1.526
diff -u -r1.526 gtkhtml.c
--- gtkhtml.c	22 Jul 2003 19:23:04 -0000	1.526
+++ gtkhtml.c	31 Jul 2003 02:21:26 -0000
@@ -2065,6 +2065,13 @@
 		return rv;
 	}
 
+	/* Reset selection. */
+	if (e->shift_selection || e->mark) {
+		html_engine_disable_selection (e);
+		html_engine_edit_selection_updater_schedule (e->selection_updater);
+		e->shift_selection = FALSE;
+	}
+
 	if (html_engine_focus (e, direction) && e->focus_object) {
 		HTMLObject *cur, *obj = html_engine_get_focus_object (e);
 		gint x1, y1, x2, y2, xo, yo;
@@ -3945,7 +3952,7 @@
 	gboolean rv;
 	gint amount;
 
-	if (!html_engine_get_editable (html->engine))
+	if (!html_engine_get_editable (html->engine) && !html->engine->caret_mode)
 		return FALSE;
 
 	html->engine->shift_selection = TRUE;
@@ -4090,6 +4097,23 @@
 	case GTK_HTML_COMMAND_COPY:
 		gtk_html_copy (html);
 		break;
+
+	case GTK_HTML_COMMAND_MODIFY_SELECTION_UP:
+	case GTK_HTML_COMMAND_MODIFY_SELECTION_DOWN:
+	case GTK_HTML_COMMAND_MODIFY_SELECTION_LEFT:
+	case GTK_HTML_COMMAND_MODIFY_SELECTION_RIGHT:
+	case GTK_HTML_COMMAND_MODIFY_SELECTION_BOL:
+	case GTK_HTML_COMMAND_MODIFY_SELECTION_EOL:
+	case GTK_HTML_COMMAND_MODIFY_SELECTION_BOD:
+	case GTK_HTML_COMMAND_MODIFY_SELECTION_EOD:
+	case GTK_HTML_COMMAND_MODIFY_SELECTION_PAGEUP:
+	case GTK_HTML_COMMAND_MODIFY_SELECTION_PAGEDOWN:
+	case GTK_HTML_COMMAND_MODIFY_SELECTION_PREV_WORD:
+	case GTK_HTML_COMMAND_MODIFY_SELECTION_NEXT_WORD:
+		if (html->engine->caret_mode || html_engine_get_editable(e))
+			rv = move_selection (html, com_type);
+		break;
+
 	default:
 		html->binding_handled = FALSE;
 	}
@@ -4337,20 +4361,6 @@
 		break;
 	case GTK_HTML_COMMAND_PARAGRAPH_STYLE_ITEMALPHA:
 		gtk_html_set_paragraph_style (html, GTK_HTML_PARAGRAPH_STYLE_ITEMALPHA);
-		break;
-	case GTK_HTML_COMMAND_MODIFY_SELECTION_UP:
-	case GTK_HTML_COMMAND_MODIFY_SELECTION_DOWN:
-	case GTK_HTML_COMMAND_MODIFY_SELECTION_LEFT:
-	case GTK_HTML_COMMAND_MODIFY_SELECTION_RIGHT:
-	case GTK_HTML_COMMAND_MODIFY_SELECTION_BOL:
-	case GTK_HTML_COMMAND_MODIFY_SELECTION_EOL:
-	case GTK_HTML_COMMAND_MODIFY_SELECTION_BOD:
-	case GTK_HTML_COMMAND_MODIFY_SELECTION_EOD:
-	case GTK_HTML_COMMAND_MODIFY_SELECTION_PAGEUP:
-	case GTK_HTML_COMMAND_MODIFY_SELECTION_PAGEDOWN:
-	case GTK_HTML_COMMAND_MODIFY_SELECTION_PREV_WORD:
-	case GTK_HTML_COMMAND_MODIFY_SELECTION_NEXT_WORD:
-		rv = move_selection (html, com_type);
 		break;
 	case GTK_HTML_COMMAND_SELECT_WORD:
 		gtk_html_select_word (html);
Index: htmlengine-edit-cursor.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlengine-edit-cursor.c,v
retrieving revision 1.24
diff -u -r1.24 htmlengine-edit-cursor.c
--- htmlengine-edit-cursor.c	10 Jul 2003 16:33:34 -0000	1.24
+++ htmlengine-edit-cursor.c	31 Jul 2003 02:21:26 -0000
@@ -100,10 +100,10 @@
 	if (*x1 > x + width || *y1 > y + height || *x2 < x || *y2 < y)
 		return FALSE;
 
-	*x1 = CLAMP (*x1, x, x + width -1);
-	*x2 = CLAMP (*x2, x, x + width -1);
-	*y1 = CLAMP (*y1, y, y + height -1);
-	*y2 = CLAMP (*y2, y, y + height -1);
+	*x1 = CLAMP (*x1, x, x + width );
+	*x2 = CLAMP (*x2, x, x + width );
+	*y1 = CLAMP (*y1, y, y + height );
+	*y2 = CLAMP (*y2, y, y + height );
 
 	return TRUE;
 }
Index: htmlengine-edit.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlengine-edit.c,v
retrieving revision 1.98
diff -u -r1.98 htmlengine-edit.c
--- htmlengine-edit.c	20 May 2003 18:25:14 -0000	1.98
+++ htmlengine-edit.c	31 Jul 2003 02:21:26 -0000
@@ -92,7 +92,7 @@
 {
 	g_return_if_fail (e != NULL);
 	g_return_if_fail (HTML_IS_ENGINE (e));
-	g_return_if_fail (e->editable);
+	g_return_if_fail (e->editable || e->caret_mode);
 
 	if (e->mark != NULL)
 		html_engine_unselect_all (e);
Index: htmlengine.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlengine.c,v
retrieving revision 1.564
diff -u -r1.564 htmlengine.c
--- htmlengine.c	30 Jul 2003 21:26:42 -0000	1.564
+++ htmlengine.c	31 Jul 2003 02:21:27 -0000
@@ -4767,7 +4767,7 @@
 	}
 	html_painter_end (e->painter);
 	
-	if (e->editable)
+	if (e->editable || e->caret_mode)
 		html_engine_draw_cursor_in_area (e, x1, y1, x2 - x1, y2 - y1);
 
 	e->expose = FALSE;
Index: htmlselection.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlselection.c,v
retrieving revision 1.26
diff -u -r1.26 htmlselection.c
--- htmlselection.c	6 Nov 2002 09:15:24 -0000	1.26
+++ htmlselection.c	31 Jul 2003 02:21:27 -0000
@@ -242,7 +242,7 @@
 static void
 remove_mark (HTMLEngine *e)
 {
-	if (e->editable) {
+	if (e->editable || e->caret_mode) {
 		if (e->mark == NULL)
 			return;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]