]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/ref_inset.C
Always use std::endl with lyxerr.
[lyx.git] / src / mathed / ref_inset.C
index 33e8000d91b659cf8bfa0b03b11fa5c62e8868b9..58638c3afcddc501a60a235ac5ba15371bf08d3c 100644 (file)
@@ -1,4 +1,3 @@
-
 #include <config.h>
 
 #include "ref_inset.h"
@@ -7,6 +6,7 @@
 #include "BufferView.h"
 #include "debug.h"
 #include "funcrequest.h"
+#include "math_support.h"
 #include "gettext.h"
 #include "LaTeXFeatures.h"
 
@@ -15,6 +15,8 @@
 
 #include "support/LOstream.h"
 
+using std::auto_ptr;
+
 
 RefInset::RefInset()
        : CommandInset("ref")
@@ -26,9 +28,9 @@ RefInset::RefInset(string const & data)
 {}
 
 
-MathInset * RefInset::clone() const
+auto_ptr<InsetBase> RefInset::clone() const
 {
-       return new RefInset(*this);
+       return auto_ptr<InsetBase>(new RefInset(*this));
 }
 
 
@@ -69,11 +71,11 @@ RefInset::dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
 }
 
 
-string RefInset::screenLabel() const
+string const RefInset::screenLabel() const
 {
        string str;
        for (int i = 0; !types[i].latex_name.empty(); ++i)
-               if (name_ == types[i].latex_name) {
+               if (commandname() == types[i].latex_name) {
                        str = _(types[i].short_gui_name);
                        break;
                }
@@ -89,9 +91,9 @@ string RefInset::screenLabel() const
 
 void RefInset::validate(LaTeXFeatures & features) const
 {
-       if (name_ == "vref" || name_ == "vpageref")
+       if (commandname() == "vref" || commandname() == "vpageref")
                features.require("varioref");
-       else if (name_ == "prettyref")
+       else if (commandname() == "prettyref")
                features.require("prettyref");
 }
 
@@ -134,10 +136,10 @@ dispatch_result RefInset::localDispatch(FuncRequest const & cmd)
                return UNDISPATCHED;
 
        *this = *ar[0].nucleus()->asRefInset();
-//     if (cmd.view())
+//     if (cmd.view())
 //                 // This does not compile because updateInset expects
 //                 // an Inset* and 'this' isn't.
-//             cmd.view()->updateInset(this);
+//             cmd.view()->updateInset(this);
        return DISPATCHED;
 }