Commit 5a343f12 authored by Andreas J. Guelzow's avatar Andreas J. Guelzow Committed by Andreas J. Guelzow
Browse files

make gnome2 compatible new callback (solver_notice) : wrapper around

2002-01-27  Andreas J. Guelzow <aguelzow@taliesin.ca>

	* solver.glade : make gnome2 compatible
	* dialog-solver.c (solver_destroy_warning) : new callback
	(solver_notice) : wrapper around gnumeric_notice_nonmodal
	(cb_dialog_solve_clicked) : destroy outdated warnings dialog and
	  change calls from gnumeric_notice to solver_notice
	(dialog_solver) : initialize state->warnings_dialog
parent 77ccd622
......@@ -8,6 +8,8 @@ Andreas:
* Make the autocorrect dialog non-modal, port to gnome2
* Fix gnome2 specific random tool crash
* Destroy outadated dialogs
* Port solver dialog to gnome2
* Make the solver information dialogs non-modal
Jody:
* Initial port to gnome2.
......
2002-01-27 Andreas J. Guelzow <aguelzow@taliesin.ca>
* solver.glade : make gnome2 compatible
* dialog-solver.c (solver_destroy_warning) : new callback
(solver_notice) : wrapper around gnumeric_notice_nonmodal
(cb_dialog_solve_clicked) : destroy outdated warnings dialog and
change calls from gnumeric_notice to solver_notice
(dialog_solver) : initialize state->warnings_dialog
2002-01-27 Andreas J. Guelzow <aguelzow@taliesin.ca>
* dialog-analysis-tools.c (sampling_tool_ok_clicked_cb) :
......
......@@ -52,6 +52,7 @@ typedef struct {
GSList *ov;
GSList *ov_stack;
GSList *ov_cell_stack;
GtkWidget *warning_dialog;
Sheet *sheet;
Workbook *wb;
......@@ -99,6 +100,45 @@ static const char *problem_type_group[] = {
0
};
/**
* warning_destroy:
* @window:
* @state:
*
* Destroy the dialog and NULL the field in the state structure.
*
**/
static gboolean
solver_destroy_warning (GtkObject *w, SolverState *state)
{
g_return_val_if_fail (w != NULL, FALSE);
g_return_val_if_fail (state != NULL, FALSE);
state->warning_dialog = NULL;
return FALSE;
}
/**
* :
* @state:
* @type:
* @str;
*
**/
static void
solver_notice (SolverState *state, GtkMessageType type, const char *str)
{
if (state->warning_dialog != NULL)
gtk_widget_destroy (state->warning_dialog);
state->warning_dialog = GTK_WIDGET (gnumeric_notice_nonmodal ((GtkWindow *) state->dialog,
type, str));
gtk_signal_connect (GTK_OBJECT (state->warning_dialog), "destroy",
GTK_SIGNAL_FUNC (solver_destroy_warning), state);
}
/**
* is_hom_row_or_col_ref:
* @Widget:
......@@ -742,6 +782,9 @@ cb_dialog_solve_clicked (GtkWidget *button, SolverState *state)
gint i;
gboolean answer, sensitivity, limits;
if (state->warning_dialog != NULL)
gtk_widget_destroy (state->warning_dialog);
pos = g_new (EvalPos, 1);
pos = eval_pos_init(pos, state->sheet, &cellpos);
......@@ -808,7 +851,7 @@ cb_dialog_solve_clicked (GtkWidget *button, SolverState *state)
state->sheet, &opt_x, &sh_pr, &ilp);
workbook_recalc (state->sheet->workbook);
if (res == SOLVER_LP_OPTIMAL) {
gnumeric_notice (state->wbcg,
solver_notice (state,
GTK_MESSAGE_INFO,
_("Solver found an optimal solution. All "
"constraints and optimality conditions "
......@@ -824,7 +867,7 @@ cb_dialog_solve_clicked (GtkWidget *button, SolverState *state)
(_("Solver was not successful:"
" %i"), res);
}
gnumeric_notice (state->wbcg, GTK_MESSAGE_WARNING, str);
solver_notice (state, GTK_MESSAGE_WARNING, str);
g_free (str);
}
......@@ -845,7 +888,7 @@ cb_dialog_solve_clicked (GtkWidget *button, SolverState *state)
str = g_strdup_printf
(_("Constraint `%s' is for a cell that "
"is not an input cell."), s);
gnumeric_notice (state->wbcg, GTK_MESSAGE_ERROR, str);
solver_notice (state, GTK_MESSAGE_ERROR, str);
g_free (str);
}
......@@ -1090,6 +1133,7 @@ dialog_solver (WorkbookControlGUI *wbcg, Sheet *sheet)
state->ov = NULL;
state->ov_stack = NULL;
state->ov_cell_stack = NULL;
state->warning_dialog = NULL;
if (dialog_init (state)) {
gnumeric_notice (wbcg, GTK_MESSAGE_ERROR,
......
......@@ -24,12 +24,6 @@
<property name="spacing">5</property>
<property name="visible">yes</property>
<child>
<widget class="GtkHButtonBox" id="hbuttonbox1">
<property name="layout_style">GTK_BUTTONBOX_END</property>
<property name="spacing">30</property>
<property name="visible">yes</property>
<child>
<widget class="GtkButton" id="solvebutton">
<property name="can_default">yes</property>
......@@ -75,13 +69,6 @@
<property name="use_underline">yes</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">yes</property>
<property name="fill">yes</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
......@@ -305,7 +292,7 @@
<child>
<widget class="GtkCList" id="constraint_list">
<property name="can_focus">yes</property>
<property name="columns">1</property>
<property name="n-columns">1</property>
<property name="column_widths">80</property>
<property name="selection_mode">GTK_SELECTION_SINGLE</property>
<property name="show_titles">yes</property>
......@@ -314,7 +301,6 @@
<child>
<widget class="GtkLabel" id="label4">
<property name="visible">no</property>
<property name="label" translatable="yes">Subject to the Constraints:</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">no</property>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment