[gnumeric] improve pasting of function names



commit 917e30d97379c7810607071c46e49a503b3ce168
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Wed Jul 21 02:11:27 2010 -0600

    improve pasting of function names
    
    2010-07-21  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* dialog-function-select.c (cb_dialog_function_select_paste_clicked): use the
    	  range passed if appropriate
    	(dialog_function_select_full): add arguments and save the passed range info,
    	  change all callers

 src/dialogs/ChangeLog                |    7 +++++++
 src/dialogs/dialog-function-select.c |   20 ++++++++++++++++----
 2 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 34152d5..d7cbe9a 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,10 @@
+2010-07-21  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* dialog-function-select.c (cb_dialog_function_select_paste_clicked): use the
+	  range passed if appropriate
+	(dialog_function_select_full): add arguments and save the passed range info,
+	  change all callers
+	
 2010-07-20  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* dialogs.h (dialog_function_select_paste): add arguments
diff --git a/src/dialogs/dialog-function-select.c b/src/dialogs/dialog-function-select.c
index 34c05f0..8293841 100644
--- a/src/dialogs/dialog-function-select.c
+++ b/src/dialogs/dialog-function-select.c
@@ -80,6 +80,11 @@ typedef struct {
 
 	GSList *recent_funcs;
 
+	struct {
+		gint from;
+		gint to;
+	} paste;
+
 	mode_t      mode;
 	char const *formula_guru_key;
 } FunctionSelectState;
@@ -399,6 +404,10 @@ cb_dialog_function_select_paste_clicked (G_GNUC_UNUSED GtkWidget *button,
 				    -1);
 		if (func != NULL) {
 			dialog_function_write_recent_func (state, func);
+			if (state->paste.from >= 0)
+				gtk_editable_select_region 
+					(entry, state->paste.from,
+					 state->paste.to);
 			gtk_editable_delete_selection (entry);
 			position = gtk_editable_get_position (entry);
 			gtk_editable_insert_text 
@@ -1313,7 +1322,8 @@ dialog_function_select_init (FunctionSelectState *state)
 }
 
 static void
-dialog_function_select_full (WBCGtk *wbcg, char const *guru_key, char const *key, mode_t mode)
+dialog_function_select_full (WBCGtk *wbcg, char const *guru_key, 
+			     char const *key, mode_t mode, gint from, gint to)
 {
 	FunctionSelectState* state;
 	GladeXML  *gui;
@@ -1336,6 +1346,8 @@ dialog_function_select_full (WBCGtk *wbcg, char const *guru_key, char const *key
 	state->formula_guru_key = guru_key;
         state->recent_funcs = NULL;
 	state->mode  = mode;
+	state->paste.from = from;
+	state->paste.to = to;
 
 	dialog_function_select_init (state);
 	gnumeric_keyed_dialog (state->wbcg, GTK_WINDOW (state->dialog),
@@ -1348,19 +1360,19 @@ void
 dialog_function_select (WBCGtk *wbcg, char const *key)
 {
 	dialog_function_select_full (wbcg, key, 
-				     FUNCTION_SELECT_KEY, GURU_MODE);	
+				     FUNCTION_SELECT_KEY, GURU_MODE, -1, -1);	
 }
 
 void
 dialog_function_select_help (WBCGtk *wbcg)
 {
 	dialog_function_select_full (wbcg, NULL, 
-				     FUNCTION_SELECT_HELP_KEY, HELP_MODE);
+				     FUNCTION_SELECT_HELP_KEY, HELP_MODE, -1, -1);
 }
 
 void
 dialog_function_select_paste (WBCGtk *wbcg, gint from, gint to)
 {
 	dialog_function_select_full (wbcg, NULL, 
-				     FUNCTION_SELECT_PASTE_KEY, PASTE_MODE);
+				     FUNCTION_SELECT_PASTE_KEY, PASTE_MODE, from, to);
 }



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