git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2429 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-08-06 19:13:25 +00:00
parent a0bf0835e5
commit 8075064372
21 changed files with 140 additions and 129 deletions

View File

@ -231,7 +231,6 @@ string const fixlabel(string const & str)
#endif
}
} // namespace anon
void add_toc2(int menu, string const & extra_label,
@ -318,6 +317,7 @@ void add_toc2(int menu, string const & extra_label,
}
}
} // namespace anon
void Menubar::Pimpl::add_toc(int menu, string const & extra_label,
vector<int> & smn, Window win)

View File

@ -392,7 +392,7 @@ void Toolbar::Pimpl::set(bool doingmain)
// Set the tooltip
#if FL_REVISION >= 89
string help = _(lyxaction.helpText(item->action));
string const help(_(lyxaction.helpText(item->action)));
fl_set_object_helper(obj, help.c_str());
#else
fl_set_object_posthandler(obj, C_Toolbar_BubblePost);

View File

@ -130,7 +130,7 @@ bool XformsColor::read(string const & filename)
if (!lexrc.setFile(filename))
return false;
while (lexrc.IsOK()) {
while (lexrc.isOK()) {
int const le = lexrc.lex();
switch (le) {
@ -145,13 +145,13 @@ bool XformsColor::read(string const & filename)
RGBColor col;
if (!lexrc.next()) break;
col.r = lexrc.GetInteger();
col.r = lexrc.getInteger();
if (!lexrc.next()) break;
col.g = lexrc.GetInteger();
col.g = lexrc.getInteger();
if (!lexrc.next()) break;
col.b = lexrc.GetInteger();
col.b = lexrc.getInteger();
fl_mapcolor(le, col.r, col.g, col.b);
}

View File

@ -163,11 +163,11 @@ void ExternalTemplateManager::readTemplates(string const & path)
return;
}
while (lex.IsOK()) {
while (lex.isOK()) {
switch (lex.lex()) {
case TM_TEMPLATE: {
lex.next();
string temp = lex.GetString();
string const temp = lex.getString();
ExternalTemplate & tmp = templates[temp];
tmp.lyxName = temp;
tmp.readTemplate(lex);
@ -208,11 +208,11 @@ void ExternalTemplate::readTemplate(LyXLex & lex)
pushpophelper pph(lex, templateoptiontags, TO_END);
while (lex.IsOK()) {
while (lex.isOK()) {
switch (lex.lex()) {
case TO_GUINAME:
lex.next(true);
guiName = lex.GetString();
guiName = lex.getString();
break;
case TO_HELPTEXT:
@ -221,12 +221,12 @@ void ExternalTemplate::readTemplate(LyXLex & lex)
case TO_FILTER:
lex.next(true);
fileRegExp = lex.GetString();
fileRegExp = lex.getString();
break;
case TO_VIEWCMD:
lex.next(true);
viewCommand = lex.GetString();
viewCommand = lex.getString();
// For security reasons, a command may not be empty!
if (viewCommand.empty())
viewCommand = "true";
@ -234,7 +234,7 @@ void ExternalTemplate::readTemplate(LyXLex & lex)
case TO_EDITCMD:
lex.next(true);
editCommand = lex.GetString();
editCommand = lex.getString();
// For security reasons, a command may not be empty!
if (editCommand.empty())
editCommand = "true";
@ -242,12 +242,12 @@ void ExternalTemplate::readTemplate(LyXLex & lex)
case TO_AUTOMATIC:
lex.next();
automaticProduction = lex.GetBool();
automaticProduction = lex.getBool();
break;
case TO_FORMAT:
lex.next(true);
formats[lex.GetString()].readFormat(lex);
formats[lex.getString()].readFormat(lex);
break;
case TO_END:
@ -283,16 +283,16 @@ void ExternalTemplate::FormatTemplate::readFormat(LyXLex & lex)
pushpophelper pph(lex, formattags, FO_END);
while (lex.IsOK()) {
while (lex.isOK()) {
switch (lex.lex()) {
case FO_PRODUCT:
lex.next(true);
product = lex.GetString();
product = lex.getString();
break;
case FO_UPDATECMD:
lex.next(true);
updateCommand = lex.GetString();
updateCommand = lex.getString();
// For security reasons, a command may not be empty!
if (updateCommand.empty())
updateCommand = "true";
@ -300,7 +300,7 @@ void ExternalTemplate::FormatTemplate::readFormat(LyXLex & lex)
case FO_REQUIREMENT:
lex.next(true);
requirement = lex.GetString();
requirement = lex.getString();
break;
case FO_PREAMBLE:

View File

@ -1074,10 +1074,10 @@ void InsetFig::read(Buffer const *, LyXLex & lex)
string buf;
bool finished = false;
while (lex.IsOK() && !finished) {
while (lex.isOK() && !finished) {
lex.next();
string const token = lex.GetString();
string const token = lex.getString();
lyxerr[Debug::INFO] << "Token: " << token << endl;
if (token.empty())
@ -1086,8 +1086,8 @@ void InsetFig::read(Buffer const *, LyXLex & lex)
finished = true;
} else if (token == "file") {
if (lex.next()) {
buf = lex.GetString();
string buf1 = OnlyPath(owner->fileName());
buf = lex.getString();
string const buf1(OnlyPath(owner->fileName()));
fname = MakeAbsPath(buf, buf1);
changedfname = true;
}
@ -1095,30 +1095,30 @@ void InsetFig::read(Buffer const *, LyXLex & lex)
if (lex.next());
// kept for backwards compability. Delete in 0.13.x
} else if (token == "subcaption") {
if (lex.EatLine())
subcaption = lex.GetString();
if (lex.eatLine())
subcaption = lex.getString();
} else if (token == "label") {
if (lex.next());
// kept for backwards compability. Delete in 0.13.x
} else if (token == "angle") {
if (lex.next())
angle = lex.GetFloat();
angle = lex.getFloat();
} else if (token == "size") {
if (lex.next())
wid = lex.GetInteger();
wid = lex.getInteger();
if (lex.next())
hgh = lex.GetInteger();
hgh = lex.getInteger();
} else if (token == "flags") {
if (lex.next())
flags = pflags = lex.GetInteger();
flags = pflags = lex.getInteger();
} else if (token == "subfigure") {
subfigure = psubfigure = true;
} else if (token == "width") {
int typ = 0;
if (lex.next())
typ = lex.GetInteger();
typ = lex.getInteger();
if (lex.next())
xwid = lex.GetFloat();
xwid = lex.getFloat();
switch (typ) {
case DEF: wtype = DEF; break;
case CM: wtype = CM; break;
@ -1133,9 +1133,9 @@ void InsetFig::read(Buffer const *, LyXLex & lex)
} else if (token == "height") {
int typ = 0;
if (lex.next())
typ = lex.GetInteger();
typ = lex.getInteger();
if (lex.next())
xhgh = lex.GetFloat();
xhgh = lex.getFloat();
switch (typ) {
case DEF: htype = DEF; break;
case CM: htype = CM; break;

View File

@ -148,10 +148,6 @@ public:
/// update the inset representation
virtual void update(BufferView *, LyXFont const &, bool = false)
{}
#if 0
///
virtual LyXFont const convertFont(LyXFont const & font) const;
#endif
/// what appears in the minibuffer when opening
virtual string const editMessage() const;
///

View File

@ -79,14 +79,13 @@ void InsetBibKey::write(Buffer const *, ostream & os) const
// This is necessary here because this is written without begin_inset
// This should be changed!!! (Jug)
void InsetBibKey::read(Buffer const *, LyXLex & lex)
{
string token;
if (lex.EatLine()) {
token = lex.GetString();
{
if (lex.eatLine()) {
string const token = lex.getString();
scanCommand(token);
} else
} else {
lex.printError("InsetCommand: Parse error: `$$Token'");
}
if (prefixIs(getContents(), key_prefix)) {
int key = strToInt(getContents().substr(key_prefix.length()));

View File

@ -87,12 +87,12 @@ void InsetCollapsable::write(Buffer const * buf, ostream & os) const
void InsetCollapsable::read(Buffer const * buf, LyXLex & lex)
{
if (lex.IsOK()) {
if (lex.isOK()) {
lex.next();
string const token = lex.GetString();
string const token = lex.getString();
if (token == "collapsed") {
lex.next();
collapsed_ = lex.GetBool();
collapsed_ = lex.getBool();
} else {
lyxerr << "InsetCollapsable::Read: Missing collapsed!"
<< endl;

View File

@ -144,14 +144,16 @@ void InsetCommandParams::read(LyXLex & lex)
{
string token;
if (lex.EatLine()) {
token = lex.GetString();
if (lex.eatLine()) {
token = lex.getString();
scanCommand(token);
} else
} else {
lex.printError("InsetCommand: Parse error: `$$Token'");
while (lex.IsOK()) {
}
while (lex.isOK()) {
lex.nextToken();
token = lex.GetString();
token = lex.getString();
if (token == "\\end_inset")
break;
}

View File

@ -91,32 +91,37 @@ InsetERT::~InsetERT()
void InsetERT::read(Buffer const * buf, LyXLex & lex)
{
bool token_found = false;
if (lex.IsOK()) {
if (lex.isOK()) {
lex.next();
string const token = lex.GetString();
string const token = lex.getString();
if (token == "status") {
lex.next();
string st;
if (lex.GetString() == "Inlined")
string const tmp_token = lex.getString();
if (tmp_token == "Inlined") {
status_ = Inlined;
else if (lex.GetString() == "Collapsed")
} else if (tmp_token == "Collapsed") {
status_ = Collapsed;
else // leave this as default!
} else {
// leave this as default!
status_ = Open;
}
token_found = true;
} else {
lyxerr << "InsetERT::Read: Missing 'status'-tag!"
<< endl;
<< std::endl;
// take countermeasures
lex.pushToken(token);
}
}
InsetCollapsable::read(buf, lex);
if (!token_found) {
if (collapsed_)
if (collapsed_) {
status_ = Collapsed;
else
} else {
status_ = Open;
}
}
setButtonLabel();
}

View File

@ -97,13 +97,15 @@ void InsetExternal::read(Buffer const *, LyXLex & lex)
string token;
// Read inset data from lex and store in format
if (lex.EatLine()) {
format = lex.GetString();
} else
if (lex.eatLine()) {
format = lex.getString();
} else {
lex.printError("InsetExternal: Parse error: `$$Token'");
while (lex.IsOK()) {
}
while (lex.isOK()) {
lex.nextToken();
token = lex.GetString();
token = lex.getString();
if (token == "\\end_inset")
break;
}

View File

@ -150,12 +150,12 @@ void InsetFloat::write(Buffer const * buf, ostream & os) const
void InsetFloat::read(Buffer const * buf, LyXLex & lex)
{
if (lex.IsOK()) {
if (lex.isOK()) {
lex.next();
string token = lex.GetString();
string token = lex.getString();
if (token == "placement") {
lex.next();
floatPlacement_ = lex.GetString();
floatPlacement_ = lex.getString();
} else {
lyxerr << "InsetFloat::Read: Missing placement!"
<< endl;
@ -163,10 +163,10 @@ void InsetFloat::read(Buffer const * buf, LyXLex & lex)
lex.pushToken(token);
}
lex.next();
token = lex.GetString();
token = lex.getString();
if (token == "wide") {
lex.next();
string const tmptoken = lex.GetString();
string const tmptoken = lex.getString();
if (tmptoken == "true")
wide(true);
else

View File

@ -39,14 +39,14 @@ void InsetFloatList::read(Buffer const *, LyXLex & lex)
{
string token;
if (lex.EatLine()) {
float_type = lex.GetString();
if (lex.eatLine()) {
float_type = lex.getString();
lyxerr << "FloatList::float_type: " << float_type << endl;
} else
lex.printError("InsetFloatList: Parse error: `$$Token'");
while (lex.IsOK()) {
while (lex.isOK()) {
lex.nextToken();
token = lex.GetString();
token = lex.getString();
if (token == "\\end_inset")
break;
}

View File

@ -354,7 +354,7 @@ void InsetGraphics::write(Buffer const * buf, ostream & os) const
void InsetGraphics::read(Buffer const * buf, LyXLex & lex)
{
string const token = lex.GetString();
string const token = lex.getString();
if (token == "Graphics")
readInsetGraphics(buf, lex);
@ -370,10 +370,10 @@ void InsetGraphics::readInsetGraphics(Buffer const * buf, LyXLex & lex)
{
bool finished = false;
while (lex.IsOK() && !finished) {
while (lex.isOK() && !finished) {
lex.next();
string const token = lex.GetString();
string const token = lex.getString();
lyxerr[Debug::INFO] << "Token: '" << token << '\''
<< std::endl;
@ -383,7 +383,7 @@ void InsetGraphics::readInsetGraphics(Buffer const * buf, LyXLex & lex)
finished = true;
} else if (token == "FormatVersion") {
lex.next();
int version = lex.GetInteger();
int version = lex.getInteger();
if (version > 1)
lyxerr
<< "This document was created with a newer Graphics widget"
@ -405,10 +405,10 @@ void InsetGraphics::readFigInset(Buffer const * buf, LyXLex & lex)
{
bool finished = false;
while (lex.IsOK() && !finished) {
while (lex.isOK() && !finished) {
lex.next();
string const token = lex.GetString();
string const token = lex.getString();
lyxerr[Debug::INFO] << "Token: " << token << endl;
if (token.empty())
@ -417,7 +417,7 @@ void InsetGraphics::readFigInset(Buffer const * buf, LyXLex & lex)
finished = true;
} else if (token == "file") {
if (lex.next()) {
string const name = lex.GetString();
string const name = lex.getString();
string const path = OnlyPath(buf->fileName());
params.filename = MakeAbsPath(name, path);
}
@ -425,25 +425,27 @@ void InsetGraphics::readFigInset(Buffer const * buf, LyXLex & lex)
if (lex.next());
// kept for backwards compability. Delete in 0.13.x
} else if (token == "subcaption") {
if (lex.EatLine())
params.subcaptionText = lex.GetString();
if (lex.eatLine())
params.subcaptionText = lex.getString();
} else if (token == "label") {
if (lex.next());
// kept for backwards compability. Delete in 0.13.x
} else if (token == "angle") {
if (lex.next())
params.rotateAngle = lex.GetFloat();
params.rotateAngle = lex.getFloat();
} else if (token == "size") {
// Size of image on screen is ignored in InsetGraphics, just eat
// the input.
if (lex.next())
lex.GetInteger();
if (lex.next())
lex.GetInteger();
if (lex.next()) {
lex.getInteger();
}
if (lex.next()) {
lex.getInteger();
}
} else if (token == "flags") {
InsetGraphicsParams::DisplayType tmp = InsetGraphicsParams::COLOR;
if (lex.next())
switch (lex.GetInteger()) {
switch (lex.getInteger()) {
case 1: tmp = InsetGraphicsParams::MONOCHROME; break;
case 2: tmp = InsetGraphicsParams::GRAYSCALE; break;
}
@ -451,15 +453,19 @@ void InsetGraphics::readFigInset(Buffer const * buf, LyXLex & lex)
} else if (token == "subfigure") {
params.subcaption = true;
} else if (token == "width") {
if (lex.next())
params.widthResize = static_cast<InsetGraphicsParams::Resize>(lex.GetInteger());
if (lex.next())
params.widthSize = lex.GetFloat();
if (lex.next()) {
params.widthResize = static_cast<InsetGraphicsParams::Resize>(lex.getInteger());
}
if (lex.next()) {
params.widthSize = lex.getFloat();
}
} else if (token == "height") {
if (lex.next())
params.heightResize = static_cast<InsetGraphicsParams::Resize>(lex.GetInteger());
if (lex.next())
params.heightSize = lex.GetFloat();
if (lex.next()) {
params.heightResize = static_cast<InsetGraphicsParams::Resize>(lex.getInteger());
}
if (lex.next()) {
params.heightSize = lex.getFloat();
}
}
}
}

View File

@ -286,7 +286,7 @@ bool InsetGraphicsParams::Read(Buffer const * buf, LyXLex & lex,
{
if (token == "filename") {
lex.next();
filename = lex.GetString();
filename = lex.getString();
if (!filename.empty()) {
// Make the filename with absolute directory.
@ -294,38 +294,38 @@ bool InsetGraphicsParams::Read(Buffer const * buf, LyXLex & lex,
}
} else if (token == "display") {
lex.next();
string const type = lex.GetString();
string const type = lex.getString();
display = displayTranslator.find(type);
} else if (token == "subcaption") {
subcaption = true;
} else if (token == "subcaptionText") {
lex.next();
subcaptionText = lex.GetString();
subcaptionText = lex.getString();
} else if (token == "widthResize") {
lex.next();
string const token = lex.GetString();
string const token = lex.getString();
readResize(this, false, token);
} else if (token == "width") {
lex.next();
widthSize = lex.GetFloat();
widthSize = lex.getFloat();
} else if (token == "heightResize") {
lex.next();
string const token = lex.GetString();
string const token = lex.getString();
readResize(this, true, token);
} else if (token == "height") {
lex.next();
heightSize = lex.GetFloat();
heightSize = lex.getFloat();
} else if (token == "rotateOrigin") {
lex.next();
string const token = lex.GetString();
string const token = lex.getString();
readOrigin(this, token);
} else if (token == "rotateAngle") {
lex.next();
rotateAngle = lex.GetFloat();
rotateAngle = lex.getFloat();
} else {
// If it's none of the above, its not ours.
return false;

View File

@ -621,8 +621,8 @@ void InsetLatexAccent::write(Buffer const *, ostream & os) const
void InsetLatexAccent::read(Buffer const *, LyXLex & lex)
{
lex.EatLine();
contents = lex.GetString();
lex.eatLine();
contents = lex.getString();
checkContents();
}

View File

@ -115,12 +115,12 @@ void InsetMinipage::write(Buffer const * buf, ostream & os) const
void InsetMinipage::read(Buffer const * buf, LyXLex & lex)
{
if (lex.IsOK()) {
if (lex.isOK()) {
lex.next();
string const token = lex.GetString();
string const token = lex.getString();
if (token == "position") {
lex.next();
pos_ = static_cast<Position>(lex.GetInteger());
pos_ = static_cast<Position>(lex.getInteger());
} else {
lyxerr << "InsetMinipage::Read: Missing 'position'-tag!"
<< endl;
@ -128,12 +128,12 @@ void InsetMinipage::read(Buffer const * buf, LyXLex & lex)
lex.pushToken(token);
}
}
if (lex.IsOK()) {
if (lex.isOK()) {
lex.next();
string const token = lex.GetString();
string const token = lex.getString();
if (token == "inner_position") {
lex.next();
inner_pos_ = static_cast<InnerPosition>(lex.GetInteger());
inner_pos_ = static_cast<InnerPosition>(lex.getInteger());
} else {
lyxerr << "InsetMinipage::Read: Missing 'inner_position'-tag!"
<< endl;
@ -141,12 +141,12 @@ void InsetMinipage::read(Buffer const * buf, LyXLex & lex)
lex.pushToken(token);
}
}
if (lex.IsOK()) {
if (lex.isOK()) {
lex.next();
string const token = lex.GetString();
string const token = lex.getString();
if (token == "height") {
lex.next();
height_ = lex.GetString();
height_ = lex.getString();
} else {
lyxerr << "InsetMinipage::Read: Missing 'height'-tag!"
<< endl;
@ -154,12 +154,12 @@ void InsetMinipage::read(Buffer const * buf, LyXLex & lex)
lex.pushToken(token);
}
}
if (lex.IsOK()) {
if (lex.isOK()) {
lex.next();
string const token = lex.GetString();
string const token = lex.getString();
if (token == "width") {
lex.next();
width_ = lex.GetString();
width_ = lex.getString();
} else {
lyxerr << "InsetMinipage::Read: Missing 'width'-tag!"
<< endl;

View File

@ -243,10 +243,11 @@ void InsetQuotes::write(Buffer const *, ostream & os) const
void InsetQuotes::read(Buffer const *, LyXLex & lex)
{
lex.nextToken();
parseString(lex.GetString());
parseString(lex.getString());
lex.next();
if (lex.GetString() != "\\end_inset")
if (lex.getString() != "\\end_inset") {
lex.printError("Missing \\end_inset at this point");
}
}

View File

@ -193,7 +193,7 @@ void InsetSpecialChar::write(Buffer const *, ostream & os) const
void InsetSpecialChar::read(Buffer const *, LyXLex & lex)
{
lex.nextToken();
string const command = lex.GetString();
string const command = lex.getString();
if (command == "\\-")
kind_ = HYPHENATION;

View File

@ -178,7 +178,7 @@ void InsetTabular::write(Buffer const * buf, ostream & os) const
void InsetTabular::read(Buffer const * buf, LyXLex & lex)
{
bool const old_format = (lex.GetString() == "\\LyXTable");
bool const old_format = (lex.getString() == "\\LyXTable");
//if (tabular)
//delete tabular;
@ -191,10 +191,10 @@ void InsetTabular::read(Buffer const * buf, LyXLex & lex)
return;
lex.nextToken();
string token = lex.GetString();
while (lex.IsOK() && (token != "\\end_inset")) {
string token = lex.getString();
while (lex.isOK() && (token != "\\end_inset")) {
lex.nextToken();
token = lex.GetString();
token = lex.getString();
}
if (token != "\\end_inset") {
lex.printError("Missing \\end_inset at this point. "

View File

@ -234,9 +234,9 @@ void InsetText::read(Buffer const * buf, LyXLex & lex)
clear();
while (lex.IsOK()) {
while (lex.isOK()) {
lex.nextToken();
token = lex.GetString();
token = lex.getString();
if (token.empty())
continue;
if (token == "\\end_inset") {