]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetbibitem.C
The markDirty() and fitCursor() changes
[lyx.git] / src / insets / insetbibitem.C
index 2e569cd0485ef8573eede8d8de08f8ec95b52d8d..7fb54eec613fcb485124c5952919ed4c8e923d5d 100644 (file)
 #include "insetbibitem.h"
 #include "buffer.h"
 #include "BufferView.h"
+#include "funcrequest.h"
 #include "lyxlex.h"
 
 #include "frontends/font_metrics.h"
-#include "frontends/LyXView.h"
-#include "frontends/Dialogs.h"
 
 #include "support/lstrings.h"
 
@@ -35,6 +34,13 @@ InsetBibitem::InsetBibitem(InsetCommandParams const & p)
 }
 
 
+InsetBibitem::~InsetBibitem()
+{
+       InsetCommandMailer mailer("bibitem", *this);
+       mailer.hideDialog();
+}
+
+
 Inset * InsetBibitem::clone(Buffer const &, bool) const
 {
        InsetBibitem * b = new InsetBibitem(params());
@@ -43,6 +49,35 @@ Inset * InsetBibitem::clone(Buffer const &, bool) const
 }
 
 
+dispatch_result InsetBibitem::localDispatch(FuncRequest const & cmd)
+{
+       Inset::RESULT result = UNDISPATCHED;
+
+       switch (cmd.action) {
+       case LFUN_INSET_MODIFY: {
+               InsetCommandParams p;
+               InsetCommandMailer::string2params(cmd.argument, p);
+               if (p.getCmdName().empty())
+                       break;
+
+               if (view() && p.getContents() != params().getContents()) {
+                       view()->ChangeCitationsIfUnique(params().getContents(),
+                                                       p.getContents());
+               }
+
+               setParams(p);
+               cmd.view()->updateInset(this);
+               result = DISPATCHED;
+       }
+       break;
+       default:
+               result = InsetCommand::localDispatch(cmd);
+       }
+
+       return result;
+}
+
+
 void InsetBibitem::setCounter(int c)
 {
        counter = c;
@@ -93,7 +128,8 @@ string const InsetBibitem::getScreenLabel(Buffer const *) const
 
 void InsetBibitem::edit(BufferView * bv, int, int, mouse_button::state)
 {
-       bv->owner()->getDialogs().showBibitem(this);
+       InsetCommandMailer mailer("bibitem", *this);
+       mailer.showDialog(bv);
 }