]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/Toolbar.C
Joao latest bits
[lyx.git] / src / frontends / Toolbar.C
index ad2d95313a358f4891f6101143f17aa70944cce4..d83e149af13fbee401f9b90bcfdd485c05906196 100644 (file)
@@ -1,83 +1,74 @@
 /**
  * \file Toolbar.C
- * Copyright 1995-2002 the LyX Team
- * Read the file COPYING
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- * \author Lars Gullik Bjønnes <larsbj@lyx.org>
+ * \author Lars Gullik Bjønnes
+ *
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation "Toolbar.h"
-#endif
-
 #include "Toolbar.h"
-#include "ToolbarDefaults.h"
-#include "Toolbar_pimpl.h"
+
 #include "debug.h"
 #include "LyXAction.h"
+#include "ToolbarBackend.h"
 
-using std::endl;
-
-extern LyXAction lyxaction;
 
-
-Toolbar::Toolbar(LyXView * o, Dialogs & d,
-                int x, int y, ToolbarDefaults const &tbd)
+Toolbar::Toolbar()
        : last_textclass_(-1)
 {
-       pimpl_ = new Pimpl(o, d, x, y);
-
-       // extracts the toolbar actions from tbd
-       for (ToolbarDefaults::const_iterator cit = tbd.begin();
-            cit != tbd.end(); ++cit) {
-               pimpl_->add((*cit));
-               lyxerr[Debug::GUI] << "tool action: " << (*cit) << endl;
-       }
 }
 
 
 Toolbar::~Toolbar()
 {
-       delete pimpl_;
 }
 
 
-void Toolbar::update()
+void Toolbar::init()
 {
-       pimpl_->update();
-}
+       // extracts the toolbars from the backend
+       ToolbarBackend::Toolbars::const_iterator cit = toolbarbackend.begin();
+       ToolbarBackend::Toolbars::const_iterator end = toolbarbackend.end();
 
+       for (; cit != end; ++cit)
+               add(*cit);
+}
 
 
-void Toolbar::setLayout(string const & layout)
+void Toolbar::update(bool in_math, bool in_table)
 {
-       pimpl_->setLayout(layout);
-}
+       update();
 
+       // extracts the toolbars from the backend
+       ToolbarBackend::Toolbars::const_iterator cit = toolbarbackend.begin();
+       ToolbarBackend::Toolbars::const_iterator end = toolbarbackend.end();
 
-bool Toolbar::updateLayoutList(int textclass)
-{
-       // update the layout display
-       if (last_textclass_ != textclass) {
-               pimpl_->updateLayoutList(true);
-               last_textclass_ = textclass;
-               return true;
-       } else {
-               pimpl_->updateLayoutList(false);
-               return false;
+       for (; cit != end; ++cit) {
+               if (cit->flags & ToolbarBackend::MATH)
+                       displayToolbar(*cit, in_math);
+               else if (cit->flags & ToolbarBackend::TABLE)
+                       displayToolbar(*cit, in_table);
        }
 }
 
 
-void Toolbar::openLayoutList()
+void Toolbar::clearLayoutList()
 {
-       pimpl_->openLayoutList();
+       last_textclass_ = -1;
 }
 
 
-void Toolbar::clearLayoutList()
+bool Toolbar::updateLayoutList(int textclass)
 {
-       pimpl_->clearLayoutList();
+       // update the layout display
+       if (last_textclass_ != textclass) {
+               updateLayoutList();
+               last_textclass_ = textclass;
+               return true;
+       } else
+               return false;
 }