/* This file is part of
- * ======================================================
- *
+ * ======================================================
+ *
* LyX, The Document Processor
- *
+ *
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
#include "buffer.h"
#include "bufferview_funcs.h"
#include "LaTeX.h"
-#include "LyXView.h"
+#include "frontends/LyXView.h"
#include "lyx_cb.h" // ShowMessage()
#include "gettext.h"
#include "BufferView.h"
#include "support/path.h"
#include "support/systemcall.h"
+#ifndef CXX_GLOBAL_CSTD
+using std::isdigit;
+#endif
+
using std::vector;
using std::queue;
using std::endl;
{
if (name_.empty())
return false;
- return isdigit(name_[name_.length() - 1]);
+ return isdigit(name_[name_.length() - 1]);
}
}
-void Formats::add(string const & name, string const & extension,
+void Formats::add(string const & name, string const & extension,
string const & prettyname, string const & shortcut)
{
- FormatList::iterator it =
+ FormatList::iterator it =
find_if(formatlist.begin(), formatlist.end(),
lyx::compare_memfun(&Format::name, name));
if (it == formatlist.end())
void Formats::erase(string const & name)
{
- FormatList::iterator it =
+ FormatList::iterator it =
find_if(formatlist.begin(), formatlist.end(),
lyx::compare_memfun(&Format::name, name));
if (it != formatlist.end())
if (paper_size == "letter")
paper_size = "us";
command += " " + paper_size;
- if (buffer->params.orientation
+ if (buffer->params.orientation
== BufferParams::ORIENTATION_LANDSCAPE)
command += 'r';
- }
+ }
command += " " + QuoteName(OnlyFilename((filename)));
bool operator<(Converter const & a, Converter const & b)
{
- int const i = compare_no_case(a.From->prettyname(),
- b.From->prettyname());
+ // use the compare_ascii_no_case instead of compare_no_case,
+ // because in turkish, 'i' is not the lowercase version of 'I',
+ // and thus turkish locale breaks parsing of tags.
+ int const i = compare_ascii_no_case(a.From->prettyname(),
+ b.From->prettyname());
if (i == 0)
- return compare_no_case(a.To->prettyname(), b.To->prettyname())
+ return compare_ascii_no_case(a.To->prettyname(), b.To->prettyname())
< 0;
else
return i < 0;
converter.flags = flags;
}
converter.readFlags();
-
+
if (converter.latex && (latex_command_.empty() || to == "dvi"))
latex_command_ = subst(command, token_from, "");
// If we have both latex & pdflatex, we set latex_command to latex.
// This method updates the pointers From and To in all the converters.
// The code is not very efficient, but it doesn't matter as the number
// of formats and converters is small.
-// Furthermore, this method is called only on startup, or after
+// Furthermore, this method is called only on startup, or after
// adding/deleting a format in FormPreferences (the latter calls can be
// eliminated if the formats in the Formats class are stored using a map or
-// a list (instead of a vector), but this will cause other problems).
+// a list (instead of a vector), but this will cause other problems).
void Converters::update(Formats const & formats)
{
ConverterList::iterator it = converterlist_.begin();
if (i != s || target != "lyx") {
result.push_back(&formats.get(i));
}
-
+
vector<int>::iterator it = vertices_[i].in_vertices.begin();
vector<int>::iterator end = vertices_[i].in_vertices.end();
for (; it != end; ++it) {
found = true;
break;
}
-
+
vector<int>::const_iterator beg =
vertices_[i].out_vertices.begin();
vector<int>::const_iterator cit = beg;
EdgePath edgepath = getPath(from_format, to_format);
if (edgepath.empty()) {
- Alert::alert(_("Cannot convert file"),
- _("No information for converting from ")
- + formats.prettyName(from_format) + _(" to ")
- + formats.prettyName(to_format));
return false;
}
} else {
if (conv.need_aux && !run_latex
&& !latex_command_.empty()) {
- lyxerr[Debug::FILES]
- << "Running " << latex_command_
+ lyxerr[Debug::FILES]
+ << "Running " << latex_command_
<< " to update aux file"<< endl;
runLaTeX(buffer, latex_command_);
}
command = subst(command, token_from, QuoteName(infile2));
command = subst(command, token_base, QuoteName(from_base));
command = subst(command, token_to, QuoteName(outfile2));
+ command = LibScriptSearch(command);
if (!conv.parselog.empty())
command += " 2> " + QuoteName(infile2 + ".out");
if (!conv.parselog.empty()) {
string const logfile = infile2 + ".log";
- string script =
- LibFileSearch("scripts",
- conv.parselog);
- if (script.empty())
- script = conv.parselog;
+ string const script = LibScriptSearch(conv.parselog);
string const command2 = script +
" < " + QuoteName(infile2 + ".out") +
" > " + QuoteName(logfile);
}
}
return true;
- } else
+ } else
return move(outfile, to_file, conv.latex);
}
-// If from = /path/file.ext and to = /path2/file2.ext2 then this method
+// If from = /path/file.ext and to = /path2/file2.ext2 then this method
// moves each /path/file*.ext file to /path2/file2*.ext2'
bool Converters::move(string const & from, string const & to, bool copy)
{
for (vector<string>::const_iterator it = files.begin();
it != files.end(); ++it)
if (prefixIs(*it, base)) {
- string from2 = path + *it;
+ string const from2 = path + *it;
string to2 = to_base + it->substr(base.length());
to2 = ChangeExtension(to2, to_extension);
- lyxerr[Debug::FILES] << "moving " << from2
+ lyxerr[Debug::FILES] << "moving " << from2
<< " to " << to2 << endl;
- bool moved = (copy)
+ bool const moved = (copy)
? lyx::copy(from2, to2)
: lyx::rename(from2, to2);
if (!moved && no_errors) {
if ((result & LaTeX::ERRORS)) {
// Insert all errors as errors boxes
bv->insertErrors(terr);
- bv->redraw();
+#warning repaint() or update() or nothing ?
+ bv->repaint();
bv->fitCursor();
}
bv->owner()->allowInput();
// do the LaTeX run(s)
string name = buffer->getLatexName();
- LaTeX latex(command, name, buffer->filePath());
+ LaTeX latex(command, name, buffer->filePath());
TeXErrors terr;
int result = latex.run(terr,
- bv ? bv->owner()->getLyXFunc() : 0);
+ bv ? &bv->owner()->getLyXFunc() : 0);
if (bv) {
if ((result & LaTeX::ERRORS)) {
// Insert all errors as errors boxes
bv->insertErrors(terr);
- bv->redraw();
+#warning repaint() or update() or nothing ?
+ bv->repaint();
bv->fitCursor();
}
}
if (bv)
bv->owner()->allowInput();
-
- int const ERROR_MASK =
+
+ int const ERROR_MASK =
LaTeX::NO_LOGFILE |
LaTeX::ERRORS |
LaTeX::NO_OUTPUT;
-
+
return (result & ERROR_MASK) == 0;
}