#include "xforms_helpers.h"
+#include "debug.h"
#include "gettext.h"
#include "lyxgluelength.h"
#include "lyxlex.h"
string const & str,
string const & default_unit)
{
+ // Paranoia check
+ BOOST_ASSERT(input && input->objclass == FL_INPUT &&
+ choice && choice->objclass == FL_CHOICE);
+
// use input field only for gluelengths
if (!isValidLength(str) && !isStrDbl(str)) {
fl_set_input(input, str.c_str());
{
// Paranoia check
BOOST_ASSERT(input && input->objclass == FL_INPUT &&
- choice && choice->objclass == FL_CHOICE);
+ choice && choice->objclass == FL_CHOICE);
if (len.empty()) {
fl_set_input(input, "");
bool XformsColor::read(string const & filename)
{
+ FileInfo const f(filename);
LyXLex lexrc(xformTags, xformCount);
- if (!lexrc.setFile(filename))
- return false;
+ if (f.readable() && !lexrc.setFile(filename)) {
+ lyxerr << "XformsColor::read(" << filename << ")\n"
+ << _("Failed to open file.") << std::endl;
+ return false;
+ }
while (lexrc.isOK()) {
int const le = lexrc.lex();
bool XformsColor::write(string const & filename)
{
ofstream os(filename.c_str());
- if (!os)
- return false;
+ if (!os) {
+ lyxerr << "XformsColor::write(" << filename << ")\n"
+ << _("Failed to open file.") << std::endl;
+ return false;
+ }
os << "###"
<< "### file " << filename << "\n\n"