[gnumeric] fix first expression entry in solver dialog



commit bcb34f4da3efd454479f35a3b1cbb747e381f3d7
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Mon Jun 21 20:48:20 2010 -0600

    fix first expression entry in solver dialog
    
    2010-06-21  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* dialog-solver.c (dialog_init): setup first entry

 src/dialogs/ChangeLog       |    4 ++++
 src/dialogs/dialog-solver.c |   11 +++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 7505476..fa9df69 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,5 +1,9 @@
 2010-06-21  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* dialog-solver.c (dialog_init): setup first entry
+
+2010-06-21  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* dialog-formula-guru.c (real_start_editing_cb): deleted
 	(start_editing_cb): include real_start_editing_cb here 
 	  (removes gtk 2.2 hack)
diff --git a/src/dialogs/dialog-solver.c b/src/dialogs/dialog-solver.c
index 8705241..4502da3 100644
--- a/src/dialogs/dialog-solver.c
+++ b/src/dialogs/dialog-solver.c
@@ -42,6 +42,7 @@
 #include <ranges.h>
 #include <commands.h>
 #include <clipboard.h>
+#include <selection.h>
 #include <tools/gnm-solver.h>
 #include <widgets/gnumeric-expr-entry.h>
 
@@ -906,6 +907,7 @@ dialog_init (SolverState *state)
 	GnmCell *target_cell;
 	GnmValue const *input;
 	int i;
+	GnmRange const *first;
 
 	param = state->sheet->solver_parameters;
 
@@ -1146,7 +1148,16 @@ dialog_init (SolverState *state)
 			    param->options.scenario_name);
 
 /* Done */
+	first = selection_first_range 
+		(wb_control_cur_sheet_view 
+		 (WORKBOOK_CONTROL (state->wbcg)), NULL, NULL);
+	if (first != NULL) {
+		gnm_expr_entry_load_from_range (state->target_entry,
+						state->sheet, first);
+	}
+	
 	gnm_expr_entry_grab_focus (state->target_entry, FALSE);
+	wbcg_set_entry (state->wbcg, state->target_entry);
 
 	dialog_set_main_button_sensitivity (NULL, state);
 	dialog_set_sec_button_sensitivity (NULL, state);



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