From 6d21659ce010957e32a7e8fe0d4444b758b254fc Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Tue, 14 Mar 2006 14:50:00 +0000 Subject: [PATCH] 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 --- src/frontends/qt4/ChangeLog | 23 +++++++++++++++++------ src/frontends/qt4/QLMenubar.C | 4 ++-- src/frontends/qt4/QLPopupMenu.C | 6 +++--- src/frontends/qt4/QWorkArea.C | 15 ++++++++------- src/frontends/qt4/QWorkArea.h | 29 ++++++++++++++++++++--------- 5 files changed, 50 insertions(+), 27 deletions(-) diff --git a/src/frontends/qt4/ChangeLog b/src/frontends/qt4/ChangeLog index 7e7ad244f5..26329469eb 100644 --- a/src/frontends/qt4/ChangeLog +++ b/src/frontends/qt4/ChangeLog @@ -1,8 +1,23 @@ -2006-03-01 Jürgen Spitzmüller +2006-03-14 Abdelrazak Younes + + * 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 + + * ui/pch.h: new file + +2006-03-11 Abdelrazak Younes + + * 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 * QLMenubar.h: compile fix for gcc-4.1. -2006-03-01 Abdelrazak Younes +2006-03-10 Abdelrazak Younes * QWorkArea.[Ch] cleanup: - Added private members workWidth_ and workHeight_ in order to @@ -14,10 +29,6 @@ separate place at the end of QWorkArea.C. - initial support for Wheel mouse (still does not work). -2006-03-12 Lars Gullik Bjønnes - - * ui/pch.h: new file - 2006-03-10 Georg Baum * QWorkArea.C (getClipboard): convert MAC to UNIX line endings on OSX diff --git a/src/frontends/qt4/QLMenubar.C b/src/frontends/qt4/QLMenubar.C index d853fc5276..e7af1862eb 100644 --- a/src/frontends/qt4/QLMenubar.C +++ b/src/frontends/qt4/QLMenubar.C @@ -149,7 +149,7 @@ MenuBackend const & QLMenubar::backend() */ QMenuBar * QLMenubar::menuBar() const { -#ifdef Q_OS_MACX +#ifdef Q_WS_MACX return mac_menubar_.get(); #else return owner_->menuBar(); @@ -158,7 +158,7 @@ QMenuBar * QLMenubar::menuBar() const void QLMenubar::macxMenuBarInit() { -#ifdef Q_OS_MACX +#ifdef Q_WS_MACX mac_menubar_.reset(new QMenuBar); // this is the name of the menu that contains our special entries diff --git a/src/frontends/qt4/QLPopupMenu.C b/src/frontends/qt4/QLPopupMenu.C index ecc7d0315a..4f03b7ba75 100644 --- a/src/frontends/qt4/QLPopupMenu.C +++ b/src/frontends/qt4/QLPopupMenu.C @@ -28,7 +28,7 @@ #include "debug.h" -#ifdef Q_OS_MACX +#ifdef Q_WS_MACX #include "kbmap.h" #include "QLyXKeySym.h" extern boost::scoped_ptr toplevel_keymap; @@ -147,7 +147,7 @@ string const QLPopupMenu::getLabel(MenuItem const & mi) /// \todo Mac specific binding handling. void QLPopupMenu::addBinding(string & label, MenuItem const & mi) { -#ifndef Q_OS_MACX +#ifndef Q_WS_MACX string const binding(mi.binding()); if (!binding.empty()) { @@ -177,7 +177,7 @@ void QLPopupMenu::addBinding(string & label, MenuItem const & mi) /// \todo Fix Mac specific menu hack void QLPopupMenu::specialMacXmenuHack() { -#ifdef Q_OS_MACX +#ifdef Q_WS_MACX /* The qt/mac menu code has a very silly hack that moves some menu entries that it recognizes by name (e.g. "Preferences...") to the "LyX" menu. This diff --git a/src/frontends/qt4/QWorkArea.C b/src/frontends/qt4/QWorkArea.C index 74dc2bd84e..3ccf2b4b79 100644 --- a/src/frontends/qt4/QWorkArea.C +++ b/src/frontends/qt4/QWorkArea.C @@ -43,7 +43,7 @@ #include #endif -#ifdef Q_OS_MACX +#ifdef Q_WS_MACX #include #include using lyx::support::subst; @@ -185,7 +185,7 @@ QWorkArea::QWorkArea(LyXView &, int w, int h) setInputMethodEnabled(true); #endif -#ifdef Q_OS_X11 +#ifdef Q_WS_X11 // 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 Microsoft Windows, calling this function sets the double @@ -193,7 +193,7 @@ QWorkArea::QWorkArea(LyXView &, int w, int h) QApplication::setDoubleClickInterval(300); #endif -#ifdef Q_OS_MACX +#ifdef Q_WS_MACX wa_ptr = this; #endif } @@ -249,7 +249,7 @@ string const QWorkArea::getClipboard() const lyxerr[Debug::ACTION] << "getClipboard: " << (const char*) str << endl; if (str.isNull()) return string(); -#ifdef Q_OS_MACX +#ifdef Q_WS_MACX // The MAC clipboard uses \r for lineendings, and we use \n return subst(fromqstr(str), '\r', '\n'); #else @@ -260,7 +260,7 @@ string const QWorkArea::getClipboard() 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 QApplication::clipboard()->setText(toqstr(subst(str, '\n', '\r')), QClipboard::Selection); @@ -390,6 +390,7 @@ void QWorkArea::mouseMoveEvent(QMouseEvent * e) void QWorkArea::wheelEvent(QWheelEvent * e) { verticalScrollBar()->setValue(verticalScrollBar()->value() - e->delta()); + adjustViewWithScrollBar(); } void QWorkArea::generateSyntheticMouseEvent() @@ -573,7 +574,7 @@ bool lyxX11EventFilter(XEvent * xev) //////////////////////////////////////////////////////////////////////// // Mac OSX specific stuff goes here... -#ifdef Q_OS_MACX +#ifdef Q_WS_MACX namespace{ OSErr checkAppleEventForMissingParams(const AppleEvent& theAppleEvent) { @@ -637,4 +638,4 @@ pascal OSErr handleOpenDocuments(const AppleEvent* inEvent, AEDisposeDesc(&documentList); return err; } -#endif // Q_OS_MACX +#endif // Q_WS_MACX diff --git a/src/frontends/qt4/QWorkArea.h b/src/frontends/qt4/QWorkArea.h index 0e650ec7b8..aa1cf5b89c 100644 --- a/src/frontends/qt4/QWorkArea.h +++ b/src/frontends/qt4/QWorkArea.h @@ -168,35 +168,46 @@ protected: #endif public slots: - - void keyeventTimeout(); - void adjustViewWithScrollBar(int action); + + /// Timeout event Slot for keyboard bufferring. + /// \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: - /// + /// Buffer view width. int workWidth_; - /// + + /// Buffer view height. int workHeight_; - /// our painter + /// Our painter. QLPainter painter_; /// The slot connected to SyntheticMouseEvent::timeout. void generateSyntheticMouseEvent(); + /// SyntheticMouseEvent synthetic_mouse_event_; /// the double buffered pixmap boost::scoped_ptr pixmap_; + /// \todo remove QTimer step_timer_; + + /// \todo remove std::queue > keyeventQueue_; double_click dc_event_; - - bool scrolled_with_mouse_; - bool scrolled_with_keyboard_; }; #endif // QWORKAREA_H