* src/LyXAction.C
(LyXAction::init): handle new LFUN_CLIPBOARD_PASTE
* src/insets/insettabular.C
(InsetTabular::doDispatch): ditto
* src/insets/insetbox.C
(InsetBox::doDispatch): ditto
* src/insets/insetert.C
(InsetERT::doDispatch): ditto
(InsetERT::getStatus): ditto
* src/insets/insetcharstyle.C
(InsetCharStyle::doDispatch): ditto
* src/BufferView_pimpl.C
(BufferView::Pimpl::selectionRequest): stuff selection, not clipboard
* src/mathed/math_nestinset.C
(MathNestInset::lfunMousePress): get stuff selection, not clipboard
(MathNestInset::lfunMouseRelease): clipboard -> selection in
commented code
* src/CutAndPaste.C
(cutSelection): ditto
* src/frontends/{qt3,gtk}/GuiImplementation.C
(GuiImplementation::newWorkArea): create new selection, not clipboard,
since the clipboard is now an object
(GuiImplementation::destroyWorkArea): destroy selection, not clipboard
* src/frontends/{qt4,qt3,gtk}/GuiSelection.h: new, copied from
GuiClipboard.h
* src/frontends/{qt4,qt3,gtk}/GuiSelection.C: new, copied from
GuiClipboard.C
* src/frontends/{qt3,gtk}/GuiImplementation.h
(selection): new accessor for selection_
(selection_): new, the global selection object
* src/frontends/{qt4,qt3,gtk}/Makefile.am: add GuiSelection.C and
GuiSelection.h
* src/frontends/{qt4,qt3,gtk}/GuiClipboard.C
(GuiClipboard::get): return clipboard, not selection
(GuiClipboard::put): stuff clipboard, not selection
* src/frontends/{qt4,qt3,gtk}/GuiClipboard.h
(haveSelection): remove (this is now in GuiSelection)
* src/frontends/{qt3,gtk}/GuiClipboard.h
(old_work_area_): remove, since it is not needed anymore
* src/frontends/gtk/ghelpers.C
(getGTKStockIcon): handle LFUN_CLIPBOARD_PASTE
* src/frontends/Clipboard.h
(haveSelection): remove (this is now in Selection)
* src/frontends/qt4/GuiImplementation.[Ch]
(GuiImplementation::selection): new accessor for selection_
* src/frontends/Gui.h
(selection): New accessor for the global selection object
* src/frontends/Selection.h; new, copied from Clipboard.h
* src/frontends/Makefile.am: add Selection.h
* src/text3.C
(various): s/clipboard().haveSelection/selection().haveSelection/
(LyXText::dispatch): handle LFUN_CLIPBOARD_PASTE
(LyXText::getStatus): ditto
* src/lfuns.h: new lfun LFUN_CLIPBOARD_PASTE
* lib/ui/stdmenus.ui: add new lfun LFUN_CLIPBOARD_PASTE
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14408
a592a061-630c-0410-9148-
cb99ea01b6c8
Item "Copy" "copy"
Item "Paste" "paste"
Submenu "Paste Recent" "pasterecent"
- Submenu "Paste External Selection" "edit_paste"
+ Submenu "Paste External Clipboard/Selection" "edit_paste"
Separator
Item "Find & Replace...|F" "dialog-show findreplace"
Separator
End
Menu "edit_paste"
+ Item "Clipboard as Lines|C" "clipboard-paste"
+ Item "Clipboard as Paragraphs|a" "clipboard-paste paragraph"
Item "Selection as Lines|L" "primary-selection-paste"
Item "Selection as Paragraphs|P" "primary-selection-paste paragraph"
End
#include "insets/insettext.h"
#include "frontends/Alert.h"
-#include "frontends/Clipboard.h"
#include "frontends/Dialogs.h"
#include "frontends/FileDialog.h"
#include "frontends/font_metrics.h"
#include "frontends/Gui.h"
#include "frontends/LyXView.h"
+#include "frontends/Selection.h"
#include "graphics/Previews.h"
xsel_cache_.set = cur.selection();
sel = cur.selectionAsString(false);
if (!sel.empty())
- owner_->gui().clipboard().put(sel);
+ owner_->gui().selection().put(sel);
}
}
// solved by running the line below only when the selection has
// finished. The solution used currently just works, to make it
// faster we need to be more clever and probably also have more
- // calls to stuffClipboard. (Lgb)
-// cur.bv().owner()->gui().clipboard().put(cur.selectionAsString(true));
+ // calls to cur.bv().owner()->gui().selection().put. (Lgb)
+// cur.bv().owner()->gui().selection().put(cur.selectionAsString(true));
// make sure that the depth behind the selection are restored, too
{ LFUN_CHAR_DELETE_FORWARD, "delete-forward", SingleParUpdate },
{ LFUN_CHAR_FORWARD, "char-forward", ReadOnly | NoUpdate},
{ LFUN_CHAR_FORWARD_SELECT, "forward-select", ReadOnly | SingleParUpdate },
+ { LFUN_CLIPBOARD_PASTE, "clipboard-paste", Noop },
{ LFUN_COMMAND_EXECUTE, "command-execute", NoBuffer },
{ LFUN_COMMAND_PREFIX, "command-prefix", NoBuffer },
{ LFUN_COMMAND_SEQUENCE, "command-sequence", NoBuffer },
public:
virtual ~Clipboard() {}
- /// a selection exists
- virtual void haveSelection(bool) = 0;
- /// get the X clipboard contents
+ /**
+ * Get the window system clipboard contents.
+ * This should be called when the user requests to paste from the
+ * clipboard.
+ */
virtual std::string const get() const = 0;
- /// fill the clipboard
+ /**
+ * Fill the window system clipboard.
+ * This should be called when the user requests to cut or copy to
+ * the clipboard.
+ */
virtual void put(std::string const &) = 0;
};
namespace frontend {
class Clipboard;
+class Selection;
class WorkArea;
///
virtual Clipboard & clipboard() = 0;
+ ///
+ virtual Selection & selection() = 0;
///
virtual int newView(unsigned int width, unsigned int height) = 0;
Toolbars.h \
Clipboard.h \
Gui.h \
+ Selection.h \
WorkArea.C \
WorkArea.h \
font_metrics.h \
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file Selection.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author unknown
+ * \author John Levon
+ * \author Abdelrazak Younes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef BASE_SELECTION_H
+#define BASE_SELECTION_H
+
+#include <string>
+
+namespace lyx {
+namespace frontend {
+
+/**
+ * A Selection class manages the selection.
+ */
+class Selection
+{
+public:
+ virtual ~Selection() {}
+
+ /// Tell the window system whether we have a selection.
+ virtual void haveSelection(bool) = 0;
+ /**
+ * Get the X selection contents.
+ * This is a noop on systems that don't have a selection.
+ * The format is plain text.
+ * This should be called when the user presses the middle mouse
+ * button.
+ */
+ virtual std::string const get() const = 0;
+ /**
+ * Fill the X selection.
+ * Does nothing on systems that don't have a selection.
+ * This should be called whenever some text is highlighted.
+ */
+ virtual void put(std::string const &) = 0;
+};
+
+} // namespace frontend
+} // namespace lyx
+
+#endif // BASE_SELECTION_H
// ENCODING: Gtk::Clipboard returns UTF-8, we assume that the backend
// wants ISO-8859-1 and convert it to that.
+// FIXME: Wrong!
string const GuiClipboard::get() const
{
Glib::RefPtr<Gtk::Clipboard> clipboard =
- Gtk::Clipboard::get(GDK_SELECTION_PRIMARY);
+ Gtk::Clipboard::get(GDK_SELECTION_CLIPBOARD);
string const str = Glib::convert_with_fallback(
clipboard->wait_for_text(), "ISO-8859-1", "UTF-8");
lyxerr[Debug::ACTION] << "GuiClipboard::get: " << str << endl;
// ENCODING: we assume that the backend passes us ISO-8859-1 and
// convert from that to UTF-8 before passing to GTK
+// FIXME: Wrong!
void GuiClipboard::put(string const & str)
{
lyxerr[Debug::ACTION] << "GuiClipboard::put: " << str << endl;
Glib::RefPtr<Gtk::Clipboard> clipboard =
- Gtk::Clipboard::get(GDK_SELECTION_PRIMARY);
+ Gtk::Clipboard::get(GDK_SELECTION_CLIPBOARD);
clipboard->set_text(Glib::convert(str, "UTF-8", "ISO-8859-1"));
}
#include "frontends/Clipboard.h"
-#include "GWorkArea.h"
-
namespace lyx {
namespace frontend {
class GuiClipboard: public lyx::frontend::Clipboard
{
public:
- GuiClipboard(GWorkArea * work_area)
- : old_work_area_(work_area)
- {
- }
-
virtual ~GuiClipboard() {}
/** Clipboard overloaded methods
*/
//@{
- void haveSelection(bool own)
- {
- old_work_area_->haveSelection(own);
- }
std::string const get() const;
void put(std::string const & str);
//@}
-
-private:
- GWorkArea * old_work_area_;
};
} // namespace frontend
old_work_area_.reset(new GWorkArea(*view_.get(), w, h));
old_screen_.reset(new GScreen(*old_work_area_.get()));
work_area_.reset(new GuiWorkArea(old_screen_.get(), old_work_area_.get()));
- clipboard_.reset(new GuiClipboard(old_work_area_.get()));
+ selection_.reset(new GuiSelection(old_work_area_.get()));
// FIXME BufferView creation should be independant of WorkArea creation
buffer_views_[0].reset(new BufferView(view_.get()));
void GuiImplementation::destroyWorkArea(int /*id*/)
{
- clipboard_.reset();
+ selection_.reset();
work_area_.reset();
old_work_area_.reset();
old_screen_.reset();
#include "GWorkArea.h"
#include "GuiClipboard.h"
+#include "GuiSelection.h"
#include "GuiWorkArea.h"
#include <boost/shared_ptr.hpp>
lyx::frontend::Clipboard & clipboard()
{
- return *clipboard_;
+ return clipboard_;
+ }
+
+ lyx::frontend::Selection & selection()
+ {
+ return *selection_;
}
int newView(unsigned int w, unsigned int h);
private:
///
- boost::shared_ptr<GuiClipboard> clipboard_;
+ GuiClipboard clipboard_;
+ ///
+ boost::shared_ptr<GuiSelection> selection_;
///
boost::shared_ptr<GuiWorkArea> work_area_;
///
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file gtk/GuiSelection.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Huang Ying
+ * \author Abdelrazak Younes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+// Too hard to make concept checks work with this file
+#ifdef _GLIBCXX_CONCEPT_CHECKS
+#undef _GLIBCXX_CONCEPT_CHECKS
+#endif
+#ifdef _GLIBCPP_CONCEPT_CHECKS
+#undef _GLIBCPP_CONCEPT_CHECKS
+#endif
+
+#include "GuiSelection.h"
+#include "debug.h"
+
+#include <gtkmm.h>
+
+using std::endl;
+using std::string;
+
+namespace lyx {
+namespace frontend {
+
+// ENCODING: Gtk::Clipboard returns UTF-8, we assume that the backend
+// wants ISO-8859-1 and convert it to that.
+// FIXME: Wrong!
+string const GuiSelection::get() const
+{
+ Glib::RefPtr<Gtk::Clipboard> clipboard =
+ Gtk::Clipboard::get(GDK_SELECTION_PRIMARY);
+ string const str = Glib::convert_with_fallback(
+ clipboard->wait_for_text(), "ISO-8859-1", "UTF-8");
+ lyxerr[Debug::ACTION] << "GuiClipboard::get: " << str << endl;
+ return str;
+}
+
+
+// ENCODING: we assume that the backend passes us ISO-8859-1 and
+// convert from that to UTF-8 before passing to GTK
+// FIXME: Wrong!
+void GuiSelection::put(string const & str)
+{
+ lyxerr[Debug::ACTION] << "GuiClipboard::put: " << str << endl;
+ Glib::RefPtr<Gtk::Clipboard> clipboard =
+ Gtk::Clipboard::get(GDK_SELECTION_PRIMARY);
+ clipboard->set_text(Glib::convert(str, "UTF-8", "ISO-8859-1"));
+}
+
+} // namespace frontend
+} // namespace lyx
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file gtk/Selection.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Abdelrazak Younes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef SELECTION_H
+#define SELECTION_H
+
+#include "frontends/Selection.h"
+
+#include "GWorkArea.h"
+
+namespace lyx {
+namespace frontend {
+
+/**
+ * The GTK version of the Selection.
+ */
+class GuiSelection: public lyx::frontend::Selection
+{
+public:
+ GuiSelection(GWorkArea * work_area)
+ : old_work_area_(work_area)
+ {
+ }
+
+ virtual ~GuiSelection() {}
+
+ /** Selection overloaded methods
+ */
+ //@{
+ void haveSelection(bool own)
+ {
+ old_work_area_->haveSelection(own);
+ }
+
+ std::string const get() const;
+
+ void put(std::string const & str);
+ //@}
+
+private:
+ GWorkArea * old_work_area_;
+};
+
+} // namespace frontend
+} // namespace lyx
+
+#endif // SELECTION_H
GUrl.C \
GUrl.h \
GuiClipboard.C GuiClipboard.h \
+ GuiSelection.C GuiSelection.h \
GuiWorkArea.h \
GView.C \
GView.h \
case LFUN_UNDO: return Gtk::Stock::UNDO;
case LFUN_REDO: return Gtk::Stock::REDO;
case LFUN_PASTE: return Gtk::Stock::PASTE;
+ case LFUN_CLIPBOARD_PASTE: return Gtk::Stock::PASTE;
case LFUN_PRIMARY_SELECTION_PASTE: return Gtk::Stock::PASTE;
case LFUN_CUT: return Gtk::Stock::CUT;
case LFUN_COPY: return Gtk::Stock::COPY;
string const GuiClipboard::get() const
{
- QString const str = qApp->clipboard()->text(QClipboard::Selection);
+ QString const str = qApp->clipboard()->text(QClipboard::Clipboard);
lyxerr[Debug::ACTION] << "GuiClipboard::get: " << (const char*) str
<< endl;
if (str.isNull())
lyxerr[Debug::ACTION] << "GuiClipboard::put: " << str << endl;
qApp->clipboard()->setText(toqstr(externalLineEnding(str)),
- QClipboard::Selection);
+ QClipboard::Clipboard);
}
} // namespace frontend
#include "frontends/Clipboard.h"
-#include "QWorkArea.h"
-
namespace lyx {
namespace frontend {
class GuiClipboard: public lyx::frontend::Clipboard
{
public:
- GuiClipboard(QWorkArea * work_area)
- : old_work_area_(work_area)
- {
- }
-
virtual ~GuiClipboard() {}
/** Clipboard overloaded methods
*/
//@{
- void haveSelection(bool own)
- {
- old_work_area_->haveSelection(own);
- }
std::string const get() const;
void put(std::string const & str);
//@}
-
-private:
- QWorkArea * old_work_area_;
};
} // namespace frontend
#include "QWorkArea.h"
#include "GuiClipboard.h"
+#include "GuiSelection.h"
#include "GuiWorkArea.h"
#include "BufferView.h"
lyx::frontend::Clipboard& clipboard()
{
- return *clipboard_;
+ return clipboard_;
+ }
+
+ lyx::frontend::Selection& selection()
+ {
+ return *selection_;
}
int newView(unsigned int /*w*/, unsigned int /*h*/)
old_work_area_.reset(new FWorkArea(*view_.get(), w, h));
old_screen_.reset(new FScreen(*old_work_area_.get()));
work_area_.reset(new GuiWorkArea(old_screen_.get(), old_work_area_.get()));
- clipboard_.reset(new GuiClipboard(old_work_area_.get()));
+ selection_.reset(new GuiSelection(old_work_area_.get()));
// FIXME BufferView creation should be independant of WorkArea creation
buffer_views_[0].reset(new BufferView(view_.get()));
void destroyWorkArea(int /*id*/)
{
- clipboard_.reset();
+ selection_.reset();
work_area_.reset();
old_work_area_.reset();
old_screen_.reset();
private:
///
- boost::shared_ptr<GuiClipboard> clipboard_;
+ GuiClipboard clipboard_;
+ ///
+ boost::shared_ptr<GuiSelection> selection_;
///
boost::shared_ptr<GuiWorkArea> work_area_;
///
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file qt3/GuiSelection.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author John Levon
+ * \author Abdelrazak Younes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "GuiSelection.h"
+#include "qt_helpers.h"
+
+#include "debug.h"
+
+#include <qapplication.h>
+#include <qclipboard.h>
+#include <qstring.h>
+
+#include "support/lstrings.h"
+using lyx::support::internalLineEnding;
+using lyx::support::externalLineEnding;
+
+using std::endl;
+using std::string;
+
+namespace lyx {
+namespace frontend {
+
+string const GuiSelection::get() const
+{
+ QString const str = qApp->clipboard()->text(QClipboard::Selection);
+ lyxerr[Debug::ACTION] << "GuiSelection::get: " << (const char*) str
+ << endl;
+ if (str.isNull())
+ return string();
+
+ return internalLineEnding(fromqstr(str));
+}
+
+
+void GuiSelection::put(string const & str)
+{
+ lyxerr[Debug::ACTION] << "GuiSelection::put: " << str << endl;
+
+ qApp->clipboard()->setText(toqstr(externalLineEnding(str)),
+ QClipboard::Selection);
+}
+
+} // namespace frontend
+} // namespace lyx
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file qt3/GuiSelection.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Abdelrazak Younes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef SELECTION_H
+#define SELECTION_H
+
+#include "frontends/Selection.h"
+
+#include "QWorkArea.h"
+
+namespace lyx {
+namespace frontend {
+
+/**
+ * The Qt3 version of the Selection.
+ */
+class GuiSelection: public lyx::frontend::Selection
+{
+public:
+ GuiSelection(QWorkArea * work_area)
+ : old_work_area_(work_area)
+ {
+ }
+
+ virtual ~GuiSelection() {}
+
+ /** Selection overloaded methods
+ */
+ //@{
+ void haveSelection(bool own)
+ {
+ old_work_area_->haveSelection(own);
+ }
+
+ std::string const get() const;
+
+ void put(std::string const & str);
+ //@}
+
+private:
+ QWorkArea * old_work_area_;
+};
+
+} // namespace frontend
+} // namespace lyx
+
+#endif // SELECTION_H
FileDialog.C \
GuiClipboard.C GuiClipboard.h \
GuiImplementation.h \
+ GuiSelection.C GuiSelection.h \
GuiWorkArea.h \
LyXKeySymFactory.C \
QLMenubar.C QLMenubar.h \
namespace lyx {
namespace frontend {
-#ifdef Q_WS_X11
-QClipboard::Mode const CLIPBOARD_MODE = QClipboard::Selection;
-#else
-// FIXME external clipboard support is mostly broken for windows
-// because the following fixe would involves too much side effects WRT mouse selection.
-//QClipboard::Mode const CLIPBOARD_MODE = QClipboard::Clipboard;
-QClipboard::Mode const CLIPBOARD_MODE = QClipboard::Selection;
-#endif
-
-void GuiClipboard::haveSelection(bool own)
-{
- if (!qApp->clipboard()->supportsSelection())
- return;
-
- if (own) {
- qApp->clipboard()->setText(QString(), CLIPBOARD_MODE);
- }
- // We don't need to do anything if own = false, as this case is
- // handled by QT.
-}
-
-
string const GuiClipboard::get() const
{
- QString str = qApp->clipboard()->text(CLIPBOARD_MODE);
+ QString const str = qApp->clipboard()->text(QClipboard::Clipboard);
lyxerr[Debug::ACTION] << "GuiClipboard::get: " << (const char*) str
<< endl;
if (str.isNull())
{
lyxerr[Debug::ACTION] << "GuiClipboard::put: " << str << endl;
- qApp->clipboard()->setText(toqstr(externalLineEnding(str)), CLIPBOARD_MODE);
+ qApp->clipboard()->setText(toqstr(externalLineEnding(str)),
+ QClipboard::Clipboard);
}
} // namespace frontend
class GuiClipboard: public Clipboard
{
public:
- GuiClipboard() {}
-
virtual ~GuiClipboard() {}
/** Clipboard overloaded methods
*/
//@{
- void haveSelection(bool own);
std::string const get() const;
void put(std::string const & str);
//@}
}
+Selection& GuiImplementation::selection()
+{
+ return selection_;
+}
+
+
int GuiImplementation::newView(unsigned int /*w*/, unsigned int /*h*/)
{
size_t const id = max_view_id_;
#include "frontends/Gui.h"
#include "GuiClipboard.h"
+#include "GuiSelection.h"
#include <boost/shared_ptr.hpp>
virtual ~GuiImplementation() {}
Clipboard& clipboard();
+ Selection& selection();
int newView(unsigned int width, unsigned int height);
LyXView& view(int id);
///
GuiClipboard clipboard_;
///
+ GuiSelection selection_;
+ ///
std::map<int, boost::shared_ptr<GuiView> > views_;
///
std::map<int, boost::shared_ptr<GuiWorkArea> > work_areas_;
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file qt4/GuiSelection.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author John Levon
+ * \author Abdelrazak Younes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "GuiSelection.h"
+#include "qt_helpers.h"
+
+#include "debug.h"
+
+#include <QApplication>
+#include <QClipboard>
+#include <QString>
+
+#include "support/lstrings.h"
+using lyx::support::internalLineEnding;
+using lyx::support::externalLineEnding;
+
+using std::endl;
+using std::string;
+
+namespace lyx {
+namespace frontend {
+
+void GuiSelection::haveSelection(bool own)
+{
+ if (!qApp->clipboard()->supportsSelection())
+ return;
+
+ if (own)
+ qApp->clipboard()->setText(QString(), QClipboard::Selection);
+ // We don't need to do anything if own = false, as this case is
+ // handled by QT.
+}
+
+
+string const GuiSelection::get() const
+{
+ QString const str = qApp->clipboard()->text(QClipboard::Selection);
+ lyxerr[Debug::ACTION] << "GuiSelection::get: " << (const char*) str
+ << endl;
+ if (str.isNull())
+ return string();
+
+ return internalLineEnding(fromqstr(str));
+}
+
+
+void GuiSelection::put(string const & str)
+{
+ lyxerr[Debug::ACTION] << "GuiSelection::put: " << str << endl;
+
+ qApp->clipboard()->setText(toqstr(externalLineEnding(str)),
+ QClipboard::Selection);
+}
+
+} // namespace frontend
+} // namespace lyx
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file qt4/GuiSelection.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author unknown
+ * \author John Levon
+ * \author Abdelrazak Younes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef SELECTION_H
+#define SELECTION_H
+
+#include "frontends/Selection.h"
+
+namespace lyx {
+namespace frontend {
+
+/**
+ * The Qt4 version of the Selection.
+ */
+class GuiSelection: public Selection
+{
+public:
+ virtual ~GuiSelection() {}
+
+ /** Selection overloaded methods
+ */
+ //@{
+ void haveSelection(bool own);
+ std::string const get() const;
+ void put(std::string const & str);
+ //@}
+};
+
+} // namespace frontend
+} // namespace lyx
+
+#endif // SELECTION_H
FileDialog.C \
FontLoader.h FontLoader.C \
GuiClipboard.h GuiClipboard.C \
+ GuiSelection.h GuiSelection.C \
GuiImplementation.h GuiImplementation.C \
LyXKeySymFactory.C \
QLMenubar.C QLMenubar.h \
InsetCollapsable::doDispatch(cur, cmd);
break;
case LFUN_PASTE:
+ case LFUN_CLIPBOARD_PASTE:
case LFUN_PRIMARY_SELECTION_PASTE:
InsetCollapsable::doDispatch(cur, cmd);
if (!params_.inner_box)
InsetText::doDispatch(cur, cmd);
break;
case LFUN_PASTE:
+ case LFUN_CLIPBOARD_PASTE:
case LFUN_PRIMARY_SELECTION_PASTE: {
InsetCollapsable::doDispatch(cur, cmd);
forceParagraphsToDefault(cur);
break;
}
case LFUN_PASTE:
+ case LFUN_CLIPBOARD_PASTE:
case LFUN_PRIMARY_SELECTION_PASTE: {
InsetCollapsable::doDispatch(cur, cmd);
case LFUN_QUOTE_INSERT:
case LFUN_INSET_MODIFY:
case LFUN_PASTE:
+ case LFUN_CLIPBOARD_PASTE:
case LFUN_PRIMARY_SELECTION_PASTE:
status.enabled(true);
return true;
#include "frontends/LyXView.h"
#include "frontends/Clipboard.h"
#include "frontends/Painter.h"
+#include "frontends/Selection.h"
#include "frontends/nullpainter.h"
#include <sstream>
cell(cur.idx())->dispatch(cur, cmd);
break;
+ case LFUN_CLIPBOARD_PASTE:
case LFUN_PRIMARY_SELECTION_PASTE: {
- string const clip = cur.bv().owner()->gui().clipboard().get();
+ string const clip = (cmd.action == LFUN_CLIPBOARD_PASTE) ?
+ cur.bv().owner()->gui().clipboard().get() :
+ cur.bv().owner()->gui().selection().get();
if (clip.empty())
break;
// pass to InsertAsciiString, but
// 280
LFUN_BUFFER_TOGGLE_COMPRESSION, // bpeng 20060427
LFUN_MATH_BIGDELIM,
+ LFUN_CLIPBOARD_PASTE,
LFUN_LASTACTION // end of the table
};
#include "frontends/Dialogs.h"
#include "frontends/Gui.h"
#include "frontends/LyXView.h"
-#include "frontends/Clipboard.h"
#include "frontends/Painter.h"
+#include "frontends/Selection.h"
#include "frontends/nullpainter.h"
#include <sstream>
if (cmd.button() == mouse_button::button2) {
MathArray ar;
- asArray(cur.bv().owner()->gui().clipboard().get(), ar);
+ asArray(cur.bv().owner()->gui().selection().get(), ar);
cur.clearSelection();
editXY(cur, cmd.x, cmd.y);
cur.insert(ar);
//lyxerr << "## lfunMouseRelease: buttons: " << cmd.button() << endl;
if (cmd.button() == mouse_button::button1) {
- //cur.bv().owner()->gui().clipboard().put(cur.grabSelection());
+ //cur.bv().owner()->gui().selection().put(cur.grabSelection());
return;
}
#include "frontends/Gui.h"
#include "frontends/LyXView.h"
#include "frontends/Clipboard.h"
+#include "frontends/Selection.h"
#include "insets/insetcommand.h"
#include "insets/insetfloatlist.h"
if (selecting || cur.mark())
cur.setSelection();
if (!cur.selection())
- cur.bv().owner()->gui().clipboard().haveSelection(false);
+ cur.bv().owner()->gui().selection().haveSelection(false);
cur.bv().switchKeyMap();
}
break;
}
- case LFUN_PRIMARY_SELECTION_PASTE: {
+ case LFUN_CLIPBOARD_PASTE: {
cur.clearSelection();
string const clip = bv->owner()->gui().clipboard().get();
if (!clip.empty()) {
break;
}
+ case LFUN_PRIMARY_SELECTION_PASTE: {
+ cur.clearSelection();
+ string const clip = bv->owner()->gui().selection().get();
+ if (!clip.empty()) {
+ recordUndo(cur);
+ if (cmd.argument == "paragraph")
+ insertStringAsParagraphs(cur, clip);
+ else
+ insertStringAsLines(cur, clip);
+ }
+ break;
+ }
+
case LFUN_QUOTE_INSERT: {
lyx::cap::replaceSelection(cur);
Paragraph & par = cur.paragraph();
cursorEnd(cur);
cur.setSelection();
bv->cursor() = cur;
- bv->owner()->gui().clipboard().haveSelection(cur.selection());
+ bv->owner()->gui().selection().haveSelection(cur.selection());
}
break;
if (cmd.button() == mouse_button::button1) {
selectWord(cur, lyx::WHOLE_WORD_STRICT);
bv->cursor() = cur;
- bv->owner()->gui().clipboard().haveSelection(cur.selection());
+ bv->owner()->gui().selection().haveSelection(cur.selection());
}
break;
// finish selection
if (cmd.button() == mouse_button::button1)
- bv->owner()->gui().clipboard().haveSelection(cur.selection());
+ bv->owner()->gui().selection().haveSelection(cur.selection());
bv->switchKeyMap();
bv->owner()->updateMenubar();
if (lyxrc.auto_region_delete) {
if (cur.selection())
cutSelection(cur, false, false);
- bv->owner()->gui().clipboard().haveSelection(false);
+ bv->owner()->gui().selection().haveSelection(false);
}
cur.clearSelection();
case LFUN_SERVER_GET_FONT:
case LFUN_SERVER_GET_LAYOUT:
case LFUN_LAYOUT:
+ case LFUN_CLIPBOARD_PASTE:
case LFUN_PRIMARY_SELECTION_PASTE:
case LFUN_DATE_INSERT:
case LFUN_SELF_INSERT: