]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetspecialchar.C
insetcharstyle drawing cosmetics
[lyx.git] / src / insets / insetspecialchar.C
index 76e4023ef8fffcd3838e666f8436e608ff7f0786..c9ea76abe57ac075718fedc1e171cd0802afc1be 100644 (file)
@@ -7,7 +7,7 @@
  * \author Jean-Marc Lasgouttes
  * \author Lars Gullik Bjønnes
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 #include "insetspecialchar.h"
 
 #include "debug.h"
-#include "dimension.h"
 #include "LaTeXFeatures.h"
-#include "BufferView.h"
-#include "frontends/Painter.h"
-#include "frontends/font_metrics.h"
+#include "LColor.h"
 #include "lyxlex.h"
-#include "lyxfont.h"
 #include "metricsinfo.h"
 
+#include "frontends/font_metrics.h"
+#include "frontends/Painter.h"
+
+
+using std::string;
+using std::auto_ptr;
 using std::ostream;
-using std::max;
 
 
 InsetSpecialChar::InsetSpecialChar(Kind k)
@@ -56,6 +57,7 @@ void InsetSpecialChar::metrics(MetricsInfo & mi, Dimension & dim) const
        dim.wid = font_metrics::width(s, font);
        if (kind_ == HYPHENATION && dim.wid > 5)
                dim.wid -= 2; // to make it look shorter
+       dim_ = dim;
 }
 
 
@@ -109,7 +111,7 @@ void InsetSpecialChar::draw(PainterInfo & pi, int x, int y) const
 
 
 // In lyxf3 this will be just LaTeX
-void InsetSpecialChar::write(Buffer const *, ostream & os) const
+void InsetSpecialChar::write(Buffer const &, ostream & os) const
 {
        string command;
        switch (kind_) {
@@ -134,9 +136,9 @@ void InsetSpecialChar::write(Buffer const *, ostream & os) const
 
 
 // This function will not be necessary when lyx3
-void InsetSpecialChar::read(Buffer const *, LyXLex & lex)
+void InsetSpecialChar::read(Buffer const &, LyXLex & lex)
 {
-       lex.nextToken();
+       lex.next();
        string const command = lex.getString();
 
        if (command == "\\-")
@@ -154,8 +156,8 @@ void InsetSpecialChar::read(Buffer const *, LyXLex & lex)
 }
 
 
-int InsetSpecialChar::latex(Buffer const *, ostream & os,
-                           LatexRunParams const &) const
+int InsetSpecialChar::latex(Buffer const &, ostream & os,
+                           OutputParams const &) const
 {
        switch (kind_) {
        case HYPHENATION:
@@ -178,7 +180,8 @@ int InsetSpecialChar::latex(Buffer const *, ostream & os,
 }
 
 
-int InsetSpecialChar::ascii(Buffer const *, ostream & os, int) const
+int InsetSpecialChar::plaintext(Buffer const &, ostream & os,
+                           OutputParams const &) const
 {
        switch (kind_) {
        case HYPHENATION:
@@ -198,7 +201,8 @@ int InsetSpecialChar::ascii(Buffer const *, ostream & os, int) const
 }
 
 
-int InsetSpecialChar::linuxdoc(Buffer const *, ostream & os) const
+int InsetSpecialChar::linuxdoc(Buffer const &, ostream & os,
+                              OutputParams const &) const
 {
        switch (kind_) {
        case HYPHENATION:
@@ -218,7 +222,8 @@ int InsetSpecialChar::linuxdoc(Buffer const *, ostream & os) const
 }
 
 
-int InsetSpecialChar::docbook(Buffer const *, ostream & os, bool) const
+int InsetSpecialChar::docbook(Buffer const &, ostream & os,
+                             OutputParams const &) const
 {
        switch (kind_) {
        case HYPHENATION:
@@ -238,18 +243,12 @@ int InsetSpecialChar::docbook(Buffer const *, ostream & os, bool) const
 }
 
 
-Inset * InsetSpecialChar::clone(Buffer const &) const
+auto_ptr<InsetBase> InsetSpecialChar::clone() const
 {
-       return new InsetSpecialChar(kind_);
+       return auto_ptr<InsetBase>(new InsetSpecialChar(kind_));
 }
 
 
-// Inset * InsetSpecialChar::clone(Buffer const &, bool) const
-// {
-//     return new InsetSpecialChar(kind_);
-// }
-
-
 void InsetSpecialChar::validate(LaTeXFeatures & features) const
 {
        if (kind_ == MENU_SEPARATOR) {
@@ -270,12 +269,6 @@ bool InsetSpecialChar::isLetter() const
 }
 
 
-bool InsetSpecialChar::isSpace() const
-{
-       return false;
-}
-
-
 bool InsetSpecialChar::isLineSeparator() const
 {
 #if 0