27 #include <glib/gi18n.h> 29 #include "dialog-options.hpp" 30 #include "dialog-report-column-view.hpp" 38 #include "swig-runtime.h" 39 #include "gnc-guile-utils.h" 41 #include "window-report.h" 42 #include "guile-mappings.h" 45 #include "gnc-report.h" 52 reportWindow(
int report_id, GtkWindow *parent)
54 gnc_set_busy_cursor (
nullptr, TRUE);
55 gnc_main_window_open_report(report_id, GNC_MAIN_WINDOW(parent));
56 gnc_unset_busy_cursor (
nullptr);
75 SCM dirty_report = scm_c_eval_string(
"gnc:report-set-dirty?!");
80 for (
auto iter = results; iter; iter = iter->next)
82 auto dialog = gtk_message_dialog_new(GTK_WINDOW (win->win),
83 static_cast<GtkDialogFlags>(0),
88 gtk_dialog_run(GTK_DIALOG(dialog));
89 gtk_widget_destroy(dialog);
92 g_list_free (results);
94 scm_call_2(dirty_report, win->cur_report, SCM_BOOL_T);
103 auto parent = prm->win->get_widget();
104 auto dialog = gtk_message_dialog_new(GTK_WINDOW(parent),
105 GTK_DIALOG_DESTROY_WITH_PARENT,
109 _(
"Set the report options you want using this dialog."));
110 g_signal_connect(G_OBJECT(dialog),
"response",
111 (GCallback)gtk_widget_destroy,
nullptr);
112 gtk_widget_show(dialog);
120 SCM set_editor = scm_c_eval_string(
"gnc:report-set-editor-widget!");
122 scm_call_2(set_editor, win->cur_report, SCM_BOOL_F);
129 gnc_report_raise_editor(SCM report)
131 SCM get_editor = scm_c_eval_string(
"gnc:report-editor-widget");
132 SCM editor = scm_call_1(get_editor, report);
133 if (editor != SCM_BOOL_F)
135 #define FUNC_NAME "gnc-report-raise-editor" 136 auto w{
static_cast<GtkWidget *
>(SWIG_MustGetPtr(editor, SWIG_TypeQuery(
"_p_GtkWidget"), 1, 0))};
138 gtk_window_present(GTK_WINDOW(w));
147 gnc_report_window_default_params_editor(
GncOptionDB* odb, SCM report,
150 SCM get_report_type = scm_c_eval_string(
"gnc:report-type");
151 SCM get_template = scm_c_eval_string(
"gnc:find-report-template");
152 SCM get_template_name = scm_c_eval_string(
"gnc:report-template-name");
155 const gchar *title =
nullptr;
157 if (gnc_report_raise_editor (report))
165 prm->cur_report = report;
168 ptr = scm_call_1(get_report_type, report);
169 if (ptr != SCM_BOOL_F)
171 ptr = scm_call_1(get_template, ptr);
172 if (ptr != SCM_BOOL_F)
174 ptr = scm_call_1(get_template_name, ptr);
175 if (scm_is_string(ptr))
176 title = gnc_scm_to_utf8_string (ptr);
181 prm->win =
new GncOptionsDialog((gchar*) (title && *title ? _(title) :
""), parent);
183 g_free ((gpointer *) title);
185 scm_gc_protect_object(prm->cur_report);
187 prm->win->build_contents(prm->odb);
189 prm->win->set_apply_cb(gnc_options_dialog_apply_cb, (gpointer)prm);
190 prm->win->set_help_cb(gnc_options_dialog_help_cb, (gpointer)prm);
191 prm->win->set_close_cb(gnc_options_dialog_close_cb, (gpointer)prm);
192 return prm->win->get_widget();
197 gnc_report_edit_options(SCM report, GtkWindow *parent)
199 SCM set_editor = scm_c_eval_string(
"gnc:report-set-editor-widget!");
200 SCM get_report_type = scm_c_eval_string(
"gnc:report-type");
203 GtkWidget *options_widget =
nullptr;
206 if (gnc_report_raise_editor (report))
210 odb = gnc_get_report_optiondb(report);
213 gnc_warning_dialog (parent,
"%s",
214 _(
"There are no options for this report."));
219 ptr = scm_call_1(get_report_type, report);
220 if (scm_is_string(ptr))
222 gchar *rpt_type = gnc_scm_to_utf8_string (ptr);
223 if (g_strcmp0 (rpt_type,
"d8ba4a2e89e8479ca9f6eccdeb164588") == 0)
224 options_widget = gnc_column_view_edit_options (odb, report);
226 options_widget = gnc_report_window_default_params_editor (odb, report, parent);
231 #define FUNC_NAME "gnc-report-edit-options" 232 ptr = SWIG_NewPointerObj (options_widget, SWIG_TypeQuery(
"_p_GtkWidget"), 0);
234 scm_call_2 (set_editor, report, ptr);
240 gnc_get_report_optiondb(SCM report_instance)
242 SCM get_report_options = scm_c_eval_string(
"gnc:report-options");
243 auto scm_dispatch{scm_call_1(get_report_options, report_instance)};
244 return gnc_get_optiondb_from_dispatcher(scm_dispatch);
Holds all of the options for a book, report, or stylesheet, organized by GncOptionSections.
void gnc_option_db_destroy(GncOptionDB *odb)
Destruct and release a GncOptionDB.
GList * gnc_option_db_commit(GncOptionDB *odb)
Write all changed ui_item values to their options.