#include "Buffer.h"
#include "BufferParams.h"
-#include "debug.h"
+#include "support/debug.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "Layout.h"
#include "LyX.h"
#include "LyXFunc.h"
#include "TextClass.h"
#include "ToolbarBackend.h"
-
-using std::endl;
-using std::string;
+using namespace std;
namespace lyx {
namespace frontend {
#define TurnOffFlag(x) flags &= ~ToolbarInfo::x
GuiToolbars::GuiToolbars(GuiView & owner)
- : owner_(owner),
- layout_(0),
- last_textclass_(TextClassPtr())
-{}
+ : owner_(owner)
+{
+ init();
+}
void GuiToolbars::initFlags(ToolbarInfo & tbinfo)
void GuiToolbars::init()
{
+ ToolbarsMap::const_iterator it = toolbars_.begin();
+ for (; it != toolbars_.end(); ++it)
+ delete it->second;
+ toolbars_.clear();
+
// extracts the toolbars from the backend
ToolbarBackend::Toolbars::iterator cit = toolbarbackend.begin();
ToolbarBackend::Toolbars::iterator end = toolbarbackend.end();
}
-void GuiToolbars::setLayout(docstring const & layout)
-{
- if (layout_)
- layout_->set(layout);
-}
-
-
-bool GuiToolbars::updateLayoutList(TextClassPtr textclass, bool force)
-{
- // update the layout display
- if (last_textclass_ != textclass || force) {
- if (layout_)
- layout_->updateContents();
- last_textclass_ = textclass;
- return true;
- } else
- return false;
-}
-
-
-void GuiToolbars::openLayoutList()
-{
- if (layout_)
- layout_->showPopup();
-}
-
-
-void GuiToolbars::clearLayoutList()
-{
- last_textclass_ = TextClassPtr();
- if (layout_)
- layout_->clear();
-}
-
-
void GuiToolbars::add(ToolbarInfo const & tbinfo, bool newline)
{
GuiToolbar * tb_ptr = owner_.makeToolbar(tbinfo, newline);
tb_ptr->show();
else
tb_ptr->hide();
-
- if (tb_ptr->layout())
- layout_ = tb_ptr->layout();
}
ToolbarsMap::const_iterator const end = toolbars_.end();
for (; it != end; ++it)
it->second->updateContents();
-
- bool const enable =
- lyx::getStatus(FuncRequest(LFUN_LAYOUT)).enabled();
-
- if (layout_)
- layout_->setEnabled(enable);
}