2 * \file QMathMatrixDialog.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Juergen Spitzmueller
8 * Full author contact details are available in file CREDITS.
13 #include "qt_helpers.h"
16 #include "ControlMath.h"
19 #include "QMathMatrixDialog.h"
21 #include <qcombobox.h>
22 #include <qlineedit.h>
23 #include <qpushbutton.h>
25 #include "emptytable.h"
28 static char h_align_str[80] = "c";
29 static char v_align_c[] = "tcb";
32 QMathMatrixDialog::QMathMatrixDialog(QMathMatrix * form)
33 : QMathMatrixDialogBase(0, 0, false, 0),
36 setCaption(qt_("LyX: Insert Matrix"));
38 table->setMinimumSize(100, 100);
40 columnsSB->setValue(2);
41 valignCO->setCurrentItem(1);
43 connect(okPB, SIGNAL(clicked()),
44 this, SLOT(slotOK()));
45 connect(closePB, SIGNAL(clicked()),
46 this, SLOT(slotClose()));
50 void QMathMatrixDialog::columnsChanged(int)
52 int const nx = int(columnsSB->value());
53 for (int i = 0; i < nx; ++i)
56 h_align_str[nx] = '\0';
57 halignED->setText(h_align_str);
63 void QMathMatrixDialog::rowsChanged(int)
68 void QMathMatrixDialog::change_adaptor()
70 // FIXME: We need a filter for the halign input
74 void QMathMatrixDialog::slotOK()
76 char const c = v_align_c[valignCO->currentItem()];
77 string const sh = fromqstr(halignED->text());
78 int const nx = int(columnsSB->value());
79 int const ny = int(rowsSB->value());
82 os << nx << ' ' << ny << ' ' << c << ' ' << sh;
83 form_->controller().dispatchMatrix(os.str().c_str());
90 void QMathMatrixDialog::slotClose()