Salome HOME
Bug IPAL22924 - TC6.5.0: The View->Display mode menu doesn't work
authorvsr <vsr@opencascade.com>
Thu, 19 Apr 2012 16:23:23 +0000 (16:23 +0000)
committervsr <vsr@opencascade.com>
Thu, 19 Apr 2012 16:23:23 +0000 (16:23 +0000)
resources/Makefile.am
resources/shading.png
resources/shading_with_edges.png [new file with mode: 0644]
resources/wireframe.png [new file with mode: 0644]
src/DisplayGUI/DisplayGUI.cxx
src/DisplayGUI/DisplayGUI.h
src/GEOMGUI/GEOM_images.ts
src/GEOMGUI/GeometryGUI.cxx
src/GEOMGUI/GeometryGUI_Operations.h

index f0ffacaf072210e05f914790e2ad9fff24943e07..187ca89c6760af2f81ebec11ef2eddb270f01461 100644 (file)
@@ -149,6 +149,7 @@ section.png                 \
 select1.png                    \
 sewing.png                     \
 shading.png                    \
+shading_with_edges.png         \
 shapesonshape.png              \
 shared_shapes.png              \
 sketch.png                     \
@@ -184,6 +185,7 @@ vector.png                  \
 vector_mode.png                 \
 vector2points.png              \
 vectordxyz.png                 \
+wireframe.png                  \
 whatis.png                     \
 ellipse.png                    \
 ellipsepointvector.png         \
index 27ca4e1d16d9cc5af0256a0649e3b6a7934e0fcb..909df3d18db75ef00e0791f22d9fbb89e05bad29 100755 (executable)
Binary files a/resources/shading.png and b/resources/shading.png differ
diff --git a/resources/shading_with_edges.png b/resources/shading_with_edges.png
new file mode 100644 (file)
index 0000000..a452c54
Binary files /dev/null and b/resources/shading_with_edges.png differ
diff --git a/resources/wireframe.png b/resources/wireframe.png
new file mode 100644 (file)
index 0000000..e500831
Binary files /dev/null and b/resources/wireframe.png differ
index 6badd1c08a8a196e7dc7bd93c08fd46f51aabb83..e0e94a8eefe27d894f4a6f9c0d9937fae108f218 100644 (file)
@@ -92,29 +92,15 @@ bool DisplayGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
   SALOME_ListIO selected;
   Sel->selectedObjects( selected );
 
-  QString aDispModeName;
-  int aDispMode;
-  if ( theCommandID == GEOMOp::OpDisplayMode )
-    aDispMode = GetDisplayMode();
-
   switch ( theCommandID ) {
-  case GEOMOp::OpDisplayMode:    // MENU VIEW - DISPLAY MODE - WIREFRAME/SHADING/SHADING WITH EDGES
-    //InvertDisplayMode();
-    switch ( aDispMode) {
-    case 0:
-      aDispModeName = tr( "GEOM_MEN_WIREFRAME" );
-      break;
-    case 1:
-      aDispModeName = tr("GEOM_MEN_SHADING");
-      break;
-    case 2:
-      aDispModeName = tr("GEOM_MEN_SHADING_WITH_EDGES");
-      break;
-    default:
-      break;
-    }
-    getGeometryGUI()->action( GEOMOp::OpDisplayMode )->setText( aDispModeName );
-    getGeometryGUI()->menuMgr()->update();
+  case GEOMOp::OpDMWireframe:         // MENU VIEW - DISPLAY MODE - WIREFRAME
+    SetDisplayMode( 0 );
+    break;
+  case GEOMOp::OpDMShading:           // MENU VIEW - DISPLAY MODE - SHADING
+    SetDisplayMode( 1 );
+    break;
+  case GEOMOp::OpDMShadingWithEdges:  // MENU VIEW - DISPLAY MODE - SHADING WITH EDGES
+    SetDisplayMode( 2 );
     break;
   case GEOMOp::OpShowAll:        // MENU VIEW - SHOW ALL
     getGeometryGUI()->EmitSignalDeactivateDialog();
@@ -411,27 +397,6 @@ void DisplayGUI::SetDisplayMode( const int mode, SUIT_ViewWindow* viewWindow )
   }
 }
 
-//=====================================================================================
-// function : DisplayGUI::GetDisplayMode()
-// purpose  : Get display mode of the viewer (current viewer if <viewWindow> - 0 )
-//=====================================================================================
-int DisplayGUI::GetDisplayMode( SUIT_ViewWindow* viewWindow )
-{
-  int dispMode = 0;
-  if ( !viewWindow ) 
-    viewWindow = getGeometryGUI()->getApp()->desktop()->activeWindow();
-  if ( viewWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) {
-    SVTK_View* aView = ((SVTK_ViewWindow*)viewWindow)->getView();
-    dispMode = aView->GetDisplayMode();
-  } 
-  else if ( viewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) {
-    OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)(viewWindow->getViewManager()))->getOCCViewer();
-    Handle(AIS_InteractiveContext) ic = v3d->getAISContext();    
-    dispMode = ic->DisplayMode();
-  }
-  return dispMode;
-}
-
 //=====================================================================================
 // function : DisplayGUI::SetVectorsMode()
 // purpose  : Set vector mode for the viewer
@@ -493,16 +458,6 @@ int DisplayGUI::GetVectorMode( SUIT_ViewWindow* viewWindow )
   return viewWindow->property( "VectorsMode" ).toBool();
 }
 
-//=====================================================================================
-// function : DisplayGUI::InvertDisplayMode()
-// purpose  : Invert display mode ( shading <-> wireframe ) for the viewer 
-//            (current viewer if <viewWindow> = 0 )
-//=====================================================================================
-void DisplayGUI::InvertDisplayMode( SUIT_ViewWindow* viewWindow )
-{
-  SetDisplayMode( 1 - GetDisplayMode( viewWindow ) );
-}
-
 //=====================================================================================
 // function : DisplayGUI::ChangeDisplayMode()
 // purpose  : Set display mode for selected objects in the viewer given
index df1c1826d35a35ac5bd7fd7054af0d55b876c026..a52fe0352947c196689d17c2648c686501f86dc5 100644 (file)
@@ -59,11 +59,6 @@ public:
   // DISPLAY MODE methods : 0 - wireframe, 1 - shading
   // Set display mode for the viewer (current viewer if <viewWindow> - 0 )
   void SetDisplayMode( const int, SUIT_ViewWindow* = 0 );
-  // Get display mode of the viewer (current viewer if <viewWindow> - 0 )
-  int  GetDisplayMode( SUIT_ViewWindow* = 0 );
-  // Invert display mode ( shadin <-> wireframe ) for the viewer 
-  // (current viewer if <viewWindow> = 0 )
-  void InvertDisplayMode( SUIT_ViewWindow* = 0 );
 
   // VECTOR MODE methods
   // Set vectror mode for the viewer
index f6ae56bb975a095c2314f3bc224f1e0439afe315..98439825d7beaaff177c3e226ca2b3bd2839dd20 100644 (file)
             <source>ICO_SEWING</source>
             <translation>sewing.png</translation>
         </message>
+       <message>
+            <source>ICO_WIREFRAME</source>
+            <translation>wireframe.png</translation>
+        </message>
        <message>
             <source>ICO_SHADING</source>
             <translation>shading.png</translation>
         </message>
+       <message>
+            <source>ICO_SHADING_WITH_EDGES</source>
+            <translation>shading_with_edges.png</translation>
+        </message>
        <message>
             <source>ICO_VECTOR_MODE</source>
             <translation>vector_mode.png</translation>
index 685c6551bdc00cbd0fa2a27fdcab700c435f91c2..1a344a25453d01b721e800faf10dae466a43e29d 100644 (file)
@@ -430,7 +430,9 @@ void GeometryGUI::OnGUIEvent( int id )
   case GEOMOp::OpClsBringToFront:    //
     libName = "GEOMToolsGUI";
     break;
-  case GEOMOp::OpDisplayMode:        // MENU VIEW - WIREFRAME/SHADING
+  case GEOMOp::OpDMWireframe:        // MENU VIEW - WIREFRAME
+  case GEOMOp::OpDMShading:          // MENU VIEW - SHADING
+  case GEOMOp::OpDMShadingWithEdges: // MENU VIEW - SHADING
   case GEOMOp::OpShowAll:            // MENU VIEW - SHOW ALL
   case GEOMOp::OpShowOnly:           // MENU VIEW - DISPLAY ONLY
   case GEOMOp::OpHideAll:            // MENU VIEW - ERASE ALL
@@ -829,7 +831,9 @@ void GeometryGUI::initialize( CAM_Application* app )
   createGeomAction( GEOMOp::OpCheckGeom,        "CHECK_GEOMETRY" );
 #endif
 
-  createGeomAction( GEOMOp::OpDisplayMode,      "SHADING" );
+  createGeomAction( GEOMOp::OpDMWireframe,        "WIREFRAME" );
+  createGeomAction( GEOMOp::OpDMShading,          "SHADING" );
+  createGeomAction( GEOMOp::OpDMShadingWithEdges, "SHADING_WITH_EDGES" );
   createGeomAction( GEOMOp::OpShowAll,          "DISPLAY_ALL" );
   createGeomAction( GEOMOp::OpHideAll,          "ERASE_ALL" );
   createGeomAction( GEOMOp::OpShow,             "DISPLAY" );
@@ -1059,9 +1063,11 @@ void GeometryGUI::initialize( CAM_Application* app )
   createMenu( separator(),       viewId, -1 );
 
   int dispmodeId = createMenu( tr( "MEN_DISPLAY_MODE" ), viewId, -1 );
-  createMenu( GEOMOp::OpDisplayMode,   dispmodeId, -1 );
-  createMenu( separator(),             dispmodeId, -1 );
-  createMenu( GEOMOp::OpSwitchVectors, dispmodeId, -1 );
+  createMenu( GEOMOp::OpDMWireframe,        dispmodeId, -1 );
+  createMenu( GEOMOp::OpDMShading,          dispmodeId, -1 );
+  createMenu( GEOMOp::OpDMShadingWithEdges, dispmodeId, -1 );
+  createMenu( separator(),                  dispmodeId, -1 );
+  createMenu( GEOMOp::OpSwitchVectors,      dispmodeId, -1 );
 
   createMenu( separator(),       viewId, -1 );
   createMenu( GEOMOp::OpShowAll, viewId, -1 );
index 816c5a61c3b80db74e687b0b9fa68cbee4767ebd..80764383192432f4787026e71f732486c020ca87 100644 (file)
@@ -58,10 +58,12 @@ namespace GEOMOp {
     OpIsosWidth           = 1261,   // POPUP MENU - LINE WIDTH - ISOS WIDTH
 
     // DisplayGUI ----------------//--------------------------------
-    OpDisplayMode         = 2000,   // MENU VIEW  - DISPLAY MODE - WIREFRAME/SHADING/SHADING WITH EDGES
     OpSwitchVectors       = 2001,   // MENU VIEW  - DISPLAY MODE - SHOW/HIDE EDGE DIRECTION
     OpShowAll             = 2002,   // MENU VIEW  - SHOW ALL
     OpHideAll             = 2003,   // MENU VIEW  - HIDE ALL
+    OpDMWireframe         = 2010,   // MENU VIEW  - DISPLAY MODE - WIREFRAME
+    OpDMShading           = 2011,   // MENU VIEW  - DISPLAY MODE - SHADING
+    OpDMShadingWithEdges  = 2012,   // MENU VIEW  - DISPLAY MODE - SHADING WITH EDGES
     OpShow                = 2100,   // POPUP MENU - SHOW
     OpShowOnly            = 2101,   // POPUP MENU - SHOW ONLY
     OpHide                = 2102,   // POPUP MENU - HIDE