merge the tabular/gui related files

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17954 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2007-04-24 17:46:08 +00:00
parent 2c7f20e2ec
commit 078bdf9c27
10 changed files with 617 additions and 697 deletions

View File

@ -70,8 +70,6 @@ libqt4_la_SOURCES = \
QRef.C QRef.h \
QSendto.C QSendto.h \
QShowFile.C QShowFile.h \
QTabular.C QTabular.h \
QTabularCreate.C QTabularCreate.h \
Qt2BC.C Qt2BC.h \
checkedwidgets.C checkedwidgets.h \
panelstack.h panelstack.C \

View File

@ -124,8 +124,8 @@ MOCFILES = \
QShowFileDialog.C QShowFileDialog.h \
QSpellchecker.C QSpellchecker.h \
QDialogView.C QDialogView.h \
QTabularCreateDialog.C QTabularCreateDialog.h \
QTabularDialog.C QTabularDialog.h \
QTabularCreate.C QTabularCreate.h \
QTabular.C QTabular.h \
QTexinfo.C QTexinfo.h \
QThesaurus.C QThesaurus.h \
TocModel.C TocModel.h \

View File

@ -14,10 +14,10 @@
#include "checkedwidgets.h"
#include "QTabular.h"
#include "QTabularDialog.h"
#include "Qt2BC.h"
#include "lengthcombo.h"
#include "validators.h"
#include "qt_helpers.h"
#include "controllers/ButtonController.h"
@ -25,10 +25,12 @@
#include "support/convert.h"
#include <qcheckbox.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <QCloseEvent>
#include <QCheckBox>
#include <QPushButton>
#include <QRadioButton>
#include <QLineEdit>
#include "qsetborder.h"
using std::string;
@ -36,6 +38,485 @@ using std::string;
namespace lyx {
namespace frontend {
/////////////////////////////////////////////////////////////////////
//
// QTabularDialog
//
/////////////////////////////////////////////////////////////////////
QTabularDialog::QTabularDialog(QTabular * form)
: form_(form)
{
setupUi(this);
widthED->setValidator(unsignedLengthValidator(widthED));
topspaceED->setValidator(new LengthValidator(topspaceED));
bottomspaceED->setValidator(new LengthValidator(bottomspaceED));
interlinespaceED->setValidator(new LengthValidator(interlinespaceED));
connect(topspaceED, SIGNAL(returnPressed()),
this, SLOT(topspace_changed()));
connect(topspaceUnit, SIGNAL(selectionChanged(lyx::LyXLength::UNIT)),
this, SLOT(topspace_changed()));
connect(topspaceCO, SIGNAL(activated(int)), this, SLOT(topspace_changed()));
connect(bottomspaceED, SIGNAL(returnPressed()),
this, SLOT(bottomspace_changed()));
connect(bottomspaceUnit, SIGNAL(selectionChanged(lyx::LyXLength::UNIT)),
this, SLOT(bottomspace_changed()));
connect(bottomspaceCO, SIGNAL(activated(int)), this, SLOT(bottomspace_changed()));
connect(interlinespaceED, SIGNAL(returnPressed()),
this, SLOT(interlinespace_changed()));
connect(interlinespaceUnit, SIGNAL(selectionChanged(lyx::LyXLength::UNIT)),
this, SLOT(interlinespace_changed()));
connect(interlinespaceCO, SIGNAL(activated(int)), this, SLOT(interlinespace_changed()));
connect(booktabsRB, SIGNAL(clicked(bool)), this, SLOT(booktabsChanged(bool)));
connect(borderDefaultRB, SIGNAL(clicked(bool)), this, SLOT(booktabsChanged(bool)));
connect(borderSetPB, SIGNAL(clicked()), this, SLOT(borderSet_clicked()));
connect(borderUnsetPB, SIGNAL(clicked()), this, SLOT(borderUnset_clicked()));
connect(longTabularCB, SIGNAL(toggled(bool)), longtableGB, SLOT(setEnabled(bool)));
connect(longTabularCB, SIGNAL(toggled(bool)), newpageCB, SLOT(setEnabled(bool)));
connect(hAlignCB, SIGNAL(activated(int)), this, SLOT(hAlign_changed(int)));
connect(vAlignCB, SIGNAL(activated(int)), this, SLOT(vAlign_changed(int)));
connect(multicolumnCB, SIGNAL(clicked()), this, SLOT(multicolumn_clicked()));
connect(newpageCB, SIGNAL(clicked()), this, SLOT(ltNewpage_clicked()));
connect(headerStatusCB, SIGNAL(clicked()), this, SLOT(ltHeaderStatus_clicked()));
connect(headerBorderAboveCB, SIGNAL(clicked()), this, SLOT(ltHeaderBorderAbove_clicked()));
connect(headerBorderBelowCB, SIGNAL(clicked()), this, SLOT(ltHeaderBorderBelow_clicked()));
connect(firstheaderStatusCB, SIGNAL(clicked()), this, SLOT(ltFirstHeaderStatus_clicked()));
connect(firstheaderBorderAboveCB, SIGNAL(clicked()), this, SLOT(ltFirstHeaderBorderAbove_clicked()));
connect(firstheaderBorderBelowCB, SIGNAL(clicked()), this, SLOT(ltFirstHeaderBorderBelow_clicked()));
connect(firstheaderNoContentsCB, SIGNAL(clicked()), this, SLOT(ltFirstHeaderEmpty_clicked()));
connect(footerStatusCB, SIGNAL(clicked()), this, SLOT(ltFooterStatus_clicked()));
connect(footerBorderAboveCB, SIGNAL(clicked()), this, SLOT(ltFooterBorderAbove_clicked()));
connect(footerBorderBelowCB, SIGNAL(clicked()), this, SLOT(ltFooterBorderBelow_clicked()));
connect(lastfooterStatusCB, SIGNAL(clicked()), this, SLOT(ltLastFooterStatus_clicked()));
connect(lastfooterBorderAboveCB, SIGNAL(clicked()), this, SLOT(ltLastFooterBorderAbove_clicked()));
connect(lastfooterBorderBelowCB, SIGNAL(clicked()), this, SLOT(ltLastFooterBorderBelow_clicked()));
connect(lastfooterNoContentsCB, SIGNAL(clicked()), this, SLOT(ltLastFooterEmpty_clicked()));
connect(specialAlignmentED, SIGNAL(returnPressed()), this, SLOT(specialAlignment_changed()));
connect(widthED, SIGNAL(returnPressed()), this, SLOT(width_changed()));
connect(widthUnit, SIGNAL(selectionChanged(lyx::LyXLength::UNIT)), this, SLOT(width_changed()));
connect(closePB, SIGNAL(clicked()), this, SLOT(close_clicked()));
connect(borders, SIGNAL(topSet(bool)), this, SLOT(topBorder_changed()));
connect(borders, SIGNAL(bottomSet(bool)), this, SLOT(bottomBorder_changed()));
connect(borders, SIGNAL(rightSet(bool)), this, SLOT(rightBorder_changed()));
connect(borders, SIGNAL(leftSet(bool)), this, SLOT(leftBorder_changed()));
connect(rotateTabularCB, SIGNAL(clicked()), this, SLOT(rotateTabular()));
connect(rotateCellCB, SIGNAL(clicked()), this, SLOT(rotateCell()));
connect(longTabularCB, SIGNAL(clicked()), this, SLOT(longTabular()));
}
void QTabularDialog::change_adaptor()
{
form_->changed();
}
void QTabularDialog::closeEvent(QCloseEvent * e)
{
form_->slotWMHide();
e->accept();
}
void QTabularDialog::booktabsChanged(bool)
{
form_->changed();
form_->controller().booktabs(booktabsRB->isChecked());
form_->update_borders();
}
void QTabularDialog::topspace_changed()
{
switch(topspaceCO->currentIndex()) {
case 0: {
form_->controller().set(LyXTabular::SET_TOP_SPACE, "");
topspaceED->setEnabled(false);
topspaceUnit->setEnabled(false);
break;
}
case 1: {
form_->controller().set(LyXTabular::SET_TOP_SPACE, "default");
topspaceED->setEnabled(false);
topspaceUnit->setEnabled(false);
break;
}
case 2: {
if (!topspaceED->text().isEmpty())
form_->controller().set(LyXTabular::SET_TOP_SPACE,
widgetsToLength(topspaceED, topspaceUnit));
if (!form_->bc().bp().isReadOnly()) {
topspaceED->setEnabled(true);
topspaceUnit->setEnabled(true);
}
break;
}
}
form_->changed();
}
void QTabularDialog::bottomspace_changed()
{
switch(bottomspaceCO->currentIndex()) {
case 0: {
form_->controller().set(LyXTabular::SET_BOTTOM_SPACE, "");
bottomspaceED->setEnabled(false);
bottomspaceUnit->setEnabled(false);
break;
}
case 1: {
form_->controller().set(LyXTabular::SET_BOTTOM_SPACE, "default");
bottomspaceED->setEnabled(false);
bottomspaceUnit->setEnabled(false);
break;
}
case 2: {
if (!bottomspaceED->text().isEmpty())
form_->controller().set(LyXTabular::SET_BOTTOM_SPACE,
widgetsToLength(bottomspaceED, bottomspaceUnit));
if (!form_->bc().bp().isReadOnly()) {
bottomspaceED->setEnabled(true);
bottomspaceUnit->setEnabled(true);
}
break;
}
}
form_->changed();
}
void QTabularDialog::interlinespace_changed()
{
switch(interlinespaceCO->currentIndex()) {
case 0: {
form_->controller().set(LyXTabular::SET_INTERLINE_SPACE, "");
interlinespaceED->setEnabled(false);
interlinespaceUnit->setEnabled(false);
break;
}
case 1: {
form_->controller().set(LyXTabular::SET_INTERLINE_SPACE, "default");
interlinespaceED->setEnabled(false);
interlinespaceUnit->setEnabled(false);
break;
}
case 2: {
if (!interlinespaceED->text().isEmpty())
form_->controller().set(LyXTabular::SET_INTERLINE_SPACE,
widgetsToLength(interlinespaceED, interlinespaceUnit));
if (!form_->bc().bp().isReadOnly()) {
interlinespaceED->setEnabled(true);
interlinespaceUnit->setEnabled(true);
}
break;
}
}
form_->changed();
}
void QTabularDialog::close_clicked()
{
form_->closeGUI();
form_->slotClose();
}
void QTabularDialog::borderSet_clicked()
{
form_->controller().set(LyXTabular::SET_ALL_LINES);
form_->update_borders();
form_->changed();
}
void QTabularDialog::borderUnset_clicked()
{
form_->controller().set(LyXTabular::UNSET_ALL_LINES);
form_->update_borders();
form_->changed();
}
void QTabularDialog::leftBorder_changed()
{
form_->controller().toggleLeftLine();
form_->changed();
}
void QTabularDialog::rightBorder_changed()
{
form_->controller().toggleRightLine();
form_->changed();
}
void QTabularDialog::topBorder_changed()
{
form_->controller().toggleTopLine();
form_->changed();
}
void QTabularDialog::bottomBorder_changed()
{
form_->controller().toggleBottomLine();
form_->changed();
}
void QTabularDialog::specialAlignment_changed()
{
string special = fromqstr(specialAlignmentED->text());
form_->controller().setSpecial(special);
form_->changed();
}
void QTabularDialog::width_changed()
{
form_->changed();
string const width = widgetsToLength(widthED, widthUnit);
form_->controller().setWidth(width);
}
void QTabularDialog::multicolumn_clicked()
{
form_->controller().toggleMultiColumn();
form_->changed();
}
void QTabularDialog::rotateTabular()
{
form_->controller().rotateTabular(rotateTabularCB->isChecked());
form_->changed();
}
void QTabularDialog::rotateCell()
{
form_->controller().rotateCell(rotateCellCB->isChecked());
form_->changed();
}
void QTabularDialog::hAlign_changed(int align)
{
ControlTabular::HALIGN h = ControlTabular::LEFT;
switch (align) {
case 0: h = ControlTabular::LEFT; break;
case 1: h = ControlTabular::CENTER; break;
case 2: h = ControlTabular::RIGHT; break;
case 3: h = ControlTabular::BLOCK; break;
}
form_->controller().halign(h);
}
void QTabularDialog::vAlign_changed(int align)
{
ControlTabular::VALIGN v = ControlTabular::TOP;
switch (align) {
case 0: v = ControlTabular::TOP; break;
case 1: v = ControlTabular::MIDDLE; break;
case 2: v = ControlTabular::BOTTOM; break;
}
form_->controller().valign(v);
}
void QTabularDialog::longTabular()
{
form_->controller().longTabular(longTabularCB->isChecked());
form_->changed();
}
void QTabularDialog::ltNewpage_clicked()
{
form_->controller().set(LyXTabular::SET_LTNEWPAGE);
form_->changed();
}
void QTabularDialog::ltHeaderStatus_clicked()
{
bool enable(headerStatusCB->isChecked());
if (enable)
form_->controller().set(LyXTabular::SET_LTHEAD, "");
else
form_->controller().set(LyXTabular::UNSET_LTHEAD, "");
headerBorderAboveCB->setEnabled(enable);
headerBorderBelowCB->setEnabled(enable);
firstheaderNoContentsCB->setEnabled(enable);
form_->changed();
}
void QTabularDialog::ltHeaderBorderAbove_clicked()
{
if (headerBorderAboveCB->isChecked())
form_->controller().set(LyXTabular::SET_LTHEAD, "dl_above");
else
form_->controller().set(LyXTabular::UNSET_LTHEAD, "dl_above");
form_->changed();
}
void QTabularDialog::ltHeaderBorderBelow_clicked()
{
if (headerBorderBelowCB->isChecked())
form_->controller().set(LyXTabular::SET_LTHEAD, "dl_below");
else
form_->controller().set(LyXTabular::UNSET_LTHEAD, "dl_below");
form_->changed();
}
void QTabularDialog::ltFirstHeaderBorderAbove_clicked()
{
if (firstheaderBorderAboveCB->isChecked())
form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "dl_above");
else
form_->controller().set(LyXTabular::UNSET_LTFIRSTHEAD, "dl_above");
form_->changed();
}
void QTabularDialog::ltFirstHeaderBorderBelow_clicked()
{
if (firstheaderBorderBelowCB->isChecked())
form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "dl_below");
else
form_->controller().set(LyXTabular::UNSET_LTFIRSTHEAD, "dl_below");
form_->changed();
}
void QTabularDialog::ltFirstHeaderStatus_clicked()
{
bool enable(firstheaderStatusCB->isChecked());
if (enable)
form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "");
else
form_->controller().set(LyXTabular::UNSET_LTFIRSTHEAD, "");
firstheaderBorderAboveCB->setEnabled(enable);
firstheaderBorderBelowCB->setEnabled(enable);
form_->changed();
}
void QTabularDialog::ltFirstHeaderEmpty_clicked()
{
bool enable(firstheaderNoContentsCB->isChecked());
if (enable)
form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "empty");
else
form_->controller().set(LyXTabular::UNSET_LTFIRSTHEAD, "empty");
firstheaderStatusCB->setEnabled(!enable);
firstheaderBorderAboveCB->setEnabled(!enable);
firstheaderBorderBelowCB->setEnabled(!enable);
form_->changed();
}
void QTabularDialog::ltFooterStatus_clicked()
{
bool enable(footerStatusCB->isChecked());
if (enable)
form_->controller().set(LyXTabular::SET_LTFOOT, "");
else
form_->controller().set(LyXTabular::UNSET_LTFOOT, "");
footerBorderAboveCB->setEnabled(enable);
footerBorderBelowCB->setEnabled(enable);
lastfooterNoContentsCB->setEnabled(enable);
form_->changed();
}
void QTabularDialog::ltFooterBorderAbove_clicked()
{
if (footerBorderAboveCB->isChecked())
form_->controller().set(LyXTabular::SET_LTFOOT, "dl_above");
else
form_->controller().set(LyXTabular::UNSET_LTFOOT, "dl_above");
form_->changed();
}
void QTabularDialog::ltFooterBorderBelow_clicked()
{
if (footerBorderBelowCB->isChecked())
form_->controller().set(LyXTabular::SET_LTFOOT, "dl_below");
else
form_->controller().set(LyXTabular::UNSET_LTFOOT, "dl_below");
form_->changed();
}
void QTabularDialog::ltLastFooterStatus_clicked()
{
bool enable(lastfooterStatusCB->isChecked());
if (enable)
form_->controller().set(LyXTabular::SET_LTLASTFOOT, "");
else
form_->controller().set(LyXTabular::UNSET_LTLASTFOOT, "");
lastfooterBorderAboveCB->setEnabled(enable);
lastfooterBorderBelowCB->setEnabled(enable);
form_->changed();
}
void QTabularDialog::ltLastFooterBorderAbove_clicked()
{
if (lastfooterBorderAboveCB->isChecked())
form_->controller().set(LyXTabular::SET_LTLASTFOOT, "dl_above");
else
form_->controller().set(LyXTabular::UNSET_LTLASTFOOT, "dl_above");
form_->changed();
}
void QTabularDialog::ltLastFooterBorderBelow_clicked()
{
if (lastfooterBorderBelowCB->isChecked())
form_->controller().set(LyXTabular::SET_LTLASTFOOT, "dl_below");
else
form_->controller().set(LyXTabular::UNSET_LTLASTFOOT, "dl_below");
form_->changed();
}
void QTabularDialog::ltLastFooterEmpty_clicked()
{
bool enable(lastfooterNoContentsCB->isChecked());
if (enable)
form_->controller().set(LyXTabular::SET_LTLASTFOOT, "empty");
else
form_->controller().set(LyXTabular::UNSET_LTLASTFOOT, "empty");
lastfooterStatusCB->setEnabled(!enable);
lastfooterBorderAboveCB->setEnabled(!enable);
lastfooterBorderBelowCB->setEnabled(!enable);
form_->changed();
}
/////////////////////////////////////////////////////////////////////
//
// QTabular
//
/////////////////////////////////////////////////////////////////////
typedef QController<ControlTabular, QView<QTabularDialog> > tabular_base_class;
QTabular::QTabular(Dialog & parent)
@ -493,3 +974,6 @@ void QTabular::closeGUI()
} // namespace frontend
} // namespace lyx
#include "QTabular_moc.cpp"

View File

@ -16,11 +16,68 @@
#define QTABULAR_H
#include "QDialogView.h"
#include "QTabularDialog.h"
#include "ui/TabularUi.h"
#include <QDialog>
#include <QCloseEvent>
namespace lyx {
namespace frontend {
class QTabular;
class QTabularDialog : public QDialog, public Ui::QTabularUi {
Q_OBJECT
public:
QTabularDialog(QTabular * form);
protected Q_SLOTS:
virtual void change_adaptor();
virtual void topspace_changed();
virtual void bottomspace_changed();
virtual void interlinespace_changed();
virtual void booktabsChanged(bool);
virtual void close_clicked();
virtual void borderSet_clicked();
virtual void borderUnset_clicked();
virtual void leftBorder_changed();
virtual void rightBorder_changed();
virtual void topBorder_changed();
virtual void bottomBorder_changed();
virtual void multicolumn_clicked();
virtual void rotateTabular();
virtual void rotateCell();
virtual void hAlign_changed(int align);
virtual void vAlign_changed(int align);
virtual void specialAlignment_changed();
virtual void width_changed();
virtual void longTabular();
virtual void ltNewpage_clicked();
virtual void ltHeaderStatus_clicked();
virtual void ltHeaderBorderAbove_clicked();
virtual void ltHeaderBorderBelow_clicked();
virtual void ltFirstHeaderStatus_clicked();
virtual void ltFirstHeaderBorderAbove_clicked();
virtual void ltFirstHeaderBorderBelow_clicked();
virtual void ltFirstHeaderEmpty_clicked();
virtual void ltFooterStatus_clicked();
virtual void ltFooterBorderAbove_clicked();
virtual void ltFooterBorderBelow_clicked();
virtual void ltLastFooterStatus_clicked();
virtual void ltLastFooterBorderAbove_clicked();
virtual void ltLastFooterBorderBelow_clicked();
virtual void ltLastFooterEmpty_clicked();
protected:
virtual void closeEvent(QCloseEvent * e);
private:
QTabular * form_;
};
class ControlTabular;
class QTabular :

View File

@ -10,23 +10,67 @@
#include <config.h>
#include "QTabularCreateDialog.h"
#include "QTabularCreate.h"
#include "Qt2BC.h"
#include "emptytable.h"
#include "controllers/ControlTabularCreate.h"
#include <qspinbox.h>
#include <qpushbutton.h>
#include <QSpinBox>
#include <QPushButton>
namespace lyx {
namespace frontend {
typedef QController<ControlTabularCreate, QView<QTabularCreateDialog> > tabularcreate_base_class;
/////////////////////////////////////////////////////////////////////
//
// QTabularCreateDialog
//
/////////////////////////////////////////////////////////////////////
QTabularCreateDialog::QTabularCreateDialog(QTabularCreate * form)
: form_(form)
{
setupUi(this);
rowsSB->setValue(5);
columnsSB->setValue(5);
connect(okPB, SIGNAL(clicked()),
form_, SLOT(slotOK()));
connect(closePB, SIGNAL(clicked()),
form_, SLOT(slotClose()));
connect(rowsSB, SIGNAL(valueChanged(int)),
this, SLOT( rowsChanged(int)));
connect(columnsSB, SIGNAL(valueChanged(int)),
this, SLOT(columnsChanged(int)));
}
void QTabularCreateDialog::columnsChanged(int)
{
form_->changed();
}
void QTabularCreateDialog::rowsChanged(int)
{
form_->changed();
}
/////////////////////////////////////////////////////////////////////
//
// QTabularCreate
//
/////////////////////////////////////////////////////////////////////
typedef QController<ControlTabularCreate, QView<QTabularCreateDialog> >
TabularCreateBase;
QTabularCreate::QTabularCreate(Dialog & parent)
: tabularcreate_base_class(parent, _("Insert Table"))
: TabularCreateBase(parent, _("Insert Table"))
{
}
@ -48,3 +92,5 @@ void QTabularCreate::apply()
} // namespace frontend
} // namespace lyx
#include "QTabularCreate_moc.cpp"

View File

@ -13,14 +13,29 @@
#define QTABULARCREATE_H
#include "QDialogView.h"
#include "QTabularCreateDialog.h"
#include "ui/TabularCreateUi.h"
#include <QDialog>
namespace lyx {
namespace frontend {
class QTabularCreate;
class QTabularCreateDialog : public QDialog, public Ui::QTabularCreateUi {
Q_OBJECT
public:
QTabularCreateDialog(QTabularCreate * form);
protected Q_SLOTS:
virtual void columnsChanged(int);
virtual void rowsChanged(int);
private:
QTabularCreate * form_;
};
class ControlTabularCreate;
///
class QTabularCreate
: public QController<ControlTabularCreate, QView<QTabularCreateDialog> >
{

View File

@ -1,57 +0,0 @@
/**
* \file QTabularCreateDialog.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
* \author Edwin Leuven
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "QTabularCreateDialog.h"
#include "QTabularCreate.h"
#include <qpushbutton.h>
#include <qspinbox.h>
#include "emptytable.h"
namespace lyx {
namespace frontend {
QTabularCreateDialog::QTabularCreateDialog(QTabularCreate * form)
: form_(form)
{
setupUi(this);
rowsSB->setValue(5);
columnsSB->setValue(5);
connect(okPB, SIGNAL(clicked()),
form_, SLOT(slotOK()));
connect(closePB, SIGNAL(clicked()),
form_, SLOT(slotClose()));
connect(rowsSB, SIGNAL(valueChanged(int)),
this, SLOT( rowsChanged(int)));
connect(columnsSB, SIGNAL(valueChanged(int)),
this, SLOT(columnsChanged(int)));
}
void QTabularCreateDialog::columnsChanged(int)
{
form_->changed();
}
void QTabularCreateDialog::rowsChanged(int)
{
form_->changed();
}
} // namespace frontend
} // namespace lyx
#include "QTabularCreateDialog_moc.cpp"

View File

@ -1,39 +0,0 @@
// -*- C++ -*-
/**
* \file QTabularCreateDialog.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
* \author Edwin Leuven
*
* Full author contact details are available in file CREDITS.
*/
#ifndef QTABULARCREATEDIALOG_H
#define QTABULARCREATEDIALOG_H
#include "ui/TabularCreateUi.h"
#include <QDialog>
namespace lyx {
namespace frontend {
class QTabularCreate;
class QTabularCreateDialog : public QDialog, public Ui::QTabularCreateUi {
Q_OBJECT
public:
QTabularCreateDialog(QTabularCreate * form);
protected Q_SLOTS:
virtual void columnsChanged(int);
virtual void rowsChanged(int);
private:
QTabularCreate * form_;
};
} // namespace frontend
} // namespace lyx
#endif // QTABULARCREATEDIALOG_H

View File

@ -1,504 +0,0 @@
/**
* \file QTabularDialog.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
* \author Jürgen Spitzmüller
* \author Herbert Voß
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "QTabularDialog.h"
#include "QTabular.h"
#include "validators.h"
#include "qt_helpers.h"
#include "controllers/ButtonController.h"
#include "controllers/ControlTabular.h"
#include <QCloseEvent>
#include <QCheckBox>
#include <QPushButton>
#include <QRadioButton>
#include <QLineEdit>
using std::string;
namespace lyx {
namespace frontend {
QTabularDialog::QTabularDialog(QTabular * form)
: form_(form)
{
setupUi(this);
widthED->setValidator(unsignedLengthValidator(widthED));
topspaceED->setValidator(new LengthValidator(topspaceED));
bottomspaceED->setValidator(new LengthValidator(bottomspaceED));
interlinespaceED->setValidator(new LengthValidator(interlinespaceED));
connect(topspaceED, SIGNAL(returnPressed()),
this, SLOT(topspace_changed()));
connect(topspaceUnit, SIGNAL(selectionChanged(lyx::LyXLength::UNIT)),
this, SLOT(topspace_changed()));
connect(topspaceCO, SIGNAL(activated(int)), this, SLOT(topspace_changed()));
connect(bottomspaceED, SIGNAL(returnPressed()),
this, SLOT(bottomspace_changed()));
connect(bottomspaceUnit, SIGNAL(selectionChanged(lyx::LyXLength::UNIT)),
this, SLOT(bottomspace_changed()));
connect(bottomspaceCO, SIGNAL(activated(int)), this, SLOT(bottomspace_changed()));
connect(interlinespaceED, SIGNAL(returnPressed()),
this, SLOT(interlinespace_changed()));
connect(interlinespaceUnit, SIGNAL(selectionChanged(lyx::LyXLength::UNIT)),
this, SLOT(interlinespace_changed()));
connect(interlinespaceCO, SIGNAL(activated(int)), this, SLOT(interlinespace_changed()));
connect(booktabsRB, SIGNAL(clicked(bool)), this, SLOT(booktabsChanged(bool)));
connect(borderDefaultRB, SIGNAL(clicked(bool)), this, SLOT(booktabsChanged(bool)));
connect(borderSetPB, SIGNAL(clicked()), this, SLOT(borderSet_clicked()));
connect(borderUnsetPB, SIGNAL(clicked()), this, SLOT(borderUnset_clicked()));
connect(longTabularCB, SIGNAL(toggled(bool)), longtableGB, SLOT(setEnabled(bool)));
connect(longTabularCB, SIGNAL(toggled(bool)), newpageCB, SLOT(setEnabled(bool)));
connect(hAlignCB, SIGNAL(activated(int)), this, SLOT(hAlign_changed(int)));
connect(vAlignCB, SIGNAL(activated(int)), this, SLOT(vAlign_changed(int)));
connect(multicolumnCB, SIGNAL(clicked()), this, SLOT(multicolumn_clicked()));
connect(newpageCB, SIGNAL(clicked()), this, SLOT(ltNewpage_clicked()));
connect(headerStatusCB, SIGNAL(clicked()), this, SLOT(ltHeaderStatus_clicked()));
connect(headerBorderAboveCB, SIGNAL(clicked()), this, SLOT(ltHeaderBorderAbove_clicked()));
connect(headerBorderBelowCB, SIGNAL(clicked()), this, SLOT(ltHeaderBorderBelow_clicked()));
connect(firstheaderStatusCB, SIGNAL(clicked()), this, SLOT(ltFirstHeaderStatus_clicked()));
connect(firstheaderBorderAboveCB, SIGNAL(clicked()), this, SLOT(ltFirstHeaderBorderAbove_clicked()));
connect(firstheaderBorderBelowCB, SIGNAL(clicked()), this, SLOT(ltFirstHeaderBorderBelow_clicked()));
connect(firstheaderNoContentsCB, SIGNAL(clicked()), this, SLOT(ltFirstHeaderEmpty_clicked()));
connect(footerStatusCB, SIGNAL(clicked()), this, SLOT(ltFooterStatus_clicked()));
connect(footerBorderAboveCB, SIGNAL(clicked()), this, SLOT(ltFooterBorderAbove_clicked()));
connect(footerBorderBelowCB, SIGNAL(clicked()), this, SLOT(ltFooterBorderBelow_clicked()));
connect(lastfooterStatusCB, SIGNAL(clicked()), this, SLOT(ltLastFooterStatus_clicked()));
connect(lastfooterBorderAboveCB, SIGNAL(clicked()), this, SLOT(ltLastFooterBorderAbove_clicked()));
connect(lastfooterBorderBelowCB, SIGNAL(clicked()), this, SLOT(ltLastFooterBorderBelow_clicked()));
connect(lastfooterNoContentsCB, SIGNAL(clicked()), this, SLOT(ltLastFooterEmpty_clicked()));
connect(specialAlignmentED, SIGNAL(returnPressed()), this, SLOT(specialAlignment_changed()));
connect(widthED, SIGNAL(returnPressed()), this, SLOT(width_changed()));
connect(widthUnit, SIGNAL(selectionChanged(lyx::LyXLength::UNIT)), this, SLOT(width_changed()));
connect(closePB, SIGNAL(clicked()), this, SLOT(close_clicked()));
connect(borders, SIGNAL(topSet(bool)), this, SLOT(topBorder_changed()));
connect(borders, SIGNAL(bottomSet(bool)), this, SLOT(bottomBorder_changed()));
connect(borders, SIGNAL(rightSet(bool)), this, SLOT(rightBorder_changed()));
connect(borders, SIGNAL(leftSet(bool)), this, SLOT(leftBorder_changed()));
connect(rotateTabularCB, SIGNAL(clicked()), this, SLOT(rotateTabular()));
connect(rotateCellCB, SIGNAL(clicked()), this, SLOT(rotateCell()));
connect(longTabularCB, SIGNAL(clicked()), this, SLOT(longTabular()));
}
void QTabularDialog::change_adaptor()
{
form_->changed();
}
void QTabularDialog::closeEvent(QCloseEvent * e)
{
form_->slotWMHide();
e->accept();
}
void QTabularDialog::booktabsChanged(bool)
{
form_->changed();
form_->controller().booktabs(booktabsRB->isChecked());
form_->update_borders();
}
void QTabularDialog::topspace_changed()
{
switch(topspaceCO->currentIndex()) {
case 0: {
form_->controller().set(LyXTabular::SET_TOP_SPACE, "");
topspaceED->setEnabled(false);
topspaceUnit->setEnabled(false);
break;
}
case 1: {
form_->controller().set(LyXTabular::SET_TOP_SPACE, "default");
topspaceED->setEnabled(false);
topspaceUnit->setEnabled(false);
break;
}
case 2: {
if (!topspaceED->text().isEmpty())
form_->controller().set(LyXTabular::SET_TOP_SPACE,
widgetsToLength(topspaceED, topspaceUnit));
if (!form_->bc().bp().isReadOnly()) {
topspaceED->setEnabled(true);
topspaceUnit->setEnabled(true);
}
break;
}
}
form_->changed();
}
void QTabularDialog::bottomspace_changed()
{
switch(bottomspaceCO->currentIndex()) {
case 0: {
form_->controller().set(LyXTabular::SET_BOTTOM_SPACE, "");
bottomspaceED->setEnabled(false);
bottomspaceUnit->setEnabled(false);
break;
}
case 1: {
form_->controller().set(LyXTabular::SET_BOTTOM_SPACE, "default");
bottomspaceED->setEnabled(false);
bottomspaceUnit->setEnabled(false);
break;
}
case 2: {
if (!bottomspaceED->text().isEmpty())
form_->controller().set(LyXTabular::SET_BOTTOM_SPACE,
widgetsToLength(bottomspaceED, bottomspaceUnit));
if (!form_->bc().bp().isReadOnly()) {
bottomspaceED->setEnabled(true);
bottomspaceUnit->setEnabled(true);
}
break;
}
}
form_->changed();
}
void QTabularDialog::interlinespace_changed()
{
switch(interlinespaceCO->currentIndex()) {
case 0: {
form_->controller().set(LyXTabular::SET_INTERLINE_SPACE, "");
interlinespaceED->setEnabled(false);
interlinespaceUnit->setEnabled(false);
break;
}
case 1: {
form_->controller().set(LyXTabular::SET_INTERLINE_SPACE, "default");
interlinespaceED->setEnabled(false);
interlinespaceUnit->setEnabled(false);
break;
}
case 2: {
if (!interlinespaceED->text().isEmpty())
form_->controller().set(LyXTabular::SET_INTERLINE_SPACE,
widgetsToLength(interlinespaceED, interlinespaceUnit));
if (!form_->bc().bp().isReadOnly()) {
interlinespaceED->setEnabled(true);
interlinespaceUnit->setEnabled(true);
}
break;
}
}
form_->changed();
}
void QTabularDialog::close_clicked()
{
form_->closeGUI();
form_->slotClose();
}
void QTabularDialog::borderSet_clicked()
{
form_->controller().set(LyXTabular::SET_ALL_LINES);
form_->update_borders();
form_->changed();
}
void QTabularDialog::borderUnset_clicked()
{
form_->controller().set(LyXTabular::UNSET_ALL_LINES);
form_->update_borders();
form_->changed();
}
void QTabularDialog::leftBorder_changed()
{
form_->controller().toggleLeftLine();
form_->changed();
}
void QTabularDialog::rightBorder_changed()
{
form_->controller().toggleRightLine();
form_->changed();
}
void QTabularDialog::topBorder_changed()
{
form_->controller().toggleTopLine();
form_->changed();
}
void QTabularDialog::bottomBorder_changed()
{
form_->controller().toggleBottomLine();
form_->changed();
}
void QTabularDialog::specialAlignment_changed()
{
string special = fromqstr(specialAlignmentED->text());
form_->controller().setSpecial(special);
form_->changed();
}
void QTabularDialog::width_changed()
{
form_->changed();
string const width = widgetsToLength(widthED, widthUnit);
form_->controller().setWidth(width);
}
void QTabularDialog::multicolumn_clicked()
{
form_->controller().toggleMultiColumn();
form_->changed();
}
void QTabularDialog::rotateTabular()
{
form_->controller().rotateTabular(rotateTabularCB->isChecked());
form_->changed();
}
void QTabularDialog::rotateCell()
{
form_->controller().rotateCell(rotateCellCB->isChecked());
form_->changed();
}
void QTabularDialog::hAlign_changed(int align)
{
ControlTabular::HALIGN h = ControlTabular::LEFT;
switch (align) {
case 0: h = ControlTabular::LEFT; break;
case 1: h = ControlTabular::CENTER; break;
case 2: h = ControlTabular::RIGHT; break;
case 3: h = ControlTabular::BLOCK; break;
}
form_->controller().halign(h);
}
void QTabularDialog::vAlign_changed(int align)
{
ControlTabular::VALIGN v = ControlTabular::TOP;
switch (align) {
case 0: v = ControlTabular::TOP; break;
case 1: v = ControlTabular::MIDDLE; break;
case 2: v = ControlTabular::BOTTOM; break;
}
form_->controller().valign(v);
}
void QTabularDialog::longTabular()
{
form_->controller().longTabular(longTabularCB->isChecked());
form_->changed();
}
void QTabularDialog::ltNewpage_clicked()
{
form_->controller().set(LyXTabular::SET_LTNEWPAGE);
form_->changed();
}
void QTabularDialog::ltHeaderStatus_clicked()
{
bool enable(headerStatusCB->isChecked());
if (enable)
form_->controller().set(LyXTabular::SET_LTHEAD, "");
else
form_->controller().set(LyXTabular::UNSET_LTHEAD, "");
headerBorderAboveCB->setEnabled(enable);
headerBorderBelowCB->setEnabled(enable);
firstheaderNoContentsCB->setEnabled(enable);
form_->changed();
}
void QTabularDialog::ltHeaderBorderAbove_clicked()
{
if (headerBorderAboveCB->isChecked())
form_->controller().set(LyXTabular::SET_LTHEAD, "dl_above");
else
form_->controller().set(LyXTabular::UNSET_LTHEAD, "dl_above");
form_->changed();
}
void QTabularDialog::ltHeaderBorderBelow_clicked()
{
if (headerBorderBelowCB->isChecked())
form_->controller().set(LyXTabular::SET_LTHEAD, "dl_below");
else
form_->controller().set(LyXTabular::UNSET_LTHEAD, "dl_below");
form_->changed();
}
void QTabularDialog::ltFirstHeaderBorderAbove_clicked()
{
if (firstheaderBorderAboveCB->isChecked())
form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "dl_above");
else
form_->controller().set(LyXTabular::UNSET_LTFIRSTHEAD, "dl_above");
form_->changed();
}
void QTabularDialog::ltFirstHeaderBorderBelow_clicked()
{
if (firstheaderBorderBelowCB->isChecked())
form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "dl_below");
else
form_->controller().set(LyXTabular::UNSET_LTFIRSTHEAD, "dl_below");
form_->changed();
}
void QTabularDialog::ltFirstHeaderStatus_clicked()
{
bool enable(firstheaderStatusCB->isChecked());
if (enable)
form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "");
else
form_->controller().set(LyXTabular::UNSET_LTFIRSTHEAD, "");
firstheaderBorderAboveCB->setEnabled(enable);
firstheaderBorderBelowCB->setEnabled(enable);
form_->changed();
}
void QTabularDialog::ltFirstHeaderEmpty_clicked()
{
bool enable(firstheaderNoContentsCB->isChecked());
if (enable)
form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "empty");
else
form_->controller().set(LyXTabular::UNSET_LTFIRSTHEAD, "empty");
firstheaderStatusCB->setEnabled(!enable);
firstheaderBorderAboveCB->setEnabled(!enable);
firstheaderBorderBelowCB->setEnabled(!enable);
form_->changed();
}
void QTabularDialog::ltFooterStatus_clicked()
{
bool enable(footerStatusCB->isChecked());
if (enable)
form_->controller().set(LyXTabular::SET_LTFOOT, "");
else
form_->controller().set(LyXTabular::UNSET_LTFOOT, "");
footerBorderAboveCB->setEnabled(enable);
footerBorderBelowCB->setEnabled(enable);
lastfooterNoContentsCB->setEnabled(enable);
form_->changed();
}
void QTabularDialog::ltFooterBorderAbove_clicked()
{
if (footerBorderAboveCB->isChecked())
form_->controller().set(LyXTabular::SET_LTFOOT, "dl_above");
else
form_->controller().set(LyXTabular::UNSET_LTFOOT, "dl_above");
form_->changed();
}
void QTabularDialog::ltFooterBorderBelow_clicked()
{
if (footerBorderBelowCB->isChecked())
form_->controller().set(LyXTabular::SET_LTFOOT, "dl_below");
else
form_->controller().set(LyXTabular::UNSET_LTFOOT, "dl_below");
form_->changed();
}
void QTabularDialog::ltLastFooterStatus_clicked()
{
bool enable(lastfooterStatusCB->isChecked());
if (enable)
form_->controller().set(LyXTabular::SET_LTLASTFOOT, "");
else
form_->controller().set(LyXTabular::UNSET_LTLASTFOOT, "");
lastfooterBorderAboveCB->setEnabled(enable);
lastfooterBorderBelowCB->setEnabled(enable);
form_->changed();
}
void QTabularDialog::ltLastFooterBorderAbove_clicked()
{
if (lastfooterBorderAboveCB->isChecked())
form_->controller().set(LyXTabular::SET_LTLASTFOOT, "dl_above");
else
form_->controller().set(LyXTabular::UNSET_LTLASTFOOT, "dl_above");
form_->changed();
}
void QTabularDialog::ltLastFooterBorderBelow_clicked()
{
if (lastfooterBorderBelowCB->isChecked())
form_->controller().set(LyXTabular::SET_LTLASTFOOT, "dl_below");
else
form_->controller().set(LyXTabular::UNSET_LTLASTFOOT, "dl_below");
form_->changed();
}
void QTabularDialog::ltLastFooterEmpty_clicked()
{
bool enable(lastfooterNoContentsCB->isChecked());
if (enable)
form_->controller().set(LyXTabular::SET_LTLASTFOOT, "empty");
else
form_->controller().set(LyXTabular::UNSET_LTLASTFOOT, "empty");
lastfooterStatusCB->setEnabled(!enable);
lastfooterBorderAboveCB->setEnabled(!enable);
lastfooterBorderBelowCB->setEnabled(!enable);
form_->changed();
}
} // namespace frontend
} // namespace lyx
#include "QTabularDialog_moc.cpp"

View File

@ -1,80 +0,0 @@
// -*- C++ -*-
/**
* \file QTabularDialog.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
* \author Jürgen Spitzmüller
* \author Herbert Voß
*
* Full author contact details are available in file CREDITS.
*/
#ifndef QTABULARDIALOG_H
#define QTABULARDIALOG_H
#include "ui/TabularUi.h"
#include <QDialog>
#include <QCloseEvent>
namespace lyx {
namespace frontend {
class QTabular;
class QTabularDialog : public QDialog, public Ui::QTabularUi {
Q_OBJECT
public:
QTabularDialog(QTabular * form);
protected Q_SLOTS:
virtual void change_adaptor();
virtual void topspace_changed();
virtual void bottomspace_changed();
virtual void interlinespace_changed();
virtual void booktabsChanged(bool);
virtual void close_clicked();
virtual void borderSet_clicked();
virtual void borderUnset_clicked();
virtual void leftBorder_changed();
virtual void rightBorder_changed();
virtual void topBorder_changed();
virtual void bottomBorder_changed();
virtual void multicolumn_clicked();
virtual void rotateTabular();
virtual void rotateCell();
virtual void hAlign_changed(int align);
virtual void vAlign_changed(int align);
virtual void specialAlignment_changed();
virtual void width_changed();
virtual void longTabular();
virtual void ltNewpage_clicked();
virtual void ltHeaderStatus_clicked();
virtual void ltHeaderBorderAbove_clicked();
virtual void ltHeaderBorderBelow_clicked();
virtual void ltFirstHeaderStatus_clicked();
virtual void ltFirstHeaderBorderAbove_clicked();
virtual void ltFirstHeaderBorderBelow_clicked();
virtual void ltFirstHeaderEmpty_clicked();
virtual void ltFooterStatus_clicked();
virtual void ltFooterBorderAbove_clicked();
virtual void ltFooterBorderBelow_clicked();
virtual void ltLastFooterStatus_clicked();
virtual void ltLastFooterBorderAbove_clicked();
virtual void ltLastFooterBorderBelow_clicked();
virtual void ltLastFooterEmpty_clicked();
protected:
virtual void closeEvent(QCloseEvent * e);
private:
QTabular * form_;
};
} // namespace frontend
} // namespace lyx
#endif // QTABULARDIALOG_H