]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormMathsDeco.C
fix crash with "save as"
[lyx.git] / src / frontends / xforms / FormMathsDeco.C
index 461a15e160e6dcc5ca1b8a7e7cbc91ae3ed3b6a0..56e9a8f0c61db8a3ec92f1f46b7cabf3f91521f9 100644 (file)
@@ -1,57 +1,43 @@
 /**
  * \file FormMathsDeco.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_
+#ifdef __GNUG__
 #pragma implementation
 #endif
 
+#include "ControlMath.h"
 #include "FormMathsDeco.h"
-#include "form_maths_deco.h"
-#include "Dialogs.h"
+#include "forms/form_maths_deco.h"
+#include "xformsBC.h"
+
 #include "bmtable.h"
+#include FORMS_H_LOCATION
 
 #include "deco.xbm"
 
 
-static char const * decoration_names[] = {
-       "widehat", "widetilde", "overbrace", "overleftarrow", "overrightarrow", 
-       "overline", "underbrace", "underline", "underleftarrow", "underrightarrow",
-       "underleftrightarrow", "overleftrightarrow",
-       "hat", "acute", "bar", "dot",
-       "check", "grave", "vec", "ddot", 
-       "breve", "tilde"
-};
+typedef FormCB<ControlMathSub, FormDB<FD_maths_deco> > base_class;
 
-
-static int const nr_decoration_names = sizeof(decoration_names) / sizeof(char const *);
-FormMathsDeco::FormMathsDeco(LyXView * lv, Dialogs * d,
-                            FormMathsPanel const & p)
-       : FormMathsSub(lv, d, p, _("Maths Decorations & Accents"), false)
+FormMathsDeco::FormMathsDeco()
+       : base_class(_("Maths Decorations & Accents"), false)
 {}
 
 
-FL_FORM * FormMathsDeco::form() const
-{
-       if (dialog_.get())
-               return dialog_->form;
-       return 0;
-}
-
-
 void FormMathsDeco::build()
 {
-       dialog_.reset(build_maths_deco());
+       dialog_.reset(build_maths_deco(this));
 
        fl_set_bmtable_data(dialog_->bmtable_deco1, 3, 4,
                            deco1_width, deco1_height, deco1_bits);
@@ -69,21 +55,20 @@ void FormMathsDeco::build()
 
 void FormMathsDeco::apply()
 {
-       if (deco_ < nr_decoration_names)
-               parent_.insertSymbol(decoration_names[deco_]);
+       if (deco_ < nr_latex_deco)
+               controller().insertSymbol(latex_deco[deco_]);
 }
 
 
-bool FormMathsDeco::input(FL_OBJECT * ob, long)
+ButtonPolicy::SMInput FormMathsDeco::input(FL_OBJECT * ob, long)
 {
        deco_ = fl_get_bmtable(ob);
        if (deco_ < 0)
-               return false;
+               return ButtonPolicy::SMI_INVALID;
        //if (ob == dialog_->bmtable_deco1)
-       //      deco_ += 0; 
+       //      deco_ += 0;
        if (ob == dialog_->bmtable_deco2)
-               deco_ += 10;
+               deco_ += 12;
        apply();
-       return true;
+       return ButtonPolicy::SMI_VALID;
 }
-