]> git.lyx.org Git - lyx.git/blob - src/frontends/gtk/GERT.C
some tabular fixes for the problems reported by Helge
[lyx.git] / src / frontends / gtk / GERT.C
1 /**
2  * \file GERT.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Spray
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 // Too hard to make concept checks work with this file
14 #ifdef _GLIBCXX_CONCEPT_CHECKS
15 #undef _GLIBCXX_CONCEPT_CHECKS
16 #endif
17 #ifdef _GLIBCPP_CONCEPT_CHECKS
18 #undef _GLIBCPP_CONCEPT_CHECKS
19 #endif
20
21 #include "GERT.h"
22 #include "ControlERT.h"
23 #include "ghelpers.h"
24
25 #include <libglademm.h>
26
27 using std::string;
28
29 namespace lyx {
30 namespace frontend {
31
32 GERT::GERT(Dialog & parent)
33         : GViewCB<ControlERT, GViewGladeB>(parent, _("TeX Settings"), false)
34 {}
35
36
37 void GERT::doBuild()
38 {
39         string const gladeName = findGladeFile("ERT");
40         xml_ = Gnome::Glade::Xml::create(gladeName);
41
42         Gtk::Button * cancelbutton;
43         xml_->get_widget("Close", cancelbutton);
44         setCancel(cancelbutton);
45
46         xml_->get_widget("Inline", inlineradio_);
47         xml_->get_widget("Open", openradio_);
48         xml_->get_widget("Collapsed", collapsedradio_);
49
50         inlineradio_->signal_toggled().connect(
51                 sigc::mem_fun(*this, &GERT::apply));
52         openradio_->signal_toggled().connect(
53                 sigc::mem_fun(*this, &GERT::apply));
54         collapsedradio_->signal_toggled().connect(
55                 sigc::mem_fun(*this, &GERT::apply));
56
57         bcview().addReadOnly(inlineradio_);
58         bcview().addReadOnly(openradio_);
59         bcview().addReadOnly(collapsedradio_);
60 }
61
62
63 void GERT::update()
64 {
65         applylock_ = true;
66
67         bc().refreshReadOnly();
68
69         switch (controller().status()) {
70         case InsetERT::Open:
71                 openradio_->set_active(true);
72                 break;
73         case InsetERT::Collapsed:
74                 collapsedradio_->set_active(true);
75                 break;
76         case InsetERT::Inlined:
77                 inlineradio_->set_active(true);
78                 break;
79         }
80
81         applylock_ = false;
82 }
83
84
85 void GERT::apply()
86 {
87         if (applylock_)
88                 return;
89
90         if (openradio_->get_active())
91                 controller().setStatus(InsetERT::Open);
92         else if (collapsedradio_->get_active())
93                 controller().setStatus(InsetERT::Collapsed);
94         else
95                 controller().setStatus(InsetERT::Inlined);
96
97         controller().dispatchParams();
98 }
99
100 } // namespace frontend
101 } // namespace lyx