1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
7 * Jukka-Pekka Iivonen <jiivonen@hutcs.cs.hut.fi>
8 * Andreas J. Guelzow <aguelzow@taliesin.ca>
10 * (C) Copyright 2000, 2001 by Jukka-Pekka Iivonen <jiivonen@hutcs.cs.hut.fi>
11 * (C) Copyright 2001, 2002 by Andreas J. Guelzow <aguelzow@taliesin.ca>
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, see <https://www.gnu.org/licenses/>.
27 #include <gnumeric-config.h>
28 #include <glib/gi18n-lib.h>
29 #include "dao-gui-utils.h"
33 #include "selection.h"
34 #include <widgets/gnm-dao.h>
39 * dialog__tool_preset_to_range:
42 * Load selection into range and switch to output range
47 dialog_tool_preset_to_range (GnmGenericToolState
*state
)
52 g_return_if_fail (state
!= NULL
);
53 g_return_if_fail (state
->gdao
!= NULL
);
55 sel
= selection_first_range (state
->sv
, NULL
, NULL
);
56 gnm_dao_load_range (GNM_DAO (state
->gdao
), sel
);
57 gnm_dao_focus_output_range (GNM_DAO (state
->gdao
));
59 w
= go_gtk_builder_get_widget (state
->gui
, "notebook1");
60 g_return_if_fail (w
&& GTK_IS_NOTEBOOK (w
));
61 gtk_notebook_set_current_page (GTK_NOTEBOOK(w
), 0);
66 * dialog_tool_init_outputs: (skip)
70 * Setup the standard output information
74 dialog_tool_init_outputs (GnmGenericToolState
*state
, GCallback sensitivity_cb
)
78 dao_box
= go_gtk_builder_get_widget (state
->gui
, "dao");
80 if (dao_box
== NULL
) {
85 state
->gdao
= gnm_dao_new (state
->wbcg
, NULL
);
86 gtk_box_pack_start (GTK_BOX (dao_box
), state
->gdao
,
88 gtk_widget_show (state
->gdao
);
89 g_signal_connect_after (G_OBJECT (state
->gdao
),
91 G_CALLBACK (sensitivity_cb
), state
);
92 gnm_editable_enters (GTK_WINDOW (state
->dialog
),
93 GTK_WIDGET (state
->gdao
));
97 * parse_output: (skip)
101 * fill dao with information from the standard output section of a dialog
103 data_analysis_output_t
*
104 parse_output (GnmGenericToolState
*state
, data_analysis_output_t
*dao
)
106 data_analysis_output_t
*this_dao
= dao
;
108 gnm_dao_get_data (GNM_DAO (state
->gdao
), &this_dao
);
109 if (this_dao
->type
== InPlaceOutput
) {
110 GnmValue
*output_range
111 = gnm_expr_entry_parse_as_value (
112 state
->input_entry
, state
->sheet
);
113 dao_load_from_value (this_dao
, output_range
);
114 value_release (output_range
);