]> git.lyx.org Git - lyx.git/commitdiff
Multi-cell select font change bug fix
authorMartin Vermeer <martin.vermeer@hut.fi>
Sun, 13 Mar 2005 10:36:42 +0000 (10:36 +0000)
committerMartin Vermeer <martin.vermeer@hut.fi>
Sun, 13 Mar 2005 10:36:42 +0000 (10:36 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9714 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/ChangeLog
src/insets/insettabular.C

index d31f87ddac8b599c9a1d22cf9fa6a1078f7a4a03..ee0d7c92cb65b6b87d168c176230c3e5d24306de 100644 (file)
@@ -1,3 +1,10 @@
+2005-03-12  Martin Vermeer  <martin.vermeer@hut.fi>
+
+       * insettabular.C: make applying character attributes 
+       possible for multiple cells in tables. Disable collapsable
+       insets for multiple-cell selection in table (Jürgen S.)
+       Bug reported by Helge Hafting.
+
 2005-02-25  Andreas Vox  <avox@arcor.de>
 
        * insetmarginal.[hC] (docbook): new method, render as <note>
index 68061502f74f3a1815cf1aa232cf81112e82e967..60bcbf07b7a244cbe3ca8cb03fa327ca0f33abfc 100644 (file)
@@ -724,6 +724,43 @@ void InsetTabular::doDispatch(LCursor & cur, FuncRequest & cmd)
                cell(cur.idx())->dispatch(cur, cmd);
                break;
 
+        case LFUN_EMPH:
+        case LFUN_BOLD:
+        case LFUN_ROMAN:
+        case LFUN_NOUN:
+        case LFUN_ITAL:
+        case LFUN_FRAK:
+        case LFUN_CODE:
+        case LFUN_SANS:
+               if (tablemode(cur)) {
+                       row_type rs, re;
+                       col_type cs, ce;
+                       getSelection(cur, rs, re, cs, ce);
+                       for (row_type i = rs; i <= re; ++i)
+                               for (col_type j = cs; j <= ce; ++j) {
+                                       // cursor follows cell:
+                                       cur.idx() = tabular.getCellNumber(i, j);
+                                       // select this cell only:
+                                       cur.pos() = 0;
+                                       cur.resetAnchor();
+                                       cur.pos() = cur.top().lastpos();
+                                       cur.setCursor(cur);
+                                       cur.setSelection();
+                                       cell(cur.idx())->dispatch(cur, cmd);
+                               }
+                       // Restore original selection
+                       cur.idx() = tabular.getCellNumber(rs, cs);
+                       cur.pos() = 0;
+                       cur.resetAnchor();
+                       cur.idx() = tabular.getCellNumber(re, ce);
+                       cur.pos() = cur.top().lastpos();
+                       cur.setCursor(cur);
+                       cur.setSelection();
+                       break;
+               } else {
+                       cell(cur.idx())->dispatch(cur, cmd);
+                       break;
+               }
        default:
                // we try to handle this event in the insets dispatch function.
                cell(cur.idx())->dispatch(cur, cmd);
@@ -909,6 +946,24 @@ bool InsetTabular::getStatus(LCursor & cur, FuncRequest const & cmd,
                return true;
        }
 
+       // disable these with multiple cells selected
+       case LFUN_INSERT_CHARSTYLE:
+       case LFUN_INSET_FLOAT:
+       case LFUN_INSET_WIDE_FLOAT:
+       case LFUN_INSET_FOOTNOTE:
+       case LFUN_INSET_MARGINAL:
+       case LFUN_INSERT_NOTE:
+       case LFUN_INSET_OPTARG:
+       case LFUN_INSERT_BOX:
+       case LFUN_INSERT_BRANCH:
+       case LFUN_INSET_WRAP:
+       case LFUN_INSET_ERT: {
+               if (tablemode(cur)) {
+                       status.enabled(false);
+                       return true;
+               }
+       }
+
        default:
                // we try to handle this event in the insets dispatch function.
                return cell(cur.idx())->getStatus(cur, cmd, status);