]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetRef.cpp
* src/paragraph_funcs.cpp (breakParagraph): change parameter 'flag' to
[lyx.git] / src / insets / InsetRef.cpp
index 92db373c227af048b8e49e2f46192d7104124100..49606c425bf1abbf69746ef66a395719b3ace74e 100644 (file)
 
 #include "InsetRef.h"
 
-#include "buffer.h"
-#include "cursor.h"
-#include "dispatchresult.h"
-#include "funcrequest.h"
+#include "Buffer.h"
+#include "Cursor.h"
+#include "DispatchResult.h"
+#include "FuncRequest.h"
 #include "gettext.h"
 #include "LaTeXFeatures.h"
-#include "lyxfunc.h"
-#include "outputparams.h"
+#include "LyXFunc.h"
+#include "OutputParams.h"
 #include "sgml.h"
 
 #include "support/lstrings.h"
@@ -42,24 +42,20 @@ InsetRef::InsetRef(InsetRef const & ir)
 {}
 
 
-void InsetRef::doDispatch(LCursor & cur, FuncRequest & cmd)
+void InsetRef::doDispatch(Cursor & cur, FuncRequest & cmd)
 {
        switch (cmd.action) {
-       case LFUN_MOUSE_PRESS:
+       case LFUN_MOUSE_RELEASE:
                // Eventually trigger dialog with button 3 not 1
                if (cmd.button() == mouse_button::button3)
-                       lyx::dispatch(FuncRequest(LFUN_LABEL_GOTO, getParam("reference")));
-               else {
-                       InsetCommandMailer("ref", *this).showDialog(&cur.bv());
-                       cur.undispatched();
-               }
-               return;
-
-       case LFUN_MOUSE_RELEASE:
-               return;
+                       lyx::dispatch(FuncRequest(LFUN_LABEL_GOTO,
+                                                 getParam("reference")));
+               else
+                       InsetCommand::doDispatch(cur, cmd);
+               break;
 
        default:
-               return InsetCommand::doDispatch(cur, cmd);
+               InsetCommand::doDispatch(cur, cmd);
        }
 }
 
@@ -84,10 +80,11 @@ docstring const InsetRef::getScreenLabel(Buffer const &) const
 
 
 int InsetRef::latex(Buffer const &, odocstream & os,
-                    OutputParams const &) const
+                   OutputParams const &) const
 {
-       // Don't output p_["name"], this is only used in docbook
-       InsetCommandParams p(getCmdName());
+       // We don't want to output p_["name"], since that is only used 
+       // in docbook. So we construct new params, without it, and use that.
+       InsetCommandParams p("ref", getCmdName());
        p["reference"] = getParam("reference");
        os << escape(p.getCommand());
        return 0;
@@ -95,7 +92,7 @@ int InsetRef::latex(Buffer const &, odocstream & os,
 
 
 int InsetRef::plaintext(Buffer const &, odocstream & os,
-                        OutputParams const &) const
+                       OutputParams const &) const
 {
        docstring const str = getParam("reference");
        os << '[' << str << ']';
@@ -104,23 +101,23 @@ int InsetRef::plaintext(Buffer const &, odocstream & os,
 
 
 int InsetRef::docbook(Buffer const & buf, odocstream & os,
-                      OutputParams const & runparams) const
+                     OutputParams const & runparams) const
 {
        docstring const & name = getParam("name");
        if (name.empty()) {
                if (runparams.flavor == OutputParams::XML) {
-                       os << "<xref linkend=\"" 
-                          << sgml::cleanID(buf, runparams, getParam("reference")) 
+                       os << "<xref linkend=\""
+                          << sgml::cleanID(buf, runparams, getParam("reference"))
                           << "\" />";
                } else {
-                       os << "<xref linkend=\"" 
-                          << sgml::cleanID(buf, runparams, getParam("reference")) 
+                       os << "<xref linkend=\""
+                          << sgml::cleanID(buf, runparams, getParam("reference"))
                           << "\">";
                }
        } else {
-               os << "<link linkend=\"" 
+               os << "<link linkend=\""
                   << sgml::cleanID(buf, runparams, getParam("reference"))
-                  << "\">" 
+                  << "\">"
                   << getParam("name")
                   << "</link>";
        }