]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insettoc.C
prevent crash when inserting minipage in table cell,
[lyx.git] / src / insets / insettoc.C
index 0c64eb5013d091bd6a9e1241c35edec5648f1ac4..876c9b0e75a41397c942c1c95fb4fdd5358ca041 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "gettext.h"
 #include "insettoc.h"
+#include "funcrequest.h"
 #include "BufferView.h"
 #include "frontends/LyXView.h"
 #include "frontends/Dialogs.h"
@@ -22,8 +23,8 @@ using std::vector;
 using std::ostream;
 
 
-InsetTOC::InsetTOC(InsetCommandParams const & p, bool same_id)
-       : InsetCommand(p, same_id)
+InsetTOC::InsetTOC(InsetCommandParams const & p)
+       : InsetCommand(p)
 {}
 
 
@@ -44,25 +45,24 @@ string const InsetTOC::getScreenLabel(Buffer const *) const
 }
 
 
-Inset::Code InsetTOC::lyxCode() const
+InsetOld::Code InsetTOC::lyxCode() const
 {
        string const cmdname(getCmdName());
        if (cmdname == "tableofcontents")
-               return Inset::TOC_CODE;
-       return Inset::NO_CODE;
+               return InsetOld::TOC_CODE;
+       return InsetOld::NO_CODE;
 }
 
 
-void InsetTOC::edit(BufferView *, int, int, mouse_button::state)
+dispatch_result InsetTOC::localDispatch(FuncRequest const & cmd)
 {
-       InsetCommandMailer mailer("toc", *this);
-       mailer.showDialog();
-}
-
-
-void InsetTOC::edit(BufferView * bv, bool)
-{
-       edit(bv, 0, 0, mouse_button::none);
+       switch (cmd.action) {
+       case LFUN_INSET_EDIT:
+               InsetCommandMailer("toc", *this).showDialog(cmd.view());
+               return DISPATCHED;
+       default:
+               return InsetCommand::localDispatch(cmd);
+       }
 }
 
 
@@ -70,7 +70,7 @@ int InsetTOC::ascii(Buffer const * buffer, ostream & os, int) const
 {
        os << getScreenLabel(buffer) << "\n\n";
 
-       toc::asciiTocList(toc::getType(getCmdName()), buffer, os);
+       lyx::toc::asciiTocList(lyx::toc::getType(getCmdName()), buffer, os);
 
        os << "\n";
        return 0;