1 /**************************************************************************** 2 * MeshLab o o * 3 * A versatile mesh processing toolbox o o * 4 * _ O _ * 5 * Copyright(C) 2005 \/)\/ * 6 * Visual Computing Lab /\/| * 7 * ISTI - Italian National Research Council | * 8 * \ * 9 * All rights reserved. * 10 * * 11 * This program is free software; you can redistribute it and/or modify * 12 * it under the terms of the GNU General Public License as published by * 13 * the Free Software Foundation; either version 2 of the License, or * 14 * (at your option) any later version. * 15 * * 16 * This program is distributed in the hope that it will be useful, * 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 19 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * 20 * for more details. * 21 * * 22 ****************************************************************************/ 23 #ifndef __MULTIVIEWER_CONTAINER_H__ 24 #define __MULTIVIEWER_CONTAINER_H__ 25 26 #include <GL/glew.h> 27 28 #include <QWidget> 29 #include <QGLWidget> 30 #include <QVector> 31 #include <QSplitter> 32 #include <QSplitterHandle> 33 34 #include "../common/meshmodel.h" 35 #include "../common/ml_shared_data_context.h" 36 37 // Class list 38 class GLArea; 39 class RichParameterSet; 40 class MultiViewer_Container; 41 class MainWindow; 42 43 class Splitter : public QSplitter 44 { 45 Q_OBJECT 46 47 public: 48 Splitter ( QWidget * parent); 49 Splitter(Qt::Orientation orientation, QWidget *parent = 0); ~Splitter()50 ~Splitter() {} 51 isMultiViewerContainer()52 virtual bool isMultiViewerContainer() const { return false; } 53 MultiViewer_Container *getRootContainer(); 54 55 protected: 56 QSplitterHandle *createHandle(); 57 }; 58 59 class SplitterHandle : public QSplitterHandle 60 { 61 Q_OBJECT 62 63 public: 64 SplitterHandle(Qt::Orientation orientation, QSplitter *parent); ~SplitterHandle()65 ~SplitterHandle() {} 66 67 protected: 68 void mousePressEvent ( QMouseEvent * e ); 69 }; 70 71 class MultiViewer_Container : public Splitter 72 { 73 Q_OBJECT 74 75 typedef vcg::Shot<double> Shot; 76 77 public: 78 MultiViewer_Container(vcg::QtThreadSafeMemoryInfo& meminfo,bool highprec,size_t perbatchprimitives,size_t minfacesforsmoothrendering,QWidget *parent); 79 ~MultiViewer_Container(); 80 isMultiViewerContainer()81 bool isMultiViewerContainer() const { return true; } 82 void addView(GLArea *viewer, Qt::Orientation); 83 void removeView(int); 84 85 GLArea* currentView(); 86 int getNextViewerId(); 87 int viewerCounter(); 88 89 void updateAllViewers(); 90 91 void updateAllDecoratorsForAllViewers(); 92 void resetAllTrackBall(); 93 void update(int id); 94 95 GLArea* getViewer(int id); 96 int getViewerByPicking(QPoint); 97 98 void updateTrackballInViewers(); 99 sharedDataContext()100 inline MLSceneGLSharedDataContext* sharedDataContext() {return scenecontext;} 101 102 protected: 103 void closeEvent(QCloseEvent *event); 104 public: 105 MeshDocument meshDoc; 106 MLSceneGLSharedDataContext* scenecontext; 107 108 int currentId; 109 LogPtr()110 GLLogStream *LogPtr() {return &meshDoc.Log;} 111 GLArea* currentgla; 112 signals: 113 void updateMainWindowMenus(); //updates the menus of the meshlab MainWindow 114 void updateDocumentViewer(); 115 void closingMultiViewerContainer(); 116 117 public slots: 118 119 // Called when we change viewer, set the current viewer 120 void updateCurrent(int current); 121 122 private: 123 void patchForCorrectResize(QSplitter* split); 124 public: 125 QList<GLArea *> viewerList; /// widgets for the OpenGL contexts and images 126 }; 127 128 #endif // __MULTIVIEWER_CONTAINER_H__ 129