]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/Toolbar.C
Create a grfx::Loader class and so move large chunks of code out of
[lyx.git] / src / frontends / Toolbar.C
index 68abc6b4660235514e958c382a45ba8d2d97c983..a86608677187fab2692ca73695cf14ec3a833390 100644 (file)
@@ -1,17 +1,10 @@
-/* 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>
 
@@ -20,6 +13,7 @@
 #endif
 
 #include "Toolbar.h"
+#include "ToolbarDefaults.h"
 #include "Toolbar_pimpl.h"
 #include "debug.h"
 #include "LyXAction.h"
@@ -30,6 +24,7 @@ extern LyXAction lyxaction;
 
 
 Toolbar::Toolbar(LyXView * o, int x, int y, ToolbarDefaults const &tbd)
+       : last_textclass_(-1)
 {
        pimpl_ = new Pimpl(o, x, y);
 
@@ -75,18 +70,27 @@ void Toolbar::update()
 }
 
 
-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();
@@ -111,7 +115,7 @@ void Toolbar::add(string const & func, bool doclean)
 
        if (tf == -1) {
                lyxerr << "Toolbar::add: no LyX command called`"
-                      << func << "'exists!" << endl; 
+                      << func << "'exists!" << endl;
        } else {
                pimpl_->add(tf, doclean);
        }