2002-10-28 16:43:58 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file QMathMatrixDialog.C
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
2003-09-07 01:45:40 +00:00
|
|
|
|
* \author J<EFBFBD>rgen Spitzm<EFBFBD>ller
|
2002-10-28 16:43:58 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-10-28 16:43:58 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2002-12-17 20:37:13 +00:00
|
|
|
|
#include "qt_helpers.h"
|
2002-10-28 16:43:58 +00:00
|
|
|
|
|
2003-09-05 17:23:11 +00:00
|
|
|
|
#include "support/std_sstream.h"
|
2003-06-17 12:53:35 +00:00
|
|
|
|
#include "ControlMath.h"
|
2002-10-28 16:43:58 +00:00
|
|
|
|
|
|
|
|
|
#include "QMath.h"
|
|
|
|
|
#include "QMathMatrixDialog.h"
|
|
|
|
|
|
|
|
|
|
#include <qcombobox.h>
|
|
|
|
|
#include <qlineedit.h>
|
|
|
|
|
#include <qpushbutton.h>
|
|
|
|
|
#include <qspinbox.h>
|
|
|
|
|
#include "emptytable.h"
|
|
|
|
|
|
2003-09-05 18:02:24 +00:00
|
|
|
|
using std::ostringstream;
|
2003-10-06 15:43:21 +00:00
|
|
|
|
using std::string;
|
2003-09-05 18:02:24 +00:00
|
|
|
|
|
2004-05-19 15:11:37 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
namespace frontend {
|
2002-10-28 16:43:58 +00:00
|
|
|
|
|
2004-05-19 15:11:37 +00:00
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
|
|
char h_align_str[80] = "c";
|
|
|
|
|
char v_align_c[] = "tcb";
|
|
|
|
|
|
|
|
|
|
} // namespace anon
|
2002-10-28 16:43:58 +00:00
|
|
|
|
|
|
|
|
|
|
2003-06-17 00:30:47 +00:00
|
|
|
|
QMathMatrixDialog::QMathMatrixDialog(QMathMatrix * form)
|
2002-10-28 16:43:58 +00:00
|
|
|
|
: QMathMatrixDialogBase(0, 0, false, 0),
|
|
|
|
|
form_(form)
|
|
|
|
|
{
|
2003-04-30 02:09:06 +00:00
|
|
|
|
setCaption(qt_("LyX: Insert Matrix"));
|
2002-10-28 16:43:58 +00:00
|
|
|
|
|
2003-05-13 17:01:28 +00:00
|
|
|
|
table->setMinimumSize(100, 100);
|
2002-10-28 16:43:58 +00:00
|
|
|
|
rowsSB->setValue(2);
|
|
|
|
|
columnsSB->setValue(2);
|
|
|
|
|
valignCO->setCurrentItem(1);
|
|
|
|
|
|
|
|
|
|
connect(okPB, SIGNAL(clicked()),
|
|
|
|
|
this, SLOT(slotOK()));
|
|
|
|
|
connect(closePB, SIGNAL(clicked()),
|
|
|
|
|
this, SLOT(slotClose()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QMathMatrixDialog::columnsChanged(int)
|
|
|
|
|
{
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QMathMatrixDialog::rowsChanged(int)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QMathMatrixDialog::change_adaptor()
|
|
|
|
|
{
|
|
|
|
|
// FIXME: We need a filter for the halign input
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QMathMatrixDialog::slotOK()
|
|
|
|
|
{
|
|
|
|
|
char const c = v_align_c[valignCO->currentItem()];
|
2002-12-17 20:37:13 +00:00
|
|
|
|
string const sh = fromqstr(halignED->text());
|
2002-12-07 18:14:02 +00:00
|
|
|
|
int const nx = int(columnsSB->value());
|
|
|
|
|
int const ny = int(rowsSB->value());
|
2002-10-28 16:43:58 +00:00
|
|
|
|
|
|
|
|
|
ostringstream os;
|
|
|
|
|
os << nx << ' ' << ny << ' ' << c << ' ' << sh;
|
2003-06-12 14:21:04 +00:00
|
|
|
|
form_->controller().dispatchMatrix(os.str().c_str());
|
2002-12-01 22:59:25 +00:00
|
|
|
|
|
2002-10-28 16:43:58 +00:00
|
|
|
|
// close the dialog
|
|
|
|
|
close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QMathMatrixDialog::slotClose()
|
|
|
|
|
{
|
|
|
|
|
close();
|
|
|
|
|
}
|
2004-05-19 15:11:37 +00:00
|
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
|
} // namespace lyx
|