mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-26 18:07:18 +00:00
implement triple click
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5148 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5ef09542a2
commit
9f535fa42b
@ -1,3 +1,8 @@
|
|||||||
|
2002-08-29 John Levon <levon@movementarian.org>
|
||||||
|
|
||||||
|
* QContentPane.C:
|
||||||
|
* QContentPane.h: implement triple click
|
||||||
|
|
||||||
2002-08-29 John Levon <levon@movementarian.org>
|
2002-08-29 John Levon <levon@movementarian.org>
|
||||||
|
|
||||||
* QInclude.C: remove some wrong code removed from xforms
|
* QInclude.C: remove some wrong code removed from xforms
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
#include <qevent.h>
|
#include <qevent.h>
|
||||||
#include <qpainter.h>
|
#include <qpainter.h>
|
||||||
|
#include <qtimer.h>
|
||||||
|
#include <qapplication.h>
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
|
|
||||||
@ -97,6 +99,15 @@ void QContentPane::scrollBarChanged(int val)
|
|||||||
|
|
||||||
void QContentPane::mousePressEvent(QMouseEvent * e)
|
void QContentPane::mousePressEvent(QMouseEvent * e)
|
||||||
{
|
{
|
||||||
|
if (dc_event_.active && dc_event_ == *e) {
|
||||||
|
dc_event_.active = false;
|
||||||
|
FuncRequest cmd(LFUN_MOUSE_TRIPLE,
|
||||||
|
dc_event_.x, dc_event_.y,
|
||||||
|
q_button_state(dc_event_.state));
|
||||||
|
wa_->dispatch(cmd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FuncRequest cmd
|
FuncRequest cmd
|
||||||
(LFUN_MOUSE_PRESS, e->x(), e->y(), q_button_state(e->button()));
|
(LFUN_MOUSE_PRESS, e->x(), e->y(), q_button_state(e->button()));
|
||||||
wa_->dispatch(cmd);
|
wa_->dispatch(cmd);
|
||||||
@ -130,12 +141,27 @@ void QContentPane::keyPressEvent(QKeyEvent * e)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void QContentPane::doubleClickTimeout()
|
||||||
|
{
|
||||||
|
if (!dc_event_.active)
|
||||||
|
return;
|
||||||
|
|
||||||
|
dc_event_.active = false;
|
||||||
|
|
||||||
|
FuncRequest cmd(LFUN_MOUSE_DOUBLE,
|
||||||
|
dc_event_.x, dc_event_.y,
|
||||||
|
q_button_state(dc_event_.state));
|
||||||
|
wa_->dispatch(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void QContentPane::mouseDoubleClickEvent(QMouseEvent * e)
|
void QContentPane::mouseDoubleClickEvent(QMouseEvent * e)
|
||||||
{
|
{
|
||||||
FuncRequest cmd
|
dc_event_ = double_click(e);
|
||||||
(LFUN_MOUSE_DOUBLE, e->x(), e->y(), q_button_state(e->button()));
|
|
||||||
wa_->dispatch(cmd);
|
// doubleClickInterval() is just too long.
|
||||||
// FIXME: triple click
|
QTimer::singleShot(QApplication::doubleClickInterval() / 1.5,
|
||||||
|
this, SLOT(doubleClickTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,6 +25,26 @@
|
|||||||
|
|
||||||
class QWorkArea;
|
class QWorkArea;
|
||||||
|
|
||||||
|
/// for emulating triple click
|
||||||
|
struct double_click {
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
Qt::ButtonState state;
|
||||||
|
bool active;
|
||||||
|
|
||||||
|
bool operator==(QMouseEvent const & e) {
|
||||||
|
return x == e.x() && y == e.y()
|
||||||
|
&& state == e.button();
|
||||||
|
}
|
||||||
|
|
||||||
|
double_click()
|
||||||
|
: x(0), y(0), state(Qt::NoButton), active(false) {}
|
||||||
|
|
||||||
|
double_click(QMouseEvent * e)
|
||||||
|
: x(e->x()), y(e->y()),
|
||||||
|
state(e->button()), active(true) {}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Widget for actually drawing the document on
|
* Widget for actually drawing the document on
|
||||||
*/
|
*/
|
||||||
@ -56,6 +76,8 @@ protected:
|
|||||||
void keyPressEvent(QKeyEvent * e);
|
void keyPressEvent(QKeyEvent * e);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void doubleClickTimeout();
|
||||||
|
|
||||||
void scrollBarChanged(int);
|
void scrollBarChanged(int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -64,6 +86,8 @@ private:
|
|||||||
|
|
||||||
/// the double buffered pixmap
|
/// the double buffered pixmap
|
||||||
boost::scoped_ptr<QPixmap> pixmap_;
|
boost::scoped_ptr<QPixmap> pixmap_;
|
||||||
|
|
||||||
|
double_click dc_event_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QCONTENTPANE_H
|
#endif // QCONTENTPANE_H
|
||||||
|
@ -23,7 +23,6 @@ QCommandBuffer
|
|||||||
|
|
||||||
QContentPane
|
QContentPane
|
||||||
|
|
||||||
- triple click
|
|
||||||
- figure out why a scroll doesn't update quickly, which leaves cursor artifacts
|
- figure out why a scroll doesn't update quickly, which leaves cursor artifacts
|
||||||
whilst holding down page down etc.
|
whilst holding down page down etc.
|
||||||
|
|
||||||
@ -35,10 +34,6 @@ qfont_loader
|
|||||||
|
|
||||||
- use lyxrc, check for failure, implement available()
|
- use lyxrc, check for failure, implement available()
|
||||||
|
|
||||||
qfont_metrics
|
|
||||||
|
|
||||||
- per char ascent/descent
|
|
||||||
|
|
||||||
QForks
|
QForks
|
||||||
|
|
||||||
- don't implement me
|
- don't implement me
|
||||||
@ -47,10 +42,6 @@ QGraphics
|
|||||||
|
|
||||||
- remaining UI cleanups and fixes
|
- remaining UI cleanups and fixes
|
||||||
|
|
||||||
QInclude
|
|
||||||
|
|
||||||
- check no load stuff works ?
|
|
||||||
|
|
||||||
QLImage
|
QLImage
|
||||||
|
|
||||||
- get jpeg etc. to work
|
- get jpeg etc. to work
|
||||||
|
Loading…
x
Reference in New Issue
Block a user