]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView_pimpl.C
Fix broken changes of wheel mouse. Sorry !
[lyx.git] / src / BufferView_pimpl.C
index 8edfc62a31ff7fb316f6c3319f979b7781388686..2f4848f6a26f47929fb957b5495823bdbed27ce5 100644 (file)
@@ -384,19 +384,26 @@ void BufferView::Pimpl::scrollDocView(int value)
 }
 
 
-int BufferView::Pimpl::scroll(long time)
+void BufferView::Pimpl::scroll(int lines)
 {
-       if (!buffer_)
-               return 0;
+       if (!buffer_) {
+               return;
+       }
 
        LyXText const * t = bv_->text;
+       int const line_height = t->defaultHeight();
 
-       double const diff = t->defaultHeight()
-               + double(time) * double(time) * 0.125;
+       // The new absolute coordinate
+       int new_first_y = t->first_y + lines * line_height;
 
-       scrollDocView(int(diff));
+       // Restrict to a valid value
+       new_first_y = std::min(t->height - 4 * line_height, new_first_y);
+       new_first_y = std::max(0, new_first_y);
+
+       scrollDocView(new_first_y);
+
+       // Update the scrollbar.
        workarea().setScrollbarParams(t->height, t->first_y, t->defaultHeight());
-       return 0;
 }
 
 
@@ -1067,18 +1074,6 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev)
        }
        break;
 
-       case LFUN_HTMLURL:
-       case LFUN_URL:
-       {
-               InsetCommandParams p;
-               if (ev.action == LFUN_HTMLURL)
-                       p.setCmdName("htmlurl");
-               else
-                       p.setCmdName("url");
-               owner_->getDialogs().createUrl(p.getAsString());
-       }
-       break;
-
        // --- accented characters ---------------------------
 
        case LFUN_UMLAUT:
@@ -1131,8 +1126,11 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev)
                InsetCitation * inset = new InsetCitation(p);
                if (!insertInset(inset))
                        delete inset;
-               else
+               else {
+                       inset->setLoadingBuffer(bv_->buffer(), false);
                        updateInset(inset, true);
+               }
+               
        }
        break;
 
@@ -1189,7 +1187,8 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev)
        case LFUN_CHILD_INSERT:
        {
                InsetInclude::Params p;
-               p.cparams.setFromString(ev.argument);
+               if (!ev.argument.empty())
+                       p.cparams.setFromString(ev.argument);
                p.masterFilename_ = buffer_->fileName();
 
                InsetInclude * inset = new InsetInclude(p);