From: Jean-Marc Lasgouttes Date: Fri, 25 Nov 2005 09:27:08 +0000 (+0000) Subject: disable LFUN_PASTE when there is nothing to paste X-Git-Tag: 1.6.10~13779 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=2eb67150a4eb894fdebd515425ff1ec1ac01ae2f;p=features.git disable LFUN_PASTE when there is nothing to paste git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10620 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/ChangeLog b/src/ChangeLog index 89edf764a7..d04d7171f2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2005-11-24 Jean-Marc Lasgouttes + + * 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 * dociterator.[Ch]: new member realInset() that returns the cell diff --git a/src/CutAndPaste.C b/src/CutAndPaste.C index 436113033a..b74d018dcc 100644 --- a/src/CutAndPaste.C +++ b/src/CutAndPaste.C @@ -472,6 +472,12 @@ std::vector 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 diff --git a/src/CutAndPaste.h b/src/CutAndPaste.h index bb94d83234..8332205fc7 100644 --- a/src/CutAndPaste.h +++ b/src/CutAndPaste.h @@ -32,6 +32,8 @@ namespace cap { /// std::vector const availableSelections(Buffer const & buffer); /// +lyx::size_type numberOfSelections(); +/// std::string getSelection(Buffer const & buffer, size_t sel_index); /// diff --git a/src/lyxfunc.C b/src/lyxfunc.C index be14d6f9c5..23c7a5f2ea 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -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"; diff --git a/src/text3.C b/src/text3.C index ab31751e00..45fe7a8d11 100644 --- a/src/text3.C +++ b/src/text3.C @@ -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: