]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/command_inset.C
some (yet unfinished) up/down work
[lyx.git] / src / mathed / command_inset.C
index 811f2d17c17d2d89d110c6a5e53f094011def766..3e4c7f4055c802baea836ed0de1c8cfce77bdb04 100644 (file)
 #include "command_inset.h"
 #include "math_data.h"
 #include "math_mathmlstream.h"
+#include "dispatchresult.h"
 #include "funcrequest.h"
-#include "support/std_sstream.h"
 
+#include <sstream>
 
 using std::string;
 using std::auto_ptr;
@@ -23,15 +24,13 @@ using std::ostringstream;
 
 
 CommandInset::CommandInset(string const & name)
-       : MathNestInset(2),
-         name_(name),
-         set_label_(false)
+       : MathNestInset(2), name_(name), set_label_(false)
 {
        lock_ = true;
 }
 
 
-auto_ptr<InsetBase> CommandInset::clone() const
+auto_ptr<InsetBase> CommandInset::doClone() const
 {
        return auto_ptr<InsetBase>(new CommandInset(*this));
 }
@@ -44,22 +43,14 @@ void CommandInset::metrics(MetricsInfo & mi, Dimension & dim) const
                button_.update(screenLabel(), true);
        }
        button_.metrics(mi, dim);
+       dim_ = dim;
 }
 
 
 void CommandInset::draw(PainterInfo & pi, int x, int y) const
 {
        button_.draw(pi, x, y);
-}
-
-dispatch_result
-CommandInset::dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
-{
-       switch (cmd.action) {
-               default:
-                       return MathNestInset::priv_dispatch(cmd, idx, pos);
-       }
-       return UNDISPATCHED;
+       setPosCache(pi, x, y);
 }
 
 
@@ -74,16 +65,16 @@ void CommandInset::write(WriteStream & os) const
 
 string const CommandInset::screenLabel() const
 {
-       return name_;
+       return name_;
 }
 
 
 string const CommandInset::createDialogStr(string const & name) const
 {
-       ostringstream data;
-       data << name << " LatexCommand ";
-       WriteStream wsdata(data);
-       write(wsdata);
-       wsdata << "\n\\end_inset\n\n";
-       return data.str();
+       ostringstream os;
+       os << name << " LatexCommand ";
+       WriteStream ws(os);
+       write(ws);
+       ws << "\n\\end_inset\n\n";
+       return os.str();
 }