*
* \author Angus Leeming
*
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "xforms_helpers.h"
-#include "lyxlex.h"
+#include "debug.h"
#include "gettext.h"
-#include "lyxlength.h"
#include "lyxgluelength.h"
-#include "Lsstream.h"
+#include "lyxlex.h"
-#include "support/LAssert.h"
#include "support/FileInfo.h"
#include "support/filetools.h"
-#include "support/tostr.h"
#include "support/lstrings.h" // frontStrip, strip
+#include "support/tostr.h"
#include "lyx_forms.h"
#include "combox.h"
+#include <boost/assert.hpp>
+
#include <fstream>
-using namespace lyx::support;
+using lyx::support::AbsolutePath;
+using lyx::support::FileInfo;
+using lyx::support::isStrDbl;
+using lyx::support::OnlyPath;
+using lyx::support::subst;
+using lyx::support::trim;
+
+using std::make_pair;
using std::ofstream;
-using std::pair;
using std::vector;
-using std::make_pair;
+using std::string;
bool isActive(FL_OBJECT * ob)
}
break;
default:
- Assert(0);
+ BOOST_ASSERT(false);
}
return vec;
string const getString(FL_OBJECT * ob, int line)
{
// Negative line value does not make sense.
- Assert(line >= 0);
+ BOOST_ASSERT(line >= 0);
char const * tmp = 0;
switch (ob->objclass) {
break;
default:
- Assert(0);
+ BOOST_ASSERT(false);
}
return tmp ? trim(tmp) : string();
string getLengthFromWidgets(FL_OBJECT * input, FL_OBJECT * choice)
{
// Paranoia check
- Assert(input && input->objclass == FL_INPUT &&
+ BOOST_ASSERT(input && input->objclass == FL_INPUT &&
choice && choice->objclass == FL_CHOICE);
string const length = trim(fl_get_input(input));
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());
string const & default_unit)
{
// Paranoia check
- Assert(input && input->objclass == FL_INPUT &&
- choice && choice->objclass == FL_CHOICE);
+ BOOST_ASSERT(input && input->objclass == FL_INPUT &&
+ 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"