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.
|
|
|
|
|
*
|
|
|
|
|
* \author J<EFBFBD>rgen Spitzm<EFBFBD>ller
|
|
|
|
|
*
|
|
|
|
|
* 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"
|
2007-11-29 07:04:28 +00:00
|
|
|
|
#include "support/gettext.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
|
|
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-02-05 12:43:19 +00:00
|
|
|
|
: GuiMath(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)) );
|
|
|
|
|
connect(valignCO, SIGNAL(highlighted(const QString&)),
|
|
|
|
|
this, SLOT(change_adaptor()));
|
|
|
|
|
connect(halignED, SIGNAL(textChanged(const QString&)),
|
|
|
|
|
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()];
|
2006-03-05 17:24:44 +00:00
|
|
|
|
string const sh = fromqstr(halignED->text());
|
|
|
|
|
int const nx = int(columnsSB->value());
|
|
|
|
|
int const ny = int(rowsSB->value());
|
|
|
|
|
|
|
|
|
|
ostringstream os;
|
|
|
|
|
os << nx << ' ' << ny << ' ' << c << ' ' << sh;
|
2007-10-07 20:34:09 +00:00
|
|
|
|
dispatchMatrix(os.str().c_str());
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
// close the dialog
|
|
|
|
|
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
|
|
|
|
|
2007-08-31 22:37:05 +00:00
|
|
|
|
#include "GuiMathMatrix_moc.cpp"
|