.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));
}
long const text_height = bv_->text->height;
+ long const work_height = workarea_.height();
+ if (text_height <= work_height) {
+ workarea_.setScrollbarBounds(0.0, 0.0);
+ current_scrollbar_value = bv_->text->first;
+ workarea_.setScrollbar(current_scrollbar_value, 1.0);
+ return;
+ }
+
double const lineh = bv_->text->defaultHeight();
double const slider_size =
(text_height == 0) ? 1.0 : 1.0 / double(text_height);
-
- static long old_text_height = 0;
- static double old_lineh = 0;
- static double old_slider_size = 0;
+
+ static long old_text_height;
+ static double old_lineh;
+ static double old_slider_size;
if (text_height != old_text_height) {
- workarea_.setScrollbarBounds(0, text_height - workarea_.height());
+ workarea_.setScrollbarBounds(0.0,
+ text_height - work_height);
old_text_height = text_height;
}
if (lineh != old_lineh) {
if (!buffer_) return;
current_scrollbar_value = long(value);
+
if (current_scrollbar_value < 0)
current_scrollbar_value = 0;
bv_->text->setSelection(bv_);
screen_->toggleToggle(bv_->text, bv_);
fitCursor();
-#if 0
- screen_->showCursor(bv_->text, bv_);
-#else
showCursor();
-#endif
}
screen_->toggleSelection(bv_->text, bv_);
bv_->text->clearSelection();
bv_->text->fullRebreak(bv_);
-#if 0
- screen_->update(bv_->text, bv_);
-#else
update();
-#endif
updateScrollbar();
// Single left click in math inset?
}
+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()) {
if (button == 2)
return;
+ // finish selection
+ if (button == 1) {
+ workarea_.haveSelection(bv_->getLyXText()->selection.set());
+ }
+
setState();
owner_->showState();
owner_->updateMenubar();
}
-Box BufferView::Pimpl::insetDimensions(LyXText const & text, LyXCursor const & cursor) const
+Box BufferView::Pimpl::insetDimensions(LyXText const & text,
+ LyXCursor const & cursor) const
{
Paragraph /*const*/ & par = *cursor.par();
pos_type const pos = cursor.pos();
}
-Inset * BufferView::Pimpl::checkInset(LyXText const & text, LyXCursor const & cursor, int & x, int & y) const
+Inset * BufferView::Pimpl::checkInset(LyXText const & text,
+ LyXCursor const & cursor,
+ int & x, int & y) const
{
pos_type const pos(cursor.pos());
Paragraph /*const*/ & par(*cursor.par());
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;
if (style.pass_thru ||
(!insertInset(new InsetQuotes(c, bv_->buffer()->params))))
- Dispatch(LFUN_SELFINSERT, "\"");
+ bv_->owner()->getLyXFunc()->dispatch(LFUN_SELFINSERT, "\"");
}