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
14 #pragma implementation
19 #include "support/lstrings.h"
22 #include "QMathMatrixDialog.h"
24 #include <qcombobox.h>
26 #include <qlineedit.h>
27 #include <qpushbutton.h>
29 #include "emptytable.h"
32 static char h_align_str[80] = "c";
33 static char v_align_c[] = "tcb";
36 QMathMatrixDialog::QMathMatrixDialog(QMath * form)
37 : QMathMatrixDialogBase(0, 0, false, 0),
40 setCaption(_("LyX: Insert matrix"));
42 table->setMinimumSize(100,100);
44 columnsSB->setValue(2);
45 valignCO->setCurrentItem(1);
47 connect(okPB, SIGNAL(clicked()),
48 this, SLOT(slotOK()));
49 connect(closePB, SIGNAL(clicked()),
50 this, SLOT(slotClose()));
54 void QMathMatrixDialog::columnsChanged(int)
56 int const nx = int(columnsSB->value());
57 for (int i = 0; i < nx; ++i)
60 h_align_str[nx] = '\0';
61 halignED->setText(h_align_str);
67 void QMathMatrixDialog::rowsChanged(int)
72 void QMathMatrixDialog::change_adaptor()
74 // FIXME: We need a filter for the halign input
78 void QMathMatrixDialog::slotOK()
80 char const c = v_align_c[valignCO->currentItem()];
81 char const * sh = halignED->text().latin1();
82 int const nx = int(rowsSB->value());
83 int const ny = int(columnsSB->value());
86 os << nx << ' ' << ny << ' ' << c << ' ' << sh;
87 form_->insertMatrix(os.str().c_str());
94 void QMathMatrixDialog::slotClose()