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
31 int Alert::prompt(docstring const & title, docstring const & question,
32 int default_button, int escape_button,
33 docstring const & b1, docstring const & b2, docstring const & b3)
35 if (!lyx::use_gui || lyxerr.debugging()) {
36 lyxerr << lyx::to_utf8(title) << '\n'
37 << "----------------------------------------\n"
38 << lyx::to_utf8(question) << endl;
40 lyxerr << "Assuming answer is ";
41 switch (default_button) {
42 case 0: lyxerr << lyx::to_utf8(b1) << endl;
43 case 1: lyxerr << lyx::to_utf8(b2) << endl;
44 case 2: lyxerr << lyx::to_utf8(b3) << endl;
47 return default_button;
50 return prompt_pimpl(title, question,
51 default_button, escape_button, b1, b2, b3);
56 void Alert::warning(docstring const & title, docstring const & message)
58 if (!lyx::use_gui || lyxerr.debugging())
59 lyxerr << "Warning: " << lyx::to_utf8(title) << '\n'
60 << "----------------------------------------\n"
61 << lyx::to_utf8(message) << endl;
63 warning_pimpl(title, message);
67 void Alert::error(docstring const & title, docstring const & message)
69 if (!lyx::use_gui || lyxerr.debugging())
70 lyxerr << "Error: " << lyx::to_utf8(title) << '\n'
71 << "----------------------------------------\n"
72 << lyx::to_utf8(message) << endl;
75 error_pimpl(title, message);
79 void Alert::information(docstring const & title, docstring const & message)
81 if (!lyx::use_gui || lyxerr.debugging())
82 lyxerr << lyx::to_utf8(title) << '\n'
83 << "----------------------------------------\n"
84 << lyx::to_utf8(message) << endl;
87 information_pimpl(title, message);
91 pair<bool, docstring> const Alert::askForText(docstring const & msg,
92 docstring const & dflt)
94 if (!lyx::use_gui || lyxerr.debugging()) {
95 lyxerr << "----------------------------------------\n"
96 << lyx::to_utf8(msg) << '\n'
97 << "Assuming answer is " << lyx::to_utf8(dflt) << '\n'
98 << "----------------------------------------" << endl;
100 return make_pair<bool, docstring>(true, dflt);
103 return askForText_pimpl(msg, dflt);