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"
15 #include "support/lstrings.h"
19 #include "QMathMatrixDialog.h"
21 #include <qcombobox.h>
23 #include <qlineedit.h>
24 #include <qpushbutton.h>
26 #include "emptytable.h"
29 static char h_align_str[80] = "c";
30 static char v_align_c[] = "tcb";
33 QMathMatrixDialog::QMathMatrixDialog(QMath * form)
34 : QMathMatrixDialogBase(0, 0, false, 0),
37 setCaption(qt_("LyX: Insert Matrix"));
39 table->setMinimumSize(100, 100);
41 columnsSB->setValue(2);
42 valignCO->setCurrentItem(1);
44 connect(okPB, SIGNAL(clicked()),
45 this, SLOT(slotOK()));
46 connect(closePB, SIGNAL(clicked()),
47 this, SLOT(slotClose()));
51 void QMathMatrixDialog::columnsChanged(int)
53 int const nx = int(columnsSB->value());
54 for (int i = 0; i < nx; ++i)
57 h_align_str[nx] = '\0';
58 halignED->setText(h_align_str);
64 void QMathMatrixDialog::rowsChanged(int)
69 void QMathMatrixDialog::change_adaptor()
71 // FIXME: We need a filter for the halign input
75 void QMathMatrixDialog::slotOK()
77 char const c = v_align_c[valignCO->currentItem()];
78 string const sh = fromqstr(halignED->text());
79 int const nx = int(columnsSB->value());
80 int const ny = int(rowsSB->value());
83 os << nx << ' ' << ny << ' ' << c << ' ' << sh;
84 form_->insertMatrix(os.str().c_str());
91 void QMathMatrixDialog::slotClose()