2006-03-05 17:24:44 +00:00
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiTabularCreate.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 John Levon
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiTabularCreate.h"
|
2007-09-05 20:33:29 +00:00
|
|
|
|
2007-04-26 03:53:02 +00:00
|
|
|
#include "EmptyTable.h"
|
2007-10-06 09:39:29 +00:00
|
|
|
#include "FuncRequest.h"
|
|
|
|
|
|
|
|
#include "support/convert.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-04-24 17:46:08 +00:00
|
|
|
#include <QSpinBox>
|
|
|
|
#include <QPushButton>
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
using namespace std;
|
2007-09-05 20:33:29 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2007-11-23 09:44:02 +00:00
|
|
|
GuiTabularCreate::GuiTabularCreate(GuiView & lv)
|
2008-02-05 12:43:19 +00:00
|
|
|
: GuiDialog(lv, "tabularcreate", qt_("Insert Table"))
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
|
|
|
setupUi(this);
|
|
|
|
|
|
|
|
rowsSB->setValue(5);
|
|
|
|
columnsSB->setValue(5);
|
2015-05-01 16:11:57 +00:00
|
|
|
table->setMinimumSize(100, 100);
|
|
|
|
|
|
|
|
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)));
|
2007-04-24 17:46:08 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
|
|
|
|
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
|
2007-08-12 12:51:00 +00:00
|
|
|
|
|
|
|
connect(rowsSB, SIGNAL(valueChanged(int)),
|
|
|
|
this, SLOT(rowsChanged(int)));
|
|
|
|
connect(columnsSB, SIGNAL(valueChanged(int)),
|
2007-04-24 17:46:08 +00:00
|
|
|
this, SLOT(columnsChanged(int)));
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
bc().setPolicy(ButtonPolicy::IgnorantPolicy);
|
|
|
|
bc().setOK(okPB);
|
|
|
|
bc().setCancel(closePB);
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:39:29 +00:00
|
|
|
void GuiTabularCreate::columnsChanged(int)
|
2007-04-24 17:46:08 +00:00
|
|
|
{
|
2007-10-06 09:39:29 +00:00
|
|
|
changed();
|
2007-04-24 17:46:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:39:29 +00:00
|
|
|
void GuiTabularCreate::rowsChanged(int)
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
changed();
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:39:29 +00:00
|
|
|
void GuiTabularCreate::applyView()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-10-06 09:39:29 +00:00
|
|
|
params_.first = rowsSB->value();
|
|
|
|
params_.second = columnsSB->value();
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 09:39:29 +00:00
|
|
|
bool GuiTabularCreate::initialiseParams(string const &)
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-10-06 09:39:29 +00:00
|
|
|
params_.first = 5;
|
|
|
|
params_.second = 5;
|
|
|
|
return true;
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
2007-10-06 09:39:29 +00:00
|
|
|
|
|
|
|
void GuiTabularCreate::clearParams()
|
|
|
|
{
|
|
|
|
params_.first = 0;
|
|
|
|
params_.second = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiTabularCreate::dispatchParams()
|
|
|
|
{
|
|
|
|
string const data = convert<string>(params().first) + ' ' + convert<string>(params().second);
|
|
|
|
dispatch(FuncRequest(getLfun(), data));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-23 09:44:02 +00:00
|
|
|
Dialog * createGuiTabularCreate(GuiView & lv)
|
2007-10-06 09:39:29 +00:00
|
|
|
{
|
|
|
|
return new GuiTabularCreate(lv);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2007-04-24 17:46:08 +00:00
|
|
|
|
2008-11-14 14:28:50 +00:00
|
|
|
#include "moc_GuiTabularCreate.cpp"
|