mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-24 13:48:59 +00:00
First part of r14315 from the younes branch:
* BufferView and BufferView::pimpl: - getClipboard, stuffClipboard, haveSelection: deleted * CutAndPaste.C: use BufferView::owner()->gui().clipboard() * insettabular.C: ditto * math_nestinset.C: ditto * text3.C: ditto git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14323 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c267eec1c9
commit
fb97c0689b
@ -212,18 +212,6 @@ void BufferView::center()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const BufferView::getClipboard() const
|
|
||||||
{
|
|
||||||
return pimpl_->gui().clipboard().get();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void BufferView::stuffClipboard(string const & stuff) const
|
|
||||||
{
|
|
||||||
pimpl_->stuffClipboard(stuff);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
FuncStatus BufferView::getStatus(FuncRequest const & cmd)
|
FuncStatus BufferView::getStatus(FuncRequest const & cmd)
|
||||||
{
|
{
|
||||||
return pimpl_->getStatus(cmd);
|
return pimpl_->getStatus(cmd);
|
||||||
@ -238,31 +226,31 @@ bool BufferView::dispatch(FuncRequest const & ev)
|
|||||||
|
|
||||||
void BufferView::selectionRequested()
|
void BufferView::selectionRequested()
|
||||||
{
|
{
|
||||||
pimpl_->selectionRequested();
|
pimpl_->selectionRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BufferView::selectionLost()
|
void BufferView::selectionLost()
|
||||||
{
|
{
|
||||||
pimpl_->selectionLost();
|
pimpl_->selectionLost();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BufferView::workAreaResize(int width, int height)
|
void BufferView::workAreaResize(int width, int height)
|
||||||
{
|
{
|
||||||
pimpl_->workAreaResize(width, height);
|
pimpl_->workAreaResize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BufferView::workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state)
|
void BufferView::workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state)
|
||||||
{
|
{
|
||||||
pimpl_->workAreaKeyPress(key, state);
|
pimpl_->workAreaKeyPress(key, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool BufferView::workAreaDispatch(FuncRequest const & ev)
|
bool BufferView::workAreaDispatch(FuncRequest const & ev)
|
||||||
{
|
{
|
||||||
return pimpl_->workAreaDispatch(ev);
|
return pimpl_->workAreaDispatch(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -338,12 +326,6 @@ LyXText const * BufferView::getLyXText() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BufferView::haveSelection(bool sel)
|
|
||||||
{
|
|
||||||
pimpl_->gui().clipboard().haveSelection(sel);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int BufferView::workHeight() const
|
int BufferView::workHeight() const
|
||||||
{
|
{
|
||||||
return pimpl_->height();
|
return pimpl_->height();
|
||||||
|
@ -187,13 +187,6 @@ public:
|
|||||||
/// switch between primary and secondary keymaps for RTL entry
|
/// switch between primary and secondary keymaps for RTL entry
|
||||||
void switchKeyMap();
|
void switchKeyMap();
|
||||||
|
|
||||||
/// get the contents of the window system clipboard
|
|
||||||
std::string const getClipboard() const;
|
|
||||||
/// fill the window system clipboard
|
|
||||||
void stuffClipboard(std::string const &) const;
|
|
||||||
/// tell the window system we have a selection
|
|
||||||
void haveSelection(bool sel);
|
|
||||||
|
|
||||||
/// return true for events that will handle
|
/// return true for events that will handle
|
||||||
FuncStatus getStatus(FuncRequest const & cmd);
|
FuncStatus getStatus(FuncRequest const & cmd);
|
||||||
/// execute the given function
|
/// execute the given function
|
||||||
|
@ -872,11 +872,6 @@ void BufferView::Pimpl::center()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BufferView::Pimpl::stuffClipboard(string const & content) const
|
|
||||||
{
|
|
||||||
owner_->gui().clipboard().put(content);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void BufferView::Pimpl::menuInsertLyXFile(string const & filenm)
|
void BufferView::Pimpl::menuInsertLyXFile(string const & filenm)
|
||||||
{
|
{
|
||||||
|
@ -176,8 +176,6 @@ private:
|
|||||||
///
|
///
|
||||||
Timeout cursor_timeout;
|
Timeout cursor_timeout;
|
||||||
///
|
///
|
||||||
void stuffClipboard(std::string const &) const;
|
|
||||||
///
|
|
||||||
bool using_xterm_cursor;
|
bool using_xterm_cursor;
|
||||||
///
|
///
|
||||||
class Position {
|
class Position {
|
||||||
@ -219,6 +217,5 @@ private:
|
|||||||
ViewMetricsInfo metrics(bool singlepar = false);
|
ViewMetricsInfo metrics(bool singlepar = false);
|
||||||
/// Working variable indicating a full screen refresh
|
/// Working variable indicating a full screen refresh
|
||||||
mutable bool refresh_inside_;
|
mutable bool refresh_inside_;
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif // BUFFERVIEW_PIMPL_H
|
#endif // BUFFERVIEW_PIMPL_H
|
||||||
|
@ -45,6 +45,10 @@
|
|||||||
|
|
||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
|
|
||||||
|
#include "frontends/Gui.h"
|
||||||
|
#include "frontends/LyXView.h"
|
||||||
|
#include "frontends/Clipboard.h"
|
||||||
|
|
||||||
#include <boost/tuple/tuple.hpp>
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
|
||||||
using lyx::pos_type;
|
using lyx::pos_type;
|
||||||
@ -53,6 +57,9 @@ using lyx::textclass_type;
|
|||||||
|
|
||||||
using lyx::support::bformat;
|
using lyx::support::bformat;
|
||||||
|
|
||||||
|
using lyx::frontend::Gui;
|
||||||
|
using lyx::frontend::Clipboard;
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using std::for_each;
|
using std::for_each;
|
||||||
using std::make_pair;
|
using std::make_pair;
|
||||||
@ -492,7 +499,8 @@ void cutSelection(LCursor & cur, bool doclear, bool realcut)
|
|||||||
// finished. The solution used currently just works, to make it
|
// finished. The solution used currently just works, to make it
|
||||||
// faster we need to be more clever and probably also have more
|
// faster we need to be more clever and probably also have more
|
||||||
// calls to stuffClipboard. (Lgb)
|
// calls to stuffClipboard. (Lgb)
|
||||||
// cur.bv().stuffClipboard(cur.selectionAsString(true));
|
// cur.bv().owner()->gui().clipboard().put(cur.selectionAsString(true));
|
||||||
|
|
||||||
|
|
||||||
// make sure that the depth behind the selection are restored, too
|
// make sure that the depth behind the selection are restored, too
|
||||||
recordUndoSelection(cur);
|
recordUndoSelection(cur);
|
||||||
@ -555,7 +563,7 @@ void cutSelection(LCursor & cur, bool doclear, bool realcut)
|
|||||||
void copySelection(LCursor & cur)
|
void copySelection(LCursor & cur)
|
||||||
{
|
{
|
||||||
// stuff the selection onto the X clipboard, from an explicit copy request
|
// stuff the selection onto the X clipboard, from an explicit copy request
|
||||||
cur.bv().stuffClipboard(cur.selectionAsString(true));
|
cur.bv().owner()->gui().clipboard().put(cur.selectionAsString(true));
|
||||||
|
|
||||||
// this doesn't make sense, if there is no selection
|
// this doesn't make sense, if there is no selection
|
||||||
if (!cur.selection())
|
if (!cur.selection())
|
||||||
|
@ -38,7 +38,9 @@
|
|||||||
|
|
||||||
#include "frontends/Alert.h"
|
#include "frontends/Alert.h"
|
||||||
#include "frontends/font_metrics.h"
|
#include "frontends/font_metrics.h"
|
||||||
|
#include "frontends/Gui.h"
|
||||||
#include "frontends/LyXView.h"
|
#include "frontends/LyXView.h"
|
||||||
|
#include "frontends/Clipboard.h"
|
||||||
#include "frontends/Painter.h"
|
#include "frontends/Painter.h"
|
||||||
#include "frontends/nullpainter.h"
|
#include "frontends/nullpainter.h"
|
||||||
|
|
||||||
@ -54,6 +56,8 @@ using lyx::graphics::PreviewLoader;
|
|||||||
using lyx::support::ltrim;
|
using lyx::support::ltrim;
|
||||||
|
|
||||||
using lyx::frontend::Painter;
|
using lyx::frontend::Painter;
|
||||||
|
using lyx::frontend::Gui;
|
||||||
|
using lyx::frontend::Clipboard;
|
||||||
|
|
||||||
using boost::shared_ptr;
|
using boost::shared_ptr;
|
||||||
|
|
||||||
@ -683,7 +687,7 @@ void InsetTabular::doDispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_PRIMARY_SELECTION_PASTE: {
|
case LFUN_PRIMARY_SELECTION_PASTE: {
|
||||||
string const clip = cur.bv().getClipboard();
|
string const clip = cur.bv().owner()->gui().clipboard().get();
|
||||||
if (clip.empty())
|
if (clip.empty())
|
||||||
break;
|
break;
|
||||||
// pass to InsertAsciiString, but
|
// pass to InsertAsciiString, but
|
||||||
@ -1776,7 +1780,7 @@ bool InsetTabular::copySelection(LCursor & cur)
|
|||||||
ostringstream os;
|
ostringstream os;
|
||||||
OutputParams const runparams;
|
OutputParams const runparams;
|
||||||
paste_tabular->plaintext(cur.buffer(), os, runparams, 0, true, '\t');
|
paste_tabular->plaintext(cur.buffer(), os, runparams, 0, true, '\t');
|
||||||
cur.bv().stuffClipboard(os.str());
|
cur.bv().owner()->gui().clipboard().put(os.str());
|
||||||
// mark tabular stack dirty
|
// mark tabular stack dirty
|
||||||
// FIXME: this is a workaround for bug 1919. Should be removed for 1.5,
|
// FIXME: this is a workaround for bug 1919. Should be removed for 1.5,
|
||||||
// when we (hopefully) have a one-for-all paste mechanism.
|
// when we (hopefully) have a one-for-all paste mechanism.
|
||||||
|
@ -50,7 +50,9 @@
|
|||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
|
|
||||||
#include "frontends/Dialogs.h"
|
#include "frontends/Dialogs.h"
|
||||||
|
#include "frontends/Gui.h"
|
||||||
#include "frontends/LyXView.h"
|
#include "frontends/LyXView.h"
|
||||||
|
#include "frontends/Clipboard.h"
|
||||||
#include "frontends/Painter.h"
|
#include "frontends/Painter.h"
|
||||||
#include "frontends/nullpainter.h"
|
#include "frontends/nullpainter.h"
|
||||||
|
|
||||||
@ -62,6 +64,9 @@ using lyx::cap::cutSelection;
|
|||||||
using lyx::cap::replaceSelection;
|
using lyx::cap::replaceSelection;
|
||||||
using lyx::cap::selClearOrDel;
|
using lyx::cap::selClearOrDel;
|
||||||
|
|
||||||
|
using lyx::frontend::Gui;
|
||||||
|
using lyx::frontend::Clipboard;
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::istringstream;
|
using std::istringstream;
|
||||||
@ -1083,7 +1088,7 @@ void MathNestInset::lfunMousePress(LCursor & cur, FuncRequest & cmd)
|
|||||||
|
|
||||||
if (cmd.button() == mouse_button::button2) {
|
if (cmd.button() == mouse_button::button2) {
|
||||||
MathArray ar;
|
MathArray ar;
|
||||||
asArray(cur.bv().getClipboard(), ar);
|
asArray(cur.bv().owner()->gui().clipboard().get(), ar);
|
||||||
cur.clearSelection();
|
cur.clearSelection();
|
||||||
editXY(cur, cmd.x, cmd.y);
|
editXY(cur, cmd.x, cmd.y);
|
||||||
cur.insert(ar);
|
cur.insert(ar);
|
||||||
@ -1116,7 +1121,7 @@ void MathNestInset::lfunMouseRelease(LCursor & cur, FuncRequest & cmd)
|
|||||||
//lyxerr << "## lfunMouseRelease: buttons: " << cmd.button() << endl;
|
//lyxerr << "## lfunMouseRelease: buttons: " << cmd.button() << endl;
|
||||||
|
|
||||||
if (cmd.button() == mouse_button::button1) {
|
if (cmd.button() == mouse_button::button1) {
|
||||||
//cur.bv().stuffClipboard(cur.grabSelection());
|
//cur.bv().owner()->gui().clipboard().put(cur.grabSelection());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
17
src/text3.C
17
src/text3.C
@ -47,7 +47,9 @@
|
|||||||
#include "pariterator.h"
|
#include "pariterator.h"
|
||||||
|
|
||||||
#include "frontends/Dialogs.h"
|
#include "frontends/Dialogs.h"
|
||||||
|
#include "frontends/Gui.h"
|
||||||
#include "frontends/LyXView.h"
|
#include "frontends/LyXView.h"
|
||||||
|
#include "frontends/Clipboard.h"
|
||||||
|
|
||||||
#include "insets/insetcommand.h"
|
#include "insets/insetcommand.h"
|
||||||
#include "insets/insetfloatlist.h"
|
#include "insets/insetfloatlist.h"
|
||||||
@ -79,6 +81,9 @@ using lyx::cap::replaceSelection;
|
|||||||
using lyx::support::isStrUnsignedInt;
|
using lyx::support::isStrUnsignedInt;
|
||||||
using lyx::support::token;
|
using lyx::support::token;
|
||||||
|
|
||||||
|
using lyx::frontend::Gui;
|
||||||
|
using lyx::frontend::Clipboard;
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::istringstream;
|
using std::istringstream;
|
||||||
@ -119,7 +124,7 @@ namespace {
|
|||||||
if (selecting || cur.mark())
|
if (selecting || cur.mark())
|
||||||
cur.setSelection();
|
cur.setSelection();
|
||||||
if (!cur.selection())
|
if (!cur.selection())
|
||||||
cur.bv().haveSelection(false);
|
cur.bv().owner()->gui().clipboard().haveSelection(false);
|
||||||
cur.bv().switchKeyMap();
|
cur.bv().switchKeyMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -980,7 +985,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
|
|
||||||
case LFUN_PRIMARY_SELECTION_PASTE: {
|
case LFUN_PRIMARY_SELECTION_PASTE: {
|
||||||
cur.clearSelection();
|
cur.clearSelection();
|
||||||
string const clip = bv->getClipboard();
|
string const clip = bv->owner()->gui().clipboard().get();
|
||||||
if (!clip.empty()) {
|
if (!clip.empty()) {
|
||||||
recordUndo(cur);
|
recordUndo(cur);
|
||||||
if (cmd.argument == "paragraph")
|
if (cmd.argument == "paragraph")
|
||||||
@ -1040,7 +1045,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
cursorEnd(cur);
|
cursorEnd(cur);
|
||||||
cur.setSelection();
|
cur.setSelection();
|
||||||
bv->cursor() = cur;
|
bv->cursor() = cur;
|
||||||
bv->haveSelection(cur.selection());
|
bv->owner()->gui().clipboard().haveSelection(cur.selection());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1048,7 +1053,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
if (cmd.button() == mouse_button::button1) {
|
if (cmd.button() == mouse_button::button1) {
|
||||||
selectWord(cur, lyx::WHOLE_WORD_STRICT);
|
selectWord(cur, lyx::WHOLE_WORD_STRICT);
|
||||||
bv->cursor() = cur;
|
bv->cursor() = cur;
|
||||||
bv->haveSelection(cur.selection());
|
bv->owner()->gui().clipboard().haveSelection(cur.selection());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1130,7 +1135,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
|
|
||||||
// finish selection
|
// finish selection
|
||||||
if (cmd.button() == mouse_button::button1)
|
if (cmd.button() == mouse_button::button1)
|
||||||
bv->haveSelection(cur.selection());
|
bv->owner()->gui().clipboard().haveSelection(cur.selection());
|
||||||
|
|
||||||
bv->switchKeyMap();
|
bv->switchKeyMap();
|
||||||
bv->owner()->updateMenubar();
|
bv->owner()->updateMenubar();
|
||||||
@ -1151,7 +1156,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
if (lyxrc.auto_region_delete) {
|
if (lyxrc.auto_region_delete) {
|
||||||
if (cur.selection())
|
if (cur.selection())
|
||||||
cutSelection(cur, false, false);
|
cutSelection(cur, false, false);
|
||||||
bv->haveSelection(false);
|
bv->owner()->gui().clipboard().haveSelection(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur.clearSelection();
|
cur.clearSelection();
|
||||||
|
Loading…
Reference in New Issue
Block a user