3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
14 #include "Alert_pimpl.h"
17 #include "lyx_main.h" // for lyx::use_gui
29 int Alert::prompt(docstring const & title, docstring const & question,
30 int default_button, int escape_button,
31 docstring const & b1, docstring const & b2, docstring const & b3)
33 if (!use_gui || lyxerr.debugging()) {
34 lyxerr << to_utf8(title) << '\n'
35 << "----------------------------------------\n"
36 << to_utf8(question) << endl;
38 lyxerr << "Assuming answer is ";
39 switch (default_button) {
40 case 0: lyxerr << to_utf8(b1) << endl;
41 case 1: lyxerr << to_utf8(b2) << endl;
42 case 2: lyxerr << to_utf8(b3) << endl;
45 return default_button;
48 return prompt_pimpl(title, question,
49 default_button, escape_button, b1, b2, b3);
54 void Alert::warning(docstring const & title, docstring const & message)
56 if (!use_gui || lyxerr.debugging())
57 lyxerr << "Warning: " << to_utf8(title) << '\n'
58 << "----------------------------------------\n"
59 << to_utf8(message) << endl;
61 warning_pimpl(title, message);
65 void Alert::error(docstring const & title, docstring const & message)
67 if (!use_gui || lyxerr.debugging())
68 lyxerr << "Error: " << to_utf8(title) << '\n'
69 << "----------------------------------------\n"
70 << to_utf8(message) << endl;
73 error_pimpl(title, message);
77 void Alert::information(docstring const & title, docstring const & message)
79 if (!use_gui || lyxerr.debugging())
80 lyxerr << to_utf8(title) << '\n'
81 << "----------------------------------------\n"
82 << to_utf8(message) << endl;
85 information_pimpl(title, message);
89 pair<bool, docstring> const Alert::askForText(docstring const & msg,
90 docstring const & dflt)
92 if (!use_gui || lyxerr.debugging()) {
93 lyxerr << "----------------------------------------\n"
94 << to_utf8(msg) << '\n'
95 << "Assuming answer is " << to_utf8(dflt) << '\n'
96 << "----------------------------------------" << endl;
98 return make_pair<bool, docstring>(true, dflt);
101 return askForText_pimpl(msg, dflt);
104 } // namespace frontend