d->scrollbarParameters_.position = 0;
// The reference is the top position so we remove one page.
- d->scrollbarParameters_.max -= d->scrollbarParameters_.page_step;
+ if (lyxrc.scroll_below_document)
+ d->scrollbarParameters_.max -= minVisiblePart();
+ else
+ d->scrollbarParameters_.max -= d->scrollbarParameters_.page_step;
}
}
+int BufferView::minVisiblePart()
+{
+ return 2 * defaultRowHeight();
+}
+
+
int BufferView::scroll(int y)
{
if (y > 0)
{
Text * text = &buffer_.text();
TextMetrics & tm = d->text_metrics_[text];
- int ymax = height_ + offset;
+ int const ymax = height_ + offset;
while (true) {
pair<pit_type, ParagraphMetrics const *> last = tm.last();
int bottom_pos = last.second->position() + last.second->descent();
+ if (lyxrc.scroll_below_document)
+ bottom_pos += height_ - minVisiblePart();
if (last.first + 1 == int(text->paragraphs().size())) {
if (bottom_pos <= height_)
return 0;
/// \return true if no further update is needed.
bool singleParUpdate();
+ /// The minimal size of the document that is visible. Used
+ /// when it is allowed to scroll below the document.
+ int minVisiblePart();
+
/// Search recursively for the the innermost inset that covers (x, y) position.
/// \retval 0 if no inset is found.
Inset const * getCoveringInset(
case LyXRC::RC_CONVERTER_CACHE_MAXAGE:
case LyXRC::RC_COPIER:
case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
+ case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
case LyXRC::RC_CUSTOM_EXPORT_COMMAND:
case LyXRC::RC_CUSTOM_EXPORT_FORMAT:
case LyXRC::RC_DATE_INSERT_FORMAT:
{ "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
{ "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
{ "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
+ { "\\scroll_below_document", LyXRC::RC_SCROLL_BELOW_DOCUMENT },
{ "\\serverpipe", LyXRC::RC_SERVERPIPE },
{ "\\set_color", LyXRC::RC_SET_COLOR },
{ "\\show_banner", LyXRC::RC_SHOW_BANNER },
tex_allows_spaces = false;
date_insert_format = "%x";
cursor_follows_scrollbar = false;
+ scroll_below_document = false;
mac_like_word_movement = false;
macro_edit_style = MACRO_EDIT_INLINE_BOX;
dialogs_iconify_with_main = false;
lexrc >> cursor_follows_scrollbar;
break;
+ case RC_SCROLL_BELOW_DOCUMENT:
+ lexrc >> scroll_below_document;
+ break;
+
case RC_MAC_LIKE_WORD_MOVEMENT:
lexrc >> mac_like_word_movement;
break;
}
if (tag != RC_LAST)
break;
+ case RC_SCROLL_BELOW_DOCUMENT:
+ if (ignore_system_lyxrc ||
+ scroll_below_document
+ != system_lyxrc.scroll_below_document) {
+ os << "\\scroll_below_document "
+ << convert<string>(scroll_below_document) << '\n';
+ }
+ if (tag != RC_LAST)
+ break;
case RC_MAC_LIKE_WORD_MOVEMENT:
if (ignore_system_lyxrc ||
mac_like_word_movement
str = _("LyX normally doesn't update the cursor position if you move the scrollbar. Set to true if you'd prefer to always have the cursor on screen.");
break;
+ case RC_SCROLL_BELOW_DOCUMENT:
+ str = _("LyX normally doesn't allow the user to scroll further than the bottom of the document. Set to true if you prefer to scroll the bottom of the document to the top of the screen");
+ break;
+
case RC_MAC_LIKE_WORD_MOVEMENT:
str = _("Use the Mac OS X conventions for the word-level cursor movement");
break;
RC_SCREEN_FONT_TYPEWRITER,
RC_SCREEN_FONT_TYPEWRITER_FOUNDRY,
RC_SCREEN_ZOOM,
+ RC_SCROLL_BELOW_DOCUMENT,
RC_SERVERPIPE,
RC_SET_COLOR,
RC_SHOW_BANNER,
///
bool cursor_follows_scrollbar;
///
+ bool scroll_below_document;
+ ///
enum MacroEditStyle {
MACRO_EDIT_INLINE_BOX = 0,
MACRO_EDIT_INLINE,
connect(cursorFollowsCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
+ connect(scrollBelowCB, SIGNAL(clicked()),
+ this, SIGNAL(changed()));
connect(sortEnvironmentsCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(groupEnvironmentsCB, SIGNAL(clicked()),
void PrefEdit::apply(LyXRC & rc) const
{
rc.cursor_follows_scrollbar = cursorFollowsCB->isChecked();
+ rc.scroll_below_document = scrollBelowCB->isChecked();
rc.sort_layouts = sortEnvironmentsCB->isChecked();
rc.group_layouts = groupEnvironmentsCB->isChecked();
switch (macroEditStyleCO->currentIndex()) {
void PrefEdit::update(LyXRC const & rc)
{
cursorFollowsCB->setChecked(rc.cursor_follows_scrollbar);
+ scrollBelowCB->setChecked(rc.scroll_below_document);
sortEnvironmentsCB->setChecked(rc.sort_layouts);
groupEnvironmentsCB->setChecked(rc.group_layouts);
macroEditStyleCO->setCurrentIndex(rc.macro_edit_style);
</property>
</widget>
</item>
+ <item>
+ <widget class="QCheckBox" name="scrollBelowCB" >
+ <property name="text" >
+ <string>Scroll &below end of document</string>
+ </property>
+ </widget>
+ </item>
<item>
<widget class="QCheckBox" name="sortEnvironmentsCB" >
<property name="text" >
<layoutdefault spacing="4" margin="9" />
<tabstops>
<tabstop>cursorFollowsCB</tabstop>
+ <tabstop>scrollBelowCB</tabstop>
<tabstop>sortEnvironmentsCB</tabstop>
<tabstop>groupEnvironmentsCB</tabstop>
<tabstop>macroEditStyleCO</tabstop>