]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetref.C
Hold on to your hats.
[lyx.git] / src / insets / insetref.C
index a0bbc2857c2c097278e5bbf97a9e9c2c6fb9cbf7..7f0e3f1b8f1b765b245dbccf425c3ae03193bc58 100644 (file)
@@ -1,8 +1,14 @@
+/**
+ * \file insetref.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author José Matos
+ *
+ * Full author contact details are available in file CREDITS
+ */
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
 
 #include "insetref.h"
 #include "buffer.h"
@@ -12,7 +18,6 @@
 #include "LaTeXFeatures.h"
 #include "frontends/LyXView.h"
 #include "frontends/Dialogs.h"
-#include "lyxfunc.h"
 #include "BufferView.h"
 #include "support/lstrings.h"
 
@@ -23,14 +28,22 @@ InsetRef::InsetRef(InsetCommandParams const & p, Buffer const & buf, bool)
 {}
 
 
+InsetRef::~InsetRef()
+{
+       InsetCommandMailer mailer("ref", *this);
+       mailer.hideDialog();
+}
+
+
 void InsetRef::edit(BufferView * bv, int, int, mouse_button::state button)
 {
        // FuncRequestually trigger dialog with button 3 not 1
        if (button == mouse_button::button3)
-               bv->owner()->getLyXFunc()->
-                       dispatch(FuncRequest(LFUN_REF_GOTO, getContents()));
-       else if (button == mouse_button::button1)
-               bv->owner()->getDialogs()->showRef(this);
+               bv->owner()->dispatch(FuncRequest(LFUN_REF_GOTO, getContents()));
+       else if (button == mouse_button::button1) {
+               InsetCommandMailer mailer("ref", *this);
+               mailer.showDialog();
+       }
 }
 
 
@@ -72,7 +85,7 @@ int InsetRef::latex(Buffer const *, ostream & os,
 
 int InsetRef::ascii(Buffer const *, ostream & os, int) const
 {
-       os << "[" << getContents() << "]";
+       os << '[' << getContents() << ']';
        return 0;
 }