00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 #ifndef QGLVIEWER_QGLVIEWER_H
00024 #define QGLVIEWER_QGLVIEWER_H
00025 
00026 #include "camera.h"
00027 
00028 #if QT_VERSION >= 0x040000
00029 # include <QMap>
00030 # include <QClipboard>
00031 #else
00032 # include <qmap.h>
00033 # include <qclipboard.h>
00034 #endif
00035 
00036 class QTabWidget;
00037 
00038 namespace qglviewer {
00039         class MouseGrabber;
00040 }
00041 
00042 #if QT_VERSION < 0x040000
00043 # define Qt::KeyboardModifiers Qt::ButtonState
00044 # define Qt::MouseButtons Qt::ButtonState
00045 # define Qt::WindowFlags Qt::WFlags
00046 #endif
00047 
00070 class QGLVIEWER_EXPORT QGLViewer : public QGLWidget
00071 {
00072         Q_OBJECT
00073 
00074 public:
00075         
00076         
00077 #if QT_VERSION < 0x040000 || defined QT3_SUPPORT
00078     explicit QGLViewer(QWidget* parent=NULL, const char* name=0, const QGLWidget* shareWidget=0, Qt::WindowFlags flags=0)
00079                 : QGLWidget(parent, name, shareWidget, flags)
00080         { defaultConstructor(); }
00081 
00082     explicit QGLViewer(const QGLFormat& format, QWidget* parent=0, const char* name=0, const QGLWidget* shareWidget=0,Qt::WindowFlags flags=0)
00083                 : QGLWidget(format, parent, name, shareWidget, flags)
00084         { defaultConstructor(); }
00085 
00086     QGLViewer(QGLContext* context, QWidget* parent, const char* name=0, const QGLWidget* shareWidget=0, Qt::WindowFlags flags=0)
00087 # if QT_VERSION >= 0x030200
00088                 : QGLWidget(context, parent, name, shareWidget, flags) {
00089 # else
00090                 
00091                 : QGLWidget(parent, name, shareWidget, flags) {
00092                         Q_UNUSED(context);
00093                         
00094 # endif
00095                         defaultConstructor(); }
00096 
00097 #else
00098 
00099     explicit QGLViewer(QWidget* parent=0, const QGLWidget* shareWidget=0, Qt::WindowFlags flags=0);
00100     explicit QGLViewer(QGLContext *context, QWidget* parent=0, const QGLWidget* shareWidget=0, Qt::WindowFlags flags=0);
00101     explicit QGLViewer(const QGLFormat& format, QWidget* parent=0, const QGLWidget* shareWidget=0, Qt::WindowFlags flags=0);
00102 #endif
00103 
00104         virtual ~QGLViewer();
00105 
00108 public:
00112         bool axisIsDrawn() const { return axisIsDrawn_; };
00116         bool gridIsDrawn() const { return gridIsDrawn_; };
00123         bool FPSIsDisplayed() const { return FPSIsDisplayed_; };
00128         bool textIsEnabled() const { return textIsEnabled_; };
00129 
00138         bool cameraIsEdited() const { return cameraIsEdited_; }
00139 
00140 
00141         public Q_SLOTS:
00143                 void setAxisIsDrawn(bool draw=true) { axisIsDrawn_ = draw; Q_EMIT axisIsDrawnChanged(draw); if (updateGLOK_) updateGL(); };
00145                 void setGridIsDrawn(bool draw=true) { gridIsDrawn_ = draw; Q_EMIT gridIsDrawnChanged(draw); if (updateGLOK_) updateGL(); };
00147                 void setFPSIsDisplayed(bool display=true) { FPSIsDisplayed_ = display; Q_EMIT FPSIsDisplayedChanged(display); if (updateGLOK_) updateGL(); };
00149                 void setTextIsEnabled(bool enable=true) { textIsEnabled_ = enable; Q_EMIT textIsEnabledChanged(enable); if (updateGLOK_) updateGL(); };
00150                 void setCameraIsEdited(bool edit=true);
00151 
00153                 void toggleAxisIsDrawn() { setAxisIsDrawn(!axisIsDrawn()); };
00155                 void toggleGridIsDrawn() { setGridIsDrawn(!gridIsDrawn()); };
00157                 void toggleFPSIsDisplayed() { setFPSIsDisplayed(!FPSIsDisplayed()); };
00159                 void toggleTextIsEnabled() { setTextIsEnabled(!textIsEnabled()); };
00161                 void toggleCameraIsEdited() { setCameraIsEdited(!cameraIsEdited()); };
00163 
00164 
00167 public:
00183         QColor backgroundColor() const { return backgroundColor_; };
00184 
00197         QColor foregroundColor() const { return foregroundColor_; };
00198         public Q_SLOTS:
00201                 void setBackgroundColor(const QColor& color) { backgroundColor_=color; qglClearColor(color); };
00203                 void setForegroundColor(const QColor& color) { foregroundColor_ = color; };
00205 
00206 
00209 public:
00221         float sceneRadius() const { return camera()->sceneRadius(); }
00230         qglviewer::Vec sceneCenter() const { return camera()->sceneCenter(); }
00231 
00232         public Q_SLOTS:
00237                 virtual void setSceneRadius(float radius) { camera()->setSceneRadius(radius); }
00238 
00243                 virtual void setSceneCenter(const qglviewer::Vec& center) { camera()->setSceneCenter(center); }
00244 
00252                 void setSceneBoundingBox(const qglviewer::Vec& min, const qglviewer::Vec& max) { camera()->setSceneBoundingBox(min,max); }
00253 
00257                 void showEntireScene() { camera()->showEntireScene(); if (updateGLOK_) updateGL(); }
00259 
00260 
00263 public:
00265         qglviewer::Camera* camera() const { return camera_; };
00266 
00277         qglviewer::ManipulatedFrame* manipulatedFrame() const { return manipulatedFrame_; };
00278 
00279         public Q_SLOTS:
00280                 void setCamera(qglviewer::Camera* const camera);
00281                 void setManipulatedFrame(qglviewer::ManipulatedFrame* frame);
00283 
00284 
00287 public:
00304         qglviewer::MouseGrabber* mouseGrabber() const { return mouseGrabber_; };
00305 
00306         void setMouseGrabberIsEnabled(const qglviewer::MouseGrabber* const mouseGrabber, bool enabled=true);
00316         bool mouseGrabberIsEnabled(const qglviewer::MouseGrabber* const mouseGrabber) { return !disabledMouseGrabbers_.contains(reinterpret_cast<size_t>(mouseGrabber)); };
00317         public Q_SLOTS:
00318                 void setMouseGrabber(qglviewer::MouseGrabber* mouseGrabber);
00320 
00321 
00324 public:
00326         float aspectRatio() const { return static_cast<float>(width())/static_cast<float>(height()); };
00337         float currentFPS() { return f_p_s_; };
00344         bool isFullScreen() const { return fullScreen_; };
00364         bool displaysInStereo() const { return stereo_; }
00366         virtual QSize sizeHint() const { return QSize(600, 400); }
00367 
00368         public Q_SLOTS:
00369                 void setFullScreen(bool fullScreen=true);
00370                 void setStereoDisplay(bool stereo=true);
00372                 void toggleFullScreen() { setFullScreen(!isFullScreen()); };
00374                 void toggleStereoDisplay() { setStereoDisplay(!stereo_); };
00375                 void toggleCameraMode();
00376 
00377 private:
00378         bool cameraIsInRevolveMode() const;
00380 
00381 
00384 public:
00385         static void drawArrow(float length=1.0f, float radius=-1.0f, int nbSubdivisions=12);
00386         static void drawArrow(const qglviewer::Vec& from, const qglviewer::Vec& to, float radius=-1.0f, int nbSubdivisions=12);
00387         static void drawAxis(float length=1.0f);
00388         static void drawGrid(float size=1.0f, int nbSubdivisions=10);
00389 
00390         virtual void startScreenCoordinatesSystem(bool upward=false) const;
00391         virtual void stopScreenCoordinatesSystem() const;
00392 
00393         void drawText(int x, int y, const QString& text, const QFont& fnt=QFont());
00394         void displayMessage(const QString& message, int delay=2000);
00395         
00396 
00397 protected:
00398         virtual void drawLight(GLenum light, float scale = 1.0f) const;
00399 
00400 private:
00401         void displayFPS();
00403         void drawVectorial() { paintGL(); };
00404 
00405 #ifndef DOXYGEN
00406         friend void drawVectorial(void* param);
00407 #endif
00408 
00409 
00410 
00411 #ifdef DOXYGEN
00412 
00414 public:
00416         int width() const;
00418         int height() const;
00420         virtual void updateGL();
00423         static QImage convertToGLFormat(const QImage & image);
00425         void qglColor(const QColor& color) const;
00427         void qglClearColor(const QColor& color) const;
00430         bool isValid() const;
00433         bool isSharing() const;
00436         virtual void makeCurrent();
00441         bool hasMouseTracking () const;
00442         public Q_SLOTS:
00444                 virtual void resize(int width, int height);
00446                 virtual void setMouseTracking(bool enable);
00447 protected:
00450         bool autoBufferSwap() const;
00451         protected Q_SLOTS:
00453                 void setAutoBufferSwap(bool on);
00455 #endif
00456 
00457 
00460 public:
00461 #if QT_VERSION < 0x030000
00462         virtual QImage grabFrameBuffer(bool withAlpha=false);
00463 #endif
00464 
00473         const QString& snapshotFileName() const { return snapshotFileName_; };
00474 #ifndef DOXYGEN
00475         const QString& snapshotFilename() const;
00476 #endif
00477 
00505         const QString& snapshotFormat() const { return snapshotFormat_; };
00511         int snapshotCounter() const { return snapshotCounter_; };
00520         int snapshotQuality() { return snapshotQuality_; };
00521 
00522         
00523         
00524         public Q_SLOTS:
00525         void saveSnapshot(bool automatic=true, bool overwrite=false);
00526 
00527         public Q_SLOTS:
00528         void saveSnapshot(const QString& fileName, bool overwrite=false);
00529         void setSnapshotFileName(const QString& name);
00530 
00532         void setSnapshotFormat(const QString& format) { snapshotFormat_ = format; };
00534         void setSnapshotCounter(int counter) { snapshotCounter_ = counter; };
00536         void setSnapshotQuality(int quality) { snapshotQuality_ = quality; };
00537         bool openSnapshotFormatDialog();
00538         void snapshotToClipboard();
00539 
00540 private:
00541         bool saveImageSnapshot(const QString& fileName);
00542         
00543 #ifndef DOXYGEN
00544         
00545 
00546 
00547 
00548 
00549         class TileRegion { public : double xMin, yMin, xMax, yMax, textScale; };
00550 #endif
00551 
00552 public:
00570         QFont scaledFont(const QFont& font) const {
00571           if (tileRegion_ == NULL)
00572             return font;
00573           else {
00574             QFont f(font);
00575             if (f.pixelSize() == -1)
00576 #if QT_VERSION >= 0x040000
00577               f.setPointSizeF(f.pointSizeF() * tileRegion_->textScale);
00578 #else
00579               f.setPointSizeFloat(f.pointSizeFloat() * tileRegion_->textScale);
00580 #endif
00581             else
00582               f.setPixelSize(f.pixelSize() * tileRegion_->textScale);
00583             return f;
00584           }
00585         }
00587 
00588 
00591 public:
00592         GLuint bufferTextureId() const;
00601         float bufferTextureMaxU() const { return bufferTextureMaxU_; };
00603         float bufferTextureMaxV() const { return bufferTextureMaxV_; };
00604         public Q_SLOTS:
00605                 void copyBufferToTexture(GLint internalFormat, GLenum format=GL_NONE);
00607 
00610 public:
00619         bool animationIsStarted() const { return animationStarted_; };
00634         int animationPeriod() const { return animationPeriod_; };
00635 
00636         public Q_SLOTS:
00638                 void setAnimationPeriod(int period) { animationPeriod_ = period; };
00639                 virtual void startAnimation();
00640                 virtual void stopAnimation();
00652                 virtual void animate() { Q_EMIT animateNeeded(); };
00654                 void toggleAnimation() { if (animationIsStarted()) stopAnimation(); else startAnimation(); };
00656 
00657 public:
00658 Q_SIGNALS:
00662         void viewerInitialized();
00663 
00668         void drawNeeded();
00669 
00681         void drawFinished(bool automatic);
00682 
00686         void animateNeeded();
00687 
00691         void helpRequired();
00692 
00694         void axisIsDrawnChanged(bool drawn);
00696         void gridIsDrawnChanged(bool drawn);
00698         void FPSIsDisplayedChanged(bool displayed);
00700         void textIsEnabledChanged(bool enabled);
00702         void cameraIsEditedChanged(bool edited);
00704         void stereoChanged(bool on);
00709         void pointSelected(const QMouseEvent* e);
00710 
00715         void mouseGrabberChanged(qglviewer::MouseGrabber* mouseGrabber);
00716 
00719 public:
00735         virtual QString helpString() const { return tr("No help available."); };
00736 
00737         virtual QString mouseString() const;
00738         virtual QString keyboardString() const;
00739 
00740 #ifndef DOXYGEN
00741 
00742         virtual QString mouseBindingsString () const { return mouseString(); }
00744         virtual QString shortcutBindingsString () const { return keyboardString(); }
00745 #endif
00746 
00747         public Q_SLOTS:
00748                 virtual void help();
00749                 virtual void aboutQGLViewer();
00750 
00751 protected:
00757         QTabWidget* helpWidget() { return helpWidget_; }
00759 
00760 
00763 protected:
00764         virtual void resizeGL(int width, int height);
00765         virtual void initializeGL();
00766 
00784         virtual void init() { Q_EMIT viewerInitialized(); };
00785 
00786         virtual void paintGL();
00787         virtual void preDraw();
00788         virtual void preDrawStereo(bool leftBuffer=true);
00789 
00805         virtual void draw() {};
00806         virtual void fastDraw();
00807         virtual void postDraw();
00809 
00812 protected:
00813         virtual void mousePressEvent(QMouseEvent *);
00814         virtual void mouseMoveEvent(QMouseEvent *);
00815         virtual void mouseReleaseEvent(QMouseEvent *);
00816         virtual void mouseDoubleClickEvent(QMouseEvent *);
00817         virtual void wheelEvent(QWheelEvent *);
00818         virtual void keyPressEvent(QKeyEvent *);
00819         virtual void timerEvent(QTimerEvent *);
00820         virtual void closeEvent(QCloseEvent *);
00822 
00825 public:
00833         int selectedName() const { return selectedObjectId_; };
00841         int selectBufferSize() const { return selectBufferSize_; };
00842 
00856         int selectRegionWidth() const { return selectRegionWidth_; };
00858         int selectRegionHeight() const { return selectRegionHeight_; };
00859 
00865         GLuint* selectBuffer() { return selectBuffer_; };
00866 
00867         public Q_SLOTS:
00868                 virtual void select(const QMouseEvent* event);
00869                 virtual void select(const QPoint& point);
00870 
00871                 void setSelectBufferSize(int size);
00873                 void setSelectRegionWidth(int width) { selectRegionWidth_ = width; };
00875                 void setSelectRegionHeight(int height) { selectRegionHeight_ = height; };
00880                 void setSelectedName(int id) { selectedObjectId_=id; };
00881 
00882 protected:
00883         virtual void beginSelection(const QPoint& point);
00906         virtual void drawWithNames() {};
00907         virtual void endSelection(const QPoint& point);
00915         virtual void postSelection(const QPoint& point) { Q_UNUSED(point); };
00917 
00918 
00921 protected:
00926         enum KeyboardAction { DRAW_AXIS, DRAW_GRID, DISPLAY_FPS, ENABLE_TEXT, EXIT_VIEWER,
00927                 SAVE_SCREENSHOT, CAMERA_MODE, FULL_SCREEN, STEREO, ANIMATION, HELP, EDIT_CAMERA,
00928                 MOVE_CAMERA_LEFT, MOVE_CAMERA_RIGHT, MOVE_CAMERA_UP, MOVE_CAMERA_DOWN,
00929                 INCREASE_FLYSPEED, DECREASE_FLYSPEED, SNAPSHOT_TO_CLIPBOARD };
00930 public:
00931     unsigned int shortcut(KeyboardAction action) const;
00932 #ifndef DOXYGEN
00933         
00934         int keyboardAccelerator(KeyboardAction action) const;
00935         Qt::Key keyFrameKey(int index) const;
00936     Qt::KeyboardModifiers playKeyFramePathStateKey() const;
00937         
00938     Qt::KeyboardModifiers addKeyFrameStateKey() const;
00939     Qt::KeyboardModifiers playPathStateKey() const;
00940 #endif
00941         Qt::Key pathKey(int index) const;
00942     Qt::KeyboardModifiers addKeyFrameKeyboardModifiers() const;
00943     Qt::KeyboardModifiers playPathKeyboardModifiers() const;
00944 
00945         public Q_SLOTS:
00946         void setShortcut(KeyboardAction action, unsigned int key);
00947 #ifndef DOXYGEN
00948                 void setKeyboardAccelerator(KeyboardAction action, int key);
00949 #endif
00950                 void setKeyDescription(int key, QString description);
00951 
00952                 
00953 #ifndef DOXYGEN
00954                 
00955                 virtual void setKeyFrameKey(int index, int key);
00956                 virtual void setPlayKeyFramePathStateKey(int buttonState);
00957                 
00958                 virtual void setPlayPathStateKey(int buttonState);
00959                 virtual void setAddKeyFrameStateKey(int buttonState);
00960 #endif
00961                 virtual void setPathKey(int key, int index = 0);
00962         virtual void setPlayPathKeyboardModifiers(Qt::KeyboardModifiers modifiers);
00963         virtual void setAddKeyFrameKeyboardModifiers(Qt::KeyboardModifiers modifiers);
00965 
00966 
00969 protected:
00974         enum MouseHandler { CAMERA, FRAME };
00975 
00980         enum ClickAction { NO_CLICK_ACTION, ZOOM_ON_PIXEL, ZOOM_TO_FIT, SELECT, RAP_FROM_PIXEL, RAP_IS_CENTER,
00981                 CENTER_FRAME, CENTER_SCENE, SHOW_ENTIRE_SCENE, ALIGN_FRAME, ALIGN_CAMERA };
00982 
00983 #ifndef DOXYGEN
00984         
00985 public:
00986 #endif
00987 
00993         enum MouseAction { NO_MOUSE_ACTION,
00994                 ROTATE, ZOOM, TRANSLATE,
00995                 MOVE_FORWARD, LOOK_AROUND, MOVE_BACKWARD,
00996                 SCREEN_ROTATE, ROLL, DRIVE,
00997                 SCREEN_TRANSLATE, ZOOM_ON_REGION };
00998 
00999 #ifdef DOXYGEN
01000 public:
01001 #endif
01002 
01003         MouseAction mouseAction(int state) const;
01004         int mouseHandler(int state) const;
01005         int mouseButtonState(MouseHandler handler, MouseAction action, bool withConstraint=true) const;
01006     ClickAction clickAction(int state, bool doubleClick, Qt::MouseButtons buttonsBefore) const;
01007     void getClickButtonState(ClickAction action, int& state, bool& doubleClick, Qt::MouseButtons& buttonsBefore) const;
01008 
01009     MouseAction wheelAction(Qt::KeyboardModifiers modifiers) const;
01010     int wheelHandler(Qt::KeyboardModifiers modifiers) const;
01011         int wheelButtonState(MouseHandler handler, MouseAction action, bool withConstraint=true) const;
01012 
01013 public Q_SLOTS:
01014     void setMouseBinding(int state, MouseHandler handler, MouseAction action, bool withConstraint=true);
01015 #if QT_VERSION < 0x030000
01016     
01017 public:
01018 #endif
01019     void setMouseBinding(int state, ClickAction action, bool doubleClick=false, Qt::MouseButtons buttonsBefore=Qt::NoButton);
01020 #if QT_VERSION < 0x030000
01021 public Q_SLOTS:
01022 #endif
01023     void setMouseBindingDescription(int state, QString description, bool doubleClick=false, Qt::MouseButtons buttonsBefore=Qt::NoButton);
01024     void setWheelBinding(Qt::KeyboardModifiers modifiers, MouseHandler handler, MouseAction action, bool withConstraint=true);
01025     void setHandlerKeyboardModifiers(MouseHandler handler, Qt::KeyboardModifiers modifiers);
01026 #ifndef DOXYGEN
01027     void setHandlerStateKey(MouseHandler handler, int buttonState);
01028     void setMouseStateKey(MouseHandler handler, int buttonState);
01029 #endif
01030 
01031 private:
01032         static QString mouseActionString(QGLViewer::MouseAction ma);
01033         static QString clickActionString(QGLViewer::ClickAction ca);
01035 
01036 
01039 public:
01040         QString stateFileName() const;
01041         virtual QDomElement domElement(const QString& name, QDomDocument& document) const;
01042 
01043         public Q_SLOTS:
01044                 virtual void initFromDOMElement(const QDomElement& element);
01045                 virtual void saveStateToFile(); 
01046                 virtual bool restoreStateFromFile();
01047 
01060                 void setStateFileName(const QString& name) { stateFileName_ = name; };
01061 
01062 #ifndef DOXYGEN
01063                 void saveToFile(const QString& fileName=QString::null);
01064                 bool restoreFromFile(const QString& fileName=QString::null);
01065 #endif
01066 
01067 private:
01068         static void saveStateToFileForAllViewers();
01070 
01071 
01074 public:
01086 #if QT_VERSION >= 0x040000
01087         static const QList<QGLViewer*>& QGLViewerPool() { return QGLViewer::QGLViewerPool_; };
01088 #else
01089         static const QPtrList<QGLViewer>& QGLViewerPool() { return QGLViewer::QGLViewerPool_; };
01090 #endif
01091 
01092 
01100 #if QT_VERSION >= 0x040000
01101         static int QGLViewerIndex(const QGLViewer* const viewer) { return QGLViewer::QGLViewerPool_.indexOf(const_cast<QGLViewer*>(viewer)); };
01102 #else
01103         static int QGLViewerIndex(const QGLViewer* const viewer) { return QGLViewer::QGLViewerPool_.findRef(viewer); };
01104 #endif
01105 
01106 
01107 #ifndef DOXYGEN
01108 
01110 public:
01111         virtual void setVisualHintsMask(int mask, int delay = 2000);
01112         virtual void drawVisualHints();
01113 
01114         public Q_SLOTS:
01115                 virtual void resetVisualHints();
01117 #endif
01118 
01119                 private Q_SLOTS:
01120                         
01121                         void delayedFullScreen() { move(prevPos_); setFullScreen(); };
01122                         void hideMessage();
01123 
01124 private:
01125         
01126         
01127         QGLViewer(const QGLViewer& v);
01128         QGLViewer& operator=(const QGLViewer& v);
01129 
01130         
01131         void defaultConstructor();
01132 
01133         void handleKeyboardAction(KeyboardAction id);
01134 
01135         
01136         qglviewer::Camera* camera_;
01137         bool cameraIsEdited_;
01138         float previousCameraZClippingCoefficient_;
01139         int previousPathId_; 
01140         void connectAllCameraKFIInterpolatedSignals(bool connection=true);
01141 
01142         
01143         QColor backgroundColor_, foregroundColor_;
01144 
01145         
01146         bool axisIsDrawn_;      
01147         bool gridIsDrawn_;      
01148         bool FPSIsDisplayed_;   
01149         bool textIsEnabled_;    
01150         bool stereo_;           
01151         bool fullScreen_;       
01152         QPoint prevPos_;        
01153 
01154         
01155         bool animationStarted_; 
01156         int animationPeriod_;   
01157         int animationTimerId_;
01158 
01159         
01160         QTime fpsTime_;
01161         unsigned int fpsCounter_;
01162         QString fpsString_;
01163         float f_p_s_;
01164 
01165         
01166         QString message_;
01167         bool displayMessage_;
01168         QTimer messageTimer_;
01169 
01170         
01171         qglviewer::ManipulatedFrame* manipulatedFrame_;
01172         bool manipulatedFrameIsACamera_;
01173 
01174         
01175         qglviewer::MouseGrabber* mouseGrabber_;
01176         bool mouseGrabberIsAManipulatedFrame_;
01177         bool mouseGrabberIsAManipulatedCameraFrame_;
01178         QMap<size_t, bool> disabledMouseGrabbers_;
01179 
01180         
01181         int selectRegionWidth_, selectRegionHeight_;
01182         int selectBufferSize_;
01183         GLuint* selectBuffer_;
01184         int selectedObjectId_;
01185 
01186         
01187         int visualHint_;
01188 
01189         
01190         void setDefaultShortcuts();
01191         QString cameraPathKeysString() const;
01192         QMap<KeyboardAction, QString> keyboardActionDescription_;
01193     QMap<KeyboardAction, unsigned int> keyboardBinding_;
01194     QMap<int, QString> keyDescription_;
01195 
01196         
01197         QMap<Qt::Key, int> pathIndex_;
01198     Qt::KeyboardModifiers addKeyFrameKeyboardModifiers_, playPathKeyboardModifiers_;
01199 
01200         
01201         GLuint bufferTextureId_;
01202         float bufferTextureMaxU_, bufferTextureMaxV_;
01203         int bufferTextureWidth_, bufferTextureHeight_;
01204         unsigned int previousBufferTextureFormat_;
01205         int previousBufferTextureInternalFormat_;
01206 
01207 #ifndef DOXYGEN
01208         
01209         struct MouseActionPrivate {
01210                 MouseHandler handler;
01211                 MouseAction action;
01212                 bool withConstraint;
01213         };
01214 
01215         
01216         struct ClickActionPrivate {
01217         Qt::KeyboardModifiers modifiers;
01218         Qt::MouseButtons button;
01219                 bool doubleClick;
01220         Qt::MouseButtons buttonsBefore; 
01221 
01222                 
01223                 bool operator<(const ClickActionPrivate& cap) const
01224                 {
01225                         if (buttonsBefore != cap.buttonsBefore)
01226                                 return buttonsBefore < cap.buttonsBefore;
01227                         else
01228                                 if (modifiers != cap.modifiers)
01229                                         return modifiers < cap.modifiers;
01230                                 else
01231                                         if (button != cap.button)
01232                                                 return button < cap.button;
01233                                         else
01234                                                 return !doubleClick && cap.doubleClick;
01235                 }
01236         };
01237 #endif
01238     static QString formatClickActionPrivate(ClickActionPrivate cap);
01239 
01240         QMap<ClickActionPrivate, QString> mouseDescription_;
01241 
01242         void setDefaultMouseBindings();
01243         void performClickAction(ClickAction ca, const QMouseEvent* const e);
01244         QMap<int, MouseActionPrivate> mouseBinding_;
01245     QMap<Qt::KeyboardModifiers, MouseActionPrivate> wheelBinding_;
01246         QMap<ClickActionPrivate, ClickAction> clickBinding_;
01247 
01248         
01249         void initializeSnapshotFormats();
01250         QImage frameBufferSnapshot();
01251         QString snapshotFileName_, snapshotFormat_;
01252         int snapshotCounter_, snapshotQuality_;
01253         TileRegion* tileRegion_;
01254 
01255         
01256 #if QT_VERSION >= 0x040000
01257         static QList<QGLViewer*> QGLViewerPool_;
01258 #else
01259         static QPtrList<QGLViewer> QGLViewerPool_;
01260 #endif
01261 
01262         
01263         QString stateFileName_;
01264 
01265         
01266         QTabWidget* helpWidget_;
01267 
01268         
01269         bool updateGLOK_;
01270 };
01271 
01272 #endif // QGLVIEWER_QGLVIEWER_H