]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormMathsMatrix.C
Bugfixes: checkboxes to radiobuttons (from J�rgen S) and remove a little
[lyx.git] / src / frontends / xforms / FormMathsMatrix.C
index 186d5b4c7583840faba506d85bab3e1131b7972d..336321ede161e998013b09e901447f902c84088e 100644 (file)
@@ -15,6 +15,8 @@
 #pragma implementation
 #endif
 
+#include <algorithm>
+
 #include "FormMathsMatrix.h"
 #include "form_maths_matrix.h"
 #include "Dialogs.h"
@@ -22,6 +24,7 @@
 #include "Lsstream.h"
 #include "lyxfunc.h"
 #include "support/LAssert.h"
+#include "support/lyxalgo.h" // lyx::count
 
 #ifndef CXX_GLOBAL_CSTD
 using std::strlen;
@@ -92,7 +95,7 @@ void FormMathsMatrix::apply()
        int const ny = int(fl_get_slider_value(dialog_->slider_rows) + 0.5);
  
        ostringstream ost;
-       ost << nx << ' ' << ny << ' ' << c << sh;
+       ost << nx << ' ' << ny << ' ' << c << ' ' << sh;
  
        lv_->getLyXFunc()->dispatch(LFUN_INSERT_MATRIX, ost.str().c_str());
 }
@@ -116,12 +119,15 @@ bool FormMathsMatrix::input(FL_OBJECT * ob, long)
 
 int FormMathsMatrix::AlignFilter(char const * cur, int c)
 {
+       size_t len = strlen(cur);
+       
        int const n = int(fl_get_slider_value(dialog_->slider_columns) + 0.5) -
-               int(strlen(cur));
+               int(len) +
+               int(lyx::count(cur, cur + len, '|'));
        if (n < 0)
                return FL_INVALID;
 
-       if (c == 'c' || c == 'l' || c == 'r'
+       if (c == 'c' || c == 'l' || c == 'r' || c == '|')
                return FL_VALID;
  
        return FL_INVALID;