+void GuiMathMatrix::slotOK()
+{
+ int const nx = columnsSB->value();
+ int const ny = rowsSB->value();
+ // a matrix without a decoration is an array,
+ // otherwise it is an AMS matrix that cannot have a vertical alignment
+ if (decorationCO->currentIndex() == 0) {
+ char v_align_c[] = "tcb";
+ char const c = v_align_c[valignCO->currentIndex()];
+ QString const sh = halignED->text();
+ string const str = fromqstr(
+ QString("%1 %2 %3 %4").arg(nx).arg(ny).arg(c).arg(sh));
+ dispatch(FuncRequest(LFUN_MATH_MATRIX, str));
+ } else {
+ int const deco = decorationCO->currentIndex();
+ QString deco_name;
+ switch (deco) {
+ case 1: deco_name = "bmatrix";
+ break;
+ case 2: deco_name = "pmatrix";
+ break;
+ case 3: deco_name = "Bmatrix";
+ break;
+ case 4: deco_name = "vmatrix";
+ break;
+ case 5: deco_name = "Vmatrix";
+ break;
+ }
+ string const str_ams = fromqstr(
+ QString("%1 %2 %3").arg(nx).arg(ny).arg(deco_name));
+ dispatch(FuncRequest(LFUN_MATH_AMS_MATRIX, str_ams));
+ }