From: jfa Date: Wed, 12 Oct 2005 14:54:36 +0000 (+0000) Subject: Now 'Erase', 'Display' and 'Display Only' items allways present in popup-menu of... X-Git-Tag: ForTest_3_1_0a2~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8867785242e2d8971381bc0cca0690cdc3a94d04;p=modules%2Fvisu.git Now 'Erase', 'Display' and 'Display Only' items allways present in popup-menu of a table object --- diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 4583e339..1caadb31 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -602,7 +602,7 @@ OnDisplayPrs() if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs"); SVTK_ViewWindow* vw = GetViewWindow( this, /*create=*/true ); - + QApplication::setOverrideCursor(Qt::waitCursor); SALOME_ListIO aList; SalomeApp_SelectionMgr* mgr = GetSelectionMgr(this); @@ -670,7 +670,7 @@ OnErasePrs() QApplication::setOverrideCursor(Qt::waitCursor); SVTK_ViewWindow* vw = GetViewWindow( this ); - if (vw) + if (vw) vw->unHighlightAll(); SALOME_ListIO aList; @@ -684,7 +684,7 @@ OnErasePrs() ErasePrs( this, anObject, false ); } - if (vw) + if (vw) vw->Repaint(); QApplication::restoreOverrideCursor(); @@ -2412,23 +2412,17 @@ createPopupMenus() // Rules - QString aSel_One_ObjBr ("client='ObjectBrowser' and selcount=1"); - QString aSel_Some_ObjBr ("client='ObjectBrowser' and selcount>0"); - QString aSel_Many_ObjBr ("client='ObjectBrowser' and selcount>1"); - QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' " "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D'"); - QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'"; - // VISU root commands - QString aRule = aSel_One_ObjBr + " and type='VISU::TVISUGEN'"; + QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'"; mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule, true ); mgr->setRule( action( VISU_IMPORT_TABLE ), aRule, true ); mgr->setRule( action( VISU_PLOT2D ), aRule, true ); // timestamp commands - aRule = aSel_One_ObjBr + " and type='VISU::TTIMESTAMP'"; + aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTIMESTAMP'"; mgr->setRule( action( VISU_SCALAR_MAP ), aRule, true ); mgr->setRule( action( VISU_ISO_SURFACES ), aRule, true ); mgr->setRule( action( VISU_CUT_PLANES ), aRule, true ); @@ -2439,19 +2433,27 @@ createPopupMenus() mgr->setRule( action( VISU_VECTORS ), aRule, true ); mgr->setRule( action( VISU_STREAM_LINES ), aRule, true ); - // table commands - //aRule = aSel_One_ObjBr + " and type='VISU::TTABLE'"; - //mgr->setRule( action( VISU_SHOW_TABLE ), aRule, true ); - //mgr->setRule( action( VISU_CREATE_CURVES ), aRule, true ); - //mgr->setRule( action( VISU_EXPORT_TABLE ), aRule, true ); + // display/erase commands + QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))"; + QString aTableOrCont = "(type='VISU::TTABLE' and nbChildren>0) or type='VISU::TCONTAINER'"; + QString orCurveVisible = "or (type='VISU::TCURVE' and isVisible)"; + QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")"; + QString aPrsVisible = "(($type in {'VISU::TMESH' " + aPrsAll + "}) and isVisible)"; + QString aPrsInvisible = "(($type in {'VISU::TMESH' " + aPrsAll + "})" + andInvisible + ")"; - aRule = "(" + aSel_Some_ObjBr + " and ((type='VISU::TTABLE' and nbChildren>0) or" - " ($type in {'VISU::TCURVE' 'VISU::TCONTAINER'}))" - ") or (selcount>0 and $type in {'VISU::TMESH' " + aPrsAll + "})"; + QString anEraseRule = "selcount>0 and (" + aPrsVisible + + " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveVisible + ")))"; - mgr->setRule( action( VISU_ERASE ), aRule + "and (isVisible=true)", true );// TODO: aRule.arg(" and isVisible=1"), true ); - mgr->setRule( action( VISU_DISPLAY ), aRule + "and ((isVisible=false and isActiveView=true) or (isActiveView=false))", true );// TODO: aRule.arg(" and isVisible=0"), true ); - mgr->setRule( action( VISU_DISPLAY_ONLY ), aRule, true ); + QString aDisplayRule = "selcount>0 and (" + aPrsInvisible + + " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveInvisible + ")))"; + + QString aDOnlyRule = "selcount>0 and (($type in {'VISU::TMESH' " + aPrsAll + "})" + " or (client='ObjectBrowser' and ((type='VISU::TTABLE' and nbChildren>0) or" + " ($type in {'VISU::TCURVE' 'VISU::TCONTAINER'}))))"; + + mgr->setRule( action( VISU_ERASE ), anEraseRule, true ); + mgr->setRule( action( VISU_DISPLAY ), aDisplayRule, true ); + mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule, true ); aRule = "selcount>0 and $type in {'VISU::TMESH' " + aPrsAll + "}"; mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule, true ); @@ -2460,7 +2462,7 @@ createPopupMenus() mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule, true ); mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule, true ); - // View parameters + // view parameters aRule = "selcount=1 and type='VISU::TVIEW3D'"; mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule, true ); mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0", true ); @@ -2507,6 +2509,8 @@ createPopupMenus() mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1", true ); // rename command + QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'"; + aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' 'VISU::TMESH' " + aCurveAll + " " + aPrsAll + "})"; mgr->setRule( action( VISU_RENAME ), aRule, true ); @@ -2519,25 +2523,25 @@ createPopupMenus() mgr->setRule( action( VISU_CURVE_PROPS ), aRule, true ); // curve container commands - aRule = aSel_One_ObjBr + " and type='VISU::TCONTAINER'"; + aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'"; mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule, true ); mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule, true ); - mgr->setRule( action( VISU_EDIT_SCALARMAP ), + mgr->setRule( action( VISU_EDIT_SCALARMAP ), "selcount=1 and type='VISU::TSCALARMAP'", true ); - mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ), + mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ), "selcount=1 and type='VISU::TDEFORMEDSHAPE'", true ); - mgr->setRule( action( VISU_EDIT_CUTPLANES ), + mgr->setRule( action( VISU_EDIT_CUTPLANES ), "selcount=1 and type='VISU::TCUTPLANES'", true ); - mgr->setRule( action( VISU_EDIT_CUTLINES ), + mgr->setRule( action( VISU_EDIT_CUTLINES ), "selcount=1 and type='VISU::TCUTLINES'", true ); - mgr->setRule( action( VISU_EDIT_ISOSURFACE ), + mgr->setRule( action( VISU_EDIT_ISOSURFACE ), "selcount=1 and type='VISU::TISOSURFACE'", true ); - mgr->setRule( action( VISU_EDIT_VECTORS ), + mgr->setRule( action( VISU_EDIT_VECTORS ), "selcount=1 and type='VISU::TVECTORS'", true ); - mgr->setRule( action( VISU_EDIT_STREAMLINES ), + mgr->setRule( action( VISU_EDIT_STREAMLINES ), "selcount=1 and type='VISU::TSTREAMLINES'", true ); - mgr->setRule( action( VISU_EDIT_PLOT3D ), + mgr->setRule( action( VISU_EDIT_PLOT3D ), "selcount=1 and type='VISU::TPLOT3D'", true ); aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0"; @@ -2546,7 +2550,7 @@ createPopupMenus() aRule = "selcount=1 and ($type in {" + aPrsAll + "})"; mgr->setRule( action( VISU_SWEEP ), aRule, true ); - // Selection info popup item + // "Selection info" popup item aRule = "client='VTKViewer' and selcount=1" + aInsideType; mgr->setRule( action( VISU_SELECTION_INFO ), aRule, true ); @@ -2888,7 +2892,7 @@ void VisuGUI::preferencesChanged( const QString&, const QString& ) SUIT_ViewManager* VisuGUI -::getViewManager(const QString& theType, +::getViewManager(const QString& theType, const bool theIsCreate) { return getApp()->getViewManager(theType,theIsCreate);