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"
27 int Alert::prompt(docstring const & title, docstring const & question,
28 int default_button, int escape_button,
29 docstring const & b1, docstring const & b2, docstring const & b3)
31 if (!lyx_gui::use_gui || lyxerr.debugging()) {
32 lyxerr << lyx::to_utf8(title) << '\n'
33 << "----------------------------------------\n"
34 << lyx::to_utf8(question) << endl;
36 lyxerr << "Assuming answer is ";
37 switch (default_button) {
38 case 0: lyxerr << lyx::to_utf8(b1) << endl;
39 case 1: lyxerr << lyx::to_utf8(b2) << endl;
40 case 2: lyxerr << lyx::to_utf8(b3) << endl;
42 if (!lyx_gui::use_gui)
43 return default_button;
46 return prompt_pimpl(title, question,
47 default_button, escape_button, b1, b2, b3);
52 void Alert::warning(docstring const & title, docstring const & message)
54 if (!lyx_gui::use_gui || lyxerr.debugging())
55 lyxerr << "Warning: " << lyx::to_utf8(title) << '\n'
56 << "----------------------------------------\n"
57 << lyx::to_utf8(message) << endl;
59 warning_pimpl(title, message);
63 void Alert::error(docstring const & title, docstring const & message)
65 if (!lyx_gui::use_gui || lyxerr.debugging())
66 lyxerr << "Error: " << lyx::to_utf8(title) << '\n'
67 << "----------------------------------------\n"
68 << lyx::to_utf8(message) << endl;
71 error_pimpl(title, message);
75 void Alert::information(docstring const & title, docstring const & message)
77 if (!lyx_gui::use_gui || lyxerr.debugging())
78 lyxerr << lyx::to_utf8(title) << '\n'
79 << "----------------------------------------\n"
80 << lyx::to_utf8(message) << endl;
83 information_pimpl(title, message);
87 pair<bool, docstring> const Alert::askForText(docstring const & msg,
88 docstring const & dflt)
90 if (!lyx_gui::use_gui || lyxerr.debugging()) {
91 lyxerr << "----------------------------------------\n"
92 << lyx::to_utf8(msg) << '\n'
93 << "Assuming answer is " << lyx::to_utf8(dflt) << '\n'
94 << "----------------------------------------" << endl;
95 if (!lyx_gui::use_gui)
96 return make_pair<bool, docstring>(true, dflt);
99 return askForText_pimpl(msg, dflt);