* \author John Levon
* \author Jürgen Spitzmüller
* \author Herbert Voß
+ * \author Uwe Stöhr
*
* Full author contact details are available in file CREDITS.
*/
bottomspaceED->setValidator(new LengthValidator(bottomspaceED));
interlinespaceED->setValidator(new LengthValidator(interlinespaceED));
+ widthUnitCB->setCurrentItem(Length::defaultUnit());
+
connect(topspaceED, SIGNAL(returnPressed()),
this, SLOT(topspace_changed()));
connect(topspaceUnit, SIGNAL(selectionChanged(lyx::Length::UNIT)),
longtableGB, SLOT(setEnabled(bool)));
connect(longTabularCB, SIGNAL(toggled(bool)),
newpageCB, SLOT(setEnabled(bool)));
+ connect(longTabularCB, SIGNAL(toggled(bool)),
+ alignmentGB, SLOT(setEnabled(bool)));
+ // longtables cannot have a vertical alignment
+ connect(longTabularCB, SIGNAL(toggled(bool)),
+ TableAlignCB, SLOT(setDisabled(bool)));
connect(hAlignCB, SIGNAL(activated(int)),
this, SLOT(hAlign_changed(int)));
connect(vAlignCB, SIGNAL(activated(int)),
this, SLOT(specialAlignment_changed()));
connect(widthED, SIGNAL(editingFinished()),
this, SLOT(width_changed()));
- connect(widthUnit, SIGNAL(selectionChanged(lyx::Length::UNIT)),
+ connect(widthUnitCB, SIGNAL(selectionChanged(lyx::Length::UNIT)),
this, SLOT(width_changed()));
connect(closePB, SIGNAL(clicked()),
this, SLOT(close_clicked()));
this, SLOT(rotateTabular()));
connect(rotateCellCB, SIGNAL(clicked()),
this, SLOT(rotateCell()));
+ connect(TableAlignCB, SIGNAL(activated(int)),
+ this, SLOT(tableAlignment_changed(int)));
connect(longTabularCB, SIGNAL(clicked()),
this, SLOT(longTabular()));
-
+ connect(leftRB, SIGNAL(clicked()),
+ this, SLOT(ltAlignment_clicked()));
+ connect(centerRB, SIGNAL(clicked()),
+ this, SLOT(ltAlignment_clicked()));
+ connect(rightRB, SIGNAL(clicked()),
+ this, SLOT(ltAlignment_clicked()));
+
bc().setPolicy(ButtonPolicy::IgnorantPolicy);
bc().addReadOnly(topspaceED);
bc().addReadOnly(rotateTabularCB);
bc().addReadOnly(specialAlignmentED);
bc().addReadOnly(widthED);
- bc().addReadOnly(widthUnit);
+ bc().addReadOnly(widthUnitCB);
bc().addReadOnly(hAlignCB);
bc().addReadOnly(vAlignCB);
+ bc().addReadOnly(TableAlignCB);
bc().addReadOnly(borderSetPB);
bc().addReadOnly(borderUnsetPB);
bc().addReadOnly(borders);
bc().addReadOnly(lastfooterBorderBelowCB);
bc().addReadOnly(lastfooterNoContentsCB);
bc().addReadOnly(newpageCB);
-
+ bc().addReadOnly(leftRB);
+ bc().addReadOnly(centerRB);
+ bc().addReadOnly(rightRB);
+
// initialize the length validator
bc().addCheckedLineEdit(widthED, fixedWidthColLA);
bc().addCheckedLineEdit(topspaceED, topspaceLA);
void GuiTabular::width_changed()
{
changed();
- string const width = widgetsToLength(widthED, widthUnit);
+ string const width = widgetsToLength(widthED, widthUnitCB);
setWidth(width);
}
}
+void GuiTabular::tableAlignment_changed(int align)
+{
+ switch (align) {
+ case 0: set(Tabular::TABULAR_VALIGN_TOP);
+ break;
+ case 1: set(Tabular::TABULAR_VALIGN_MIDDLE);
+ break;
+ case 2: set(Tabular::TABULAR_VALIGN_BOTTOM);
+ break;
+ }
+}
+
+
void GuiTabular::longTabular()
{
longTabular(longTabularCB->isChecked());
}
+void GuiTabular::ltAlignment_clicked()
+{
+ if (leftRB->isChecked())
+ set(Tabular::LONGTABULAR_ALIGN_LEFT);
+ else if (centerRB->isChecked())
+ set(Tabular::LONGTABULAR_ALIGN_CENTER);
+ else if (rightRB->isChecked())
+ set(Tabular::LONGTABULAR_ALIGN_RIGHT);
+ changed();
+}
+
+
void GuiTabular::update_borders()
{
Tabular::idx_type const cell = getActiveCell();
interlinespaceCO->setEnabled(!isReadonly);
string colwidth;
- if (!pwidth.zero())
+ if (!pwidth.zero()) {
colwidth = pwidth.asString();
- lengthToWidgets(widthED, widthUnit,
- colwidth, default_unit);
+
+ lengthToWidgets(widthED, widthUnitCB,
+ colwidth, default_unit);
+ }
widthED->setEnabled(!isReadonly);
- widthUnit->setEnabled(!isReadonly);
+ widthUnitCB->setEnabled(!isReadonly);
hAlignCB->clear();
hAlignCB->addItem(qt_("Left"));
hAlignCB->setEnabled(true);
vAlignCB->setEnabled(!pwidth.zero());
+ int tableValign = 1;
+ switch (tabular_.tabular_valignment) {
+ case Tabular::LYX_VALIGN_TOP:
+ tableValign = 0;
+ break;
+ case Tabular::LYX_VALIGN_MIDDLE:
+ tableValign = 1;
+ break;
+ case Tabular::LYX_VALIGN_BOTTOM:
+ tableValign = 2;
+ break;
+ default:
+ tableValign = 0;
+ break;
+ }
+ TableAlignCB->setCurrentIndex(tableValign);
+
if (!tabular_.is_long_tabular) {
headerStatusCB->setChecked(false);
headerBorderAboveCB->setChecked(false);
captionStatusCB->setChecked(false);
captionStatusCB->blockSignals(false);
return;
+ } else
+ // longtables cannot have a vertical alignment
+ TableAlignCB->setCurrentIndex(Tabular::LYX_VALIGN_MIDDLE);
+
+ switch (tabular_.longtabular_alignment) {
+ case Tabular::LYX_LONGTABULAR_ALIGN_LEFT:
+ leftRB->setChecked(true);
+ break;
+ case Tabular::LYX_LONGTABULAR_ALIGN_CENTER:
+ centerRB->setChecked(true);
+ break;
+ case Tabular::LYX_LONGTABULAR_ALIGN_RIGHT:
+ rightRB->setChecked(true);
+ break;
+ default:
+ centerRB->setChecked(true);
+ break;
}
captionStatusCB->blockSignals(true);
captionStatusCB->setChecked(tabular_.ltCaption(row));
// apply the fixed width values
size_t const cell = getActiveCell();
bool const multicol = tabular_.isMultiColumn(cell);
- string width = widgetsToLength(widthED, widthUnit);
+ string width = widgetsToLength(widthED, widthUnitCB);
string width2;
Length llen = getColumnPWidth(tabular_, cell);