]> git.lyx.org Git - lyx.git/blob - src/frontends/Toolbar.C
major GUII cleanup + Baruchs patch + Angus's patch + removed a couple of generated...
[lyx.git] / src / frontends / Toolbar.C
1 /* This file is part of
2  * ====================================================== 
3  * 
4  *           LyX, The Document Processor
5  *
6  *           Copyright 1995 Matthias Ettrich
7  *           Copyright 1995-2000 The LyX Team.
8  *
9  *           This file is Copyright 1996-1998
10  *           Lars Gullik Bjønnes
11  *
12  * ====================================================== */
13
14 //  Added pseudo-action handling, asierra 180296
15
16 #include <config.h>
17
18 #ifdef __GNUG__
19 #pragma implementation "Toolbar.h"
20 #endif
21
22 #include "Toolbar.h"
23 #include "Toolbar_pimpl.h"
24 #include "debug.h"
25 #include "LyXAction.h"
26
27 using std::endl;
28
29 extern LyXAction lyxaction;
30
31
32 Toolbar::Toolbar(LyXView * o, int x, int y, ToolbarDefaults const &tbd)
33 {
34         pimpl_ = new Pimpl(o, x, y);
35
36         pimpl_->reset();
37
38         // extracts the toolbar actions from tbd
39         for (ToolbarDefaults::const_iterator cit = tbd.begin();
40              cit != tbd.end(); ++cit) {
41                 pimpl_->add((*cit));
42                 lyxerr[Debug::GUI] << "tool action: "
43                                        << (*cit) << endl;
44         }
45 }
46
47 Toolbar::~Toolbar()
48 {
49         delete pimpl_;
50 }
51
52
53 void Toolbar::set(bool doingmain)
54 {
55         pimpl_->set(doingmain);
56 }
57
58
59 void Toolbar::activate()
60 {
61         pimpl_->activate();
62 }
63
64
65 void Toolbar::deactivate()
66 {
67         pimpl_->deactivate();
68 }
69
70 void Toolbar::update()
71 {
72         pimpl_->update();
73 }
74
75
76 void Toolbar::setLayout(int layout) {
77         pimpl_->setLayout(layout);
78 }
79
80
81 void Toolbar::updateLayoutList(bool force) {
82         pimpl_->updateLayoutList(force);
83 }
84
85                 
86 void Toolbar::openLayoutList() {
87         pimpl_->openLayoutList();
88 }
89
90
91 void Toolbar::clearLayoutList()
92 {
93         pimpl_->clearLayoutList();
94 }
95
96
97 void Toolbar::push(int nth)
98 {
99         pimpl_->push(nth);}
100
101
102 void Toolbar::add(string const & func, bool doclean)
103 {
104         int tf = lyxaction.LookupFunc(func);
105
106         if (tf == -1) {
107                 lyxerr << "Toolbar::add: no LyX command called`"
108                        << func << "'exists!" << endl; 
109         } else {
110                 pimpl_->add(tf, doclean);
111         }
112 }
113
114