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"
30 int Alert::prompt(docstring const & title, docstring const & question,
31 int default_button, int escape_button,
32 docstring const & b1, docstring const & b2, docstring const & b3)
34 if (!lyx_gui::use_gui || lyxerr.debugging()) {
35 lyxerr << lyx::to_utf8(title) << '\n'
36 << "----------------------------------------\n"
37 << lyx::to_utf8(question) << endl;
39 lyxerr << "Assuming answer is ";
40 switch (default_button) {
41 case 0: lyxerr << lyx::to_utf8(b1) << endl;
42 case 1: lyxerr << lyx::to_utf8(b2) << endl;
43 case 2: lyxerr << lyx::to_utf8(b3) << endl;
45 if (!lyx_gui::use_gui)
46 return default_button;
49 return prompt_pimpl(title, question,
50 default_button, escape_button, b1, b2, b3);
55 void Alert::warning(docstring const & title, docstring const & message)
57 if (!lyx_gui::use_gui || lyxerr.debugging())
58 lyxerr << "Warning: " << lyx::to_utf8(title) << '\n'
59 << "----------------------------------------\n"
60 << lyx::to_utf8(message) << endl;
62 warning_pimpl(title, message);
66 void Alert::error(docstring const & title, docstring const & message)
68 if (!lyx_gui::use_gui || lyxerr.debugging())
69 lyxerr << "Error: " << lyx::to_utf8(title) << '\n'
70 << "----------------------------------------\n"
71 << lyx::to_utf8(message) << endl;
74 error_pimpl(title, message);
78 void Alert::information(docstring const & title, docstring const & message)
80 if (!lyx_gui::use_gui || lyxerr.debugging())
81 lyxerr << lyx::to_utf8(title) << '\n'
82 << "----------------------------------------\n"
83 << lyx::to_utf8(message) << endl;
86 information_pimpl(title, message);
90 pair<bool, docstring> const Alert::askForText(docstring const & msg,
91 docstring const & dflt)
93 if (!lyx_gui::use_gui || lyxerr.debugging()) {
94 lyxerr << "----------------------------------------\n"
95 << lyx::to_utf8(msg) << '\n'
96 << "Assuming answer is " << lyx::to_utf8(dflt) << '\n'
97 << "----------------------------------------" << endl;
98 if (!lyx_gui::use_gui)
99 return make_pair<bool, docstring>(true, dflt);
102 return askForText_pimpl(msg, dflt);