diff --git a/src/frontends/qt4/GuiToolbar.cpp b/src/frontends/qt4/GuiToolbar.cpp index 76ea3efcd0..c0c043a546 100644 --- a/src/frontends/qt4/GuiToolbar.cpp +++ b/src/frontends/qt4/GuiToolbar.cpp @@ -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_, diff --git a/src/frontends/qt4/GuiToolbar.h b/src/frontends/qt4/GuiToolbar.h index cb440079f5..7751474d3f 100644 --- a/src/frontends/qt4/GuiToolbar.h +++ b/src/frontends/qt4/GuiToolbar.h @@ -16,6 +16,8 @@ #ifndef GUITOOLBAR_H #define GUITOOLBAR_H +#include "GuiCommandBuffer.h" + #include "Session.h" #include @@ -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(); diff --git a/src/frontends/qt4/GuiToolbars.cpp b/src/frontends/qt4/GuiToolbars.cpp index 7e3430b08c..8bf24294ed 100644 --- a/src/frontends/qt4/GuiToolbars.cpp +++ b/src/frontends/qt4/GuiToolbars.cpp @@ -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 diff --git a/src/frontends/qt4/GuiToolbars.h b/src/frontends/qt4/GuiToolbars.h index 4c97475cad..d427132e78 100644 --- a/src/frontends/qt4/GuiToolbars.h +++ b/src/frontends/qt4/GuiToolbars.h @@ -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); diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 81db40c699..17d413964f 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -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); }