]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiERT.cpp
Fix the tab ordering of GuiDocument components.
[lyx.git] / src / frontends / qt4 / GuiERT.cpp
index f9b994129bb7bf4bd67105930e3e41cb7dd1260f..cc9f984b9d182278a1af61fdfc00785b03650e68 100644 (file)
@@ -3,6 +3,8 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
+ * \author Jürgen Vigna
+ * \author Angus Leeming
  * \author John Levon
  *
  * Full author contact details are available in file CREDITS.
 #include <config.h>
 
 #include "GuiERT.h"
-#include "Qt2BC.h"
+
+#include "GuiApplication.h"
+#include "GuiView.h"
+
+#include "insets/InsetERT.h"
+
+#include "support/gettext.h"
 
 #include <QRadioButton>
 #include <QPushButton>
-#include <QCloseEvent>
 
+using namespace std;
 
 namespace lyx {
 namespace frontend {
 
-/////////////////////////////////////////////////////////////////////
-//
-// GuiERTDialog
-//
-/////////////////////////////////////////////////////////////////////
-
-
-GuiERTDialog::GuiERTDialog(GuiERT * form)
-       : form_(form)
+GuiERT::GuiERT(QWidget * parent) : InsetParamsWidget(parent)
 {
        setupUi(this);
-       connect(okPB, SIGNAL(clicked()), form, SLOT(slotOK()));
-       connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
-       connect(collapsedRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
-       connect(openRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
-}
-
-
-void GuiERTDialog::closeEvent(QCloseEvent * e)
-{
-       form_->slotWMHide();
-       e->accept();
-}
-
-
-void GuiERTDialog::change_adaptor()
-{
-       form_->changed();
-}
-
-
-/////////////////////////////////////////////////////////////////////
-//
-// GuiERT
-//
-/////////////////////////////////////////////////////////////////////
-
-GuiERT::GuiERT(Dialog & parent)
-       : GuiView<GuiERTDialog>(parent, _("TeX Code Settings"))
-{
-}
-
-
-void GuiERT::build_dialog()
-{
-       dialog_.reset(new GuiERTDialog(this));
 
-       bcview().setOK(dialog_->okPB);
-       bcview().setCancel(dialog_->closePB);
+       connect(collapsedRB, SIGNAL(clicked()), this, SIGNAL(changed()));
+       connect(openRB, SIGNAL(clicked()), this, SIGNAL(changed()));
 }
 
 
-void GuiERT::apply()
+docstring GuiERT::dialogToParams() const
 {
-       if (dialog_->openRB->isChecked())
-               controller().setStatus(Inset::Open);
-       else
-               controller().setStatus(Inset::Collapsed);
+       InsetCollapsable::CollapseStatus const status = openRB->isChecked()
+               ? InsetCollapsable::Open : InsetCollapsable::Collapsed;
+       return from_ascii(InsetERT::params2string(status));
 }
 
 
-void GuiERT::update_contents()
+void GuiERT::paramsToDialog(Inset const * inset)
 {
-       QRadioButton * rb = 0;
-
-       switch (controller().status()) {
-               case InsetERT::Open: rb = dialog_->openRB; break;
-               case InsetERT::Collapsed: rb = dialog_->collapsedRB; break;
+       InsetERT const * ert = static_cast<InsetERT const *>(inset);
+       // FIXME: This dialog has absolutely no value...
+       BufferView const * bv = guiApp->currentView()->currentBufferView();
+       InsetCollapsable::CollapseStatus status = ert->status(*bv);
+       switch (status) {
+               case InsetCollapsable::Open: openRB->setChecked(true); break;
+               case InsetCollapsable::Collapsed: collapsedRB->setChecked(true); break;
        }
-
-       rb->setChecked(true);
 }
 
 } // namespace frontend
 } // namespace lyx
 
-#include "GuiERT_moc.cpp"
+#include "moc_GuiERT.cpp"