]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetspecialchar.C
Enable convertDefault.sh to run even if its executable bit is not set.
[lyx.git] / src / insets / insetspecialchar.C
index 8a67a6214110647ee00be3e469618a0f2bd50927..018ac6763e3de80193be15bd41a227769b13759b 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>
@@ -26,6 +26,7 @@
 
 using std::ostream;
 using std::max;
+using std::auto_ptr;
 
 
 InsetSpecialChar::InsetSpecialChar(Kind k)
@@ -39,9 +40,9 @@ InsetSpecialChar::Kind InsetSpecialChar::kind() const
 }
 
 
-void InsetSpecialChar::dimension(BufferView *, LyXFont const & font,
-       Dimension & dim) const
+void InsetSpecialChar::metrics(MetricsInfo & mi, Dimension & dim) const
 {
+       LyXFont & font = mi.base.font;
        dim.asc = font_metrics::maxAscent(font);
        dim.des = font_metrics::maxDescent(font);
 
@@ -56,6 +57,7 @@ void InsetSpecialChar::dimension(BufferView *, LyXFont const & font,
        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,7 +136,7 @@ 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();
        string const command = lex.getString();
@@ -154,7 +156,7 @@ void InsetSpecialChar::read(Buffer const *, LyXLex & lex)
 }
 
 
-int InsetSpecialChar::latex(Buffer const *, ostream & os,
+int InsetSpecialChar::latex(Buffer const &, ostream & os,
                            LatexRunParams const &) const
 {
        switch (kind_) {
@@ -178,7 +180,7 @@ int InsetSpecialChar::latex(Buffer const *, ostream & os,
 }
 
 
-int InsetSpecialChar::ascii(Buffer const *, ostream & os, int) const
+int InsetSpecialChar::ascii(Buffer const &, ostream & os, int) const
 {
        switch (kind_) {
        case HYPHENATION:
@@ -198,7 +200,7 @@ int InsetSpecialChar::ascii(Buffer const *, ostream & os, int) const
 }
 
 
-int InsetSpecialChar::linuxdoc(Buffer const *, ostream & os) const
+int InsetSpecialChar::linuxdoc(Buffer const &, ostream & os) const
 {
        switch (kind_) {
        case HYPHENATION:
@@ -218,7 +220,7 @@ int InsetSpecialChar::linuxdoc(Buffer const *, ostream & os) const
 }
 
 
-int InsetSpecialChar::docbook(Buffer const *, ostream & os, bool) const
+int InsetSpecialChar::docbook(Buffer const &, ostream & os, bool) const
 {
        switch (kind_) {
        case HYPHENATION:
@@ -238,18 +240,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) {