formatting.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29708 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2009-05-17 09:36:07 +00:00
parent a999218b4e
commit eb2dc6d0b3

View File

@ -56,52 +56,90 @@ GuiTabular::GuiTabular(GuiView & lv)
this, SLOT(topspace_changed()));
connect(topspaceUnit, SIGNAL(selectionChanged(lyx::Length::UNIT)),
this, SLOT(topspace_changed()));
connect(topspaceCO, SIGNAL(activated(int)), 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::Length::UNIT)),
this, SLOT(bottomspace_changed()));
connect(bottomspaceCO, SIGNAL(activated(int)), 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::Length::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(editingFinished()), this, SLOT(width_changed()));
connect(widthUnit, SIGNAL(selectionChanged(lyx::Length::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()));
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(editingFinished()),
this, SLOT(width_changed()));
connect(widthUnit, SIGNAL(selectionChanged(lyx::Length::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()),
his, SLOT(rotateCell()));
connect(longTabularCB, SIGNAL(clicked()),
this, SLOT(longTabular()));
bc().setPolicy(ButtonPolicy::IgnorantPolicy);
@ -190,7 +228,8 @@ void GuiTabular::topspace_changed()
case 2: {
if (!topspaceED->text().isEmpty())
set(Tabular::SET_TOP_SPACE,
widgetsToLength(topspaceED, topspaceUnit));
widgetsToLength(topspaceED,
topspaceUnit));
if (!bc().policy().isReadOnly()) {
topspaceED->setEnabled(true);
topspaceUnit->setEnabled(true);
@ -220,7 +259,8 @@ void GuiTabular::bottomspace_changed()
case 2: {
if (!bottomspaceED->text().isEmpty())
set(Tabular::SET_BOTTOM_SPACE,
widgetsToLength(bottomspaceED, bottomspaceUnit));
widgetsToLength(bottomspaceED,
bottomspaceUnit));
if (!bc().policy().isReadOnly()) {
bottomspaceED->setEnabled(true);
bottomspaceUnit->setEnabled(true);
@ -250,7 +290,8 @@ void GuiTabular::interlinespace_changed()
case 2: {
if (!interlinespaceED->text().isEmpty())
set(Tabular::SET_INTERLINE_SPACE,
widgetsToLength(interlinespaceED, interlinespaceUnit));
widgetsToLength(interlinespaceED,
interlinespaceUnit));
if (!bc().policy().isReadOnly()) {
interlinespaceED->setEnabled(true);
interlinespaceUnit->setEnabled(true);
@ -628,10 +669,12 @@ void GuiTabular::updateContents()
docstring special;
if (multicol) {
special = getAlignSpecial(tabular_, cell, Tabular::SET_SPECIAL_MULTI);
special = getAlignSpecial(tabular_, cell,
Tabular::SET_SPECIAL_MULTI);
pwidth = getMColumnPWidth(tabular_, cell);
} else {
special = getAlignSpecial(tabular_, cell, Tabular::SET_SPECIAL_COLUMN);
special = getAlignSpecial(tabular_, cell,
Tabular::SET_SPECIAL_COLUMN);
pwidth = getColumnPWidth(tabular_, cell);
}
@ -788,36 +831,44 @@ void GuiTabular::updateContents()
// FIXME: shouldn't this be handled by GuiDialog?
// FIXME: Some of them should be handled directly in TabularUI.ui
firstheaderBorderAboveCB->setEnabled(funcEnabled(Tabular::SET_LTFIRSTHEAD));
firstheaderBorderBelowCB->setEnabled(funcEnabled(Tabular::SET_LTFIRSTHEAD));
firstheaderBorderAboveCB->setEnabled(
funcEnabled(Tabular::SET_LTFIRSTHEAD));
firstheaderBorderBelowCB->setEnabled(
funcEnabled(Tabular::SET_LTFIRSTHEAD));
// first header can only be suppressed when there is a header
firstheaderNoContentsCB->setEnabled(tabular_.haveLTHead()
&& !tabular_.haveLTFirstHead());
// check if setting a first header is allowed
// additionally check firstheaderStatusCB because when this is the case
// a first header makes no sense
firstheaderStatusCB->setEnabled(funcEnabled(Tabular::SET_LTFIRSTHEAD)
// additionally check firstheaderStatusCB because when this is the
// case a first header makes no sense
firstheaderStatusCB->setEnabled(
funcEnabled(Tabular::SET_LTFIRSTHEAD)
&& !firstheaderNoContentsCB->isChecked());
//firstheaderStatusCB->setEnabled(!firstheaderNoContentsCB->isChecked());
//firstheaderStatusCB->setEnabled(
// !firstheaderNoContentsCB->isChecked());
headerBorderAboveCB->setEnabled(funcEnabled(Tabular::SET_LTHEAD));
headerBorderBelowCB->setEnabled(funcEnabled(Tabular::SET_LTHEAD));
headerStatusCB->setEnabled(funcEnabled(Tabular::SET_LTHEAD));
footerBorderAboveCB->setEnabled(funcEnabled(Tabular::SET_LTFOOT));
footerBorderBelowCB->setEnabled(funcEnabled(Tabular::SET_LTFOOT));
footerStatusCB->setEnabled(funcEnabled(Tabular::SET_LTFOOT));
lastfooterBorderAboveCB->setEnabled(funcEnabled(Tabular::SET_LTLASTFOOT));
lastfooterBorderBelowCB->setEnabled(funcEnabled(Tabular::SET_LTLASTFOOT));
lastfooterBorderAboveCB->setEnabled(
funcEnabled(Tabular::SET_LTLASTFOOT));
lastfooterBorderBelowCB->setEnabled(
funcEnabled(Tabular::SET_LTLASTFOOT));
// last footer can only be suppressed when there is a footer
lastfooterNoContentsCB->setEnabled(tabular_.haveLTFoot()
&& !tabular_.haveLTLastFoot());
// check if setting a last footer is allowed
// additionally check lastfooterNoContentsCB because when this is the case
// a last footer makes no sense
lastfooterStatusCB->setEnabled(funcEnabled(Tabular::SET_LTLASTFOOT)
// additionally check lastfooterNoContentsCB because when this is
// the case a last footer makes no sense
lastfooterStatusCB->setEnabled(
funcEnabled(Tabular::SET_LTLASTFOOT)
&& !lastfooterNoContentsCB->isChecked());
captionStatusCB->setEnabled(funcEnabled(Tabular::TOGGLE_LTCAPTION));
// When a row is set as longtable caption, it must not be allowed to unset
// that this row is a multicolumn.
captionStatusCB->setEnabled(
funcEnabled(Tabular::TOGGLE_LTCAPTION));
// When a row is set as longtable caption, it must not be allowed
// to unset that this row is a multicolumn.
multicolumnCB->setEnabled(funcEnabled(Tabular::MULTICOLUMN));
Tabular::ltType ltt;
@ -917,9 +968,11 @@ void GuiTabular::closeGUI()
docstring sa2;
if (multicol)
sa2 = getAlignSpecial(tabular_, cell, Tabular::SET_SPECIAL_MULTI);
sa2 = getAlignSpecial(tabular_, cell,
Tabular::SET_SPECIAL_MULTI);
else
sa2 = getAlignSpecial(tabular_, cell, Tabular::SET_SPECIAL_COLUMN);
sa2 = getAlignSpecial(tabular_, cell,
Tabular::SET_SPECIAL_COLUMN);
if (sa1 != sa2) {
if (multicol)
@ -945,7 +998,8 @@ void GuiTabular::closeGUI()
break;
case 2:
set(Tabular::SET_TOP_SPACE,
widgetsToLength(topspaceED, topspaceUnit));
widgetsToLength(topspaceED,
topspaceUnit));
break;
}
@ -958,7 +1012,8 @@ void GuiTabular::closeGUI()
break;
case 2:
set(Tabular::SET_BOTTOM_SPACE,
widgetsToLength(bottomspaceED, bottomspaceUnit));
widgetsToLength(bottomspaceED,
bottomspaceUnit));
break;
}
@ -971,7 +1026,8 @@ void GuiTabular::closeGUI()
break;
case 2:
set(Tabular::SET_INTERLINE_SPACE,
widgetsToLength(interlinespaceED, interlinespaceUnit));
widgetsToLength(interlinespaceED,
interlinespaceUnit));
break;
}
*/
@ -989,7 +1045,8 @@ bool GuiTabular::initialiseParams(string const & data)
// assume that it is "ours"
for (int i = cur.depth() - 1; i >= 0; --i)
if (cur[i].inset().lyxCode() == TABULAR_CODE) {
current_inset = static_cast<InsetTabular const *>(&cur[i].inset());
current_inset =
static_cast<InsetTabular const *>(&cur[i].inset());
active_cell_ = cur[i].idx();
break;
}
@ -1009,8 +1066,9 @@ bool GuiTabular::initialiseParams(string const & data)
void GuiTabular::clearParams()
{
// This function is also called when LyX is closing and the dialog is
// still open. At that time, the buffer might not be available anymore.
// This function is also called when LyX is closing and the dialog
// is still open. At that time, the buffer might not be available
// anymore.
if (isBufferAvailable()) {
InsetTabular tmp(const_cast<Buffer &>(buffer()));
tabular_ = tmp.tabular;
@ -1156,7 +1214,8 @@ void GuiTabular::longTabular(bool yes)
// to get the status of the longtable row settings
bool GuiTabular::funcEnabled(Tabular::Feature f) const
{
return getStatus(FuncRequest(getLfun(), featureAsString(f))).enabled();
return getStatus(
FuncRequest(getLfun(), featureAsString(f))).enabled();
}