]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormMathsSpace.C
fix crash with "save as"
[lyx.git] / src / frontends / xforms / FormMathsSpace.C
index 8403687f16deefeba0c1a1fb7426334a8f7fff1a..b22f11c2edf5c66581cbc5a8e94ea859e94f0814 100644 (file)
@@ -1,6 +1,7 @@
 /**
  * \file FormMathsSpace.C
- * 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
 
 #include "FormMathsSpace.h"
 #include "forms/form_maths_space.h"
+#include "ControlMath.h"
+#include "xformsBC.h"
+
 #include FORMS_H_LOCATION
 
 extern char * latex_mathspace[];
 
-FormMathsSpace::FormMathsSpace(LyXView & lv, Dialogs & d,
-                              FormMathsPanel const & p)
-       : FormMathsSub(lv, d, p, _("Maths Spacing"), false),
+typedef FormCB<ControlMathSub, FormDB<FD_maths_space> > base_class;
+
+FormMathsSpace::FormMathsSpace()
+       : base_class(_("Maths 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(this));
@@ -45,10 +42,12 @@ void FormMathsSpace::build()
 
        bc().setCancel(dialog_->button_close);
 
+       bc().addReadOnly(dialog_->button_negative);
+       bc().addReadOnly(dialog_->button_negmedspace);
+       bc().addReadOnly(dialog_->button_negthickspace);
        bc().addReadOnly(dialog_->button_thin);
        bc().addReadOnly(dialog_->button_medium);
        bc().addReadOnly(dialog_->button_thick);
-       bc().addReadOnly(dialog_->button_negative);
        bc().addReadOnly(dialog_->button_quadratin);
        bc().addReadOnly(dialog_->button_twoquadratin);
 }
@@ -57,16 +56,16 @@ void FormMathsSpace::build()
 void FormMathsSpace::apply()
 {
        if (space_ >= 0)
-               parent_.insertSymbol(latex_mathspace[space_]);
+               controller().insertSymbol(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;
 }