]> git.lyx.org Git - features.git/commitdiff
disable LFUN_PASTE when there is nothing to paste
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 25 Nov 2005 09:27:08 +0000 (09:27 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 25 Nov 2005 09:27:08 +0000 (09:27 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10620 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/CutAndPaste.C
src/CutAndPaste.h
src/lyxfunc.C
src/text3.C

index 89edf764a78cd2da23900a6f180093fb3432df30..d04d7171f26231cb0aa56cf4fa663ff18173d40b 100644 (file)
@@ -1,3 +1,12 @@
+2005-11-24  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
+
+       * CutAndPaste.C (numberOfSelections): new helper function.
+
+       * lyxfunc.C (getStatus): remove support for LFUN_COPY and LFUN_CUT.
+
+       * text3.C (getStatus): move code for LFUN_CUT and LFUN_COPY from
+       LyXFunc::getStatus; implement LFUN_PASTE.
+
 2005-11-17  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
 
        * dociterator.[Ch]: new member realInset() that returns the cell
index 436113033ab1100cc78aa0a78dd4e21bcf4dd2a2..b74d018dccc11dcaa80abb531c3107812493e4c2 100644 (file)
@@ -472,6 +472,12 @@ std::vector<string> const availableSelections(Buffer const & buffer)
 }
 
 
+lyx::size_type numberOfSelections()
+{
+       return theCuts.size();
+}
+
+
 void cutSelection(LCursor & cur, bool doclear, bool realcut)
 {
        // This doesn't make sense, if there is no selection
index bb94d8323408f6018194943ff993552bb37dd210..8332205fc7fc3955f7d02591172d2acbaa2f1889 100644 (file)
@@ -32,6 +32,8 @@ namespace cap {
 ///
 std::vector<std::string> const availableSelections(Buffer const & buffer);
 ///
+lyx::size_type numberOfSelections();
+///
 std::string getSelection(Buffer const & buffer, size_t sel_index);
 
 ///
index be14d6f9c5997d8ba4c118e3ff87ade0078961f5..23c7a5f2ea937c90cb838a2b2d6197a265af3b83 100644 (file)
@@ -411,10 +411,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                enable = cmd.argument == "custom"
                        || Exporter::IsExportable(*buf, cmd.argument);
                break;
-       case LFUN_CUT:
-       case LFUN_COPY:
-               enable = cur.selection();
-               break;
 
        case LFUN_RUNCHKTEX:
                enable = buf->isLatex() && lyxrc.chktex_command != "none";
index ab31751e00b95b33ad6989c85234b475031de467..45fe7a8d117200e5db814950e47fc5a9a51f07c5 100644 (file)
@@ -1765,6 +1765,15 @@ bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd,
                flag.setOnOff(font.family() == LyXFont::TYPEWRITER_FAMILY);
                return true;
 
+       case LFUN_CUT:
+       case LFUN_COPY:
+               enable = cur.selection();
+               break;
+
+       case LFUN_PASTE:
+               enable = lyx::cap::numberOfSelections() > 0;
+               break;
+
        case LFUN_DELETE_WORD_FORWARD:
        case LFUN_DELETE_WORD_BACKWARD:
        case LFUN_DELETE_LINE_FORWARD:
@@ -1808,9 +1817,6 @@ bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd,
        case LFUN_LOWCASE_WORD:
        case LFUN_CAPITALIZE_WORD:
        case LFUN_TRANSPOSE_CHARS:
-       case LFUN_PASTE:
-       case LFUN_CUT:
-       case LFUN_COPY:
        case LFUN_GETXY:
        case LFUN_SETXY:
        case LFUN_GETFONT: