QWorkArea.[Ch]: Wheel one-liner mouse fix

QWorkArea.h: Added comments
Reverted to Q_WS_X11 and Q_WS_MACX instead of Q_OS_*


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13371 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2006-03-14 14:50:00 +00:00
parent b751c74fe1
commit 6d21659ce0
5 changed files with 50 additions and 27 deletions

View File

@ -1,8 +1,23 @@
2006-03-01 Jürgen Spitzmüller <j.spitzmueller@gmx.de> 2006-03-14 Abdelrazak Younes <younes.a@free.fr>
* QWorkArea.[Ch]: Wheel one-liner mouse fix
* QWorkArea.C: Reverted to Q_WS_X11 and Q_WS_MACX instead of Q_OS_*
* QWorkArea.h: Added comments
2006-03-12 Lars Gullik Bjønnes <larsbj@lyx.org>
* ui/pch.h: new file
2006-03-11 Abdelrazak Younes <younes.a@free.fr>
* Various Compilation fixes for MacOSX. There is still a problem
with Dialog.C:275 which does not recognize
2006-03-10 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* QLMenubar.h: compile fix for gcc-4.1. * QLMenubar.h: compile fix for gcc-4.1.
2006-03-01 Abdelrazak Younes <younes.a@free.fr> 2006-03-10 Abdelrazak Younes <younes.a@free.fr>
* QWorkArea.[Ch] cleanup: * QWorkArea.[Ch] cleanup:
- Added private members workWidth_ and workHeight_ in order to - Added private members workWidth_ and workHeight_ in order to
@ -14,10 +29,6 @@
separate place at the end of QWorkArea.C. separate place at the end of QWorkArea.C.
- initial support for Wheel mouse (still does not work). - initial support for Wheel mouse (still does not work).
2006-03-12 Lars Gullik Bjønnes <larsbj@lyx.org>
* ui/pch.h: new file
2006-03-10 Georg Baum <Georg.Baum@post.rwth-aachen.de> 2006-03-10 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* QWorkArea.C (getClipboard): convert MAC to UNIX line endings on OSX * QWorkArea.C (getClipboard): convert MAC to UNIX line endings on OSX

View File

@ -149,7 +149,7 @@ MenuBackend const & QLMenubar::backend()
*/ */
QMenuBar * QLMenubar::menuBar() const QMenuBar * QLMenubar::menuBar() const
{ {
#ifdef Q_OS_MACX #ifdef Q_WS_MACX
return mac_menubar_.get(); return mac_menubar_.get();
#else #else
return owner_->menuBar(); return owner_->menuBar();
@ -158,7 +158,7 @@ QMenuBar * QLMenubar::menuBar() const
void QLMenubar::macxMenuBarInit() void QLMenubar::macxMenuBarInit()
{ {
#ifdef Q_OS_MACX #ifdef Q_WS_MACX
mac_menubar_.reset(new QMenuBar); mac_menubar_.reset(new QMenuBar);
// this is the name of the menu that contains our special entries // this is the name of the menu that contains our special entries

View File

@ -28,7 +28,7 @@
#include "debug.h" #include "debug.h"
#ifdef Q_OS_MACX #ifdef Q_WS_MACX
#include "kbmap.h" #include "kbmap.h"
#include "QLyXKeySym.h" #include "QLyXKeySym.h"
extern boost::scoped_ptr<kb_keymap> toplevel_keymap; extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
@ -147,7 +147,7 @@ string const QLPopupMenu::getLabel(MenuItem const & mi)
/// \todo Mac specific binding handling. /// \todo Mac specific binding handling.
void QLPopupMenu::addBinding(string & label, MenuItem const & mi) void QLPopupMenu::addBinding(string & label, MenuItem const & mi)
{ {
#ifndef Q_OS_MACX #ifndef Q_WS_MACX
string const binding(mi.binding()); string const binding(mi.binding());
if (!binding.empty()) { if (!binding.empty()) {
@ -177,7 +177,7 @@ void QLPopupMenu::addBinding(string & label, MenuItem const & mi)
/// \todo Fix Mac specific menu hack /// \todo Fix Mac specific menu hack
void QLPopupMenu::specialMacXmenuHack() void QLPopupMenu::specialMacXmenuHack()
{ {
#ifdef Q_OS_MACX #ifdef Q_WS_MACX
/* The qt/mac menu code has a very silly hack that /* The qt/mac menu code has a very silly hack that
moves some menu entries that it recognizes by name moves some menu entries that it recognizes by name
(e.g. "Preferences...") to the "LyX" menu. This (e.g. "Preferences...") to the "LyX" menu. This

View File

@ -43,7 +43,7 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#endif #endif
#ifdef Q_OS_MACX #ifdef Q_WS_MACX
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#include <support/lstrings.h> #include <support/lstrings.h>
using lyx::support::subst; using lyx::support::subst;
@ -185,7 +185,7 @@ QWorkArea::QWorkArea(LyXView &, int w, int h)
setInputMethodEnabled(true); setInputMethodEnabled(true);
#endif #endif
#ifdef Q_OS_X11 #ifdef Q_WS_X11
// doubleClickInterval() is 400 ms on X11 witch is just too long. // doubleClickInterval() is 400 ms on X11 witch is just too long.
// On Windows and Mac OS X, the operating system's value is used. // On Windows and Mac OS X, the operating system's value is used.
// On Microsoft Windows, calling this function sets the double // On Microsoft Windows, calling this function sets the double
@ -193,7 +193,7 @@ QWorkArea::QWorkArea(LyXView &, int w, int h)
QApplication::setDoubleClickInterval(300); QApplication::setDoubleClickInterval(300);
#endif #endif
#ifdef Q_OS_MACX #ifdef Q_WS_MACX
wa_ptr = this; wa_ptr = this;
#endif #endif
} }
@ -249,7 +249,7 @@ string const QWorkArea::getClipboard() const
lyxerr[Debug::ACTION] << "getClipboard: " << (const char*) str << endl; lyxerr[Debug::ACTION] << "getClipboard: " << (const char*) str << endl;
if (str.isNull()) if (str.isNull())
return string(); return string();
#ifdef Q_OS_MACX #ifdef Q_WS_MACX
// The MAC clipboard uses \r for lineendings, and we use \n // The MAC clipboard uses \r for lineendings, and we use \n
return subst(fromqstr(str), '\r', '\n'); return subst(fromqstr(str), '\r', '\n');
#else #else
@ -260,7 +260,7 @@ string const QWorkArea::getClipboard() const
void QWorkArea::putClipboard(string const & str) const void QWorkArea::putClipboard(string const & str) const
{ {
#ifdef Q_OS_MACX #ifdef Q_WS_MACX
// The MAC clipboard uses \r for lineendings, and we use \n // The MAC clipboard uses \r for lineendings, and we use \n
QApplication::clipboard()->setText(toqstr(subst(str, '\n', '\r')), QApplication::clipboard()->setText(toqstr(subst(str, '\n', '\r')),
QClipboard::Selection); QClipboard::Selection);
@ -390,6 +390,7 @@ void QWorkArea::mouseMoveEvent(QMouseEvent * e)
void QWorkArea::wheelEvent(QWheelEvent * e) void QWorkArea::wheelEvent(QWheelEvent * e)
{ {
verticalScrollBar()->setValue(verticalScrollBar()->value() - e->delta()); verticalScrollBar()->setValue(verticalScrollBar()->value() - e->delta());
adjustViewWithScrollBar();
} }
void QWorkArea::generateSyntheticMouseEvent() void QWorkArea::generateSyntheticMouseEvent()
@ -573,7 +574,7 @@ bool lyxX11EventFilter(XEvent * xev)
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// Mac OSX specific stuff goes here... // Mac OSX specific stuff goes here...
#ifdef Q_OS_MACX #ifdef Q_WS_MACX
namespace{ namespace{
OSErr checkAppleEventForMissingParams(const AppleEvent& theAppleEvent) OSErr checkAppleEventForMissingParams(const AppleEvent& theAppleEvent)
{ {
@ -637,4 +638,4 @@ pascal OSErr handleOpenDocuments(const AppleEvent* inEvent,
AEDisposeDesc(&documentList); AEDisposeDesc(&documentList);
return err; return err;
} }
#endif // Q_OS_MACX #endif // Q_WS_MACX

View File

@ -168,35 +168,46 @@ protected:
#endif #endif
public slots: public slots:
void keyeventTimeout(); /// Timeout event Slot for keyboard bufferring.
void adjustViewWithScrollBar(int action); /// \todo This is not used currently in the code, remove?
void keyeventTimeout();
/// Adjust the LyX buffer view with the position of the scrollbar.
/**
* The action argument is not used in the the code, it is there
* only for the connection to the vertical srollbar signal which
* emits an 'int' action.
*/
void adjustViewWithScrollBar(int action = 0);
private: private:
/// /// Buffer view width.
int workWidth_; int workWidth_;
///
/// Buffer view height.
int workHeight_; int workHeight_;
/// our painter /// Our painter.
QLPainter painter_; QLPainter painter_;
/// The slot connected to SyntheticMouseEvent::timeout. /// The slot connected to SyntheticMouseEvent::timeout.
void generateSyntheticMouseEvent(); void generateSyntheticMouseEvent();
///
SyntheticMouseEvent synthetic_mouse_event_; SyntheticMouseEvent synthetic_mouse_event_;
/// the double buffered pixmap /// the double buffered pixmap
boost::scoped_ptr<QPixmap> pixmap_; boost::scoped_ptr<QPixmap> pixmap_;
/// \todo remove
QTimer step_timer_; QTimer step_timer_;
/// \todo remove
std::queue<boost::shared_ptr<QKeyEvent> > keyeventQueue_; std::queue<boost::shared_ptr<QKeyEvent> > keyeventQueue_;
double_click dc_event_; double_click dc_event_;
bool scrolled_with_mouse_;
bool scrolled_with_keyboard_;
}; };
#endif // QWORKAREA_H #endif // QWORKAREA_H