]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlConnections.C
Add a buffer_path arg to InsetGraphicsMailer's params2string, string2params.
[lyx.git] / src / frontends / controllers / ControlConnections.C
1 /**
2  * \file ControlConnections.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Angus Leeming
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #include <config.h>
12
13
14 #include "ControlConnections.h"
15
16 #include "ViewBase.h"
17
18 #include "buffer.h"
19 #include "BufferView.h"
20
21 #include "frontends/Dialogs.h"
22 #include "frontends/LyXView.h"
23
24 #include <boost/bind.hpp>
25
26
27 ControlConnectBase::ControlConnectBase(LyXView & lv, Dialogs & d)
28         : lv_(lv), d_(d)
29 {}
30
31
32 void ControlConnectBase::connect()
33 {
34         r_ = d_.redrawGUI().
35                 connect(boost::bind(&ControlConnectBase::redraw, this));
36 }
37
38 void ControlConnectBase::disconnect()
39 {
40         h_.disconnect();
41         r_.disconnect();
42 }
43
44
45 void ControlConnectBase::redraw()
46 {
47         view().redraw();
48 }
49
50
51 bool ControlConnectBase::bufferIsReadonly() const
52 {
53         if (!lv_.buffer())
54                 return true;
55
56         return lv_.buffer()->isReadonly();
57 }
58
59
60 bool ControlConnectBase::bufferIsAvailable() const
61 {
62         if (!lv_.view())
63                 return false;
64
65         return lv_.view()->available();
66 }
67
68
69 BufferView * ControlConnectBase::bufferview()
70 {
71         return lv_.view().get();
72 }
73
74
75 BufferView const * ControlConnectBase::bufferview() const
76 {
77         return lv_.view().get();
78 }
79
80
81 Buffer * ControlConnectBase::buffer()
82 {
83         return lv_.buffer();
84 }
85
86
87 Buffer const * ControlConnectBase::buffer() const
88 {
89         return lv_.buffer();
90 }
91
92
93 LyXFunc & ControlConnectBase::lyxfunc()
94 {
95         return lv_.getLyXFunc();
96 }
97
98
99 LyXFunc const & ControlConnectBase::lyxfunc() const
100 {
101         return lv_.getLyXFunc();
102 }
103
104
105 ControlConnectBase::DocTypes ControlConnectBase::docType() const
106 {
107         if (!lv_.buffer())
108                 return LATEX;
109
110         if (lv_.buffer()->isLatex())
111                 return LATEX;
112         else if (lv_.buffer()->isLiterate())
113                 return LITERATE;
114         else if (lv_.buffer()->isLinuxDoc())
115                 return LINUXDOC;
116         /* else if (lv_.buffer()->isDocBook()) */
117                 return DOCBOOK;
118 }
119
120
121 ControlConnectBI::ControlConnectBI(LyXView & lv, Dialogs & d)
122         : ControlConnectBase(lv, d)
123 {}
124
125
126 void ControlConnectBI::connect()
127 {
128         h_ = d_.hideAllSignal.connect(boost::bind(&ControlConnectBI::hide, this));
129         ControlConnectBase::connect();
130 }
131
132 ControlConnectBD::ControlConnectBD(LyXView & lv, Dialogs & d)
133         : ControlConnectBase(lv, d)
134 {}
135
136
137 void ControlConnectBD::connect()
138 {
139         u_ = d_.updateBufferDependentSignal.
140                 connect(boost::bind(&ControlConnectBD::updateSlot, this, _1));
141         h_ = d_.hideBufferDependentSignal.
142                 connect(boost::bind(&ControlConnectBD::hide, this));
143         ControlConnectBase::connect();
144 }
145
146 void ControlConnectBD::disconnect()
147 {
148         u_.disconnect();
149         ControlConnectBase::disconnect();
150 }