]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormMathsSpace.C
Introduce LFUN_PRINT.
[lyx.git] / src / frontends / xforms / FormMathsSpace.C
index 31ca06b7673709ad24ced249a964a590ca1445e6..03cce878ca02e94cbfaa4ec8946da0f020f6a00b 100644 (file)
@@ -1,73 +1,68 @@
 /**
  * \file FormMathsSpace.C
- * Copyright 2001 The LyX Team.
- * See the file COPYING.
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
  * \author Alejandro Aguilar Sierra
- * \author Pablo De Napoli, pdenapo@dm.uba.ar
- * \author John Levon, moz@compsoc.man.ac.uk
- * \author Angus Leeming, a.leeming@ic.ac.uk
+ * \author Pablo De Napoli
+ * \author John Levon
+ * \author Angus Leeming
+ *
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
-#ifdef __GNUG_
-#pragma implementation
-#endif
-
 #include "FormMathsSpace.h"
-#include "form_maths_space.h"
+#include "forms/form_maths_space.h"
+#include "ControlMath.h"
+#include "xformsBC.h"
+
+#include "lyx_forms.h"
+
 
 extern char * latex_mathspace[];
 
-FormMathsSpace::FormMathsSpace(LyXView * lv, Dialogs * d,
-                              FormMathsPanel const & p)
-       : FormMathsSub(lv, d, p, _("Maths Spacing")),
+typedef FormController<ControlMath, FormView<FD_maths_space> > base_class;
+
+FormMathsSpace::FormMathsSpace(Dialog & parent)
+       : base_class(parent, _("Math Spacing"), false),
          space_(-1)
 {}
 
 
-FL_FORM * FormMathsSpace::form() const
-{
-       if (dialog_.get())
-               return dialog_->form;
-       return 0;
-}
-
-
 void FormMathsSpace::build()
 {
-       dialog_.reset(build_maths_space());
+       dialog_.reset(build_maths_space(this));
 
-       fl_set_button(dialog_->radio_thin, 1);
-
-       bc().setOK(dialog_->button_ok);
-       bc().setApply(dialog_->button_apply);
-       bc().setCancel(dialog_->button_cancel);
+       space_ = -1;
 
-       bc().addReadOnly(dialog_->radio_thin);
-       bc().addReadOnly(dialog_->radio_medium);
-       bc().addReadOnly(dialog_->radio_thick);
-       bc().addReadOnly(dialog_->radio_negative);
-       bc().addReadOnly(dialog_->radio_quadratin);
-       bc().addReadOnly(dialog_->radio_twoquadratin);
+       bcview().setCancel(dialog_->button_close);
 
-       bc().refresh();
+       bcview().addReadOnly(dialog_->button_negative);
+       bcview().addReadOnly(dialog_->button_negmedspace);
+       bcview().addReadOnly(dialog_->button_negthickspace);
+       bcview().addReadOnly(dialog_->button_thin);
+       bcview().addReadOnly(dialog_->button_medium);
+       bcview().addReadOnly(dialog_->button_thick);
+       bcview().addReadOnly(dialog_->button_quadratin);
+       bcview().addReadOnly(dialog_->button_twoquadratin);
 }
 
 
 void FormMathsSpace::apply()
 {
-       if (space_ > 0)
-               parent_.insertSymbol(latex_mathspace[space_]);
+       if (space_ >= 0)
+               controller().dispatchInsert(latex_mathspace[space_]);
 }
 
-bool FormMathsSpace::input(FL_OBJECT *, long data)
+ButtonPolicy::SMInput FormMathsSpace::input(FL_OBJECT *, long data)
 {
        space_ = -1;
-       if (data >= 0 && data < 6) {
+
+       if (data >= 0 && data < 8) {
                space_ = short(data);
+               apply();
        }
-       return true;
+       return ButtonPolicy::SMI_VALID;
 }