]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormMathsMatrix.C
remove defaults stuff, let Qt handle no toolbar
[lyx.git] / src / frontends / xforms / FormMathsMatrix.C
index db68165677d35c230ddc54bf2578ca1be9fb5e10..10541873a85b3e4564bc923c386e16a856f29412 100644 (file)
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
 
 #include "FormMathsMatrix.h"
 #include "forms/form_maths_matrix.h"
-
-#include "funcrequest.h"
-#include "lyxfunc.h"
-
-#include "frontends/LyXView.h"
+#include "ControlMath.h"
+#include "xformsBC.h"
+#include "ButtonController.h"
 
 #include "support/LAssert.h"
 #include "support/lyxalgo.h" // lyx::count
@@ -59,18 +54,11 @@ extern "C" {
 }
 
 
-FormMathsMatrix::FormMathsMatrix(LyXView & lv, Dialogs & d,
-                                FormMathsPanel const & p)
-       : FormMathsSub(lv, d, p, _("Maths Matrix"), false)
-{}
-
+typedef FormCB<ControlMathSub, FormDB<FD_maths_matrix> > base_class;
 
-FL_FORM * FormMathsMatrix::form() const
-{
-       if (dialog_.get())
-               return dialog_->form;
-       return 0;
-}
+FormMathsMatrix::FormMathsMatrix()
+       : base_class(_("Maths Matrix"), false)
+{}
 
 
 void FormMathsMatrix::build()
@@ -85,14 +73,14 @@ void FormMathsMatrix::build()
                            C_FormMathsMatrixAlignFilter);
        setPrehandler(dialog_->input_halign);
 
-       bc().setOK(dialog_->button_ok);
-       bc().setApply(dialog_->button_apply);
-       bc().setCancel(dialog_->button_close);
+       bcview().setOK(dialog_->button_ok);
+       bcview().setApply(dialog_->button_apply);
+       bcview().setCancel(dialog_->button_close);
 
-       bc().addReadOnly(dialog_->slider_rows);
-       bc().addReadOnly(dialog_->slider_columns);
-       bc().addReadOnly(dialog_->choice_valign);
-       bc().addReadOnly(dialog_->input_halign);
+       bcview().addReadOnly(dialog_->slider_rows);
+       bcview().addReadOnly(dialog_->slider_columns);
+       bcview().addReadOnly(dialog_->choice_valign);
+       bcview().addReadOnly(dialog_->input_halign);
 }
 
 
@@ -105,15 +93,20 @@ void FormMathsMatrix::apply()
 
        ostringstream os;
        os << nx << ' ' << ny << ' ' << c << ' ' << sh;
+       controller().dispatchFunc(LFUN_INSERT_MATRIX, STRCONV(os.str()));
+}
 
-       lv_.dispatch(FuncRequest(LFUN_INSERT_MATRIX, STRCONV(os.str())));
+
+void FormMathsMatrix::update()
+{
+       bc().valid();
 }
 
 
-bool FormMathsMatrix::input(FL_OBJECT * ob, long)
+ButtonPolicy::SMInput FormMathsMatrix::input(FL_OBJECT * ob, long)
 {
        if (ob == dialog_->choice_valign ||
-           ob == dialog_->slider_rows) return true;
+           ob == dialog_->slider_rows) return ButtonPolicy::SMI_VALID;
 
        int const nx = int(fl_get_slider_value(dialog_->slider_columns)+0.5);
        for (int i = 0; i < nx; ++i)
@@ -123,7 +116,7 @@ bool FormMathsMatrix::input(FL_OBJECT * ob, long)
 
        fl_set_input(dialog_->input_halign, h_align_str);
        fl_redraw_object(dialog_->input_halign);
-       return true;
+       return ButtonPolicy::SMI_VALID;
 }