* \author John Levon
* \author Angus Leeming
*
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
*/
#include <config.h>
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
#include "FormMathsBitmap.h"
-#include "ControlMath.h"
-#include "xformsBC.h"
#include "bmtable.h"
#include "forms_gettext.h"
-#include "gettext.h"
-#include "support/LAssert.h"
-
-#include XPM_H_LOCATION
+#include "xformsBC.h"
-#include <algorithm>
+#include "ControlMath.h"
-extern "C" void C_FormBaseCancelCB(FL_OBJECT *, long);
-extern "C" void C_FormBaseInputCB(FL_OBJECT *, long);
-using std::vector;
using std::max;
+using std::vector;
+using std::string;
+
+extern "C" void C_FormDialogView_CancelCB(FL_OBJECT *, long);
+extern "C" void C_FormDialogView_InputCB(FL_OBJECT *, long);
FD_maths_bitmap::~FD_maths_bitmap()
{
}
-typedef FormCB<ControlMathSub, FormDB<FD_maths_bitmap> > base_class;
+typedef FormController<ControlMath, FormView<FD_maths_bitmap> > base_class;
-FormMathsBitmap::FormMathsBitmap(string const & t, vector<string> const & l)
- : base_class(t, false),
+FormMathsBitmap::FormMathsBitmap(Dialog & parent, string const & t, vector<string> const & l)
+ : base_class(parent, t, false),
latex_(l), ww_(0), x_(0), y_(0), w_(0), h_(0)
{
ww_ = 2 * FL_abs(FL_BOUND_WIDTH);
}
-void FormMathsBitmap::addBitmap(int nt, int nx, int ny, int bw, int bh,
- unsigned char const * data, bool vert)
+void FormMathsBitmap::addBitmap(BitmapStore const & bm)
{
- bitmaps_.push_back(BitmapStore(nt, nx, ny, bw, bh, data, vert));
+ bitmaps_.push_back(bm);
- int wx = bw + ww_ / 2;
- int wy = bh + ww_ / 2;
- wx += (wx % nx);
- wy += (wy % ny);
+ int wx = bm.bw + ww_ / 2;
+ int wy = bm.bh + ww_ / 2;
+ wx += (wx % bm.nx);
+ wy += (wy % bm.ny);
- if (vert) {
+ if (bm.vert) {
y_ += wy + 8;
h_ = max(y_, h_);
w_ = max(x_ + wx + ww_, w_);
void FormMathsBitmap::build()
{
- lyx::Assert(bitmaps_.size() > 0);
+ BOOST_ASSERT(bitmaps_.size() > 0);
h_+= 42; // Allow room for a Close button
it < bitmaps_.end(); ++it) {
FL_OBJECT * obj = buildBitmap(*it);
- bc().addReadOnly(obj);
+ bcview().addReadOnly(obj);
y_close = max(y_close, obj->y + obj->h);
}
bitmaps_.clear();
x_ = (fdui->form->w - 90) / 2;
y_ = y_close + 10;
- char const * const label = _("Close|^[");
+ string const label = _("Close|^[");
fdui->button_close = fl_add_button(FL_NORMAL_BUTTON, x_, y_, 90, 30,
idex(label).c_str());
fl_set_button_shortcut(fdui->button_close, scex(label).c_str(), 1);
fl_set_object_lsize(fdui->button_close, FL_NORMAL_SIZE);
- fl_set_object_callback(fdui->button_close, C_FormBaseCancelCB, 0);
+ fl_set_object_callback(fdui->button_close, C_FormDialogView_CancelCB, 0);
fl_end_form();
fdui->form->fdui = fdui;
dialog_.reset(fdui);
- bc().setCancel(dialog_->button_close);
}
fl_set_bmtable_data(obj, bmstore.nx, bmstore.ny, bmstore.bw, bmstore.bh,
bmstore.data);
fl_set_bmtable_maxitems(obj, bmstore.nt);
- fl_set_object_callback(obj, C_FormBaseInputCB, 0);
+ fl_set_object_callback(obj, C_FormDialogView_InputCB, 0);
if (bmstore.vert) {
y_ += wy + 8;
string::size_type const i = latex_chosen_.find(' ');
if (i != string::npos) {
controller().dispatchFunc(LFUN_MATH_MODE);
- controller().insertSymbol(latex_chosen_.substr(0,i));
- controller().insertSymbol(latex_chosen_.substr(i + 1), false);
+ controller().dispatchInsert(latex_chosen_.substr(0,i));
+ controller().dispatchInsert('\\' + latex_chosen_.substr(i + 1));
} else
- controller().insertSymbol(latex_chosen_);
+ controller().dispatchInsert(latex_chosen_);
}