mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
the const patch
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9443 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
eb0de102db
commit
46756fd9e4
@ -1,3 +1,32 @@
|
||||
2005-01-05 Lars Gullik Bjonnes <larsbj@gullik.net>
|
||||
|
||||
* lyxfunc.C (getStatus): moved from lyxfunc.C put into anon
|
||||
namespace, also more use of temp references and const
|
||||
|
||||
* cursor.[Ch] (getStatus): move to lyxfunc.C
|
||||
|
||||
* bufferparams.C: reformat slightly
|
||||
|
||||
* bufferview_funcs.C (font2string): constify arg
|
||||
|
||||
* changes.C:
|
||||
* converter.C:
|
||||
* counters.C:
|
||||
* bufferlist.C:
|
||||
* buffer_funcs.C: (many funcs): constify arg on function
|
||||
definitions, also make more local vars const, also add ASSERTS on
|
||||
pointer args.
|
||||
|
||||
* buffer.C (LYX_FORMAT): put const in correct place
|
||||
(many funcs): constify arg on function definitions, also make
|
||||
more local vars const
|
||||
|
||||
* aspell_local.h: remove "struct" from typdef setup
|
||||
|
||||
* aspell.C (check): make word_ok const
|
||||
(nextMiss): simplify slightly
|
||||
(error): ditto
|
||||
|
||||
2005-01-05 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* lyxrc.[Ch]: store all float values as strings.
|
||||
@ -44,7 +73,7 @@
|
||||
* BufferView_pimpl.C (getStatus, dispatch): handle
|
||||
LFUN_WORDS_COUNT.
|
||||
|
||||
* LyXAction.C (init):
|
||||
* LyXAction.C (init):
|
||||
* lfuns.h: add LFUN_WORDS_COUNT.
|
||||
|
||||
2004-12-19 Angus Leeming <leeming@lyx.org>
|
||||
@ -66,11 +95,11 @@
|
||||
avoid using the paragraph one
|
||||
|
||||
* text2.C (LyXText, insertStringAsLines): adjust
|
||||
|
||||
|
||||
2004-12-16 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* bufferlist.C:
|
||||
* lyx_main.C:
|
||||
* lyx_main.C:
|
||||
* messages.C: remove redundant "using lyx::support::GetEnvPath;"
|
||||
|
||||
2004-12-14 Angus Leeming <leeming@lyx.org>
|
||||
@ -92,7 +121,7 @@
|
||||
|
||||
2004-12-06 Alfredo Braunstein <abraunst@lyx.org>
|
||||
|
||||
* lyxfunc.C:
|
||||
* lyxfunc.C:
|
||||
* text3.C: remove selection_possible global flag
|
||||
|
||||
2004-12-06 Alfredo Braunstein <abraunst@lyx.org>
|
||||
|
13
src/aspell.C
13
src/aspell.C
@ -73,7 +73,7 @@ void ASpell::addSpeller(string const & lang)
|
||||
}
|
||||
|
||||
|
||||
enum ASpell::Result ASpell::check(WordLangTuple const & word)
|
||||
ASpell::Result ASpell::check(WordLangTuple const & word)
|
||||
{
|
||||
Result res = UNKNOWN;
|
||||
|
||||
@ -88,7 +88,7 @@ enum ASpell::Result ASpell::check(WordLangTuple const & word)
|
||||
|
||||
AspellSpeller * m = it->second.speller;
|
||||
|
||||
int word_ok = aspell_speller_check(m, word.word().c_str(), -1);
|
||||
int const word_ok = aspell_speller_check(m, word.word().c_str(), -1);
|
||||
BOOST_ASSERT(word_ok != -1);
|
||||
|
||||
if (word_ok) {
|
||||
@ -129,9 +129,8 @@ string const ASpell::nextMiss()
|
||||
|
||||
if (els)
|
||||
str = aspell_string_enumeration_next(els);
|
||||
if (str)
|
||||
return str;
|
||||
return "";
|
||||
|
||||
return (str ? str : "");
|
||||
}
|
||||
|
||||
|
||||
@ -143,9 +142,7 @@ string const ASpell::error()
|
||||
err = aspell_error_message(spell_error_object);
|
||||
}
|
||||
|
||||
if (err)
|
||||
return err;
|
||||
return "";
|
||||
return (err ? err : "");
|
||||
}
|
||||
|
||||
#endif // USE_ASPELL
|
||||
|
@ -64,7 +64,7 @@ private:
|
||||
AspellConfig * config;
|
||||
};
|
||||
|
||||
typedef std::map<std::string, struct Speller> Spellers;
|
||||
typedef std::map<std::string, Speller> Spellers;
|
||||
|
||||
/// the spellers
|
||||
Spellers spellers_;
|
||||
|
44
src/buffer.C
44
src/buffer.C
@ -136,7 +136,7 @@ extern BufferList bufferlist;
|
||||
|
||||
namespace {
|
||||
|
||||
const int LYX_FORMAT = 238;
|
||||
int const LYX_FORMAT = 238;
|
||||
|
||||
} // namespace anon
|
||||
|
||||
@ -319,7 +319,7 @@ TexRow const & Buffer::texrow() const
|
||||
}
|
||||
|
||||
|
||||
string const Buffer::getLatexName(bool no_path) const
|
||||
string const Buffer::getLatexName(bool const no_path) const
|
||||
{
|
||||
string const name = ChangeExtension(MakeLatexName(fileName()), ".tex");
|
||||
return no_path ? OnlyFilename(name) : name;
|
||||
@ -358,7 +358,7 @@ pair<Buffer::LogType, string> const Buffer::getLogName() const
|
||||
}
|
||||
|
||||
|
||||
void Buffer::setReadonly(bool flag)
|
||||
void Buffer::setReadonly(bool const flag)
|
||||
{
|
||||
if (pimpl_->read_only != flag) {
|
||||
pimpl_->read_only = flag;
|
||||
@ -548,7 +548,7 @@ bool Buffer::readFile(string const & filename)
|
||||
}
|
||||
|
||||
|
||||
bool Buffer::readFile(string const & filename, pit_type pit)
|
||||
bool Buffer::readFile(string const & filename, pit_type const pit)
|
||||
{
|
||||
LyXLex lex(0, 0);
|
||||
lex.setFile(filename);
|
||||
@ -562,13 +562,13 @@ bool Buffer::fully_loaded() const
|
||||
}
|
||||
|
||||
|
||||
void Buffer::fully_loaded(bool value)
|
||||
void Buffer::fully_loaded(bool const value)
|
||||
{
|
||||
pimpl_->file_fully_loaded = value;
|
||||
}
|
||||
|
||||
|
||||
bool Buffer::readFile(LyXLex & lex, string const & filename, pit_type pit)
|
||||
bool Buffer::readFile(LyXLex & lex, string const & filename, pit_type const pit)
|
||||
{
|
||||
BOOST_ASSERT(!filename.empty());
|
||||
|
||||
@ -846,7 +846,7 @@ void Buffer::makeLaTeXFile(string const & fname,
|
||||
void Buffer::makeLaTeXFile(ostream & os,
|
||||
string const & original_path,
|
||||
OutputParams const & runparams_in,
|
||||
bool output_preamble, bool output_body)
|
||||
bool const output_preamble, bool const output_body)
|
||||
{
|
||||
OutputParams runparams = runparams_in;
|
||||
|
||||
@ -1000,7 +1000,7 @@ bool Buffer::isSGML() const
|
||||
|
||||
void Buffer::makeLinuxDocFile(string const & fname,
|
||||
OutputParams const & runparams,
|
||||
bool body_only)
|
||||
bool const body_only)
|
||||
{
|
||||
ofstream ofs;
|
||||
if (!openFileWrite(ofs, fname))
|
||||
@ -1013,7 +1013,7 @@ void Buffer::makeLinuxDocFile(string const & fname,
|
||||
|
||||
LyXTextClass const & tclass = params().getLyXTextClass();
|
||||
|
||||
string top_element = tclass.latexname();
|
||||
string const & top_element = tclass.latexname();
|
||||
|
||||
if (!body_only) {
|
||||
ofs << tclass.class_header();
|
||||
@ -1058,7 +1058,7 @@ void Buffer::makeLinuxDocFile(string const & fname,
|
||||
|
||||
void Buffer::makeDocBookFile(string const & fname,
|
||||
OutputParams const & runparams,
|
||||
bool only_body)
|
||||
bool const only_body)
|
||||
{
|
||||
ofstream ofs;
|
||||
if (!openFileWrite(ofs, fname))
|
||||
@ -1070,7 +1070,7 @@ void Buffer::makeDocBookFile(string const & fname,
|
||||
texrow().reset();
|
||||
|
||||
LyXTextClass const & tclass = params().getLyXTextClass();
|
||||
string top_element = tclass.latexname();
|
||||
string const & top_element = tclass.latexname();
|
||||
|
||||
if (!only_body) {
|
||||
if (runparams.flavor == OutputParams::XML)
|
||||
@ -1157,7 +1157,7 @@ int Buffer::runChktex()
|
||||
|
||||
TeXErrors terr;
|
||||
Chktex chktex(lyxrc.chktex_command, name, filePath());
|
||||
int res = chktex.run(terr); // run chktex
|
||||
int const res = chktex.run(terr); // run chktex
|
||||
|
||||
if (res == -1) {
|
||||
Alert::error(_("chktex failure"),
|
||||
@ -1220,7 +1220,7 @@ void Buffer::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
void Buffer::getLabelList(std::vector<string> & list) const
|
||||
void Buffer::getLabelList(vector<string> & list) const
|
||||
{
|
||||
/// if this is a child document and the parent is already loaded
|
||||
/// Use the parent's list instead [ale990407]
|
||||
@ -1240,7 +1240,7 @@ void Buffer::getLabelList(std::vector<string> & list) const
|
||||
|
||||
|
||||
// This is also a buffer property (ale)
|
||||
void Buffer::fillWithBibKeys(std::vector<std::pair<string, string> > & keys)
|
||||
void Buffer::fillWithBibKeys(vector<pair<string, string> > & keys)
|
||||
const
|
||||
{
|
||||
/// if this is a child document and the parent is already loaded
|
||||
@ -1276,7 +1276,7 @@ void Buffer::fillWithBibKeys(std::vector<std::pair<string, string> > & keys)
|
||||
|
||||
bool Buffer::isDepClean(string const & name) const
|
||||
{
|
||||
DepClean::const_iterator it = pimpl_->dep_clean.find(name);
|
||||
DepClean::const_iterator const it = pimpl_->dep_clean.find(name);
|
||||
if (it == pimpl_->dep_clean.end())
|
||||
return true;
|
||||
return it->second;
|
||||
@ -1316,6 +1316,9 @@ bool Buffer::dispatch(FuncRequest const & func, bool * result)
|
||||
|
||||
void Buffer::changeLanguage(Language const * from, Language const * to)
|
||||
{
|
||||
BOOST_ASSERT(from);
|
||||
BOOST_ASSERT(to);
|
||||
|
||||
lyxerr << "Changing Language!" << endl;
|
||||
|
||||
// Take care of l10n/i18n
|
||||
@ -1329,6 +1332,8 @@ void Buffer::changeLanguage(Language const * from, Language const * to)
|
||||
|
||||
void Buffer::updateDocLang(Language const * nlang)
|
||||
{
|
||||
BOOST_ASSERT(nlang);
|
||||
|
||||
pimpl_->messages.reset(new Messages(nlang->code()));
|
||||
}
|
||||
|
||||
@ -1344,10 +1349,10 @@ bool Buffer::isMultiLingual() const
|
||||
}
|
||||
|
||||
|
||||
ParIterator Buffer::getParFromID(int id) const
|
||||
ParIterator Buffer::getParFromID(int const id) const
|
||||
{
|
||||
ParConstIterator it = par_iterator_begin();
|
||||
ParConstIterator end = par_iterator_end();
|
||||
ParConstIterator const end = par_iterator_end();
|
||||
|
||||
if (id < 0) {
|
||||
// John says this is called with id == -1 from undo
|
||||
@ -1363,9 +1368,9 @@ ParIterator Buffer::getParFromID(int id) const
|
||||
}
|
||||
|
||||
|
||||
bool Buffer::hasParWithID(int id) const
|
||||
bool Buffer::hasParWithID(int const id) const
|
||||
{
|
||||
ParConstIterator it = getParFromID(id);
|
||||
ParConstIterator const it = getParFromID(id);
|
||||
return it != par_iterator_end();
|
||||
}
|
||||
|
||||
@ -1452,6 +1457,7 @@ bool Buffer::isUnnamed() const
|
||||
}
|
||||
|
||||
|
||||
#warning this function should be moved to buffer_pimpl.C
|
||||
void Buffer::markDirty()
|
||||
{
|
||||
if (pimpl_->lyx_clean) {
|
||||
|
@ -50,8 +50,10 @@ extern BufferList bufferlist;
|
||||
|
||||
namespace {
|
||||
|
||||
bool readFile(Buffer * b, string const & s)
|
||||
bool readFile(Buffer * const b, string const & s)
|
||||
{
|
||||
BOOST_ASSERT(b);
|
||||
|
||||
// File information about normal file
|
||||
FileInfo fileN(s);
|
||||
if (!fileN.exist()) {
|
||||
@ -70,9 +72,10 @@ bool readFile(Buffer * b, string const & s)
|
||||
&& fileE.getModificationTime() > fileN.getModificationTime())
|
||||
{
|
||||
string const file = MakeDisplayPath(s, 20);
|
||||
string text = bformat(_("An emergency save of the document "
|
||||
"%1$s exists.\n\n"
|
||||
"Recover emergency save?"), file);
|
||||
string const text =
|
||||
bformat(_("An emergency save of the document "
|
||||
"%1$s exists.\n\n"
|
||||
"Recover emergency save?"), file);
|
||||
switch (Alert::prompt(_("Load emergency save?"), text, 0, 2,
|
||||
_("&Recover"), _("&Load Original"),
|
||||
_("&Cancel")))
|
||||
@ -96,9 +99,10 @@ bool readFile(Buffer * b, string const & s)
|
||||
&& fileA.getModificationTime() > fileN.getModificationTime())
|
||||
{
|
||||
string const file = MakeDisplayPath(s, 20);
|
||||
string text = bformat(_("The backup of the document "
|
||||
"%1$s is newer.\n\nLoad the "
|
||||
"backup instead?"), file);
|
||||
string const text =
|
||||
bformat(_("The backup of the document "
|
||||
"%1$s is newer.\n\nLoad the "
|
||||
"backup instead?"), file);
|
||||
switch (Alert::prompt(_("Load backup?"), text, 0, 2,
|
||||
_("&Load backup"), _("Load &original"),
|
||||
_("&Cancel") ))
|
||||
@ -125,6 +129,8 @@ bool readFile(Buffer * b, string const & s)
|
||||
|
||||
bool loadLyXFile(Buffer * b, string const & s)
|
||||
{
|
||||
BOOST_ASSERT(b);
|
||||
|
||||
switch (IsFileWriteable(s)) {
|
||||
case 0:
|
||||
b->setReadonly(true);
|
||||
@ -139,8 +145,9 @@ bool loadLyXFile(Buffer * b, string const & s)
|
||||
string const file = MakeDisplayPath(s, 20);
|
||||
// Here we probably should run
|
||||
if (LyXVC::file_not_found_hook(s)) {
|
||||
string text = bformat(_("Do you want to retrieve the document"
|
||||
" %1$s from version control?"), file);
|
||||
string const text =
|
||||
bformat(_("Do you want to retrieve the document"
|
||||
" %1$s from version control?"), file);
|
||||
int const ret = Alert::prompt(_("Retrieve from version control?"),
|
||||
text, 0, 1, _("&Retrieve"), _("&Cancel"));
|
||||
|
||||
@ -159,10 +166,11 @@ bool loadLyXFile(Buffer * b, string const & s)
|
||||
|
||||
|
||||
Buffer * newFile(string const & filename, string const & templatename,
|
||||
bool isNamed)
|
||||
bool const isNamed)
|
||||
{
|
||||
// get a free buffer
|
||||
Buffer * b = bufferlist.newBuffer(filename);
|
||||
BOOST_ASSERT(b);
|
||||
|
||||
string tname;
|
||||
// use defaults.lyx as a default template if it exists.
|
||||
@ -251,4 +259,3 @@ int countWords(DocIterator const & from, DocIterator const & to)
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
@ -69,14 +69,17 @@ bool BufferList::empty() const
|
||||
|
||||
bool BufferList::quitWriteBuffer(Buffer * buf)
|
||||
{
|
||||
BOOST_ASSERT(buf);
|
||||
|
||||
string file;
|
||||
if (buf->isUnnamed())
|
||||
file = OnlyFilename(buf->fileName());
|
||||
else
|
||||
file = MakeDisplayPath(buf->fileName(), 30);
|
||||
|
||||
string text = bformat(_("The document %1$s has unsaved changes.\n\n"
|
||||
"Do you want to save the document or discard the changes?"), file);
|
||||
string const text =
|
||||
bformat(_("The document %1$s has unsaved changes.\n\n"
|
||||
"Do you want to save the document or discard the changes?"), file);
|
||||
int const ret = Alert::prompt(_("Save changed document?"),
|
||||
text, 0, 2, _("&Save"), _("&Discard"), _("&Cancel"));
|
||||
|
||||
@ -127,16 +130,18 @@ bool BufferList::quitWriteAll()
|
||||
void BufferList::release(Buffer * buf)
|
||||
{
|
||||
BOOST_ASSERT(buf);
|
||||
BufferStorage::iterator it = find(bstore.begin(), bstore.end(), buf);
|
||||
BufferStorage::iterator const it =
|
||||
find(bstore.begin(), bstore.end(), buf);
|
||||
if (it != bstore.end()) {
|
||||
Buffer * tmp = (*it);
|
||||
BOOST_ASSERT(tmp);
|
||||
bstore.erase(it);
|
||||
delete tmp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Buffer * BufferList::newBuffer(string const & s, bool ronly)
|
||||
Buffer * BufferList::newBuffer(string const & s, bool const ronly)
|
||||
{
|
||||
auto_ptr<Buffer> tmpbuf(new Buffer(s, ronly));
|
||||
tmpbuf->params().useClassDefaults();
|
||||
@ -155,7 +160,7 @@ void BufferList::closeAll()
|
||||
}
|
||||
|
||||
|
||||
bool BufferList::close(Buffer * buf, bool ask)
|
||||
bool BufferList::close(Buffer * buf, bool const ask)
|
||||
{
|
||||
BOOST_ASSERT(buf);
|
||||
|
||||
@ -171,8 +176,9 @@ bool BufferList::close(Buffer * buf, bool ask)
|
||||
else
|
||||
fname = MakeDisplayPath(buf->fileName(), 30);
|
||||
|
||||
string text = bformat(_("The document %1$s has unsaved changes.\n\n"
|
||||
"Do you want to save the document or discard the changes?"), fname);
|
||||
string const text =
|
||||
bformat(_("The document %1$s has unsaved changes.\n\n"
|
||||
"Do you want to save the document or discard the changes?"), fname);
|
||||
int const ret = Alert::prompt(_("Save changed document?"),
|
||||
text, 0, 2, _("&Save"), _("&Discard"), _("&Cancel"));
|
||||
|
||||
@ -216,7 +222,7 @@ Buffer * BufferList::first()
|
||||
}
|
||||
|
||||
|
||||
Buffer * BufferList::getBuffer(unsigned int choice)
|
||||
Buffer * BufferList::getBuffer(unsigned int const choice)
|
||||
{
|
||||
if (choice >= bstore.size())
|
||||
return 0;
|
||||
@ -226,6 +232,8 @@ Buffer * BufferList::getBuffer(unsigned int choice)
|
||||
|
||||
Buffer * BufferList::next(Buffer const * buf) const
|
||||
{
|
||||
BOOST_ASSERT(buf);
|
||||
|
||||
if (bstore.empty())
|
||||
return 0;
|
||||
BufferStorage::const_iterator it = find(bstore.begin(),
|
||||
@ -241,6 +249,8 @@ Buffer * BufferList::next(Buffer const * buf) const
|
||||
|
||||
Buffer * BufferList::previous(Buffer const * buf) const
|
||||
{
|
||||
BOOST_ASSERT(buf);
|
||||
|
||||
if (bstore.empty())
|
||||
return 0;
|
||||
BufferStorage::const_iterator it = find(bstore.begin(),
|
||||
@ -280,10 +290,9 @@ void BufferList::emergencyWriteAll()
|
||||
|
||||
void BufferList::emergencyWrite(Buffer * buf)
|
||||
{
|
||||
// assert(buf) // this is not good since C assert takes an int
|
||||
// and a pointer is a long (JMarc)
|
||||
assert(buf != 0); // use c assert to avoid a loop
|
||||
|
||||
// Use ::assert to avoid a loop, BOOST_ASSERT ends up calling ::assert
|
||||
// compare with 0 to avoid pointer/interger comparison
|
||||
assert(buf != 0);
|
||||
|
||||
// No need to save if the buffer has not changed.
|
||||
if (buf->isClean())
|
||||
|
@ -64,26 +64,30 @@ namespace biblio = lyx::biblio;
|
||||
namespace {
|
||||
|
||||
// Paragraph separation
|
||||
typedef Translator<std::string, BufferParams::PARSEP> ParSepTranslator;
|
||||
typedef Translator<string, BufferParams::PARSEP> ParSepTranslator;
|
||||
|
||||
|
||||
ParSepTranslator const init_parseptranslator() {
|
||||
ParSepTranslator const init_parseptranslator()
|
||||
{
|
||||
ParSepTranslator translator(string_paragraph_separation[0], BufferParams::PARSEP_INDENT);
|
||||
translator.addPair(string_paragraph_separation[1], BufferParams::PARSEP_SKIP);
|
||||
return translator;
|
||||
}
|
||||
|
||||
|
||||
ParSepTranslator const & parseptranslator() {
|
||||
ParSepTranslator const & parseptranslator()
|
||||
{
|
||||
static ParSepTranslator translator = init_parseptranslator();
|
||||
return translator;
|
||||
}
|
||||
|
||||
|
||||
// Quotes language
|
||||
typedef Translator<std::string, InsetQuotes::quote_language> QuotesLangTranslator;
|
||||
typedef Translator<string, InsetQuotes::quote_language> QuotesLangTranslator;
|
||||
|
||||
|
||||
QuotesLangTranslator const init_quoteslangtranslator() {
|
||||
QuotesLangTranslator const init_quoteslangtranslator()
|
||||
{
|
||||
QuotesLangTranslator translator(string_quotes_language[0], InsetQuotes::EnglishQ);
|
||||
translator.addPair(string_quotes_language[1], InsetQuotes::SwedishQ);
|
||||
translator.addPair(string_quotes_language[2], InsetQuotes::GermanQ);
|
||||
@ -94,32 +98,38 @@ QuotesLangTranslator const init_quoteslangtranslator() {
|
||||
}
|
||||
|
||||
|
||||
QuotesLangTranslator const & quoteslangtranslator() {
|
||||
QuotesLangTranslator const & quoteslangtranslator()
|
||||
{
|
||||
static QuotesLangTranslator translator = init_quoteslangtranslator();
|
||||
return translator;
|
||||
}
|
||||
|
||||
|
||||
// Quote times
|
||||
typedef Translator<int, InsetQuotes::quote_times> QuotesTimesTranslator;
|
||||
|
||||
|
||||
QuotesTimesTranslator const init_quotestimestranslator() {
|
||||
QuotesTimesTranslator const init_quotestimestranslator()
|
||||
{
|
||||
QuotesTimesTranslator translator(1, InsetQuotes::SingleQ);
|
||||
translator.addPair(2, InsetQuotes::DoubleQ);
|
||||
return translator;
|
||||
}
|
||||
|
||||
|
||||
QuotesTimesTranslator const & quotestimestranslator() {
|
||||
QuotesTimesTranslator const & quotestimestranslator()
|
||||
{
|
||||
static QuotesTimesTranslator translator = init_quotestimestranslator();
|
||||
return translator;
|
||||
}
|
||||
|
||||
|
||||
// Paper size
|
||||
typedef Translator<std::string, VMARGIN_PAPER_TYPE> PaperSizeTranslator;
|
||||
|
||||
|
||||
PaperSizeTranslator const init_papersizetranslator() {
|
||||
PaperSizeTranslator const init_papersizetranslator()
|
||||
{
|
||||
PaperSizeTranslator translator(string_papersize[0], VM_PAPER_DEFAULT);
|
||||
translator.addPair(string_papersize[1], VM_PAPER_CUSTOM);
|
||||
translator.addPair(string_papersize[2], VM_PAPER_USLETTER);
|
||||
@ -135,16 +145,19 @@ PaperSizeTranslator const init_papersizetranslator() {
|
||||
}
|
||||
|
||||
|
||||
PaperSizeTranslator const & papersizetranslator() {
|
||||
PaperSizeTranslator const & papersizetranslator()
|
||||
{
|
||||
static PaperSizeTranslator translator = init_papersizetranslator();
|
||||
return translator;
|
||||
}
|
||||
|
||||
|
||||
// Paper packages
|
||||
typedef Translator<std::string, PAPER_PACKAGES> PaperPackagesTranslator;
|
||||
typedef Translator<string, PAPER_PACKAGES> PaperPackagesTranslator;
|
||||
|
||||
|
||||
PaperPackagesTranslator const init_paperpackagestranslator() {
|
||||
PaperPackagesTranslator const init_paperpackagestranslator()
|
||||
{
|
||||
PaperPackagesTranslator translator(string_paperpackages[0], PACKAGE_NONE);
|
||||
translator.addPair(string_paperpackages[1], PACKAGE_A4);
|
||||
translator.addPair(string_paperpackages[2], PACKAGE_A4WIDE);
|
||||
@ -153,24 +166,27 @@ PaperPackagesTranslator const init_paperpackagestranslator() {
|
||||
}
|
||||
|
||||
|
||||
PaperPackagesTranslator const & paperpackagestranslator() {
|
||||
PaperPackagesTranslator const & paperpackagestranslator()
|
||||
{
|
||||
static PaperPackagesTranslator translator = init_paperpackagestranslator();
|
||||
return translator;
|
||||
}
|
||||
|
||||
|
||||
// Paper orientation
|
||||
typedef Translator<std::string, PAPER_ORIENTATION> PaperOrientationTranslator;
|
||||
typedef Translator<string, PAPER_ORIENTATION> PaperOrientationTranslator;
|
||||
|
||||
|
||||
PaperOrientationTranslator const init_paperorientationtranslator() {
|
||||
PaperOrientationTranslator const init_paperorientationtranslator()
|
||||
{
|
||||
PaperOrientationTranslator translator(string_orientation[0], ORIENTATION_PORTRAIT);
|
||||
translator.addPair(string_orientation[1], ORIENTATION_LANDSCAPE);
|
||||
return translator;
|
||||
}
|
||||
|
||||
|
||||
PaperOrientationTranslator const & paperorientationtranslator() {
|
||||
PaperOrientationTranslator const & paperorientationtranslator()
|
||||
{
|
||||
static PaperOrientationTranslator translator = init_paperorientationtranslator();
|
||||
return translator;
|
||||
}
|
||||
@ -180,14 +196,16 @@ PaperOrientationTranslator const & paperorientationtranslator() {
|
||||
typedef Translator<int, LyXTextClass::PageSides> SidesTranslator;
|
||||
|
||||
|
||||
SidesTranslator const init_sidestranslator() {
|
||||
SidesTranslator const init_sidestranslator()
|
||||
{
|
||||
SidesTranslator translator(1, LyXTextClass::OneSide);
|
||||
translator.addPair(2, LyXTextClass::TwoSides);
|
||||
return translator;
|
||||
}
|
||||
|
||||
|
||||
SidesTranslator const & sidestranslator() {
|
||||
SidesTranslator const & sidestranslator()
|
||||
{
|
||||
static SidesTranslator translator = init_sidestranslator();
|
||||
return translator;
|
||||
}
|
||||
@ -198,7 +216,8 @@ SidesTranslator const & sidestranslator() {
|
||||
typedef Translator<int, BufferParams::AMS> AMSTranslator;
|
||||
|
||||
|
||||
AMSTranslator const init_amstranslator() {
|
||||
AMSTranslator const init_amstranslator()
|
||||
{
|
||||
AMSTranslator translator(0, BufferParams::AMS_OFF);
|
||||
translator.addPair(1, BufferParams::AMS_AUTO);
|
||||
translator.addPair(2, BufferParams::AMS_ON);
|
||||
@ -206,18 +225,19 @@ AMSTranslator const init_amstranslator() {
|
||||
}
|
||||
|
||||
|
||||
AMSTranslator const & amstranslator() {
|
||||
AMSTranslator const & amstranslator()
|
||||
{
|
||||
static AMSTranslator translator = init_amstranslator();
|
||||
return translator;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Cite engine
|
||||
typedef Translator<string, biblio::CiteEngine> CiteEngineTranslator;
|
||||
|
||||
|
||||
CiteEngineTranslator const init_citeenginetranslator() {
|
||||
CiteEngineTranslator const init_citeenginetranslator()
|
||||
{
|
||||
CiteEngineTranslator translator("basic", biblio::ENGINE_BASIC);
|
||||
translator.addPair("natbib_numerical", biblio::ENGINE_NATBIB_NUMERICAL);
|
||||
translator.addPair("natbib_authoryear", biblio::ENGINE_NATBIB_AUTHORYEAR);
|
||||
@ -226,7 +246,8 @@ CiteEngineTranslator const init_citeenginetranslator() {
|
||||
}
|
||||
|
||||
|
||||
CiteEngineTranslator const & citeenginetranslator() {
|
||||
CiteEngineTranslator const & citeenginetranslator()
|
||||
{
|
||||
static CiteEngineTranslator translator = init_citeenginetranslator();
|
||||
return translator;
|
||||
}
|
||||
@ -236,7 +257,8 @@ CiteEngineTranslator const & citeenginetranslator() {
|
||||
typedef Translator<string, Spacing::Space> SpaceTranslator;
|
||||
|
||||
|
||||
SpaceTranslator const init_spacetranslator() {
|
||||
SpaceTranslator const init_spacetranslator()
|
||||
{
|
||||
SpaceTranslator translator("default", Spacing::Default);
|
||||
translator.addPair("single", Spacing::Single);
|
||||
translator.addPair("onehalf", Spacing::Onehalf);
|
||||
@ -245,7 +267,8 @@ SpaceTranslator const init_spacetranslator() {
|
||||
}
|
||||
|
||||
|
||||
SpaceTranslator const & spacetranslator() {
|
||||
SpaceTranslator const & spacetranslator()
|
||||
{
|
||||
static SpaceTranslator translator = init_spacetranslator();
|
||||
return translator;
|
||||
}
|
||||
@ -281,6 +304,8 @@ BufferParams::Impl::Impl()
|
||||
BufferParams::Impl *
|
||||
BufferParams::MemoryTraits::clone(BufferParams::Impl const * ptr)
|
||||
{
|
||||
BOOST_ASSERT(ptr);
|
||||
|
||||
return new BufferParams::Impl(*ptr);
|
||||
}
|
||||
|
||||
@ -359,28 +384,28 @@ BranchList const & BufferParams::branchlist() const
|
||||
}
|
||||
|
||||
|
||||
Bullet & BufferParams::temp_bullet(lyx::size_type index)
|
||||
Bullet & BufferParams::temp_bullet(lyx::size_type const index)
|
||||
{
|
||||
BOOST_ASSERT(index < 4);
|
||||
return pimpl_->temp_bullets[index];
|
||||
}
|
||||
|
||||
|
||||
Bullet const & BufferParams::temp_bullet(lyx::size_type index) const
|
||||
Bullet const & BufferParams::temp_bullet(lyx::size_type const index) const
|
||||
{
|
||||
BOOST_ASSERT(index < 4);
|
||||
return pimpl_->temp_bullets[index];
|
||||
}
|
||||
|
||||
|
||||
Bullet & BufferParams::user_defined_bullet(lyx::size_type index)
|
||||
Bullet & BufferParams::user_defined_bullet(lyx::size_type const index)
|
||||
{
|
||||
BOOST_ASSERT(index < 4);
|
||||
return pimpl_->user_defined_bullets[index];
|
||||
}
|
||||
|
||||
|
||||
Bullet const & BufferParams::user_defined_bullet(lyx::size_type index) const
|
||||
Bullet const & BufferParams::user_defined_bullet(lyx::size_type const index) const
|
||||
{
|
||||
BOOST_ASSERT(index < 4);
|
||||
return pimpl_->user_defined_bullets[index];
|
||||
@ -425,7 +450,8 @@ string const BufferParams::readToken(LyXLex & lex, string const & token)
|
||||
return classname;
|
||||
}
|
||||
if (!getLyXTextClass().isTeXClassAvailable()) {
|
||||
string msg = bformat(_("The document uses a missing "
|
||||
string const msg =
|
||||
bformat(_("The document uses a missing "
|
||||
"TeX class \"%1$s\".\n"), classname);
|
||||
Alert::warning(_("Document class not available"),
|
||||
msg + _("LyX will not be able to produce output."));
|
||||
@ -589,12 +615,12 @@ void BufferParams::writeFile(ostream & os) const
|
||||
<< "\n\\end_preamble\n";
|
||||
}
|
||||
|
||||
/* the options */
|
||||
// the options
|
||||
if (!options.empty()) {
|
||||
os << "\\options " << options << '\n';
|
||||
}
|
||||
|
||||
/* then the text parameters */
|
||||
// then the text parameters
|
||||
if (language != ignore_language)
|
||||
os << "\\language " << language->lang() << '\n';
|
||||
os << "\\inputencoding " << inputenc
|
||||
@ -1091,6 +1117,7 @@ bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
|
||||
return use_babel;
|
||||
}
|
||||
|
||||
|
||||
void BufferParams::setPaperStuff()
|
||||
{
|
||||
papersize = PAPER_DEFAULT;
|
||||
@ -1226,7 +1253,7 @@ void BufferParams::readBulletsLaTeX(LyXLex & lex)
|
||||
if (!lex.next()) return;
|
||||
int const index = lex.getInteger();
|
||||
lex.next(true);
|
||||
string temp_str = lex.getString();
|
||||
string const temp_str = lex.getString();
|
||||
|
||||
user_defined_bullet(index).setText(temp_str);
|
||||
temp_bullet(index).setText(temp_str);
|
||||
|
@ -50,7 +50,7 @@ namespace bv_funcs {
|
||||
|
||||
// Set data using font and toggle
|
||||
// If successful, returns true
|
||||
bool font2string(LyXFont const & font, bool toggle, string & data)
|
||||
bool font2string(LyXFont const & font, bool const toggle, string & data)
|
||||
{
|
||||
string lang = "ignore";
|
||||
if (font.language())
|
||||
|
@ -60,13 +60,13 @@ bool Changes::Range::contained(Range const & r) const
|
||||
}
|
||||
|
||||
|
||||
bool Changes::Range::contains(pos_type pos) const
|
||||
bool Changes::Range::contains(pos_type const pos) const
|
||||
{
|
||||
return pos >= start && pos < end;
|
||||
}
|
||||
|
||||
|
||||
bool Changes::Range::loose_contains(pos_type pos) const
|
||||
bool Changes::Range::loose_contains(pos_type const pos) const
|
||||
{
|
||||
return pos >= start && pos <= end;
|
||||
}
|
||||
@ -79,7 +79,7 @@ bool Changes::Range::intersects(Range const & r) const
|
||||
}
|
||||
|
||||
|
||||
Changes::Changes(Change::Type type)
|
||||
Changes::Changes(Change::Type const type)
|
||||
: empty_type_(type)
|
||||
{
|
||||
}
|
||||
@ -96,7 +96,7 @@ Changes::Changes(Changes const & c)
|
||||
}
|
||||
|
||||
|
||||
void Changes::record(Change change, pos_type pos)
|
||||
void Changes::record(Change const change, pos_type const pos)
|
||||
{
|
||||
if (lyxerr.debugging(Debug::CHANGES)) {
|
||||
lyxerr[Debug::CHANGES] << "record " << change.type
|
||||
@ -118,25 +118,27 @@ void Changes::record(Change change, pos_type pos)
|
||||
}
|
||||
|
||||
|
||||
void Changes::set(Change change, pos_type pos)
|
||||
void Changes::set(Change const change, pos_type const pos)
|
||||
{
|
||||
set(change, pos, pos + 1);
|
||||
}
|
||||
|
||||
|
||||
void Changes::set(Change::Type type, pos_type pos)
|
||||
void Changes::set(Change::Type const type, pos_type const pos)
|
||||
{
|
||||
set(type, pos, pos + 1);
|
||||
}
|
||||
|
||||
|
||||
void Changes::set(Change::Type type, pos_type start, pos_type end)
|
||||
void Changes::set(Change::Type const type,
|
||||
pos_type const start, pos_type const end)
|
||||
{
|
||||
set(Change(type), start, end);
|
||||
}
|
||||
|
||||
|
||||
void Changes::set(Change change, pos_type start, pos_type end)
|
||||
void Changes::set(Change const change,
|
||||
pos_type const start, pos_type const end)
|
||||
{
|
||||
ChangeTable::iterator it = table_.begin();
|
||||
|
||||
@ -162,7 +164,7 @@ void Changes::set(Change change, pos_type start, pos_type end)
|
||||
}
|
||||
|
||||
it = table_.begin();
|
||||
ChangeTable::iterator itend = table_.end();
|
||||
ChangeTable::iterator const itend = table_.end();
|
||||
|
||||
// find a super-range
|
||||
for (; it != itend; ++it) {
|
||||
@ -221,7 +223,7 @@ void Changes::set(Change change, pos_type start, pos_type end)
|
||||
}
|
||||
|
||||
|
||||
void Changes::erase(pos_type pos)
|
||||
void Changes::erase(pos_type const pos)
|
||||
{
|
||||
ChangeTable::iterator it = table_.begin();
|
||||
ChangeTable::iterator end = table_.end();
|
||||
@ -252,7 +254,7 @@ void Changes::erase(pos_type pos)
|
||||
}
|
||||
|
||||
|
||||
void Changes::del(Change change, ChangeTable::size_type pos)
|
||||
void Changes::del(Change const change, ChangeTable::size_type const pos)
|
||||
{
|
||||
// this case happens when building from .lyx
|
||||
if (table_.empty()) {
|
||||
@ -281,7 +283,7 @@ void Changes::del(Change change, ChangeTable::size_type pos)
|
||||
}
|
||||
|
||||
|
||||
void Changes::add(Change change, ChangeTable::size_type pos)
|
||||
void Changes::add(Change const change, ChangeTable::size_type const pos)
|
||||
{
|
||||
ChangeTable::iterator it = table_.begin();
|
||||
ChangeTable::iterator end = table_.end();
|
||||
@ -310,7 +312,7 @@ void Changes::add(Change change, ChangeTable::size_type pos)
|
||||
}
|
||||
|
||||
|
||||
Change const Changes::lookupFull(pos_type pos) const
|
||||
Change const Changes::lookupFull(pos_type const pos) const
|
||||
{
|
||||
if (!table_.size()) {
|
||||
if (lyxerr.debugging(Debug::CHANGES))
|
||||
@ -319,7 +321,7 @@ Change const Changes::lookupFull(pos_type pos) const
|
||||
}
|
||||
|
||||
ChangeTable::const_iterator it = table_.begin();
|
||||
ChangeTable::const_iterator end = table_.end();
|
||||
ChangeTable::const_iterator const end = table_.end();
|
||||
|
||||
for (; it != end; ++it) {
|
||||
if (it->range.contains(pos))
|
||||
@ -327,12 +329,12 @@ Change const Changes::lookupFull(pos_type pos) const
|
||||
}
|
||||
|
||||
check();
|
||||
BOOST_ASSERT(false);
|
||||
BOOST_ASSERT(false && "missing changes for pos");
|
||||
return Change(Change::UNCHANGED);
|
||||
}
|
||||
|
||||
|
||||
Change::Type Changes::lookup(pos_type pos) const
|
||||
Change::Type Changes::lookup(pos_type const pos) const
|
||||
{
|
||||
if (!table_.size()) {
|
||||
if (lyxerr.debugging(Debug::CHANGES))
|
||||
@ -349,12 +351,12 @@ Change::Type Changes::lookup(pos_type pos) const
|
||||
}
|
||||
|
||||
check();
|
||||
BOOST_ASSERT(0);
|
||||
BOOST_ASSERT(false && "missing changes for pos");
|
||||
return Change::UNCHANGED;
|
||||
}
|
||||
|
||||
|
||||
bool Changes::isChange(pos_type start, pos_type end) const
|
||||
bool Changes::isChange(pos_type const start, pos_type const end) const
|
||||
{
|
||||
if (!table_.size()) {
|
||||
if (lyxerr.debugging(Debug::CHANGES))
|
||||
@ -363,7 +365,7 @@ bool Changes::isChange(pos_type start, pos_type end) const
|
||||
}
|
||||
|
||||
ChangeTable::const_iterator it = table_.begin();
|
||||
ChangeTable::const_iterator itend = table_.end();
|
||||
ChangeTable::const_iterator const itend = table_.end();
|
||||
|
||||
for (; it != itend; ++it) {
|
||||
if (lyxerr.debugging(Debug::CHANGES)) {
|
||||
@ -388,7 +390,8 @@ bool Changes::isChange(pos_type start, pos_type end) const
|
||||
}
|
||||
|
||||
|
||||
bool Changes::isChangeEdited(lyx::pos_type start, lyx::pos_type end) const
|
||||
bool Changes::isChangeEdited(lyx::pos_type const start,
|
||||
lyx::pos_type const end) const
|
||||
{
|
||||
if (!table_.size()) {
|
||||
if (lyxerr.debugging(Debug::CHANGES))
|
||||
@ -397,7 +400,7 @@ bool Changes::isChangeEdited(lyx::pos_type start, lyx::pos_type end) const
|
||||
}
|
||||
|
||||
ChangeTable::const_iterator it = table_.begin();
|
||||
ChangeTable::const_iterator itend = table_.end();
|
||||
ChangeTable::const_iterator const itend = table_.end();
|
||||
|
||||
for (; it != itend; ++it) {
|
||||
if (it->range.intersects(Range(start, end ? end - 1 : 0))
|
||||
@ -465,7 +468,7 @@ void Changes::check() const
|
||||
ChangeTable::const_iterator it = table_.begin();
|
||||
ChangeTable::const_iterator end = table_.end();
|
||||
|
||||
bool dont_assert(true);
|
||||
bool dont_assert = true;
|
||||
|
||||
lyxerr[Debug::CHANGES] << "Changelist:" << endl;
|
||||
for (; it != end; ++it) {
|
||||
@ -491,7 +494,8 @@ void Changes::check() const
|
||||
}
|
||||
|
||||
|
||||
int Changes::latexMarkChange(std::ostream & os, Change::Type old, Change::Type change)
|
||||
int Changes::latexMarkChange(std::ostream & os,
|
||||
Change::Type const old, Change::Type const change)
|
||||
{
|
||||
if (old == change)
|
||||
return 0;
|
||||
@ -535,8 +539,9 @@ int Changes::latexMarkChange(std::ostream & os, Change::Type old, Change::Type c
|
||||
}
|
||||
|
||||
|
||||
void Changes::lyxMarkChange(std::ostream & os, int & column, lyx::time_type curtime,
|
||||
Change const & old, Change const & change)
|
||||
void Changes::lyxMarkChange(std::ostream & os, int & column,
|
||||
lyx::time_type const curtime,
|
||||
Change const & old, Change const & change)
|
||||
{
|
||||
if (old == change)
|
||||
return;
|
||||
@ -549,7 +554,7 @@ void Changes::lyxMarkChange(std::ostream & os, int & column, lyx::time_type curt
|
||||
break;
|
||||
|
||||
case Change::DELETED: {
|
||||
lyx::time_type t(change.changetime);
|
||||
lyx::time_type t = change.changetime;
|
||||
if (!t)
|
||||
t = curtime;
|
||||
os << "\n\\change_deleted " << change.author
|
||||
@ -558,12 +563,13 @@ void Changes::lyxMarkChange(std::ostream & os, int & column, lyx::time_type curt
|
||||
break;
|
||||
}
|
||||
|
||||
case Change::INSERTED:
|
||||
lyx::time_type t(change.changetime);
|
||||
case Change::INSERTED: {
|
||||
lyx::time_type t = change.changetime;
|
||||
if (!t)
|
||||
t = curtime;
|
||||
os << "\n\\change_inserted " << change.author
|
||||
<< " " << t << "\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,10 +103,11 @@ private:
|
||||
} // namespace anon
|
||||
|
||||
|
||||
Converter::Converter(string const & f, string const & t, string const & c,
|
||||
string const & l): from(f), to(t), command(c), flags(l),
|
||||
From(0), To(0), latex(false), xml(false),
|
||||
original_dir(false), need_aux(false)
|
||||
Converter::Converter(string const & f, string const & t,
|
||||
string const & c, string const & l)
|
||||
: from(f), to(t), command(c), flags(l),
|
||||
From(0), To(0), latex(false), xml(false),
|
||||
original_dir(false), need_aux(false)
|
||||
{}
|
||||
|
||||
|
||||
@ -158,7 +159,7 @@ bool operator<(Converter const & a, Converter const & b)
|
||||
Converter const * Converters::getConverter(string const & from,
|
||||
string const & to) const
|
||||
{
|
||||
ConverterList::const_iterator cit =
|
||||
ConverterList::const_iterator const cit =
|
||||
find_if(converterlist_.begin(), converterlist_.end(),
|
||||
ConverterEqual(from, to));
|
||||
if (cit != converterlist_.end())
|
||||
@ -170,7 +171,7 @@ Converter const * Converters::getConverter(string const & from,
|
||||
|
||||
int Converters::getNumber(string const & from, string const & to) const
|
||||
{
|
||||
ConverterList::const_iterator cit =
|
||||
ConverterList::const_iterator const cit =
|
||||
find_if(converterlist_.begin(), converterlist_.end(),
|
||||
ConverterEqual(from, to));
|
||||
if (cit != converterlist_.end())
|
||||
@ -215,9 +216,10 @@ void Converters::add(string const & from, string const & to,
|
||||
|
||||
void Converters::erase(string const & from, string const & to)
|
||||
{
|
||||
ConverterList::iterator it = find_if(converterlist_.begin(),
|
||||
converterlist_.end(),
|
||||
ConverterEqual(from, to));
|
||||
ConverterList::iterator const it =
|
||||
find_if(converterlist_.begin(),
|
||||
converterlist_.end(),
|
||||
ConverterEqual(from, to));
|
||||
if (it != converterlist_.end())
|
||||
converterlist_.erase(it);
|
||||
}
|
||||
@ -324,7 +326,7 @@ bool Converters::convert(Buffer const * buffer,
|
||||
|
||||
if (conv.latex) {
|
||||
run_latex = true;
|
||||
string command = subst(conv.command, token_from, "");
|
||||
string const command = subst(conv.command, token_from, "");
|
||||
lyxerr[Debug::FILES] << "Running " << command << endl;
|
||||
if (!runLaTeX(*buffer, command, runparams))
|
||||
return false;
|
||||
@ -337,9 +339,9 @@ bool Converters::convert(Buffer const * buffer,
|
||||
runLaTeX(*buffer, latex_command_, runparams);
|
||||
}
|
||||
|
||||
string infile2 = (conv.original_dir)
|
||||
string const infile2 = (conv.original_dir)
|
||||
? infile : MakeRelPath(infile, path);
|
||||
string outfile2 = (conv.original_dir)
|
||||
string const outfile2 = (conv.original_dir)
|
||||
? outfile : MakeRelPath(outfile, path);
|
||||
|
||||
string command = conv.command;
|
||||
@ -363,7 +365,7 @@ bool Converters::convert(Buffer const * buffer,
|
||||
buffer->message(_("Executing command: ")
|
||||
+ command);
|
||||
|
||||
Systemcall::Starttype type = (dummy)
|
||||
Systemcall::Starttype const type = (dummy)
|
||||
? Systemcall::DontWait : Systemcall::Wait;
|
||||
Systemcall one;
|
||||
int res;
|
||||
@ -420,9 +422,9 @@ bool Converters::convert(Buffer const * buffer,
|
||||
subst(conv.result_file,
|
||||
token_base, OnlyFilename(to_base)));
|
||||
if (from_base != to_base) {
|
||||
string from = subst(conv.result_dir,
|
||||
string const from = subst(conv.result_dir,
|
||||
token_base, from_base);
|
||||
string to = subst(conv.result_dir,
|
||||
string const to = subst(conv.result_dir,
|
||||
token_base, to_base);
|
||||
Mover const & mover = movers(conv.from);
|
||||
if (!mover.rename(from, to)) {
|
||||
@ -506,7 +508,7 @@ bool Converters::scanLog(Buffer const & buffer, string const & /*command*/,
|
||||
runparams.flavor = OutputParams::LATEX;
|
||||
LaTeX latex("", runparams, filename, "");
|
||||
TeXErrors terr;
|
||||
int result = latex.scanLogFile(terr);
|
||||
int const result = latex.scanLogFile(terr);
|
||||
|
||||
if (result & LaTeX::ERRORS)
|
||||
bufferErrors(buffer, terr);
|
||||
@ -514,6 +516,7 @@ bool Converters::scanLog(Buffer const & buffer, string const & /*command*/,
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
class showMessage : public std::unary_function<string, void>, public boost::signals::trackable {
|
||||
@ -539,21 +542,22 @@ bool Converters::runLaTeX(Buffer const & buffer, string const & command,
|
||||
runparams.document_language = buffer.params().language->babel();
|
||||
|
||||
// do the LaTeX run(s)
|
||||
string name = buffer.getLatexName();
|
||||
string const name = buffer.getLatexName();
|
||||
LaTeX latex(command, runparams, name, buffer.filePath());
|
||||
TeXErrors terr;
|
||||
showMessage show(buffer);
|
||||
latex.message.connect(show);
|
||||
int result = latex.run(terr);
|
||||
int const result = latex.run(terr);
|
||||
|
||||
if (result & LaTeX::ERRORS)
|
||||
bufferErrors(buffer, terr);
|
||||
|
||||
// check return value from latex.run().
|
||||
if ((result & LaTeX::NO_LOGFILE)) {
|
||||
string str = bformat(_("LaTeX did not run successfully. "
|
||||
"Additionally, LyX could not locate "
|
||||
"the LaTeX log %1$s."), name);
|
||||
string const str =
|
||||
bformat(_("LaTeX did not run successfully. "
|
||||
"Additionally, LyX could not locate "
|
||||
"the LaTeX log %1$s."), name);
|
||||
Alert::error(_("LaTeX failed"), str);
|
||||
} else if (result & LaTeX::NO_OUTPUT) {
|
||||
Alert::warning(_("Output is empty"),
|
||||
@ -578,7 +582,7 @@ void Converters::buildGraph()
|
||||
{
|
||||
G_.init(formats.size());
|
||||
ConverterList::iterator beg = converterlist_.begin();
|
||||
ConverterList::iterator end = converterlist_.end();
|
||||
ConverterList::iterator const end = converterlist_.end();
|
||||
for (ConverterList::iterator it = beg; it != end ; ++it) {
|
||||
int const s = formats.getNumber(it->from);
|
||||
int const t = formats.getNumber(it->to);
|
||||
@ -593,7 +597,7 @@ Converters::intToFormat(std::vector<int> const & input)
|
||||
vector<Format const *> result(input.size());
|
||||
|
||||
vector<int>::const_iterator it = input.begin();
|
||||
vector<int>::const_iterator end = input.end();
|
||||
vector<int>::const_iterator const end = input.end();
|
||||
vector<Format const *>::iterator rit = result.begin();
|
||||
for ( ; it != end; ++it, ++rit) {
|
||||
*rit = &formats.get(*it);
|
||||
@ -601,8 +605,9 @@ Converters::intToFormat(std::vector<int> const & input)
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
vector<Format const *> const
|
||||
Converters::getReachableTo(string const & target, bool clear_visited)
|
||||
Converters::getReachableTo(string const & target, bool const clear_visited)
|
||||
{
|
||||
vector<int> const & reachablesto =
|
||||
G_.getReachableTo(formats.getNumber(target), clear_visited);
|
||||
@ -612,8 +617,8 @@ Converters::getReachableTo(string const & target, bool clear_visited)
|
||||
|
||||
|
||||
vector<Format const *> const
|
||||
Converters::getReachable(string const & from, bool only_viewable,
|
||||
bool clear_visited)
|
||||
Converters::getReachable(string const & from, bool const only_viewable,
|
||||
bool const clear_visited)
|
||||
{
|
||||
vector<int> const & reachables =
|
||||
G_.getReachable(formats.getNumber(from),
|
||||
|
@ -78,7 +78,7 @@ void Counter::setMaster(string const & m)
|
||||
void Counters::newCounter(string const & newc)
|
||||
{
|
||||
// First check if newc already exist
|
||||
CounterList::iterator cit = counterList.find(newc);
|
||||
CounterList::iterator const cit = counterList.find(newc);
|
||||
// if already exist give warning and return
|
||||
if (cit != counterList.end()) {
|
||||
lyxerr << "The new counter already exists." << endl;
|
||||
@ -91,14 +91,14 @@ void Counters::newCounter(string const & newc)
|
||||
void Counters::newCounter(string const & newc, string const & masterc)
|
||||
{
|
||||
// First check if newc already exists
|
||||
CounterList::iterator cit = counterList.find(newc);
|
||||
CounterList::iterator const cit = counterList.find(newc);
|
||||
// if already existant give warning and return
|
||||
if (cit != counterList.end()) {
|
||||
lyxerr << "The new counter already exists." << endl;
|
||||
return;
|
||||
}
|
||||
// then check if masterc exists
|
||||
CounterList::iterator it = counterList.find(masterc);
|
||||
CounterList::iterator const it = counterList.find(masterc);
|
||||
// if not give warning and return
|
||||
if (it == counterList.end()) {
|
||||
lyxerr << "The master counter does not exist." << endl;
|
||||
@ -109,9 +109,9 @@ void Counters::newCounter(string const & newc, string const & masterc)
|
||||
}
|
||||
|
||||
|
||||
void Counters::set(string const & ctr, int val)
|
||||
void Counters::set(string const & ctr, int const val)
|
||||
{
|
||||
CounterList::iterator it = counterList.find(ctr);
|
||||
CounterList::iterator const it = counterList.find(ctr);
|
||||
if (it == counterList.end()) {
|
||||
lyxerr << "set: Counter does not exist: " << ctr << endl;
|
||||
return;
|
||||
@ -120,9 +120,9 @@ void Counters::set(string const & ctr, int val)
|
||||
}
|
||||
|
||||
|
||||
void Counters::addto(string const & ctr, int val)
|
||||
void Counters::addto(string const & ctr, int const val)
|
||||
{
|
||||
CounterList::iterator it = counterList.find(ctr);
|
||||
CounterList::iterator const it = counterList.find(ctr);
|
||||
if (it == counterList.end()) {
|
||||
lyxerr << "addto: Counter does not exist: " << ctr << endl;
|
||||
return;
|
||||
@ -133,7 +133,7 @@ void Counters::addto(string const & ctr, int val)
|
||||
|
||||
int Counters::value(string const & ctr) const
|
||||
{
|
||||
CounterList::const_iterator cit = counterList.find(ctr);
|
||||
CounterList::const_iterator const cit = counterList.find(ctr);
|
||||
if (cit == counterList.end()) {
|
||||
lyxerr << "value: Counter does not exist: " << ctr << endl;
|
||||
return 0;
|
||||
@ -152,7 +152,7 @@ void Counters::step(string const & ctr)
|
||||
|
||||
it->second.step();
|
||||
it = counterList.begin();
|
||||
CounterList::iterator end = counterList.end();
|
||||
CounterList::iterator const end = counterList.end();
|
||||
for (; it != end; ++it) {
|
||||
if (it->second.master() == ctr) {
|
||||
it->second.reset();
|
||||
@ -164,7 +164,7 @@ void Counters::step(string const & ctr)
|
||||
void Counters::reset()
|
||||
{
|
||||
CounterList::iterator it = counterList.begin();
|
||||
CounterList::iterator end = counterList.end();
|
||||
CounterList::iterator const end = counterList.end();
|
||||
for (; it != end; ++it) {
|
||||
it->second.reset();
|
||||
}
|
||||
@ -198,7 +198,7 @@ void Counters::copy(Counters & from, Counters & to, string const & match)
|
||||
|
||||
namespace {
|
||||
|
||||
char loweralphaCounter(int n)
|
||||
char loweralphaCounter(int const n)
|
||||
{
|
||||
if (n < 1 || n > 26)
|
||||
return '?';
|
||||
@ -206,7 +206,7 @@ char loweralphaCounter(int n)
|
||||
}
|
||||
|
||||
|
||||
char alphaCounter(int n)
|
||||
char alphaCounter(int const n)
|
||||
{
|
||||
if (n < 1 || n > 26)
|
||||
return '?';
|
||||
@ -214,7 +214,7 @@ char alphaCounter(int n)
|
||||
}
|
||||
|
||||
|
||||
char hebrewCounter(int n)
|
||||
char hebrewCounter(int const n)
|
||||
{
|
||||
static const char hebrew[22] = {
|
||||
'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è',
|
||||
@ -228,9 +228,9 @@ char hebrewCounter(int n)
|
||||
}
|
||||
|
||||
|
||||
string const lowerromanCounter(int n)
|
||||
string const lowerromanCounter(int const n)
|
||||
{
|
||||
static char const * roman[20] = {
|
||||
static char const * const roman[20] = {
|
||||
"i", "ii", "iii", "iv", "v",
|
||||
"vi", "vii", "viii", "ix", "x",
|
||||
"xi", "xii", "xiii", "xiv", "xv",
|
||||
@ -243,9 +243,9 @@ string const lowerromanCounter(int n)
|
||||
}
|
||||
|
||||
|
||||
string const romanCounter(int n)
|
||||
string const romanCounter(int const n)
|
||||
{
|
||||
static char const * roman[20] = {
|
||||
static char const * const roman[20] = {
|
||||
"I", "II", "III", "IV", "V",
|
||||
"VI", "VII", "VIII", "IX", "X",
|
||||
"XI", "XII", "XIII", "XIV", "XV",
|
||||
@ -291,7 +291,7 @@ string Counters::counterLabel(string const & format)
|
||||
string label = format;
|
||||
while (true) {
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning Using boost::regex would make this code a lot simpler... (Lgb)
|
||||
#warning Using boost::regex or boost::spirit would make this code a lot simpler... (Lgb)
|
||||
#endif
|
||||
|
||||
size_t const i = label.find('\\', 0);
|
||||
|
39
src/cursor.C
39
src/cursor.C
@ -230,45 +230,6 @@ DispatchResult LCursor::result() const
|
||||
}
|
||||
|
||||
|
||||
bool LCursor::getStatus(FuncRequest const & cmd, FuncStatus & status)
|
||||
{
|
||||
// This is, of course, a mess. Better create a new doc iterator and use
|
||||
// this in Inset::getStatus. This might require an additional
|
||||
// BufferView * arg, though (which should be avoided)
|
||||
LCursor safe = *this;
|
||||
bool res = false;
|
||||
for ( ; size(); pop()) {
|
||||
//lyxerr << "\nLCursor::getStatus: cmd: " << cmd << endl << *this << endl;
|
||||
if (idx() > lastidx()) {
|
||||
lyxerr << "wrong idx " << idx() << ", max is " << lastidx()
|
||||
<< ". Trying to correct this." << endl;
|
||||
idx() = lastidx();
|
||||
}
|
||||
if (pit() > lastpit()) {
|
||||
lyxerr << "wrong par " << pit() << ", max is " << lastpit()
|
||||
<< ". Trying to correct this." << endl;
|
||||
pit() = lastpit();
|
||||
}
|
||||
if (pos() > lastpos()) {
|
||||
lyxerr << "wrong pos " << pos() << ", max is " << lastpos()
|
||||
<< ". Trying to correct this." << endl;
|
||||
pos() = lastpos();
|
||||
}
|
||||
|
||||
// The inset's getStatus() will return 'true' if it made
|
||||
// a definitive decision on whether it want to handle the
|
||||
// request or not. The result of this decision is put into
|
||||
// the 'status' parameter.
|
||||
if (inset().getStatus(*this, cmd, status)) {
|
||||
res = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
operator=(safe);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
BufferView & LCursor::bv() const
|
||||
{
|
||||
BOOST_ASSERT(bv_);
|
||||
|
@ -42,14 +42,6 @@ public:
|
||||
void dispatch(FuncRequest const & cmd);
|
||||
/// get the resut of the last dispatch
|
||||
DispatchResult result() const;
|
||||
/**
|
||||
* \returns true if this function made a definitive decision on
|
||||
* whether the inset at this cursor position wants to handle the
|
||||
* request \p cmd or not. The result of this decision is put into
|
||||
* \p status.
|
||||
*/
|
||||
bool getStatus(FuncRequest const & cmd, FuncStatus & flag);
|
||||
|
||||
/// add a new cursor slice
|
||||
void push(InsetBase & inset);
|
||||
/// add a new cursor slice, place cursor on left end
|
||||
|
@ -1,11 +1,16 @@
|
||||
2005-01-05 Lars Gullik Bjonnes <larsbj@gullik.net>
|
||||
|
||||
* inset.[Ch] (forceDefaultParagraphs): delete since it is same as
|
||||
base version
|
||||
|
||||
2005-01-04 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* ExternalTransforms.C: fix LaTeX output of \scalebox.
|
||||
|
||||
* ExternalTransforms.[Ch]:
|
||||
|
||||
* ExternalTransforms.[Ch]:
|
||||
* insetexternal.C: store all float/double values as strings.
|
||||
|
||||
* insetgraphics.C:
|
||||
|
||||
* insetgraphics.C:
|
||||
* insetgraphicsParams.C: more precise checks for the value strings.
|
||||
|
||||
2004-12-28 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
@ -14,12 +19,12 @@
|
||||
|
||||
2004-12-28 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* insetgraphics.C:
|
||||
* insetgraphics.C:
|
||||
* insetgraphicsParams.[Ch]: store all float/double values as strings.
|
||||
|
||||
2004-12-17 Alfredo Braunstein <abraunst@lyx.org>
|
||||
|
||||
* insettext.[Ch] : move autoBreakRows_ bool to LyXText
|
||||
* insettext.[Ch] : move autoBreakRows_ bool to LyXText
|
||||
|
||||
2004-12-15 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
@ -36,7 +41,7 @@
|
||||
* insettabular.C (getCellXPos): make it return a relative x
|
||||
position wrt. the begin of the tabular
|
||||
(resetPos): a couple of fixes
|
||||
(doDispatch): add a couple of resetPos calls
|
||||
(doDispatch): add a couple of resetPos calls
|
||||
(drawSelection): fix drawing of selection in single-cell mode
|
||||
(draw): replace 'do not draw' optimization by 'draw with
|
||||
nullpainter' one
|
||||
|
@ -52,12 +52,6 @@ LColor_color InsetOld::backgroundColor() const
|
||||
}
|
||||
|
||||
|
||||
bool InsetOld::forceDefaultParagraphs(InsetBase const *) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
int InsetOld::ascent() const
|
||||
{
|
||||
return dim_.asc;
|
||||
|
@ -53,8 +53,6 @@ public:
|
||||
/// returns the actual scroll-value
|
||||
virtual int scroll(bool recursive = true) const;
|
||||
|
||||
///
|
||||
bool forceDefaultParagraphs(InsetBase const * inset) const;
|
||||
protected:
|
||||
///
|
||||
InsetOld(InsetOld const & in);
|
||||
|
@ -318,6 +318,7 @@ public:
|
||||
// if this inset has paragraphs should they be output all as default
|
||||
// paragraphs with "Standard" layout?
|
||||
virtual bool forceDefaultParagraphs(InsetBase const *) const { return false; }
|
||||
|
||||
///
|
||||
virtual std::string const & getInsetName() const;
|
||||
/// used to toggle insets
|
||||
|
@ -141,6 +141,59 @@ extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
|
||||
extern tex_accent_struct get_accent(kb_action action);
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
bool getStatus(LCursor cursor,
|
||||
FuncRequest const & cmd, FuncStatus & status)
|
||||
{
|
||||
// This is, of course, a mess. Better create a new doc iterator and use
|
||||
// this in Inset::getStatus. This might require an additional
|
||||
// BufferView * arg, though (which should be avoided)
|
||||
//LCursor safe = *this;
|
||||
bool res = false;
|
||||
for ( ; cursor.size(); cursor.pop()) {
|
||||
//lyxerr << "\nLCursor::getStatus: cmd: " << cmd << endl << *this << endl;
|
||||
DocIterator::idx_type & idx = cursor.idx();
|
||||
DocIterator::idx_type const lastidx = cursor.lastidx();
|
||||
|
||||
if (idx > lastidx) {
|
||||
lyxerr << "wrong idx " << idx << ", max is " << lastidx
|
||||
<< ". Trying to correct this." << endl;
|
||||
idx = lastidx;
|
||||
}
|
||||
|
||||
DocIterator::pit_type & pit = cursor.pit();
|
||||
DocIterator::pit_type const lastpit = cursor.lastpit();
|
||||
|
||||
if (pit > lastpit) {
|
||||
lyxerr << "wrong par " << pit << ", max is " << lastpit
|
||||
<< ". Trying to correct this." << endl;
|
||||
pit = lastpit;
|
||||
}
|
||||
|
||||
DocIterator::pos_type & pos = cursor.pos();
|
||||
DocIterator::pos_type const lastpos = cursor.lastpos();
|
||||
|
||||
if (pos > lastpos) {
|
||||
lyxerr << "wrong pos " << pos << ", max is " << lastpos
|
||||
<< ". Trying to correct this." << endl;
|
||||
pos = lastpos;
|
||||
}
|
||||
|
||||
// The inset's getStatus() will return 'true' if it made
|
||||
// a definitive decision on whether it want to handle the
|
||||
// request or not. The result of this decision is put into
|
||||
// the 'status' parameter.
|
||||
if (cursor.inset().getStatus(cursor, cmd, status)) {
|
||||
res = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LyXFunc::LyXFunc(LyXView * lv)
|
||||
: owner(lv),
|
||||
encoded_last_key(0),
|
||||
@ -522,8 +575,8 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
|
||||
default:
|
||||
|
||||
if (!cur.getStatus(cmd, flag))
|
||||
flag |= view()->getStatus(cmd);
|
||||
if (!::getStatus(cur, cmd, flag))
|
||||
flag = view()->getStatus(cmd);
|
||||
}
|
||||
|
||||
if (!enable)
|
||||
|
@ -425,4 +425,3 @@ int MathArray::yo() const
|
||||
{
|
||||
return theCoords.arrays_.y(this);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user