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.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 lyxerr << "Warning: " << to_utf8(title) << '\n'
57 << "----------------------------------------\n"
58 << to_utf8(message) << endl;
61 warning_pimpl(title, message);
65 void Alert::error(docstring const & title, docstring const & message)
67 lyxerr << "Error: " << to_utf8(title) << '\n'
68 << "----------------------------------------\n"
69 << to_utf8(message) << endl;
72 error_pimpl(title, message);
76 void Alert::information(docstring const & title, docstring const & message)
78 if (!use_gui || lyxerr.debugging())
79 lyxerr << to_utf8(title) << '\n'
80 << "----------------------------------------\n"
81 << to_utf8(message) << endl;
84 information_pimpl(title, message);
88 pair<bool, docstring> const Alert::askForText(docstring const & msg,
89 docstring const & dflt)
91 if (!use_gui || lyxerr.debugging()) {
92 lyxerr << "----------------------------------------\n"
93 << to_utf8(msg) << '\n'
94 << "Assuming answer is " << to_utf8(dflt) << '\n'
95 << "----------------------------------------" << endl;
97 return make_pair<bool, docstring>(true, dflt);
100 return askForText_pimpl(msg, dflt);
103 } // namespace frontend