#include "insetspecialchar.h"
#include "debug.h"
#include "LaTeXFeatures.h"
+#include "BufferView.h"
#include "Painter.h"
#include "font.h"
{}
-int InsetSpecialChar::ascent(Painter &, LyXFont const & font) const
+int InsetSpecialChar::ascent(BufferView *, LyXFont const & font) const
{
return lyxfont::maxAscent(font);
}
-int InsetSpecialChar::descent(Painter &, LyXFont const & font) const
+int InsetSpecialChar::descent(BufferView *, LyXFont const & font) const
{
return lyxfont::maxDescent(font);
}
-int InsetSpecialChar::width(Painter &, LyXFont const & font) const
+int InsetSpecialChar::width(BufferView *, LyXFont const & font) const
{
switch (kind) {
case HYPHENATION:
}
-void InsetSpecialChar::draw(Painter & pain, LyXFont const & f,
- int baseline, float & x) const
+void InsetSpecialChar::draw(BufferView * bv, LyXFont const & f,
+ int baseline, float & x, bool) const
{
+ Painter & pain = bv->painter();
LyXFont font(f);
+
switch (kind) {
case HYPHENATION:
{
font.setColor(LColor::special);
pain.text(int(x), baseline, "-", font);
- x += width(pain, font);
+ x += width(bv, font);
break;
}
case END_OF_SENTENCE:
{
font.setColor(LColor::special);
pain.text(int(x), baseline, ".", font);
- x += width(pain, font);
+ x += width(bv, font);
break;
}
case LDOTS:
{
font.setColor(LColor::special);
pain.text(int(x), baseline, ". . .", font);
- x += width(pain, font);
+ x += width(bv, font);
break;
}
case MENU_SEPARATOR:
xp[3] = ox; yp[3] = baseline;
pain.lines(xp, yp, 4, LColor::special);
- x += width(pain, font);
+ x += width(bv, font);
break;
}
case PROTECTED_SEPARATOR:
{
- float w = width(pain, font);
+ float w = width(bv, font);
int h = lyxfont::ascent('x', font);
int xp[4], yp[4];
// In lyxf3 this will be just LaTeX
-void InsetSpecialChar::Write(ostream & os) const
+void InsetSpecialChar::Write(Buffer const *, ostream & os) const
{
string command;
switch (kind) {
case LDOTS: command = "\\ldots{}"; break;
case MENU_SEPARATOR: command = "\\menuseparator"; break;
case PROTECTED_SEPARATOR:
- command = "\\protected_separator"; break;
+ //command = "\\protected_separator";
+ command = "~";
+ break;
}
os << "\\SpecialChar " << command << "\n";
}
// This function will not be necessary when lyx3
-void InsetSpecialChar::Read(LyXLex & lex)
+void InsetSpecialChar::Read(Buffer const *, LyXLex & lex)
{
lex.nextToken();
string command = lex.GetString();
kind = LDOTS;
else if (command == "\\menuseparator")
kind = MENU_SEPARATOR;
- else if (command == "\\protected_separator")
+ else if (command == "\\protected_separator"
+ || command == "~")
kind = PROTECTED_SEPARATOR;
else
lex.printError("InsetSpecialChar: Unknown kind: `$$Token'");
}
-int InsetSpecialChar::Latex(ostream & os, bool /*fragile*/,
+int InsetSpecialChar::Latex(Buffer const *, ostream & os, bool /*fragile*/,
bool free_space) const
{
switch (kind) {
return 0;
}
-int InsetSpecialChar::Ascii(ostream & os) const
+int InsetSpecialChar::Ascii(Buffer const *, ostream & os, int) const
{
switch (kind) {
case HYPHENATION: break;
}
-int InsetSpecialChar::Linuxdoc(ostream & os) const
+int InsetSpecialChar::Linuxdoc(Buffer const * buf, ostream & os) const
{
- return Ascii(os);
+ return Ascii(buf, os, 0);
}
-int InsetSpecialChar::DocBook(ostream & os) const
+int InsetSpecialChar::DocBook(Buffer const * buf, ostream & os) const
{
- return Ascii(os);
+ return Ascii(buf, os, 0);
}
-Inset * InsetSpecialChar::Clone() const
+Inset * InsetSpecialChar::Clone(Buffer const &) const
{
return new InsetSpecialChar(kind);
}