void BufferView::Pimpl::selectionRequested()
{
+ static string sel;
+
if (!available())
return;
-
- string const sel(bv_->getLyXText()->selectionAsString(bv_->buffer(),
- false));
+
+ LyXText * text = bv_->getLyXText();
+
+ if (text->selection.set() &&
+ (!bv_->text->xsel_cache.set() ||
+ text->selection.start != bv_->text->xsel_cache.start ||
+ text->selection.end != bv_->text->xsel_cache.end))
+ {
+ bv_->text->xsel_cache = text->selection;
+ sel = text->selectionAsString(bv_->buffer(), false);
+ } else if (!text->selection.set()) {
+ sel = string();
+ bv_->text->xsel_cache.set(false);
+ }
if (!sel.empty()) {
workarea_.putClipboard(sel);
}
hideCursor();
toggleSelection();
bv_->getLyXText()->clearSelection();
- showCursor();
+ showCursor();
+ bv_->text->xsel_cache.set(false);
}
}
update(lt, BufferView::SELECT|BufferView::FITCUR);
showCursor();
}
+
+ if (!lt->selection.set())
+ workarea_.haveSelection(false);
/* ---> Everytime the cursor is moved, show the current font state. */
// should this too me moved out of this func?
case LFUN_PARENTINSERT:
{
- lyxerr << "arg " << argument << endl;
InsetCommandParams p("lyxparent", argument);
Inset * inset = new InsetParent(p, *buffer_);
if (!insertInset(inset, "Standard"))
| BufferView::FITCUR
| BufferView::CHANGE);
}
+ workarea_.haveSelection(false);
}
beforeChange(lt);
+2002-03-19 Juergen Vigna <jug@sad.it>
+
+ * text2.C (clearSelection): reset also xsel_cache.
+
+ * BufferView_pimpl.C (Dispatch): call WorkArea::haveSelection(false)
+ where it needs to be called (John tells us to do so too :)
+ (selectionLost): reset sel_cache.
+
+ * WorkArea.C (event_cb): leave ret to 0 (John tells us to do so :)
+
2002-03-19 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* text2.C (setCursorIntern): put debuging code in INSETS channel
case SelectionRequest:
lyxerr[Debug::GUI] << "X requested selection." << endl;
selectionRequested.emit();
- ret = 1;
+// ret = 1;
break;
case SelectionClear:
lyxerr[Debug::GUI] << "Lost selection." << endl;
selectionLost.emit();
- ret = 1;
+// ret = 1;
break;
}
return ret;
+2002-03-19 Juergen Vigna <jug@sad.it>
+
+ * insetgraphics.C (draw): fixed the setting of CHANGED_IN_DRAW!
+
2002-03-18 Angus Leeming <a.leeming@ic.ac.uk>
* insetgraphics.C: Clean up Baruch's comments a little.
// the status message may mean we changed size, so indicate
// we need a row redraw
- if (old_status_ != cached_status_) {
+ if (old_status_ != grfx::ErrorUnknown && old_status_ != cached_status_) {
bv->getLyXText()->status(bv, LyXText::CHANGED_IN_DRAW);
}
};
mutable Selection selection;
+ // this is used to handle XSelection events in the right manner
+ mutable Selection xsel_cache;
/// needed for the toggling (cursor position on last selection made)
mutable LyXCursor last_sel_cursor;
selection.set(false);
selection.mark(false);
last_sel_cursor = selection.end = selection.start = selection.cursor = cursor;
+ // reset this in the bv_owner!
+ if (bv_owner && bv_owner->text)
+ bv_owner->text->xsel_cache.set(false);
}