string const name = addName(path.absFilename(), latexName());
string const org_path = filePath();
- support::PathChanger p(path); // path to LaTeX file
+ PathChanger p(path); // path to LaTeX file
message(_("Running chktex..."));
// Generate the LaTeX file if neccessary
namespace {
-class AutoSaveBuffer : public support::ForkedProcess {
+class AutoSaveBuffer : public ForkedProcess {
public:
///
AutoSaveBuffer(Buffer const & buffer, FileName const & fname)
if (!makeLaTeXFile(FileName(filename), string(), runparams))
return false;
} else if (!lyxrc.tex_allows_spaces
- && support::contains(filePath(), ' ')) {
+ && contains(filePath(), ' ')) {
Alert::error(_("File name error"),
_("The directory path to the document cannot contain spaces."));
return false;
formats.extension(from_format);
string const to_ext = formats.extension(to_format);
string const command =
- support::os::python() + ' ' +
+ os::python() + ' ' +
quoteName(libFileSearch("scripts", "convertDefault.py").toFilesystemEncoding()) +
' ' +
quoteName(from_ext + ':' + from_file.toFilesystemEncoding()) +
string const path(onlyPath(from_file.absFilename()));
// Prevent the compiler from optimizing away p
FileName pp(path);
- support::PathChanger p(pp);
+ PathChanger p(pp);
// empty the error list before any new conversion takes place.
errorList.clear();
FileName const index(addName(cache_dir.absFilename(), "index"));
ofstream os(index.toFilesystemEncoding().c_str());
os.close();
- if (!lyx::support::chmod(index, 0600))
+ if (!chmod(index, 0600))
return;
os.open(index.toFilesystemEncoding().c_str());
CacheType::iterator it1 = cache.begin();
return;
// We do this here and not in the constructor because package() gets
// initialized after all static variables.
- cache_dir = FileName(addName(support::package().user_support().absFilename(), "cache"));
+ cache_dir = FileName(addName(package().user_support().absFilename(), "cache"));
if (!cache_dir.exists())
if (support::mkdir(cache_dir, 0700) != 0) {
lyxerr << "Could not create cache directory `"
// FIXME: Should not hardcode this (see bug 3819 for details)
if (to_format == "pstex") {
- FileName const converted_eps(support::changeExtension(converted_file.absFilename(), "eps"));
+ FileName const converted_eps(changeExtension(converted_file.absFilename(), "eps"));
add(orig_from, "eps", converted_eps);
} else if (to_format == "pdftex") {
- FileName const converted_pdf(support::changeExtension(converted_file.absFilename(), "pdf"));
+ FileName const converted_pdf(changeExtension(converted_file.absFilename(), "pdf"));
add(orig_from, "pdf", converted_pdf);
}
}
item->checksum = checksum;
if (!mover.copy(converted_file, item->cache_name,
- support::onlyFilename(item->cache_name.absFilename()), 0600)) {
+ onlyFilename(item->cache_name.absFilename()), 0600)) {
LYXERR(Debug::FILES, "ConverterCache::add(" << orig_from << "):\n"
"Could not copy file.");
}
CacheItem new_item(orig_from, to_format, timestamp,
orig_from.checksum());
if (mover.copy(converted_file, new_item.cache_name,
- support::onlyFilename(new_item.cache_name.absFilename()), 0600)) {
+ onlyFilename(new_item.cache_name.absFilename()), 0600)) {
FormatCache & format_cache = pimpl_->cache[orig_from];
if (format_cache.from_format.empty())
format_cache.from_format =
// FIXME: Should not hardcode this (see bug 3819 for details)
if (to_format == "pstex") {
- FileName const dest_eps(support::changeExtension(dest.absFilename(), "eps"));
+ FileName const dest_eps(changeExtension(dest.absFilename(), "eps"));
if (!copy(orig_from, "eps", dest_eps))
return false;
} else if (to_format == "pdftex") {
- FileName const dest_pdf(support::changeExtension(dest.absFilename(), "pdf"));
+ FileName const dest_pdf(changeExtension(dest.absFilename(), "pdf"));
if (!copy(orig_from, "pdf", dest_pdf))
return false;
}
BOOST_ASSERT(item);
Mover const & mover = getMover(to_format);
return mover.copy(item->cache_name, dest,
- support::onlyFilename(dest.absFilename()));
+ onlyFilename(dest.absFilename()));
}
} // namespace lyx
info.force = false;
while (!flags.empty()) {
string flag;
- flags = support::split(flags, flag, ',');
+ flags = split(flags, flag, ',');
if (flag == "combining")
info.combining = true;
else if (flag == "force")
return format;
// try to find a format from the file extension.
- string const ext = support::getExtension(filename.absFilename());
+ string const ext = getExtension(filename.absFilename());
if (!ext.empty()) {
// this is ambigous if two formats have the same extension,
// but better than nothing
///
void popTable();
///
- bool setFile(support::FileName const & filename);
+ bool setFile(FileName const & filename);
///
void setStream(istream & i);
///
}
-bool Lexer::setFile(support::FileName const & filename)
+bool Lexer::setFile(FileName const & filename)
{
return pimpl_->setFile(filename);
}
string const configure_command = package().configure_command();
lyxerr << to_utf8(_("LyX: reconfiguring user directory")) << endl;
- support::PathChanger p(package().user_support());
+ PathChanger p(package().user_support());
Systemcall one;
one.startscript(Systemcall::Wait, configure_command);
lyxerr << "LyX: " << to_utf8(_("Done!")) << endl;
easyParse(argc, argv);
try {
- support::init_package(to_utf8(from_local8bit(argv[0])),
+ init_package(to_utf8(from_local8bit(argv[0])),
cl_system_support, cl_user_support,
- support::top_build_dir_is_one_level_up);
- } catch (support::ExceptionMessage const & message) {
- if (message.type_ == support::ErrorException) {
+ top_build_dir_is_one_level_up);
+ } catch (ExceptionMessage const & message) {
+ if (message.type_ == ErrorException) {
Alert::error(message.title_, message.details_);
exit(1);
- } else if (message.type_ == support::WarningException) {
+ } else if (message.type_ == WarningException) {
Alert::warning(message.title_, message.details_);
}
}
// the filename if necessary
pimpl_->files_to_load_.push_back(fileSearch(string(),
os::internal_path(to_utf8(from_local8bit(argv[argi]))),
- "lyx", support::allow_unreadable));
+ "lyx", allow_unreadable));
}
if (first_start)
lv.message(_("Running configure..."));
// Run configure in user lyx directory
- support::PathChanger p(package().user_support());
+ PathChanger p(package().user_support());
string configure_command = package().configure_command();
configure_command += option;
Systemcall one;
p.pop();
// emit message signal.
lv.message(_("Reloading configuration..."));
- lyxrc.read(support::libFileSearch(string(), "lyxrc.defaults"));
+ lyxrc.read(libFileSearch(string(), "lyxrc.defaults"));
// Re-read packages.lst
LaTeXFeatures::getAvailable();
string const path = buffer->temppath();
// Prevent the compiler from optimizing away p
FileName pp(path);
- support::PathChanger p(pp);
+ PathChanger p(pp);
// there are three cases here:
// 1. we print to a file
if (lyxrc_orig.document_path != lyxrc_new.document_path) {
FileName path(lyxrc_new.document_path);
if (path.exists() && path.isDirectory())
- support::package().document_dir() = FileName(lyxrc.document_path);
+ package().document_dir() = FileName(lyxrc.document_path);
}
case LyXRC::RC_ESC_CHARS:
case LyXRC::RC_EXAMPLEPATH:
case LyXRC::RC_NUMLASTFILES:
case LyXRC::RC_PATH_PREFIX:
if (lyxrc_orig.path_prefix != lyxrc_new.path_prefix) {
- support::prependEnvPath("PATH", lyxrc.path_prefix);
+ prependEnvPath("PATH", lyxrc.path_prefix);
}
case LyXRC::RC_PERS_DICT:
case LyXRC::RC_PREVIEW:
case LyXRC::RC_TEX_ALLOWS_SPACES:
case LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS:
if (lyxrc_orig.windows_style_tex_paths != lyxrc_new.windows_style_tex_paths) {
- support::os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths);
+ os::windows_style_tex_paths(lyxrc_new.windows_style_tex_paths);
}
case LyXRC::RC_UIFILE:
case LyXRC::RC_USER_EMAIL:
int flgs = Format::none;
while (!flags.empty()) {
string flag;
- flags = support::split(flags, flag, ',');
+ flags = split(flags, flag, ',');
if (flag == "document")
flgs |= Format::document;
else if (flag == "vector")
flags.push_back("document");
if (cit->vectorFormat())
flags.push_back("vector");
- os << support::getStringFromVector(flags);
+ os << getStringFromVector(flags);
os << "\"\n";
}
}
//Much of this is borrowed from TextClassList::read()
bool ModuleList::load()
{
- support::FileName const real_file = libFileSearch("", "lyxmodules.lst");
+ FileName const real_file = libFileSearch("", "lyxmodules.lst");
LYXERR(Debug::TCLASS, "Reading modules from `" << real_file << '\'');
if (real_file.empty()) {
vector<string> pkgs;
while (!packages.empty()) {
string p;
- packages = support::split(packages, p, ',');
+ packages = split(packages, p, ',');
pkgs.push_back(p);
}
// This code is run when we have
namespace lyx {
-bool Mover::copy(support::FileName const & from, support::FileName const & to,
+bool Mover::copy(FileName const & from, FileName const & to,
unsigned long int mode) const
{
return do_copy(from, to, to.absFilename(), mode);
}
-bool Mover::do_copy(support::FileName const & from, support::FileName const & to,
+bool Mover::do_copy(FileName const & from, FileName const & to,
string const &, unsigned long int mode) const
{
- return support::copy(from, to, mode);
+ return copy(from, to, mode);
}
-bool Mover::rename(support::FileName const & from,
- support::FileName const & to) const
+bool Mover::rename(FileName const & from,
+ FileName const & to) const
{
return do_rename(from, to, to.absFilename());
}
-bool Mover::do_rename(support::FileName const & from, support::FileName const & to,
+bool Mover::do_rename(FileName const & from, FileName const & to,
string const &) const
{
- return support::rename(from, to);
+ return rename(from, to);
}
-bool SpecialisedMover::do_copy(support::FileName const & from, support::FileName const & to,
+bool SpecialisedMover::do_copy(FileName const & from, FileName const & to,
string const & latex, unsigned long int mode) const
{
if (command_.empty())
if (!ofs)
return false;
ofs.close();
- if (!support::chmod(to, mode))
+ if (!chmod(to, mode))
return false;
}
- string command = support::libScriptSearch(command_);
- command = support::subst(command, "$$i", quoteName(from.toFilesystemEncoding()));
- command = support::subst(command, "$$o", quoteName(to.toFilesystemEncoding()));
- command = support::subst(command, "$$l", quoteName(latex));
+ string command = libScriptSearch(command_);
+ command = subst(command, "$$i", quoteName(from.toFilesystemEncoding()));
+ command = subst(command, "$$o", quoteName(to.toFilesystemEncoding()));
+ command = subst(command, "$$l", quoteName(latex));
- support::Systemcall one;
- return one.startscript(support::Systemcall::Wait, command) == 0;
+ Systemcall one;
+ return one.startscript(Systemcall::Wait, command) == 0;
}
-bool SpecialisedMover::do_rename(support::FileName const & from, support::FileName const & to,
+bool SpecialisedMover::do_rename(FileName const & from, FileName const & to,
string const & latex) const
{
if (command_.empty())
docstring const Paragraph::translateIfPossible(docstring const & s,
BufferParams const & bparams) const
{
- if (!support::isAscii(s) || s.empty()) {
+ if (!isAscii(s) || s.empty()) {
// This must be a user defined layout. We cannot translate
// this, since gettext accepts only ascii keys.
return s;
}
} else if (token == "\\align") {
lex.next();
- int tmpret = support::findToken(string_align, lex.getString());
+ int tmpret = findToken(string_align, lex.getString());
if (tmpret == -1)
++tmpret;
align(LyXAlignment(1 << tmpret));
# include <io.h>
#endif
-using boost::shared_ptr;
-
using namespace std;
+using namespace lyx::support;
+
+using boost::shared_ptr;
namespace lyx {
// Address is the unix address for the socket.
// MAX_CLIENTS is the maximum number of clients
// that can connect at the same time.
-ServerSocket::ServerSocket(LyXFunc * f, support::FileName const & addr)
+ServerSocket::ServerSocket(LyXFunc * f, FileName const & addr)
: func(f),
- fd_(support::socktools::listen(addr, 3)),
+ fd_(socktools::listen(addr, 3)),
address_(addr)
{
if (fd_ == -1) {
// These env vars are used by DVI inverse search
// Needed by xdvi
- support::setEnv("XEDITOR", "lyxclient -g %f %l");
+ setEnv("XEDITOR", "lyxclient -g %f %l");
// Needed by lyxclient
- support::setEnv("LYXSOCKET", address_.absFilename());
+ setEnv("LYXSOCKET", address_.absFilename());
theApp()->registerSocketCallback(
fd_,
// is OK and if the number of clients does not exceed MAX_CLIENTS
void ServerSocket::serverCallback()
{
- int const client_fd = support::socktools::accept(fd_);
+ int const client_fd = socktools::accept(fd_);
if (fd_ == -1) {
LYXERR(Debug::LYXSERVER, "lyx: Failed to accept new client");
#include <iterator>
using namespace std;
+using namespace lyx::support;
namespace {
namespace lyx {
-using support::absolutePath;
-using support::addName;
-using support::FileName;
-using support::package;
LastFilesSection::LastFilesSection(unsigned int num) :
default_num_last_files(4),
cur.recordUndo();
if (cmd.action == LFUN_INDEX_INSERT) {
- docstring ds = support::subst(text->getStringToIndex(cur), '\n', ' ');
+ docstring ds = subst(text->getStringToIndex(cur), '\n', ' ');
text->insertInset(cur, inset);
if (edit)
inset->edit(cur, true);
if (cmd.argument().empty())
break;
docstring hexstring = cmd.argument();
- if (lyx::support::isHex(hexstring)) {
- char_type c = lyx::support::hexToInt(hexstring);
+ if (isHex(hexstring)) {
+ char_type c = hexToInt(hexstring);
if (c >= 32 && c < 0x10ffff) {
lyxerr << "Inserting c: " << c << endl;
docstring s = docstring(1, c);
}
ostringstream command;
- command << support::os::python() << ' ' << quoteName(script.toFilesystemEncoding())
+ command << os::python() << ' ' << quoteName(script.toFilesystemEncoding())
<< ' ' << quoteName(filename.toFilesystemEncoding())
<< ' ' << quoteName(tempfile.toFilesystemEncoding());
string const command_str = command.str();
LYXERR(Debug::TCLASS, "Running `" << command_str << '\'');
- support::cmd_ret const ret =
- support::runCommand(command_str);
+ cmd_ret const ret =
+ runCommand(command_str);
if (ret.first != 0) {
lyxerr << "Could not run layout conversion "
"script layout2layout.py." << endl;
if (format != FORMAT) {
LYXERR(Debug::TCLASS, "Converting layout file from format "
<< format << " to " << FORMAT);
- FileName const tempfile(support::tempName());
+ FileName const tempfile(tempName());
error = !layout2layout(filename, tempfile);
if (!error)
error = read(tempfile, rt);
bool TextClassList::read()
{
Lexer lex(0, 0);
- support::FileName const real_file = libFileSearch("", "textclass.lst");
+ FileName const real_file = libFileSearch("", "textclass.lst");
LYXERR(Debug::TCLASS, "Reading textclasses from `" << real_file << '\'');
if (real_file.empty()) {
int Trans::load(string const & language)
{
- support::FileName const filename = libFileSearch("kbd", language, "kmap");
+ FileName const filename = libFileSearch("kbd", language, "kmap");
if (filename.empty())
return -1;
LyXDataSocket::LyXDataSocket(FileName const & address)
{
- if ((fd_ = support::socktools::connect(address)) == -1) {
+ if ((fd_ = socktools::connect(address)) == -1) {
connected_ = false;
} else {
connected_ = true;
docstring clientName =
- from_ascii(support::itoa(::getppid()) + ">" + support::itoa(::getpid()));
+ from_ascii(itoa(::getppid()) + ">" + itoa(::getpid()));
int n(vector<docstring> const & arg)
{
} else {
// We have to look for an address.
// serverPid can be empty.
- vector<fs::path> addrs = support::lyxSockets(to_filesystem8bit(cmdline::mainTmp), cmdline::serverPid);
+ vector<fs::path> addrs = lyxSockets(to_filesystem8bit(cmdline::mainTmp), cmdline::serverPid);
vector<fs::path>::const_iterator addr = addrs.begin();
vector<fs::path>::const_iterator end = addrs.end();
for (; addr != end; ++addr) {
{ l.stream() << t; return l; }
LyXErr & operator<<(LyXErr & l, docstring const & t)
{ l.stream() << to_utf8(t); return l; }
-LyXErr & operator<<(LyXErr & l, support::FileName const & t)
+LyXErr & operator<<(LyXErr & l, FileName const & t)
{ l.stream() << t; return l; }
LyXErr & operator<<(LyXErr & l, ostream &(*t)(ostream &))
{ l.stream() << t; return l; }
#include <sstream>
using namespace std;
+using namespace lyx::support;
namespace lyx {
break;
}
- } catch (support::ExceptionMessage const & message) {
- if (message.type_ == support::ErrorException) {
+ } catch (ExceptionMessage const & message) {
+ if (message.type_ == ErrorException) {
Alert::error(message.title_, message.details_);
LyX::cref().emergencyCleanup();
abort();
- } else if (message.type_ == support::WarningException) {
+ } else if (message.type_ == WarningException) {
Alert::warning(message.title_, message.details_);
return 0;
}
#include <exception>
using namespace std;
+using namespace lyx::support;
namespace lyx {
///////////////////////////////////////////////////////////////
-using support::FileName;
-
GuiApplication * guiApp;
try {
return QApplication::notify(receiver, event);
}
- catch (support::ExceptionMessage const & e) {
- if (e.type_ == support::ErrorException) {
+ catch (ExceptionMessage const & e) {
+ if (e.type_ == ErrorException) {
Alert::error(e.title_, e.details_);
LyX::cref().emergencyCleanup();
QApplication::exit(1);
- } else if (e.type_ == support::WarningException) {
+ } else if (e.type_ == WarningException) {
Alert::warning(e.title_, e.details_);
return false;
}
string const GuiApplication::hexName(ColorCode col)
{
- return support::ltrim(fromqstr(color_cache_.get(col).name()), "#");
+ return ltrim(fromqstr(color_cache_.get(col).name()), "#");
}
#include <vector>
using namespace std;
+using namespace lyx::support;
namespace lyx {
namespace frontend {
{
vector<docstring> foundKeys;
- docstring expr = support::trim(search_expression);
+ docstring expr = trim(search_expression);
if (expr.empty())
return foundKeys;
#include <sstream>
using namespace std;
+using namespace lyx::support;
///
template<class Pair>
namespace lyx {
namespace frontend {
-using support::token;
-using support::bformat;
-using support::findToken;
-using support::getVectorFromString;
-
/////////////////////////////////////////////////////////////////////
//
// PreambleModule
#include <QFontDatabase>
using namespace std;
+using namespace lyx::support;
QString const math_fonts[] = {"cmex10", "cmmi10", "cmr10", "cmsy10",
"eufm10", "msam10", "msbm10", "wasy10", "esint10"};
namespace lyx {
-using support::contains;
-using support::package;
-using support::addPath;
-using support::addName;
-
extern docstring const stateText(FontInfo const & f);
namespace frontend {
}
-void GuiImage::load(support::FileName const & filename)
+void GuiImage::load(FileName const & filename)
{
if (!original_.isNull()) {
LYXERR(Debug::GRAPHICS, "Image is loaded already!");
params_ = PrinterParams(t,
fromqstr(printerED->text()),
- support::os::internal_path(fromqstr(fileED->text())),
+ os::internal_path(fromqstr(fileED->text())),
allRB->isChecked(),
fromED->text().toUInt(),
toED->text().toUInt(),
bool GuiPrint::initialiseParams(string const &)
{
/// get global printer parameters
- string const name = support::changeExtension(buffer().absFileName(),
+ string const name = changeExtension(buffer().absFileName(),
lyxrc.print_file_extension);
params_ = PrinterParams(PrinterParams::PRINTER, lyxrc.printer, name);
#include <QCloseEvent>
using namespace std;
+using namespace lyx::support;
namespace lyx {
namespace frontend {
-using support::FileName;
-using support::onlyFilename;
GuiShowFile::GuiShowFile(GuiView & lv)
: GuiDialog(lv, "file")
vector<string>::iterator it1 = data.begin();
vector<string>::iterator end1 = data.end();
for (; it1 != end1; ++it1)
- *it1 = support::onlyFilename(*it1);
+ *it1 = onlyFilename(*it1);
// sort on filename only (no path)
sort(data.begin(), data.end());
#include <boost/assert.hpp>
using namespace std;
+using namespace lyx::support;
static void initializeResources()
{
namespace lyx {
namespace frontend {
-using support::libFileSearch;
-using support::subst;
-using support::compare;
-
-
namespace {
struct PngMap {
LYXERR(Debug::GUI, "GuiView::dropEvent: got URLs!");
for (int i = 0; i != files.size(); ++i) {
- string const file = support::os::internal_path(fromqstr(
+ string const file = os::internal_path(fromqstr(
files.at(i).toLocalFile()));
if (!file.empty())
lyx::dispatch(FuncRequest(LFUN_FILE_OPEN, file));
dlg.setButton1(_("Documents|#o#O"), from_utf8(lyxrc.document_path));
dlg.setButton2(_("Templates|#T#t"), from_utf8(lyxrc.template_path));
- if (!support::isLyXFilename(fname.absFilename()))
+ if (!isLyXFilename(fname.absFilename()))
fname.changeExtension(".lyx");
- support::FileFilterList const filter(_("LyX Documents (*.lyx)"));
+ FileFilterList const filter(_("LyX Documents (*.lyx)"));
FileDialog::Result result =
dlg.save(from_utf8(fname.onlyPath().absFilename()),
if (fname.empty())
return false;
- if (!support::isLyXFilename(fname.absFilename()))
+ if (!isLyXFilename(fname.absFilename()))
fname.changeExtension(".lyx");
}
// Use this opportunity to deal with any child processes that
// have finished but are waiting to communicate this fact
// to the rest of LyX.
- support::ForkedCallsController::handleCompletedProcesses();
+ ForkedCallsController::handleCompletedProcesses();
}
void rescanTexStyles()
{
// Run rescan in user lyx directory
- support::PathChanger p(package().user_support());
+ PathChanger p(package().user_support());
FileName const command = libFileSearch("scripts", "TeXFiles.py");
Systemcall one;
int const status = one.startscript(Systemcall::Wait,
- support::os::python() + ' ' +
+ os::python() + ' ' +
quoteName(command.toFilesystemEncoding()));
if (status == 0)
return;
// We create a dummy command for ease of understanding of the
// list of forked processes.
// Note: 'python ' is absolutely essential, or execvp will fail.
- script_command_ = support::os::python() + ' ' +
+ script_command_ = os::python() + ' ' +
quoteName(script_file_.toFilesystemEncoding()) + ' ' +
quoteName(onlyFilename(from_file.toFilesystemEncoding())) + ' ' +
quoteName(to_format);
}
ForkedCall::SignalTypePtr ptr =
- support::ForkedCallQueue::add(script_command_);
+ ForkedCallQueue::add(script_command_);
ptr->connect(boost::bind(&Impl::converted, this, _1, _2));
}
<< quoteName(to_file, quote_python) << ")\n";
ostringstream os;
- os << support::os::python() << ' '
+ os << os::python() << ' '
<< libScriptSearch("$$s/scripts/convertDefault.py",
quote_python) << ' ';
if (!from_format.empty())
{
static int theCounter = 0;
string const filename = lyx::convert<string>(theCounter++) + "lyxpreview";
- return lyx::support::addName(bufferpath, filename);
+ return addName(bufferpath, filename);
}
void InProgress::stop() const
{
if (pid)
- lyx::support::ForkedCallsController::kill(pid, 0);
+ ForkedCallsController::kill(pid, 0);
if (!metrics_file.empty())
metrics_file.removeFile();
if (!pconverter_ || status(latex_snippet) != NotFound)
return;
- string const snippet = support::trim(latex_snippet);
+ string const snippet = trim(latex_snippet);
if (snippet.empty())
return;
// The conversion command.
ostringstream cs;
cs << pconverter_->command << ' ' << pconverter_->to << ' '
- << support::quoteName(latexfile.toFilesystemEncoding()) << ' '
+ << quoteName(latexfile.toFilesystemEncoding()) << ' '
<< int(font_scaling_factor_) << ' '
<< theApp()->hexName(Color_preview) << ' '
<< theApp()->hexName(Color_background);
- string const command = support::libScriptSearch(cs.str());
+ string const command = libScriptSearch(cs.str());
// Initiate the conversion from LaTeX to bitmap images files.
- support::ForkedCall::SignalTypePtr
- convert_ptr(new support::ForkedCall::SignalType);
+ ForkedCall::SignalTypePtr
+ convert_ptr(new ForkedCall::SignalType);
convert_ptr->connect(bind(&Impl::finishedGenerating, this, _1, _2));
- support::ForkedCall call;
+ ForkedCall call;
int ret = call.startScript(command, convert_ptr);
if (ret != 0) {
string const & placeholder,
string const & path,
bool use_latex_path,
- support::latex_path_extension ext = support::PROTECT_EXTENSION,
- support::latex_path_dots dots = support::LEAVE_DOTS)
+ latex_path_extension ext = PROTECT_EXTENSION,
+ latex_path_dots dots = LEAVE_DOTS)
{
if (input.find(placeholder) == string::npos)
return input;
// path will be compared with another one in internal style later
// in Converters::move.
string const path2 = use_latex_path ?
- support::latex_path(path, ext, dots) : path;
- return support::subst(input, placeholder, path2);
+ latex_path(path, ext, dots) : path;
+ return subst(input, placeholder, path2);
}
} // namespace anon
string const filename = external_in_tmpdir ?
params.filename.mangledFilename() :
params.filename.outputFilename(parentpath);
- string const basename = support::changeExtension(
- support::onlyFilename(filename), string());
- string const absname = support::makeAbsPath(filename, parentpath).absFilename();
+ string const basename = changeExtension(
+ onlyFilename(filename), string());
+ string const absname = makeAbsPath(filename, parentpath).absFilename();
string result = s;
if (what != ALL_BUT_PATHS) {
- string const filepath = support::onlyPath(filename);
- string const abspath = support::onlyPath(absname);
+ string const filepath = onlyPath(filename);
+ string const abspath = onlyPath(absname);
string const masterpath = external_in_tmpdir ?
masterBuffer->temppath() :
masterBuffer->filePath();
// FIXME UNICODE
- string relToMasterPath = support::onlyPath(
- to_utf8(support::makeRelPath(from_utf8(absname),
+ string relToMasterPath = onlyPath(
+ to_utf8(makeRelPath(from_utf8(absname),
from_utf8(masterpath))));
if (relToMasterPath == "./")
relToMasterPath.clear();
// FIXME UNICODE
- string relToParentPath = support::onlyPath(
- to_utf8(support::makeRelPath(from_utf8(absname),
+ string relToParentPath = onlyPath(
+ to_utf8(makeRelPath(from_utf8(absname),
from_utf8(parentpath))));
if (relToParentPath == "./")
relToParentPath.clear();
result = subst_path(result, "$$FPath", filepath,
use_latex_path,
- support::PROTECT_EXTENSION,
- support::ESCAPE_DOTS);
+ PROTECT_EXTENSION,
+ ESCAPE_DOTS);
result = subst_path(result, "$$AbsPath", abspath,
use_latex_path,
- support::PROTECT_EXTENSION,
- support::ESCAPE_DOTS);
+ PROTECT_EXTENSION,
+ ESCAPE_DOTS);
result = subst_path(result, "$$RelPathMaster",
relToMasterPath, use_latex_path,
- support::PROTECT_EXTENSION,
- support::ESCAPE_DOTS);
+ PROTECT_EXTENSION,
+ ESCAPE_DOTS);
result = subst_path(result, "$$RelPathParent",
relToParentPath, use_latex_path,
- support::PROTECT_EXTENSION,
- support::ESCAPE_DOTS);
- if (support::absolutePath(filename)) {
+ PROTECT_EXTENSION,
+ ESCAPE_DOTS);
+ if (absolutePath(filename)) {
result = subst_path(result, "$$AbsOrRelPathMaster",
abspath, use_latex_path,
- support::PROTECT_EXTENSION,
- support::ESCAPE_DOTS);
+ PROTECT_EXTENSION,
+ ESCAPE_DOTS);
result = subst_path(result, "$$AbsOrRelPathParent",
abspath, use_latex_path,
- support::PROTECT_EXTENSION,
- support::ESCAPE_DOTS);
+ PROTECT_EXTENSION,
+ ESCAPE_DOTS);
} else {
result = subst_path(result, "$$AbsOrRelPathMaster",
relToMasterPath, use_latex_path,
- support::PROTECT_EXTENSION,
- support::ESCAPE_DOTS);
+ PROTECT_EXTENSION,
+ ESCAPE_DOTS);
result = subst_path(result, "$$AbsOrRelPathParent",
relToParentPath, use_latex_path,
- support::PROTECT_EXTENSION,
- support::ESCAPE_DOTS);
+ PROTECT_EXTENSION,
+ ESCAPE_DOTS);
}
}
return result;
result = subst_path(result, "$$FName", filename, use_latex_path,
- support::EXCLUDE_EXTENSION);
+ EXCLUDE_EXTENSION);
result = subst_path(result, "$$Basename", basename, use_latex_path,
- support::PROTECT_EXTENSION, support::ESCAPE_DOTS);
+ PROTECT_EXTENSION, ESCAPE_DOTS);
result = subst_path(result, "$$Extension",
- '.' + support::getExtension(filename), use_latex_path);
+ '.' + getExtension(filename), use_latex_path);
result = subst_path(result, "$$Tempname", params.tempname().absFilename(), use_latex_path);
result = subst_path(result, "$$Sysdir",
- support::package().system_support().absFilename(), use_latex_path);
+ package().system_support().absFilename(), use_latex_path);
// Handle the $$Contents(filename) syntax
- if (support::contains(result, "$$Contents(\"")) {
+ if (contains(result, "$$Contents(\"")) {
// Since use_latex_path may be true we must extract the file
// name from s instead of result and do the substitutions
// again, this time with use_latex_path false.
string contents;
FileName const absfile(
- support::makeAbsPath(file, masterBuffer->temppath()));
+ makeAbsPath(file, masterBuffer->temppath()));
if (absfile.isReadableFile())
// FIXME UNICODE
contents = to_utf8(absfile.fileContents("UTF-8"));
// We copy the source file to the temp dir and do the conversion
// there if necessary
FileName const temp_file(
- support::makeAbsPath(params.filename.mangledFilename(),
+ makeAbsPath(params.filename.mangledFilename(),
masterBuffer->temppath()));
if (!params.filename.empty() && !params.filename.isDirectory()) {
unsigned long const from_checksum = params.filename.checksum();
outputFormat.updateResult,
false, true);
FileName const abs_to_file(
- support::makeAbsPath(to_file, masterBuffer->temppath()));
+ makeAbsPath(to_file, masterBuffer->temppath()));
if (!dryrun) {
// Record the referenced files for the exporter.
vector<string>::const_iterator fit = rit->second.begin();
vector<string>::const_iterator fend = rit->second.end();
for (; fit != fend; ++fit) {
- FileName const source(support::makeAbsPath(
+ FileName const source(makeAbsPath(
doSubstitution(params, buffer, *fit,
false, true),
masterBuffer->temppath()));
// temp path, but the filename may be the mangled
// or the real name. Therefore we substitute the
// paths and names separately.
- string file = support::subst(*fit, "$$FName",
+ string file = subst(*fit, "$$FName",
"$$FPath$$Basename$$Extension");
file = doSubstitution(params, buffer, file, false, false,
PATHS);
// Do we need to perform the conversion?
// Yes if to_file does not exist or if from_file is newer than to_file
- if (support::compare_timestamps(temp_file, abs_to_file) < 0)
+ if (compare_timestamps(temp_file, abs_to_file) < 0)
return; // SUCCESS
// FIXME (Abdel 12/08/06): Is there a need to show these errors?
return 0;
}
- if (!dryrun || support::contains(cit->second.product, "$$Contents"))
+ if (!dryrun || contains(cit->second.product, "$$Contents"))
updateExternal(params, format, buffer, exportdata,
external_in_tmpdir, dryrun);
string str = doSubstitution(params, buffer, cit->second.product,
use_latex_path, external_in_tmpdir);
- string const absname = support::makeAbsPath(
+ string const absname = makeAbsPath(
params.filename.outputFilename(buffer.filePath()), buffer.filePath()).absFilename();
if (!external_in_tmpdir && !isValidLaTeXFilename(absname)) {
return input;
string result =
- support::subst(input, ptr->front_placeholder(), ptr->front());
- return support::subst(result, ptr->back_placeholder(), ptr->back());
+ subst(input, ptr->front_placeholder(), ptr->front());
+ return subst(result, ptr->back_placeholder(), ptr->back());
}
if (!ptr.get())
return input;
- return support::subst(input, ptr->placeholder(), ptr->option());
+ return subst(input, ptr->placeholder(), ptr->option());
}
for (; it != end; ++it) {
string const opt = substituteOption(params, it->option, format);
string const placeholder = "$$" + it->name;
- output = support::subst(output, placeholder, opt);
+ output = subst(output, placeholder, opt);
}
return output;
#include <ostream>
using namespace std;
+using namespace lyx::support;
namespace lyx {
namespace external {
TemplateManager::TemplateManager()
{
- readTemplates(support::package().user_support());
+ readTemplates(package().user_support());
if (lyxerr.debugging(Debug::EXTERNAL)) {
dumpPreambleDefs(lyxerr);
lyxerr << '\n';
string const
TemplateManager::getPreambleDefByName(string const & name) const
{
- string const trimmed_name = support::trim(name);
+ string const trimmed_name = trim(name);
if (trimmed_name.empty())
return string();
}
-void TemplateManager::readTemplates(support::FileName const & path)
+void TemplateManager::readTemplates(FileName const & path)
{
- support::PathChanger p(path);
+ PathChanger p(path);
enum TemplateTags {
TM_PREAMBLEDEF = 1,
Lexer lex(templatetags, TM_TEMPLATE_END);
- support::FileName const filename = support::libFileSearch("", "external_templates");
+ FileName const filename = libFileSearch("", "external_templates");
if (filename.empty() || !lex.setFile(filename)) {
lex.printError("external::TemplateManager::readTemplates: "
"No template file");
output = what.str(1);
// Remove any surrounding whitespace
- output = support::trim(output);
+ output = trim(output);
// If the thing is empty, leave it so, else wrap it in square brackets.
return output.empty() ? output : "[" + output + "]";
#include <ostream>
using namespace std;
+using namespace lyx::support;
namespace lyx {
{
InsetCommand::read(buf, lex);
- if (support::prefixIs(getParam("key"), key_prefix)) {
+ if (prefixIs(getParam("key"), key_prefix)) {
int const key = convert<int>(getParam("key").substr(key_prefix.length()));
key_counter = max(key_counter, key);
}
cur.noUpdate();
break;
}
- } catch (support::ExceptionMessage const & message) {
- if (message.type_ == support::WarningException) {
+ } catch (ExceptionMessage const & message) {
+ if (message.type_ == WarningException) {
Alert::warning(message.title_, message.details_);
cur.noUpdate();
} else
FileNameList const InsetBibtex::getFiles(Buffer const & buffer) const
{
FileName path(buffer.filePath());
- support::PathChanger p(path);
+ PathChanger p(path);
FileNameList vec;
#include <sstream>
using namespace std;
+using namespace lyx::support;
namespace lyx {
void InsetCaption::setCustomLabel(docstring const & label)
{
- if (!support::isAscii(label) || label.empty())
+ if (!isAscii(label) || label.empty())
// This must be a user defined layout. We cannot translate
// this, since gettext accepts only ascii keys.
custom_label_ = label;
void InsetCaption::updateLabels(Buffer const & buf, ParIterator const & it)
{
- using support::bformat;
TextClass const & tclass = buf.params().getTextClass();
Counters & cnts = tclass.counters();
string const & type = cnts.current_float();
docstring const getBasicLabel(docstring const & keyList, docstring const & after)
{
- using support::contains;
-
docstring keys = keyList;
docstring label;
TempName::TempName()
{
- support::FileName const tempname(support::tempName(support::FileName(), "lyxext"));
+ FileName const tempname(tempName(FileName(), "lyxext"));
// FIXME: This is unsafe
tempname.removeFile();
// must have an extension for the converter code to work correctly.
- tempname_ = support::FileName(tempname.absFilename() + ".tmp");
+ tempname_ = FileName(tempname.absFilename() + ".tmp");
}
}
if (!resizedata.no_resize()) {
- using support::float_equal;
double const scl = convert<double>(resizedata.scale);
if (!float_equal(scl, 0.0, 0.05)) {
if (!float_equal(scl, 100.0, 0.05))
external::getTemplatePtr(params);
if (!ptr)
// FIXME UNICODE
- return support::bformat((_("External template %1$s is not installed")),
+ return bformat((_("External template %1$s is not installed")),
from_utf8(params.templatename()));
// FIXME UNICODE
docstring gui = _(ptr->guiName);
if (!success) {
// FIXME UNICODE
LYXERR(Debug::GRAPHICS,
- to_utf8(support::bformat(_("Could not copy the file\n%1$s\n"
+ to_utf8(bformat(_("Could not copy the file\n%1$s\n"
"into the temporary directory."),
from_utf8(file_in.absFilename()))));
}
pair<GraphicsCopyStatus, FileName> const
copyToDirIfNeeded(DocFileName const & file, string const & dir)
{
- using support::rtrim;
-
string const file_in = file.absFilename();
- string const only_path = support::onlyPath(file_in);
- if (rtrim(support::onlyPath(file_in) , "/") == rtrim(dir, "/"))
+ string const only_path = onlyPath(file_in);
+ if (rtrim(onlyPath(file_in) , "/") == rtrim(dir, "/"))
return make_pair(IDENTICAL_PATHS, file_in);
string mangled = file.mangledFilename();
string::size_type const ext_len = file_in.length() - base.length();
mangled[mangled.length() - ext_len] = '.';
}
- FileName const file_out(support::makeAbsPath(mangled, dir));
+ FileName const file_out(makeAbsPath(mangled, dir));
return copyFileIfNeeded(file, file_out);
}
// dots with a macro whose definition is just a dot ;-)
// The automatic format selection does not work if the file
// name is escaped.
- string const latex_name = latex_path(file,
- support::EXCLUDE_EXTENSION);
+ string const latex_name = latex_path(file, EXCLUDE_EXTENSION);
if (!nice || contains(latex_name, '"'))
return latex_name;
- return latex_path(removeExtension(file),
- support::PROTECT_EXTENSION,
- support::ESCAPE_DOTS);
+ return latex_path(removeExtension(file), PROTECT_EXTENSION, ESCAPE_DOTS);
}
(to_format == "eps" && file_format == "ps") ||
(to_format == "ps" && file_format == "eps"))
return stripExtensionIfPossible(file, nice);
- return latex_path(file, support::EXCLUDE_EXTENSION);
+ return latex_path(file, EXCLUDE_EXTENSION);
}
} // namespace anon
source_file, output_file);
// We can't strip the extension, because we don't know
// the unzipped file format
- return latex_path(output_file,
- support::EXCLUDE_EXTENSION);
+ return latex_path(output_file, EXCLUDE_EXTENSION);
}
FileName const unzipped_temp_file =
// the file format from the extension, so we must
// change it.
FileName const new_file = FileName(changeExtension(temp_file.absFilename(), ext));
- if (support::rename(temp_file, new_file)) {
+ if (rename(temp_file, new_file)) {
temp_file = new_file;
output_file = changeExtension(output_file, ext);
source_file = FileName(changeExtension(source_file.absFilename(), ext));
#include "support/lyxalgo.h"
using namespace std;
+using namespace lyx::support;
namespace lyx {
int InsetLabel::latex(Buffer const &, odocstream & os,
OutputParams const &) const
{
- os << support::escape(getCommand());
+ os << escape(getCommand());
return 0;
}
#include <sstream>
using namespace std;
+using namespace lyx::support;
namespace lyx {
-using support::bformat;
-
namespace {
docstring verboseHLine(int n)
status.enable(false);
break;
}
- if (!support::contains("tcb", cmd.argument()[0])) {
+ if (!contains("tcb", cmd.argument()[0])) {
status.enable(false);
break;
}
docstring str = p["name"];
cur.recordUndoInset();
row_type const r = (type_ == hullMultline) ? nrows() - 1 : cur.row();
- str = support::trim(str);
+ str = trim(str);
if (!str.empty())
numbered(r, true);
docstring old = label(r);
#include <sstream>
using namespace std;
+using namespace lyx::support;
namespace lyx {
case LFUN_MATH_DELIM: {
docstring ls;
- docstring rs = support::split(cmd.argument(), ls, ' ');
+ docstring rs = split(cmd.argument(), ls, ' ');
// Reasonable default values
if (ls.empty())
ls = '(';
string data = to_utf8(os.str());
// search external script
- support::FileName const file = libFileSearch("mathed", "extern_" + lang);
+ FileName const file = libFileSearch("mathed", "extern_" + lang);
if (file.empty()) {
lyxerr << "converter to '" << lang << "' not found" << endl;
return MathData();
void initSymbols()
{
- support::FileName const filename = libFileSearch(string(), "symbols");
+ FileName const filename = libFileSearch(string(), "symbols");
LYXERR(Debug::MATHED, "read symbols from " << filename);
if (filename.empty()) {
lyxerr << "Could not find symbols file" << endl;
{ if (l.enabled()) l.stream() << t; return l; }
LyXErr & operator<<(LyXErr & l, docstring const & t)
{ if (l.enabled()) l.stream() << to_utf8(t); return l; }
-LyXErr & operator<<(LyXErr & l, support::FileName const & t)
+LyXErr & operator<<(LyXErr & l, FileName const & t)
{ if (l.enabled()) l.stream() << t; return l; }
LyXErr & operator<<(LyXErr & l, ostream &(*t)(ostream &))
{ if (l.enabled()) l.stream() << t; return l; }
for (; iit != eit; ++iit) {
s += *iit;
++n;
- bool true_ok = lyx::support::prefixIs(truename, s);
- bool false_ok = lyx::support::prefixIs(falsename, s);
+ bool true_ok = prefixIs(truename, s);
+ bool false_ok = prefixIs(falsename, s);
if (!true_ok && !false_ok) {
++iit;
ok = false;
#include <iostream>
using namespace std;
+using namespace lyx::support;
namespace lyx {
void Context::add_extra_stuff(string const & stuff)
{
- if (!lyx::support::contains(extra_stuff, stuff))
+ if (!contains(extra_stuff, stuff))
extra_stuff += stuff;
}
// Force textclass if the user wanted it
if (!forceclass.empty())
h_textclass = forceclass;
- if (noweb_mode && !lyx::support::prefixIs(h_textclass, "literate-"))
+ if (noweb_mode && !prefixIs(h_textclass, "literate-"))
h_textclass.insert(0, "literate-");
FileName layoutfilename = libFileSearch("layouts", h_textclass, "layout");
if (layoutfilename.empty()) {
return 2;
}
- lyx::support::os::init(argc, argv);
+ os::init(argc, argv);
- try { support::init_package(internal_path(to_utf8(from_local8bit(argv[0]))),
+ try { init_package(internal_path(to_utf8(from_local8bit(argv[0]))),
cl_system_support, cl_user_support,
- support::top_build_dir_is_two_levels_up);
- } catch (support::ExceptionMessage const & message) {
+ top_build_dir_is_two_levels_up);
+ } catch (ExceptionMessage const & message) {
cerr << to_utf8(message.title_) << ":\n"
<< to_utf8(message.details_) << endl;
- if (message.type_ == support::ErrorException)
+ if (message.type_ == ErrorException)
exit(1);
}
} else
outfilename = changeExtension(infilename, ".lyx");
- FileName const system_syntaxfile = lyx::support::libFileSearch("", "syntax.default");
+ FileName const system_syntaxfile = libFileSearch("", "syntax.default");
if (system_syntaxfile.empty()) {
cerr << "Error: Could not find syntax file \"syntax.default\"." << endl;
exit(1);
if (contains(len, '\\'))
unit = trim(string(len, i));
else
- unit = support::ascii_lowercase(trim(string(len, i)));
+ unit = ascii_lowercase(trim(string(len, i)));
return true;
}
/// convention (relative to .lyx file) if it is relative
void fix_relative_filename(string & name)
{
- if (lyx::support::absolutePath(name))
+ if (absolutePath(name))
return;
// FIXME UNICODE encoding of name may be wrong (makeAbsPath expects
// utf8)