]> git.lyx.org Git - lyx.git/blobdiff - src/insets/inseturl.C
Rename LatexRunParams::fragile as moving_arg.
[lyx.git] / src / insets / inseturl.C
index 37c8c41b51db889bc42fe2822f12329909861001..cff4ab9a80d5727c2ee35d7603d4d6d4e4e446c9 100644 (file)
@@ -7,15 +7,14 @@
  *
  * Full author contact details are available in file CREDITS
  */
-#include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
+#include <config.h>
 
 #include "inseturl.h"
+#include "funcrequest.h"
 #include "BufferView.h"
 #include "LaTeXFeatures.h"
+#include "latexrunparams.h"
 #include "frontends/LyXView.h"
 #include "debug.h"
 #include "frontends/Dialogs.h"
@@ -30,15 +29,21 @@ InsetUrl::InsetUrl(InsetCommandParams const & p, bool)
 {}
 
 
-void InsetUrl::edit(BufferView * bv, int, int, mouse_button::state)
+InsetUrl::~InsetUrl()
 {
-       bv->owner()->getDialogs().showUrl(this);
+       InsetCommandMailer("url", *this).hideDialog();
 }
 
 
-void InsetUrl::edit(BufferView * bv, bool)
+dispatch_result InsetUrl::localDispatch(FuncRequest const & cmd)
 {
-       edit(bv, 0, 0, mouse_button::none);
+       switch (cmd.action) {
+               case LFUN_INSET_EDIT:
+                       InsetCommandMailer("url", *this).showDialog(cmd.view());
+                       return DISPATCHED;
+               default:
+                       return InsetCommand::localDispatch(cmd);
+       }
 }
 
 
@@ -67,11 +72,11 @@ string const InsetUrl::getScreenLabel(Buffer const *) const
 
 
 int InsetUrl::latex(Buffer const *, ostream & os,
-                   bool fragile, bool /*free_spc*/) const
+                   LatexRunParams const & runparams) const
 {
        if (!getOptions().empty())
                os << getOptions() + ' ';
-       if (fragile)
+       if (runparams.moving_arg)
                os << "\\protect";
        os << "\\url{" << getContents() << '}';
        return 0;