+2003-03-31 John Levon <levon@movementarian.org>
+
+ * bufferlist.C: "Load original" -> "Load Original"
+
+ * converter.C:
+ * exporter.C:
+ * importer.C:
+ * lyx_main.C:
+ * format.C: more Alert cleanups
+
2003-03-30 Lars Gullik Bjønnes <larsbj@gullik.net>
* text2.C (removeParagraph): make it take a RowList::iterator as
text += file + _(" exists.\n\nRecover emergency save?");
#endif
int const ret = Alert::prompt(_("Load emergency save?"),
- text, 0, _("&Recover"), _("&Load original"));
+ text, 0, _("&Recover"), _("&Load Original"));
if (ret == 0) {
ts = e;
Alert::error(_("Build errors"),
_("There were errors during the build process."));
} else {
- Alert::alert(_("Cannot convert file"),
- _("Error while executing"),
- command.substr(0, 50));
+#if USE_BOOST_FORMAT
+// FIXME: this should go out of here. For example, here we cannot say if
+// it is a document (.lyx) or something else. Same goes for elsewhere.
+ Alert::error(_("Cannot convert file"),
+ boost::io::str(boost::format(_("An error occurred whilst running %1$s"))
+ % command.substr(0, 50)));
+#else
+ Alert::error(_("Cannot convert file"),
+ _("An error occurred whilst running ")
+ + command.substr(0, 50));
+#endif
}
return false;
}
token_base, to_base);
if (!lyx::rename(from, to)) {
#if USE_BOOST_FORMAT
- Alert::alert(_("Error while trying to move directory:"),
- from, boost::io::str(boost::format(_("to %1$s")) % to));
+ Alert::error(_("Cannot convert file"),
+ boost::io::str(boost::format(_(
+ "Could not move a temporary file from %1$s to %2$s.")) % from % to));
#else
- Alert::alert(_("Error while trying to move directory:"),
- from, _("to ") + to);
+ Alert::error(_("Cannot convert file"),
+ _("Could not move a temporary file from ") + from + _(" to ") + to + ".");
#endif
return false;
}
: lyx::rename(from2, to2);
if (!moved && no_errors) {
#if USE_BOOST_FORMAT
- Alert::alert(_("Error while trying to move file:"),
- from2, boost::io::str(boost::format(_("to %1$s")) % to2));
+ Alert::error(_("Cannot convert file"),
+ boost::io::str(boost::format(_(
+ "Could not move a temporary file from %1$s to %2$s.")) % from2 % to2));
#else
- Alert::alert(_("Error while trying to move file:"),
- from2, _("to ") + to2);
+ Alert::error(_("Cannot convert file"),
+ _("Could not move a temporary file from ") + from2 + _(" to ") + to2 + ".");
#endif
no_errors = false;
}
// check return value from latex.run().
if ((result & LaTeX::NO_LOGFILE)) {
- Alert::alert(_("LaTeX did not work!"),
- _("Missing log file:"), name);
+ string str;
+#if USE_BOOST_FORMAT
+ boost::format fmt(_("LaTeX did not run successfully. Additionally, LyX "
+ "could not locate the LaTeX log %1$s."));
+ fmt % name;
+ str = fmt.str();
+#else
+ str += _("LaTeX did not run successfully. Additionally, LyX "
+ "could not locate the LaTeX log ");
+ str += name + ".";
+#endif
+ Alert::error(_("LaTeX failed"), str);
} else if ((result & LaTeX::ERRORS)) {
alertErrors("LaTeX", latex.getNumErrors());
} else if (result & LaTeX::NO_OUTPUT) {
-/* This file is part of
- * ======================================================
+/**
+ * \file exporter.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * LyX, The Document Processor
+ * \author unknown
*
- * Copyright 1995 Matthias Ettrich
- * Copyright 1995-2001 The LyX Team.
- *
- * ====================================================== */
+ * Full author contact details are available in file CREDITS
+ */
#include <config.h>
#include "buffer.h"
#include "lyx_cb.h" //ShowMessage()
#include "support/filetools.h"
+#include "support/BoostFormat.h"
#include "lyxrc.h"
#include "converter.h"
#include "format.h"
}
}
if (backend_format.empty()) {
- Alert::alert(_("Cannot export file"),
- _("No information for exporting to ")
- + formats.prettyName(format));
+#if USE_BOOST_FORMAT
+// FIXME: better english ...
+ Alert::error(_("Couldn't export file"),
+ boost::io::str(boost::format(_("No information for exporting the format %1$s."))
+ % formats.prettyName(format)));
+#else
+ Alert::error(_("Couldn't export file"),
+ _("No information for exporting the format ")
+ + formats.prettyName(format) + ".");
+#endif
return false;
}
} else
else if (backend_format == format)
buffer->makeLaTeXFile(filename, string(), true);
else if (contains(buffer->filePath(), ' ')) {
- Alert::alert(_("Cannot run LaTeX."),
- _("The path to the lyx file cannot contain spaces."));
+ Alert::error(_("File name error"),
+ _("The directory path to the document cannot contain spaces."));
return false;
} else
buffer->makeLaTeXFile(filename, buffer->filePath(), false);
format->isChildFormat())
format = getFormat(format->parentFormat());
if (!format || format->viewer().empty()) {
+// I believe this is the wrong place to show alerts, it should be done by
+// the caller (this should be "utility" code
#if USE_BOOST_FORMAT
- Alert::alert(_("Cannot view file"),
+ Alert::error(_("Cannot view file"),
boost::io::str(boost::format(_("No information for viewing %1$s"))
% prettyName(format_name)));
#else
- Alert::alert(_("Cannot view file"),
+ Alert::error(_("Cannot view file"),
_("No information for viewing ")
+ prettyName(format_name));
#endif
int const res = one.startscript(Systemcall::DontWait, command);
if (res) {
- Alert::alert(_("Cannot view file"),
- _("Error while executing"),
- command.substr(0, 50));
+#if USE_BOOST_FORMAT
+ Alert::error(_("Cannot view file"),
+ boost::io::str(boost::format(_("An error occurred whilst running %1$s"))
+ % command.substr(0, 50)));
+#else
+ Alert::error(_("Cannot view file"),
+ _("An error occurred whilst running ")
+ + command.substr(0, 50));
+#endif
return false;
}
return true;
using std::pair;
using std::make_pair;
-void Alert::alert(string const & s1, string const & s2, string const & s3)
-{
- if (!lyxrc.use_gui) {
- lyxerr << "------------------------------" << endl
- << s1 << endl << s2 << endl << s3 << endl
- << "------------------------------" << endl;
- } else {
- alert_pimpl(s1, s2, s3);
- }
-}
-
-
int Alert::prompt(string const & title, string const & question,
int default_button,
string const & b1, string const & b2, string const & b3)
string const & b1, string const & b2, string const & b3 = string());
/**
- * Display a warning to the user. Title should be a short summary.
+ * Display a warning to the user. Title should be a short (general) summary.
* Only use this if the user cannot perform some remedial action.
*/
void warning(string const & title, string const & message);
/**
- * Display a warning to the user. Title should be a short summary.
+ * Display a warning to the user. Title should be a short (general) summary.
* Only use this if the user cannot perform some remedial action.
*/
void error(string const & title, string const & message);
*/
void information(string const & title, string const & message);
-/// show an alert message. DO NOT USE !!
-void alert(string const & title, string const & s1 = string(),
- string const & s2 = string());
-
/// Asks for a text. DO NOT USE !!
std::pair<bool, string> const
askForText(string const & msg,
// GUI-specific implementations
-void alert_pimpl(string const & s1, string const & s2, string const & s3);
-
int prompt_pimpl(string const & title, string const & question,
int default_button,
string const & b1, string const & b2, string const & b3);
+2003-03-31 John Levon <levon@movementarian.org>
+
+ * Alert_pimpl.h:
+ * Alert.h:
+ * Alert.C: finally kill alert()
+
2003-03-30 Lars Gullik Bjønnes <larsbj@gullik.net>
* screen.C (drawFromTo): adjust for RowList.
+2003-03-31 John Levon <levon@movementarian.org>
+
+ * ControlPrint.C:
+ * ControlDocument.C: more Alert cleanups
+
2003-03-29 John Levon <levon@movementarian.org>
* ControlSpellchecker.C: Alert cleanup
old_class, new_class,
&*(lv_.buffer()->paragraphs.begin()),
lv_.buffer()->params);
- if (ret) {
- string s;
- if (ret == 1) {
- s = _("One paragraph couldn't be converted");
- } else {
+
+ if (!ret)
+ return;
+
+ string s;
#if USE_BOOST_FORMAT
- boost::format fmt(_("%1$s paragraphs couldn't be converted"));
- fmt % ret;
- s = fmt.str();
+ if (ret == 1) {
+ boost::format fmt(_("One paragraph could not be converted\n"
+ "into the document class %2$s."));
+ fmt % textclasslist[new_class].name();
+ s = fmt.str();
+ } else {
+ boost::format fmt(_("%1$s paragraphs could not be converted\n"
+ "into the document class %2$s."));
+ fmt % tostr(ret);
+ fmt % textclasslist[new_class].name();
+ s = fmt.str();
+ }
#else
- s += tostr(ret);
- s += _(" paragraphs couldn't be converted");
-#endif
- }
- Alert::alert(_("Conversion Errors!"),s,
- _("into chosen document class"));
+ if (ret == 1) {
+ s += _("One paragraph could not be converted\n"
+ "into the document class ");
+ s += textclasslist[new_class].name() + ".";
+ } else {
+ s += tostr(ret);
+ s += _(" paragraphs could not be converted\n"
+ "into the document class ");
+ s += textclasslist[new_class].name() + ".";
}
+#endif
+ Alert::warning(_("Class conversion errors"), s);
}
bool ControlDocument::loadTextclass(lyx::textclass_type tc) const
{
bool const success = textclasslist[tc].load();
- if (!success) {
- // problem changing class
- // -- warn user (to retain old style)
- Alert::alert(_("Conversion Errors!"),
- _("Errors loading new document class."),
- _("Reverting to original document class."));
- }
+ if (success)
+ return success;
+
+ string s;
+
+#if USE_BOOST_FORMAT
+ boost::format fmt(_("The document could not be converted\n"
+ "into the document class %1$s."));
+ fmt % textclasslist[tc].name();
+ s = fmt.str();
+#else
+ s += _("The document could not be converted\n"
+ "into the document class ");
+ s += textclasslist[tc].name() + ".";
+#endif
+ Alert::error(_("Could not change class"), s);
+
return success;
}
#include "support/filetools.h"
#include "support/path.h"
#include "support/systemcall.h"
+#include "support/BoostFormat.h"
#include "debug.h" // for lyxerr
}
+namespace {
+
+void showPrintError(string const & name)
+{
+#if USE_BOOST_FORMAT
+ boost::format fmt(_("Could not print the document %1$s.\n"
+ "Check that your printer is set up correctly."));
+ fmt % MakeDisplayPath(name, 50);
+ string str = fmt.str();
+#else
+ string str = _("Could not print the document ");
+ str += MakeDisplayPath(name, 50);
+ str += _(".\nCheck that your printer is set up correctly.");
+#endif
+ Alert::error(_("Print document failed"), str);
+}
+
+}
+
+
/// print the current buffer
void ControlPrint::apply()
{
command += converters.dvips_options(buffer()) + ' ';
if (!Exporter::Export(buffer(), "dvi", true)) {
- Alert::alert(_("Error:"),
- _("Unable to print"),
- _("Check that your parameters are correct"));
+ showPrintError(buffer()->fileName());
return;
}
lyxerr[Debug::LATEX] << "ControlPrint::apply(): print command = \""
<< command << '"' << endl;
- if (res != 0) {
- Alert::alert(_("Error:"),
- _("Unable to print"),
- _("Check that your parameters are correct"));
- }
+ if (res != 0)
+ showPrintError(buffer()->fileName());
}
using std::pair;
using std::make_pair;
-
-void alert_pimpl(string const & s1, string const & s2, string const & s3)
-{
- QMessageBox::warning(0, "LyX",
- toqstr(s1 + '\n' + '\n' + s2 + '\n' + s3));
-}
-
-
int prompt_pimpl(string const & tit, string const & question,
int default_button,
string const & b1, string const & b2, string const & b3)
+2003-03-31 John Levon <levon@movementarian.org>
+
+ * Alert_pimpl.C: remove alert()
+
2003-03-29 John Levon <levon@movementarian.org>
* QBrowseBox.C: handle transparent pixmaps
using std::make_pair;
using std::endl;
-void alert_pimpl(string const & s1, string const & s2, string const & s3)
-{
- fl_set_resource("flAlert.dismiss.label", _("Dismiss"));
- fl_show_alert(s1.c_str(), s2.c_str(), s3.c_str(), 0);
-}
-
-
void warning_pimpl(string const &, string const & message)
{
fl_show_messages(message.c_str());
boost::tie(b1label, b1sc) = parse_shortcut(b1);
boost::tie(b2label, b2sc) = parse_shortcut(b2);
boost::tie(b3label, b3sc) = parse_shortcut(b3);
- lyxerr << "Parsed " << b1 << " as " << b1label << " and " << b1sc << endl;
if (b3.empty()) {
fl_set_choices_shortcut(b1sc.c_str(), b2sc.c_str(), "");
+2003-03-31 John Levon <levon@movementarian.org>
+
+ * Alert_pimpl.C: remove alert()
+
2003-03-29 John Levon <levon@movementarian.org>
* bmtable.c: handle transparent pixels
-/* This file is part of
- * ======================================================
+/**
+ * \file exporter.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * LyX, The Document Processor
+ * \author unknown
*
- * Copyright 1995 Matthias Ettrich
- * Copyright 1995-2001 The LyX Team.
- *
- * ====================================================== */
+ * Full author contact details are available in file CREDITS
+ */
+
#include <config.h>
}
if (loader_format.empty()) {
#if USE_BOOST_FORMAT
- Alert::alert(_("Cannot import file"),
- boost::io::str(boost::format(_("No information for importing from %1$s"))
+// FIXME: better english ...
+ Alert::error(_("Couldn't import file"),
+ boost::io::str(boost::format(_("No information for importing the format %1$s."))
% formats.prettyName(format)));
#else
- Alert::alert(_("Cannot import file"),
- _("No information for importing from ")
- + formats.prettyName(format));
+ Alert::error(_("Couldn't import file"),
+ _("No information for importing the format ")
+ + formats.prettyName(format) + ".");
#endif
return false;
}
+2003-03-31 John Levon <levon@movementarian.org>
+
+ * insettext.C: Alert fix
+
2003-03-30 Lars Gullik Bjønnes <larsbj@gullik.net>
* insettext.C (ascent): adjust for RowList
<< temp_file
<< (success ? " succeeded\n" : " failed\n");
if (!success) {
- Alert::alert(_("Cannot copy file"), orig_file_with_path,
- _("into tempdir"));
+#if USE_BOOST_FORMAT
+ boost::format fmt(_("Could not copy the file\n%1$s\ninto the temporary directory."));
+ fmt % orig_file_with_path;
+ string str = fmt.str();
+#else
+ string str = _("Could not copy the file\n");
+ str += orig_file_with_path;
+ str += _("\ninto the temporary directory.");
+#endif
+ Alert::error(_("Graphics display failed"), str);
return orig_file;
}
}
<< command << endl;
Systemcall one;
one.startscript(Systemcall::Wait, command);
- if (!IsFileReadable(ChangeExtension(outfile_base, to)))
+ if (!IsFileReadable(ChangeExtension(outfile_base, to))) {
#if USE_BOOST_FORMAT
- Alert::alert(_("Cannot convert Image (not existing file?)"),
- boost::io::str(boost::format(_("No information for converting from %1$s to %2$s"))
- % from % to));
+ boost::format fmt(_("No information for converting %1$s format files to %1$s.\n"
+ "Try defining a convertor in the preferences."));
+ fmt % from % to;
+ string str = fmt.str();
#else
- Alert::alert(_("Cannot convert Image (not existing file?)"),
- _("No information for converting from ") + from + " to " + to);
+ string str = _("No information for converting ");
+ str += from + _(" format files to " + to;
+ str += ".\nTry defining a convertor in the preferences.");
#endif
+ Alert::error(_("Could not convert image"), str);
+ }
}
return RemoveExtension(temp_file);
#ifdef WITH_WARNINGS
#warning FIXME horrendously bad UI
#endif
- Alert::alert(_("Impossible operation!"),
- _("Cannot include more than one paragraph!"),
- _("Sorry."));
+ Alert::error(_("Paste failed"), _("Cannot include more than one paragraph."));
break;
}
}
<< " in " << lyxrc_path << endl;
if (lyxrc.read(lyxrc_path) < 0) {
#if USE_BOOST_FORMAT
- Alert::alert(_("LyX Warning!"),
- boost::io::str(boost::format(_("Error while reading %1$s.")) % lyxrc_path),
- _("Using built-in defaults."));
+ Alert::warning(_("Could not read preferences"),
+ boost::io::str(boost::format(
+ _("Error while reading the preferences file\n%1$s.\n"
+ "LyX will use the built-in defaults.")) % lyxrc_path));
#else
- Alert::alert(_("LyX Warning!"),
- _("Error while reading ") + lyxrc_path,
- _("Using built-in defaults."));
+ Alert::warning(_("Could not read preferences"),
+ string(_("Error while reading the preferences file\n"))
+ + lyxrc_path + _("LyX will use the built-in defaults."));
#endif
return false;
}