]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormMathsBitmap.C
Yet more dialog tweaking from Rob.
[lyx.git] / src / frontends / xforms / FormMathsBitmap.C
index 932fe932576575989d459145046a7ae829e049de..518650e739c3ff8b4f9053ebf18a310d73d2a14a 100644 (file)
@@ -1,33 +1,33 @@
 /**
  * \file FormMathsBitmap.C
- * Copyright 2001 the LyX Team
- * Read the file COPYING
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
  * \author Alejandro Aguilar Sierra
- * \author John Levon, moz@compsoc.man.ac.uk
- * \author Angus Leeming, a.leeming@ic.ac.uk
+ * \author John Levon
+ * \author Angus Leeming 
+ *
+ * Full author contact details are available in file CREDITS
  */
 
 #include <config.h>
-#include <algorithm>
-#include <iomanip>
-#include XPM_H_LOCATION
 
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
 #include "FormMathsBitmap.h"
-
-#include "Dialogs.h"
-#include "LyXView.h"
 #include "bmtable.h"
 #include "debug.h"
-#include "xforms_helpers.h"
+#include "forms_gettext.h"
 #include "gettext.h"
 #include "support/LAssert.h"
 
+#include XPM_H_LOCATION
+
+#include <algorithm>
+#include <iomanip>
+
 using std::vector;
 using std::endl;
 using std::setw;
@@ -36,11 +36,11 @@ using std::max;
 extern  "C" void C_FormBaseDeprecatedCancelCB(FL_OBJECT *, long);
 extern  "C" void C_FormBaseDeprecatedInputCB(FL_OBJECT *, long);
 
-FormMathsBitmap::FormMathsBitmap(LyXView * lv, Dialogs * d,   
-                                FormMathsPanel const & p,
+FormMathsBitmap::FormMathsBitmap(LyXView & lv, Dialogs & d,
+                                FormMathsPanel const & p, string const & t,
                                 vector<string> const & l)
-       : FormMathsSub(lv, d, p, _("Maths Bitmaps"), false),
-         latex_(l), form_(0), ww_(0), x_(0), y_(0), w_(0), h_(0)
+       : FormMathsSub(lv, d, p, t, false),
+         latex_(l), ww_(0), x_(0), y_(0), w_(0), h_(0)
 {
        ww_ = 2 * FL_abs(FL_BOUND_WIDTH);
        x_ = y_ = ww_;
@@ -70,7 +70,7 @@ void FormMathsBitmap::build()
 
        h_+= 50; // Allow room for a Close button
 
-       form_.reset(fl_bgn_form(FL_UP_BOX, w_, h_));
+       form_.reset(fl_bgn_form(FL_UP_BOX, w_, h_), fl_free_form);
        form_->u_vdata = this;
 
        fl_add_box(FL_UP_BOX, 0, 0, w_, h_, "");
@@ -85,20 +85,20 @@ void FormMathsBitmap::build()
 
                y_ = max(y_, obj->y + obj->h);
        }
-       char const * const label = N_("Close|^[");
+
+       char const * const label = _("Close|^[");
        x_ = (form_->w - 90) / 2;
        y_ += 10;
 
-       FL_OBJECT * button_cancel =
+       FL_OBJECT * button_close =
                fl_add_button(FL_NORMAL_BUTTON, x_, y_, 90, 30, idex(_(label)));
-       fl_set_button_shortcut(button_cancel, scex(_(label)), 1);
-       fl_set_object_lsize(button_cancel, FL_NORMAL_SIZE);
-       fl_set_object_callback(button_cancel, C_FormBaseDeprecatedCancelCB, 0);
+       fl_set_button_shortcut(button_close, scex(_(label)), 1);
+       fl_set_object_lsize(button_close, FL_NORMAL_SIZE);
+       fl_set_object_callback(button_close, C_FormBaseDeprecatedCancelCB, 0);
 
        fl_end_form();
 
-       bc().setCancel(button_cancel);
+       bc().setCancel(button_close);
 }
 
 
@@ -106,7 +106,7 @@ void FormMathsBitmap::addBitmap(int nt, int nx, int ny, int bw, int bh,
                                unsigned char const * data, bool vert)
 {
        // Add a bitmap to a button panel: one bitmap per panel.
-       // nt is the number of buttons and nx, ny the nr. of buttons 
+       // nt is the number of buttons and nx, ny the nr. of buttons
        // in x and y direction.
        // bw, bh and data are the bitmap dimensions width, height and
        // bit pattern; these come directly from an .xbm file included
@@ -114,7 +114,7 @@ void FormMathsBitmap::addBitmap(int nt, int nx, int ny, int bw, int bh,
        // vert indicates whether the next button panel within this
        // window will be below (true, default) or next to this one.
        //
-       // The scaling of the bitmap on top of the buttons will be 
+       // The scaling of the bitmap on top of the buttons will be
        // correct if the nx, ny values are given correctly.
        int wx = bw + ww_ / 2;
        int wy = bh + ww_ / 2;
@@ -137,7 +137,7 @@ void FormMathsBitmap::addBitmap(int nt, int nx, int ny, int bw, int bh,
                h_ = max(y_ + wy + ww_, h_);
        }
 
-       bitmaps_.push_back(bm_ptr(obj));
+       bitmaps_.push_back(bm_ptr(obj, fl_free_object));
 }
 
 
@@ -171,7 +171,7 @@ bool FormMathsBitmap::input(FL_OBJECT * ob, long)
 {
        int const i = GetIndex(ob);
 
-       if (i < 0) 
+       if (i < 0)
                return false;
 
        latex_chosen_ = latex_[i];