-/* This file is part of
- * ======================================================
- *
- * LyX, The Document Processor
+/**
+ * \file Toolbar.C
+ * Copyright 1995-2002 the LyX Team
+ * Read the file COPYING
*
- * Copyright 1995 Matthias Ettrich
- * Copyright 1995-2001 The LyX Team.
- *
- * This file is Copyright 1996-1998
- * Lars Gullik Bjønnes
- *
- * ====================================================== */
-
-// Added pseudo-action handling, asierra 180296
+ * \author Lars Gullik Bjønnes <larsbj@lyx.org>
+ */
#include <config.h>
#endif
#include "Toolbar.h"
+#include "ToolbarDefaults.h"
#include "Toolbar_pimpl.h"
#include "debug.h"
#include "LyXAction.h"
Toolbar::Toolbar(LyXView * o, int x, int y, ToolbarDefaults const &tbd)
+ : last_textclass_(-1)
{
pimpl_ = new Pimpl(o, x, y);
}
-void Toolbar::setLayout(int layout)
+
+void Toolbar::setLayout(string const & layout)
{
pimpl_->setLayout(layout);
}
-void Toolbar::updateLayoutList(bool force)
+bool Toolbar::updateLayoutList(int textclass)
{
- pimpl_->updateLayoutList(force);
+ // update the layout display
+ if (last_textclass_ != textclass) {
+ pimpl_->updateLayoutList(true);
+ last_textclass_ = textclass;
+ return true;
+ } else {
+ pimpl_->updateLayoutList(false);
+ return false;
+ }
}
-
+
void Toolbar::openLayoutList()
{
pimpl_->openLayoutList();
if (tf == -1) {
lyxerr << "Toolbar::add: no LyX command called`"
- << func << "'exists!" << endl;
+ << func << "'exists!" << endl;
} else {
pimpl_->add(tf, doclean);
}