Am Samstag, 8. Juli 2006 22:17 schrieb Bo Peng: > { LFUN_CHAR_FORWARD_SELECT, "forward-select", ReadOnly | SingleParUpdate }, > + { LFUN_CLIPBOARD_PASTE, "clipboard-paste", Noop }, > > For C-v or menu paste only, right?
Not C-v, only menu paste. C-v is bound to LFUN_PASTE. > + 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(); > > Why don't we handle these two actions separately? Because I did not want to duplicate code. > My understanding > is that the first should be triggered by C-v, the second by > middle-button. The first is triggered by the clipboard-paste lfun (see my other mail why C-v does not work). The second is indeed triggered by middle mouse button. > > + return clipboard_; > + return *selection_; > > + GuiClipboard clipboard_; > + /// > + boost::shared_ptr<GuiSelection> selection_; > /// > > Is there a particular reason why clipboard is an object and > selection is a pointer? Yes. All should be objects (see qt4), but in qt3 and gtk selection needs a workarea, and is therefore a pointer. > > > + case LFUN_CLIPBOARD_PASTE: > case LFUN_PRIMARY_SELECTION_PASTE: { > cur.clearSelection(); > - string const clip = bv->owner()->gui().clipboard().get(); > + string const clip = (cmd.action == LFUN_CLIPBOARD_PASTE) ? > + bv->owner()->gui().clipboard().get() : > + bv->owner()->gui().selection().get(); > > If the body is not long, I still prefer separating these two > actions, rather than telling them apart from cmd.action. OK, I can do that. > I do not really like the external/internal clipboard. Is there any > technique reason why can not they be merged? They should be merged in the future, but I don't know how exactly. There are two problems: 1) The internal clipboard is actually a stack with 10 positions. I don't know how impoertant this is, maybe we can simply drop that. 2) We can't yet store LyX content on the external clipboard, only plain text. I have an idea how to change that, but I want to proceed step by step, so consider the new lfun and menu entries temporary. > Ideally, we should > have copy/cut/paste/select all etc for CLIPBAORD, and under *nix, > we have the bonus of selection/middle button. The internal clipboard > actually makes copy/paste between two lyx sessions impossible. Not really. The fact that we cannot store LyX content on the external clipboard is the problem. Not an unsolvable one, though. Georg