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;
31 static char h_align_str[80] = "c";
32 static char v_align_c[] = "tcb";
35 QMathMatrixDialog::QMathMatrixDialog(QMathMatrix * form)
36 : QMathMatrixDialogBase(0, 0, false, 0),
39 setCaption(qt_("LyX: Insert Matrix"));
41 table->setMinimumSize(100, 100);
43 columnsSB->setValue(2);
44 valignCO->setCurrentItem(1);
46 connect(okPB, SIGNAL(clicked()),
47 this, SLOT(slotOK()));
48 connect(closePB, SIGNAL(clicked()),
49 this, SLOT(slotClose()));
53 void QMathMatrixDialog::columnsChanged(int)
55 int const nx = int(columnsSB->value());
56 for (int i = 0; i < nx; ++i)
59 h_align_str[nx] = '\0';
60 halignED->setText(h_align_str);
66 void QMathMatrixDialog::rowsChanged(int)
71 void QMathMatrixDialog::change_adaptor()
73 // FIXME: We need a filter for the halign input
77 void QMathMatrixDialog::slotOK()
79 char const c = v_align_c[valignCO->currentItem()];
80 string const sh = fromqstr(halignED->text());
81 int const nx = int(columnsSB->value());
82 int const ny = int(rowsSB->value());
85 os << nx << ' ' << ny << ' ' << c << ' ' << sh;
86 form_->controller().dispatchMatrix(os.str().c_str());
93 void QMathMatrixDialog::slotClose()