void BufferView::copy()
{
if (available()) {
- text->copySelection(this);
+ getLyXText()->copySelection(this);
owner()->message(_("Copy"));
}
}
void BufferView::paste()
{
- if (!available()) return;
+ if (!available())
+ return;
owner()->message(_("Paste"));
// paste
text->pasteSelection(this);
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
-
+// why fake a selection only I think it should be a real one and not only
+// a painted one (Jug 20020318).
+#if 0
// clear the selection
toggleSelection();
text->clearSelection();
update(text, BufferView::SELECT|BufferView::FITCUR);
+#endif
}
void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
unsigned int button)
{
- if (!buffer_ || !screen_.get()) return;
+ if (!buffer_ || !screen_.get())
+ return;
Inset * inset_hit = checkInsetHit(bv_->text, xpos, ypos);
}
}
+ // Middle button press pastes if we have a selection
+ // We do this here as if the selection was inside an inset
+ // it could get cleared on the unlocking of the inset so
+ // we have to check this first
+ bool paste_internally = false;
+ if (button == 2 && bv_->getLyXText()->selection.set()) {
+ owner_->getLyXFunc()->dispatch(LFUN_COPY);
+ paste_internally = true;
+ }
+
if (bv_->theLockingInset()) {
// We are in inset locking mode
int const screen_first = bv_->text->first_y;
- // Middle button press pastes if we have a selection
- bool paste_internally = false;
- if (button == 2
- && bv_->text->selection.set()) {
- owner_->getLyXFunc()->dispatch(LFUN_COPY);
- paste_internally = true;
- }
-
// Clear the selection
screen_->toggleSelection(bv_->text, bv_);
bv_->text->clearSelection();
owner_->getLyXFunc()->dispatch(LFUN_PASTE);
else
owner_->getLyXFunc()->dispatch(LFUN_PASTESELECTION,
- "paragraph");
+ "paragraph");
selection_possible = false;
return;
}
void BufferView::Pimpl::pasteClipboard(bool asPara)
{
- if (!buffer_) return;
+ if (!buffer_)
+ return;
screen_->hideCursor();
beforeChange(bv_->text);
string const clip(workarea_.getClipboard());
- if (clip.empty()) return;
+ if (clip.empty())
+ return;
if (asPara) {
bv_->getLyXText()->insertStringAsParagraphs(bv_, clip);
case LFUN_PASTESELECTION:
{
- bool asPara = false;
+ bool asPara = false;
if (argument == "paragraph")
asPara = true;
pasteClipboard(asPara);
+2002-03-18 Juergen Vigna <jug@sad.it>
+
+ * BufferView2.C (copy): use getLyXText() so that we do it inside an
+ inset if we're there actually (probably not used right now but this
+ is the direction to go for unifying code).
+ (paste): disable code to clear the selection.
+
+ * BufferView_pimpl.C (workAreaButtonPress): check also for a selection
+ inside an InsetText and move the check further up as it is in the
+ wrong place.
+
+ * text2.C (pasteSelection): set a selection over the pasted text.
+
2002-03-14 Kayvan A. Sylvan <kayvan@sylvan.com>
* Makefile.am (lyx_DEPENDENCIES): Swap the order of libfrontend
int pos = cursor.pos();
CutAndPaste::pasteSelection(&actpar, &endpar, pos,
- bview->buffer()->params.textclass);
+ bview->buffer()->params.textclass);
redoParagraphs(bview, cursor, endpar);
setCursor(bview, cursor.par(), cursor.pos());
clearSelection();
-
+
+ selection.cursor = cursor;
setCursor(bview, actpar, pos);
+ setSelection(bview);
updateCounters(bview, cursor.row());
}