From: Lars Gullik Bjønnes Date: Mon, 3 Jul 2006 20:19:33 +0000 (+0000) Subject: First part of r14315 from the younes branch: X-Git-Tag: 1.6.10~13020 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=fb97c0689b250c5b1fba83eb0e13ad5c5ade70ca;p=lyx.git 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 --- diff --git a/src/BufferView.C b/src/BufferView.C index 1c56e33867..2f23937c28 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -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) { return pimpl_->getStatus(cmd); @@ -238,31 +226,31 @@ bool BufferView::dispatch(FuncRequest const & ev) void BufferView::selectionRequested() { - pimpl_->selectionRequested(); + pimpl_->selectionRequested(); } void BufferView::selectionLost() { - pimpl_->selectionLost(); + pimpl_->selectionLost(); } void BufferView::workAreaResize(int width, int height) { - pimpl_->workAreaResize(width, height); + pimpl_->workAreaResize(width, height); } void BufferView::workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state) { - pimpl_->workAreaKeyPress(key, state); + pimpl_->workAreaKeyPress(key, state); } 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 { return pimpl_->height(); diff --git a/src/BufferView.h b/src/BufferView.h index 357ab9acbb..c5423f936d 100644 --- a/src/BufferView.h +++ b/src/BufferView.h @@ -187,13 +187,6 @@ public: /// switch between primary and secondary keymaps for RTL entry 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 FuncStatus getStatus(FuncRequest const & cmd); /// execute the given function diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index b4ed4db808..2a16604e23 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -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) { diff --git a/src/BufferView_pimpl.h b/src/BufferView_pimpl.h index b5b42d1970..18a019f958 100644 --- a/src/BufferView_pimpl.h +++ b/src/BufferView_pimpl.h @@ -176,8 +176,6 @@ private: /// Timeout cursor_timeout; /// - void stuffClipboard(std::string const &) const; - /// bool using_xterm_cursor; /// class Position { @@ -219,6 +217,5 @@ private: ViewMetricsInfo metrics(bool singlepar = false); /// Working variable indicating a full screen refresh mutable bool refresh_inside_; - }; #endif // BUFFERVIEW_PIMPL_H diff --git a/src/CutAndPaste.C b/src/CutAndPaste.C index 7f7a0e0080..a418054c95 100644 --- a/src/CutAndPaste.C +++ b/src/CutAndPaste.C @@ -45,6 +45,10 @@ #include "support/lstrings.h" +#include "frontends/Gui.h" +#include "frontends/LyXView.h" +#include "frontends/Clipboard.h" + #include using lyx::pos_type; @@ -53,6 +57,9 @@ using lyx::textclass_type; using lyx::support::bformat; +using lyx::frontend::Gui; +using lyx::frontend::Clipboard; + using std::endl; using std::for_each; 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 // faster we need to be more clever and probably also have more // 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 recordUndoSelection(cur); @@ -555,7 +563,7 @@ void cutSelection(LCursor & cur, bool doclear, bool realcut) void copySelection(LCursor & cur) { // 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 if (!cur.selection()) diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index a8c9d8d95d..d927fe7095 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -38,7 +38,9 @@ #include "frontends/Alert.h" #include "frontends/font_metrics.h" +#include "frontends/Gui.h" #include "frontends/LyXView.h" +#include "frontends/Clipboard.h" #include "frontends/Painter.h" #include "frontends/nullpainter.h" @@ -54,6 +56,8 @@ using lyx::graphics::PreviewLoader; using lyx::support::ltrim; using lyx::frontend::Painter; +using lyx::frontend::Gui; +using lyx::frontend::Clipboard; using boost::shared_ptr; @@ -683,7 +687,7 @@ void InsetTabular::doDispatch(LCursor & cur, FuncRequest & cmd) break; case LFUN_PRIMARY_SELECTION_PASTE: { - string const clip = cur.bv().getClipboard(); + string const clip = cur.bv().owner()->gui().clipboard().get(); if (clip.empty()) break; // pass to InsertAsciiString, but @@ -1776,7 +1780,7 @@ bool InsetTabular::copySelection(LCursor & cur) ostringstream os; OutputParams const runparams; 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 // FIXME: this is a workaround for bug 1919. Should be removed for 1.5, // when we (hopefully) have a one-for-all paste mechanism. diff --git a/src/mathed/math_nestinset.C b/src/mathed/math_nestinset.C index d4967a7048..fe37369bc0 100644 --- a/src/mathed/math_nestinset.C +++ b/src/mathed/math_nestinset.C @@ -50,7 +50,9 @@ #include "support/lstrings.h" #include "frontends/Dialogs.h" +#include "frontends/Gui.h" #include "frontends/LyXView.h" +#include "frontends/Clipboard.h" #include "frontends/Painter.h" #include "frontends/nullpainter.h" @@ -62,6 +64,9 @@ using lyx::cap::cutSelection; using lyx::cap::replaceSelection; using lyx::cap::selClearOrDel; +using lyx::frontend::Gui; +using lyx::frontend::Clipboard; + using std::endl; using std::string; using std::istringstream; @@ -1083,7 +1088,7 @@ void MathNestInset::lfunMousePress(LCursor & cur, FuncRequest & cmd) if (cmd.button() == mouse_button::button2) { MathArray ar; - asArray(cur.bv().getClipboard(), ar); + asArray(cur.bv().owner()->gui().clipboard().get(), ar); cur.clearSelection(); editXY(cur, cmd.x, cmd.y); cur.insert(ar); @@ -1116,7 +1121,7 @@ void MathNestInset::lfunMouseRelease(LCursor & cur, FuncRequest & cmd) //lyxerr << "## lfunMouseRelease: buttons: " << cmd.button() << endl; if (cmd.button() == mouse_button::button1) { - //cur.bv().stuffClipboard(cur.grabSelection()); + //cur.bv().owner()->gui().clipboard().put(cur.grabSelection()); return; } diff --git a/src/text3.C b/src/text3.C index d74494cefd..49d204a3fd 100644 --- a/src/text3.C +++ b/src/text3.C @@ -47,7 +47,9 @@ #include "pariterator.h" #include "frontends/Dialogs.h" +#include "frontends/Gui.h" #include "frontends/LyXView.h" +#include "frontends/Clipboard.h" #include "insets/insetcommand.h" #include "insets/insetfloatlist.h" @@ -79,6 +81,9 @@ using lyx::cap::replaceSelection; using lyx::support::isStrUnsignedInt; using lyx::support::token; +using lyx::frontend::Gui; +using lyx::frontend::Clipboard; + using std::endl; using std::string; using std::istringstream; @@ -119,7 +124,7 @@ namespace { if (selecting || cur.mark()) cur.setSelection(); if (!cur.selection()) - cur.bv().haveSelection(false); + cur.bv().owner()->gui().clipboard().haveSelection(false); cur.bv().switchKeyMap(); } @@ -980,7 +985,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) case LFUN_PRIMARY_SELECTION_PASTE: { cur.clearSelection(); - string const clip = bv->getClipboard(); + string const clip = bv->owner()->gui().clipboard().get(); if (!clip.empty()) { recordUndo(cur); if (cmd.argument == "paragraph") @@ -1040,7 +1045,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) cursorEnd(cur); cur.setSelection(); bv->cursor() = cur; - bv->haveSelection(cur.selection()); + bv->owner()->gui().clipboard().haveSelection(cur.selection()); } break; @@ -1048,7 +1053,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) if (cmd.button() == mouse_button::button1) { selectWord(cur, lyx::WHOLE_WORD_STRICT); bv->cursor() = cur; - bv->haveSelection(cur.selection()); + bv->owner()->gui().clipboard().haveSelection(cur.selection()); } break; @@ -1130,7 +1135,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) // finish selection if (cmd.button() == mouse_button::button1) - bv->haveSelection(cur.selection()); + bv->owner()->gui().clipboard().haveSelection(cur.selection()); bv->switchKeyMap(); bv->owner()->updateMenubar(); @@ -1151,7 +1156,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) if (lyxrc.auto_region_delete) { if (cur.selection()) cutSelection(cur, false, false); - bv->haveSelection(false); + bv->owner()->gui().clipboard().haveSelection(false); } cur.clearSelection();