2006-03-05 17:24:44 +00:00
|
|
|
/**
|
2007-08-31 22:37:05 +00:00
|
|
|
* \file GuiMathMatrix.cpp
|
2006-03-05 17:24:44 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Jürgen Spitzmüller
|
2006-03-05 17:24:44 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2007-08-31 22:37:05 +00:00
|
|
|
#include "GuiMathMatrix.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-04-26 03:53:02 +00:00
|
|
|
#include "EmptyTable.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
#include "qt_helpers.h"
|
|
|
|
|
2008-06-02 10:05:29 +00:00
|
|
|
#include "FuncRequest.h"
|
|
|
|
|
2007-08-31 22:16:11 +00:00
|
|
|
#include <QLineEdit>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QSpinBox>
|
2007-04-19 21:42:42 +00:00
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
using namespace std;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2007-11-23 09:44:02 +00:00
|
|
|
GuiMathMatrix::GuiMathMatrix(GuiView & lv)
|
2008-06-02 10:05:29 +00:00
|
|
|
: GuiDialog(lv, "mathmatrix", qt_("Math Matrix"))
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
setupUi(this);
|
|
|
|
|
|
|
|
table->setMinimumSize(100, 100);
|
2007-05-07 18:30:41 +00:00
|
|
|
rowsSB->setValue(5);
|
|
|
|
columnsSB->setValue(5);
|
2006-08-17 08:57:44 +00:00
|
|
|
valignCO->setCurrentIndex(1);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-08-12 12:44:42 +00:00
|
|
|
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
|
|
|
|
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
|
|
|
|
|
|
|
|
connect(table, SIGNAL(rowsChanged(int)),
|
|
|
|
rowsSB, SLOT(setValue(int)));
|
|
|
|
connect(table, SIGNAL(colsChanged(int)),
|
|
|
|
columnsSB, SLOT(setValue(int)));
|
|
|
|
connect(rowsSB, SIGNAL(valueChanged(int)),
|
|
|
|
table, SLOT(setNumberRows(int)));
|
|
|
|
connect(columnsSB, SIGNAL(valueChanged(int)),
|
|
|
|
table, SLOT(setNumberColumns(int)));
|
|
|
|
connect(rowsSB, SIGNAL(valueChanged(int)),
|
|
|
|
this, SLOT(rowsChanged(int)));
|
|
|
|
connect(columnsSB, SIGNAL(valueChanged(int)),
|
|
|
|
this, SLOT(columnsChanged(int)) );
|
2008-04-20 21:05:35 +00:00
|
|
|
connect(valignCO, SIGNAL(highlighted(QString)),
|
2007-08-12 12:44:42 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
2008-04-20 21:05:35 +00:00
|
|
|
connect(halignED, SIGNAL(textChanged(QString)),
|
2007-08-12 12:44:42 +00:00
|
|
|
this, SLOT(change_adaptor()));
|
2007-09-05 20:33:29 +00:00
|
|
|
|
|
|
|
bc().setPolicy(ButtonPolicy::IgnorantPolicy);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-07 20:34:09 +00:00
|
|
|
void GuiMathMatrix::columnsChanged(int)
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-08-31 22:16:11 +00:00
|
|
|
char h_align_str[80] = "c";
|
2006-03-05 17:24:44 +00:00
|
|
|
int const nx = int(columnsSB->value());
|
|
|
|
for (int i = 0; i < nx; ++i)
|
|
|
|
h_align_str[i] = 'c';
|
|
|
|
|
|
|
|
h_align_str[nx] = '\0';
|
|
|
|
halignED->setText(h_align_str);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-07 20:34:09 +00:00
|
|
|
void GuiMathMatrix::rowsChanged(int)
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-07 20:34:09 +00:00
|
|
|
void GuiMathMatrix::change_adaptor()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
// FIXME: We need a filter for the halign input
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-07 20:34:09 +00:00
|
|
|
void GuiMathMatrix::slotOK()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-08-31 22:16:11 +00:00
|
|
|
char v_align_c[] = "tcb";
|
2006-08-17 08:57:44 +00:00
|
|
|
char const c = v_align_c[valignCO->currentIndex()];
|
2008-04-20 21:05:35 +00:00
|
|
|
QString const sh = halignED->text();
|
|
|
|
int const nx = columnsSB->value();
|
|
|
|
int const ny = rowsSB->value();
|
2008-06-02 09:26:27 +00:00
|
|
|
string const str = fromqstr(
|
|
|
|
QString("%1 %2 %3 %4").arg(nx).arg(ny).arg(c).arg(sh));
|
2008-06-02 10:05:29 +00:00
|
|
|
dispatch(FuncRequest(LFUN_MATH_MATRIX, str));
|
2006-03-05 17:24:44 +00:00
|
|
|
close();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-07 20:34:09 +00:00
|
|
|
void GuiMathMatrix::slotClose()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
close();
|
|
|
|
}
|
|
|
|
|
2007-10-07 20:34:09 +00:00
|
|
|
|
2007-11-23 09:44:02 +00:00
|
|
|
Dialog * createGuiMathMatrix(GuiView & lv) { return new GuiMathMatrix(lv); }
|
2007-10-07 20:34:09 +00:00
|
|
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2006-05-18 08:51:12 +00:00
|
|
|
|
2008-11-14 14:28:50 +00:00
|
|
|
#include "moc_GuiMathMatrix.cpp"
|