Some fixes and cleanup to command buffer.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20652 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-10-02 06:59:02 +00:00
parent 8ae95bb178
commit fc742ab7d2
5 changed files with 29 additions and 16 deletions

View 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_,

View 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();

View 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

View 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);

View 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);
}