]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormMathsPanel.C
Martin's patches, Part II
[lyx.git] / src / frontends / xforms / FormMathsPanel.C
index fffe677b2dfb5a85c24ded3304587bb3d68d7217..bb9a3f135693efaa1c5dd681ab6bc3a0056eb66c 100644 (file)
@@ -41,6 +41,8 @@
 #include "matrix.xpm"
 #include "space.xpm"
 #include "sqrt.xpm"
+#include "sub.xpm"
+#include "super.xpm"
 
 #include "arrows.xbm"
 #include "bop.xbm"
@@ -54,7 +56,7 @@ using std::vector;
 using SigC::slot;
 
 FormMathsPanel::FormMathsPanel(LyXView * lv, Dialogs * d)
-       : FormBaseBD(lv, d, _("Maths Panel")),
+       : FormBaseBD(lv, d, _("Maths Panel"), false),
          active_(0), bc_("Close")
 {
        deco_.reset(  new FormMathsDeco(  lv, d, *this));
@@ -94,6 +96,13 @@ FormMathsPanel::FormMathsPanel(LyXView * lv, Dialogs * d)
        }
        misc_.reset(new FormMathsBitmap(lv, d, *this, latex));
 
+       latex.resize(nr_latex_dots);
+       for (StringVec::size_type i = 0; i<latex.size(); ++i) {
+               latex[i] = latex_dots[i];
+       }
+
+       dots_.reset(new FormMathsBitmap(lv, d, *this, latex));
+
        latex.resize(nr_latex_varsz);
        for (StringVec::size_type i = 0; i<latex.size(); ++i) {
                latex[i] = latex_varsz[i];
@@ -130,6 +139,10 @@ void FormMathsPanel::build()
                           const_cast<char**>(sqrt_xpm));
        fl_set_pixmap_data(dialog_->button_frac,
                           const_cast<char**>(frac));
+       fl_set_pixmap_data(dialog_->button_super,
+                          const_cast<char**>(super_xpm));
+       fl_set_pixmap_data(dialog_->button_sub,
+                          const_cast<char**>(sub_xpm));
        fl_set_pixmap_data(dialog_->button_delim,
                           const_cast<char**>(delim));
        fl_set_pixmap_data(dialog_->button_deco,
@@ -154,6 +167,8 @@ void FormMathsPanel::build()
        greek_->addBitmap(28, 7, 4, greek_width, greek_height, greek_bits);
 
        misc_->addBitmap(29, 5, 6, misc_width, misc_height, misc_bits);
+       dots_->addBitmap(4, 4, 1, dots_width, dots_height, dots_bits);
 
        varsize_->addBitmap(14, 3, 5, varsz_width, varsz_height, varsz_bits);
 
@@ -195,6 +210,12 @@ bool FormMathsPanel::input(FL_OBJECT *, long data)
                misc_->show();
                break;
 
+       case MM_DOTS:
+               if (active_ && active_ != dots_.get())
+                       active_->hide();
+               dots_->show();
+               break;
        case MM_VARSIZE:
                if (active_ && active_ != varsize_.get())
                        active_->hide();
@@ -209,6 +230,20 @@ bool FormMathsPanel::input(FL_OBJECT *, long data)
                insertSymbol("sqrt");
                break;
 
+       case MM_SUPER:
+               lv_->getLyXFunc()->dispatch(LFUN_SUPERSCRIPT);
+               break;
+
+       case MM_SUB:
+               lv_->getLyXFunc()->dispatch(LFUN_SUBSCRIPT);
+               break;
+
+       case MM_SUBSUPER:
+               lv_->getLyXFunc()->dispatch(LFUN_SUBSCRIPT);
+               lv_->getLyXFunc()->dispatch(LFUN_LEFT);
+               lv_->getLyXFunc()->dispatch(LFUN_SUPERSCRIPT);
+               break;
+
        case MM_DELIM:
                if (active_ && active_ != delim_.get())
                        active_->hide();
@@ -249,20 +284,20 @@ bool FormMathsPanel::input(FL_OBJECT *, long data)
 
 void FormMathsPanel::insertSymbol(string const & sym) const
 {
-       lv_->getLyXFunc()->Dispatch(LFUN_INSERT_MATH, sym);
+       lv_->getLyXFunc()->dispatch(LFUN_INSERT_MATH, '\\' + sym);
 }
 
 
 void FormMathsPanel::mathDisplay() const
 {
-       lv_->getLyXFunc()->Dispatch(LFUN_MATH_DISPLAY);
+       lv_->getLyXFunc()->dispatch(LFUN_MATH_DISPLAY);
 }
 
 
 
 FormMathsSub::FormMathsSub(LyXView * lv, Dialogs * d, FormMathsPanel const & p,
-                          string const & t)
-    : FormBaseBD(lv, d, t), parent_(p), bc_("Close")
+                          string const & t, bool allowResize)
+    : FormBaseBD(lv, d, t, allowResize), parent_(p), bc_("Close")
 {}