1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 2001 The LyX Team.
8 * ======================================================
10 * \file ControlConnections.C
11 * \author Angus Leeming <leeming@lyx.org>
17 #pragma implementation
20 #include "ControlConnections.h"
25 #include "BufferView.h"
27 #include "frontends/Dialogs.h"
28 #include "frontends/LyXView.h"
30 #include <boost/bind.hpp>
32 ControlConnectBase::ControlConnectBase(LyXView & lv, Dialogs & d)
37 void ControlConnectBase::connect()
40 connect(boost::bind(&ControlConnectBase::redraw, this));
43 void ControlConnectBase::disconnect()
50 void ControlConnectBase::redraw()
56 bool ControlConnectBase::bufferIsReadonly() const
61 return lv_.buffer()->isReadonly();
65 bool ControlConnectBase::bufferIsAvailable() const
70 return lv_.view()->available();
74 BufferView * ControlConnectBase::bufferview()
76 return lv_.view().get();
80 BufferView const * ControlConnectBase::bufferview() const
82 return lv_.view().get();
86 Buffer * ControlConnectBase::buffer()
92 Buffer const * ControlConnectBase::buffer() const
98 LyXFunc & ControlConnectBase::lyxfunc()
100 return lv_.getLyXFunc();
104 LyXFunc const & ControlConnectBase::lyxfunc() const
106 return lv_.getLyXFunc();
110 ControlConnectBase::DocTypes ControlConnectBase::docType() const
115 if (lv_.buffer()->isLatex())
117 else if (lv_.buffer()->isLiterate())
119 else if (lv_.buffer()->isLinuxDoc())
121 /* else if (lv_.buffer()->isDocBook()) */
126 ControlConnectBI::ControlConnectBI(LyXView & lv, Dialogs & d)
127 : ControlConnectBase(lv, d)
131 void ControlConnectBI::connect()
133 h_ = d_.hideAll.connect(boost::bind(&ControlConnectBI::hide, this));
134 ControlConnectBase::connect();
137 ControlConnectBD::ControlConnectBD(LyXView & lv, Dialogs & d)
138 : ControlConnectBase(lv, d)
142 void ControlConnectBD::connect()
144 u_ = d_.updateBufferDependent.
145 connect(boost::bind(&ControlConnectBD::updateSlot, this, _1));
146 h_ = d_.hideBufferDependent.
147 connect(boost::bind(&ControlConnectBD::hide, this));
148 ControlConnectBase::connect();
151 void ControlConnectBD::disconnect()
154 ControlConnectBase::disconnect();