3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
7 * \author Angus Leeming
9 * Full author contact details are available in file CREDITS.
17 #include "funcrequest.h"
18 #include "FuncStatus.h"
26 Toolbars::Toolbars(LyXView & owner)
35 // extracts the toolbars from the backend
36 ToolbarBackend::Toolbars::const_iterator cit = toolbarbackend.begin();
37 ToolbarBackend::Toolbars::const_iterator end = toolbarbackend.end();
39 for (; cit != end; ++cit)
44 void Toolbars::display(string const & name, bool show)
46 ToolbarBackend::Toolbars::const_iterator cit = toolbarbackend.begin();
47 ToolbarBackend::Toolbars::const_iterator end = toolbarbackend.end();
49 for (; cit != end; ++cit) {
50 if (cit->name == name) {
51 displayToolbar(*cit, show);
56 lyxerr[Debug::GUI] << "Toolbar::display: no toolbar named "
61 void Toolbars::update(bool in_math, bool in_table)
65 // extracts the toolbars from the backend
66 ToolbarBackend::Toolbars::const_iterator cit = toolbarbackend.begin();
67 ToolbarBackend::Toolbars::const_iterator end = toolbarbackend.end();
69 for (; cit != end; ++cit) {
70 if (cit->flags & ToolbarBackend::MATH)
71 displayToolbar(*cit, in_math);
72 else if (cit->flags & ToolbarBackend::TABLE)
73 displayToolbar(*cit, in_table);
78 void Toolbars::setLayout(string const & layout)
85 bool Toolbars::updateLayoutList(int textclass)
87 // update the layout display
88 if (last_textclass_ != textclass) {
91 last_textclass_ = textclass;
98 void Toolbars::openLayoutList()
105 void Toolbars::clearLayoutList()
107 last_textclass_ = -1;
113 void Toolbars::add(ToolbarBackend::Toolbar const & tbb)
115 ToolbarPtr tb_ptr = make_toolbar(tbb, owner_);
116 toolbars_[tbb.name] = tb_ptr;
118 if (tbb.flags & ToolbarBackend::ON)
123 if (tb_ptr->layout())
124 layout_ = tb_ptr->layout();
128 void Toolbars::displayToolbar(ToolbarBackend::Toolbar const & tbb,
131 ToolbarsMap::iterator it = toolbars_.find(tbb.name);
132 BOOST_ASSERT(it != toolbars_.end());
135 it->second->show(true);
137 it->second->hide(true);
141 void Toolbars::update()
143 ToolbarsMap::const_iterator it = toolbars_.begin();
144 ToolbarsMap::const_iterator const end = toolbars_.end();
145 for (; it != end; ++it)
146 it->second->update();
148 bool const enable = owner_.getLyXFunc().
149 getStatus(FuncRequest(LFUN_LAYOUT)).enabled();
152 layout_->setEnabled(enable);