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 "QMathMatrixDialog.h"
16 #include "emptytable.h"
17 #include "qt_helpers.h"
19 #include "controllers/ControlMath.h"
21 #include "support/std_sstream.h"
23 #include <qcombobox.h>
24 #include <qlineedit.h>
25 #include <qpushbutton.h>
28 using std::ostringstream;
36 char h_align_str[80] = "c";
37 char v_align_c[] = "tcb";
42 QMathMatrixDialog::QMathMatrixDialog(QMathMatrix * form)
43 : QMathMatrixDialogBase(0, 0, false, 0),
46 setCaption(qt_("LyX: Insert Matrix"));
48 table->setMinimumSize(100, 100);
50 columnsSB->setValue(2);
51 valignCO->setCurrentItem(1);
53 connect(okPB, SIGNAL(clicked()),
54 this, SLOT(slotOK()));
55 connect(closePB, SIGNAL(clicked()),
56 this, SLOT(slotClose()));
60 void QMathMatrixDialog::columnsChanged(int)
62 int const nx = int(columnsSB->value());
63 for (int i = 0; i < nx; ++i)
66 h_align_str[nx] = '\0';
67 halignED->setText(h_align_str);
73 void QMathMatrixDialog::rowsChanged(int)
78 void QMathMatrixDialog::change_adaptor()
80 // FIXME: We need a filter for the halign input
84 void QMathMatrixDialog::slotOK()
86 char const c = v_align_c[valignCO->currentItem()];
87 string const sh = fromqstr(halignED->text());
88 int const nx = int(columnsSB->value());
89 int const ny = int(rowsSB->value());
92 os << nx << ' ' << ny << ' ' << c << ' ' << sh;
93 form_->controller().dispatchMatrix(os.str().c_str());
100 void QMathMatrixDialog::slotClose()
105 } // namespace frontend