]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiCommandBuffer.cpp
Complete the removal of the embedding stuff. Maybe. It's hard to be sure we got every...
[lyx.git] / src / frontends / qt4 / GuiCommandBuffer.cpp
index 92317f60ddf9c15d8b41ea96fab2de432b6594e2..6958e45469e3f161d971edcd626d27398965555b 100644 (file)
 
 #include <config.h>
 
-#include "GuiView.h"
-
 #include "GuiCommandBuffer.h"
+
 #include "GuiCommandEdit.h"
+#include "GuiView.h"
 #include "qt_helpers.h"
 
 #include "BufferView.h"
 #include "LyXAction.h"
 #include "FuncRequest.h"
 
-#include "frontends/LyXView.h"
-
 #include "support/lyxalgo.h"
 #include "support/lstrings.h"
 
 #include <QHBoxLayout>
 #include <QKeyEvent>
-#include <QLayout>
 #include <QListWidget>
 #include <QMouseEvent>
 #include <QPixmap>
 #include <QToolTip>
 #include <QVBoxLayout>
 
-using std::back_inserter;
-using std::transform;
-using std::string;
-using std::vector;
-
+using namespace std;
+using namespace lyx::support;
 
 namespace lyx {
 namespace frontend {
 
-using support::prefixIs;
-
-
 namespace {
 
 class QTempListBox : public QListWidget {
@@ -89,7 +80,7 @@ protected:
 
 
 GuiCommandBuffer::GuiCommandBuffer(GuiView * view)
-       : view_(view), lv_(*view), history_pos_(history_.end())
+       : view_(view), history_pos_(history_.end())
 {
        transform(lyxaction.func_begin(), lyxaction.func_end(),
                back_inserter(commands_), firster());
@@ -137,10 +128,11 @@ void GuiCommandBuffer::cancel()
 
 void GuiCommandBuffer::dispatch()
 {
-       dispatch(fromqstr(edit_->text()));
+       QString cmd = edit_->text();
        view_->setFocus();
        edit_->setText(QString());
        edit_->clearFocus();
+       dispatch(fromqstr(cmd));
 }
 
 
@@ -175,7 +167,7 @@ void GuiCommandBuffer::complete()
        list->resize(list->sizeHint());
        QPoint const pos = edit_->mapToGlobal(QPoint(0, 0));
 
-       int const y = std::max(0, pos.y() - list->height());
+       int const y = max(0, pos.y() - list->height());
 
        list->move(pos.x(), y);
 
@@ -268,13 +260,15 @@ string const GuiCommandBuffer::historyDown()
 
 docstring const GuiCommandBuffer::getCurrentState() const
 {
-       return lv_.view()->cursor().currentState();
+       return view_->view()->cursor().currentState();
 }
 
 
 void GuiCommandBuffer::hide() const
 {
-       lv_.showMiniBuffer(false);
+       FuncRequest cmd(LFUN_COMMAND_EXECUTE, "off");
+       theLyXFunc().setLyXView(view_);
+       lyx::dispatch(cmd);
 }
 
 
@@ -326,7 +320,8 @@ void GuiCommandBuffer::dispatch(string const & str)
        history_pos_ = history_.end();
        FuncRequest func = lyxaction.lookupFunc(str);
        func.origin = FuncRequest::COMMANDBUFFER;
-       lv_.dispatch(func);
+       theLyXFunc().setLyXView(view_);
+       lyx::dispatch(func);
 }
 
 } // namespace frontend