]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlConnections.C
The reference dialog now disconnects from the inset on Apply. Its behaviour
[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 #ifdef __GNUG__
15 #pragma implementation
16 #endif
17
18 #include <config.h>
19
20 #include "ViewBase.h"
21 #include "ControlConnections.h"
22 #include "Dialogs.h"
23 #include "LyXView.h"
24 #include "buffer.h"
25
26 using SigC::slot;
27
28 ControlConnectBase::ControlConnectBase(LyXView & lv, Dialogs & d)
29         : lv_(lv), d_(d), h_(0), r_(0)
30 {}
31
32
33 void ControlConnectBase::connect()
34 {
35         r_ = Dialogs::redrawGUI.
36                 connect(slot(this, &ControlConnectBase::redraw));
37 }
38
39 void ControlConnectBase::disconnect()
40 {
41         h_.disconnect();
42         r_.disconnect();
43 }
44
45
46 void ControlConnectBase::redraw()
47 {
48         view().redraw();
49 }
50
51
52 bool ControlConnectBase::isReadonly() const
53 {
54         if (!lv_.buffer())
55                 return true;
56
57         return lv_.buffer()->isReadonly();
58 }
59
60
61 ControlConnectBase::DocTypes ControlConnectBase::docType() const
62 {
63         if (!lv_.buffer())
64                 return LATEX;
65
66         if (lv_.buffer()->isLatex())
67                 return LATEX;
68         else if (lv_.buffer()->isLiterate())
69                 return LITERATE;
70         else if (lv_.buffer()->isLinuxDoc())
71                 return LINUXDOC;
72         /* else if (lv_.buffer()->isDocBook()) */
73                 return DOCBOOK;
74 }
75
76
77 ControlConnectBI::ControlConnectBI(LyXView & lv, Dialogs & d)
78         : ControlConnectBase(lv, d)
79 {}
80
81
82 void ControlConnectBI::connect()
83 {
84         h_ = d_.hideAll.connect(slot(this, &ControlConnectBI::hide));
85         ControlConnectBase::connect();
86 }
87
88 ControlConnectBD::ControlConnectBD(LyXView & lv, Dialogs & d)
89         : ControlConnectBase(lv, d),
90           u_(0)
91 {}
92
93
94 void ControlConnectBD::connect()
95 {
96         u_ = d_.updateBufferDependent.
97                 connect(slot(this, &ControlConnectBD::updateSlot));
98         h_ = d_.hideBufferDependent.
99                 connect(slot(this, &ControlConnectBD::hide));
100         ControlConnectBase::connect();
101 }
102
103 void ControlConnectBD::disconnect()
104 {
105         u_.disconnect();
106         ControlConnectBase::disconnect();
107 }