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;
35 char h_align_str[80] = "c";
36 char v_align_c[] = "tcb";
41 QMathMatrixDialog::QMathMatrixDialog(QMathMatrix * form)
42 : QMathMatrixDialogBase(0, 0, false, 0),
45 setCaption(qt_("LyX: Insert Matrix"));
47 table->setMinimumSize(100, 100);
49 columnsSB->setValue(2);
50 valignCO->setCurrentItem(1);
52 connect(okPB, SIGNAL(clicked()),
53 this, SLOT(slotOK()));
54 connect(closePB, SIGNAL(clicked()),
55 this, SLOT(slotClose()));
59 void QMathMatrixDialog::columnsChanged(int)
61 int const nx = int(columnsSB->value());
62 for (int i = 0; i < nx; ++i)
65 h_align_str[nx] = '\0';
66 halignED->setText(h_align_str);
72 void QMathMatrixDialog::rowsChanged(int)
77 void QMathMatrixDialog::change_adaptor()
79 // FIXME: We need a filter for the halign input
83 void QMathMatrixDialog::slotOK()
85 char const c = v_align_c[valignCO->currentItem()];
86 string const sh = fromqstr(halignED->text());
87 int const nx = int(columnsSB->value());
88 int const ny = int(rowsSB->value());
91 os << nx << ' ' << ny << ' ' << c << ' ' << sh;
92 form_->controller().dispatchMatrix(os.str().c_str());
99 void QMathMatrixDialog::slotClose()
104 } // namespace frontend