]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/ref_inset.C
Fix event loop to no longer eat CPU
[lyx.git] / src / mathed / ref_inset.C
index 775ba5d9ac1461a77c0c2bf5cf98d8888f71cf18..3d33e8152931e3d9491bc854272063eb9a3314c1 100644 (file)
@@ -18,6 +18,7 @@
 #include "cursor.h"
 #include "debug.h"
 #include "funcrequest.h"
+#include "FuncStatus.h"
 #include "gettext.h"
 #include "math_data.h"
 #include "math_factory.h"
@@ -70,6 +71,14 @@ void RefInset::doDispatch(LCursor & cur, FuncRequest & cmd)
                cur.undispatched();
                break;
 
+       case LFUN_INSET_DIALOG_UPDATE: {
+               string const data = createDialogStr("ref");
+               if (cur.bv().owner()->getDialogs().visible("ref"))
+                       cur.bv().owner()->getDialogs().update("ref", data);
+               break;
+       }
+
+       case LFUN_INSET_DIALOG_SHOW:
        case LFUN_MOUSE_RELEASE:
                if (cmd.button() == mouse_button::button3) {
                        lyxerr << "trying to goto ref '" << asString(cell(0)) << "'" << endl;
@@ -97,6 +106,25 @@ void RefInset::doDispatch(LCursor & cur, FuncRequest & cmd)
 }
 
 
+bool RefInset::getStatus(LCursor & cur, FuncRequest const & cmd,
+                         FuncStatus & status) const
+{
+       switch (cmd.action) {
+       // we handle these
+       case LFUN_INSET_MODIFY:
+       case LFUN_INSET_DIALOG_UPDATE:
+       case LFUN_INSET_DIALOG_SHOW:
+       case LFUN_MOUSE_RELEASE:
+       case LFUN_MOUSE_PRESS:
+       case LFUN_MOUSE_MOTION:
+               status.enabled(true);
+               return true;
+       default:
+               return CommandInset::getStatus(cur, cmd, status);
+       }
+}
+
+
 string const RefInset::screenLabel() const
 {
        string str;
@@ -156,8 +184,6 @@ int RefInset::docbook(Buffer const & buf, std::ostream & os, OutputParams const
 }
 
 
-
-
 RefInset::ref_type_info RefInset::types[] = {
        { "ref",       N_("Standard"),              N_("Ref: ")},
        { "eqref",     N_("Equation"),              N_("EqRef: ")},
@@ -167,3 +193,4 @@ RefInset::ref_type_info RefInset::types[] = {
        { "prettyref", N_("PrettyRef"),             N_("PrettyRef: ")},
        { "", "", "" }
 };
+