r33506: better fix for table borders.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33507 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2010-02-19 10:03:03 +00:00
parent 15e19deed3
commit addba25b98
4 changed files with 47 additions and 29 deletions

View File

@ -377,14 +377,14 @@ docstring GuiTabular::dialogToParams() const
&& !borders->getRight())
setParam(param_str, Tabular::UNSET_ALL_LINES);
else {
if (borders->getLeft() != left_border_set_)
setParam(param_str, Tabular::TOGGLE_LINE_LEFT);
if (borders->getRight() != right_border_set_)
setParam(param_str, Tabular::TOGGLE_LINE_RIGHT);
if (borders->getTop() != top_border_set_)
setParam(param_str, Tabular::TOGGLE_LINE_TOP);
if (borders->getBottom() != bottom_border_set_)
setParam(param_str, Tabular::TOGGLE_LINE_BOTTOM);
setParam(param_str, Tabular::SET_LINE_LEFT,
borders->getLeft() ? "true" : "false");
setParam(param_str, Tabular::SET_LINE_RIGHT,
borders->getRight() ? "true" : "false");
setParam(param_str, Tabular::SET_LINE_TOP,
borders->getTop() ? "true" : "false");
setParam(param_str, Tabular::SET_LINE_BOTTOM,
borders->getBottom() ? "true" : "false");
}
// apply the special alignment
@ -554,15 +554,10 @@ void GuiTabular::paramsToDialog(Inset const * inset)
longTabularCB->setChecked(tabular.is_long_tabular);
//
top_border_set_ = tabular.topLine(cell);
bottom_border_set_ = tabular.bottomLine(cell);
left_border_set_ = tabular.leftLine(cell);
right_border_set_ = tabular.rightLine(cell);
borders->setTop(top_border_set_);
borders->setBottom(bottom_border_set_);
borders->setLeft(left_border_set_);
borders->setRight(right_border_set_);
borders->setTop(tabular.topLine(cell));
borders->setBottom(tabular.bottomLine(cell));
borders->setLeft(tabular.leftLine(cell));
borders->setRight(tabular.rightLine(cell));
// repaint the setborder widget
borders->update();

View File

@ -48,11 +48,6 @@ private:
void setVAlign(std::string & param_str) const;
///
void setTableAlignment(std::string & param_str) const;
///
bool left_border_set_;
bool right_border_set_;
bool top_border_set_;
bool bottom_border_set_;
};
} // namespace frontend

View File

@ -113,6 +113,11 @@ TabularFeature tabularFeature[] =
{ Tabular::DELETE_COLUMN, "delete-column", false },
{ Tabular::COPY_ROW, "copy-row", false },
{ Tabular::COPY_COLUMN, "copy-column", false },
{ Tabular::SET_LINE_TOP, "set-line-top", true },
{ Tabular::SET_LINE_BOTTOM, "set-line-bottom", true },
{ Tabular::SET_LINE_LEFT, "set-line-left", true },
{ Tabular::SET_LINE_RIGHT, "set-line-right", true },
//FIXME: get rid of those 4 TOGGLE actions in favor of the 4 above.
{ Tabular::TOGGLE_LINE_TOP, "toggle-line-top", false },
{ Tabular::TOGGLE_LINE_BOTTOM, "toggle-line-bottom", false },
{ Tabular::TOGGLE_LINE_LEFT, "toggle-line-left", false },
@ -4095,6 +4100,13 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
status.setEnabled(!tabular.ltCaption(tabular.cellRow(cur.idx())));
break;
case Tabular::SET_LINE_TOP:
case Tabular::SET_LINE_BOTTOM:
case Tabular::SET_LINE_LEFT:
case Tabular::SET_LINE_RIGHT:
status.setEnabled(!tabular.ltCaption(tabular.cellRow(cur.idx())));
break;
case Tabular::TOGGLE_LINE_TOP:
status.setEnabled(!tabular.ltCaption(tabular.cellRow(cur.idx())));
status.setOnOff(tabular.topLine(cur.idx()));
@ -4925,32 +4937,40 @@ void InsetTabular::tabularFeatures(Cursor & cur,
cur.idx() = tabular.cellIndex(row, column);
break;
case Tabular::SET_LINE_TOP:
case Tabular::TOGGLE_LINE_TOP: {
bool lineSet = !tabular.topLine(cur.idx());
bool lineSet = (feature == Tabular::SET_LINE_TOP)
? (value == "true") : !tabular.topLine(cur.idx());
for (row_type i = sel_row_start; i <= sel_row_end; ++i)
for (col_type j = sel_col_start; j <= sel_col_end; ++j)
tabular.setTopLine(tabular.cellIndex(i, j), lineSet);
break;
}
case Tabular::SET_LINE_BOTTOM:
case Tabular::TOGGLE_LINE_BOTTOM: {
bool lineSet = !tabular.bottomLine(cur.idx());
bool lineSet = (feature == Tabular::SET_LINE_BOTTOM)
? (value == "true") : !tabular.bottomLine(cur.idx());
for (row_type i = sel_row_start; i <= sel_row_end; ++i)
for (col_type j = sel_col_start; j <= sel_col_end; ++j)
tabular.setBottomLine(tabular.cellIndex(i, j), lineSet);
break;
}
case Tabular::SET_LINE_LEFT:
case Tabular::TOGGLE_LINE_LEFT: {
bool lineSet = !tabular.leftLine(cur.idx());
bool lineSet = (feature == Tabular::SET_LINE_LEFT)
? (value == "true") : !tabular.leftLine(cur.idx());
for (row_type i = sel_row_start; i <= sel_row_end; ++i)
for (col_type j = sel_col_start; j <= sel_col_end; ++j)
tabular.setLeftLine(tabular.cellIndex(i, j), lineSet);
break;
}
case Tabular::SET_LINE_RIGHT:
case Tabular::TOGGLE_LINE_RIGHT: {
bool lineSet = !tabular.rightLine(cur.idx());
bool lineSet = (feature == Tabular::SET_LINE_RIGHT)
? (value == "true") : !tabular.rightLine(cur.idx());
for (row_type i = sel_row_start; i <= sel_row_end; ++i)
for (col_type j = sel_col_start; j <= sel_col_end; ++j)
tabular.setRightLine(tabular.cellIndex(i, j), lineSet);

View File

@ -72,12 +72,20 @@ public:
///
COPY_COLUMN,
///
SET_LINE_TOP,
///
SET_LINE_BOTTOM,
///
SET_LINE_LEFT,
///
SET_LINE_RIGHT,
///FIXME: remove
TOGGLE_LINE_TOP,
///
///FIXME: remove
TOGGLE_LINE_BOTTOM,
///
///FIXME: remove
TOGGLE_LINE_LEFT,
///
///FIXME: remove
TOGGLE_LINE_RIGHT,
///
ALIGN_LEFT,