John Spray's gtk scrolling patch

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9002 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Alfredo Braunstein 2004-09-24 06:32:22 +00:00
parent 32b506229b
commit 47aecd3178
3 changed files with 26 additions and 1 deletions

View File

@ -1,6 +1,11 @@
2004-09-23 John Spray <spray_john@users.sourceforge.net>
* GWorkArea.[Ch]: Add GWorkArea::onScrollWheel to implement
mouse-wheel scrolling of document
2004-07-24 Lars Gullik Bjonnes <larsbj@gullik.net>
* GPainter.C (text): sue boost::scoped_array to store the
* GPainter.C (text): use boost::scoped_array to store the
temporary wchar_t pointer
* lyx_gui.C: change "support/std_sstream.h" to <sstream>

View File

@ -174,6 +174,8 @@ GWorkArea::GWorkArea(LyXView & owner, int width, int height)
workArea_.show();
vscrollbar_.get_adjustment()->signal_value_changed().connect(
SigC::slot(*this, &GWorkArea::onScroll));
workArea_.signal_scroll_event().connect(
SigC::slot(*this, &GWorkArea::onScrollWheel));
vscrollbar_.show();
hbox_.children().push_back(Gtk::Box_Helpers::Element(workArea_));
hbox_.children().push_back(
@ -340,6 +342,23 @@ void GWorkArea::onScroll()
scrollDocView(static_cast<int>(val));
}
bool GWorkArea::onScrollWheel(GdkEventScroll * event)
{
Gtk::Adjustment * adjustment = vscrollbar_.get_adjustment();
double step;
if (event->state & GDK_CONTROL_MASK)
step = adjustment->get_page_increment();
else
step = adjustment->get_step_increment();
if (event->direction == GDK_SCROLL_UP)
step *= -1.0f;
adjustment->set_value(adjustment->get_value() + step);
return true;
}
bool GWorkArea::onButtonPress(GdkEventButton * event)
{

View File

@ -93,6 +93,7 @@ private:
bool onExpose(GdkEventExpose * event);
bool onConfigure(GdkEventConfigure * event);
void onScroll();
bool onScrollWheel(GdkEventScroll * event);
bool onButtonPress(GdkEventButton * event);
bool onButtonRelease(GdkEventButton * event);
bool onMotionNotify(GdkEventMotion * event);