]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView_pimpl.C
Michael's latest batch of new gnome files.
[lyx.git] / src / BufferView_pimpl.C
index 8e2021b8ac83a4158edf310120dd03816be6df2c..11506b505e4237eaff2e99df4b8123146c689989 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();
@@ -1429,7 +1445,7 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filen)
                string initpath = lyxrc.document_path;
 
                if (available()) {
-                       string const trypath = owner_->buffer()->filepath;
+                       string const trypath = owner_->buffer()->filePath();
                        // If directory is writeable, use this as default.
                        if (IsDirWriteable(trypath))
                                initpath = trypath;