From a683072ea0294d6bb1c63b77f39e928235ca7e88 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Mon, 8 Jan 2007 18:37:40 +0000 Subject: [PATCH] Fix enabling of LFUN_PRIMARY_SELECTION_PASTE: It was always disabled, because we don't set the selection with qApp->clipboard()->put(). Therefore we get the status of the internal selection from the cursor, and the empty flag for fake selections is not needed anymore. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16610 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/Selection.h | 4 ++-- src/frontends/qt4/GuiSelection.C | 6 ++---- src/frontends/qt4/GuiSelection.h | 9 --------- src/text3.C | 2 +- 4 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/frontends/Selection.h b/src/frontends/Selection.h index 53f587ddbe..569ea0272d 100644 --- a/src/frontends/Selection.h +++ b/src/frontends/Selection.h @@ -59,8 +59,8 @@ public: virtual void put(docstring const &) = 0; /** * Is the X selection empty? - * This reports only the state of the internal selection on systems - * that don't have a real selection. + * This does always return true on systems that don't have a real + * selection. */ virtual bool empty() const = 0; }; diff --git a/src/frontends/qt4/GuiSelection.C b/src/frontends/qt4/GuiSelection.C index 50f9045c7d..9aba124499 100644 --- a/src/frontends/qt4/GuiSelection.C +++ b/src/frontends/qt4/GuiSelection.C @@ -32,10 +32,8 @@ namespace frontend { void GuiSelection::haveSelection(bool own) { - if (!qApp->clipboard()->supportsSelection()) { - empty_ = !own; + if (!qApp->clipboard()->supportsSelection()) return; - } // Tell qt that we have a selection by setting a dummy selection. // We don't use the interface provided by Qt for setting the @@ -82,7 +80,7 @@ void GuiSelection::put(docstring const & str) bool GuiSelection::empty() const { if (!qApp->clipboard()->supportsSelection()) - return empty_; + return true; return qApp->clipboard()->text(QClipboard::Selection).isEmpty(); } diff --git a/src/frontends/qt4/GuiSelection.h b/src/frontends/qt4/GuiSelection.h index 860c3d16aa..8ffed6d326 100644 --- a/src/frontends/qt4/GuiSelection.h +++ b/src/frontends/qt4/GuiSelection.h @@ -25,7 +25,6 @@ namespace frontend { class GuiSelection: public Selection { public: - GuiSelection() : empty_(true) {} virtual ~GuiSelection() {} /** Selection overloaded methods @@ -36,14 +35,6 @@ public: void put(docstring const & str); bool empty() const; //@} -private: - /** - * Is the selection empty? - * Only used on systems that don't support a real selection to - * reflect the status of the internal selection of LyX. - * This is needed to emulate the X selection as far as possible. - */ - bool empty_; }; } // namespace frontend diff --git a/src/text3.C b/src/text3.C index 1212fcd1a4..cd5d7d0046 100644 --- a/src/text3.C +++ b/src/text3.C @@ -1757,7 +1757,7 @@ bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd, break; case LFUN_PRIMARY_SELECTION_PASTE: - enable = !theSelection().empty(); + enable = cur.selection() || !theSelection().empty(); break; case LFUN_PARAGRAPH_MOVE_UP: -- 2.39.2