]> git.lyx.org Git - features.git/commitdiff
Some fixes and cleanup to command buffer.
authorAbdelrazak Younes <younes@lyx.org>
Tue, 2 Oct 2007 06:59:02 +0000 (06:59 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Tue, 2 Oct 2007 06:59:02 +0000 (06:59 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20652 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiToolbar.cpp
src/frontends/qt4/GuiToolbar.h
src/frontends/qt4/GuiToolbars.cpp
src/frontends/qt4/GuiToolbars.h
src/frontends/qt4/GuiView.cpp

index 76ea3efcd043472eacd0478f602bc18c4f1adb67..c0c043a546e6535bdd2795ec3e30940d0832708a 100644 (file)
@@ -171,13 +171,6 @@ GuiToolbar::GuiToolbar(ToolbarInfo const & tbinfo, GuiViewBase & owner)
 }
 
 
-void GuiToolbar::focusCommandBuffer()
-{
-       if (command_buffer_)
-               command_buffer_->setFocus();
-}
-
-
 Action * GuiToolbar::addItem(ToolbarItem const & item)
 {
        Action * act = new Action(owner_,
index cb440079f56432c4878a6112a3c36b3af9b84060..7751474d3f842a468f1584c1b3ac176293edb58a 100644 (file)
@@ -16,6 +16,8 @@
 #ifndef GUITOOLBAR_H
 #define GUITOOLBAR_H
 
+#include "GuiCommandBuffer.h"
+
 #include "Session.h"
 
 #include <QList>
@@ -29,8 +31,6 @@ class ToolbarItem;
 
 namespace frontend {
 
-class GuiCommandBuffer;
-class GuiLayoutBox;
 class GuiViewBase;
 class Action;
 
@@ -69,8 +69,8 @@ public:
        /// Refresh the contents of the bar.
        void updateContents();
        GuiLayoutBox * layout() const { return layout_; }
-       /// Set the focus on the command buffer, if any.
-       void focusCommandBuffer();
+       ///
+       GuiCommandBuffer * commandBuffer() { return command_buffer_; }
 
 Q_SIGNALS:
        void updated();
index 7e3430b08cc6fcff20a919a6b0cc2deef74444d0..8bf24294edc0a2444a9b65f7d135875230a0350b 100644 (file)
@@ -362,5 +362,25 @@ void GuiToolbars::updateIcons()
                layout_->setEnabled(enable);
 }
 
+
+void GuiToolbars::showCommandBuffer(bool show_it)
+{
+       ToolbarsMap::const_iterator it = toolbars_.begin();
+       ToolbarsMap::const_iterator const end = toolbars_.end();
+       for (; it != end; ++it) {
+               GuiCommandBuffer * cb = it->second->commandBuffer();
+               if (!cb)
+                       continue;
+               if (!show_it) {
+                       it->second->hide();
+                       return;
+               }
+               if (!it->second->isVisible())
+                       it->second->show();
+               cb->setFocus();
+               return;
+       }
+}
+
 } // namespace frontend
 } // namespace lyx
index 4c97475cad1303d6122603b653718b83b60feb2e..d427132e7855f9b4b513f1552dc46094cac6a7db 100644 (file)
@@ -69,6 +69,10 @@ public:
        /// Erase the layout list.
        void clearLayoutList();
 
+       /// Show or hide the command buffer.
+       void showCommandBuffer(bool show_it);
+
+
 private:
        /// Add a new toolbar. if newline==true, start from a new line
        void add(ToolbarInfo const & tbinfo, bool newline);
index 81db40c699c3375f48050db026a0b2f3e28092ce..17d413964f47b5cc0ddb1b63eea53f6d111ea5a6 100644 (file)
@@ -938,11 +938,7 @@ void GuiViewBase::removeWorkArea(WorkArea * work_area)
 
 void GuiViewBase::showMiniBuffer(bool visible)
 {
-       d.toolbars_->display("minibuffer", visible);
-
-       // FIXME: do something about command buffer focus.
-//     if (t)
-//             t->focusCommandBuffer();
+       d.toolbars_->showCommandBuffer(visible);
 }