]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiCommandBuffer.cpp
Fix the tab ordering of GuiDocument components.
[lyx.git] / src / frontends / qt4 / GuiCommandBuffer.cpp
index 0ce6cc7749831229938012dd5df6fd0d54c13d12..0d19a492425943ba9c9f9a0d42e25f6e66fc693f 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "BufferView.h"
 #include "Cursor.h"
-#include "LyXFunc.h"
+#include "LyX.h"
 #include "LyXAction.h"
 #include "FuncRequest.h"
 #include "Session.h"
@@ -248,7 +248,8 @@ void GuiCommandBuffer::down()
        if (!h.empty())
                edit_->setText(toqstr(h));
 
-       downPB->setEnabled(history_pos_ != history_.end()-1);
+       downPB->setEnabled(!history_.empty()
+                          && history_pos_ != history_.end() - 1);
        upPB->setEnabled(history_pos_ != history_.begin());
 }
        
@@ -296,14 +297,13 @@ string const GuiCommandBuffer::historyDown()
 
 docstring const GuiCommandBuffer::getCurrentState() const
 {
-       return view_->view()->cursor().currentState();
+       return view_->currentBufferView()->cursor().currentState();
 }
 
 
 void GuiCommandBuffer::hide() const
 {
        FuncRequest cmd(LFUN_COMMAND_EXECUTE, "off");
-       theLyXFunc().setLyXView(view_);
        lyx::dispatch(cmd);
 }
 
@@ -313,7 +313,7 @@ GuiCommandBuffer::completions(string const & prefix, string & new_prefix)
 {
        vector<string> comp;
 
-       copy_if(commands_.begin(), commands_.end(),
+       lyx::copy_if(commands_.begin(), commands_.end(),
                back_inserter(comp), prefix_p(prefix));
 
        if (comp.empty()) {
@@ -333,7 +333,7 @@ GuiCommandBuffer::completions(string const & prefix, string & new_prefix)
                test += tmp[test.length()];
        while (test.length() < tmp.length()) {
                vector<string> vtmp;
-               copy_if(comp.begin(), comp.end(),
+               lyx::copy_if(comp.begin(), comp.end(),
                        back_inserter(vtmp), prefix_p(test));
                if (vtmp.size() != comp.size()) {
                        test.erase(test.length() - 1);
@@ -357,8 +357,7 @@ void GuiCommandBuffer::dispatch(string const & str)
        upPB->setEnabled(history_pos_ != history_.begin());
        downPB->setEnabled(history_pos_ != history_.end());
        FuncRequest func = lyxaction.lookupFunc(str);
-       func.origin = FuncRequest::COMMANDBUFFER;
-       theLyXFunc().setLyXView(view_);
+       func.setOrigin(FuncRequest::COMMANDBUFFER);
        lyx::dispatch(func);
 }