]> git.lyx.org Git - lyx.git/blobdiff - src/LyXFunc.cpp
This is the first of a series of commits that will make InsetLayout a real class.
[lyx.git] / src / LyXFunc.cpp
index 4bd6d49f1a2dde9c916dd86dce5bbc11930bd23f..e136e363df7cf9eccb45b0333e5ec63c2a7d1a50 100644 (file)
@@ -18,7 +18,6 @@
  */
 
 #include <config.h>
-#include <vector>
 
 #include "LyXFunc.h"
 
 #include "Converter.h"
 #include "Cursor.h"
 #include "CutAndPaste.h"
-#include "support/debug.h"
 #include "DispatchResult.h"
 #include "Encoding.h"
 #include "ErrorList.h"
 #include "Format.h"
 #include "FuncRequest.h"
 #include "FuncStatus.h"
-#include "support/gettext.h"
 #include "InsetIterator.h"
 #include "Intl.h"
 #include "KeyMap.h"
@@ -58,7 +55,6 @@
 #include "Server.h"
 #include "Session.h"
 #include "TextClassList.h"
-#include "ToolbarBackend.h"
 
 #include "insets/InsetBox.h"
 #include "insets/InsetBranch.h"
 #include "frontends/LyXView.h"
 #include "frontends/Selection.h"
 
+#include "support/debug.h"
 #include "support/environment.h"
 #include "support/FileName.h"
 #include "support/filetools.h"
+#include "support/gettext.h"
 #include "support/lstrings.h"
 #include "support/Path.h"
 #include "support/Package.h"
@@ -91,6 +89,7 @@
 #include "support/os.h"
 
 #include <sstream>
+#include <vector>
 
 using namespace std;
 using namespace lyx::support;
@@ -101,9 +100,6 @@ using frontend::LyXView;
 
 namespace Alert = frontend::Alert;
 
-extern bool quitting;
-extern bool use_gui;
-
 namespace {
 
 
@@ -370,9 +366,17 @@ void LyXFunc::processKeySym(KeySymbol const & keysym, KeyModifier state)
                        dispatch(FuncRequest(LFUN_SELF_INSERT, arg,
                                             FuncRequest::KEYBOARD));
                        LYXERR(Debug::KEY, "SelfInsert arg[`" << to_utf8(arg) << "']");
+                       lyx_view_->updateCompletion(true, true);
                }
        } else {
                dispatch(func);
+               if (func.action == LFUN_CHAR_DELETE_BACKWARD)
+                       // backspace is not a self-insertion. But it
+                       // still should not hide the completion popup.
+                       // FIXME: more clever way to detect those movements
+                       lyx_view_->updateCompletion(false, true);
+               else
+                       lyx_view_->updateCompletion(false, false);
        }
 
        lyx_view_->restartCursor();
@@ -453,10 +457,19 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                break;
 
        case LFUN_TOOLBAR_TOGGLE:
-       case LFUN_UI_TOGGLE:
        case LFUN_INSET_APPLY:
        case LFUN_BUFFER_WRITE:
        case LFUN_BUFFER_WRITE_AS:
+       case LFUN_SPLIT_VIEW:
+       case LFUN_CLOSE_TAB_GROUP:
+               if (lyx_view_)
+                       return lyx_view_->getStatus(cmd);
+               enable = false;
+               break;
+
+       case LFUN_COMPLETION_POPUP:
+       case LFUN_COMPLETION_INLINE:
+       case LFUN_COMPLETION_COMPLETE:
                if (lyx_view_)
                        return lyx_view_->getStatus(cmd);
                enable = false;
@@ -602,6 +615,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
        case LFUN_DIALOG_HIDE:
        case LFUN_DIALOG_DISCONNECT_INSET:
        case LFUN_BUFFER_CHILD_OPEN:
+       case LFUN_UI_TOGGLE:
        case LFUN_TOGGLE_CURSOR_FOLLOWS_SCROLLBAR:
        case LFUN_KEYMAP_OFF:
        case LFUN_KEYMAP_PRIMARY:
@@ -1899,6 +1913,14 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_BIBTEX_COMMAND:
        case LyXRC::RC_BINDFILE:
        case LyXRC::RC_CHECKLASTFILES:
+       case LyXRC::RC_COMPLETION_INLINE_DELAY:
+       case LyXRC::RC_COMPLETION_INLINE_MATH:
+       case LyXRC::RC_COMPLETION_INLINE_TEXT:
+       case LyXRC::RC_COMPLETION_INLINE_DOTS:
+       case LyXRC::RC_COMPLETION_POPUP_DELAY:
+       case LyXRC::RC_COMPLETION_POPUP_MATH:
+       case LyXRC::RC_COMPLETION_POPUP_TEXT:
+       case LyXRC::RC_COMPLETION_POPUP_AFTER_COMPLETE:
        case LyXRC::RC_USELASTFILEPOS:
        case LyXRC::RC_LOADSESSION:
        case LyXRC::RC_CHKTEX_COMMAND:
@@ -2006,6 +2028,12 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
        case LyXRC::RC_USE_SPELL_LIB:
        case LyXRC::RC_VIEWDVI_PAPEROPTION:
        case LyXRC::RC_SORT_LAYOUTS:
+       case LyXRC::RC_FULL_SCREEN_LIMIT:
+       case LyXRC::RC_FULL_SCREEN_SCROLLBAR:
+       case LyXRC::RC_FULL_SCREEN_TABBAR:
+       case LyXRC::RC_FULL_SCREEN_TOOLBARS:
+       case LyXRC::RC_FULL_SCREEN_WIDTH:
+       case LyXRC::RC_VISUAL_CURSOR:
        case LyXRC::RC_VIEWER:
        case LyXRC::RC_LAST:
                break;