[Gnucash-changes] Re-add text-selection via mouse-drag.

Joshua Sled jsled at cvs.gnucash.org
Wed Dec 15 23:19:32 EST 2004


Log Message:
-----------
Re-add text-selection via mouse-drag.

2004-12-15  Joshua Sled  <jsled at asynchronous.org>

	* src/register/register-gnome/gnucash-item-edit.c
	(gnc_item_edit_set_cursor_pos): Re-add
	text-selection-via-mouse-drag support [still buggy in multiple
	ways; see GNOME2_STATUS for updates].

	* GNOME2_STATUS: Update status.

Tags:
----
gnucash-gnome2-dev

Modified Files:
--------------
    gnucash:
        ChangeLog
        GNOME2_STATUS
    gnucash/src/register/register-gnome:
        gnucash-item-edit.c

Revision Data
-------------
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/ChangeLog,v
retrieving revision 1.1487.2.145
retrieving revision 1.1487.2.146
diff -LChangeLog -LChangeLog -u -r1.1487.2.145 -r1.1487.2.146
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,12 @@
+2004-12-15  Joshua Sled  <jsled at asynchronous.org>
+
+	* src/register/register-gnome/gnucash-item-edit.c
+	(gnc_item_edit_set_cursor_pos): Re-add
+	text-selection-via-mouse-drag support [still buggy in multiple
+	ways; see GNOME2_STATUS for updates].
+
+	* GNOME2_STATUS: Update status. 
+
 2004-12-14  Joshua Sled  <jsled at asynchronous.org>
 
 	* src/business/business-gnome/business-gnome.scm
Index: GNOME2_STATUS
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/Attic/GNOME2_STATUS,v
retrieving revision 1.1.2.28
retrieving revision 1.1.2.29
diff -LGNOME2_STATUS -LGNOME2_STATUS -u -r1.1.2.28 -r1.1.2.29
--- GNOME2_STATUS
+++ GNOME2_STATUS
@@ -73,16 +73,20 @@
         - New registers should open in new top-level windows.
 
 
-Register Core - MINIMALLY FUNCTIONAL
+Register Core - MOSTLY FUNCTIONAL
 
 	- Can navigate, enter transactions, etc.
 
 	- Insertion point not shown. (fix gnucash-item-edit.c)
-	- Cannot hilight text with mouse (fix gnucash-item-edit.c)
+	- <strike>Cannot hilight text with mouse (fix gnucash-item-edit.c)</strike>
+          - Getting better; x-position -> pango-text-index works; some gtk_entry selection works.
+          - Offset for non-LEFT_ALIGN'ed fields not correct.
+          - finer points of gtk_entry selection+position setting not correct, yet.
 
 	- The first time it is used, the account popup immediately
 	  selects the first account. After that it functions normally.
 
+        - The drop-down-arrow widgets for {date,action,account-sel} don't seem to be showing.
 
 Find - Somewhat Functional
 	- Can generate a query in the dialog.
@@ -99,7 +103,6 @@
           gnc_extensions_menu_setup( GtkWindow, char*, EggMenuMerge )
 
 Reporting - Somewhat functional
-
         - Graphing still unsupported; [jsled] in periodic contact with Jody
           Goldberg of Gnumeric regarding Gnome Office Graphing [GOG] to be
           factored out of gnumeric into libgoffice.
Index: gnucash-item-edit.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/register/register-gnome/gnucash-item-edit.c,v
retrieving revision 1.1.6.6
retrieving revision 1.1.6.7
diff -Lsrc/register/register-gnome/gnucash-item-edit.c -Lsrc/register/register-gnome/gnucash-item-edit.c -u -r1.1.6.6 -r1.1.6.7
--- src/register/register-gnome/gnucash-item-edit.c
+++ src/register/register-gnome/gnucash-item-edit.c
@@ -323,13 +323,6 @@
 }
 
 
-static int
-gnc_item_edit_event (GnomeCanvasItem *item, GdkEvent *event)
-{
-        return 0;
-}
-
-
 int
 gnc_item_edit_get_toggle_offset (int row_height)
 {
@@ -663,14 +656,13 @@
                           gboolean extend_selection)
 {
         GtkEditable *editable;
-        TextDrawInfo info;
+        // TextDrawInfo info;
         Table *table;
         gint pos = 0;
         gint o_x, o_y;
         CellDimensions *cd;
         gint cell_row, cell_col;
         SheetBlockStyle *style;
-/*        GdkWChar *text;*/
 
         g_return_val_if_fail (GNC_IS_ITEM_EDIT(item_edit), FALSE);
 
@@ -706,14 +698,29 @@
                         x -= item_edit->popup_toggle.toggle_offset;
         }
 
-        gnc_item_edit_draw_info (item_edit, o_x, o_y, &info);
+        // WTF!?  All the `pos` setting logic has been silently removed from
+        // this location.  Compare to 1.8 sources...  *grumble*
+        {
+                PangoLayout *pl;
+                int textIndex, textTrailing;
+                gboolean insideText;
+
+                pl = gtk_entry_get_layout( GTK_ENTRY(item_edit->editor) );
+                insideText = pango_layout_xy_to_index( pl, (x - o_x) * PANGO_SCALE,
+                                                       10 * PANGO_SCALE, &textIndex, &textTrailing );
+                pos = textIndex;
+        }
+
+        // I think we can remove the TextDrawInfo-related stuff since Pango handles it, and better.
+        //gnc_item_edit_draw_info (item_edit, o_x, o_y, &info);
 
         if (extend_selection)
         {
+                gboolean selection_exists;
                 gint current_pos, start_sel, end_sel;
 
                 current_pos = gtk_editable_get_position (editable);
-		gtk_editable_get_selection_bounds (editable, &start_sel, &end_sel);
+		selection_exists = gtk_editable_get_selection_bounds (editable, &start_sel, &end_sel);
 
                 if (start_sel == end_sel)
                 {
@@ -721,25 +728,32 @@
                         end_sel = pos;
                 }
                 else if (current_pos == start_sel)
+                {
                         start_sel = pos;
+                }
                 else
+                {
                         end_sel = pos;
+                }
 
+                gtk_editable_set_position (editable, pos);
                 gtk_editable_select_region(editable, start_sel, end_sel);
+
+		selection_exists = gtk_editable_get_selection_bounds (editable, &start_sel, &end_sel);
         }
         else
+        {
                 gtk_editable_select_region(editable, 0, 0);
-
-        gtk_editable_set_position (editable, pos);
+                gtk_editable_set_position (editable, pos);
+        }
 
         queue_sync (item_edit);
 
-        gnc_item_edit_free_draw_info_members(&info);
+        //gnc_item_edit_free_draw_info_members(&info);
 
         return TRUE;
 }
 
-
 static int
 entry_event (GtkEntry *entry, GdkEvent *event, GncItemEdit *item_edit)
 {
@@ -758,7 +772,6 @@
         return FALSE;
 }
 
-
 static void
 gnc_item_edit_set_editor (GncItemEdit *item_edit, void *data)
 {
@@ -1177,7 +1190,7 @@
         item_class->point       = gnc_item_edit_point;
         item_class->realize     = gnc_item_edit_realize;
         item_class->unrealize   = gnc_item_edit_unrealize;
-        item_class->event       = gnc_item_edit_event;
+        //item_class->event       = gnc_item_edit_event;
 }
 
 
@@ -1680,3 +1693,5 @@
   c-basic-offset: 8
   End:
 */
+
+


More information about the gnucash-changes mailing list