]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/ref_inset.C
architectural changes to tex2lyx
[lyx.git] / src / mathed / ref_inset.C
index b0f2c204e6957a093fc559db08d28b60bc6cda74..bb07534a3b888046719715719ef6cf7bd5745a01 100644 (file)
@@ -1,4 +1,3 @@
-
 #include <config.h>
 
 #include "ref_inset.h"
@@ -16,6 +15,9 @@
 
 #include "support/LOstream.h"
 
+using std::auto_ptr;
+using std::endl;
+
 
 RefInset::RefInset()
        : CommandInset("ref")
@@ -27,9 +29,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));
 }
 
 
@@ -45,7 +47,7 @@ RefInset::dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
        switch (cmd.action) {
                case LFUN_MOUSE_RELEASE:
                        if (cmd.button() == mouse_button::button3) {
-                               lyxerr << "trying to goto ref" << cell(0) << "\n";
+                               lyxerr << "trying to goto ref" << cell(0) << endl;
                                cmd.view()->dispatch(FuncRequest(LFUN_REF_GOTO, asString(cell(0))));
                                return DISPATCHED;
                        }
@@ -70,11 +72,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;
                }
@@ -90,9 +92,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");
 }
 
@@ -135,10 +137,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;
 }