[Gnucash-changes] r11892 - gnucash/trunk - Scott Oonk's patch to simplify the keyboard selection in

David Hampton hampton at cvs.gnucash.org
Wed Nov 9 17:38:09 EST 2005


Author: hampton
Date: 2005-11-09 17:38:08 -0500 (Wed, 09 Nov 2005)
New Revision: 11892

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/register/register-gnome/gnucash-sheet.c
Log:
Scott Oonk's patch to simplify the keyboard selection in
gnucash-sheet.  Fixes a problem where selection does not work
correctly when holding 'shift' and hitting the left arrow key.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2005-11-09 22:34:26 UTC (rev 11891)
+++ gnucash/trunk/ChangeLog	2005-11-09 22:38:08 UTC (rev 11892)
@@ -1,5 +1,10 @@
 2005-11-09  Scott Oonk  <scott.oonk at gmail.com>
 
+	* src/register/register-gnome/gnucash-sheet.c: This patch
+	simplifies the keyboard selection in gnucash-sheet.  Fixes a
+	problem where selection does not work correctly when holding
+	'shift' and hitting the left arrow key.
+	
 	* src/register/register-gnome/gnucash-item-edit.[ch]: This patch
 	simplifies the mouse selection logic in gnucash-item-edit.  It
 	also fixes a problem where selection with the mouse does not work

Modified: gnucash/trunk/src/register/register-gnome/gnucash-sheet.c
===================================================================
--- gnucash/trunk/src/register/register-gnome/gnucash-sheet.c	2005-11-09 22:34:26 UTC (rev 11891)
+++ gnucash/trunk/src/register/register-gnome/gnucash-sheet.c	2005-11-09 22:38:08 UTC (rev 11892)
@@ -1567,7 +1567,6 @@
 	CellBlock *header;
 	gboolean pass_on = FALSE;
         gboolean abort_move;
-        gboolean set_selection = TRUE;
         VirtualLocation cur_virt_loc;
         VirtualLocation new_virt_loc;
 	gncTableTraversalDir direction = 0;
@@ -1667,7 +1666,6 @@
 		case GDK_Alt_L:
 		case GDK_Alt_R:
                         pass_on = TRUE;
-                        set_selection = FALSE;
                         break;
 		default:
                         if (gnucash_sheet_clipboard_event(sheet, event))
@@ -1688,65 +1686,13 @@
                                         break;
                         }
 
-                        if (event->length > 0)
-                                set_selection = FALSE;
-
 			break;
         }
 
 	/* Forward the keystroke to the input line */
 	if (pass_on)
-        {
-                GtkEditable *editable;
-                gboolean extend_selection;
-                gboolean result;
-                gint current_pos;
-                gint start_sel;
-                gint end_sel;
-                gint new_pos;
+		return gtk_widget_event (sheet->entry, (GdkEvent *) event);
 
-                editable = GTK_EDITABLE(sheet->entry);
-
-                current_pos = gtk_editable_get_position (editable);
-
-                extend_selection = event->state & GDK_SHIFT_MASK;
-                if (extend_selection && set_selection)
-                {
-			gtk_editable_get_selection_bounds (editable, &start_sel, &end_sel);
-                }
-                else
-                {
-                        start_sel = 0;
-                        end_sel = 0;
-                }
-
-                sheet->input_cancelled = FALSE;
-
-		result = gtk_widget_event (sheet->entry, (GdkEvent *) event);
-
-                sheet->input_cancelled = FALSE;
-
-                new_pos = gtk_editable_get_position (editable);
-
-                if (extend_selection && set_selection)
-                {
-                        if (start_sel == end_sel)
-                        {
-                                start_sel = current_pos;
-                                end_sel = new_pos;
-                        }
-                        else if (current_pos == start_sel)
-                                start_sel = new_pos;
-                        else
-                                end_sel = new_pos;
-                }
-
-                if (set_selection && (start_sel != end_sel))
-                        gtk_editable_select_region(editable, start_sel, end_sel);
-
-                return result;
-        }
-
 	abort_move = gnc_table_traverse_update (table, cur_virt_loc,
                                                 direction, &new_virt_loc);
 



More information about the gnucash-changes mailing list