]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlConnections.C
Once again the user can use the Font button on the toolbar to get the current
[lyx.git] / src / frontends / controllers / ControlConnections.C
1 // -*- C++ -*-
2 /* This file is part of
3  * ====================================================== 
4  *
5  *           LyX, The Document Processor
6  *
7  *           Copyright 2001 The LyX Team.
8  *
9  * ======================================================
10  *
11  * \file ControlConnections.C
12  * \author Angus Leeming <a.leeming@ic.ac.uk>
13  */
14
15 #ifdef __GNUG__
16 #pragma implementation
17 #endif
18
19 #include <config.h>
20
21 #include "ViewBase.h"
22 #include "ControlConnections.h"
23 #include "Dialogs.h"
24 #include "LyXView.h"
25 #include "buffer.h"
26
27 using SigC::slot;
28
29 ControlConnectBase::ControlConnectBase(LyXView & lv, Dialogs & d)
30         : lv_(lv), d_(d), h_(0), r_(0)
31 {}
32
33
34 void ControlConnectBase::connect()
35 {
36         r_ = Dialogs::redrawGUI.
37                 connect(slot(this, &ControlConnectBase::redraw));
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(slot(this, &ControlConnectBI::hide));
86         ControlConnectBase::connect();
87 }
88
89 ControlConnectBD::ControlConnectBD(LyXView & lv, Dialogs & d)
90         : ControlConnectBase(lv, d),
91           u_(0)
92 {}
93
94
95 void ControlConnectBD::connect()
96 {
97         u_ = d_.updateBufferDependent.
98                 connect(slot(this, &ControlConnectBD::updateSlot));
99         h_ = d_.hideBufferDependent.
100                 connect(slot(this, &ControlConnectBD::hide));
101         ControlConnectBase::connect();
102 }
103
104 void ControlConnectBD::disconnect()
105 {
106         u_.disconnect();
107         ControlConnectBase::disconnect();
108 }
109