mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
support/textutils.h:
support/filetools.h: rename IsDirWriteable IsFileReadable IsLyXFilename IsSGMLFilename IsLineSeparatorChar IsLetterChar IsPrintable IsPrintableNonspace IsDigit to lower case initial lyxvc.C: LaTeXFeatures.C: lyx_cb.C: insets/insetbibtex.C: insets/insetexternal.C: insets/insetgraphics.C: insets/ExternalSupport.C: insets/insetinclude.C: BufferView_pimpl.C: graphics/GraphicsCacheItem.C: text2.C: converter.C: buffer.C: lyxfunc.C: frontends/gtk/ghelpers.C: frontends/controllers/ControlGraphics.C: frontends/controllers/ControlInclude.C: frontends/controllers/ControlSpellchecker.C: support/filetools.C: support/filetools.h: adjust git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13595 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
218dc64141
commit
1f5c5a06ee
@ -89,7 +89,7 @@ using lyx::support::bformat;
|
|||||||
using lyx::support::FileFilterList;
|
using lyx::support::FileFilterList;
|
||||||
using lyx::support::FileSearch;
|
using lyx::support::FileSearch;
|
||||||
using lyx::support::ForkedcallsController;
|
using lyx::support::ForkedcallsController;
|
||||||
using lyx::support::IsDirWriteable;
|
using lyx::support::isDirWriteable;
|
||||||
using lyx::support::MakeDisplayPath;
|
using lyx::support::MakeDisplayPath;
|
||||||
using lyx::support::MakeAbsPath;
|
using lyx::support::MakeAbsPath;
|
||||||
using lyx::support::package;
|
using lyx::support::package;
|
||||||
@ -907,7 +907,7 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filenm)
|
|||||||
if (available()) {
|
if (available()) {
|
||||||
string const trypath = owner_->buffer()->filePath();
|
string const trypath = owner_->buffer()->filePath();
|
||||||
// If directory is writeable, use this as default.
|
// If directory is writeable, use this as default.
|
||||||
if (IsDirWriteable(trypath))
|
if (isDirWriteable(trypath))
|
||||||
initpath = trypath;
|
initpath = trypath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
using lyx::support::IsSGMLFilename;
|
using lyx::support::isSGMLFilename;
|
||||||
using lyx::support::LibFileSearch;
|
using lyx::support::LibFileSearch;
|
||||||
using lyx::support::MakeRelPath;
|
using lyx::support::MakeRelPath;
|
||||||
using lyx::support::OnlyPath;
|
using lyx::support::OnlyPath;
|
||||||
@ -509,7 +509,7 @@ string const LaTeXFeatures::getIncludedFiles(string const & fname) const
|
|||||||
for (FileMap::const_iterator fi = IncludedFiles_.begin();
|
for (FileMap::const_iterator fi = IncludedFiles_.begin();
|
||||||
fi != end; ++fi)
|
fi != end; ++fi)
|
||||||
sgmlpreamble << "\n<!ENTITY " << fi->first
|
sgmlpreamble << "\n<!ENTITY " << fi->first
|
||||||
<< (IsSGMLFilename(fi->second) ? " SYSTEM \"" : " \"")
|
<< (isSGMLFilename(fi->second) ? " SYSTEM \"" : " \"")
|
||||||
<< MakeRelPath(fi->second, basename) << "\">";
|
<< MakeRelPath(fi->second, basename) << "\">";
|
||||||
|
|
||||||
return sgmlpreamble.str();
|
return sgmlpreamble.str();
|
||||||
|
@ -101,7 +101,7 @@ using lyx::support::cmd_ret;
|
|||||||
using lyx::support::createBufferTmpDir;
|
using lyx::support::createBufferTmpDir;
|
||||||
using lyx::support::destroyDir;
|
using lyx::support::destroyDir;
|
||||||
using lyx::support::getFormatFromContents;
|
using lyx::support::getFormatFromContents;
|
||||||
using lyx::support::IsDirWriteable;
|
using lyx::support::isDirWriteable;
|
||||||
using lyx::support::LibFileSearch;
|
using lyx::support::LibFileSearch;
|
||||||
using lyx::support::latex_path;
|
using lyx::support::latex_path;
|
||||||
using lyx::support::ltrim;
|
using lyx::support::ltrim;
|
||||||
@ -531,7 +531,7 @@ void Buffer::insertStringAsLines(ParagraphList & pars,
|
|||||||
}
|
}
|
||||||
space_inserted = true;
|
space_inserted = true;
|
||||||
}
|
}
|
||||||
} else if (!IsPrintable(*cit)) {
|
} else if (!isPrintable(*cit)) {
|
||||||
// Ignore unprintables
|
// Ignore unprintables
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
@ -36,7 +36,7 @@ using lyx::support::compare_ascii_no_case;
|
|||||||
using lyx::support::contains;
|
using lyx::support::contains;
|
||||||
using lyx::support::DirList;
|
using lyx::support::DirList;
|
||||||
using lyx::support::GetExtension;
|
using lyx::support::GetExtension;
|
||||||
using lyx::support::IsFileReadable;
|
using lyx::support::isFileReadable;
|
||||||
using lyx::support::LibFileSearch;
|
using lyx::support::LibFileSearch;
|
||||||
using lyx::support::LibScriptSearch;
|
using lyx::support::LibScriptSearch;
|
||||||
using lyx::support::MakeRelPath;
|
using lyx::support::MakeRelPath;
|
||||||
@ -310,7 +310,7 @@ bool Converters::convert(Buffer const * buffer,
|
|||||||
<< command << endl;
|
<< command << endl;
|
||||||
Systemcall one;
|
Systemcall one;
|
||||||
one.startscript(Systemcall::Wait, command);
|
one.startscript(Systemcall::Wait, command);
|
||||||
if (IsFileReadable(to_file)) {
|
if (isFileReadable(to_file)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ namespace lyx {
|
|||||||
|
|
||||||
using support::AddName;
|
using support::AddName;
|
||||||
using support::FileFilterList;
|
using support::FileFilterList;
|
||||||
using support::IsFileReadable;
|
using support::isFileReadable;
|
||||||
using support::MakeAbsPath;
|
using support::MakeAbsPath;
|
||||||
using support::package;
|
using support::package;
|
||||||
using support::readBB_from_PSFile;
|
using support::readBB_from_PSFile;
|
||||||
@ -133,7 +133,7 @@ bool ControlGraphics::isFilenameValid(string const & fname) const
|
|||||||
{
|
{
|
||||||
// It may be that the filename is relative.
|
// It may be that the filename is relative.
|
||||||
string const name = MakeAbsPath(fname, kernel().bufferFilepath());
|
string const name = MakeAbsPath(fname, kernel().bufferFilepath());
|
||||||
return IsFileReadable(name);
|
return isFileReadable(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ using std::string;
|
|||||||
namespace lyx {
|
namespace lyx {
|
||||||
|
|
||||||
using support::FileFilterList;
|
using support::FileFilterList;
|
||||||
using support::IsFileReadable;
|
using support::isFileReadable;
|
||||||
using support::MakeAbsPath;
|
using support::MakeAbsPath;
|
||||||
using support::OnlyPath;
|
using support::OnlyPath;
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ bool ControlInclude::fileExists(string const & file)
|
|||||||
= MakeAbsPath(file,
|
= MakeAbsPath(file,
|
||||||
OnlyPath(kernel().buffer().fileName()));
|
OnlyPath(kernel().buffer().fileName()));
|
||||||
|
|
||||||
if (IsFileReadable(fileWithAbsPath))
|
if (isFileReadable(fileWithAbsPath))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -161,7 +161,7 @@ WordLangTuple nextWord(DocIterator & cur, ptrdiff_t & progress,
|
|||||||
Paragraph::value_type const c =
|
Paragraph::value_type const c =
|
||||||
cur.paragraph().getChar(cur.pos());
|
cur.paragraph().getChar(cur.pos());
|
||||||
word += c;
|
word += c;
|
||||||
if (IsDigit(c))
|
if (isDigit(c))
|
||||||
ignoreword = true;
|
ignoreword = true;
|
||||||
}
|
}
|
||||||
} else { // !isLetter(cur)
|
} else { // !isLetter(cur)
|
||||||
|
@ -257,7 +257,7 @@ string const findGladeFile(string const & name)
|
|||||||
filename = lyx::support::ChangeExtension(name, ".glade");
|
filename = lyx::support::ChangeExtension(name, ".glade");
|
||||||
filename = lyx::support::AddName(dir, filename);
|
filename = lyx::support::AddName(dir, filename);
|
||||||
|
|
||||||
if (!lyx::support::IsFileReadable(filename)) {
|
if (!lyx::support::isFileReadable(filename)) {
|
||||||
lyxerr << "Unable to find glade file \"" << name
|
lyxerr << "Unable to find glade file \"" << name
|
||||||
<< "\". libglade is going to crash..." << std::endl;
|
<< "\". libglade is going to crash..." << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ namespace support = lyx::support;
|
|||||||
|
|
||||||
using support::ChangeExtension;
|
using support::ChangeExtension;
|
||||||
using support::FileMonitor;
|
using support::FileMonitor;
|
||||||
using support::IsFileReadable;
|
using support::isFileReadable;
|
||||||
using support::MakeDisplayPath;
|
using support::MakeDisplayPath;
|
||||||
using support::OnlyFilename;
|
using support::OnlyFilename;
|
||||||
using support::tempName;
|
using support::tempName;
|
||||||
@ -267,7 +267,7 @@ void CacheItem::Impl::imageConverted(bool success)
|
|||||||
converter_.reset();
|
converter_.reset();
|
||||||
cc_.disconnect();
|
cc_.disconnect();
|
||||||
|
|
||||||
success = !file_to_load_.empty() && IsFileReadable(file_to_load_);
|
success = !file_to_load_.empty() && isFileReadable(file_to_load_);
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
lyxerr[Debug::GRAPHICS] << "Unable to find converted file!"
|
lyxerr[Debug::GRAPHICS] << "Unable to find converted file!"
|
||||||
@ -378,7 +378,7 @@ void CacheItem::Impl::convertToDisplayFormat()
|
|||||||
setStatus(Converting);
|
setStatus(Converting);
|
||||||
|
|
||||||
// First, check that the file exists!
|
// First, check that the file exists!
|
||||||
if (!IsFileReadable(filename_)) {
|
if (!isFileReadable(filename_)) {
|
||||||
if (status_ != ErrorNoFile) {
|
if (status_ != ErrorNoFile) {
|
||||||
setStatus(ErrorNoFile);
|
setStatus(ErrorNoFile);
|
||||||
lyxerr[Debug::GRAPHICS]
|
lyxerr[Debug::GRAPHICS]
|
||||||
|
@ -172,11 +172,11 @@ string const doSubstitution(InsetExternalParams const & params,
|
|||||||
string const file = result.substr(pos + 12, end - (pos + 12));
|
string const file = result.substr(pos + 12, end - (pos + 12));
|
||||||
string contents;
|
string contents;
|
||||||
|
|
||||||
string const filepath = support::IsFileReadable(file) ?
|
string const filepath = support::isFileReadable(file) ?
|
||||||
buffer.filePath() : m_buffer->temppath();
|
buffer.filePath() : m_buffer->temppath();
|
||||||
support::Path p(filepath);
|
support::Path p(filepath);
|
||||||
|
|
||||||
if (support::IsFileReadable(file))
|
if (support::isFileReadable(file))
|
||||||
contents = support::GetFileContents(file);
|
contents = support::GetFileContents(file);
|
||||||
|
|
||||||
result = support::subst(result,
|
result = support::subst(result,
|
||||||
|
@ -43,7 +43,7 @@ using lyx::support::contains;
|
|||||||
using lyx::support::copy;
|
using lyx::support::copy;
|
||||||
using lyx::support::FileName;
|
using lyx::support::FileName;
|
||||||
using lyx::support::findtexfile;
|
using lyx::support::findtexfile;
|
||||||
using lyx::support::IsFileReadable;
|
using lyx::support::isFileReadable;
|
||||||
using lyx::support::latex_path;
|
using lyx::support::latex_path;
|
||||||
using lyx::support::ltrim;
|
using lyx::support::ltrim;
|
||||||
using lyx::support::MakeAbsPath;
|
using lyx::support::MakeAbsPath;
|
||||||
@ -112,7 +112,7 @@ string normalize_name(Buffer const & buffer, OutputParams const & runparams,
|
|||||||
string const & name, string const & ext)
|
string const & name, string const & ext)
|
||||||
{
|
{
|
||||||
string const fname = MakeAbsPath(name, buffer.filePath());
|
string const fname = MakeAbsPath(name, buffer.filePath());
|
||||||
if (AbsolutePath(name) || !IsFileReadable(fname + ext))
|
if (AbsolutePath(name) || !isFileReadable(fname + ext))
|
||||||
return name;
|
return name;
|
||||||
else if (!runparams.nice)
|
else if (!runparams.nice)
|
||||||
return fname;
|
return fname;
|
||||||
@ -162,7 +162,7 @@ int InsetBibtex::latex(Buffer const & buffer, ostream & os,
|
|||||||
string const in_file = database + ".bib";
|
string const in_file = database + ".bib";
|
||||||
|
|
||||||
if (!runparams.inComment && !runparams.nice &&
|
if (!runparams.inComment && !runparams.nice &&
|
||||||
IsFileReadable(in_file)) {
|
isFileReadable(in_file)) {
|
||||||
|
|
||||||
// mangledFilename() needs the extension
|
// mangledFilename() needs the extension
|
||||||
database = removeExtension(FileName(in_file).mangledFilename());
|
database = removeExtension(FileName(in_file).mangledFilename());
|
||||||
@ -217,7 +217,7 @@ int InsetBibtex::latex(Buffer const & buffer, ostream & os,
|
|||||||
// This prevents problems with spaces and 8bit charcaters
|
// This prevents problems with spaces and 8bit charcaters
|
||||||
// in the file name.
|
// in the file name.
|
||||||
if (!runparams.inComment && !runparams.nice &&
|
if (!runparams.inComment && !runparams.nice &&
|
||||||
IsFileReadable(in_file)) {
|
isFileReadable(in_file)) {
|
||||||
// use new style name
|
// use new style name
|
||||||
base = removeExtension(
|
base = removeExtension(
|
||||||
FileName(in_file).mangledFilename());
|
FileName(in_file).mangledFilename());
|
||||||
|
@ -801,7 +801,7 @@ bool preview_wanted(InsetExternalParams const & params)
|
|||||||
string const included_file = params.filename.absFilename();
|
string const included_file = params.filename.absFilename();
|
||||||
|
|
||||||
return params.display == external::PreviewDisplay &&
|
return params.display == external::PreviewDisplay &&
|
||||||
support::IsFileReadable(included_file);
|
support::isFileReadable(included_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ using lyx::support::contains;
|
|||||||
using lyx::support::FileName;
|
using lyx::support::FileName;
|
||||||
using lyx::support::float_equal;
|
using lyx::support::float_equal;
|
||||||
using lyx::support::GetExtension;
|
using lyx::support::GetExtension;
|
||||||
using lyx::support::IsFileReadable;
|
using lyx::support::isFileReadable;
|
||||||
using lyx::support::latex_path;
|
using lyx::support::latex_path;
|
||||||
using lyx::support::OnlyFilename;
|
using lyx::support::OnlyFilename;
|
||||||
using lyx::support::removeExtension;
|
using lyx::support::removeExtension;
|
||||||
@ -576,7 +576,7 @@ string const InsetGraphics::prepareFile(Buffer const & buf,
|
|||||||
// not exist.
|
// not exist.
|
||||||
// We are not going to change the extension or using the name of the
|
// We are not going to change the extension or using the name of the
|
||||||
// temporary file, the code is already complicated enough.
|
// temporary file, the code is already complicated enough.
|
||||||
if (runparams.inComment || !IsFileReadable(orig_file))
|
if (runparams.inComment || !isFileReadable(orig_file))
|
||||||
return params().filename.outputFilename(m_buffer->filePath());
|
return params().filename.outputFilename(m_buffer->filePath());
|
||||||
|
|
||||||
// We place all temporary files in the master buffer's temp dir.
|
// We place all temporary files in the master buffer's temp dir.
|
||||||
@ -726,7 +726,7 @@ int InsetGraphics::latex(Buffer const & buf, ostream & os,
|
|||||||
params().filename.relFilename(buf.filePath());
|
params().filename.relFilename(buf.filePath());
|
||||||
|
|
||||||
string const file_ = params().filename.absFilename();
|
string const file_ = params().filename.absFilename();
|
||||||
bool const file_exists = !file_.empty() && IsFileReadable(file_);
|
bool const file_exists = !file_.empty() && isFileReadable(file_);
|
||||||
string const message = file_exists ?
|
string const message = file_exists ?
|
||||||
string() : string("bb = 0 0 200 100, draft, type=eps");
|
string() : string("bb = 0 0 200 100, draft, type=eps");
|
||||||
// if !message.empty() then there was no existing file
|
// if !message.empty() then there was no existing file
|
||||||
|
@ -61,8 +61,8 @@ using lyx::support::contains;
|
|||||||
using lyx::support::copy;
|
using lyx::support::copy;
|
||||||
using lyx::support::FileName;
|
using lyx::support::FileName;
|
||||||
using lyx::support::GetFileContents;
|
using lyx::support::GetFileContents;
|
||||||
using lyx::support::IsFileReadable;
|
using lyx::support::isFileReadable;
|
||||||
using lyx::support::IsLyXFilename;
|
using lyx::support::isLyXFilename;
|
||||||
using lyx::support::latex_path;
|
using lyx::support::latex_path;
|
||||||
using lyx::support::MakeAbsPath;
|
using lyx::support::MakeAbsPath;
|
||||||
using lyx::support::MakeDisplayPath;
|
using lyx::support::MakeDisplayPath;
|
||||||
@ -307,7 +307,7 @@ bool loadIfNeeded(Buffer const & buffer, InsetCommandParams const & params)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
string const included_file = includedFilename(buffer, params);
|
string const included_file = includedFilename(buffer, params);
|
||||||
if (!IsLyXFilename(included_file))
|
if (!isLyXFilename(included_file))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Buffer * buf = bufferlist.getBuffer(included_file);
|
Buffer * buf = bufferlist.getBuffer(included_file);
|
||||||
@ -417,7 +417,7 @@ int InsetInclude::latex(Buffer const & buffer, ostream & os,
|
|||||||
exportfile);
|
exportfile);
|
||||||
|
|
||||||
// \input wants file with extension (default is .tex)
|
// \input wants file with extension (default is .tex)
|
||||||
if (!IsLyXFilename(included_file)) {
|
if (!isLyXFilename(included_file)) {
|
||||||
incfile = latex_path(incfile);
|
incfile = latex_path(incfile);
|
||||||
os << '\\' << params_.getCmdName() << '{' << incfile << '}';
|
os << '\\' << params_.getCmdName() << '{' << incfile << '}';
|
||||||
} else {
|
} else {
|
||||||
@ -553,7 +553,7 @@ void InsetInclude::validate(LaTeXFeatures & features) const
|
|||||||
|
|
||||||
string const included_file = includedFilename(buffer, params_);
|
string const included_file = includedFilename(buffer, params_);
|
||||||
|
|
||||||
if (IsLyXFilename(included_file))
|
if (isLyXFilename(included_file))
|
||||||
writefile = ChangeExtension(included_file, ".sgml");
|
writefile = ChangeExtension(included_file, ".sgml");
|
||||||
else
|
else
|
||||||
writefile = included_file;
|
writefile = included_file;
|
||||||
@ -692,7 +692,7 @@ bool preview_wanted(InsetCommandParams const & params, Buffer const & buffer)
|
|||||||
string const included_file = includedFilename(buffer, params);
|
string const included_file = includedFilename(buffer, params);
|
||||||
|
|
||||||
return type(params) == INPUT && params.preview() &&
|
return type(params) == INPUT && params.preview() &&
|
||||||
IsFileReadable(included_file);
|
isFileReadable(included_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ using lyx::support::bformat;
|
|||||||
using lyx::support::destroyDir;
|
using lyx::support::destroyDir;
|
||||||
using lyx::support::FileFilterList;
|
using lyx::support::FileFilterList;
|
||||||
using lyx::support::ForkedProcess;
|
using lyx::support::ForkedProcess;
|
||||||
using lyx::support::IsLyXFilename;
|
using lyx::support::isLyXFilename;
|
||||||
using lyx::support::LibFileSearch;
|
using lyx::support::LibFileSearch;
|
||||||
using lyx::support::MakeAbsPath;
|
using lyx::support::MakeAbsPath;
|
||||||
using lyx::support::MakeDisplayPath;
|
using lyx::support::MakeDisplayPath;
|
||||||
@ -135,7 +135,7 @@ bool WriteAs(Buffer * buffer, string const & filename)
|
|||||||
make_pair(string(_("Templates|#T#t")),
|
make_pair(string(_("Templates|#T#t")),
|
||||||
string(lyxrc.template_path)));
|
string(lyxrc.template_path)));
|
||||||
|
|
||||||
if (!IsLyXFilename(fname))
|
if (!isLyXFilename(fname))
|
||||||
fname += ".lyx";
|
fname += ".lyx";
|
||||||
|
|
||||||
FileFilterList const filter (_("LyX Documents (*.lyx)"));
|
FileFilterList const filter (_("LyX Documents (*.lyx)"));
|
||||||
@ -155,7 +155,7 @@ bool WriteAs(Buffer * buffer, string const & filename)
|
|||||||
|
|
||||||
// Make sure the absolute filename ends with appropriate suffix
|
// Make sure the absolute filename ends with appropriate suffix
|
||||||
fname = MakeAbsPath(fname);
|
fname = MakeAbsPath(fname);
|
||||||
if (!IsLyXFilename(fname))
|
if (!isLyXFilename(fname))
|
||||||
fname += ".lyx";
|
fname += ".lyx";
|
||||||
} else
|
} else
|
||||||
fname = filename;
|
fname = filename;
|
||||||
|
@ -110,8 +110,8 @@ using lyx::support::FileFilterList;
|
|||||||
using lyx::support::FileSearch;
|
using lyx::support::FileSearch;
|
||||||
using lyx::support::ForkedcallsController;
|
using lyx::support::ForkedcallsController;
|
||||||
using lyx::support::i18nLibFileSearch;
|
using lyx::support::i18nLibFileSearch;
|
||||||
using lyx::support::IsDirWriteable;
|
using lyx::support::isDirWriteable;
|
||||||
using lyx::support::IsFileReadable;
|
using lyx::support::isFileReadable;
|
||||||
using lyx::support::isStrInt;
|
using lyx::support::isStrInt;
|
||||||
using lyx::support::MakeAbsPath;
|
using lyx::support::MakeAbsPath;
|
||||||
using lyx::support::MakeDisplayPath;
|
using lyx::support::MakeDisplayPath;
|
||||||
@ -515,7 +515,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
|||||||
else if (name == "character" || name == "mathpanel")
|
else if (name == "character" || name == "mathpanel")
|
||||||
enable = cur.inset().lyxCode() != InsetBase::ERT_CODE;
|
enable = cur.inset().lyxCode() != InsetBase::ERT_CODE;
|
||||||
else if (name == "latexlog")
|
else if (name == "latexlog")
|
||||||
enable = IsFileReadable(buf->getLogName().second);
|
enable = isFileReadable(buf->getLogName().second);
|
||||||
#if !defined (USE_ASPELL) && !defined (USE_ISPELL) && !defined (USE_PSPELL)
|
#if !defined (USE_ASPELL) && !defined (USE_ISPELL) && !defined (USE_PSPELL)
|
||||||
else if (name == "spellchecker")
|
else if (name == "spellchecker")
|
||||||
enable = false;
|
enable = false;
|
||||||
@ -1696,7 +1696,7 @@ void LyXFunc::menuNew(string const & name, bool fromTemplate)
|
|||||||
if (view()->available()) {
|
if (view()->available()) {
|
||||||
string const trypath = owner->buffer()->filePath();
|
string const trypath = owner->buffer()->filePath();
|
||||||
// If directory is writeable, use this as default.
|
// If directory is writeable, use this as default.
|
||||||
if (IsDirWriteable(trypath))
|
if (isDirWriteable(trypath))
|
||||||
initpath = trypath;
|
initpath = trypath;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1746,7 +1746,7 @@ void LyXFunc::open(string const & fname)
|
|||||||
if (view()->available()) {
|
if (view()->available()) {
|
||||||
string const trypath = owner->buffer()->filePath();
|
string const trypath = owner->buffer()->filePath();
|
||||||
// If directory is writeable, use this as default.
|
// If directory is writeable, use this as default.
|
||||||
if (IsDirWriteable(trypath))
|
if (isDirWriteable(trypath))
|
||||||
initpath = trypath;
|
initpath = trypath;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1821,7 +1821,7 @@ void LyXFunc::doImport(string const & argument)
|
|||||||
if (view()->available()) {
|
if (view()->available()) {
|
||||||
string const trypath = owner->buffer()->filePath();
|
string const trypath = owner->buffer()->filePath();
|
||||||
// If directory is writeable, use this as default.
|
// If directory is writeable, use this as default.
|
||||||
if (IsDirWriteable(trypath))
|
if (isDirWriteable(trypath))
|
||||||
initpath = trypath;
|
initpath = trypath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ enum TextClassTags {
|
|||||||
// Reads a textclass structure from file.
|
// Reads a textclass structure from file.
|
||||||
bool LyXTextClass::Read(string const & filename, bool merge)
|
bool LyXTextClass::Read(string const & filename, bool merge)
|
||||||
{
|
{
|
||||||
if (!lyx::support::IsFileReadable(filename)) {
|
if (!lyx::support::isFileReadable(filename)) {
|
||||||
lyxerr << "Cannot read layout file `" << filename << "'."
|
lyxerr << "Cannot read layout file `" << filename << "'."
|
||||||
<< endl;
|
<< endl;
|
||||||
return true;
|
return true;
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "support/lyxlib.h"
|
#include "support/lyxlib.h"
|
||||||
|
|
||||||
using lyx::support::bformat;
|
using lyx::support::bformat;
|
||||||
using lyx::support::IsFileReadable;
|
using lyx::support::isFileReadable;
|
||||||
using lyx::support::MakeDisplayPath;
|
using lyx::support::MakeDisplayPath;
|
||||||
using lyx::support::tempName;
|
using lyx::support::tempName;
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ void LyXVC::registrer()
|
|||||||
string const filename = owner_->fileName();
|
string const filename = owner_->fileName();
|
||||||
|
|
||||||
// there must be a file to save
|
// there must be a file to save
|
||||||
if (!IsFileReadable(filename)) {
|
if (!isFileReadable(filename)) {
|
||||||
Alert::error(_("Document not saved"),
|
Alert::error(_("Document not saved"),
|
||||||
_("You must save the document "
|
_("You must save the document "
|
||||||
"before it can be registered."));
|
"before it can be registered."));
|
||||||
@ -100,7 +100,7 @@ void LyXVC::registrer()
|
|||||||
if (!vcs) {
|
if (!vcs) {
|
||||||
string const cvs_entries = "CVS/Entries";
|
string const cvs_entries = "CVS/Entries";
|
||||||
|
|
||||||
if (IsFileReadable(cvs_entries)) {
|
if (isFileReadable(cvs_entries)) {
|
||||||
lyxerr[Debug::LYXVC]
|
lyxerr[Debug::LYXVC]
|
||||||
<< "LyXVC: registering "
|
<< "LyXVC: registering "
|
||||||
<< MakeDisplayPath(filename)
|
<< MakeDisplayPath(filename)
|
||||||
|
@ -1461,7 +1461,7 @@ bool Paragraph::isNewline(pos_type pos) const
|
|||||||
bool Paragraph::isLineSeparator(pos_type pos) const
|
bool Paragraph::isLineSeparator(pos_type pos) const
|
||||||
{
|
{
|
||||||
value_type const c = getChar(pos);
|
value_type const c = getChar(pos);
|
||||||
return IsLineSeparatorChar(c)
|
return isLineSeparatorChar(c)
|
||||||
|| (c == Paragraph::META_INSET && getInset(pos) &&
|
|| (c == Paragraph::META_INSET && getInset(pos) &&
|
||||||
getInset(pos)->isLineSeparator());
|
getInset(pos)->isLineSeparator());
|
||||||
}
|
}
|
||||||
@ -1474,7 +1474,7 @@ bool Paragraph::isLetter(pos_type pos) const
|
|||||||
return getInset(pos)->isLetter();
|
return getInset(pos)->isLetter();
|
||||||
else {
|
else {
|
||||||
value_type const c = getChar(pos);
|
value_type const c = getChar(pos);
|
||||||
return IsLetterChar(c) || IsDigit(c);
|
return isLetterChar(c) || isDigit(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1547,7 +1547,7 @@ string const Paragraph::asString(Buffer const & buffer,
|
|||||||
|
|
||||||
for (pos_type i = 0; i < size(); ++i) {
|
for (pos_type i = 0; i < size(); ++i) {
|
||||||
value_type c = getChar(i);
|
value_type c = getChar(i);
|
||||||
if (IsPrintable(c))
|
if (isPrintable(c))
|
||||||
s += c;
|
s += c;
|
||||||
else if (c == META_INSET &&
|
else if (c == META_INSET &&
|
||||||
getInset(i)->lyxCode() == InsetBase::MATH_CODE) {
|
getInset(i)->lyxCode() == InsetBase::MATH_CODE) {
|
||||||
@ -1586,7 +1586,7 @@ string const Paragraph::asString(Buffer const & buffer,
|
|||||||
|
|
||||||
for (pos_type i = beg; i < end; ++i) {
|
for (pos_type i = beg; i < end; ++i) {
|
||||||
value_type const c = getUChar(buffer.params(), i);
|
value_type const c = getUChar(buffer.params(), i);
|
||||||
if (IsPrintable(c))
|
if (isPrintable(c))
|
||||||
os << c;
|
os << c;
|
||||||
else if (c == META_INSET)
|
else if (c == META_INSET)
|
||||||
getInset(i)->textString(buffer, os, runparams);
|
getInset(i)->textString(buffer, os, runparams);
|
||||||
@ -1811,7 +1811,7 @@ size_t Paragraph::pos2row(pos_type pos) const
|
|||||||
unsigned char Paragraph::transformChar(unsigned char c, pos_type pos) const
|
unsigned char Paragraph::transformChar(unsigned char c, pos_type pos) const
|
||||||
{
|
{
|
||||||
if (!Encodings::is_arabic(c))
|
if (!Encodings::is_arabic(c))
|
||||||
if (lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 && IsDigit(c))
|
if (lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 && isDigit(c))
|
||||||
return c + (0xb0 - '0');
|
return c + (0xb0 - '0');
|
||||||
else
|
else
|
||||||
return c;
|
return c;
|
||||||
|
@ -196,7 +196,7 @@ void RowPainter::paintHebrewComposeChar(pos_type & vpos, LyXFont const & font)
|
|||||||
for (pos_type i = pos - 1; i >= 0; --i) {
|
for (pos_type i = pos - 1; i >= 0; --i) {
|
||||||
c = par_.getChar(i);
|
c = par_.getChar(i);
|
||||||
if (!Encodings::IsComposeChar_hebrew(c)) {
|
if (!Encodings::IsComposeChar_hebrew(c)) {
|
||||||
if (IsPrintableNonspace(c)) {
|
if (isPrintableNonspace(c)) {
|
||||||
int const width2 =
|
int const width2 =
|
||||||
text_.singleWidth(par_, i, c, text_.getFont(par_, i));
|
text_.singleWidth(par_, i, c, text_.getFont(par_, i));
|
||||||
// dalet / resh
|
// dalet / resh
|
||||||
@ -230,7 +230,7 @@ void RowPainter::paintArabicComposeChar(pos_type & vpos, LyXFont const & font)
|
|||||||
for (pos_type i = pos - 1; i >= 0; --i) {
|
for (pos_type i = pos - 1; i >= 0; --i) {
|
||||||
c = par_.getChar(i);
|
c = par_.getChar(i);
|
||||||
if (!Encodings::IsComposeChar_arabic(c)) {
|
if (!Encodings::IsComposeChar_arabic(c)) {
|
||||||
if (IsPrintableNonspace(c)) {
|
if (isPrintableNonspace(c)) {
|
||||||
int const width2 =
|
int const width2 =
|
||||||
text_.singleWidth(par_, i, c, text_.getFont(par_, i));
|
text_.singleWidth(par_, i, c, text_.getFont(par_, i));
|
||||||
dx = (width2 - width) / 2;
|
dx = (width2 - width) / 2;
|
||||||
@ -270,7 +270,7 @@ void RowPainter::paintChars(pos_type & vpos, LyXFont font,
|
|||||||
|
|
||||||
char c = par_.getChar(pos);
|
char c = par_.getChar(pos);
|
||||||
|
|
||||||
if (!IsPrintableNonspace(c))
|
if (!isPrintableNonspace(c))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (arabic && Encodings::IsComposeChar_arabic(c))
|
if (arabic && Encodings::IsComposeChar_arabic(c))
|
||||||
|
@ -70,13 +70,13 @@ namespace fs = boost::filesystem;
|
|||||||
namespace lyx {
|
namespace lyx {
|
||||||
namespace support {
|
namespace support {
|
||||||
|
|
||||||
bool IsLyXFilename(string const & filename)
|
bool isLyXFilename(string const & filename)
|
||||||
{
|
{
|
||||||
return suffixIs(ascii_lowercase(filename), ".lyx");
|
return suffixIs(ascii_lowercase(filename), ".lyx");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool IsSGMLFilename(string const & filename)
|
bool isSGMLFilename(string const & filename)
|
||||||
{
|
{
|
||||||
return suffixIs(ascii_lowercase(filename), ".sgml");
|
return suffixIs(ascii_lowercase(filename), ".sgml");
|
||||||
}
|
}
|
||||||
@ -142,7 +142,7 @@ string const QuoteName(string const & name)
|
|||||||
|
|
||||||
|
|
||||||
// Is a file readable ?
|
// Is a file readable ?
|
||||||
bool IsFileReadable(string const & path)
|
bool isFileReadable(string const & path)
|
||||||
{
|
{
|
||||||
return fs::exists(path) && !fs::is_directory(path) && fs::is_readable(path);
|
return fs::exists(path) && !fs::is_directory(path) && fs::is_readable(path);
|
||||||
}
|
}
|
||||||
@ -150,9 +150,9 @@ bool IsFileReadable(string const & path)
|
|||||||
|
|
||||||
//returns true: dir writeable
|
//returns true: dir writeable
|
||||||
// false: not writeable
|
// false: not writeable
|
||||||
bool IsDirWriteable(string const & path)
|
bool isDirWriteable(string const & path)
|
||||||
{
|
{
|
||||||
lyxerr[Debug::FILES] << "IsDirWriteable: " << path << endl;
|
lyxerr[Debug::FILES] << "isDirWriteable: " << path << endl;
|
||||||
|
|
||||||
string const tmpfl = tempName(path, "lyxwritetest");
|
string const tmpfl = tempName(path, "lyxwritetest");
|
||||||
|
|
||||||
@ -246,14 +246,14 @@ string const FileSearch(string const & path, string const & name,
|
|||||||
string const tmpname = ReplaceEnvironmentPath(name);
|
string const tmpname = ReplaceEnvironmentPath(name);
|
||||||
string fullname = MakeAbsPath(tmpname, path);
|
string fullname = MakeAbsPath(tmpname, path);
|
||||||
// search first without extension, then with it.
|
// search first without extension, then with it.
|
||||||
if (IsFileReadable(fullname))
|
if (isFileReadable(fullname))
|
||||||
return fullname;
|
return fullname;
|
||||||
if (ext.empty())
|
if (ext.empty())
|
||||||
return string();
|
return string();
|
||||||
// Is it not more reasonable to use ChangeExtension()? (SMiyata)
|
// Is it not more reasonable to use ChangeExtension()? (SMiyata)
|
||||||
fullname += '.';
|
fullname += '.';
|
||||||
fullname += ext;
|
fullname += ext;
|
||||||
return IsFileReadable(fullname) ? fullname : string();
|
return isFileReadable(fullname) ? fullname : string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -415,7 +415,7 @@ string const createLyXTmpDir(string const & deflt)
|
|||||||
#ifdef __EMX__
|
#ifdef __EMX__
|
||||||
Path p(package().user_support());
|
Path p(package().user_support());
|
||||||
#endif
|
#endif
|
||||||
if (IsDirWriteable(deflt)) {
|
if (isDirWriteable(deflt)) {
|
||||||
// deflt could not be created because it
|
// deflt could not be created because it
|
||||||
// did exist already, so let's create our own
|
// did exist already, so let's create our own
|
||||||
// dir inside deflt.
|
// dir inside deflt.
|
||||||
@ -797,7 +797,7 @@ string const GetExtension(string const & name)
|
|||||||
string const getFormatFromContents(string const & filename)
|
string const getFormatFromContents(string const & filename)
|
||||||
{
|
{
|
||||||
// paranoia check
|
// paranoia check
|
||||||
if (filename.empty() || !IsFileReadable(filename))
|
if (filename.empty() || !isFileReadable(filename))
|
||||||
return string();
|
return string();
|
||||||
|
|
||||||
ifstream ifs(filename.c_str());
|
ifstream ifs(filename.c_str());
|
||||||
|
@ -63,18 +63,18 @@ std::vector<std::string> const DirList(std::string const & dir,
|
|||||||
true: dir writeable
|
true: dir writeable
|
||||||
false: not writeable
|
false: not writeable
|
||||||
*/
|
*/
|
||||||
bool IsDirWriteable (std::string const & path);
|
bool isDirWriteable (std::string const & path);
|
||||||
|
|
||||||
/** Is a file readable ?
|
/** Is a file readable ?
|
||||||
Returns true if the file `path' is readable.
|
Returns true if the file `path' is readable.
|
||||||
*/
|
*/
|
||||||
bool IsFileReadable (std::string const & path);
|
bool isFileReadable (std::string const & path);
|
||||||
|
|
||||||
///
|
///
|
||||||
bool IsLyXFilename(std::string const & filename);
|
bool isLyXFilename(std::string const & filename);
|
||||||
|
|
||||||
///
|
///
|
||||||
bool IsSGMLFilename(std::string const & filename);
|
bool isSGMLFilename(std::string const & filename);
|
||||||
|
|
||||||
/** Returns the path of a library data file.
|
/** Returns the path of a library data file.
|
||||||
Search the file name.ext in the subdirectory dir of
|
Search the file name.ext in the subdirectory dir of
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
/// return true if the char is a line separator
|
/// return true if the char is a line separator
|
||||||
inline
|
inline
|
||||||
bool IsLineSeparatorChar(char c)
|
bool isLineSeparatorChar(char c)
|
||||||
{
|
{
|
||||||
return c == ' ';
|
return c == ' ';
|
||||||
}
|
}
|
||||||
@ -26,7 +26,7 @@ bool IsLineSeparatorChar(char c)
|
|||||||
|
|
||||||
/// return true if a char is alphabetical (including accented chars)
|
/// return true if a char is alphabetical (including accented chars)
|
||||||
inline
|
inline
|
||||||
bool IsLetterChar(unsigned char c)
|
bool isLetterChar(unsigned char c)
|
||||||
{
|
{
|
||||||
return (c >= 'A' && c <= 'Z')
|
return (c >= 'A' && c <= 'Z')
|
||||||
|| (c >= 'a' && c <= 'z')
|
|| (c >= 'a' && c <= 'z')
|
||||||
@ -36,7 +36,7 @@ bool IsLetterChar(unsigned char c)
|
|||||||
|
|
||||||
/// return true if the char is printable (masked to 7-bit ASCII)
|
/// return true if the char is printable (masked to 7-bit ASCII)
|
||||||
inline
|
inline
|
||||||
bool IsPrintable(unsigned char c)
|
bool isPrintable(unsigned char c)
|
||||||
{
|
{
|
||||||
return (c & 127) >= ' ';
|
return (c & 127) >= ' ';
|
||||||
}
|
}
|
||||||
@ -44,15 +44,15 @@ bool IsPrintable(unsigned char c)
|
|||||||
|
|
||||||
/// return true if the char is printable and not a space (masked to 7-bit ASCII)
|
/// return true if the char is printable and not a space (masked to 7-bit ASCII)
|
||||||
inline
|
inline
|
||||||
bool IsPrintableNonspace(unsigned char c)
|
bool isPrintableNonspace(unsigned char c)
|
||||||
{
|
{
|
||||||
return IsPrintable(c) && c != ' ';
|
return isPrintable(c) && c != ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// completely pointless FIXME
|
/// completely pointless FIXME
|
||||||
inline
|
inline
|
||||||
bool IsDigit(unsigned char ch)
|
bool isDigit(unsigned char ch)
|
||||||
{
|
{
|
||||||
return ch >= '0' && ch <= '9';
|
return ch >= '0' && ch <= '9';
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ using lyx::support::ltrim;
|
|||||||
using lyx::support::MakeAbsPath;
|
using lyx::support::MakeAbsPath;
|
||||||
using lyx::support::OnlyPath;
|
using lyx::support::OnlyPath;
|
||||||
using lyx::support::rtrim;
|
using lyx::support::rtrim;
|
||||||
using lyx::support::IsFileReadable;
|
using lyx::support::isFileReadable;
|
||||||
|
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = boost::filesystem;
|
||||||
|
|
||||||
@ -450,7 +450,7 @@ bool tex2lyx(string const &infilename, std::ostream &os)
|
|||||||
|
|
||||||
bool tex2lyx(string const &infilename, string const &outfilename)
|
bool tex2lyx(string const &infilename, string const &outfilename)
|
||||||
{
|
{
|
||||||
if (IsFileReadable(outfilename)) {
|
if (isFileReadable(outfilename)) {
|
||||||
if (overwrite_files) {
|
if (overwrite_files) {
|
||||||
cerr << "Overwriting existing file "
|
cerr << "Overwriting existing file "
|
||||||
<< outfilename << endl;
|
<< outfilename << endl;
|
||||||
|
@ -427,7 +427,7 @@ int LyXText::singleWidth(Paragraph const & par,
|
|||||||
pos_type pos, char c, LyXFont const & font) const
|
pos_type pos, char c, LyXFont const & font) const
|
||||||
{
|
{
|
||||||
// The most common case is handled first (Asger)
|
// The most common case is handled first (Asger)
|
||||||
if (IsPrintable(c)) {
|
if (isPrintable(c)) {
|
||||||
Language const * language = font.language();
|
Language const * language = font.language();
|
||||||
if (language->RightToLeft()) {
|
if (language->RightToLeft()) {
|
||||||
if ((lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 ||
|
if ((lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 ||
|
||||||
@ -1132,7 +1132,7 @@ void LyXText::insertChar(LCursor & cur, char c)
|
|||||||
static string const number_seperators = ".,:";
|
static string const number_seperators = ".,:";
|
||||||
|
|
||||||
if (current_font.number() == LyXFont::ON) {
|
if (current_font.number() == LyXFont::ON) {
|
||||||
if (!IsDigit(c) && !contains(number_operators, c) &&
|
if (!isDigit(c) && !contains(number_operators, c) &&
|
||||||
!(contains(number_seperators, c) &&
|
!(contains(number_seperators, c) &&
|
||||||
cur.pos() != 0 &&
|
cur.pos() != 0 &&
|
||||||
cur.pos() != cur.lastpos() &&
|
cur.pos() != cur.lastpos() &&
|
||||||
@ -1140,7 +1140,7 @@ void LyXText::insertChar(LCursor & cur, char c)
|
|||||||
getFont(par, cur.pos() - 1).number() == LyXFont::ON)
|
getFont(par, cur.pos() - 1).number() == LyXFont::ON)
|
||||||
)
|
)
|
||||||
number(cur); // Set current_font.number to OFF
|
number(cur); // Set current_font.number to OFF
|
||||||
} else if (IsDigit(c) &&
|
} else if (isDigit(c) &&
|
||||||
real_current_font.isVisibleRightToLeft()) {
|
real_current_font.isVisibleRightToLeft()) {
|
||||||
number(cur); // Set current_font.number to ON
|
number(cur); // Set current_font.number to ON
|
||||||
|
|
||||||
@ -1169,7 +1169,7 @@ void LyXText::insertChar(LCursor & cur, char c)
|
|||||||
|
|
||||||
// When the free-spacing option is set for the current layout,
|
// When the free-spacing option is set for the current layout,
|
||||||
// disable the double-space checking
|
// disable the double-space checking
|
||||||
if (!freeSpacing && IsLineSeparatorChar(c)) {
|
if (!freeSpacing && isLineSeparatorChar(c)) {
|
||||||
if (cur.pos() == 0) {
|
if (cur.pos() == 0) {
|
||||||
static bool sent_space_message = false;
|
static bool sent_space_message = false;
|
||||||
if (!sent_space_message) {
|
if (!sent_space_message) {
|
||||||
|
@ -648,7 +648,7 @@ void LyXText::insertStringAsParagraphs(LCursor & cur, string const & str)
|
|||||||
linestr[i] = ' ';
|
linestr[i] = ' ';
|
||||||
newline_inserted = true;
|
newline_inserted = true;
|
||||||
}
|
}
|
||||||
} else if (IsPrintable(linestr[i])) {
|
} else if (isPrintable(linestr[i])) {
|
||||||
newline_inserted = false;
|
newline_inserted = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user