fix wheel handling for xforms

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8856 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2004-08-01 21:24:03 +00:00
parent 13748a5e7a
commit 8a490234de
7 changed files with 60 additions and 27 deletions

View File

@ -355,7 +355,6 @@ void BufferView::Pimpl::setBuffer(Buffer * b)
// This is done after the layout combox has been populated
if (buffer_)
owner_->setLayout(cursor_.paragraph().layout()->name());
if (buffer_ && lyx::graphics::Previews::status() != LyXRC::PREVIEW_OFF)
lyx::graphics::Previews::get().generateBufferPreviews(*buffer_);

View File

@ -1,3 +1,8 @@
2004-08-01 Lars Gullik Bjonnes <larsbj@gullik.net>
* text3.C (dispatch): remove special handling of button 4 and 5,
it is now taken care of in the frontend code.
2004-07-25 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* Spacing.h: add <string> (STLPort compile fix)
@ -5,7 +10,7 @@
2004-07-25 Lars Gullik Bjonnes <larsbj@gullik.net>
* lyxlex_pimpl.C (compare_tags): chagne return type of operator()
to bool.
to bool.
* converter.C (showMessage): inherit from unary_function, make
operator() const.

View File

@ -1,3 +1,8 @@
2004-08-01 Lars Gullik Bjonnes <larsbj@gullik.net>
* QContentPane.C (keyPressEvent): make sure to use the smart
pointer as soon as possible.
2004-07-24 Lars Gullik Bjonnes <larsbj@gullik.net>
* QPrefs.C, QMathMatrixDialog.C:

View File

@ -216,11 +216,9 @@ void QContentPane::wheelEvent(QWheelEvent * e)
void QContentPane::keyPressEvent(QKeyEvent * e)
{
typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;
QLyXKeySym * sym = new QLyXKeySym;
boost::shared_ptr<QLyXKeySym> sym(new QLyXKeySym);
sym->set(e);
wa_->workAreaKeyPress(LyXKeySymPtr(sym), q_key_state(e->state()));
wa_->workAreaKeyPress(sym, q_key_state(e->state()));
}

View File

@ -1,3 +1,8 @@
2004-08-01 Lars Gullik Bjonnes <larsbj@gullik.net>
* XWorkArea.C (work_area_handler): handle wheel events more
explict here, make the way of handlig it similar to qt.
2004-07-24 Lars Gullik Bjonnes <larsbj@gullik.net>
* lyx_gui.C, FormMathsMatrix.C, FormLog.C:

View File

@ -333,6 +333,30 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
case FL_PUSH:
if (!ev || ev->xbutton.button == 0) break;
if (ev->xbutton.button == 4 || ev->xbutton.button == 5) {
static long last_wheel;
long cur_wheel = ev->xbutton.time;
if (last_wheel == cur_wheel)
break;
last_wheel = cur_wheel;
float l, r;
fl_get_scrollbar_increment(area->scrollbar, &l, &r);
if (ev->xbutton.button == 4)
l *= -1.0;
fl_set_scrollbar_value(
area->scrollbar,
fl_get_scrollbar_value(area->scrollbar) + l);
area->scroll_cb();
break;
}
// Should really have used xbutton.state
lyxerr[Debug::WORKAREA] << "Workarea event: PUSH" << endl;
area->dispatch(
@ -345,7 +369,14 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
case FL_RELEASE:
if (!ev || ev->xbutton.button == 0) break;
// Should really have used xbutton.state
if (ev->xbutton.button == 4 || ev->xbutton.button == 5) {
// We ingnore wheel event here
break;
}
lyxerr[Debug::WORKAREA] << "Workarea event: RELEASE" << endl;
area->dispatch(
FuncRequest(LFUN_MOUSE_RELEASE,
ev->xbutton.x - ob->x,
@ -526,6 +557,12 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
case FL_DBLCLICK:
if (ev) {
if (ev->xbutton.button == 4 || ev->xbutton.button == 5) {
// Ignore wheel events
break;
}
lyxerr[Debug::WORKAREA] << "Workarea event: DBLCLICK" << endl;
FuncRequest cmd(LFUN_MOUSE_DOUBLE,
ev->xbutton.x - ob->x,
@ -537,6 +574,11 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
case FL_TRPLCLICK:
if (ev) {
if (ev->xbutton.button == 4 || ev->xbutton.button == 5) {
// Ignore wheel events
break;
}
lyxerr[Debug::WORKAREA] << "Workarea event: TRPLCLICK" << endl;
FuncRequest cmd(LFUN_MOUSE_TRIPLE,
ev->xbutton.x - ob->x,

View File

@ -1118,20 +1118,6 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
// Single-click on work area
case LFUN_MOUSE_PRESS: {
// ok ok, this is a hack (for xforms)
// We shouldn't go further down as we really need to. Only do the
// scrolling and be done with this. Otherwise we may open some
// dialogs (Jug 20020424).
if (cmd.button() == mouse_button::button4) {
bv->scroll(-lyxrc.wheel_jump);
break;
}
if (cmd.button() == mouse_button::button5) {
bv->scroll(lyxrc.wheel_jump);
break;
}
// Right click on a footnote flag opens float menu
if (cmd.button() == mouse_button::button3) {
cur.clearSelection();
@ -1185,13 +1171,6 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
}
case LFUN_MOUSE_RELEASE: {
// do nothing if we used the mouse wheel
if (cmd.button() == mouse_button::button4
|| cmd.button() == mouse_button::button5) {
cur.undispatched();
break;
}
selection_possible = false;
if (cmd.button() == mouse_button::button2)