Georg Baum wrote:

> Alfredo,
> 
> can you please provide frontends/WorkArea.C? Otherwise I can't try the
> patch ;-(

Ah right, sorry my bad.

Alfredo
/**
 * \file WorkArea.C
 * This file is part of LyX, the document processor.
 * Licence details can be found in the file COPYING.
 *
 * \author Alfredo Braunstein
 *
 * Full author contact details are available in file CREDITS.
 */

#include <config.h>

#include "WorkArea.h"

#include "debug.h"

using std::endl;

namespace {

static int const bignum = 1000000;

}


WorkArea::WorkArea() : scroll_(0), page_(0)
{}


void WorkArea::scrollDocViewInternal(int value)
{
	lyxerr << BOOST_CURRENT_FUNCTION << endl;

	int oldvalue = scroll_;
	lyxerr << "value: " << value << " oldvalue: " << oldvalue << " page: " << page_;
	if (value == oldvalue + 1) {
		scrollLineDown();
		lyxerr << " LINE DOWN"<< endl;
		return;
	}

	if (value == oldvalue - 1) {
		scrollLineUp();
		lyxerr << " LINE UP"<< endl;
		return;
	}

	if (value == oldvalue + page_) {
		scrollPageDown();
		lyxerr << " PAGE DOWN" << endl;
		return;
	}

	if (value == oldvalue - page_) {
		scrollPageUp();
		lyxerr << " PAGE UP" << endl;
		return;
	}

	scrollDocView(double(value)/bignum);
}


void WorkArea::setScrollbarParams(double height, double pos)
{
	static int const bignum = 1000000;
	page_ = int(height * bignum);
	BOOST_ASSERT(height >= 0);
	BOOST_ASSERT(page_ >= 0);
	scroll_ = int(pos * bignum);
	lyxerr << "setting scrollbar, page:" << page_  << " scroll: " << scroll_ << endl;
	doSetScrollbarParams(bignum, page_, scroll_, 1);
}

Reply via email to