]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QERT.C
The initial merge of the Qt frontend, and the necessary compile fixes.
[lyx.git] / src / frontends / qt2 / QERT.C
1 /**
2  * \file QERT.C
3  * Copyright 2001 the LyX Team
4  * Read the file COPYING
5  *
6  * \author John Levon <moz@compsoc.man.ac.uk>
7  */
8
9 #include <config.h>
10
11 #include "ControlERT.h"
12 #include "gettext.h"
13
14 #include <qradiobutton.h>
15 #include <qpushbutton.h>
16
17 #include "QERTDialog.h"
18 #include "QERT.h"
19 #include "Qt2BC.h"
20  
21 typedef Qt2CB<ControlERT, Qt2DB<QERTDialog> > base_class;
22
23 QERT::QERT(ControlERT & c)
24         : base_class(c, _("LaTeX ERT"))
25 {
26 }
27
28
29 void QERT::build_dialog()
30 {
31         dialog_.reset(new QERTDialog(this));
32
33         bc().setOK(dialog_->okPB);
34         bc().setCancel(dialog_->closePB);
35 }
36
37
38 void QERT::apply()
39 {
40         if (dialog_->openRB->isChecked())
41                 controller().params().status = InsetERT::Open;
42         else if (dialog_->inlineRB->isChecked())
43                 controller().params().status = InsetERT::Inlined;
44         else
45                 controller().params().status = InsetERT::Collapsed;
46 }
47
48
49 void QERT::update_contents()
50 {
51         QRadioButton * rb;
52
53         switch (controller().params().status) {
54                 case InsetERT::Open: rb = dialog_->openRB; break;
55                 case InsetERT::Inlined: rb = dialog_->inlineRB; break;
56                 case InsetERT::Collapsed: rb = dialog_->collapsedRB; break;
57         }
58
59         rb->setChecked(true);
60 }