Fixed rules for setting left/right borders for multicolumns (fix #173).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3765 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2002-03-18 15:27:41 +00:00
parent 0fd56e0359
commit 53e8fb6000
4 changed files with 42 additions and 11 deletions

View File

@ -1,5 +1,10 @@
2002-03-18 Juergen Vigna <jug@sad.it>
* tabular.C (LeftAlreadyDrawed): fixed for multicolumn borders.
(GetAdditionalWidth): ditto.
(RightLine): ditto.
(LeftLine): ditto.
* BufferView2.C (copy): use getLyXText() so that we do it inside an
inset if we're there actually (probably not used right now but this
is the direction to go for unifying code).

View File

@ -1,3 +1,8 @@
2002-03-18 Juergen Vigna <jug@sad.it>
* FormTabular.C (update): deactivate left/right border settings for
multicolumns if not an outer cell or no parent multicolumn cell.
2002-03-13 Angus Leeming <a.leeming@ic.ac.uk>
* FormBase.C (show):

View File

@ -207,12 +207,29 @@ void FormTabular::update()
fl_set_button(cell_options_->check_border_bottom,
tabular->BottomLine(cell)?1:0);
setEnabled(cell_options_->check_border_bottom, true);
fl_set_button(cell_options_->check_border_left,
tabular->LeftLine(cell)?1:0);
setEnabled(cell_options_->check_border_left, true);
fl_set_button(cell_options_->check_border_right,
tabular->RightLine(cell)?1:0);
setEnabled(cell_options_->check_border_right, true);
// pay attention to left/right lines they are only allowed
// to set if we are in first/last cell of row or if the left/right
// cell is also a multicolumn.
if (tabular->IsFirstCellInRow(cell) ||
tabular->IsMultiColumn(cell-1))
{
fl_set_button(cell_options_->check_border_left,
tabular->LeftLine(cell)?1:0);
setEnabled(cell_options_->check_border_left, true);
} else {
fl_set_button(cell_options_->check_border_left, 0);
setEnabled(cell_options_->check_border_left, false);
}
if (tabular->IsLastCellInRow(cell) ||
tabular->IsMultiColumn(cell+1))
{
fl_set_button(cell_options_->check_border_right,
tabular->RightLine(cell)?1:0);
setEnabled(cell_options_->check_border_right, true);
} else {
fl_set_button(cell_options_->check_border_right, 0);
setEnabled(cell_options_->check_border_right, false);
}
pwidth = tabular->GetMColumnPWidth(cell);
align = tabular->GetAlignment(cell);
if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))

View File

@ -465,7 +465,9 @@ bool LyXTabular::BottomLine(int cell, bool onlycolumn) const
bool LyXTabular::LeftLine(int cell, bool onlycolumn) const
{
if (!onlycolumn && IsMultiColumn(cell)) {
if (!onlycolumn && IsMultiColumn(cell) &&
(IsFirstCellInRow(cell) || IsMultiColumn(cell-1)))
{
#ifdef SPECIAL_COLUM_HANDLING
if (cellinfo_of_cell(cell)->align_special.empty())
return cellinfo_of_cell(cell)->left_line;
@ -486,7 +488,9 @@ bool LyXTabular::LeftLine(int cell, bool onlycolumn) const
bool LyXTabular::RightLine(int cell, bool onlycolumn) const
{
if (!onlycolumn && IsMultiColumn(cell)) {
if (!onlycolumn && IsMultiColumn(cell) &&
(IsLastCellInRow(cell) || IsMultiColumn(cell+1)))
{
#ifdef SPECIAL_COLUM_HANDLING
if (cellinfo_of_cell(cell)->align_special.empty())
return cellinfo_of_cell(cell)->right_line;
@ -535,7 +539,7 @@ bool LyXTabular::LeftAlreadyDrawed(int cell) const
if (GetAdditionalWidth(cell_info[row][column].cellno))
return false;
#ifdef SPECIAL_COLUM_HANDLING
return column_info[column].right_line;
return RightLine(cell_info[row][column].cellno);
#else
return RightLine(cell_info[row][column].cellno, true);
#endif
@ -588,8 +592,8 @@ int LyXTabular::GetAdditionalWidth(int cell) const
// used to get it back in text.C
int const col = right_column_of_cell(cell);
int const row = row_of_cell(cell);
if (col < columns_ - 1 && RightLine(cell, true) &&
LeftLine(cell_info[row][col+1].cellno, true)) // column_info[col+1].left_line)
if (col < columns_ - 1 && RightLine(cell) &&
LeftLine(cell_info[row][col+1].cellno)) // column_info[col+1].left_line)
{
return WIDTH_OF_LINE;
} else {