]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormTabularCreate.C
Bugfixes: checkboxes to radiobuttons (from J�rgen S) and remove a little
[lyx.git] / src / frontends / xforms / FormTabularCreate.C
index b04a5d80ab3f732c828752dec662b1f978f4d123..2ec372345c2f6a924f83a3a9e16833f32861ac1b 100644 (file)
@@ -1,65 +1,39 @@
-// -*- C++ -*-
 /* This file is part of
  * ====================================================== 
  *
  *           LyX, The Document Processor
  *
- *           Copyright 2000 The LyX Team.
+ *           Copyright 2000-2001 The LyX Team.
  *
  * ======================================================
- */
-/* FormTabularCreate.C
- * FormTabularCreate Interface Class Implementation
+ *
+ * \file FormTabularCreate.C
  */
 
 #include <config.h>
+#include <utility>
 
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
+#include "xformsBC.h"
+#include "ControlTabularCreate.h"
 #include "FormTabularCreate.h"
 #include "form_tabular_create.h"
-#include "buffer.h"
-#include "BufferView.h"
-#include "Dialogs.h"
-#include "LyXView.h"
-#include "insets/insettabular.h"
 #include "support/lstrings.h"
 
-FormTabularCreate::FormTabularCreate(LyXView * lv, Dialogs * d)
-       : FormBaseBD(lv, d, _("Insert Tabular"))
-{
-       // let the dialog be shown
-       // This is a permanent connection so we won't bother
-       // storing a copy because we won't be disconnecting.
-       d->showTabularCreate.connect(slot(this, &FormTabularCreate::show));
-}
-
-
-FL_FORM * FormTabularCreate::form() const
-{
-       if (dialog_.get())
-               return dialog_->form;
-       return 0;
-}
-
+typedef FormCB<ControlTabularCreate, FormDB<FD_form_tabular_create> > base_class;
 
-void FormTabularCreate::connect()
-{
-       bc().valid(true);
-       FormBaseBD::connect();
-}
+FormTabularCreate::FormTabularCreate(ControlTabularCreate & c)
+       : base_class(c, _("Insert Tabular"))
+{}
 
 
 void FormTabularCreate::build()
 {
        dialog_.reset(build_tabular_create());
 
-       // Workaround dumb xforms sizing bug
-       minw_ = form()->w;
-       minh_ = form()->h;
-
        fl_set_slider_bounds(dialog_->slider_rows, 1, 50);
        fl_set_slider_bounds(dialog_->slider_columns, 1, 50);
        fl_set_slider_value(dialog_->slider_rows, 5);
@@ -71,21 +45,13 @@ void FormTabularCreate::build()
        bc().setOK(dialog_->button_ok);
        bc().setApply(dialog_->button_apply);
        bc().setCancel(dialog_->button_cancel);
-       bc().refresh();
 }
 
 
 void FormTabularCreate::apply()
 {
-       int ysize = int(fl_get_slider_value(dialog_->slider_columns) + 0.5);
-       int xsize = int(fl_get_slider_value(dialog_->slider_rows) + 0.5);
+       unsigned int ysize = (unsigned int)(fl_get_slider_value(dialog_->slider_columns) + 0.5);
+       unsigned int xsize = (unsigned int)(fl_get_slider_value(dialog_->slider_rows) + 0.5);
 
-       string tmp = tostr(xsize) + " " + tostr(ysize);
-       lv_->getLyXFunc()->Dispatch(LFUN_INSET_TABULAR, tmp);
-}
-
-
-void FormTabularCreate::update()
-{
-       bc().readOnly(lv_->buffer()->isReadonly());
+       controller().params() = std::make_pair(xsize, ysize);
 }