]> git.lyx.org Git - features.git/commitdiff
Add tabular-features set-inner-lines and fix set-all-lines behavior
authorJuergen Spitzmueller <spitz@lyx.org>
Fri, 28 Dec 2018 09:11:42 +0000 (10:11 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Wed, 20 Mar 2019 11:49:23 +0000 (12:49 +0100)
Patch by Daniel Ramöller (racoon)

Fixes: #11382
(cherry picked from commit cb84f752f21bb4cf4bd9ed6999df0353aba2b57e)

lib/Makefile.am
lib/images/classic/tabular-feature_set-inner-lines.png [new file with mode: 0644]
lib/images/classic/tabular-feature_unset-all-lines.png
lib/images/oxygen/tabular-feature_set-inner-lines.svgz [new file with mode: 0644]
lib/images/tabular-feature_set-inner-lines.svgz [new file with mode: 0644]
lib/ui/stdtoolbars.inc
src/insets/InsetTabular.cpp
src/insets/InsetTabular.h
status.23x

index 95e105864dcb8d25a0a9f7d1c2e9d52a641e1d78..49f95dee2615589e5f3c5ec26c307c2269907e36 100644 (file)
@@ -556,6 +556,7 @@ dist_images_DATA1X = \
        images/tabular-feature_set-longtabular.svgz \
        images/tabular-feature_set-rotate-cell.svgz \
        images/tabular-feature_set-border-lines.svgz \
+       images/tabular-feature_set-inner-lines.svgz \
        images/tabular-feature_set-rotate-tabular.svgz \
        images/tabular-feature_toggle-line-bottom.svgz \
        images/tabular-feature_toggle-line-left.svgz \
@@ -1826,6 +1827,7 @@ dist_imagesoxygen_DATA1X = \
        images/oxygen/tabular-feature_multirow.svgz \
        images/oxygen/tabular-feature_set-all-lines.svgz \
        images/oxygen/tabular-feature_set-border-lines.svgz \
+       images/oxygen/tabular-feature_set-inner-lines.svgz \
        images/oxygen/tabular-feature_set-longtabular.svgz \
        images/oxygen/tabular-feature_toggle-line-bottom.svgz \
        images/oxygen/tabular-feature_toggle-line-left.svgz \
@@ -2016,6 +2018,7 @@ dist_imagesclassic_DATA = \
        images/classic/tabular-feature_multirow.png  \
        images/classic/tabular-feature_set-all-lines.png  \
        images/classic/tabular-feature_set-border-lines.png  \
+       images/classic/tabular-feature_set-inner-lines.png  \
        images/classic/tabular-feature_set-longtabular.png  \
        images/classic/tabular-feature_set-rotate-cell.png  \
        images/classic/tabular-feature_set-rotate-tabular.png  \
diff --git a/lib/images/classic/tabular-feature_set-inner-lines.png b/lib/images/classic/tabular-feature_set-inner-lines.png
new file mode 100644 (file)
index 0000000..a8179e9
Binary files /dev/null and b/lib/images/classic/tabular-feature_set-inner-lines.png differ
index b78d50d17209906a8b10feadc47e29fc513011d2..27bdbdd7c09b0249224abec55d34c99c3fa88e12 100644 (file)
Binary files a/lib/images/classic/tabular-feature_unset-all-lines.png and b/lib/images/classic/tabular-feature_unset-all-lines.png differ
diff --git a/lib/images/oxygen/tabular-feature_set-inner-lines.svgz b/lib/images/oxygen/tabular-feature_set-inner-lines.svgz
new file mode 100644 (file)
index 0000000..9ad978e
Binary files /dev/null and b/lib/images/oxygen/tabular-feature_set-inner-lines.svgz differ
diff --git a/lib/images/tabular-feature_set-inner-lines.svgz b/lib/images/tabular-feature_set-inner-lines.svgz
new file mode 100644 (file)
index 0000000..c9ea752
Binary files /dev/null and b/lib/images/tabular-feature_set-inner-lines.svgz differ
index 8f0f6dce3fa8dad134cdacd7a83f3e9333e38e51..0e6782b09c1f8d4e49da5fb4e4c7c81778d117a4 100644 (file)
@@ -156,6 +156,7 @@ ToolbarSet
                Item "Set right line" "tabular-feature toggle-line-right"
                Item "Set border lines" "tabular-feature set-border-lines"
                Item "Set all lines" "tabular-feature set-all-lines"
+               Item "Set inner lines" "tabular-feature set-inner-lines"
                Item "Unset all lines" "tabular-feature unset-all-lines"
                Separator
                Item "Align left" "command-alternatives tabular-feature m-align-left;tabular-feature align-left"
index c111365f280b9953cfd6fbb35b8a6a0f85b67021..0e1c8499c89c15f8d90ef5bb075ffe0d48056430 100644 (file)
@@ -198,6 +198,7 @@ TabularFeature tabularFeature[] =
        { Tabular::LONGTABULAR_ALIGN_RIGHT, "longtabular-align-right", false },
        { Tabular::SET_DECIMAL_POINT, "set-decimal-point", true },
        { Tabular::SET_TABULAR_WIDTH, "set-tabular-width", true },
+       { Tabular::SET_INNER_LINES, "set-inner-lines", false },
        { Tabular::LAST_ACTION, "", false }
 };
 
@@ -4744,6 +4745,7 @@ bool InsetTabular::getFeatureStatus(Cursor & cur, string const & s,
 
                case Tabular::SET_ALL_LINES:
                case Tabular::UNSET_ALL_LINES:
+               case Tabular::SET_INNER_LINES:
                case Tabular::SET_BORDER_LINES:
                        status.setEnabled(!tabular.ltCaption(tabular.cellRow(cur.idx())));
                        break;
@@ -5554,6 +5556,7 @@ void InsetTabular::tabularFeatures(Cursor & cur,
        row_type sel_row_start;
        row_type sel_row_end;
        bool setLines = false;
+       bool setLinesInnerOnly = false;
        LyXAlignment setAlign = LYX_ALIGN_LEFT;
        Tabular::VAlignment setVAlign = Tabular::LYX_VALIGN_TOP;
 
@@ -5899,6 +5902,9 @@ void InsetTabular::tabularFeatures(Cursor & cur,
                break;
        }
 
+       case Tabular::SET_INNER_LINES:
+               setLinesInnerOnly = true;
+               // fall through
        case Tabular::SET_ALL_LINES:
                setLines = true;
                // fall through
@@ -5906,10 +5912,16 @@ void InsetTabular::tabularFeatures(Cursor & cur,
                for (row_type r = sel_row_start; r <= sel_row_end; ++r)
                        for (col_type c = sel_col_start; c <= sel_col_end; ++c) {
                                idx_type const cell = tabular.cellIndex(r, c);
-                               tabular.setTopLine(cell, setLines);
-                               tabular.setBottomLine(cell, setLines);
-                               tabular.setRightLine(cell, setLines);
-                               tabular.setLeftLine(cell, setLines);
+                               if (!setLinesInnerOnly || r != sel_row_start)
+                                       tabular.setTopLine(cell, setLines);
+                               if ((!setLinesInnerOnly || r != sel_row_end)
+                                   && (!setLines || r == sel_row_end))
+                                       tabular.setBottomLine(cell, setLines);
+                               if ((!setLinesInnerOnly || c != sel_col_end)
+                                   && (!setLines || c == sel_col_end))
+                                       tabular.setRightLine(cell, setLines);
+                               if ((!setLinesInnerOnly || c != sel_col_start))
+                                       tabular.setLeftLine(cell, setLines);
                        }
                break;
 
index be11b0413e90b924a679472ccb2a999a5b3ec2f2..1a8bf33243fcb6df9dc975ed35c1ca3c1c8e37e4 100644 (file)
@@ -297,6 +297,8 @@ public:
                ///
                SET_TABULAR_WIDTH,
                ///
+               SET_INNER_LINES,
+               ///
                LAST_ACTION
        };
        ///
index 5216b09953a464e282212672fb381867148bed8c..adf8b1395b85647d8dd79920bba1c99cd9194ece 100644 (file)
@@ -167,6 +167,7 @@ What's new
 - Quote filenames when calling gunzip and avoid a crash when the filename
   of a compressed file does not end with a proper extension (bug 4269).
 
+- Fix behavior of (un)setting all tabular borders (bug 11382).
 
 
 * INTERNALS