cosmetics/#include cleanup

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23747 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2008-03-15 00:22:54 +00:00
parent f5a02d060a
commit f2c9b56fb4
36 changed files with 298 additions and 205 deletions

View File

@ -286,7 +286,7 @@ docstring const BiblioInfo::getInfo(docstring const & key) const
vector<docstring> const BiblioInfo::getCiteStrings(
docstring const & key, Buffer const & buf) const
{
biblio::CiteEngine const engine = buf.params().getEngine();
biblio::CiteEngine const engine = buf.params().citeEngine();
if (engine == biblio::ENGINE_BASIC ||
engine == biblio::ENGINE_NATBIB_NUMERICAL)
return getNumericalStrings(key, buf);
@ -307,7 +307,7 @@ vector<docstring> const BiblioInfo::getNumericalStrings(
return vector<docstring>();
vector<biblio::CiteStyle> const & styles =
biblio::getCiteStyles(buf.params().getEngine());
biblio::getCiteStyles(buf.params().citeEngine());
vector<docstring> vec(styles.size());
for (vector<docstring>::size_type i = 0; i != vec.size(); ++i) {
@ -367,7 +367,7 @@ vector<docstring> const BiblioInfo::getAuthorYearStrings(
return vector<docstring>();
vector<biblio::CiteStyle> const & styles =
getCiteStyles(buf.params().getEngine());
getCiteStyles(buf.params().citeEngine());
vector<docstring> vec(styles.size());
for (vector<docstring>::size_type i = 0; i != vec.size(); ++i) {

View File

@ -29,6 +29,7 @@
#include "support/lstrings.h"
#include "support/Package.h"
#include <boost/assert.hpp>
#include <boost/bind.hpp>
#include <algorithm>
@ -95,7 +96,8 @@ void BufferList::release(Buffer * buf)
Buffer * BufferList::newBuffer(string const & s, bool const ronly)
{
auto_ptr<Buffer> tmpbuf;
try { tmpbuf.reset(new Buffer(s, ronly));
try {
tmpbuf.reset(new Buffer(s, ronly));
} catch (ExceptionMessage const & message) {
if (message.type_ == ErrorException) {
Alert::error(message.title_, message.details_);

View File

@ -95,13 +95,14 @@ namespace lyx {
namespace {
// Paragraph separation
typedef Translator<string, BufferParams::PARSEP> ParSepTranslator;
typedef Translator<string, BufferParams::ParagraphSeparation> ParSepTranslator;
ParSepTranslator const init_parseptranslator()
{
ParSepTranslator translator(string_paragraph_separation[0], BufferParams::PARSEP_INDENT);
translator.addPair(string_paragraph_separation[1], BufferParams::PARSEP_SKIP);
ParSepTranslator translator
(string_paragraph_separation[0], BufferParams::ParagraphIndentSeparation);
translator.addPair(string_paragraph_separation[1], BufferParams::ParagraphSkipSeparation);
return translator;
}
@ -114,17 +115,18 @@ ParSepTranslator const & parseptranslator()
// Quotes language
typedef Translator<string, InsetQuotes::quote_language> QuotesLangTranslator;
typedef Translator<string, InsetQuotes::QuoteLanguage> 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);
translator.addPair(string_quotes_language[3], InsetQuotes::PolishQ);
translator.addPair(string_quotes_language[4], InsetQuotes::FrenchQ);
translator.addPair(string_quotes_language[5], InsetQuotes::DanishQ);
QuotesLangTranslator translator
(string_quotes_language[0], InsetQuotes::EnglishQuotes);
translator.addPair(string_quotes_language[1], InsetQuotes::SwedishQuotes);
translator.addPair(string_quotes_language[2], InsetQuotes::GermanQuotes);
translator.addPair(string_quotes_language[3], InsetQuotes::PolishQuotes);
translator.addPair(string_quotes_language[4], InsetQuotes::FrenchQuotes);
translator.addPair(string_quotes_language[5], InsetQuotes::DanishQuotes);
return translator;
}
@ -140,7 +142,7 @@ QuotesLangTranslator const & quoteslangtranslator()
typedef Translator<string, PAPER_SIZE> PaperSizeTranslator;
PaperSizeTranslator const init_papersizetranslator()
static PaperSizeTranslator initPaperSizeTranslator()
{
PaperSizeTranslator translator(string_papersize[0], PAPER_DEFAULT);
translator.addPair(string_papersize[1], PAPER_CUSTOM);
@ -159,7 +161,7 @@ PaperSizeTranslator const init_papersizetranslator()
PaperSizeTranslator const & papersizetranslator()
{
static PaperSizeTranslator translator = init_papersizetranslator();
static PaperSizeTranslator translator = initPaperSizeTranslator();
return translator;
}
@ -317,8 +319,8 @@ BufferParams::BufferParams()
{
setBaseClass(defaultBaseclass());
makeDocumentClass();
paragraph_separation = PARSEP_INDENT;
quotes_language = InsetQuotes::EnglishQ;
paragraph_separation = ParagraphIndentSeparation;
quotes_language = InsetQuotes::EnglishQuotes;
fontsize = "default";
/* PaperLayout */
@ -357,11 +359,7 @@ BufferParams::BufferParams()
}
BufferParams::~BufferParams()
{}
docstring const BufferParams::B_(string const & l10n) const
docstring BufferParams::B_(string const & l10n) const
{
BOOST_ASSERT(language);
return getMessages(language->code()).get(l10n);
@ -468,7 +466,7 @@ void BufferParams::setDefSkip(VSpace const & vs)
}
string const BufferParams::readToken(Lexer & lex, string const & token,
string BufferParams::readToken(Lexer & lex, string const & token,
FileName const & filepath, FileName const & temppath)
{
if (token == "\\textclass") {
@ -1650,7 +1648,7 @@ void BufferParams::readModules(Lexer & lex)
}
string const BufferParams::paperSizeName(Papersize_Purpose const & purpose) const
string BufferParams::paperSizeName(PapersizePurpose purpose) const
{
char real_papersize = papersize;
if (real_papersize == PAPER_DEFAULT)
@ -1742,7 +1740,7 @@ string const BufferParams::dvips_options() const
}
string const BufferParams::babelCall(string const & lang_opts) const
string BufferParams::babelCall(string const & lang_opts) const
{
string lang_pack = lyxrc.language_package;
if (lang_pack != "\\usepackage{babel}")
@ -1982,7 +1980,7 @@ Encoding const & BufferParams::encoding() const
}
biblio::CiteEngine BufferParams::getEngine() const
biblio::CiteEngine BufferParams::citeEngine() const
{
// FIXME the class should provide the numerical/
// authoryear choice
@ -1993,7 +1991,7 @@ biblio::CiteEngine BufferParams::getEngine() const
}
void BufferParams::setCiteEngine(biblio::CiteEngine const cite_engine)
void BufferParams::setCiteEngine(biblio::CiteEngine cite_engine)
{
cite_engine_ = cite_engine;
}

View File

@ -27,9 +27,7 @@
namespace lyx {
namespace support {
class FileName;
}
namespace support { class FileName; }
class AuthorList;
class BranchList;
@ -54,21 +52,20 @@ class VSpace;
class BufferParams {
public:
///
enum PARSEP {
enum ParagraphSeparation {
///
PARSEP_INDENT,
ParagraphIndentSeparation,
///
PARSEP_SKIP
ParagraphSkipSeparation
};
///
BufferParams();
~BufferParams();
/// get l10n translated to the buffers language
docstring const B_(std::string const & l10n) const;
docstring B_(std::string const & l10n) const;
/// read a header token, if unrecognised, return it or an unknown class name
std::string const readToken(Lexer & lex,
std::string readToken(Lexer & lex,
std::string const & token, ///< token to read.
support::FileName const & filepath,
support::FileName const & temppath); ///< where to look for local layout file.
@ -87,20 +84,18 @@ public:
///
void useClassDefaults();
///
bool hasClassDefaults() const;
///
VSpace const & getDefSkip() const;
///
void setDefSkip(VSpace const & vs);
/** Whether paragraphs are separated by using a indent like in
* articles or by using a little skip like in letters.
*/
PARSEP paragraph_separation;
ParagraphSeparation paragraph_separation;
///
InsetQuotes::QuoteLanguage quotes_language;
///
@ -287,7 +282,7 @@ public:
* purpose for which the paper size is needed, since they
* support different subsets of paper sizes.
*/
enum Papersize_Purpose {
enum PapersizePurpose {
///
DVIPS,
///
@ -296,9 +291,9 @@ public:
XDVI
};
///
std::string const paperSizeName(Papersize_Purpose const & purpose) const;
std::string paperSizeName(PapersizePurpose purpose) const;
/// set up if and how babel is called
std::string const babelCall(std::string const & lang_opts) const;
std::string babelCall(std::string const & lang_opts) const;
/// handle inputenc etc.
void writeEncodingPreamble(odocstream & os, LaTeXFeatures & features,
TexRow & texrow) const;
@ -309,8 +304,7 @@ public:
int const & sfscale, int const & ttscale) const;
/// get the appropriate cite engine (natbib handling)
biblio::CiteEngine getEngine() const;
biblio::CiteEngine citeEngine() const;
///
void setCiteEngine(biblio::CiteEngine const);

36
src/CompletionList.h Normal file
View File

@ -0,0 +1,36 @@
// -*- C++ -*-
/**
* \file CompletionList.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Stefan Schimanski
*
* Full author contact details are available in file CREDITS.
*/
#ifndef COMPLETIONLIST_H
#define COMPLETIONLIST_H
#include "support/docstring.h"
namespace lyx {
class CompletionList {
public:
///
virtual ~CompletionList() {}
///
virtual bool sorted() const = 0;
///
virtual size_t size() const = 0;
/// returns the string shown in the gui.
virtual lyx::docstring const & data(size_t idx) const = 0;
/// returns the resource string used to load an icon.
virtual std::string icon(size_t /*idx*/) const { return std::string(); }
};
} // namespace lyx
#endif

View File

@ -34,6 +34,8 @@
#include "support/ExceptionMessage.h"
#include "support/FileZipListDir.h"
#include <boost/assert.hpp>
#include <sstream>
#include <fstream>
#include <utility>
@ -46,8 +48,7 @@ namespace lyx {
namespace Alert = frontend::Alert;
EmbeddedFile::EmbeddedFile(string const & file, std::string const & buffer_path)
: DocFileName("", false), inzip_name_(""), embedded_(false), inset_list_(),
temp_path_("")
: DocFileName("", false), embedded_(false), inset_list_()
{
set(file, buffer_path);
}

View File

@ -150,7 +150,7 @@ public:
* when an embedded file is copied to another buffer, temp_path_ has
* to be updated and file copying may be needed.
*/
bool enabled() const { return temp_path_ != ""; }
bool enabled() const { return !temp_path_.empty(); }
/// enable embedding of this file
void enable(bool flag, Buffer const * buf, bool updateFile);
@ -205,7 +205,8 @@ public:
/* \param file Embedded file to add
* \param inset Inset pointer
*/
void registerFile(EmbeddedFile const & file, Inset const * inset, Buffer const & buffer);
void registerFile(EmbeddedFile const & file, Inset const * inset,
Buffer const & buffer);
/// validate embedded fies after a file is read.
void validate(Buffer const & buffer);

View File

@ -36,6 +36,7 @@
using namespace std;
using namespace lyx::support;
namespace lyx {
/////////////////////////////////////////////////////////////////////
@ -515,9 +516,8 @@ string const LaTeXFeatures::getPackages() const
}
// pdfcolmk must be loaded after color
if (mustProvide("pdfcolmk")) {
if (mustProvide("pdfcolmk"))
packages << "\\usepackage{pdfcolmk}\n";
}
// makeidx.sty
if (isRequired("makeidx")) {
@ -551,13 +551,12 @@ string const LaTeXFeatures::getPackages() const
}
// lyxskak.sty --- newer chess support based on skak.sty
if (mustProvide("chess")) {
if (mustProvide("chess"))
packages << "\\usepackage[ps,mover]{lyxskak}\n";
}
// setspace.sty
if (mustProvide("setspace") && !tclass.provides("SetSpace"))
packages << "\\usepackage{setspace}\n";
packages << "\\usepackage{setspace}\n";
// amssymb.sty
if (mustProvide("amssymb")
@ -573,29 +572,25 @@ string const LaTeXFeatures::getPackages() const
// natbib.sty
if (mustProvide("natbib")) {
packages << "\\usepackage[";
if (params_.getEngine() == biblio::ENGINE_NATBIB_NUMERICAL) {
if (params_.citeEngine() == biblio::ENGINE_NATBIB_NUMERICAL)
packages << "numbers";
} else {
else
packages << "authoryear";
}
packages << "]{natbib}\n";
}
// jurabib -- we need version 0.6 at least.
if (mustProvide("jurabib")) {
if (mustProvide("jurabib"))
packages << "\\usepackage{jurabib}[2004/01/25]\n";
}
// xargs -- we need version 1.09 at least
if (mustProvide("xargs")) {
if (mustProvide("xargs"))
packages << "\\usepackage{xargs}[2008/03/08]\n";
}
// bibtopic -- the dot provides the aux file naming which
// LyX can detect.
if (mustProvide("bibtopic")) {
if (mustProvide("bibtopic"))
packages << "\\usepackage[dot]{bibtopic}\n";
}
if (mustProvide("xy"))
packages << "\\usepackage[all]{xy}\n";

View File

@ -1090,14 +1090,9 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
else
c = par.getChar(pos - 1);
string arg = to_utf8(cmd.argument());
if (arg == "single")
cur.insert(new InsetQuotes(c,
bufparams.quotes_language,
InsetQuotes::SingleQ));
else
cur.insert(new InsetQuotes(c,
bufparams.quotes_language,
InsetQuotes::DoubleQ));
cur.insert(new InsetQuotes(c, bufparams.quotes_language,
(arg == "single") ? InsetQuotes::SingleQuotes
: InsetQuotes::DoubleQuotes));
cur.posForward();
}
else

View File

@ -50,15 +50,16 @@
#include "support/debug.h"
#include <boost/assert.hpp>
using namespace std;
namespace lyx {
using frontend::FontMetrics;
namespace {
int numberOfSeparators(Paragraph const & par, Row const & row)
static int numberOfSeparators(Paragraph const & par, Row const & row)
{
pos_type const first = max(row.pos(), par.beginOfBody());
pos_type const last = row.endpos() - 1;
@ -71,7 +72,7 @@ int numberOfSeparators(Paragraph const & par, Row const & row)
}
int numberOfLabelHfills(Paragraph const & par, Row const & row)
static int numberOfLabelHfills(Paragraph const & par, Row const & row)
{
pos_type last = row.endpos() - 1;
pos_type first = row.pos();
@ -92,7 +93,7 @@ int numberOfLabelHfills(Paragraph const & par, Row const & row)
}
int numberOfHfills(Paragraph const & par, Row const & row)
static int numberOfHfills(Paragraph const & par, Row const & row)
{
pos_type const last = row.endpos();
pos_type first = row.pos();
@ -113,7 +114,13 @@ int numberOfHfills(Paragraph const & par, Row const & row)
return n;
}
} // namespace anon
/////////////////////////////////////////////////////////////////////
//
// TextMetrics
//
/////////////////////////////////////////////////////////////////////
TextMetrics::TextMetrics(BufferView * bv, Text * text)
: bv_(bv), text_(text)
@ -944,7 +951,7 @@ Dimension TextMetrics::rowHeight(pit_type const pit, pos_type const first,
BufferParams const & bufparams = buffer.params();
// some parskips VERY EASY IMPLEMENTATION
if (bufparams.paragraph_separation
== BufferParams::PARSEP_SKIP
== BufferParams::ParagraphSkipSeparation
&& par.ownerCode() != ERT_CODE
&& par.ownerCode() != LISTINGS_CODE
&& pit > 0
@ -1843,7 +1850,7 @@ int TextMetrics::leftMargin(int max_width,
&& par.getInset(pos)->display())
&& ((tclass.isDefaultLayout(par.layout())
|| tclass.isEmptyLayout(par.layout()))
|| buffer.params().paragraph_separation == BufferParams::PARSEP_INDENT)
|| buffer.params().paragraph_separation == BufferParams::ParagraphIndentSeparation)
)
{
l_margin += theFontMetrics(buffer.params().getFont()).signedWidth(

View File

@ -30,8 +30,11 @@
#include "support/debug.h"
#include "support/docstream.h"
#include <boost/assert.hpp>
using namespace std;
namespace lyx {
///////////////////////////////////////////////////////////////////////////

View File

@ -33,14 +33,16 @@
#include "support/debug.h"
#include "support/limited_stack.h"
#include <boost/assert.hpp>
#include <algorithm>
#include <ostream>
using namespace std;
using namespace lyx::support;
namespace lyx {
namespace lyx {
/**
These are the elements put on the undo stack. Each object contains complete
@ -61,8 +63,9 @@ Obviously, the stored ranged should be as small as possible. However, it
there is a lower limit: The StableDocIterator pointing stored in the undo
class must be valid after the changes, too, as it will used as a pointer
where to insert the stored bits when performining undo.
*/
struct UndoElement
{
/// Which kind of operation are we recording for?
@ -88,7 +91,7 @@ struct UndoElement
struct Undo::Private
{
Private(Buffer & buffer): buffer_(buffer) {}
Private(Buffer & buffer) : buffer_(buffer) {}
// Returns false if no undo possible.
bool textUndoOrRedo(DocIterator & cur, bool isUndoOperation);
@ -119,9 +122,16 @@ struct Undo::Private
};
Undo::Undo(Buffer & buffer): d(new Undo::Private(buffer))
{
}
/////////////////////////////////////////////////////////////////////
//
// Undo
//
/////////////////////////////////////////////////////////////////////
Undo::Undo(Buffer & buffer)
: d(new Undo::Private(buffer))
{}
Undo::~Undo()
@ -142,11 +152,7 @@ bool Undo::hasRedoStack() const
}
namespace {
ostream & operator<<(ostream & os, UndoElement const & undo)
static ostream & operator<<(ostream & os, UndoElement const & undo)
{
return os << " from: " << undo.from << " end: " << undo.end
<< " cell:\n" << undo.cell
@ -154,15 +160,19 @@ ostream & operator<<(ostream & os, UndoElement const & undo)
}
bool samePar(StableDocIterator const & i1, StableDocIterator const & i2)
static bool samePar(StableDocIterator const & i1, StableDocIterator const & i2)
{
StableDocIterator tmpi2 = i2;
tmpi2.pos() = i1.pos();
return i1 == tmpi2;
}
} // namespace anon
/////////////////////////////////////////////////////////////////////
//
// Undo::Private
//
///////////////////////////////////////////////////////////////////////
void Undo::Private::doRecordUndo(UndoKind kind,
DocIterator const & cell,

View File

@ -23,11 +23,14 @@
#include "support/convert.h"
#include "support/lstrings.h"
#include <boost/assert.hpp>
#include <cstring>
using namespace std;
using namespace lyx::support;
namespace lyx {
namespace {

View File

@ -515,7 +515,7 @@ QString GuiBibtex::styleFile() const
{
// the different bibtex packages have (and need) their
// own "plain" stylefiles
biblio::CiteEngine const engine = buffer().params().getEngine();
biblio::CiteEngine const engine = buffer().params().citeEngine();
QString defaultstyle;
switch (engine) {
case biblio::ENGINE_BASIC:

View File

@ -213,7 +213,7 @@ void GuiCitation::updateDialog()
void GuiCitation::updateFormatting(biblio::CiteStyle currentStyle)
{
biblio::CiteEngine const engine = getEngine();
biblio::CiteEngine const engine = citeEngine();
bool const natbib_engine =
engine == biblio::ENGINE_NATBIB_AUTHORYEAR ||
engine == biblio::ENGINE_NATBIB_NUMERICAL;
@ -590,13 +590,9 @@ void GuiCitation::setCitedKeys()
bool GuiCitation::initialiseParams(string const & data)
{
InsetCommandMailer::string2params(lfun_name_, data, params_);
biblio::CiteEngine const engine = buffer().params().getEngine();
biblio::CiteEngine const engine = buffer().params().citeEngine();
bibkeysInfo_.fillWithBibKeys(&buffer());
citeStyles_ = biblio::getCiteStyles(engine);
return true;
}
@ -608,19 +604,19 @@ void GuiCitation::clearParams()
}
vector<docstring> const GuiCitation::availableKeys() const
vector<docstring> GuiCitation::availableKeys() const
{
return bibkeysInfo_.getKeys();
}
vector<docstring> const GuiCitation::availableFields() const
vector<docstring> GuiCitation::availableFields() const
{
return bibkeysInfo_.getFields();
}
vector<docstring> const GuiCitation::availableEntries() const
vector<docstring> GuiCitation::availableEntries() const
{
return bibkeysInfo_.getEntries();
}
@ -648,9 +644,9 @@ void GuiCitation::filterByEntryType(
}
biblio::CiteEngine GuiCitation::getEngine() const
biblio::CiteEngine GuiCitation::citeEngine() const
{
return buffer().params().getEngine();
return buffer().params().citeEngine();
}

View File

@ -151,16 +151,16 @@ private:
bool disconnectOnApply() const { return true; }
/// \return the list of all available bibliography keys.
std::vector<docstring> const availableKeys() const;
std::vector<docstring> availableKeys() const;
/// \return the list of all used BibTeX fields
std::vector<docstring> const availableFields() const;
std::vector<docstring> availableFields() const;
/// \return the list of all used BibTeX entry types
std::vector<docstring> const availableEntries() const;
std::vector<docstring> availableEntries() const;
///
void filterByEntryType(
std::vector<docstring> & keyVector, docstring entryType);
///
biblio::CiteEngine getEngine() const;
biblio::CiteEngine citeEngine() const;
/// \return information for this key.
docstring getInfo(docstring const & key) const;

View File

@ -14,6 +14,7 @@
#include "Buffer.h"
#include "BufferView.h"
#include "CompletionList.h"
#include "Cursor.h"
#include "Dimension.h"
#include "FuncRequest.h"
@ -102,7 +103,7 @@ protected:
class GuiCompletionModel : public QAbstractListModel {
public:
///
GuiCompletionModel(QObject * parent, Inset::CompletionList const * l)
GuiCompletionModel(QObject * parent, CompletionList const * l)
: QAbstractListModel(parent), list_(l) {}
///
~GuiCompletionModel()
@ -164,8 +165,8 @@ public:
}
private:
///
Inset::CompletionList const * list_;
/// owned by us
CompletionList const * list_;
};
@ -479,7 +480,7 @@ void GuiCompleter::updateModel(Cursor & cur, bool popupUpdate, bool inlineUpdate
rtlItemDelegate_->setEnabled(rtl);
// set new model
Inset::CompletionList const * list = cur.inset().createCompletionList(cur);
CompletionList const * list = cur.inset().createCompletionList(cur);
setModel(new GuiCompletionModel(this, list));
modelActive_ = true;
if (list->sorted())

View File

@ -1512,25 +1512,25 @@ void GuiDocument::apply(BufferParams & params)
fromqstr(langModule->encodingCO->currentText());
}
InsetQuotes::quote_language lga = InsetQuotes::EnglishQ;
InsetQuotes::QuoteLanguage lga = InsetQuotes::EnglishQuotes;
switch (langModule->quoteStyleCO->currentIndex()) {
case 0:
lga = InsetQuotes::EnglishQ;
lga = InsetQuotes::EnglishQuotes;
break;
case 1:
lga = InsetQuotes::SwedishQ;
lga = InsetQuotes::SwedishQuotes;
break;
case 2:
lga = InsetQuotes::GermanQ;
lga = InsetQuotes::GermanQuotes;
break;
case 3:
lga = InsetQuotes::PolishQ;
lga = InsetQuotes::PolishQuotes;
break;
case 4:
lga = InsetQuotes::FrenchQ;
lga = InsetQuotes::FrenchQuotes;
break;
case 5:
lga = InsetQuotes::DanishQ;
lga = InsetQuotes::DanishQuotes;
break;
}
params.quotes_language = lga;
@ -1622,9 +1622,9 @@ void GuiDocument::apply(BufferParams & params)
InsetListingsParams(fromqstr(textLayoutModule->listingsED->toPlainText())).params();
if (textLayoutModule->indentRB->isChecked())
params.paragraph_separation = BufferParams::PARSEP_INDENT;
params.paragraph_separation = BufferParams::ParagraphIndentSeparation;
else
params.paragraph_separation = BufferParams::PARSEP_SKIP;
params.paragraph_separation = BufferParams::ParagraphSkipSeparation;
switch (textLayoutModule->skipCO->currentIndex()) {
case 0:
@ -1806,17 +1806,17 @@ void GuiDocument::updateParams(BufferParams const & params)
// biblio
biblioModule->citeDefaultRB->setChecked(
params.getEngine() == biblio::ENGINE_BASIC);
params.citeEngine() == biblio::ENGINE_BASIC);
biblioModule->citeNatbibRB->setChecked(
params.getEngine() == biblio::ENGINE_NATBIB_NUMERICAL ||
params.getEngine() == biblio::ENGINE_NATBIB_AUTHORYEAR);
params.citeEngine() == biblio::ENGINE_NATBIB_NUMERICAL ||
params.citeEngine() == biblio::ENGINE_NATBIB_AUTHORYEAR);
biblioModule->citeStyleCO->setCurrentIndex(
params.getEngine() == biblio::ENGINE_NATBIB_NUMERICAL);
params.citeEngine() == biblio::ENGINE_NATBIB_NUMERICAL);
biblioModule->citeJurabibRB->setChecked(
params.getEngine() == biblio::ENGINE_JURABIB);
params.citeEngine() == biblio::ENGINE_JURABIB);
biblioModule->bibtopicCB->setChecked(
params.use_bibtopic);
@ -1907,7 +1907,7 @@ void GuiDocument::updateParams(BufferParams const & params)
}
setLSpacing(nitem);
if (params.paragraph_separation == BufferParams::PARSEP_INDENT)
if (params.paragraph_separation == BufferParams::ParagraphIndentSeparation)
textLayoutModule->indentRB->setChecked(true);
else
textLayoutModule->skipRB->setChecked(true);

View File

@ -218,7 +218,7 @@ void GuiParagraph::updateView()
labelWidth->setText(toqstr(labelwidth));
} else {
labelwidthGB->setEnabled(false);
labelWidth->setText("");
labelWidth->setText(QString());
}
// alignment
@ -320,8 +320,8 @@ bool GuiParagraph::haveMultiParSelection()
bool GuiParagraph::canIndent() const
{
return buffer().params().paragraph_separation ==
BufferParams::PARSEP_INDENT;
return buffer().params().paragraph_separation
== BufferParams::ParagraphIndentSeparation;
}

View File

@ -17,6 +17,7 @@
#include "DockView.h"
#include "TocWidget.h"
#include "FuncRequest.h"
#include "insets/InsetCommand.h"
#include "TocModel.h"
@ -33,6 +34,8 @@
#include "support/debug.h"
#include "support/gettext.h"
#include <boost/assert.hpp>
#include <algorithm>
using namespace std;

View File

@ -31,6 +31,9 @@
#include "support/debug.h"
#include "support/gettext.h"
#include <boost/assert.hpp>
using namespace std;
namespace lyx {

View File

@ -31,16 +31,17 @@
#include "support/gettext.h"
#include "support/lstrings.h"
#include <boost/assert.hpp>
#include <sstream>
using namespace std;
using namespace lyx::support;
namespace lyx {
namespace {
docstring verboseHLine(int n)
static docstring verboseHLine(int n)
{
docstring res;
for (int i = 0; i < n; ++i)
@ -51,14 +52,13 @@ docstring verboseHLine(int n)
}
int extractInt(istream & is)
static int extractInt(istream & is)
{
int num = 1;
is >> num;
return (num == 0) ? 1 : num;
}
}
//////////////////////////////////////////////////////////////
@ -70,7 +70,6 @@ InsetMathGrid::CellInfo::CellInfo()
//////////////////////////////////////////////////////////////

View File

@ -445,9 +445,7 @@ void InsetMathHull::drawT(TextPainter & pain, int x, int y) const
}
namespace {
docstring const latex_string(InsetMathHull const & inset)
static docstring latexString(InsetMathHull const & inset)
{
odocstringstream ls;
WriteStream wi(ls, false, false);
@ -455,13 +453,11 @@ docstring const latex_string(InsetMathHull const & inset)
return ls.str();
}
} // namespace anon
void InsetMathHull::addPreview(graphics::PreviewLoader & ploader) const
{
if (RenderPreview::status() == LyXRC::PREVIEW_ON) {
docstring const snippet = latex_string(*this);
docstring const snippet = latexString(*this);
preview_->addPreview(snippet, ploader);
}
}
@ -471,7 +467,7 @@ bool InsetMathHull::notifyCursorLeaves(Cursor const & /*old*/, Cursor & cur)
{
if (RenderPreview::status() == LyXRC::PREVIEW_ON) {
Buffer const & buffer = cur.buffer();
docstring const snippet = latex_string(*this);
docstring const snippet = latexString(*this);
preview_->addPreview(snippet, buffer);
preview_->startLoading(buffer);
cur.updateFlags(Update::Force);

View File

@ -25,6 +25,7 @@
#include "InsetMathSpace.h"
#include "InsetMathSymbol.h"
#include "InsetMathUnknown.h"
#include "MathCompletionList.h"
#include "MathData.h"
#include "MathFactory.h"
#include "MathMacro.h"
@ -408,7 +409,8 @@ void InsetMathNest::handleFont
}
void InsetMathNest::handleFont(Cursor & cur, docstring const & arg, docstring const & font)
void InsetMathNest::handleFont(Cursor & cur, docstring const & arg,
docstring const & font)
{
// this whole function is a hack and won't work for incremental font
// changes...
@ -416,12 +418,20 @@ void InsetMathNest::handleFont(Cursor & cur, docstring const & arg, docstring co
if (cur.inset().asInsetMath()->name() == font) {
cur.recordUndoInset();
cur.handleFont(to_utf8(font));
} else
} else {
handleNest(cur, createInsetMath(font), arg);
}
}
void InsetMathNest::handleNest(Cursor & cur, MathAtom const & nest, docstring const & arg)
void InsetMathNest::handleNest(Cursor & cur, MathAtom const & nest)
{
handleNest(cur, nest, docstring());
}
void InsetMathNest::handleNest(Cursor & cur, MathAtom const & nest,
docstring const & arg)
{
CursorSlice i1 = cur.selBegin();
CursorSlice i2 = cur.selEnd();
@ -460,11 +470,11 @@ void InsetMathNest::handleNest(Cursor & cur, MathAtom const & nest, docstring co
// the complicated case with multiple selected cells in a grid
cur.recordUndoInset();
Inset::row_type r1, r2;
Inset::col_type c1, c2;
row_type r1, r2;
col_type c1, c2;
cap::region(i1, i2, r1, r2, c1, c2);
for (Inset::row_type row = r1; row <= r2; ++row) {
for (Inset::col_type col = c1; col <= c2; ++col) {
for (row_type row = r1; row <= r2; ++row) {
for (col_type col = c1; col <= c2; ++col) {
// select cell
cur.idx() = i1.asInsetMath()->index(row, col);
cur.pos() = 0;
@ -502,7 +512,6 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg)
void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
{
//lyxerr << "InsetMathNest: request: " << cmd << endl;
//CursorSlice sl = cur.current();
switch (cmd.action) {
@ -1588,6 +1597,12 @@ bool InsetMathNest::interpretString(Cursor & cur, docstring const & str)
}
bool InsetMathNest::script(Cursor & cur, bool up)
{
script(cur, up, docstring());
}
bool InsetMathNest::script(Cursor & cur, bool up,
docstring const & save_selection)
{
@ -1666,7 +1681,7 @@ bool InsetMathNest::automaticPopupCompletion() const
}
Inset::CompletionList const *
CompletionList const *
InsetMathNest::createCompletionList(Cursor const & cur) const
{
if (!cur.inMacroMode())

View File

@ -14,34 +14,11 @@
#include "InsetMath.h"
// FIXME: remove
#include "support/docstring.h"
namespace lyx {
class MathCompletionList : public Inset::CompletionList {
public:
///
MathCompletionList(Cursor const & cur);
///
virtual ~MathCompletionList();
///
virtual bool sorted() const { return false; }
///
virtual size_t size() const;
///
virtual docstring const & data(size_t idx) const;
///
virtual std::string icon(size_t idx) const;
///
static void addToFavorites(docstring const & completion);
private:
///
static std::vector<docstring> globals;
///
std::vector<docstring> locals;
};
/** Abstract base class for all math objects that contain nested items.
This is basically everything that is not a single character or a
single symbol.
@ -172,15 +149,16 @@ protected:
/// Grab and erase selection and insert the InsetMathNest atom in every
/// previously selected cell, insert the grabbed former data and \c arg
/// in the first cell of the inserted atom.
void handleNest(Cursor & cur, MathAtom const & nest);
void handleNest(Cursor & cur, MathAtom const & nest,
docstring const & arg = docstring());
docstring const & arg);
/// interpret \p c and insert the result at the current position of
/// of \p cur. Return whether the cursor should stay in the formula.
bool interpretChar(Cursor & cur, char_type c);
///
bool script(Cursor & cur, bool,
docstring const & save_selection = docstring());
bool script(Cursor & cur, bool);
bool script(Cursor & cur, bool, docstring const & save_selection);
public:
/// interpret \p str and insert the result at the current position of

View File

@ -17,8 +17,8 @@
using namespace std;
namespace lyx {
namespace lyx {
InsetMathNumber::InsetMathNumber(docstring const & s)
: str_(s)

View File

@ -14,12 +14,12 @@
#include "InsetMath.h"
#include "support/docstring.h"
namespace lyx {
/** Some inset that "is" a number
* mainly for math-extern
/** Some inset that "is" a number mainly for math-extern
*/
class InsetMathNumber : public InsetMath {
public:
@ -55,4 +55,5 @@ private:
} // namespace lyx
#endif

View File

@ -14,6 +14,8 @@
#include "InsetMath.h"
#include "support/docstring.h"
namespace lyx {

View File

@ -27,12 +27,6 @@ InsetMathUnknown::InsetMathUnknown(docstring const & nm,
{}
Inset * InsetMathUnknown::clone() const
{
return new InsetMathUnknown(*this);
}
docstring InsetMathUnknown::name() const
{
return name_;

View File

@ -14,10 +14,11 @@
#include "InsetMath.h"
#include "support/docstring.h"
namespace lyx {
/// LaTeX names for objects that we really don't know
class InsetMathUnknown : public InsetMath {
public:
@ -60,7 +61,9 @@ public:
int kerning(BufferView const *) const { return kerning_; }
private:
virtual Inset * clone() const;
///
Inset * clone() const { return new InsetMathUnknown(*this); }
///
docstring name_;
/// are we finished creating the name?
@ -73,6 +76,6 @@ private:
docstring selection_;
};
} // namespace lyx
#endif

View File

@ -0,0 +1,52 @@
// -*- C++ -*-
/**
* \file MathCompletionList.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Stefan Schimanski
*
* Full author contact details are available in file CREDITS.
*/
#ifndef MATH_COMPLETIONLIST_H
#define MATH_COMPLETIONLIST_H
#include "CompletionList.h"
#include "support/docstring.h"
#include <vector>
namespace lyx {
class MathCompletionList : public CompletionList {
public:
///
MathCompletionList(Cursor const & cur);
///
virtual ~MathCompletionList();
///
virtual bool sorted() const { return false; }
///
virtual size_t size() const;
///
virtual docstring const & data(size_t idx) const;
///
virtual std::string icon(size_t idx) const;
///
static void addToFavorites(docstring const & completion);
private:
///
static std::vector<docstring> globals;
///
std::vector<docstring> locals;
};
} // namespace lyx
#endif // MATH_COMPLETIONLIST_H

View File

@ -13,9 +13,11 @@
#include <config.h>
#include "MathMacro.h"
#include "MathSupport.h"
#include "MathCompletionList.h"
#include "MathExtern.h"
#include "MathStream.h"
#include "MathSupport.h"
#include "Buffer.h"
#include "BufferView.h"
@ -770,7 +772,7 @@ bool MathMacro::automaticPopupCompletion() const
}
Inset::CompletionList const *
CompletionList const *
MathMacro::createCompletionList(Cursor const & cur) const
{
if (displayMode() != DISPLAY_UNFOLDED)

View File

@ -20,7 +20,7 @@
namespace lyx {
MathMacroArgument::MathMacroArgument(size_t n)
MathMacroArgument::MathMacroArgument(int n)
: number_(n)
{
if (n < 1 || n > 9) {
@ -43,7 +43,7 @@ Inset * MathMacroArgument::clone() const
}
void MathMacroArgument::setNumber(size_t n)
void MathMacroArgument::setNumber(int n)
{
if (n < 1 || n > 9) {
LYXERR0("MathMacroArgument::setNumber: wrong Argument id: " << n);

View File

@ -15,6 +15,8 @@
#include "InsetMath.h"
#include "support/docstring.h"
namespace lyx {
@ -23,15 +25,15 @@ namespace lyx {
class MathMacroArgument : public InsetMath {
public:
///
explicit MathMacroArgument(std::size_t);
explicit MathMacroArgument(int number);
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo &, int x, int y) const;
///
std::size_t number() const { return number_; }
int number() const { return number_; }
///
void setNumber(std::size_t n);
void setNumber(int n);
///
InsetCode lyxCode() const { return MATHMACROARG_CODE; }
@ -41,9 +43,9 @@ public:
void write(WriteStream & os) const;
private:
virtual Inset * clone() const;
Inset * clone() const;
/// A number between 1 and 9
std::size_t number_;
int number_;
///
docstring str_;
};

View File

@ -23,6 +23,7 @@
#include "support/debug.h"
#include <boost/assert.hpp>
#include <boost/next_prior.hpp>
using namespace std;

View File

@ -42,6 +42,7 @@
#include "support/debug.h"
#include "support/textutils.h"
#include <boost/assert.hpp>
#include <boost/crc.hpp>
#include <ostream>
@ -473,10 +474,9 @@ void RowPainter::paintFirst()
y_top += paintAppendixStart(yo_ - row_.ascent() + 2 * defaultRowHeight());
Buffer const & buffer = pi_.base.bv->buffer();
Layout const & layout = par_.layout();
if (buffer.params().paragraph_separation == BufferParams::PARSEP_SKIP) {
if (buffer.params().paragraph_separation == BufferParams::ParagraphSkipSeparation) {
if (pit_ != 0) {
if (layout.latextype == LATEX_PARAGRAPH
&& !par_.getDepth()) {