]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView_pimpl.C
bug 186
[lyx.git] / src / BufferView_pimpl.C
index ca62780d4ab8ea23f7090fedbcc55bfa2bba6f40..cf671b5216472648222c3c519c5acc404f43e424 100644 (file)
@@ -155,6 +155,8 @@ BufferView::Pimpl::Pimpl(BufferView * b, LyXView * o,
                .connect(slot(this, &BufferView::Pimpl::tripleClick));
        workarea_.workAreaKeyPress
                .connect(slot(this, &BufferView::Pimpl::workAreaKeyPress));
+       workarea_.selectionRequested
+               .connect(slot(this, &BufferView::Pimpl::selectionRequested)); 
        
        cursor_timeout.timeout.connect(slot(this,
                                            &BufferView::Pimpl::cursorToggle));
@@ -736,6 +738,15 @@ void BufferView::Pimpl::tripleClick(int /*x*/, int /*y*/, unsigned int button)
 }
 
 
+void BufferView::Pimpl::selectionRequested()
+{
+       string const sel(bv_->getLyXText()->selectionAsString(bv_->buffer(), false)); 
+       if (!sel.empty()) {
+               workarea_.putClipboard(sel);
+       }
+}
+
 void BufferView::Pimpl::enterView()
 {
        if (active() && available()) {
@@ -780,6 +791,11 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
        if (button == 2)
                return;
 
+       // finish selection
+       if (button == 1) {
+               workarea_.haveSelection(bv_->getLyXText()->selection.set());
+       }
        setState();
        owner_->showState();
        owner_->updateMenubar();
@@ -1438,9 +1454,9 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filen)
                FileDialog fileDlg(bv_->owner(),
                                   _("Select LyX document to insert"),
                        LFUN_FILE_INSERT,
-                       make_pair(string(_("Documents")),
+                       make_pair(string(_("Documents|#o#O")),
                                  string(lyxrc.document_path)),
-                       make_pair(string(_("Examples")),
+                       make_pair(string(_("Examples|#E#e")),
                                  string(AddPath(system_lyxdir, "examples"))));
 
                FileDialog::Result result =