From c0718e321f8fc6d5db9e68d94b9929263179701a Mon Sep 17 00:00:00 2001 From: Paolo Cignoni cignoni Date: Fri, 23 Dec 2005 20:21:16 +0000 Subject: [PATCH] - Added ColorModes - ColorModes consistency between different windows --- src/meshlab/mainwindow.h | 10 +++++++++ src/meshlab/mainwindow_Init.cpp | 35 ++++++++++++++++++++++++++---- src/meshlab/mainwindow_RunTime.cpp | 21 +++++++++++++++++- 3 files changed, 61 insertions(+), 5 deletions(-) diff --git a/src/meshlab/mainwindow.h b/src/meshlab/mainwindow.h index b0bdb31b2..919b79dbb 100644 --- a/src/meshlab/mainwindow.h +++ b/src/meshlab/mainwindow.h @@ -23,6 +23,10 @@ /**************************************************************************** History $Log$ +Revision 1.52 2005/12/23 20:21:16 glvertex +- Added ColorModes +- ColorModes consistency between different windows + Revision 1.51 2005/12/22 20:01:23 glvertex - Added support for more than one shader - Some methods renamed @@ -130,6 +134,7 @@ private slots: void setLight(); void setDoubleLighting(); void setFancyLighting(); + void setColorMode(QAction *qa); void applyRenderMode(); void applyColorMode(); void applyEditMode(); @@ -226,6 +231,11 @@ private: QAction *setFancyLightingAct; QAction *setLightAct; QAction *backFaceCullAct; + + QActionGroup *colorModeGroupAct; + QAction *colorModeNoneAct; + QAction *colorModePerVertexAct; + QAction *colorModePerFaceAct; ///////////Action Menu View //////////////////////// QAction *fullScreenAct; QAction *showToolbarStandardAct; diff --git a/src/meshlab/mainwindow_Init.cpp b/src/meshlab/mainwindow_Init.cpp index 34bd8daea..1dafe8c31 100644 --- a/src/meshlab/mainwindow_Init.cpp +++ b/src/meshlab/mainwindow_Init.cpp @@ -24,6 +24,10 @@ History $Log$ +Revision 1.33 2005/12/23 20:21:16 glvertex +- Added ColorModes +- ColorModes consistency between different windows + Revision 1.32 2005/12/22 20:01:23 glvertex - Added support for more than one shader - Some methods renamed @@ -528,18 +532,41 @@ void MainWindow::createMenus() //////////////////// Menu Render ////////////////////////////////////////////////////////////////////////// renderMenu = menuBar()->addMenu(tr("&Render")); - renderModeMenu=renderMenu->addMenu(tr("Render Mode")); + renderModeMenu=renderMenu->addMenu(tr("Render &Mode")); renderModeMenu->addAction(backFaceCullAct); renderModeMenu->addActions(renderModeGroupAct->actions()); renderModeMenu->addAction(renderModeTextureAct); - lightingModeMenu=renderMenu->addMenu(tr("Lighting")); + lightingModeMenu=renderMenu->addMenu(tr("&Lighting")); lightingModeMenu->addAction(setLightAct); lightingModeMenu->addAction(setDoubleLightingAct); lightingModeMenu->addAction(setFancyLightingAct); - colorModeMenu = renderMenu->addMenu(tr("Color")); - shadersMenu = renderMenu->addMenu(tr("Shaders")); + // Color SUBmenu + colorModeMenu = renderMenu->addMenu(tr("&Color")); + + colorModeGroupAct = new QActionGroup(this); colorModeGroupAct->setExclusive(true); + + colorModeNoneAct = new QAction(QString("&None"),colorModeGroupAct); + colorModeNoneAct->setCheckable(true); + colorModeNoneAct->setChecked(true); + + colorModePerVertexAct = new QAction(QString("Per &Vertex"),colorModeGroupAct); + colorModePerVertexAct->setCheckable(true); + + colorModePerFaceAct = new QAction(QString("Per &Face"),colorModeGroupAct); + colorModePerFaceAct->setCheckable(true); + + + colorModeMenu->addAction(colorModeNoneAct); + colorModeMenu->addAction(colorModePerVertexAct); + colorModeMenu->addAction(colorModePerFaceAct); + + connect(colorModeGroupAct, SIGNAL(triggered(QAction *)), this, SLOT(setColorMode(QAction *))); + + + // Shaders SUBmenu + shadersMenu = renderMenu->addMenu(tr("&Shaders")); shadersMenu->addAction("None",this,SLOT(applyRenderMode())); //////////////////// Menu View //////////////////////////////////////////////////////////////////////////// diff --git a/src/meshlab/mainwindow_RunTime.cpp b/src/meshlab/mainwindow_RunTime.cpp index c8252ebe3..a35675b36 100644 --- a/src/meshlab/mainwindow_RunTime.cpp +++ b/src/meshlab/mainwindow_RunTime.cpp @@ -24,6 +24,10 @@ History $Log$ +Revision 1.57 2005/12/23 20:21:16 glvertex +- Added ColorModes +- ColorModes consistency between different windows + Revision 1.56 2005/12/23 02:18:05 buzzelli setting color mode according to kind of data found into opened file @@ -416,6 +420,14 @@ void MainWindow::updateWindowMenu() ++i; } } + +void MainWindow::setColorMode(QAction *qa) +{ + if(qa->text() == tr("&None")) GLA()->setColorMode(GLW::CMNone); + if(qa->text() == tr("Per &Vertex")) GLA()->setColorMode(GLW::CMPerVert); + if(qa->text() == tr("Per &Face")) GLA()->setColorMode(GLW::CMPerFace); +} + void MainWindow::updateMenus() { bool active = (bool)workspace->activeWindow(); @@ -455,6 +467,14 @@ void MainWindow::updateMenus() break; } + switch (rm.colorMode) + { + case GLW::CMNone: colorModeNoneAct->setChecked(true); break; + case GLW::CMPerVert: colorModePerVertexAct->setChecked(true); break; + case GLW::CMPerFace: colorModePerFaceAct->setChecked(true); break; + } + + showLogAct->setChecked(GLA()->isLogVisible()); showInfoPaneAct->setChecked(GLA()->isInfoAreaVisible()); showTrackBallAct->setChecked(GLA()->isTrackBallVisible()); @@ -519,7 +539,6 @@ void MainWindow::applyRenderMode() GLA()->setRenderer(0,0); //vertex and fragment programs not supported GLA()->log.Log(GLLogStream::Warning,"Shader not supported!"); } - }