]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfunc.C
remove noload/don't typeset
[lyx.git] / src / lyxfunc.C
index 0b05ccc93fc2ae8c9db2d60786609d66d240e5e0..968c5225ca367f67fc52da49527592df5139230c 100644 (file)
 #include "undo_funcs.h"
 #include "ParagraphParameters.h"
 
-#include "insets/inseturl.h"
-#include "insets/insetlatexaccent.h"
-#include "insets/insettoc.h"
-#include "insets/insetref.h"
-#include "insets/insetparent.h"
-#include "insets/insetindex.h"
-#include "insets/insetinclude.h"
-#include "insets/insetbib.h"
-#include "insets/insetcite.h"
-#include "insets/insettext.h"
-#include "insets/insetert.h"
-#include "insets/insetexternal.h"
-#include "insets/insetgraphics.h"
-#include "insets/insetfoot.h"
-#include "insets/insetmarginal.h"
-#include "insets/insetminipage.h"
-#include "insets/insetfloat.h"
-#if 0
-#include "insets/insetlist.h"
-#include "insets/insettheorem.h"
-#endif
+#include "insets/insetcommand.h"
 #include "insets/insettabular.h"
-#include "insets/insetcaption.h"
 
 #include "mathed/formulamacro.h"
 #include "mathed/math_cursor.h"
@@ -183,6 +162,7 @@ void LyXFunc::processKeySym(LyXKeySymPtr keysym,
                       << keysym->getSymbolName()
                       << endl;
        }
        // Do nothing if we have nothing (JMarc)
        if (!keysym->isOK()) {
                lyxerr[Debug::KEY] << "Empty kbd action (probably composing)"
@@ -199,9 +179,7 @@ void LyXFunc::processKeySym(LyXKeySymPtr keysym,
        cancel_meta_seq.reset();
 
        int action = cancel_meta_seq.addkey(keysym, state);
-       if (lyxerr.debugging(Debug::KEY)) {
-               lyxerr << "action first set to [" << action << "]" << endl;
-       }
+       lyxerr[Debug::KEY] << "action first set to [" << action << "]" << endl;
 
        // When not cancel or meta-fake, do the normal lookup.
        // Note how the meta_fake Mod1 bit is OR-ed in and reset afterwards.
@@ -332,6 +310,10 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
        case LFUN_REDO:
                disable = buf->redostack.empty();
                break;
+       case LFUN_CUT:
+       case LFUN_COPY:
+               disable = !mathcursor && !view()->getLyXText()->selection.set();
+               break;
 #ifndef HAVE_LIBAIKSAURUS
        case LFUN_THESAURUS_ENTRY:
                disable = true;
@@ -361,8 +343,52 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
                break;
        }
 
+       case LFUN_INSET_OPTARG:
+               disable = (TEXT(false)->cursor.par()->layout()->optionalargs == 0);
+               break;
+
        case LFUN_TABULAR_FEATURE:
-               disable = true;
+               if (mathcursor) {
+#if 0
+                       // FIXME: check temporarily disabled
+                       // valign code
+                       char align = mathcursor->valign();
+                       if (align == '\0') {
+                               disable = true;
+                               break;
+                       }
+                       if (ev.argument.empty()) {
+                               flag.clear();
+                               break;
+                       }
+                       if (!contains("tcb", ev.argument[0])) {
+                               disable = true;
+                               break;
+                       }
+                       flag.setOnOff(ev.argument[0] == align);
+               } else
+                       disable = true;
+
+                       char align = mathcursor->halign();
+                       if (align == '\0') {
+                               disable = true;
+                               break;
+                       }
+                       if (ev.argument.empty()) {
+                               flag.clear();
+                               break;
+                       }
+                       if (!contains("lcr", ev.argument[0])) {
+                               disable = true;
+                               break;
+                       }
+                       flag.setOnOff(ev.argument[0] == align);
+#endif
+
+                       disable = !mathcursor->halign();
+                       break;
+               }
+
                if (tli) {
                        FuncStatus ret;
                        //ret.disabled(true);
@@ -416,45 +442,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
        case LFUN_LATEX_LOG:
                disable = !IsFileReadable(buf->getLogName().second);
                break;
-       case LFUN_MATH_VALIGN:
-               if (mathcursor) {
-                       char align = mathcursor->valign();
-                       if (align == '\0') {
-                               disable = true;
-                               break;
-                       }
-                       if (ev.argument.empty()) {
-                               flag.clear();
-                               break;
-                       }
-                       if (!contains("tcb", ev.argument[0])) {
-                               disable = true;
-                               break;
-                       }
-                       flag.setOnOff(ev.argument[0] == align);
-               } else
-                       disable = true;
-               break;
-
-       case LFUN_MATH_HALIGN:
-               if (mathcursor) {
-                       char align = mathcursor->halign();
-                       if (align == '\0') {
-                               disable = true;
-                               break;
-                       }
-                       if (ev.argument.empty()) {
-                               flag.clear();
-                               break;
-                       }
-                       if (!contains("lcr", ev.argument[0])) {
-                               disable = true;
-                               break;
-                       }
-                       flag.setOnOff(ev.argument[0] == align);
-               } else
-                       disable = true;
-               break;
 
        case LFUN_MATH_MUTATE:
                if (mathcursor)
@@ -474,15 +461,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
                disable = !mathcursor;
                break;
 
-       // we need to be math mode and a math array for that
-       // Hack: halign produces non-zero result iff we are in a math array
-       case LFUN_MATH_ROW_INSERT:
-       case LFUN_MATH_ROW_DELETE:
-       case LFUN_MATH_COLUMN_INSERT:
-       case LFUN_MATH_COLUMN_DELETE:
-               disable = !mathcursor || !mathcursor->halign();
-               break;
-
        default:
                break;
        }
@@ -535,6 +513,9 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
        case LFUN_INSERT_LABEL:
                code = Inset::LABEL_CODE;
                break;
+       case LFUN_INSET_OPTARG:
+               code = Inset::OPTARG_CODE;
+               break;
        case LFUN_REF_INSERT:
                code = Inset::REF_CODE;
                break;
@@ -585,9 +566,8 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
        default:
                break;
        }
-       if (code != Inset::NO_CODE && tli && !tli->insetAllowed(code)) {
+       if (code != Inset::NO_CODE && tli && !tli->insetAllowed(code))
                disable = true;
-       }
 
        if (disable)
                flag.disabled(true);
@@ -736,7 +716,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
        }
 
        if (view()->available() && view()->theLockingInset()) {
-               UpdatableInset::RESULT result;
+               Inset::RESULT result;
                if ((action > 1) || ((action == LFUN_UNKNOWN_ACTION) &&
                                     (!keyseq.deleted())))
                {
@@ -1377,19 +1357,19 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
                lyxrc.cursor_follows_scrollbar = !lyxrc.cursor_follows_scrollbar;
                break;
 
-       case LFUN_KMAP_OFF:             // keymap off
+       case LFUN_KMAP_OFF:
                owner->getIntl().KeyMapOn(false);
                break;
 
-       case LFUN_KMAP_PRIM:    // primary keymap
+       case LFUN_KMAP_PRIM:
                owner->getIntl().KeyMapPrim();
                break;
 
-       case LFUN_KMAP_SEC:             // secondary keymap
+       case LFUN_KMAP_SEC:
                owner->getIntl().KeyMapSec();
                break;
 
-       case LFUN_KMAP_TOGGLE:  // toggle keymap
+       case LFUN_KMAP_TOGGLE:
                owner->getIntl().ToggleKeyMap();
                break;