]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormMathsPanel.h
fix crash with "save as"
[lyx.git] / src / frontends / xforms / FormMathsPanel.h
index 617922f31eb54a3e49025aecad1d0f9f12aecbab..f70c1468674e4bdb478a0dbf1c657d77395ebeaa 100644 (file)
 #ifndef FORM_MATHSPANEL_H
 #define FORM_MATHSPANEL_H
 
-#include "commandtags.h"
-
 #ifdef __GNUG__
 #pragma interface
 #endif
 
-#include "MathsCallbacks.h"
-#include "FormBaseDeprecated.h"
-
-#include <boost/scoped_ptr.hpp>
+#include "FormBase.h"
 
-class FormMathsBitmap;
-class FormMathsDeco;
-class FormMathsDelim;
-class FormMathsMatrix;
-class FormMathsSpace;
-class FormMathsStyle;
-class FormMathsSub;
+class ControlMath;
 struct FD_maths_panel;
+class FormMathsBitmap;
 
 /**
  * This class provides an XForms implementation of the maths panel.
  */
-class FormMathsPanel : public FormBaseBD {
+class FormMathsPanel : public FormCB<ControlMath, FormDB<FD_maths_panel> > {
 public:
        ///
-       FormMathsPanel(LyXView &, Dialogs &);
-       ///
-       void setActive(FormMathsSub *) const;
-       /// dispatch an LFUN:
-       void dispatchFunc(kb_action action) const;
-       /// dispatch a symbol insert
-       void insertSymbol(string const & sym, bool bs = true) const;
-private:
-       /// Pointer to the actual instantiation of the ButtonController.
-       virtual xformsBC & bc();
-
-       /// Build the dialog
-       virtual void build();
-       /// input handler
-       virtual bool input(FL_OBJECT *, long);
-
-       /// Pointer to the actual instantiation of the xforms form
-       virtual FL_FORM * form() const;
-
-       // Real GUI implementation
-       boost::scoped_ptr<FD_maths_panel> dialog_;
-
-       /// send LFUN_MATH_DISPLAY
-       void mathDisplay() const;
-
-       /// Subdialogs
-       boost::scoped_ptr<FormMathsDeco>   deco_;
-       boost::scoped_ptr<FormMathsDelim>  delim_;
-       boost::scoped_ptr<FormMathsMatrix> matrix_;
-       boost::scoped_ptr<FormMathsSpace>  space_;
-       boost::scoped_ptr<FormMathsStyle>  style_;
-       boost::scoped_ptr<FormMathsBitmap> arrow_;
-       boost::scoped_ptr<FormMathsBitmap> boperator_;
-       boost::scoped_ptr<FormMathsBitmap> brelats_;
-       boost::scoped_ptr<FormMathsBitmap> greek_;
-       boost::scoped_ptr<FormMathsBitmap> misc_;
-       boost::scoped_ptr<FormMathsBitmap> dots_;
-       boost::scoped_ptr<FormMathsBitmap> varsize_;
-       boost::scoped_ptr<FormMathsBitmap> ams_misc_;
-       boost::scoped_ptr<FormMathsBitmap> ams_arrows_;
-       boost::scoped_ptr<FormMathsBitmap> ams_rel_;
-       boost::scoped_ptr<FormMathsBitmap> ams_nrel_;
-       boost::scoped_ptr<FormMathsBitmap> ams_ops_;
+       FormMathsPanel();
 
-       /// A pointer to the currently active subdialog
-       mutable FormMathsSub * active_;
-
-       /// The ButtonController
-       ButtonController<OkCancelReadOnlyPolicy, xformsBC> bc_;
-};
-
-
-class FormMathsSub : public FormBaseBD {
-       friend class FormMathsPanel; // has subdialogs to manipulate
-
-public:
+private:
+       /// Not needed.
+       virtual void apply() {}
        ///
-       FormMathsSub(LyXView &, Dialogs &, FormMathsPanel const &,
-                    string const &, bool allowResize = true);
+       virtual void update() {}
 
-protected:
-       /// Pointer to the actual instantiation of the ButtonController.
-       virtual xformsBC & bc();
-       /// The parent Maths Panel
-       FormMathsPanel const & parent_;
-private:
        ///
-       virtual void connect();
+       virtual void build();
        ///
-       virtual void disconnect();
-       /// The ButtonController
-       ButtonController<IgnorantPolicy, xformsBC> bc_;
-};
-
+       virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
 
-inline
-xformsBC & FormMathsSub::bc()
-{
-       return bc_;
-}
+       /** Add a bitmap dialog to the store of all daughters_ and
+        *  return a pointer to the dialog, so that bitmaps can be added to it.
+        */
+       FormMathsBitmap * addDaughter(void * button, string const & title,
+                                     char const * const * data, int size);
+};
 
-inline
-xformsBC & FormMathsPanel::bc()
-{
-       return bc_;
-}
 #endif //  FORM_MATHSPANEL_H