]> git.lyx.org Git - features.git/commitdiff
Fixed rules for setting left/right borders for multicolumns (fix #173).
authorJürgen Vigna <jug@sad.it>
Mon, 18 Mar 2002 15:27:41 +0000 (15:27 +0000)
committerJürgen Vigna <jug@sad.it>
Mon, 18 Mar 2002 15:27:41 +0000 (15:27 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3765 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormTabular.C
src/tabular.C

index e8659359821aa593f631dd4b15a0117345350760..7ea9a6e224bf311843c8d156a6d69a3bbed9e900 100644 (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).
index 96d459e490e0c3da0d8e47849be5bebad9671a32..b674bfa33c54837c4944bde77bab3b9f4df8488d 100644 (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):
index 781a2237fb9ca9b72b39596b07635b8979e943ea..1ed5fe40358abb8785c523f35f13843e7c78400e 100644 (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))
index abb382168577d9165bb522675e81536b90d0cfea..e5f64586a42a204cfc1676edefc8d9714ac650b3 100644 (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 {