--- /dev/null
+/**
+ * \file QERT.C
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author John Levon <moz@compsoc.man.ac.uk>
+ */
+
+#include <config.h>
+
+#include "QERTDialog.h"
+#include "ControlERT.h"
+#include "QERT.h"
+#include "Qt2BC.h"
+#include "gettext.h"
+
+#include <qradiobutton.h>
+#include <qpushbutton.h>
+
+typedef Qt2CB<ControlERT, Qt2DB<QERTDialog> > base_class;
+
+QERT::QERT(ControlERT & c)
+ : base_class(c, _("LaTeX ERT"))
+{
+}
+
+
+void QERT::build_dialog()
+{
+ dialog_.reset(new QERTDialog(this));
+
+ bc().setOK(dialog_->okPB);
+ bc().setCancel(dialog_->closePB);
+}
+
+
+void QERT::apply()
+{
+ if (dialog_->openRB->isChecked())
+ controller().params().status = InsetERT::Open;
+ else if (dialog_->inlineRB->isChecked())
+ controller().params().status = InsetERT::Inlined;
+ else
+ controller().params().status = InsetERT::Collapsed;
+}
+
+
+void QERT::update_contents()
+{
+ QRadioButton * rb;
+
+ switch (controller().params().status) {
+ case InsetERT::Open: rb = dialog_->openRB; break;
+ case InsetERT::Inlined: rb = dialog_->inlineRB; break;
+ case InsetERT::Collapsed: rb = dialog_->collapsedRB; break;
+ }
+
+ rb->setChecked(true);
+}
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file QERT.h
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author John Levon <moz@compsoc.man.ac.uk>
+ */
+
+#ifndef QERT_H
+#define QERT_H
+
+#include "Qt2Base.h"
+
+class ControlERT;
+class QERTDialog;
+
+class QERT :
+ public Qt2CB<ControlERT, Qt2DB<QERTDialog> >
+{
+ friend class QERTDialog;
+
+public:
+ QERT(ControlERT &);
+
+private:
+ /// Apply changes
+ virtual void apply();
+ /// update
+ virtual void update_contents();
+ /// build the dialog
+ virtual void build_dialog();
+};
+
+#endif // QERT_H
--- /dev/null
+/**
+ * \file QERTDialog.C
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author John Levon <moz@compsoc.man.ac.uk>
+ */
+
+#include "QERTDialog.h"
+#include "Dialogs.h"
+#include "QERT.h"
+
+#include <qpushbutton.h>
+
+QERTDialog::QERTDialog(QERT * form)
+ : QERTDialogBase(0, 0, false, 0),
+ form_(form)
+{
+ connect(okPB, SIGNAL(clicked()),
+ form, SLOT(slotOK()));
+ connect(closePB, SIGNAL(clicked()),
+ form, SLOT(slotClose()));
+}
+
+
+void QERTDialog::closeEvent(QCloseEvent * e)
+{
+ form_->slotWMHide();
+ e->accept();
+}
--- /dev/null
+/**
+ * \file QERTDialog.h
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author John Levon <moz@compsoc.man.ac.uk>
+ */
+
+#ifndef QERTDIALOG_H
+#define QERTDIALOG_H
+
+#include <config.h>
+
+#include "ui/QERTDialogBase.h"
+#include "QERT.h"
+
+class QERTDialog : public QERTDialogBase
+{ Q_OBJECT
+
+public:
+ QERTDialog(QERT * form);
+
+protected slots:
+ void change_adaptor() {
+ form_->changed();
+ }
+
+protected:
+ virtual void closeEvent(QCloseEvent * e);
+
+private:
+ QERT * form_;
+};
+
+#endif // QERTDIALOG_H
--- /dev/null
+<!DOCTYPE UI><UI>
+<class>QERTDialogBase</class>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>QERTDialogBase</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>197</width>
+ <height>158</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>ERT inset display</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QButtonGroup</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ertBG</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>ERT inset display</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>inlineRB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Inline</string>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Show ERT inline</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>collapsedRB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Collapsed</string>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Show ERT button only</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>openRB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Open</string>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Show ERT contents</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout2</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer3</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>okPB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>OK</string>
+ </property>
+ <property stdset="1">
+ <name>default</name>
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>closePB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Close</string>
+ </property>
+ <property stdset="1">
+ <name>default</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>inlineRB</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>QERTDialogBase</receiver>
+ <slot>change_adaptor()</slot>
+ </connection>
+ <connection>
+ <sender>collapsedRB</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>QERTDialogBase</receiver>
+ <slot>change_adaptor()</slot>
+ </connection>
+ <connection>
+ <sender>openRB</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>QERTDialogBase</receiver>
+ <slot>change_adaptor()</slot>
+ </connection>
+ <slot access="public">change_adaptor()</slot>
+</connections>
+</UI>