*
* LyX, The Document Processor
*
- * Copyright (C) 1995 Matthias Ettrich
- * Copyright (C) 1995-1998 The LyX Team.
+ * Copyright 1995 Matthias Ettrich
+ * Copyright 1995-1999 The LyX Team.
*
- *======================================================*/
+ * ======================================================*/
#include <config.h>
#endif
#include "insetlatexaccent.h"
-#include "error.h"
+#include "debug.h"
#include "lyxrc.h"
#include "lyxdraw.h"
+#include "support/lstrings.h"
extern LyXRC * lyxrc;
-// $Id: insetlatexaccent.C,v 1.1 1999/09/27 18:44:39 larsbj Exp $
-
-#if !defined(lint) && !defined(WITH_WARNINGS)
-static char vcid[] = "$Id: insetlatexaccent.C,v 1.1 1999/09/27 18:44:39 larsbj Exp $";
-#endif /* lint */
-
/* LatexAccent. Proper handling of accented characters */
/* This part is done by Ivan Schreter, schreter@ccsun.tuke.sk */
/* Later modified by Lars G. Bjonnes, larsbj@ifi.uio.no */
{}
-InsetLatexAccent::InsetLatexAccent(LString const & string)
+InsetLatexAccent::InsetLatexAccent(string const & string)
: contents(string)
{
checkContents();
// REMOVE IN 0.13
// Dirty Hack for backward compability. remove in 0.13 (Lgb)
- contents.strip();
- contents.frontStrip();
- if (!contents.contains("{") && !contents.contains("}")) {
+ contents = frontStrip(strip(contents));
+ if (!contains(contents, "{") && !contains(contents, "}")) {
if (contents.length() == 2) {
- LString tmp;
+ string tmp;
tmp += contents[0];
tmp += contents[1];
tmp += "{}";
contents = tmp;
} else if (contents.length() == 3) {
- LString tmp;
+ string tmp;
tmp += contents[0];
tmp += contents[1];
tmp += '{';
tmp += '}';
contents = tmp;
} else if (contents.length()==4 && contents[2] == ' ') {
- LString tmp;
+ string tmp;
tmp += contents[0];
tmp += contents[1];
tmp += '{';
contents = tmp;
} else if (contents.length()==4 && contents[2] == '\\'
&& (contents[3]== 'i' || contents[3]== 'j')) {
- LString tmp;
+ string tmp;
tmp += contents[0];
tmp += contents[1];
tmp += '{';
}
if (contents[0] != '\\') return; // demand that first char is a '\\'
- lyxerr.debug("Decode: " + contents);
+ lyxerr.debug() << "Decode: " << contents << endl;
remdot = false; plusasc = false; plusdesc = false;
case LSLASH: ic = 'L'; break;
default:
// if this happens something is really wrong
- lyxerr.print("InsetLaTexAccent: weird error.");
+ lyxerr << "InsetLaTexAccent: weird error." << endl;
break;
}
//ic = (modtype == DOT_LESS_J ? 'j' : 'i');
- lyxerr.debug("Contents: [" + contents + "], ic: " + ic
- + ", top: " + long(plusasc)
- + ", bot: " + long(plusdesc)
- + ", dot: " + long(remdot)
- + ", mod: " + long(modtype));
+ lyxerr.debug() << "Contents: [" << contents << "]"
+ << ", ic: " << ic
+ << ", top: " << plusasc
+ << ", bot: " << plusdesc
+ << ", dot: " << remdot
+ << ", mod: " << modtype << endl;
// Special case for space
} else if (contents[3] == '}') {
ic = ' ';
return;
} else if ( (ic=='i'|| ic=='j') && contents[4]=='}') {
// Do a rewrite: \<foo>{i} --> \<foo>{\i}
- LString temp=contents;
- temp.substring(0,2);
+ string temp=contents;
+ temp.erase(3, string::npos);
temp+='\\';
temp+=char(ic);
- for(int j=4;j<contents.length();j++)
+ for(string::size_type j = 4; j < contents.length(); ++j)
temp+=contents[j];
contents=temp;
i++;
if (contents[++i] != '}' && contents[++i]) return;
// fine, the char is properly decoded now (hopefully)
- lyxerr.debug("Contents: [" + contents + "], ic: " + ic
- + ", top: " + long(plusasc)
- + ", bot: " + long(plusdesc)
- + ", dot: " + long(remdot)
- + ", mod: " + long(modtype));
+ lyxerr.debug() << "Contents: [" << contents << "]"
+ << ", ic: " << ic
+ << ", top: " << plusasc
+ << ", bot: " << plusdesc
+ << ", dot: " << remdot
+ << ", mod: " << modtype << endl;
}
candisp = true;
}
int tmpvar = baseline - font.ascent('i');
float tmpx = 0;
if (font.shape() == LyXFont::ITALIC_SHAPE) tmpx += (8*hg)/10; // italic
- lyxerr.debug("Removing dot.", Error::ANY);
+ lyxerr.debug() << "Removing dot." << endl;
// remove the dot first
scr.fillRectangle(gc_clear, int(x + tmpx),
tmpvar, wid,
}
-int InsetLatexAccent::Latex(LString &file, signed char /*fragile*/)
+int InsetLatexAccent::Latex(string &file, signed char /*fragile*/)
{
file += contents;
return 0;
}
-int InsetLatexAccent::Linuxdoc(LString &file)
+int InsetLatexAccent::Linuxdoc(string &file)
{
file += contents;
return 0;
}
-int InsetLatexAccent::DocBook(LString &file)
+int InsetLatexAccent::DocBook(string &file)
{
file += contents;
return 0;
}
return false;
}
+
+ostream & operator<<(ostream & o, InsetLatexAccent::ACCENT_TYPES at)
+{
+ return o << int(at);
+}