]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetspecialchar.C
Some more changes for updating text-insets.
[lyx.git] / src / insets / insetspecialchar.C
index 8caa469bfebcb8ef3c215c006d2fd9843b1d9c83..172e0d4aaab69ea7f5fba03e541659502bb224de 100644 (file)
@@ -16,6 +16,7 @@
 #include "insetspecialchar.h"
 #include "debug.h"
 #include "LaTeXFeatures.h"
+#include "BufferView.h"
 #include "Painter.h"
 #include "font.h"
 
@@ -71,10 +72,12 @@ int InsetSpecialChar::width(Painter &, LyXFont const & font) const
 }
 
 
-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:
        {
@@ -141,7 +144,7 @@ void InsetSpecialChar::draw(Painter & pain, LyXFont const & f,
 
 
 // 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) {
@@ -150,14 +153,16 @@ void InsetSpecialChar::Write(ostream & os) const
        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();
@@ -170,14 +175,15 @@ void InsetSpecialChar::Read(LyXLex & lex)
                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) {
@@ -190,7 +196,7 @@ int InsetSpecialChar::Latex(ostream & os, bool /*fragile*/,
        return 0;
 }
 
-int InsetSpecialChar::Ascii(ostream & os) const
+int InsetSpecialChar::Ascii(Buffer const *, ostream & os) const
 {
        switch (kind) {
        case HYPHENATION:                       break;
@@ -203,15 +209,15 @@ int InsetSpecialChar::Ascii(ostream & os) const
 }
 
 
-int InsetSpecialChar::Linuxdoc(ostream & os) const
+int InsetSpecialChar::Linuxdoc(Buffer const * buf, ostream & os) const
 {
-       return Ascii(os);
+       return Ascii(buf, os);
 }
 
 
-int InsetSpecialChar::DocBook(ostream & os) const
+int InsetSpecialChar::DocBook(Buffer const * buf, ostream & os) const
 {
-       return Ascii(os);
+       return Ascii(buf, os);
 }