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