#include "tex-strings.h"
#include "bufferparams.h"
#include "support/FileInfo.h"
-#include "error.h"
+#include "debug.h"
#include "LaTeXFeatures.h"
#include "insets/insetinclude.h"
#include "support/filetools.h"
bibkey = 0; // ale970302
// ale970302
-// fprintf(stderr, "new bib "); fflush(stderr);
+// lyxerr << "new bib " << endl;
// if (par->bibkey) {
// bibkey = new InsetBibKey(par->bibkey);
// }
if (c != '\0')
fprintf(file, "%c", c);
else
- lyxerr.print("ERROR (LyXParagraph::writeFile):"
- " NULL char in structure.");
+ lyxerr << "ERROR (LyXParagraph::writeFile):"
+ " NULL char in structure." << endl;
column++;
break;
}
FontTable *tmpfonttable = fonttable;
while (tmpfonttable) {
if (tmpfonttable->font.noun() == LyXFont::ON) {
- lyxerr.debug(string("font.noun: ")
- + tostr(tmpfonttable->font.noun()),
- Error::LATEX);
+ lyxerr[Debug::LATEX] << "font.noun: "
+ << tmpfonttable->font.noun()
+ << endl;
features.noun = true;
- lyxerr.debug("Noun enabled. Font: "
- +tmpfonttable->font.stateText(),
- Error::LATEX);
+ lyxerr[Debug::LATEX] << "Noun enabled. Font: "
+ << tmpfonttable->font.stateText()
+ << endl;
}
switch (tmpfonttable->font.color()) {
case LyXFont::NONE:
break;
default:
features.color = true;
- lyxerr.debug("Color enabled. Font: "
- +tmpfonttable->font.stateText(),
- Error::LATEX);
+ lyxerr[Debug::LATEX] << "Color enabled. Font: "
+ << tmpfonttable->font.stateText()
+ << endl;
}
tmpfonttable = tmpfonttable->next;
}
noindent = false;
pextra_type = PEXTRA_NONE;
- pextra_width.erase();
- pextra_widthp.erase();
+ pextra_width.clear();
+ pextra_widthp.clear();
pextra_alignment = MINIPAGE_ALIGN_TOP;
pextra_hfill = false;
pextra_start_minipage = false;
- labelstring.erase();
- labelwidthstring.erase();
+ labelstring.clear();
+ labelwidthstring.clear();
layout = 0;
bibkey = 0;
if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
NextAfterFootnote()->Erase(pos - last - 1);
else
- lyxerr.debug("ERROR (LyXParagraph::Erase): position does not exist.");
+ lyxerr.debug() << "ERROR (LyXParagraph::Erase): "
+ "position does not exist." << endl;
return;
}
if (pos < last) { // last is free for insertation, but should be empty
}
} else {
- lyxerr.print("ERROR (LyXParagraph::Erase): can't erase non-existant char.");
+ lyxerr << "ERROR (LyXParagraph::Erase): "
+ "can't erase non-existant char." << endl;
}
}
if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
NextAfterFootnote()->Enlarge(pos - last - 1, number);
else
- lyxerr.print("ERROR (LyXParagraph::Enlarge): position does not exist.");
+ lyxerr << "ERROR (LyXParagraph::Enlarge): "
+ "position does not exist." << endl;
return;
}
if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
NextAfterFootnote()->InsertChar(pos - last - 1, c);
else
- lyxerr.debug("ERROR (LyXParagraph::InsertChar): "
- "position does not exist.");
+ lyxerr.debug() << "ERROR (LyXParagraph::InsertChar): "
+ "position does not exist." << endl;
return;
}
if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
NextAfterFootnote()->InsertInset(pos - last - 1, inset);
else
- lyxerr.print("ERROR (LyXParagraph::InsertInset): "
- "position does not exist: " + tostr(pos));
+ lyxerr << "ERROR (LyXParagraph::InsertInset): "
+ "position does not exist: " << pos << endl;
return;
}
if (text[pos]!=LYX_META_INSET) {
- lyxerr.print("ERROR (LyXParagraph::InsertInset): "
- "there is no LYX_META_INSET");
+ lyxerr << "ERROR (LyXParagraph::InsertInset): "
+ "there is no LYX_META_INSET" << endl;
return;
}
if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
return NextAfterFootnote()->GetInset(pos - last - 1);
else {
- lyxerr.print(string("ERROR (LyXParagraph::GetInset): position does not exist: ") + tostr(pos));
+ lyxerr << "ERROR (LyXParagraph::GetInset): position does not exist: "
+ << pos << endl;
}
return 0;
}
if (tmpi)
return tmpi->inset;
else {
- lyxerr.print(string("ERROR (LyXParagraph::GetInset): "
- "Inset does not exist: ") + tostr(pos));
+ lyxerr << "ERROR (LyXParagraph::GetInset): "
+ "Inset does not exist: " << pos << endl;
text[pos] = ' '; /// WHY!!! does this set the pos to ' '????
// Did this commenting out introduce a bug? So far I have not
// seen any, please enlighten me. (Lgb)
// enough for this to be anable on debug?
// We want strict error checking, but it's ok to only
// have it when debugging. (Asger)
- lyxerr.print(
- string("ERROR (LyXParagraph::GetFontSettings): "
- "position does not exist. ") + tostr(pos));
+ lyxerr << "ERROR (LyXParagraph::GetFontSettings): "
+ "position does not exist. " << pos << endl;
}
} else if (pos) {
return GetFontSettings(pos - 1);
if (pos < 0) {
// This function is important. It should not work around bugs.
// Let's find the bugs instead and fix them. (Asger)
- lyxerr.print(string("FATAL ERROR (LyXParagraph::GetChar):"
- " bad position ") + tostr(pos));
+ lyxerr << "FATAL ERROR (LyXParagraph::GetChar):"
+ " bad position " << pos << endl;
abort();
}
#endif
if (next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE)
return NextAfterFootnote()->GetChar(pos - last - 1);
else
- lyxerr.print("ERROR (LyXParagraph::GetChar): "
- "position does not exist.");
+ lyxerr << "ERROR (LyXParagraph::GetChar): "
+ "position does not exist." << endl;
return '\0';
} else { // pos==last
/* we should have a footnote environment */
if (!next || next->footnoteflag == LyXParagraph::NO_FOOTNOTE) {
// Notice that LyX does request the last char from time to time. (Asger)
-// lyxerr.print("ERROR (LyXParagraph::GetChar): "
-// "expected footnote.");
+// lyxerr << "ERROR (LyXParagraph::GetChar): "
+// "expected footnote." << endl;
return '\0';
}
switch (next->footnotekind) {
// return LYX_META_TAB;
// if (next->footnotekind == LyXParagraph::ALGORITHM)
// return LYX_META_ALGORITHM;
-// lyxerr.print("ERROR (LyXParagraph::GetChar): "
-// "unknown footnote kind.");
+// lyxerr << "ERROR (LyXParagraph::GetChar): "
+// "unknown footnote kind." << endl;
// return 'F'; /* this should not happen! */
// This _can_ not happen, due to the type of next->footnotekind
// being LyXParagraph::footnot_kind
if (lastpos < 0) {
// This function is important. It should not work around bugs.
// Let's find the bugs instead and fix them. (Asger)
- lyxerr.print(string("FATAL ERROR (LyXParagraph::GetWord):"
- " bad position ") + tostr(lastpos));
+ lyxerr << "FATAL ERROR (LyXParagraph::GetWord):"
+ " bad position " << lastpos << endl;
abort();
}
#endif
if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
return NextAfterFootnote()->ParFromPos(pos - last - 1);
else
- lyxerr.print("ERROR (LyXParagraph::ParFromPos): "
- "position does not exist.");
+ lyxerr << "ERROR (LyXParagraph::ParFromPos): "
+ "position does not exist." << endl;
return this;
}
else
if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
return NextAfterFootnote()->PositionInParFromPos(pos - last - 1);
else
- lyxerr.print(
+ lyxerr <<
"ERROR (LyXParagraph::PositionInParFromPos): "
- "position does not exist.");
+ "position does not exist." << endl;
return pos;
}
else
if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) {
NextAfterFootnote()->SetFont(pos - last - 1, font);
} else {
- lyxerr.print("ERROR (LyXParagraph::SetFont): "
- "position does not exist.");
+ lyxerr << "ERROR (LyXParagraph::SetFont): "
+ "position does not exist." << endl;
}
return;
}
*npar = 0;
par->layout = new_layout;
- par->labelwidthstring.erase();
+ par->labelwidthstring.clear();
par->align = LYX_ALIGN_LAYOUT;
//par->depth = 0;
par->added_space_top = VSpace(VSpace::NONE);
if (!newpar) {
if (Previous() || GetDepth())
- lyxerr.print("ERROR (LyXParagraph::DepthHook): "
- "no hook.");
+ lyxerr << "ERROR (LyXParagraph::DepthHook): "
+ "no hook." << endl;
newpar = this;
}
return newpar->FirstPhysicalPar();
Erase(tmpi2->pos);
} else {}
else
- lyxerr.print(
- "ERROR (LyXParagraph::AutoDeleteInsets): "
- "cannot auto-delete insets");
+ lyxerr << "ERROR (LyXParagraph::AutoDeleteInsets): "
+ "cannot auto-delete insets" << endl;
}
return i;
}
string &foot, TexRow &foot_texrow,
int &foot_count)
{
- lyxerr.debug(string("TeXOnePar... ") + tostr(this), Error::LATEX);
+ lyxerr[Debug::LATEX] << "TeXOnePar... " << this << endl;
LyXParagraph *par = next;
LyXLayout * style = lyxstyle.Style(GetCurrentTextClass(), layout);
bool further_blank_line = false;
if (IsDummy())
- lyxerr.print("ERROR (LyXParagraph::TeXOnePar) is dummy.");
+ lyxerr << "ERROR (LyXParagraph::TeXOnePar) is dummy." << endl;
if (start_of_appendix) {
file += "\\appendix\n";
texrow.newline();
}
- lyxerr.debug(string("TeXOnePar...done ") + tostr(par), Error::LATEX);
+ lyxerr[Debug::LATEX] << "TeXOnePar...done " << par << endl;
return par;
}
// This one spits out the text of the paragraph
bool LyXParagraph::SimpleTeXOnePar(string &file, TexRow &texrow)
{
- lyxerr.debug(string("SimpleTeXOnePar... ") + tostr(this),
- Error::LATEX);
+ lyxerr[Debug::LATEX] << "SimpleTeXOnePar... " << this << endl;
if (table)
return SimpleTeXOneTablePar(file, texrow);
return_value = false;
}
- lyxerr.debug(string("SimpleTeXOnePar...done ") + tostr(this),
- Error::LATEX);
+ lyxerr[Debug::LATEX] << "SimpleTeXOnePar...done " << this << endl;
return return_value;
}
// This one spits out the text of a table paragraph
bool LyXParagraph::SimpleTeXOneTablePar(string &file, TexRow &texrow)
{
- lyxerr.debug(string("SimpleTeXOneTablePar... ")+
- tostr(this), Error::LATEX);
+ lyxerr[Debug::LATEX] << "SimpleTeXOneTablePar... " << this << endl;
char c;
int column, tmp;
tmp = table->TexEndOfCell(file, current_cell_number);
for (;tmp>0;tmp--)
texrow.newline();
- lyxerr.debug(string("SimpleTeXOneTablePar...done ")+ tostr(this), Error::LATEX);
+ lyxerr[Debug::LATEX] << "SimpleTeXOneTablePar...done " << this << endl;
return return_value;
}
int current_cell_number,
int &column, TexRow &texrow)
{
- lyxerr.debug(string("TeXContTableRows... ") +
- tostr(this), Error::LATEX);
+ lyxerr[Debug::LATEX] << "TeXContTableRows... " << this << endl;
if (!table)
return false;
running_font = basefont;
cell = table->CellHasContRow(current_cell_number);
}
- lyxerr.debug(string("TeXContTableRows...done ")+ tostr(this), Error::LATEX);
+ lyxerr[Debug::LATEX] << "TeXContTableRows...done " << this << endl;
return return_value;
}
bool retval = false;
switch (c) {
case LYX_META_HFILL:
- sgml_string.erase();
+ sgml_string.clear();
break;
case LYX_META_PROTECTED_SEPARATOR:
sgml_string = ' ';
sgml_string = ' ';
break;
case '\0': /* Ignore :-) */
- sgml_string.erase();
+ sgml_string.clear();
break;
default:
sgml_string = c;
{
if (!table)
return;
- lyxerr.debug(string("SimpleDocbookOneTablePar... ") +
- tostr(this), Error::LATEX);
+ lyxerr[Debug::LATEX] << "SimpleDocbookOneTablePar... " << this << endl;
int column, tmp;
//bool return_value = false; // unused
int current_cell_number = -1;
if (footnoteflag == LyXParagraph::NO_FOOTNOTE)
file += "</INFORMALTABLE>";
file += '\n';
- lyxerr.debug(string("SimpleDocbookOneTablePar...done ") +
- tostr(this), Error::LATEX);
+ lyxerr[Debug::LATEX] << "SimpleDocbookOneTablePar...done "
+ << this << endl;
}
void LyXParagraph::DocBookContTableRows(string &file, string &extra,
if (!table)
return;
- lyxerr.debug(string("DocBookContTableRows... ") +
- tostr(this), Error::LATEX);
+ lyxerr[Debug::LATEX] << "DocBookContTableRows... " << this << endl;
+
int cell, lastpos; //tmp; //unused
LyXFont font1,font2;
char c;
font1 = font2 = getFont(-1);
cell = table->CellHasContRow(current_cell_number);
}
- lyxerr.debug(string("DocBookContTableRows...done ") +
- tostr(this), Error::LATEX);
+ lyxerr[Debug::LATEX] << "DocBookContTableRows...done " << this << endl;
}
if (c != '\0')
fprintf(fp, "%c", c);
else
- lyxerr.debug("RoffAsciiTable: NULL char in structure.");
+ lyxerr.debug() << "RoffAsciiTable: NULL char in structure." << endl;
break;
}
}
string &foot, TexRow &foot_texrow,
int &foot_count)
{
- lyxerr.debug(string("TeXDeeper... ") + tostr(this), Error::LATEX);
+ lyxerr[Debug::LATEX] << "TeXDeeper... " << this << endl;
LyXParagraph *par = this;
while (par && par->depth == depth) {
if (par->IsDummy())
- lyxerr.print("ERROR (LyXParagraph::TeXDeeper)");
+ lyxerr << "ERROR (LyXParagraph::TeXDeeper)" << endl;
if (lyxstyle.Style(GetCurrentTextClass(),
par->layout)->isEnvironment()
|| par->pextra_type != PEXTRA_NONE)
foot_count);
}
}
- lyxerr.debug(string("TeXDeeper...done ") + tostr(par), Error::LATEX);
+ lyxerr[Debug::LATEX] << "TeXDeeper...done " << par << endl;
return par;
}
char
par_sep = current_view->currentBuffer()->params.paragraph_separation;
- lyxerr.debug(string("TeXEnvironment... ") + tostr(this), Error::LATEX);
+ lyxerr[Debug::LATEX] << "TeXEnvironment... " << this << endl;
if (IsDummy())
- lyxerr.print("ERROR (LyXParagraph::TeXEnvironment)");
+ lyxerr << "ERROR (LyXParagraph::TeXEnvironment)" << endl;
LyXLayout * style = lyxstyle.Style(GetCurrentTextClass(), layout);
if (foot_count >= 1) {
if (foot_count > 1) {
file += "\\addtocounter{footnote}{-";
- file += foot_count - 1;
+ file += tostr(foot_count - 1);
file += '}';
}
file += foot;
texrow += foot_texrow;
- foot.erase();
+ foot.clear();
foot_texrow.reset();
foot_count = 0;
}
file += '\n';
texrow.newline();
}
- lyxerr.debug(string("TeXEnvironment...done ")
- + tostr(par), Error::LATEX);
+ lyxerr[Debug::LATEX] << "TeXEnvironment...done " << par << endl;
return par; // ale970302
}
string &foot, TexRow &foot_texrow,
int &foot_count)
{
- lyxerr.debug(string("TeXFootnote... ")
- + tostr(this), Error::LATEX);
+ lyxerr[Debug::LATEX] << "TeXFootnote... " << this << endl;
if (footnoteflag == LyXParagraph::NO_FOOTNOTE)
- lyxerr.print("ERROR (LyXParagraph::TeXFootnote): "
- "No footnote!");
+ lyxerr << "ERROR (LyXParagraph::TeXFootnote): "
+ "No footnote!" << endl;
LyXParagraph *par = this;
LyXLayout * style = lyxstyle.Style(GetCurrentTextClass(),
previous->GetLayout());
if (style->needprotect && footnotekind != LyXParagraph::FOOTNOTE){
- lyxerr.print("ERROR (LyXParagraph::TeXFootnote): "
- "Float other than footnote in command"
- " with moving argument is illegal");
+ lyxerr << "ERROR (LyXParagraph::TeXFootnote): "
+ "Float other than footnote in command"
+ " with moving argument is illegal" << endl;
}
if (footnotekind != LyXParagraph::FOOTNOTE
LyXLayout *style = lyxstyle.Style(GetCurrentTextClass(),
par->layout);
if (par->IsDummy())
- lyxerr.print("ERROR (LyXParagraph::TeXFootnote)");
+ lyxerr << "ERROR (LyXParagraph::TeXFootnote)"
+ << endl;
if (style->isEnvironment()
|| par->pextra_type == PEXTRA_MINIPAGE) { /* && !minipage_open ?? */
// Allows the use of minipages within float environments.
LyXLayout *style = lyxstyle.Style(GetCurrentTextClass(),
par->layout);
if (par->IsDummy())
- lyxerr.print("ERROR (LyXParagraph::TeXFootnote)");
+ lyxerr << "ERROR (LyXParagraph::TeXFootnote)"
+ << endl;
if (style->isEnvironment()
|| par->pextra_type == PEXTRA_MINIPAGE) { /* && !minipage_open ?? */
// Allows the use of minipages within float environments.
}
} while (par && par->footnoteflag != LyXParagraph::NO_FOOTNOTE);
if (dummy_count) {
- lyxerr.print("ERROR (LyXParagraph::TeXFootnote): "
- "Footnote in a Footnote -- not supported");
+ lyxerr << "ERROR (LyXParagraph::TeXFootnote): "
+ "Footnote in a Footnote -- not supported"
+ << endl;
}
}
texrow.newline();
}
- lyxerr.debug(string("TeXFootnote...done ") +
- tostr(par->next), Error::LATEX);
+ lyxerr[Debug::LATEX] << "TeXFootnote...done " << par->next << endl;
return par;
}
return;
pextra_type = PEXTRA_NONE;
- pextra_width.erase();
- pextra_widthp.erase();
+ pextra_width.clear();
+ pextra_widthp.clear();
if (lyxstyle.Style(GetCurrentTextClass(),
layout)->isEnvironment()) {
par = ppar;
while (par && (par->layout == layout) && (par->depth == depth)) {
par->pextra_type = PEXTRA_NONE;
- par->pextra_width.erase();
- par->pextra_widthp.erase();
+ par->pextra_width.clear();
+ par->pextra_widthp.clear();
par = par->NextAfterFootnote();
if (par && (par->depth > depth))
par->UnsetPExtraType();