]> git.lyx.org Git - features.git/commitdiff
Cleanups:
authorAbdelrazak Younes <younes@lyx.org>
Sat, 3 Oct 2009 19:30:48 +0000 (19:30 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Sat, 3 Oct 2009 19:30:48 +0000 (19:30 +0000)
Remove dead code and make sendDispatchMessage() a local function.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31493 a592a061-630c-0410-9148-cb99ea01b6c8

src/LyXFunc.cpp
src/LyXFunc.h

index 72bbee61ca9d19d0eed1b3685e50eea6846fa23e..79d7ed2091ee461f5ca7c2a66216992bc5512386 100644 (file)
@@ -496,6 +496,49 @@ namespace {
 
 void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new);
 
+/// send a post-dispatch status message
+docstring sendDispatchMessage(docstring const & msg, FuncRequest const & cmd)
+{
+       const bool verbose = (cmd.origin == FuncRequest::MENU
+                             || cmd.origin == FuncRequest::TOOLBAR
+                             || cmd.origin == FuncRequest::COMMANDBUFFER);
+
+       if (cmd.action == LFUN_SELF_INSERT || !verbose) {
+               LYXERR(Debug::ACTION, "dispatch msg is " << msg);
+               return msg;
+       }
+
+       docstring dispatch_msg = msg;
+       if (!dispatch_msg.empty())
+               dispatch_msg += ' ';
+
+       docstring comname = from_utf8(lyxaction.getActionName(cmd.action));
+
+       bool argsadded = false;
+
+       if (!cmd.argument().empty()) {
+               if (cmd.action != LFUN_UNKNOWN_ACTION) {
+                       comname += ' ' + cmd.argument();
+                       argsadded = true;
+               }
+       }
+       docstring const shortcuts = theTopLevelKeymap().
+               printBindings(cmd, KeySequence::ForGui);
+
+       if (!shortcuts.empty())
+               comname += ": " + shortcuts;
+       else if (!argsadded && !cmd.argument().empty())
+               comname += ' ' + cmd.argument();
+
+       if (!comname.empty()) {
+               comname = rtrim(comname);
+               dispatch_msg += '(' + rtrim(comname) + ')';
+       }
+       LYXERR(Debug::ACTION, "verbose dispatch msg " << to_utf8(dispatch_msg));
+       return dispatch_msg;
+}
+
+
 } //namespace anon
 
 
@@ -730,11 +773,6 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        if (lv == 0)
                                break;
 
-                       Buffer * doc_buffer = (lv && lv->documentBufferView())
-                               ? &(lv->documentBufferView()->buffer()) : 0;
-                       if (doc_buffer && !theBufferList().isLoaded(doc_buffer))
-                               doc_buffer = 0;
-
                        // Let the current LyXView dispatch its own actions.
                        if (lv->dispatch(cmd)) {
                                BufferView * bv = lv->currentBufferView();
@@ -846,58 +884,12 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
        }
        if (lv) {
                // Some messages may already be translated, so we cannot use _()
-               sendDispatchMessage(translateIfPossible(getMessage()), cmd);
+               lv->message(sendDispatchMessage(
+                       translateIfPossible(getMessage()), cmd));
        }
 }
 
 
-void LyXFunc::sendDispatchMessage(docstring const & msg, FuncRequest const & cmd)
-{
-       const bool verbose = (cmd.origin == FuncRequest::MENU
-                             || cmd.origin == FuncRequest::TOOLBAR
-                             || cmd.origin == FuncRequest::COMMANDBUFFER);
-
-       LyXView * lv = theApp()->currentWindow();
-       if (cmd.action == LFUN_SELF_INSERT || !verbose) {
-               LYXERR(Debug::ACTION, "dispatch msg is " << to_utf8(msg));
-               if (!msg.empty())
-                       lv->message(msg);
-               return;
-       }
-
-       docstring dispatch_msg = msg;
-       if (!dispatch_msg.empty())
-               dispatch_msg += ' ';
-
-       docstring comname = from_utf8(lyxaction.getActionName(cmd.action));
-
-       bool argsadded = false;
-
-       if (!cmd.argument().empty()) {
-               if (cmd.action != LFUN_UNKNOWN_ACTION) {
-                       comname += ' ' + cmd.argument();
-                       argsadded = true;
-               }
-       }
-
-       docstring const shortcuts = theTopLevelKeymap().printBindings(cmd, KeySequence::ForGui);
-
-       if (!shortcuts.empty())
-               comname += ": " + shortcuts;
-       else if (!argsadded && !cmd.argument().empty())
-               comname += ' ' + cmd.argument();
-
-       if (!comname.empty()) {
-               comname = rtrim(comname);
-               dispatch_msg += '(' + rtrim(comname) + ')';
-       }
-
-       LYXERR(Debug::ACTION, "verbose dispatch msg " << to_utf8(dispatch_msg));
-       if (!dispatch_msg.empty())
-               lv->message(dispatch_msg);
-}
-
-
 // Each LyXView should have it's own message method. lyxview and
 // the minibuffer would use the minibuffer, but lyxserver would
 // send an ERROR signal to its client.  Alejandro 970603
index c0fc35c4d0a73eee3a6944fc06a4256042cabb32..d560b15f47852ec9ab5be60c7cf3ae6bd7557f70 100644 (file)
@@ -107,10 +107,6 @@ private:
            good reason to have this one as static in Dispatch? (Ale)
        */
        mutable docstring dispatch_buffer;
-
-       /// send a post-dispatch status message
-       void sendDispatchMessage(docstring const & msg,
-               FuncRequest const & ev);
 };
 
 /// Implementation is in LyX.cpp