]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormMathsStyle.C
fix crash with "save as"
[lyx.git] / src / frontends / xforms / FormMathsStyle.C
index 4837052b2786833214b82285c943a642183b9bd9..0d784d23ef67f7e980bab03b9319738b93ae2200 100644 (file)
@@ -1,6 +1,7 @@
 /**
  * \file FormMathsStyle.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 "FormMathsStyle.h"
 #include "forms/form_maths_style.h"
-#include "bmtable.h"
+#include "ControlMath.h"
+#include "xformsBC.h"
 
-#include "debug.h"
+#include "bmtable.h"
 
 #include FORMS_H_LOCATION
 
@@ -38,22 +40,14 @@ kb_action latex_mathfontcmds[] = {
 };
 
 
+typedef FormCB<ControlMathSub, FormDB<FD_maths_style> > base_class;
 
-FormMathsStyle::FormMathsStyle(LyXView & lv, Dialogs & d,
-                              FormMathsPanel const & p)
-       : FormMathsSub(lv, d, p, _("Maths Styles & Fonts"), false),
+FormMathsStyle::FormMathsStyle()
+       : base_class(_("Maths Styles & Fonts"), false),
          style_(-1)
 {}
 
 
-FL_FORM * FormMathsStyle::form() const
-{
-       if (dialog_.get())
-               return dialog_->form;
-       return 0;
-}
-
-
 void FormMathsStyle::build()
 {
        dialog_.reset(build_maths_style(this));
@@ -85,21 +79,23 @@ void FormMathsStyle::build()
 void FormMathsStyle::apply()
 {
        if ((style_ >= 0) && (style_ < 4))
-               parent_.insertSymbol(latex_mathstyle[style_]);
+               controller().insertSymbol(latex_mathstyle[style_]);
        else if ((style_ >= 4) && (style_ < 14))
-               parent_.dispatchFunc(latex_mathfontcmds[style_ - 4]);
+               controller().dispatchFunc(latex_mathfontcmds[style_-4]);
 }
 
 
-bool FormMathsStyle::input(FL_OBJECT * ob, long data)
+ButtonPolicy::SMInput FormMathsStyle::input(FL_OBJECT * ob, long data)
 {
        style_ = fl_get_bmtable(ob);
-       if (style_ < 0) return false;
+       if (style_ < 0) return ButtonPolicy::SMI_INVALID;
+
        //if (ob == dialog_->bmtable_style1) style_ += 0;
        if (ob == dialog_->bmtable_style2) style_ += 1;
        if (ob == dialog_->bmtable_font1)  style_ += 4;
        if (ob == dialog_->bmtable_font2)  style_ += 9;
        if (data >= 12) style_ = short(data);
        apply();
-       return true;
+
+       return ButtonPolicy::SMI_VALID;
 }