]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/Toolbar.C
namespace grfx -> lyx::graphics
[lyx.git] / src / frontends / Toolbar.C
index bfe845a63873522b064553f6de23f6a54d5cddd1..b243030f9049d20f085391061a4af0e1a3be14df 100644 (file)
@@ -1,41 +1,35 @@
 /**
  * \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 "ToolbarBackend.h"
 #include "Toolbar_pimpl.h"
 #include "debug.h"
 #include "LyXAction.h"
 
 using std::endl;
 
-extern LyXAction lyxaction;
-
-
-Toolbar::Toolbar(LyXView * o, int x, int y, ToolbarDefaults const &tbd)
+Toolbar::Toolbar(LyXView * o, int x, int y)
        : last_textclass_(-1)
 {
        pimpl_ = new Pimpl(o, x, y);
 
-       pimpl_->reset();
+       // extracts the toolbars from the backend
+       ToolbarBackend::Toolbars::const_iterator cit = toolbarbackend.begin();
+       ToolbarBackend::Toolbars::const_iterator end = toolbarbackend.end();
 
-       // 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;
-       }
+       for (; cit != end; ++cit)
+               pimpl_->add(*cit);
 }
 
 
@@ -45,27 +39,20 @@ Toolbar::~Toolbar()
 }
 
 
-void Toolbar::set(bool doingmain)
-{
-       pimpl_->set(doingmain);
-}
-
-
-void Toolbar::activate()
+void Toolbar::update(bool in_math, bool in_table)
 {
-       pimpl_->activate();
-}
-
-
-void Toolbar::deactivate()
-{
-       pimpl_->deactivate();
-}
+       pimpl_->update();
 
+       // extracts the toolbars from the backend
+       ToolbarBackend::Toolbars::const_iterator cit = toolbarbackend.begin();
+       ToolbarBackend::Toolbars::const_iterator end = toolbarbackend.end();
 
-void Toolbar::update()
-{
-       pimpl_->update();
+       for (; cit != end; ++cit) {
+               if (cit->flags & ToolbarBackend::MATH)
+                       pimpl_->displayToolbar(*cit, in_math);
+               else if (cit->flags & ToolbarBackend::TABLE)
+                       pimpl_->displayToolbar(*cit, in_table);
+       }
 }
 
 
@@ -100,22 +87,3 @@ void Toolbar::clearLayoutList()
 {
        pimpl_->clearLayoutList();
 }
-
-
-void Toolbar::push(int nth)
-{
-       pimpl_->push(nth);
-}
-
-
-void Toolbar::add(string const & func, bool doclean)
-{
-       int const tf = lyxaction.LookupFunc(func);
-
-       if (tf == -1) {
-               lyxerr << "Toolbar::add: no LyX command called`"
-                      << func << "'exists!" << endl;
-       } else {
-               pimpl_->add(tf, doclean);
-       }
-}