]> git.lyx.org Git - features.git/commitdiff
Implement shortcut (M-x) to hide the minibuffer
authorJürgen Spitzmüller <spitz@lyx.org>
Sun, 29 Apr 2007 08:58:09 +0000 (08:58 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Sun, 29 Apr 2007 08:58:09 +0000 (08:58 +0000)
* src/frontends/controllers/ControlCommandBuffer.{cpp,h}:
- new member hide()
* src/frontends/qt4QCommandEdit.{cpp,h}:
- new signal hidePressed(), emit it on M-x/Alt-x
* src/frontends/qt4/QCommandBuffer.{cpp,h}:
- new slot hideParent(), connected to QCommandEdit::hidePressed()

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

src/frontends/controllers/ControlCommandBuffer.cpp
src/frontends/controllers/ControlCommandBuffer.h
src/frontends/qt4/QCommandBuffer.cpp
src/frontends/qt4/QCommandBuffer.h
src/frontends/qt4/QCommandEdit.cpp
src/frontends/qt4/QCommandEdit.h

index 6995678e2c88d25d663e17808f622cfc2d38261b..959bfb73266b5118530612c01d4dc022862f46a8 100644 (file)
@@ -85,6 +85,12 @@ docstring const ControlCommandBuffer::getCurrentState() const
 }
 
 
+void ControlCommandBuffer::hide() const
+{
+       lv_.getToolbars().display("minibuffer", false);
+}
+
+
 vector<string> const
 ControlCommandBuffer::completions(string const & prefix, string & new_prefix)
 {
index b1e413411e50f7f4e524299ce3f9b7926c666022..d2c54639b66d9478f7600afd50fb5140f89ea740 100644 (file)
@@ -44,6 +44,9 @@ public:
        /// return the font and depth in the active BufferView as a message.
        docstring const getCurrentState() const;
 
+       /// hide the command buffer.
+       void hide() const;
+
        /// return the possible completions
        std::vector<std::string> const completions(std::string const & prefix,
                                              std::string & new_prefix);
index 5bc8c46a03ab8111011175178d3a664ba3b4dced..b418c990ded6717d4c123c56247a6fa8a29ae39d 100644 (file)
@@ -101,6 +101,7 @@ QCommandBuffer::QCommandBuffer(GuiView * view, ControlCommandBuffer & control)
        connect(edit_, SIGNAL(tabPressed()), this, SLOT(complete()));
        connect(edit_, SIGNAL(upPressed()), this, SLOT(up()));
        connect(edit_, SIGNAL(downPressed()), this, SLOT(down()));
+       connect(edit_, SIGNAL(hidePressed()), this, SLOT(hideParent()));
 
        layout->addWidget(up, 0);
        layout->addWidget(down, 0);
@@ -214,6 +215,15 @@ void QCommandBuffer::down()
 }
 
 
+void QCommandBuffer::hideParent()
+{
+       view_->setFocus();
+       edit_->setText(QString());
+       edit_->clearFocus();
+       controller_.hide();
+}
+
+
 #if 0
 void XMiniBuffer::show_info_suffix(string const & suffix, string const & input)
 {
index bd1fafd66da8759e5893e6011972bde392c65833..9304783e85534be24eb2fd1b42dcf11c6096d6fe 100644 (file)
@@ -43,6 +43,8 @@ public Q_SLOTS:
        void up();
        /// down
        void down();
+       /// leave and hide the command buffer
+       void hideParent();
 private:
        /// owning view
        GuiView * view_;
index 3cd2c3243007a233edcd81c51e4534dbd8fdc1b5..2fcecdae6ccdea8e0db2f4ff456a1aac96c8e3f8 100644 (file)
@@ -43,6 +43,14 @@ void QCommandEdit::keyPressEvent(QKeyEvent * e)
                downPressed();
                break;
 
+       case Qt::Key_X:
+               if (e->modifiers() == Qt::AltModifier
+                  || e->modifiers() == Qt::MetaModifier) {
+                       // emit signal
+                       hidePressed();
+                       break;
+               }
+
        default:
                QLineEdit::keyPressEvent(e);
                break;
index 5a846844fd43ef8ccff10f25b71c440974ea3532..9fbd02a42b8aa54d51a16ebdf83937ff17c939eb 100644 (file)
@@ -32,6 +32,8 @@ Q_SIGNALS:
        void downPressed();
        /// complete
        void tabPressed();
+       /// leave and hide command buffer
+       void hidePressed();
 
 protected:
        ///