-/* This file is part of
- * ======================================================
- *
- * LyX, The Document Processor
- *
- * Copyright 2000-2001 The LyX Team.
+/**
+ * \file FormTabularCreate.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * ======================================================
+ * \author Jürgen Vigna
*
- * \file FormTabularCreate.C
+ * Full author contact details are available in file CREDITS.
*/
#include <config.h>
-#ifdef __GNUG__
-#pragma implementation
-#endif
+#include "FormTabularCreate.h"
+#include "ControlTabularCreate.h"
+#include "forms/form_tabular_create.h"
+#include "Tooltips.h"
#include "xformsBC.h"
-#include "ControlTabularCreate.h"
-#include "FormTabularCreate.h"
-#include "form_tabular_create.h"
-#include "support/lstrings.h"
-typedef FormCB<ControlTabularCreate, FormDB<FD_form_tabular_create> > base_class;
+#include "lyx_forms.h"
+
+using std::make_pair;
+using std::string;
+
+
+typedef FormController<ControlTabularCreate, FormView<FD_tabular_create> > base_class;
-FormTabularCreate::FormTabularCreate(ControlTabularCreate & c)
- : base_class(c, _("Insert Tabular"))
+FormTabularCreate::FormTabularCreate(Dialog & parent)
+ : base_class(parent, _("Insert Table"))
{}
void FormTabularCreate::build()
{
- dialog_.reset(build_tabular_create());
-
- 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);
- fl_set_slider_value(dialog_->slider_columns, 5);
- fl_set_slider_precision(dialog_->slider_rows, 0);
- fl_set_slider_precision(dialog_->slider_columns, 0);
-
- // Manage the ok, apply and cancel/close buttons
- bc().setOK(dialog_->button_ok);
- bc().setApply(dialog_->button_apply);
- bc().setCancel(dialog_->button_cancel);
- bc().refresh();
+ dialog_.reset(build_tabular_create(this));
+
+ // Manage the ok, apply and cancel/close buttons
+ bcview().setOK(dialog_->button_ok);
+ bcview().setApply(dialog_->button_apply);
+ bcview().setCancel(dialog_->button_close);
+
+ // set up the tooltips
+ string str = _("Number of columns in the tabular.");
+ tooltips().init(dialog_->slider_columns, str);
+ str = _("Number of rows in the tabular.");
+ tooltips().init(dialog_->slider_rows, str);
}
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);
- controller().params() = tostr(xsize) + " " + tostr(ysize);
+ controller().params() = make_pair(xsize, ysize);
}