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 Jürgen Spitzmüller
8 * Full author contact details are available in file CREDITS.
13 #include "qt_helpers.h"
15 #include "support/std_sstream.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"
27 using std::ostringstream;
30 static char h_align_str[80] = "c";
31 static char v_align_c[] = "tcb";
34 QMathMatrixDialog::QMathMatrixDialog(QMathMatrix * form)
35 : QMathMatrixDialogBase(0, 0, false, 0),
38 setCaption(qt_("LyX: Insert Matrix"));
40 table->setMinimumSize(100, 100);
42 columnsSB->setValue(2);
43 valignCO->setCurrentItem(1);
45 connect(okPB, SIGNAL(clicked()),
46 this, SLOT(slotOK()));
47 connect(closePB, SIGNAL(clicked()),
48 this, SLOT(slotClose()));
52 void QMathMatrixDialog::columnsChanged(int)
54 int const nx = int(columnsSB->value());
55 for (int i = 0; i < nx; ++i)
58 h_align_str[nx] = '\0';
59 halignED->setText(h_align_str);
65 void QMathMatrixDialog::rowsChanged(int)
70 void QMathMatrixDialog::change_adaptor()
72 // FIXME: We need a filter for the halign input
76 void QMathMatrixDialog::slotOK()
78 char const c = v_align_c[valignCO->currentItem()];
79 string const sh = fromqstr(halignED->text());
80 int const nx = int(columnsSB->value());
81 int const ny = int(rowsSB->value());
84 os << nx << ' ' << ny << ' ' << c << ' ' << sh;
85 form_->controller().dispatchMatrix(os.str().c_str());
92 void QMathMatrixDialog::slotClose()