]> git.lyx.org Git - lyx.git/blob - src/frontends/gtk/GERT.C
Change glob() API to accept a dir parameter.
[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 _GLIBCPP_CONCEPT_CHECKS
15 #undef _GLIBCPP_CONCEPT_CHECKS
16 #endif
17
18 #include "GERT.h"
19 #include "ControlERT.h"
20 #include "ghelpers.h"
21
22 #include <libglademm.h>
23
24 using std::string;
25
26 namespace lyx {
27 namespace frontend {
28
29 GERT::GERT(Dialog & parent)
30         : GViewCB<ControlERT, GViewGladeB>(parent, _("TeX Settings"), false)
31 {}
32
33
34 void GERT::doBuild()
35 {
36         string const gladeName = findGladeFile("ERT");
37         xml_ = Gnome::Glade::Xml::create(gladeName);
38
39         Gtk::Button * cancelbutton;
40         xml_->get_widget("Close", cancelbutton);
41         setCancel(cancelbutton);
42
43         xml_->get_widget("Inline", inlineradio_);
44         xml_->get_widget("Open", openradio_);
45         xml_->get_widget("Collapsed", collapsedradio_);
46
47         inlineradio_->signal_toggled().connect(
48                 sigc::mem_fun(*this, &GERT::apply));
49         openradio_->signal_toggled().connect(
50                 sigc::mem_fun(*this, &GERT::apply));
51         collapsedradio_->signal_toggled().connect(
52                 sigc::mem_fun(*this, &GERT::apply));
53
54         bcview().addReadOnly(inlineradio_);
55         bcview().addReadOnly(openradio_);
56         bcview().addReadOnly(collapsedradio_);
57 }
58
59
60 void GERT::update()
61 {
62         applylock_ = true;
63
64         bc().refreshReadOnly();
65
66         switch (controller().status()) {
67         case InsetERT::Open:
68                 openradio_->set_active(true);
69                 break;
70         case InsetERT::Collapsed:
71                 collapsedradio_->set_active(true);
72                 break;
73         case InsetERT::Inlined:
74                 inlineradio_->set_active(true);
75                 break;
76         }
77
78         applylock_ = false;
79 }
80
81
82 void GERT::apply()
83 {
84         if (applylock_)
85                 return;
86
87         if (openradio_->get_active())
88                 controller().setStatus(InsetERT::Open);
89         else if (collapsedradio_->get_active())
90                 controller().setStatus(InsetERT::Collapsed);
91         else
92                 controller().setStatus(InsetERT::Inlined);
93
94         controller().dispatchParams();
95 }
96
97 } // namespace frontend
98 } // namespace lyx