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).
+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):
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))
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;
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;
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
// 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 {