]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiCommandBuffer.cpp
do what the FIXME suggested
[lyx.git] / src / frontends / qt4 / GuiCommandBuffer.cpp
index a18515cff4285dc7cf03ad6f5e4fee7c5dcb546d..6958e45469e3f161d971edcd626d27398965555b 100644 (file)
@@ -29,7 +29,6 @@
 
 #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 {
@@ -135,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));
 }
 
 
@@ -173,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);
 
@@ -273,7 +267,8 @@ docstring const GuiCommandBuffer::getCurrentState() const
 void GuiCommandBuffer::hide() const
 {
        FuncRequest cmd(LFUN_COMMAND_EXECUTE, "off");
-       view_->dispatch(cmd);
+       theLyXFunc().setLyXView(view_);
+       lyx::dispatch(cmd);
 }
 
 
@@ -325,7 +320,8 @@ void GuiCommandBuffer::dispatch(string const & str)
        history_pos_ = history_.end();
        FuncRequest func = lyxaction.lookupFunc(str);
        func.origin = FuncRequest::COMMANDBUFFER;
-       view_->dispatch(func);
+       theLyXFunc().setLyXView(view_);
+       lyx::dispatch(func);
 }
 
 } // namespace frontend