]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlConnections.C
fix tooltips in toolbar
[lyx.git] / src / frontends / controllers / ControlConnections.C
1 /* This file is part of
2  * ======================================================
3  *
4  *           LyX, The Document Processor
5  *
6  *           Copyright 2001 The LyX Team.
7  *
8  * ======================================================
9  *
10  * \file ControlConnections.C
11  * \author Angus Leeming <a.leeming@ic.ac.uk>
12  */
13
14 #include <config.h>
15
16 #ifdef __GNUG__
17 #pragma implementation
18 #endif
19
20 #include "ControlConnections.h"
21 #include "ViewBase.h"
22 #include "Dialogs.h"
23 #include "buffer.h"
24
25 #include "frontends/LyXView.h"
26
27 #include <boost/bind.hpp>
28
29 ControlConnectBase::ControlConnectBase(LyXView & lv, Dialogs & d)
30         : lv_(lv), d_(d)
31 {}
32
33
34 void ControlConnectBase::connect()
35 {
36         r_ = d_.redrawGUI.
37                 connect(boost::bind(&ControlConnectBase::redraw, this));
38 }
39
40 void ControlConnectBase::disconnect()
41 {
42         h_.disconnect();
43         r_.disconnect();
44 }
45
46
47 void ControlConnectBase::redraw()
48 {
49         view().redraw();
50 }
51
52
53 bool ControlConnectBase::isReadonly() const
54 {
55         if (!lv_.buffer())
56                 return true;
57
58         return lv_.buffer()->isReadonly();
59 }
60
61
62 ControlConnectBase::DocTypes ControlConnectBase::docType() const
63 {
64         if (!lv_.buffer())
65                 return LATEX;
66
67         if (lv_.buffer()->isLatex())
68                 return LATEX;
69         else if (lv_.buffer()->isLiterate())
70                 return LITERATE;
71         else if (lv_.buffer()->isLinuxDoc())
72                 return LINUXDOC;
73         /* else if (lv_.buffer()->isDocBook()) */
74                 return DOCBOOK;
75 }
76
77
78 ControlConnectBI::ControlConnectBI(LyXView & lv, Dialogs & d)
79         : ControlConnectBase(lv, d)
80 {}
81
82
83 void ControlConnectBI::connect()
84 {
85         h_ = d_.hideAll.connect(boost::bind(&ControlConnectBI::hide, this));
86         ControlConnectBase::connect();
87 }
88
89 ControlConnectBD::ControlConnectBD(LyXView & lv, Dialogs & d)
90         : ControlConnectBase(lv, d)
91 {}
92
93
94 void ControlConnectBD::connect()
95 {
96         u_ = d_.updateBufferDependent.
97                 connect(boost::bind(&ControlConnectBD::updateSlot, this, _1));
98         h_ = d_.hideBufferDependent.
99                 connect(boost::bind(&ControlConnectBD::hide, this));
100         ControlConnectBase::connect();
101 }
102
103 void ControlConnectBD::disconnect()
104 {
105         u_.disconnect();
106         ControlConnectBase::disconnect();
107 }