// PageStep only depends on the viewport height.
verticalScrollBar()->setPageStep(viewport()->height());
- LYXERR(Debug::GUI) << BOOST_CURRENT_FUNCTION
- << "\n Area width\t" << width()
- << "\n Area height\t" << height()
+ LYXERR(Debug::GUI, BOOST_CURRENT_FUNCTION
<< "\n viewport width\t" << viewport()->width()
- << "\n viewport height\t" << viewport()->height()
- << endl;
+ << "\n viewport height\t" << viewport()->height());
// Enables input methods for asian languages.
// Must be set when creating custom text editing widgets.
ViewMetricsInfo const & vi = buffer_view_->viewMetricsInfo();
- LYXERR(Debug::WORKAREA) << "WorkArea::redraw screen" << endl;
+ LYXERR(Debug::WORKAREA, "WorkArea::redraw screen");
int const ymin = std::max(vi.y1, 0);
- int const ymax = vi.p2 < vi.size - 1 ? vi.y2 : height();
+ int const ymax = vi.p2 < vi.size - 1 ? vi.y2 : viewport()->height();
- expose(0, ymin, width(), ymax - ymin);
+ updateScreen();
+ update(0, ymin, viewport()->width(), ymax - ymin);
- //LYXERR(Debug::WORKAREA)
- //<< " ymin = " << ymin << " width() = " << width()
-// << " ymax-ymin = " << ymax-ymin << std::endl;
+ //LYXERR(Debug::WORKAREA, " ymin = " << ymin << " width() = " << width()
+ // << " ymax-ymin = " << ymax-ymin);
if (lyxerr.debugging(Debug::WORKAREA))
buffer_view_->coordCache().dump();
// WARNING: Please don't put any code that will trigger a repaint here!
// We are already inside a paint event.
lyx_view_->setBusy(true);
- buffer_view_->resize(width(), height());
+ buffer_view_->resize(viewport()->width(), viewport()->height());
lyx_view_->updateLayoutChoice(false);
lyx_view_->setBusy(false);
}
-void GuiWorkArea::updateScrollbar()
-{
- buffer_view_->updateScrollbar();
- ScrollbarParameters const & scroll_ = buffer_view_->scrollbarParameters();
- setScrollbarParams(scroll_.height, scroll_.position,
- scroll_.lineScrollHeight);
-}
-
-
void GuiWorkArea::showCursor()
{
if (cursor_visible_)
y -= asc;
// if it doesn't touch the screen, don't try to show it
- if (y + h < 0 || y >= height())
+ if (y + h < 0 || y >= viewport()->height())
return;
cursor_visible_ = true;
}
-void GuiWorkArea::setScrollbarParams(int h, int scroll_pos, int scroll_line_step)
+void GuiWorkArea::updateScrollbar()
{
if (verticalScrollBarPolicy() != Qt::ScrollBarAlwaysOn)
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
-
verticalScrollBar()->setTracking(false);
+ buffer_view_->updateScrollbar();
+ ScrollbarParameters const & scroll_ = buffer_view_->scrollbarParameters();
+
// do what cursor movement does (some grey)
- h += height() / 4;
- int scroll_max_ = std::max(0, h - height());
+ int const h = scroll_.height + viewport()->height() / 4;
+ int scroll_max_ = std::max(0, h - viewport()->height());
verticalScrollBar()->setRange(0, scroll_max_);
- verticalScrollBar()->setSliderPosition(scroll_pos);
- verticalScrollBar()->setSingleStep(scroll_line_step);
- verticalScrollBar()->setValue(scroll_pos);
+ verticalScrollBar()->setSliderPosition(scroll_.position);
+ verticalScrollBar()->setSingleStep(scroll_.lineScrollHeight);
+ verticalScrollBar()->setValue(scroll_.position);
verticalScrollBar()->setTracking(true);
}
#ifdef Q_WS_X11
if (XEventsQueued(QX11Info::display(), 0) > 1 && ev->isAutoRepeat()
&& (Qt::Key_PageDown || Qt::Key_PageUp)) {
- LYXERR(Debug::KEY)
- << BOOST_CURRENT_FUNCTION << endl
- << "system is busy: scroll key event ignored" << endl;
+ LYXERR(Debug::KEY, BOOST_CURRENT_FUNCTION
+ << "\nsystem is busy: scroll key event ignored");
ev->ignore();
return;
}
#endif
- LYXERR(Debug::KEY) << BOOST_CURRENT_FUNCTION
+ LYXERR(Debug::KEY, BOOST_CURRENT_FUNCTION
<< " count=" << ev->count()
<< " text=" << fromqstr(ev->text())
<< " isAutoRepeat=" << ev->isAutoRepeat()
- << " key=" << ev->key()
- << endl;
+ << " key=" << ev->key());
KeySymbol sym;
setKeySymbol(&sym, ev);
}
-void GuiWorkArea::expose(int x, int y, int w, int h)
-{
- updateScreen();
- update(x, y, w, h);
-}
-
-
void GuiWorkArea::updateScreen()
{
GuiPainter pain(&screen_);
if (!commit_string.isEmpty()) {
- LYXERR(Debug::KEY) << BOOST_CURRENT_FUNCTION
+ LYXERR(Debug::KEY, BOOST_CURRENT_FUNCTION
<< " preeditString =" << fromqstr(e->preeditString())
- << " commitString =" << fromqstr(e->commitString())
- << endl;
+ << " commitString =" << fromqstr(e->commitString()));
int key = 0;
int cur_y = cursor_->rect().bottom();
// redraw area of preedit string.
- update(0, cur_y - height, GuiWorkArea::width(),
+ update(0, cur_y - height, viewport()->width(),
(height + 1) * preedit_lines_);
if (preedit_string.empty()) {
ps = Painter::preedit_default;
// if we reached the right extremity of the screen, go to next line.
- if (cur_x + fm.width(typed_char) > GuiWorkArea::width() - right_margin) {
+ if (cur_x + fm.width(typed_char) > viewport()->width() - right_margin) {
cur_x = right_margin;
cur_y += height + 1;
++preedit_lines_;
}
// update the preedit string screen area.
- update(0, cur_y - preedit_lines_*height, GuiWorkArea::width(),
+ update(0, cur_y - preedit_lines_*height, viewport()->width(),
(height + 1) * preedit_lines_);
// Don't forget to accept the event!
this, SLOT(closeCurrentTab()));
setCornerWidget(closeTabButton);
-#if QT_VERSION >= 0x040200
setUsesScrollButtons(true);
-#endif
}
///
currentWorkAreaChanged(wa);
- LYXERR(Debug::GUI) << "currentTabChanged " << i
- << "File" << bv.buffer().absFileName() << endl;
+ LYXERR(Debug::GUI, "currentTabChanged " << i
+ << "File" << bv.buffer().absFileName());
}