From cff314642fe97b042af9fa3db544e311e02d4e22 Mon Sep 17 00:00:00 2001 From: Michele Sottile sottile Date: Wed, 7 Apr 2010 12:55:14 +0000 Subject: [PATCH] Unsplit function --- src/meshlab_2.0/mainwindow.h | 3 +++ src/meshlab_2.0/mainwindow_Init.cpp | 4 ++++ src/meshlab_2.0/mainwindow_RunTime.cpp | 27 ++++++++++++++++++++++++-- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/meshlab_2.0/mainwindow.h b/src/meshlab_2.0/mainwindow.h index 49749d437..882718166 100644 --- a/src/meshlab_2.0/mainwindow.h +++ b/src/meshlab_2.0/mainwindow.h @@ -127,6 +127,7 @@ private slots: ///////////Slot Menu Preferences ///////////////// //void setCustomize(); void setSplit(); + void setUnsplit(); ///////////Slot Menu Help //////////////////////// /*void about(); void aboutPlugins();*/ @@ -310,6 +311,8 @@ private: ///////////Actions Menu Preferences ///////////////// QAction *setCustomizeAct; QAction *setSplitAct; + QAction *setUnsplitAct; + ///////////Actions Menu Help //////////////////////// QAction *aboutAct; QAction *aboutPluginsAct; diff --git a/src/meshlab_2.0/mainwindow_Init.cpp b/src/meshlab_2.0/mainwindow_Init.cpp index 24d0e6cde..88024f8fe 100644 --- a/src/meshlab_2.0/mainwindow_Init.cpp +++ b/src/meshlab_2.0/mainwindow_Init.cpp @@ -280,6 +280,9 @@ void MainWindow::createActions() setSplitAct = new QAction(tr("&Split view"),this); connect(setSplitAct, SIGNAL(triggered()), this, SLOT(setSplit())); + setUnsplitAct = new QAction(tr("&Close current view"),this); + connect(setUnsplitAct, SIGNAL(triggered()), this, SLOT(setUnsplit())); + //////////////Action Menu About /////////////////////////////////////////////////////////////////////////// aboutAct = new QAction(tr("&About"), this); connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); @@ -456,6 +459,7 @@ void MainWindow::createMenus() preferencesMenu=menuBar()->addMenu(tr("&Tools")); preferencesMenu->addAction(setCustomizeAct); preferencesMenu->addAction(setSplitAct); + preferencesMenu->addAction(setUnsplitAct); //////////////////// Menu Help //////////////////////////////////////////////////////////////// helpMenu = menuBar()->addMenu(tr("&Help")); diff --git a/src/meshlab_2.0/mainwindow_RunTime.cpp b/src/meshlab_2.0/mainwindow_RunTime.cpp index 9ef5c244b..28d7f3671 100644 --- a/src/meshlab_2.0/mainwindow_RunTime.cpp +++ b/src/meshlab_2.0/mainwindow_RunTime.cpp @@ -225,8 +225,8 @@ void MainWindow::updateMenus() setFancyLightingAct->setChecked(rm.fancyLighting); setDoubleLightingAct->setChecked(rm.doubleSideLighting); - setSelectFaceRenderingAct->setChecked(rm.selectedFace); - setSelectVertRenderingAct->setChecked(rm.selectedVert); + setSelectFaceRenderingAct->setChecked(rm.selectedFace); + setSelectVertRenderingAct->setChecked(rm.selectedVert); // Check only the active decorations foreach (QAction *a, PM.decoratorActionList){a->setChecked(false);a->setEnabled(true);} @@ -244,6 +244,15 @@ void MainWindow::updateMenus() } + //Viewer + if(active) { + MultiViewer_Container *mvc = qobject_cast(mdiarea->currentSubWindow()); + if(!mvc) + mvc = qobject_cast(mdiarea->currentSubWindow()->widget()); + setUnsplitAct->setEnabled(mvc->viewerCounter()>1); + setSplitAct->setEnabled(mvc->viewerCounter()<6); + } + /*if(GLA()) { showLayerDlgAct->setChecked(GLA()->layerDialog->isVisible()); @@ -1141,6 +1150,20 @@ void MainWindow::setSplit() } +void MainWindow::setUnsplit() +{ + if(mdiarea->currentSubWindow()==0) return; + MultiViewer_Container *mvc = qobject_cast(mdiarea->currentSubWindow()); + if(!mvc) + mvc = qobject_cast(mdiarea->currentSubWindow()->widget()); + + assert(mvc->viewerCounter() >1); + + mvc->removeView(mvc->currentView()->getId()); + + updateMenus(); +} + void MainWindow::renderBbox() { GLA()->setDrawMode(GLW::DMBox ); } void MainWindow::renderPoint() { GLA()->setDrawMode(GLW::DMPoints ); } void MainWindow::renderWire() { GLA()->setDrawMode(GLW::DMWire ); }